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


IGeometryBridge.QueryGeometries Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IGeometryBridge.QueryGeometries Method

Populates the array with references to a sub-sequence of geometries.

[Visual Basic .NET]
Public Sub QueryGeometries ( _
    ByVal pGeometryCollection As IGeometryCollection, _
    ByVal Index As Integer, _
    ByRef geometries As IGeometry[] _
)
[C#]
public void QueryGeometries (
    IGeometryCollection pGeometryCollection,
    int Index,
    ref IGeometry[] geometries
);
[C++]
HRESULT QueryGeometries(
  IGeometryCollection* pGeometryCollection,
  long Index,
  Array* geometries
);
[C++]

Parameters pGeometryCollection [in]
pGeometryCollection is a parameter of type IGeometryCollection Index Index is a parameter of type long geometries [in, out] geometries is a parameter of type Array

Product Availability

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

Description

All development languages compatible version of IGeometryCollection::QueryGeometries.

[C#]

    public void QueryGeometries()
    {
        int inputLength=10;
        IGeometry[] inputGeometryArray=new IGeometry[inputLength];
        for (int i=0; i < inputLength; i++)
        {
            IPoint point=new PointClass();
            point.PutCoords(i * 10, i * 10);
            inputGeometryArray[i]=point as IGeometry;
        }
        IGeometryBridge geometryBridge=new GeometryEnvironmentClass();
        IGeometryCollection geometryCollection=new MultipointClass();
        //add geometries
        geometryBridge.AddGeometries(geometryCollection, ref inputGeometryArray);
        //query geometries starting from position 1
        int startIndex=5;
        IGeometry[] outputGeometryArray=new IGeometry[inputLength - startIndex];
        for (int i=0; i < outputGeometryArray.Length; i++)
        {
            outputGeometryArray[i]=new PointClass() as IGeometry;
        }
        geometryBridge.QueryGeometries(geometryCollection, startIndex, ref outputGeometryArray);
        for (int i=0; i < outputGeometryArray.Length; i++)
        {
            //we know that the Geometry is a Point
            IPoint currentPoint=outputGeometryArray[i] as IPoint;
            System.Windows.Forms.MessageBox.Show("X=" + currentPoint.X + ", Y=" + currentPoint.Y);
        }
    }

See Also

IGeometryBridge Interface