| Package | com.esri.ags.geometry |
| Class | public class Polygon |
| Inheritance | Polygon Geometry |
Default MXML Propertyrings
<esri:Graphic>
<esri:Polygon spatialReference="{new SpatialReference(4326)}">
<mx:Array>
<mx:Array>
<esri:MapPoint x="13" y="55.59"/>
<esri:MapPoint x="18.42" y="-33.92"/>
<esri:MapPoint x="-43.23" y="-22.90"/>
<esri:MapPoint x="13" y="55.59"/>
</mx:Array>
</mx:Array>
</esri:Polygon>
</esri:Graphic>See also
| Property | Defined by | ||
|---|---|---|---|
| extent : Extent
[read-only]
The extent of this polygon.
| Polygon | ||
| rings : Array
An array of rings where each ring is an array of two or more MapPoints.
| Polygon | ||
![]() | spatialReference : SpatialReference
The spatial reference of the geometry.
| Geometry | |
| type : String [read-only]
The type of geometry is POLYGON.
| Polygon | ||
| Method | Defined by | ||
|---|---|---|---|
|
Polygon(rings:Array = null, spatialReference:SpatialReference = null)
Creates a new Polygon object.
| Polygon | ||
|
addRing(points:Array):void
Adds a ring to the polygon.
| Polygon | ||
|
Checks if a point is contained in "this" polygon [added in version 1.3].
| Polygon | ||
|
Returns a point specified by a ring and point in the path [added in version 1.3].
| Polygon | ||
|
insertPoint(ringIndex:int, pointIndex:int, point:MapPoint):void
Inserts a point into the polygon [added in version 1.3].
| Polygon | ||
|
removePoint(ringIndex:int, pointIndex:int):MapPoint
Removes a point from the polygon [added in version 1.3].
| Polygon | ||
|
removeRing(index:int):Array
Removes a ring from the polygon.
| Polygon | ||
|
Sets (updates) an existing point in the polygon [added in version 1.3].
| Polygon | ||
| extent | property |
extent:Extent [read-only]The extent of this polygon.
Implementation public function get extent():Extent
| rings | property |
rings:Array [read-write]An array of rings where each ring is an array of two or more MapPoints.
Implementation public function get rings():Array
public function set rings(value:Array):void
| type | property |
type:String [read-only]The type of geometry is POLYGON.
Implementation public function get type():String
| Polygon | () | constructor |
public function Polygon(rings:Array = null, spatialReference:SpatialReference = null)Creates a new Polygon object.
Parametersrings:Array (default = null) — Array of rings (each of which is an array of MapPoints).
|
|
spatialReference:SpatialReference (default = null) — The spatial reference of the polygon.
|
| addRing | () | method |
public function addRing(points:Array):voidAdds a ring to the polygon. When added the index of the ring is incremented by one.
Parameterspoints:Array — The array of MapPoints.
|
| contains | () | method |
public function contains(point:MapPoint):BooleanChecks if a point is contained in "this" polygon [added in version 1.3]. A point exactly on the polygon line is considered contained inside the polygon.
Parameterspoint:MapPoint — The location to check for.
|
Boolean — True if the polygon contains the point, false otherwise.
|
if( polygon.contains( MapPoint(graphic.geometry) ) ) | getPoint | () | method |
public function getPoint(ringIndex:Number, pointIndex:Number):MapPointReturns a point specified by a ring and point in the path [added in version 1.3].
ParametersringIndex:Number — The index of a ring.
|
|
pointIndex:Number — The index of a point in a ring.
|
MapPoint —
A copy of the point at the specified index.
|
| insertPoint | () | method |
public function insertPoint(ringIndex:int, pointIndex:int, point:MapPoint):voidInserts a point into the polygon [added in version 1.3].
ParametersringIndex:int — The index of the ring to insert point.
|
|
pointIndex:int — The index of the inserted point.
|
|
point:MapPoint — The point to be inserted.
|
| removePoint | () | method |
public function removePoint(ringIndex:int, pointIndex:int):MapPointRemoves a point from the polygon [added in version 1.3].
ParametersringIndex:int — The index of the ring to remove point.
|
|
pointIndex:int — The index of the point to be removed.
|
MapPoint |
| removeRing | () | method |
public function removeRing(index:int):ArrayRemoves a ring from the polygon. The index specifies which ring to remove.
Parametersindex:int — The index of the ring to remove.
|
Array |
| setPoint | () | method |
public function setPoint(ringIndex:int, pointIndex:int, point:MapPoint):voidSets (updates) an existing point in the polygon [added in version 1.3].
ParametersringIndex:int — The index of the ring to update point.
|
|
pointIndex:int — The index of the updated point.
|
|
point:MapPoint — The updated point.
|