Maps API for JavaScript Developer's Guide

H.map.Rect

Class Summary

Extends: H.map.Polygon

A Rect is a visual representation of a rectangular shaped surface on a map.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

setBounds (bounds)

This method sets the bounds of the given rectangle.

getGeometry () : {(H.geo.Polygon | H.geo.MultiPolygon)}

To obtain the polygon's geometry. If you modify the obtained geometry, you must call setGeometry afterwards to not violate the integrity of the polygon.

setGeometry (geometry) : {H.map.Polygon}

To set the polygon's geometry. If the given geometry is modified afterwards, it must be set via setGeometry again to not violate the integrity of the polygon.

setNorthPoleCovering (flag) : {H.map.Polygon}

To specify whether this polygon covers the North or the South Pole. This information is only needed for very special Polygons whose geometry is 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 (Antarctic) or the northern part (anything except Antarctic) should be covered. Be aware, that this deprecated method has no effect if the current geometry is a MultiPolygon.

getNorthPoleCovering () : {boolean}

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

clip (geoRect, projection) : {Array<Array<number>>}

This method clips the given polygon to a rectangular area. The method takes polygons crossing the International Date Line into account to duplicate the shape in the returned list of intersecting line-strings.

getStrip () : {H.geo.Strip}

Returns the geometry.

setStrip (strip) : {H.map.GeoShape}

Sets the geometry.

getBounds () : {H.geo.Rect}

Returns the smallest rectangle which encloses the whole geometry of the GeoShape.

getStyle () : {H.map.SpatialStyle}

This method retrieves the drawing style of the given spatial object. The returned style is treated as immutable and must not be modified afterwards to prevent inconsistencies!

setStyle (opt_style) : {H.map.Spatial}

This method sets the drawing style of the given spatial object. If the argument opt_style is an instance of H.map.SpatialStyle, it is treated as immutable and must not be modified afterwards to prevent inconsistencies! .

getArrows () : {(H.map.ArrowStyle | undefined)}

This method retrieves the arrow style of the given spatial object or undefined if the style is not defined. The returned arrow style is treated as immutable and must not be modified afterwards to prevent inconsistencies!

setArrows (opt_arrows) : {H.map.Spatial}

This method sets the arrow style of the given spatial object.

isClosed () : {boolean}

This method indicates whether this spatial object represents a closed shape.

getId () : {*}

This method retrieves the ID of the given object.

setVisibility (opt_visibility) : {H.map.Object}

This method sets the visibility of the given object.

getVisibility (opt_effective) : {boolean}

This method retrieves a value indicating the visibility of the given object.

getZIndex () : {(number | undefined)}

This method retrieves the z-index of the given object.

setZIndex (zIndex) : {H.map.Object}

This method sets the z-index of the given object.

compareZOrder (other) : {number}

This method compares the rendering z-order of the given object with another object. (The 'given object' mean the object on which the method has been invoke.)

getParentGroup () : {?H.map.Group}

This method retrieves the parent group which contains the given object or null if the object is not contained in any group.

getRootGroup () : {!H.map.Object}

The root object to which the given object is attached or the object itself if it is not attached to another.

contains (object) : {boolean}

This method checks whether the received object is an inclusive descendant of the given object.

getProvider () : {?H.map.provider.ObjectProvider}

This method obtains the current provider of the given object.

getInvalidations () : {H.map.provider.Invalidations}

This method retrieves the invalidation states for the given object.

invalidate (flags) : {boolean}

This method invalidates the given map object.

getData () : {*}

This method retrieves previously stored arbitrary data from the given object.

setData (data) : {H.map.Object}

This method stores arbitrary data with the given map object.

addEventListener (type, handler, opt_capture, opt_scope)

This method adds a listener for a specific event.

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the EventTarget instance.

dispatchEvent (evt)

This method dispatches an event on the EventTarget object.

dispose ()

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds a callback which is triggered when the EventTarget object is being disposed.

Events Summary

Table 2. Events
Events

stripchange : {H.util.ChangeEvent}

Fired when the geometry of the GeoShape has been changed.

stylechange : {H.util.ChangeEvent}

Event fired when the style of the given spatial object changes.

visibilitychange : {H.util.ChangeEvent}

Event fired when the visibility of the given object changes.

zindexchange : {H.util.ChangeEvent}

Event fired when the z-index of the given object changes.

Class Description

A Rect is a visual representation of a rectangular shaped surface on a map.

Constructor Details

H.map.Rect(bounds, opt_options)

Parameters:
 
bounds:
{H.geo.Rect}
 
The geographical bounding box for the rectangle
opt_options:
{H.map.Spatial.Options=} [optional]
 
An object containing configuration options.

Method Details

setBounds (bounds)

This method sets the bounds of the given rectangle.

Parameters:
 
bounds:
{H.geo.Rect}
 
A rectangle defining the bounds for the rectangle

getGeometry () : {(H.geo.Polygon | H.geo.MultiPolygon)}

To obtain the polygon's geometry. If you modify the obtained geometry, you must call setGeometry afterwards to not violate the integrity of the polygon.

Returns:
 
{(H.geo.Polygon | H.geo.MultiPolygon)}

setGeometry (geometry) : {H.map.Polygon}

To set the polygon's geometry. If the given geometry is modified afterwards, it must be set via setGeometry again to not violate the integrity of the polygon.

Parameters:
 
geometry:
{(H.geo.Polygon | H.geo.MultiPolygon)}
 
Returns:
 
{H.map.Polygon}

setNorthPoleCovering (flag) : {H.map.Polygon}

To specify whether this polygon covers the North or the South Pole. This information is only needed for very special Polygons whose geometry is 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 (Antarctic) or the northern part (anything except Antarctic) should be covered. Be aware, that this deprecated method has no effect if the current geometry is a MultiPolygon.

Deprecated:
since 3.0.15.0, use {@link H.geo.Polygon#setPoleCovering} instead.
Parameters:
 
flag:
{boolean}
 
A value of true means it covers the North Pole, false means the South Pole
Returns:
 
{H.map.Polygon}
An object representing the given Polygon instance

getNorthPoleCovering () : {boolean}

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

Deprecated:
since 3.0.15.0, use {@link H.geo.Polygon#getPoleCovering} instead.
Returns:
 
{boolean}

clip (geoRect, projection) : {Array<Array<number>>}

This method clips the given polygon to a rectangular area. The method takes polygons crossing the International Date Line into account to duplicate the shape in the returned list of intersecting line-strings.

Deprecated:
since 3.0.5.1
Parameters:
 
geoRect:
{H.geo.Rect}
 
The rectangular area to which to clip the polygon
projection:
{H.geo.PixelProjection}
 
A projection to use for bounding box padding
Returns:
 
{Array<Array<number>>}
A list of arrays, each represents connected line segments which intersect with the clipping rectangle. The connected line segments are represented as alternating latitude and longitude coordinates.

getStrip () : {H.geo.Strip}

Returns the geometry.

Deprecated:
since 3.0.15.0
Returns:
 
{H.geo.Strip}
spatial object.

setStrip (strip) : {H.map.GeoShape}

Sets the geometry.

Deprecated:
since 3.0.15.0
Parameters:
 
strip:
{H.geo.Strip}
 
The strip which represents geometry.
Returns:
 
{H.map.GeoShape}
The given spatial object

getBounds () : {H.geo.Rect}

Returns the smallest rectangle which encloses the whole geometry of the GeoShape.

Returns:
 
{H.geo.Rect}

getStyle () : {H.map.SpatialStyle}

This method retrieves the drawing style of the given spatial object. The returned style is treated as immutable and must not be modified afterwards to prevent inconsistencies!

Returns:
 
{H.map.SpatialStyle}
The given spatial object

setStyle (opt_style) : {H.map.Spatial}

This method sets the drawing style of the given spatial object. If the argument opt_style is an instance of H.map.SpatialStyle, it is treated as immutable and must not be modified afterwards to prevent inconsistencies! .

Parameters:
 
opt_style:
{(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} [optional]
 
The style to set. If it evaluates to a false, the H.map.SpatialStyle.DEFAULT_STYLE is used.
Returns:
 
{H.map.Spatial}
The given spatial object

getArrows () : {(H.map.ArrowStyle | undefined)}

This method retrieves the arrow style of the given spatial object or undefined if the style is not defined. The returned arrow style is treated as immutable and must not be modified afterwards to prevent inconsistencies!

Returns:
 
{(H.map.ArrowStyle | undefined)}
An object encapsulating information about the arrow style or undefined if the arrow style is not defined.

setArrows (opt_arrows) : {H.map.Spatial}

This method sets the arrow style of the given spatial object.

Parameters:
 
opt_arrows:
{(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} [optional]
 
The arrow style to be applied
Returns:
 
{H.map.Spatial}
The given spatial object

isClosed () : {boolean}

This method indicates whether this spatial object represents a closed shape.

Returns:
 
{boolean}
true if the given spatial object is a closed shape, false otherwise

getId () : {*}

This method retrieves the ID of the given object.

Returns:
 
{*}
The identifier of the given object.

setVisibility (opt_visibility) : {H.map.Object}

This method sets the visibility of the given object.

Parameters:
 
opt_visibility:
{boolean=} [optional]
 
Indicates whether the map object should be visible.
Returns:
 
{H.map.Object}
The given object

getVisibility (opt_effective) : {boolean}

This method retrieves a value indicating the visibility of the given object.

Parameters:
 
opt_effective:
{boolean=} [optional]
 
Indicates that the effective visibility is requested. In this case the visibility of all possible ancestor groups is also taken into account
Returns:
 
{boolean}
A value indicating if the object is visible (true) or not false

getZIndex () : {(number | undefined)}

This method retrieves the z-index of the given object.

Returns:
 
{(number | undefined)}
A value reflecting the z-index of the given object.

setZIndex (zIndex) : {H.map.Object}

This method sets the z-index of the given object.

Parameters:
 
zIndex:
{(number | undefined)}
 
A value indicating the new z-index
Returns:
 
{H.map.Object}
The given object

compareZOrder (other) : {number}

This method compares the rendering z-order of the given object with another object. (The 'given object' mean the object on which the method has been invoke.)

Parameters:
 
other:
{H.map.Object}
 
The map object with which to compare the given object.
Returns:
 
{number}
A value lower than 0 indicates that the given object has a lower z-order. 0 indicates that both objects have the same z-order. A value greater than 0, indicates that the given object has a higher z-order.

getParentGroup () : {?H.map.Group}

This method retrieves the parent group which contains the given object or null if the object is not contained in any group.

Returns:
 
{?H.map.Group}
An object representing the containing group object or null if the given object is not contained in any group.

getRootGroup () : {!H.map.Object}

The root object to which the given object is attached or the object itself if it is not attached to another.

Returns:
 
{!H.map.Object}
An object representing the root group for the given object or the given object if it is not part of a group.

contains (object) : {boolean}

This method checks whether the received object is an inclusive descendant of the given object.

Parameters:
 
object:
{*}
 
The object to check.
Returns:
 
{boolean}
true if the given object is contained in the given object, otherwise false

getProvider () : {?H.map.provider.ObjectProvider}

This method obtains the current provider of the given object.

Returns:
 
{?H.map.provider.ObjectProvider}
An object representing the provider

getInvalidations () : {H.map.provider.Invalidations}

This method retrieves the invalidation states for the given object.

Returns:
 
{H.map.provider.Invalidations}
An object containing the invalidation states

invalidate (flags) : {boolean}

This method invalidates the given map object.

Parameters:
 
flags:
{H.math.BitMask}
 
The flags indicating the types of changes to the given object
Returns:
 
{boolean}
Indicates whether a validation was executed (only if the object has a provider)

getData () : {*}

This method retrieves previously stored arbitrary data from the given object.

Returns:
 
{*}
The previously stored data or undefined if no data was stored.

setData (data) : {H.map.Object}

This method stores arbitrary data with the given map object.

Parameters:
 
data:
{*}
 
The data to be stored
Returns:
 
{H.map.Object}
The given map object

addEventListener (type, handler, opt_capture, opt_scope)

This method adds a listener for a specific event.

Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it.

Parameters:
 
type:
{string}
 
The name of the event
handler:
{!Function}
 
An event handler function
opt_capture:
{boolean=} [optional]
 
true indicates that the method should listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
An object defining the scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the EventTarget instance.

Parameters:
 
type:
{string}
 
The name of the event
handler:
{!Function}
 
A previously added event handler
opt_capture:
{boolean=} [optional]
 
true indicates that the method should listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
An oject defining the scope for the handler function

dispatchEvent (evt)

This method dispatches an event on the EventTarget object.

Parameters:
 
evt:
{(H.util.Event | string)}
 
An object representing the event or a string with the event name

dispose ()

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds a callback which is triggered when the EventTarget object is being disposed.

Parameters:
 
callback:
{!Function}
 
The callback function.
opt_scope:
{Object=} [optional]
 
An optional scope for the callback function

Event Details

stripchange: {H.util.ChangeEvent}

Fired when the geometry of the GeoShape has been changed.

Deprecated:
since 3.0.7.0

stylechange: {H.util.ChangeEvent}

Event fired when the style of the given spatial object changes.

Deprecated:
since 3.0.7.0

visibilitychange: {H.util.ChangeEvent}

Event fired when the visibility of the given object changes.

Deprecated:
since 3.0.7.0

zindexchange: {H.util.ChangeEvent}

Event fired when the z-index of the given object changes.

Deprecated:
since 3.0.7.0