Removes the specified path, and all of the points that compose that path, from the Polyline.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public void RemovePathAt( int pathIndex ) |
Visual Basic (Declaration) |
---|
Public Sub RemovePathAt ( _ pathIndex As Integer _ ) |
Parameters
- pathIndex
- Type: System..::.Int32
The index of the path to remove.
Remarks
RemovePath removes an entire path from the Polyline; all other existing paths within the Polyline remain unchanged. Removing a path from a Polyline changes the shape of the overall Polyline path and may result in a Polyline with gaps where previously paths were contiguous.
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 poly.
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
Exception | Condition |
---|---|
System..::.ArgumentOutOfRangeException | The specified pathIndexmust exist in the Polyline. |
See Also
[O:ESRI.ArcGISExplorer.Geometry.Polyline.RemovePointAt]
[O:ESRI.ArcGISExplorer.Geometry.Polyline.RemovePointsAt]