This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometryBridge Interface > IGeometryBridge.QuerySegments Method (ArcObjects .NET 10.5 SDK) |
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
All development languages compatible version of ISegmentCollection::QuerySegments .
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);
}