| Package | com.esri.ags.geometry |
| Class | public class Polygon |
| Inheritance | Polygon Geometry Object |
Default MXML Propertyrings
See also
| Property | Defined By | ||
|---|---|---|---|
| extent : Extent [override] [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 [override] [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. | Polygon | ||
Returns a point specified by a ring and point in the path. | Polygon | ||
insertPoint(ringIndex:int, pointIndex:int, point:MapPoint):void
Inserts a point into the polygon. | Polygon | ||
removePoint(ringIndex:int, pointIndex:int):MapPoint
Removes a point from the polygon. | Polygon | ||
removeRing(index:int):Array
Removes a ring from the polygon. | Polygon | ||
Sets(updates) an existing point in the polygon. | Polygon | ||
| extent | property |
extent:Extent [read-only] [override] The extent of this polygon.
public function get extent():Extent| rings | property |
rings:ArrayAn array of rings where each ring is an array of two or more MapPoints.
public function get rings():Array public function set rings(value:Array):void| type | property |
type:String [read-only] [override] The type of geometry is POLYGON.
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.
Parameters
points:Array — The array of MapPoints.
|
| contains | () | method |
public function contains(point:MapPoint):BooleanChecks if a point is contained in "this" polygon. A point on the polygon line is considered in.
Parameters
point:MapPoint — The location to check for.
|
Boolean — Returns true if the polygon contains the point, false otherwise.
|
if( polygon.contains( MapPoint(graphic.geometry) ) ) | getPoint | () | method |
public function getPoint(ringIndex:int, pointIndex:int):MapPointReturns a point specified by a ring and point in the path.
Parameters
ringIndex:int — The index of a ring.
| |
pointIndex:int — The index of a point in a ring.
|
MapPoint |
| insertPoint | () | method |
public function insertPoint(ringIndex:int, pointIndex:int, point:MapPoint):voidInserts a point into the polygon.
Parameters
ringIndex: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.
Parameters
ringIndex: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.
Parameters
index: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.
Parameters
ringIndex:int — The index of the ring to update point.
| |
pointIndex:int — The index of the updated point.
| |
point:MapPoint — The updated point.
|
<esri:Graphic>
<esri:Polygon spatialReference="{new SpatialReference(4326)}">
<fx:Array>
<fx: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"/>
</fx:Array>
</fx:Array>
</esri:Polygon>
</esri:Graphic>