Maps API for JavaScript Developer's Guide

H.geo.MultiGeometry

Class Summary

Extends: H.geo.AbstractGeometry

The base class for a geometry that is a container for multiple geometries of a generic type. The type of the contained geometries is specified by the generic type parameter T

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

splice (index, opt_deleteCount, opt_items) : {!Array<!T>}

This method splices the specified MultiGeometry at the provided index, removing the specified number of items at that index and inserting new items.

removeAt (index) : {!T}

Removes a contained geometry at the given index.

remove (geometry) : {T}

Removes the specified geometry from the multi-geometry

getGeometries () : {!Array<!T>}

Returns the aggregated geometries of the multi-geometry. The returned geometries must be treated as read-only to not violate the integrity of the multi-geometry.

push (geometry)

Adds the specified geometry to the current multi-geometry.

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

The base class for a geometry that is a container for multiple geometries of a generic type. The type of the contained geometries is specified by the generic type parameter T

Constructor Details

H.geo.MultiGeometry(geometries)

Parameters:
 
geometries:
{!Array<!T>}
 
The list of geometries which are initially aggregated.
Throws:
 
{H.lang.InvalidArgumentError}
 
if geometries parameter is not valid

Method Details

splice (index, opt_deleteCount, opt_items) : {!Array<!T>}

This method splices the specified MultiGeometry at the provided index, removing the specified number of items at that index and inserting new items.

Parameters:
 
index:
{number}
 
The index at which to start changing the list.
opt_deleteCount:
{number=} [optional]
 
The number of geometries to remove.
opt_items:
{!Array<!T>=} [optional]
 
The geometries to add.
Returns:
 
{!Array<!T>}
the removed geometries.

removeAt (index) : {!T}

Removes a contained geometry at the given index.

Parameters:
 
index:
{number}
 
The index of the geometry to remove.
Returns:
 
{!T}
the removed geometry.
Throws:
 
{H.lang.OutOfRangeError}
 
if no geometry exists at the given index.

remove (geometry) : {T}

Removes the specified geometry from the multi-geometry

Parameters:
 
geometry:
{T}
 
The geometry (by reference) to remove from this multi-geometry.
Returns:
 
{T}
the removed geometry or null if the geometry was not found

getGeometries () : {!Array<!T>}

Returns the aggregated geometries of the multi-geometry. The returned geometries must be treated as read-only to not violate the integrity of the multi-geometry.

Returns:
 
{!Array<!T>}
An array of geometries

push (geometry)

Adds the specified geometry to the current multi-geometry.

Parameters:
 
geometry:
{!T}
 
A geometry which will be added to the current multi-geometry
Throws:
 
{H.lang.InvalidArgumentError}
 
in case of invalid geometry argument

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