Gets a copy of the Point at the specified index in the specified ring of the Polygon.

Namespace:  ESRI.ArcGISExplorer.Geometry

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

Syntax

C#
public Point GetPoint(
	int ringIndex,
	int pointIndex
)
Visual Basic (Declaration)
Public Function GetPoint ( _
	ringIndex As Integer, _
	pointIndex As Integer _
) As Point

Parameters

ringIndex
Type: System..::.Int32

The index of the ring within the Polygon.
pointIndex
Type: System..::.Int32

The index of the Point within the ringIndex.

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 ringIndex within the Polygon. Polygons are created and edited by-value, therefore there is no way to get a direct reference to the same Point that exists inside the Polygon; to change one of the points in a Polygon, use the [O:ESRI.ArcGISExplorer.Geometry.Polygon.SetPoint] method.

If working with single part polygons, the GetPoint(Int32) overload is also available which works with the first ring of the Polygon.

The GetRing(Int32) and GetRings()()() 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 ring of a multipart Polygon by ring and point index number. The code assumes there is an existing multipart Polygon called poly. Instances of the Point class are fully-qualified to avoid namespace clashes with System.Drawing.Point.
CopyC#
// For an existing single part Polygon called pline, use PointCount to iterate points by index number.
for (int partIndx = 0; partIndx < pgon.RingCount; partIndx++)
{
    for (int pointIndx = 0; pointIndx < pgon.PointCount(); pointIndx++)
    {
        // Use GetPoint overload to get a copy of the specific point in the specific ring.
        System.Diagnostics.Debug.WriteLine(pgon.GetPoint(partIndx, pointIndx).ToString());
    }
}
CopyVB.NET
' For an existing single part Polygon called poly, use PointCount to iterate points by index number.
For partIndx As Integer = 0 To poly.RingCount - 1
    For pointIndx As Integer = 0 To poly.PointCount(partIndx) - 1
        ' Use GetPoint overload to get a copy of the specific point in the specific ring.
        System.Diagnostics.Debug.WriteLine(poly.GetPoint(partIndx, pointIndx).ToString())
    Next pointIndx
Next partIndx

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeExceptionThe specified ringIndex and pointIndex must exist in the Polygon.
System..::.InvalidOperationExceptionAn empty Polygon cannot return a Point.

See Also