ArcGIS Explorer Component Help |
Multipoint..::.GetPoint Method |
Multipoint Class Example See Also |
Gets a copy of the Point at the specified index.
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 pointIndex ) |
Visual Basic (Declaration) |
---|
Public Function GetPoint ( _ pointIndex As Integer _ ) As Point |
Parameters
- pointIndex
- Type: System..::.Int32
The index of the Point to retrieve.
Return Value
A copy of the point.Examples
The code below shows two alternative ways to iterate through the Points comprising a Multipoint; firstly by using
GetPoint and PointCount to enumerate over each vertex in a Multipoint by point index number, and secondly by using
a foreach (For Each in Visual Basic) statement and the GetPoints method.
The code assumes there is an existing Multipoint called mpt.
Instances of the Point class are fully-qualified to avoid namespace clashes with System.Drawing.Point.
CopyC#
// For an existing single part Multipoint called mpt, GetPoint and PointCount can be used to iterate points by index number. for (int pointIndx = 0; pointIndx < mpt.PointCount; pointIndx++) { // Use GetPoint to get a copy of the specific point. System.Diagnostics.Debug.WriteLine(mpt.GetPoint(pointIndx).ToString()); } // Alternatively, Points can be iterated by using foreach. foreach (ESRI.ArcGISExplorer.Geometry.Point pt in mpt.GetPoints()) { System.Diagnostics.Debug.WriteLine(pt.ToString()); }
CopyVB.NET
' For an existing single part Multipoint called mpt, GetPoint and PointCount can be used to iterate points by index number. Dim pointIndx As Integer = 0 While pointIndx < mpt.PointCount ' Use GetPoint to get a copy of the specific point. System.Diagnostics.Debug.WriteLine(mpt.GetPoint(pointIndx).ToString()) System.Math.Max(System.Threading.Interlocked.Increment(pointIndx), pointIndx - 1) End While ' Alternatively, Points can be iterated by using foreach. For Each pt As ESRI.ArcGISExplorer.Geometry.Point In mpt.GetPoints() System.Diagnostics.Debug.WriteLine(pt.ToString()) Next
Exceptions
Exception | Condition |
---|---|
System..::.InvalidOperationException | The Multipoint must contain at least one Point to get. |