ArcGIS Explorer Component Help |
Polyline..::.PathCount Property |
Polyline Class Example See Also |
Gets the number of paths in this Polyline. Polylines may have one or more paths.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public int PathCount { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property PathCount As Integer |
Field Value
An integer indicating the number of paths.Remarks
Polylines may consist of one or more individual paths; those with one path are known as single part polylines, and those with more than one path are known as multipart polylines. Each path is made up of a number of points, which define the vertices of the path.
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)
See Also
[O:ESRI.ArcGISExplorer.Geometry.Polyline.PointCount]