Gets the number of points in the specified path of a multipart Polyline.

Namespace:  ESRI.ArcGISExplorer.Geometry

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

Syntax

C#
public int PointCount(
	int pathIndex
)
Visual Basic (Declaration)
Public Function PointCount ( _
	pathIndex As Integer _
) As Integer

Parameters

pathIndex
Type: System..::.Int32

The path to count points of.

Return Value

An integer indicating the number of points in the specified path.

Remarks

Use this method to return the number of Points in a specific path of a multipart Polyline. This method is often used with other methods which have a path index parameter; for example, a very common use is to use PointCount(int) with GetPoint(Int32, Int32) to iterate through all of the points in a path by point index number.

Alternatives are the PointCount()()() overload which counts points in the first path (ideal if using single part polylines), or the PointCountAllPaths()()() method which counts the total number of points in all paths in the Polyline.

Examples

The code below shows how to use GetPoint and PointCount overloads to enumerate over each vertex in each path of a multipart Polyline by path and point index number. The code assumes there is an existing multipart Polyline called poly. Instances of the Point class are fully-qualified to avoid namespace clashes with System.Drawing.Point.
CopyC#
// For an existing single part Polyline called pline, use PointCount to iterate points by index number.
for (int partIndx = 0; partIndx < pline.PathCount; partIndx++)
{
  for (int pointIndx = 0; pointIndx < pline.PointCount(); pointIndx++)
  {
    // Use GetPoint overload to get a copy of the specific point in the specific path.
    System.Diagnostics.Debug.WriteLine(pline.GetPoint(partIndx, pointIndx).ToString());
  }
}
CopyVB.NET
' For an existing single part Polyline called pline, use PointCount to iterate points by index number.
For partIndx As Integer = 0 To pline.PathCount - 1
    For pointIndx As Integer = 0 To pline.PointCount(partIndx) - 1
        ' Use GetPoint overload to get a copy of the specific point in the specific path.
        System.Diagnostics.Debug.WriteLine(pline.GetPoint(partIndx, pointIndx).ToString())
    Next pointIndx
Next partIndx

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeExceptionthe specified pathIndex must already exist in the Polyline.
System..::.InvalidOperationExceptionAn empty Polyline cannot return a PointCount.

See Also