Class: PolygonE-mail This Topic Printable Version Give Us Feedback

Description

An array of rings where each ring is an array points. The first and last points of a ring must be the same.

Class hierarchy

esri.geometry.Geometry
  |_ esri.geometry.Polygon

Constructor

Constructor Description
esri.geometry.Polygon(spatialReference) Creates a new Polygon object.
esri.geometry.Polygon(json) Creates a new Polygon object using a JSON object.

Properties

Property Type Description
rings Number[][][] An array of rings. Each ring is made up of three or more points.

Methods

Method Return Value Description
addRing(points or ring or pointJson) Polygon Adds a ring to the Polygon. The ring can be one of the following: an array of numbers, an array of points, or a JSON object. When added the index of the ring is incremented by one.

The return value of Polygon was added at v1.4.
contains(point) Boolean Checks on the client if the specified point is inside the polygon. A point on the polygon line is considered in.
getExtent() Extent Returns the extent of the polygon.
getPoint(ringIndex, pointIndex) Point Returns a point specified by a ring and point in the path.
insertPoint(ringIndex, pointIndex, point) Polygon Inserts a new point into a polygon.
removeRing(ringIndex) Point[] Removes a ring from the Polygon. The index specifies which ring to remove.
setPoint(ringIndex, pointIndex, point) Polygon Updates a point in a polygon.
Constructor Detail

esri.geometry.Polygon(spatialReference)

Creates a new Polygon object.
Parameters:
<SpatialReference> spatialReference Required Spatial reference of the geometry.

esri.geometry.Polygon(json)

Creates a new Polygon object using a JSON object.
Parameters:
<Object> json Required JSON object representing the geometry.
Properties Detail

<Number[][][]> rings

An array of rings. Each ring is made up of three or more points.
See also:
addRing  
Methods Detail

addRing(points or ring or pointJson)

Adds a ring to the Polygon. The ring can be one of the following: an array of numbers, an array of points, or a JSON object. When added the index of the ring is incremented by one.

The return value of Polygon was added at v1.4.
Return value: Polygon
Input Parameters:
<Point[]> points Required An array of ESRI points to create a ring.
<Number[][]> ring Required An array of x,y coordinate pairs to create a ring.
<Object> pointJson Required A JSON object representing a ring.

contains(point)

Checks on the client if the specified point is inside the polygon. A point on the polygon line is considered in.
Return value: Boolean
Input Parameters:
<Point> point Required The location defined by an X- and Y- coordinate in map units.

getExtent()

Returns the extent of the polygon.
Return value: Extent

getPoint(ringIndex, pointIndex)

Returns a point specified by a ring and point in the path.
Return value: Point
Input Parameters:
<Number> ringIndex Required The index of a ring.
<Number> pointIndex Required The index of a point in a ring.

insertPoint(ringIndex, pointIndex, point)

Inserts a new point into a polygon. (As of v1.4)
Return value: Polygon
Input Parameters:
<Number> ringIndex Required Ring index to insert point.
<Number> pointIndex Required The index of the inserted point in the ring.
<Point> point Required Point to insert into the ring.

removeRing(ringIndex)

Removes a ring from the Polygon. The index specifies which ring to remove.
Return value: Point[]
Input Parameters:
<Number> ringIndex Required The index of the ring to remove.

setPoint(ringIndex, pointIndex, point)

Updates a point in a polygon. (As of v1.4)
Return value: Polygon
Input Parameters:
<Number> ringIndex Required Ring index for updated point.
<Number> pointIndex Required The index of the updated point in the ring.
<Point> point Required Point to update in the ring.