Maps API for JavaScript Developer's Guide

H.geo.Polygon

Class Summary

Extends: H.geo.AbstractGeometry

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.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

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.

getPoleCovering () : {H.geo.Polygon.Direction}

To obtain whether this polygon covers the North or the South Pole. See H.geo.Polygon#setPoleCovering for more details.

getExterior () : {H.geo.LineString}

To obtain the exterior ring of the polygon.

setExterior (exterior)

To set the exterior ring of the polygon.

getInteriors () : {Array<H.geo.LineString>}

To obtain a reference to the list of interior rings of the polygon.

spliceInteriors (opt_index, opt_deleteCount, var_args) : {Array<H.geo.LineString>}

Applies a splice-operation on the list of interior rings of the polygon. (see Array.prototype.splice)

removeInteriorAt (opt_index) : {(!H.geo.LineString | undefined)}

To remove an interior ring at the given index.

removeInterior (interior) : {(!H.geo.LineString | undefined)}

To remove the specified interior ring.

pushInterior (interior)

To add an interior ring.

getBounds () : {?H.geo.Rect}

Returns the bounding rectangle of the geometry.

equals (other) : {boolean}

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.

toString () : {!string}

To obtain a Well-Known-Text (WKT) representation of the geometry.

Class Description

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.

Constructor Details

H.geo.Polygon(exterior, opt_interiors)

Parameters:
 
exterior:
{H.geo.LineString}
 
The exterior ring of the polygon.
opt_interiors:
{Array<H.geo.LineString>=} [optional]
 
The interior rings of the polygon.
Throws:
 
{H.lang.InvalidArgumentError}
 
if the exterior or interiors argument is invalid.

Method Details

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.

Parameters:
 
direction:
{H.geo.Polygon.Direction}
 
The direction to set.
Returns:
 
{H.geo.Polygon}
the Polygon instance itself.

getPoleCovering () : {H.geo.Polygon.Direction}

To obtain whether this polygon covers the North or the South Pole. See H.geo.Polygon#setPoleCovering for more details.

Returns:
 
{H.geo.Polygon.Direction}

getExterior () : {H.geo.LineString}

To obtain the exterior ring of the polygon.

Returns:
 
{H.geo.LineString}

setExterior (exterior)

To set the exterior ring of the polygon.

Parameters:
 
exterior:
{H.geo.LineString}
 
The exterior ring to set

getInteriors () : {Array<H.geo.LineString>}

To obtain a reference to the list of interior rings of the polygon.

Returns:
 
{Array<H.geo.LineString>}

spliceInteriors (opt_index, opt_deleteCount, var_args) : {Array<H.geo.LineString>}

Applies a splice-operation on the list of interior rings of the polygon. (see Array.prototype.splice)

Parameters:
 
opt_index:
{number=} [optional]
 
The index at which to start changing the list, defaults to 0.
opt_deleteCount:
{number=} [optional]
 
The number of interior rings to remove, defaults to Infinity.
var_args:
{...!H.geo.LineString}
 
The interior rings to insert.
Returns:
 
{Array<H.geo.LineString>}
An array containing the removed interior rings.

removeInteriorAt (opt_index) : {(!H.geo.LineString | undefined)}

To remove an interior ring at the given index.

Parameters:
 
opt_index:
{number=} [optional]
 
The index of the interior ring to remove, defaults to 0.
Returns:
 
{(!H.geo.LineString | undefined)}
the removed interior ring or undefined if no interior ring exists at the given index.

removeInterior (interior) : {(!H.geo.LineString | undefined)}

To remove the specified interior ring.

Parameters:
 
interior:
{H.geo.LineString}
 
The interior ring to remove.
Returns:
 
{(!H.geo.LineString | undefined)}
the removed interior ring or undefined if the interior ring was not found.

pushInterior (interior)

To add an interior ring.

Parameters:
 
interior:
{H.geo.LineString}
 
The interior ring to add.
Throws:
 
{H.lang.InvalidArgumentError}
 
if the interior argument is invalid.

getBounds () : {?H.geo.Rect}

Returns the bounding rectangle of the geometry.

Returns:
 
{?H.geo.Rect}
the bounding rectangle of the geometry or null if the bounding rectangle can't be computed (e.g. for a geometry without coordinates)

equals (other) : {boolean}

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.

Parameters:
 
other:
{*}
 
The geometry to check against
Returns:
 
{boolean}
true if the two geometries are equal, otherwise false

toString () : {!string}

To obtain a Well-Known-Text (WKT) representation of the geometry.

Returns:
 
{!string}
the resulting WKT string

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.