This document is archived and information here might be outdated. Recommended version. |
Replaces vertices/points within a PointCollection.
[Visual Basic .NET] Public Sub ReplacePoints ( _ ByVal pPointCollection As IPointCollection4, _ ByVal Index As Integer, _ ByVal goingAway As Integer, _ ByRef newPoints As IPoint[] _ )
[C#] public void ReplacePoints ( IPointCollection4 pPointCollection, int Index, int goingAway, ref IPoint[] newPoints );
[C++]
HRESULT ReplacePoints(
IPointCollection4* pPointCollection,
long Index,
long goingAway,
SAFEARRAY(IPoint)** newPoints
);
[C++] Parameters pPointCollection [in]
pPointCollection is a parameter of type IPointCollection4* Index
Index is a parameter of type long goingAway
goingAway is a parameter of type long newPoints [in]
newPoints is a parameter of type SAFEARRAY(IPoint*)*
All development languages compatible version of IPointCollection::ReplacePoints .
public void ReplacePoints()
{
int length = 10;
IPoint[] pointArray = new IPoint[length];
for (int i = 0; i < length; i++)
{
pointArray[i] = new PointClass();
pointArray[i].PutCoords(i * 10, i * 10);
}
IPointCollection4 pointCollection = new MultipointClass();
//add points to pointCollection
IGeometryBridge geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddPoints(pointCollection, ref pointArray);
//create replacement point
IPoint point3 = new PointClass();
point3.PutCoords(999, 999);
IPoint point4 = new PointClass();
point4.PutCoords(666, 666);
IPoint point5 = new PointClass();
point5.PutCoords(333, 333);
IPoint[] replacementPointArray = new IPoint[3];
replacementPointArray[0] = point3;
replacementPointArray[1] = point4;
replacementPointArray[2] = point5;
geometryBridge.ReplacePoints(pointCollection, 2, 3, ref replacementPointArray);
}