Gets a copy of the Point at the specified index of a Polyline. If called on a multipart Polyline, gets the Point at the specified index of the first path.

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 pointIndex
)
Visual Basic (Declaration)
Public Function GetPoint ( _
	pointIndex As Integer _
) As Point

Parameters

pointIndex
Type: System..::.Int32

The index of the Point to get.

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 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 the Polyline has multiple parts (PathCount is greater than 1), then the Point is always retrieved from the first path in the Polyline; if working with multipart polylines, see the GetPoint(Int32, Int32) overload in which a path index can be specified in addition to a pointIndex.

The GetPath(Int32) and GetPaths()()() methods can be used to return multiple points in one method call.

Examples

The code below demonstrates the creation of a simple Polyline using the AddPoint method. The individual points in the Polyline are also retrieved using the GetPoint method and this information is used to add a Note with popup information to the current map in the application.
CopyC#
// Create a new Polyline, allowing the default CoordinateSystem of WGS84.
Polyline pline = new Polyline();

// Add a series of points to the Polyline (overloads are available to add multiple Points.
pline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33434596343321, 48.8628885302916));
pline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33269733037166, 48.8603451299656));
pline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33659764618658, 48.8594678571346));
pline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33960511237599, 48.8591968205275));
pline.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.340578062027, 48.8608773611669));

// Create a Note using the Polyline shape.
Note louvre = new Note("The Louvre Boundary", pline, Symbol.Fill.SolidOutline.Green);

// Populate the Note popup information using information about the Polyline.
StringBuilder info = new StringBuilder(@"<p><a href=""http://www.louvre.fr"">The Louvre, Paris</a></p>");
for (int i = 0; i < pline.PointCount(); i++)
{
  ESRI.ArcGISExplorer.Geometry.Point pt = pline.GetPoint(i);
  info.AppendLine(@"<p>" + i.ToString() + ": " + pt.ToString() + @"</p>");
}

MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
louvre.Popup.Content = info.ToString();

// Add the Note to the current Map.
disp.Map.ChildItems.Add(louvre);
CopyVB.NET
' Create a new Polyline, allowing the default CoordinateSystem of WGS84.
Dim pline As New Polyline()

' Add a series of points to the Polyline (overloads are available to add multiple Points.
pline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33434596343321, 48.8628885302916))
pline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33269733037166, 48.8603451299656))
pline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33659764618658, 48.8594678571346))
pline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33960511237599, 48.8591968205275))
pline.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.340578062027, 48.8608773611669))

' Create a Note using the Polyline shape.
Dim louvre As New Note("The Louvre Boundary", pline, Symbol.Fill.SolidOutline.Green)

' Populate the Note popup information using information about the Polyline.
Dim info As New StringBuilder("")
Dim i As Integer
For i = 0 To (pline.PointCount()) - 1
    Dim pt As ESRI.ArcGISExplorer.Geometry.Point = pline.GetPoint(i)
    info.AppendLine("<p>" & i.ToString() & ": " & pt.ToString() & "</p>")
Next i

Dim disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
louvre.Popup.Content = info.ToString()

' Add the Note to the current Map.
disp.Map.ChildItems.Add(louvre)
'

Exceptions

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

See Also