Gets the a copy of the points in the requested path of the Polyline.

Namespace:  ESRI.ArcGISExplorer.Geometry

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public IList<Point> GetPath(
	int pathIndex
)
Visual Basic (Declaration)
Public Function GetPath ( _
	pathIndex As Integer _
) As IList(Of Point)

Parameters

pathIndex
Type: System..::.Int32

The index of the path within the Polyline

Return Value

An enumerable generic list of points which are copies of the points in the requested path.

Remarks

GetPoint returns a copy of the Point at a specific pointIndex position within a specific pathIndex within the Polyline. polylines are created and edited by-value, therefore there is no way to get a direct reference to the same Point that exists inside the Polyline; to change one of the points in a Polyline, use the [O:ESRI.ArcGISExplorer.Geometry.Polyline.SetPoint] method.

Examples

The code below shows how the GetPath and RemovePath methods and PathCount property can be used to turn one multipart Polyline into multiple single part polylines. The code assumes there is an existing multipart Polyline called pline.
CopyC#
// Create a list to hold all the created polylines. 
System.Collections.Generic.List<Polyline> singlePrts = new System.Collections.Generic.List<Polyline>(pline.PathCount);

// Use PathCount and GetPath to iterate through every path except the first path in the Polyline.
for (int i = 1; i < pline.PathCount; i++)
{
  // Create a new Polyline from the path, and add to the list.
  Polyline newPline = new Polyline(pline.GetPath(i));
  singlePrts.Add(newPline);
}

// Remove the subsequent paths from the original Polyline and add the original Polyline to the list.
while (pline.PathCount > 1)
{
  pline.RemovePathAt(1);
}
singlePrts.Add(pline);
CopyVB.NET
' Create a list to hold all the created polylines. 
Dim singlePrts As System.Collections.Generic.List(Of Polyline) = New System.Collections.Generic.List(Of Polyline)(pline.PathCount)

' Use PathCount and GetPath to iterate through every path except the first path in the Polyline.
For i As Integer = 1 To pline.PathCount - 1
    ' Create a new Polyline from the path, and add to the list.
    Dim newPline As Polyline = New Polyline(pline.GetPath(i))
    singlePrts.Add(newPline)
Next i

' Remove the subsequent paths from the original Polyline and add the original Polyline to the list.
While pline.PathCount > 1
    pline.RemovePathAt(1)
End While
singlePrts.Add(pline)

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeExceptionThe specified pathIndex must exist in the Polyline.
System..::.InvalidOperationExceptionAn empty Polyline cannot return a path.

See Also