ArcObjects Library Reference (Geometry)  

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,
  Array* 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 Array

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