Namespace:
ESRI.ArcGISExplorer.Geometry
Assembly:
ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.900 (2.0.0.900)
Syntax
C# |
---|
public void Close() |
Visual Basic (Declaration) |
---|
Public Sub Close |
Remarks
For a Polygon to be a valid polygonal shape, it must describe a closed shape - the last Point must be at the same location as the first Point. The Close method will check and, if necessary, add a new Point at the same location as the first Point; existing points are not moved.
For a multipart Polygon, the Close method will close each ring separately.
This method does not guarantee a correctly constructed (simple) Polygon; if a Polygon has been constructed from individual points it is unclear if it has been constructed to be geometrically correct, refer to the Simplify(Polygon) method.
Examples

// Create a new Polygon, allowing the default CoordinateSystem of WGS84. Polygon poly = new Polygon(); // Add a series of points to the Polygon (overloads are available to add multiple Points. poly.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33434596343321, 48.8628885302916)); poly.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33269733037166, 48.8603451299656)); poly.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33659764618658, 48.8594678571346)); poly.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.33960511237599, 48.8591968205275)); poly.AddPoint(new ESRI.ArcGISExplorer.Geometry.Point(2.340578062027, 48.8608773611669)); // Ensure the Polygon is a closed shape. poly.Close(); // Create a Note using the polygon shape. Note louvre = new Note("The Louvre", poly, Symbol.Fill.SolidOutline.Green); // Populate the Note popup information using information about the Polygon. StringBuilder info = new StringBuilder(@"<p><a href=""http://www.louvre.fr"">The Louvre, Paris</a></p>"); for (int i = 0; i < poly.PointCount(); i++) { ESRI.ArcGISExplorer.Geometry.Point pt = poly.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 Polygon, allowing the default CoordinateSystem of WGS84. Dim poly As Polygon = New Polygon() ' Add a series of points to the Polygon (overloads are available to add multiple Points. poly.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33434596343321, 48.8628885302916)) poly.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33269733037166, 48.8603451299656)) poly.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33659764618658, 48.8594678571346)) poly.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.33960511237599, 48.8591968205275)) poly.AddPoint(New ESRI.ArcGISExplorer.Geometry.Point(2.340578062027, 48.8608773611669)) ' Ensure the Polygon is a closed shape. poly.Close() ' Create a Note using the polygon shape. Dim louvre As Note = New Note("The Louvre", poly, Symbol.Fill.SolidOutline.Green) ' Populate the Note popup information using information about the Polygon. Dim info As StringBuilder = New StringBuilder("<p><a href=""http://www.louvre.fr"">The Louvre, Paris</a></p>") For i As Integer = 0 To poly.PointCount() - 1 Dim pt As ESRI.ArcGISExplorer.Geometry.Point = poly.GetPoint(i) info.AppendLine("<p>" & i.ToString() & ": " & pt.ToString() & "</p>") Next 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)
See Also
AddPoint Method
AddPoints Method
AddRing Method
Clone Method
CreateFromXmlString Method
GetLabelPoint Method
GetPerimeter Method
GetPoint Method
GetRing Method
GetRings Method
GetXmlSchema Method
InsertPoint Method
InsertPoints Method
InsertRing Method
PointCount Method
PointCountAllRings Method
RemoveAllPoints Method
RemovePointAt Method
RemovePointsAt Method
RemoveRing Method
SetPoint Method
SetPoints Method
SetRing Method
ToString Method