Assembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public sealed class Polyline : Geometry, IXmlSerializable |
Visual Basic (Declaration) |
---|
Public NotInheritable Class Polyline _ Inherits Geometry _ Implements IXmlSerializable |
Remarks
A Polyline geometry represents linear shapes, and can be used to represent geographical features such as roads, rivers, power lines or water pipes. Polylines may be found as the Geometry in a spatially-enabled Table, or as the Geometry of a Graphic.
A Polyline geometry comprises multiple Point objects; Point objects are used to build up or change a Polyline geometry (for example by using the AddPoint, InsertPoint, RemovePointAt, or SetPoint methods), or to retrieve information about the Polyline (GetPoint).
Polylines may be made up of multiple sections called paths, and there may be gaps between the different paths. A Polyline with multiple paths is known as a multipart shape. Overloaded methods are available to work specifically with multipart polylines (for example AddPoint(Int32, Point), InsertPoint(Int32, Int32, Point), RemovePointAt(Int32, Int32), SetPoint(Int32, Int32, Point), and GetPoint(Int32, Int32)).
The points of a Polyline are retrieved and set by value.
Examples
// 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);
' 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) '
Inheritance Hierarchy
ESRI.ArcGISExplorer.Geometry..::.Geometry
ESRI.ArcGISExplorer.Geometry..::.Polyline