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


IGeometryBridge.ReplaceSegments Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IGeometryBridge.ReplaceSegments Method

Removes and inserts from segments.

[Visual Basic .NET]
Public Sub ReplaceSegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByVal Index As Integer, _
    ByVal goingAway As Integer, _
    ByRef newSegments As ISegment[] _
)
[C#]
public void ReplaceSegments (
    ISegmentCollection pSegmentCollection,
    int Index,
    int goingAway,
    ref ISegment[] newSegments
);
[C++]
HRESULT ReplaceSegments(
  ISegmentCollection* pSegmentCollection,
  long Index,
  long goingAway,
  Array* newSegments
);
[C++]

Parameters pSegmentCollection [in]
pSegmentCollection is a parameter of type ISegmentCollection Index Index is a parameter of type long goingAway goingAway is a parameter of type long newSegments [in] newSegments is a parameter of type Array

Product Availability

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

Description

All development languages compatible version of ISegmentCollection::ReplaceSegments .

[C#]

    public static void ReplaceSegments(ISegment[] segmentArray)
    {
        ISegmentCollection segmentCollection=new PolylineClass();
        //adds Segments to segmentCollection
        IGeometryBridge geometryBridge=new GeometryEnvironmentClass();
        geometryBridge.AddSegments(segmentCollection, ref segmentArray);
        PrintSegments(segmentCollection, "Segments before replacement");
        int replaceLength=5;
        ISegment[] replaceSegmentArray=new ISegment[replaceLength];
        for (int i=0; i < replaceLength; i++)
        {
            ILine replaceLine=new LineClass();
            IPoint replaceFromPoint=new PointClass();
            replaceFromPoint.PutCoords(i * 666, i * 666);
            IPoint replaceToPoint=new PointClass();
            replaceToPoint.PutCoords(i * 333, i * 333);
            replaceLine.PutCoords(replaceFromPoint, replaceToPoint);
            replaceSegmentArray[i]=replaceLine as ISegment;
        }
        int index=3;
        geometryBridge.ReplaceSegments(segmentCollection, index, replaceLength, ref replaceSegmentArray);
        PrintSegments(segmentCollection, "Segments after replacement");
    }

See Also

IGeometryBridge Interface