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


IGeometryBridge.QuerySegments Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometryBridge Interface > IGeometryBridge.QuerySegments Method
ArcGIS Developer Help

IGeometryBridge.QuerySegments Method

Returns references to some of the input segments.

[Visual Basic .NET]
Public Sub QuerySegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByVal Index As Integer, _
    ByRef segments As ISegment[] _
)
[C#]
public void QuerySegments (
    ISegmentCollection pSegmentCollection,
    int Index,
    ref ISegment[] segments
);
[C++]
HRESULT QuerySegments(
  ISegmentCollection* pSegmentCollection,
  long Index,
  SAFEARRAY(ISegment)** segments
);
[C++]
Parameters
pSegmentCollection [in]

pSegmentCollection is a parameter of type ISegmentCollection* Index
Index is a parameter of type long segments [in, out]
segments is a parameter of type SAFEARRAY(ISegment*)*

Product Availability

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

Description

All development languages compatible version of ISegmentCollection::QuerySegments .

[C#]

public void QuerySegments(ISegment[] segmentArray)
    {
        ISegmentCollection segmentCollection = new PolylineClass();
        //adds Segments to segmentCollection
        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();
        geometryBridge.AddSegments(segmentCollection, ref segmentArray);
        //prepare output
        int index = 0;
        ISegment[] outputSegmentArray = new ISegment[segmentCollection.SegmentCount - index];
        for (int i = 0; i < outputSegmentArray.Length; i++)
        {
            outputSegmentArray[i] = new LineClass();
        }
        //query
        geometryBridge.QuerySegments(segmentCollection, index, ref outputSegmentArray);
        String report = "";
        for (int i = 0; i < outputSegmentArray.Length; i++)
        {
            ISegment currentSegment = outputSegmentArray[i];
            ILine currentLine = currentSegment as ILine;
            report = report + "index = " + i + " , FromPoint X = " + currentLine.FromPoint.X + " , FromPoint Y = " + currentLine.FromPoint.X;
            report = report + " , ToPoint X = " + currentLine.ToPoint.X + " , ToPoint Y = " + currentLine.ToPoint.X + "\n";
        }
        System.Windows.Forms.MessageBox.Show(report);
    }

See Also

IGeometryBridge Interface