A polygon represents a plane figure that is defined by an exterior ring (finite chain of straight line segments) and zero or more interior rings which are rendered by using the Even–odd rule. In a simple case each interior ring represents a hole within the polygon.
Interior rings that intersects the exterior ring or that are outside the exterior ring are not supported.
| Name | Type | Description |
|---|---|---|
exterior |
H.geo.LineString |
The exterior ring of the polygon. |
opt_interiors |
Array.<!H.geo.LineString> |
optional
The interior rings of the polygon. |
Throws:
-
if the exterior or interiors argument is invalid.
Extends
Members
-
See
H.geo.Polygon#setPoleCoveringfor more details.Properties:
Name Description NORTHSOUTH
Methods
-
Checks whether the geometry is equal to the geometry supplied by the caller. Two geometries are considered as equal if they represent the same geometry type and have equal coordinate values.
Name Type Description other* The geometry to check against
Returns:
Type Description boolean trueif the two geometries are equal, otherwisefalse -
getBoundingBox ()H.geo.Rect inherited overrides
-
Returns the bounding rectangle of the geometry.
Returns:
Type Description H.geo.Rect the bounding rectangle of the geometry or nullif the bounding rectangle can't be computed (e.g. for a geometry without coordinates) -
getExterior ()H.geo.LineString
-
To obtain the exterior ring of the polygon.
Returns:
Type Description H.geo.LineString -
getInteriors ()Array.<!H.geo.LineString>
-
To obtain a reference to the list of interior rings of the polygon.
Returns:
Type Description Array.<!H.geo.LineString> -
getPoleCovering ()H.geo.Polygon.Direction
-
To obtain whether this polygon covers the North or the South Pole. See
H.geo.Polygon#setPoleCoveringfor more details.Returns:
Type Description H.geo.Polygon.Direction -
To add an interior ring.
Name Type Description interiorH.geo.LineString The interior ring to add.
Throws:
-
if the interior argument is invalid.
-
-
removeInterior (interior)H.geo.LineString | undefined
-
To remove the specified interior ring.
Name Type Description interiorH.geo.LineString The interior ring to remove.
Returns:
Type Description H.geo.LineString | undefined the removed interior ring or undefinedif the interior ring was not found. -
removeInteriorAt (opt_index)H.geo.LineString | undefined
-
To remove an interior ring at the given index.
Name Type Description opt_indexnumber optional The index of the interior ring to remove, defaults to
0.Returns:
Type Description H.geo.LineString | undefined the removed interior ring or undefinedif no interior ring exists at the given index. -
To set the exterior ring of the polygon.
Name Type Description exteriorH.geo.LineString The exterior ring to set
-
setPoleCovering (direction)H.geo.Polygon
-
To specify whether this polygon covers the North or the South Pole. This information is only needed for very special polygons that are defined as a line string around the world on longitude axis (for example along the coast of the Antarctic). In such cases, an additional information is needed to know if the southern part of the Earth (Antarctic) or the northern part (anything except Antarctic) should be covered.
Name Type Description directionH.geo.Polygon.Direction The direction to set.
Returns:
Type Description H.geo.Polygon the Polygoninstance itself. -
spliceInteriors (opt_index, opt_deleteCount, var_args)Array.<!H.geo.LineString>
-
Applies a splice-operation on the list of interior rings of the polygon.
Name Type Description opt_indexnumber optional The index at which to start changing the list, defaults to
0.opt_deleteCountnumber optional The number of interior rings to remove, defaults to
Infinity.var_argsH.geo.LineString repeatable The interior rings to insert.
Returns:
Type Description Array.<!H.geo.LineString> An array containing the removed interior rings. -
toGeoJSON ()Object inherited
-
To obtain a GeoJSON representation of the given geometry.
Returns:
Type Description Object A GeoJSON Geometry object representing the given geometry. -
toString () inherited
-
To obtain a Well-Known-Text (WKT) representation of the geometry.