This document is archived and information here might be outdated.  Recommended version.


IConstructPath.ConstructRigidStretch Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IConstructPath.ConstructRigidStretch Method

Constructs a scaled, rotated version of srcPath. The point at stretchStartIndex will end up at stretchEnd. The points at startAnchor and endAnchor will remain unchanged. Others will be scaled and rotate proportionately.

[Visual Basic .NET]
Public Sub ConstructRigidStretch ( _
    ByVal srcPath As IPath, _
    ByVal stretchStartIndex As Integer, _
    ByVal startAnchor As Integer, _
    ByVal endAnchor As Integer, _
    ByVal stretchEnd As IPoint _
)
[C#]
public void ConstructRigidStretch (
    IPath srcPath,
    int stretchStartIndex,
    int startAnchor,
    int endAnchor,
    IPoint stretchEnd
);
[C++]
HRESULT ConstructRigidStretch(
  IPath* srcPath,
  long stretchStartIndex,
  long startAnchor,
  long endAnchor,
  IPoint* stretchEnd
);
[C++]

Parameters srcPath
srcPath is a parameter of type IPath stretchStartIndex stretchStartIndex is a parameter of type long startAnchor startAnchor is a parameter of type long endAnchor endAnchor is a parameter of type long stretchEnd
stretchEnd is a parameter of type IPoint

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

For an existing Path, the ConstructRigidStretch method can be used to rotate and scale the shape of a Path, or just a section of the Path, to a certain point. This method is ideal for use in interactive rubber-sheeting operations. ArcMap, for example, makes use of this method in the �Stretch geometry proportionally when moving a vertex� option.

Remarks

Parameters description:

srcPath: Input IPath object. The path to be stretched. 
stretchStartIndex: Input Long that represents the index of the origin point on the path to be stretched.
startAnchor: Input Long that represents the start anchor. Typically 0 to represent the first point on the path. 
endAnchor: Input Long that represents the end anchor. Typically pointcount-1 to represent the last point on the path. 
stretchEnd: Input IPoint object. The destination point where the strecthStartIndex point will be moved.

 

[C#]

public void ConstructRigidStretch_Example()
{
    //Create the source path
    IPath sourcePath=new PathClass();
    IPointCollection pointCollection=sourcePath as IPointCollection;
    IPoint[] points=new IPoint[5];
    for (int i=0; i < 5; i++)
    {
        points[i]=new PointClass();
    }
    points[0].PutCoords(0, 0);
    points[1].PutCoords(10, 5);
    points[2].PutCoords(20, 20);
    points[3].PutCoords(30, 35);
    points[4].PutCoords(40, 40);
    //helper class to solve C-Style Array usage in COM classes  IGeometryBridge geometryBride=new GeometryEnvironmentClass();  geometryBride.AddPoints(pointCollection as IPointCollection4, ref points);    //Strecth the whole path by specifying 0 and the last point index
    //as the start and end anchors
    //The stretch start index is 1, which means that the path will be
    //stretched by moving the second point of the path to the stretched point location
    int originOfStretch=1;
    int startAnchor=0;
    int endAnchor=pointCollection.PointCount - 1;
    //The stretchEnd point is the destination point where the point corresponding to
    //originOfStretch index will end up
    IPoint stretchEnd=new PointClass();
    stretchEnd.PutCoords(10, 30);
    //Create a new stretched path
    IConstructPath constructionPath=new PathClass();
    constructionPath.ConstructRigidStretch(sourcePath, originOfStretch, startAnchor, endAnchor, stretchEnd);
}

[Visual Basic .NET]

    'This example demonstrates how to use the ConstructRigidStretch method
    Sub ConstructRigidStretch_Example()
        Dim pSrcPath As IPath, pPointColl As IPointCollection
        Dim pPoints(4) As IPoint, i As Long
        Dim pConstPath As IConstructPath, lOriginOfStretch As Long
        Dim lStartAnchor As Long, lEndAnchor As Long
        Dim pStretchEnd As IPoint
        'Create the source path
        pSrcPath=New Path
        pPointColl=pSrcPath
        For i=0 To 4
            pPoints(i)=New Point
        Next
        pPoints(0).PutCoords(0, 0)
        pPoints(1).PutCoords(10, 5)
        pPoints(2).PutCoords(20, 20)
        pPoints(3).PutCoords(30, 35)
        pPoints(4).PutCoords(40, 40)
        pPointColl.AddPoints(5, pPoints(0))
        'Create a new stretched path
        pConstPath=New Path
        'Strecth the whole path by specifying 0 and the last point index
        'as the start and end anchors
        'The stretch start index is 1, which means that the path will be
        'stretched by moving the second point of the path to the stretched point location
        lOriginOfStretch=1 'Origin of the stretch
        lStartAnchor=0
        lEndAnchor=pPointColl.PointCount - 1
        pStretchEnd=New Point
        'The pStretchEnd point is the destination point where the point corresponding to
        'lOriginOfStrectch index will end up
        pStretchEnd.PutCoords(10, 30)
        pConstPath.ConstructRigidStretch(pSrcPath, lOriginOfStretch, lStartAnchor, lEndAnchor, pStretchEnd)
    End Sub

See Also

IConstructPath Interface