This document is archived and information here might be outdated. Recommended version. |
Copies vertices'/points' coordinates to the array of point structures.
[Visual Basic .NET] Public Sub QueryWKSPoints ( _ ByVal pPointCollection As IPointCollection4, _ ByVal Index As Integer, _ ByRef pointStructures As WKSPoint[] _ )
[C#] public void QueryWKSPoints ( IPointCollection4 pPointCollection, int Index, ref WKSPoint[] pointStructures );
[C++]
HRESULT QueryWKSPoints(
IPointCollection4* pPointCollection,
long Index,
SAFEARRAY(WKSPoint)* pointStructures
);
[C++]
Parameters pPointCollection [in]
pPointCollection is a parameter of type IPointCollection4* Index [in]
Index is a parameter of type long pointStructures [in, out]
pointStructures is a parameter of type SAFEARRAY(WKSPoint)*
public void QueryWKSPoints()
{
int length=10;
WKSPoint[] pointArray=new WKSPoint[length];
for (int i=0; i < length; i++)
{
pointArray[i]=new WKSPoint();
pointArray[i].X=i * 10;
pointArray[i].Y=i * 10;
}
IPointCollection4 pointCollection=new MultipointClass();
//adds WKSpointZs to pointCollection I
IGeometryBridge2 geometryBridge=new GeometryEnvironmentClass();
geometryBridge.AddWKSPoints(pointCollection, ref pointArray);
//prepare output
int index=5;
WKSPoint[] outPutPointArray=new WKSPoint[pointCollection.PointCount - index];
for (int i=0; i < outPutPointArray.Length; i++)
{
outPutPointArray[i]=new WKSPoint();
}
//query
geometryBridge.QueryWKSPoints(pointCollection, index, ref outPutPointArray);
String report="";
for (int i=0; i < outPutPointArray.Length; i++)
{
WKSPoint currentPoint=outPutPointArray[i];
report=report + "index=" + (i + index) + " ,X=" + currentPoint.X + " ,Y=" + currentPoint.Y + "\n";
}
System.Windows.Forms.MessageBox.Show(report);
}