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


IGeometryBridge.QueryPoints Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Geometry)  

IGeometryBridge.QueryPoints Method

Copies some points to an existing array of points.

[Visual Basic .NET]
Public Sub QueryPoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByRef Points As IPoint[] _
)
[C#]
public void QueryPoints (
    IPointCollection4 pPointCollection,
    int Index,
    ref IPoint[] Points
);
[C++]
HRESULT QueryPoints(
  IPointCollection4* pPointCollection,
  long Index,
  Array* Points
);
[C++]

Parameters pPointCollection [in]
pPointCollection is a parameter of type IPointCollection4 Index Index is a parameter of type long Points [in, out] Points is a parameter of type Array

Product Availability

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

Description

All development languages compatible version of IPointCollection::QueryPoints.

When calling this method no count parameter is needed. The length of the array parameter will be used in place of the explicit number given in the IPointCollection::QueryPoints call.  This also requires that the array parameter given to IGeometryBridge::QueryPoints can not be longer than the length of the PointCollection minus the index parameter.

[C#]

    public void QueryPoints()
    {
        //prepare inputPoints
        IPoint point1=new PointClass();
        point1.PutCoords(10, 10);
        IPoint point2=new PointClass();
        point2.PutCoords(20, 20);
        IPoint[] inputPointArray=new IPoint[2];
        inputPointArray[0]=point1;
        inputPointArray[1]=point2;
        IPointCollection4 pointCollection=new MultipointClass();

        //add points to pointCollection
        IGeometryBridge geometryBridge=new GeometryEnvironmentClass();
        geometryBridge.AddPoints(pointCollection, ref inputPointArray);
        //query Points
        int index=0;
        IPoint[] outputPointArray=new IPoint[inputPointArray.Length - index];
        for (int i=0; i < outputPointArray.Length; i++)
        {
            outputPointArray[i]=new PointClass();
        }

        geometryBridge.QueryPoints(pointCollection, index, ref outputPointArray);
        for (int i=0; i < outputPointArray.Length; i++)
        {
            IPoint currentPoint=outputPointArray[i];
            if (currentPoint == null)
            {
                System.Windows.Forms.MessageBox.Show("Current point=null");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("X=" + currentPoint.X + ", Y=" + currentPoint.Y);
            }
        }
    }

See Also

IGeometryBridge Interface