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


IGeometryBridge.ReplaceSegments Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometryBridge Interface > IGeometryBridge.ReplaceSegments Method
ArcGIS Developer Help

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,
  SAFEARRAY(ISegment)** 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 SAFEARRAY(ISegment*)*

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