ArcGIS Explorer Component Help |
Polyline..::.GetPoint Method (Int32, Int32) |
Polyline Class Example See Also |
Gets a copy of the Point at the specified index in the specified path of the Polyline.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public Point GetPoint( int pathIndex, int pointIndex ) |
Visual Basic (Declaration) |
---|
Public Function GetPoint ( _ pathIndex As Integer, _ pointIndex As Integer _ ) As Point |
Parameters
- pathIndex
- Type: System..::.Int32
The index of the path within the Polyline.
- pointIndex
- Type: System..::.Int32
The index of the path within the pathIndex.
Return Value
A copy of the Point at the specified position.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.
If working with single part polylines, the GetPoint(Int32) overload is also available which works with the first path of the Polyline.
The GetPath(Int32) and GetPaths()()() methods can be used to return multiple points in one method call.
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 pline. 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
Exception | Condition |
---|---|
System..::.ArgumentOutOfRangeException | The specified pathIndex and pointIndex must exist in the Polyline. |
System..::.InvalidOperationException | An empty Polyline cannot return a Point. |