ESRI.ArcGIS.Mobile
Polygon Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.Mobile.Geometries Namespace : Polygon Class

A geometry representing an ordered sequence of points which describe a closed figure.

Object Model



Syntax

Visual Basic (Declaration) 
Public NotInheritable Class Polygon 
   Inherits Geometry
   Implements IBoundableIGeometryIGeometryConstruction 
C# 
public sealed class Polygon : Geometry, IBoundableIGeometryIGeometryConstruction  

Example

an example showing add a shell and a hole to a polygon.
C#Copy Code
// creates a new polygon 
Polygon polygon = new Polygon(); 
  
// creates a ring (unclosed) in clockwise order 
CoordinateCollection ccbig = new CoordinateCollection(); 
ccbig.Add(0, 0);        ccbig.Add(0,1000.0); 
ccbig.Add(1000.0, 1000.0);  ccbig.Add(1000.0, 0); 
// ccbig is not closed 
  
polygon.AddPart(ccbig); 
//AddPart closes it (the first vertex is appended to the end), now the polygon has a closed shell 
Debug.WriteLine(polygon.ShellCount.ToString());   // 1 
Debug.WriteLine(polygon.IsValid.ToString());            // true 
  
// creates a ring (unclosed) in clockwise order 
CoordinateCollection ccsm = new CoordinateCollection(); 
ccsm.Add(10.0, 10.0);   ccsm.Add(10.0, 100.0); 
ccsm.Add(100.0, 100.0); ccsm.Add(100.0, 10.0); 
//ccsm.Add(10.0, 10.0); 
polygon.AddHole(ccsm); 
  
// gets the first hole of the first shell in the polygon 
// AddHole makes ccsm a closed hole. the coordiantes are reversed 
CoordinateCollection thehole = polygon.GetHoles(0)[0]; 
foreach (Coordinate c in thehole) 
    Debug.WriteLine(c.ToString()); 
// output:  
//Coordinate, x:100.0 y:10.0 
//Coordinate, x:100.0 y:100.0 
//Coordinate, x:10.0 y:100.0 
//Coordinate, x:10.0 y:10.0 
//Coordinate, x:100.0 y:10.0 
  
Debug.WriteLine(polygon.PartCount.ToString());  // 2 
    

Remarks

Represents a collection of rings ordered by their containment relationship. The rings do not need to be connected to or contained by other rings in the polygon.

A ring is a shell if coordinates are organized in clockwise order, otherwise is a hole.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.Mobile.Geometries.Geometry
      ESRI.ArcGIS.Mobile.Geometries.Polygon

Requirements

Namespace: ESRI.ArcGIS.Mobile.Geometries

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

Assembly: ESRI.ArcGIS.Mobile (in ESRI.ArcGIS.Mobile.dll)

See Also