This document is archived and information here might be outdated. Recommended version. |
Replaces all segments with references to the input segments.
[Visual Basic .NET] Public Sub SetSegments ( _ ByVal pSegmentCollection As ISegmentCollection, _ ByRef newSegments As ISegment[] _ )
[C#] public void SetSegments ( ISegmentCollection pSegmentCollection, ref ISegment[] newSegments );
[C++]
HRESULT SetSegments(
ISegmentCollection* pSegmentCollection,
SAFEARRAY(ISegment)** newSegments
);
[C++] Parameters pSegmentCollection [in]
pSegmentCollection is a parameter of type ISegmentCollection* newSegments [in]
newSegments is a parameter of type SAFEARRAY(ISegment*)*
All development languages compatible version of ISegmentCollection::SetSegments .
public static void SetSegments(ISegment[] segmentArray)
{
ISegmentCollection segmentCollection = new PolylineClass();
//adds Segments to segmentCollection
IGeometryBridge geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddSegments(segmentCollection, ref segmentArray);
int insertLength = 5;
ISegment[] insertSegmentArray = new ISegment[insertLength];
for (int i = 0; i < insertLength; i++)
{
ILine insertLine = new LineClass();
IPoint insertFromPoint = new PointClass();
insertFromPoint.PutCoords(i * 666, i * 666);
IPoint insertToPoint = new PointClass();
insertToPoint.PutCoords(i * 333, i * 333);
insertLine.PutCoords(insertFromPoint, insertToPoint);
insertSegmentArray[i] = insertLine as ISegment;
}
geometryBridge.SetSegments(segmentCollection, ref insertSegmentArray);
}