H.map.provider.LocalObjectProvider
Class Summary
Extends: H.map.provider.ObjectProvider
A LocalObjectProvider
acts as a database for map objects. It provides functionality to fetch visible objects for specific geographical bounds and zoom levels. All objects are organized in a hierarchical group structure. An object can be added to the provider by adding it to a group within this structure. The root group of the provider can be fetched via the method H.map.provider.LocalObjectProvider#getRootGroup. A H.Map has its own LocalObjectProvider
and offer a means to add and remove objects. Only in advanced use cases, is there a need to create an additional LocalObjectProvider
.
[ For full details, see the Class Details ]
Property Summary
Properties |
---|
This property holds the provider's unique resource identifier. If it is not provided at construction time, it defaults to provider's |
This property holds a value indicating the minimum zoom level at which the given provider can serve data. The value is set at construction time. |
This property holds a value indicating the maximum zoom level at which the given provider can server data. The value is set at construction time. |
This property holds the unique identifier for the provider instance. The value is generated at construction time. |
Method Summary
Methods |
---|
This method retrieves the root group for the given provider. |
This method removes an object from the given provider's database. It must not called directly. It is invoked by |
This method retrieves the accumulated invalidations of the given provider's objects. |
This method signals to the provider that a map object has changed. The method updates the |
This method retrieves all overlay objects which intersect with the specified area. |
This method retrieves all polyline, polygon, circle and rectangle objects which intersect with the provided area. |
This method retrieves the spatial objects which intersect the given tile. |
This method retrieves all |
This method retrieves all |
This method retrieves the copyrights for the provided content for a certain geographical area and zoom level. |
This method checks whether this provider currently provides spatial map objects. A concrete implementation of |
This method checks whether this provider currently provides overlay map objects. A concrete implementation of |
This method checks whether this provider currently provides |
This method checks whether this provider currentky provides |
This method adds a listener for a specific event. |
This method removes a previously added listener from the |
This method dispatches an event on the |
This method removes listeners from the given object. Classes that extend |
This method adds a callback which is triggered when the |
Events Summary
Events |
---|
Event fired when this provider's data updates. |
Class Description
A LocalObjectProvider
acts as a database for map objects. It provides functionality to fetch visible objects for specific geographical bounds and zoom levels. All objects are organized in a hierarchical group structure. An object can be added to the provider by adding it to a group within this structure. The root group of the provider can be fetched via the method H.map.provider.LocalObjectProvider#getRootGroup. A H.Map has its own LocalObjectProvider
and offer a means to add and remove objects. Only in advanced use cases, is there a need to create an additional LocalObjectProvider
.
Example
// Create your own LocalObjectProvider and add some hierarchical objects:
myProvider = new H.map.provider.LocalObjectProvider();
myMap.addLayer(new H.map.layer.ObjectLayer(myProvider));
position = {lat: 52.5308, lng: 13.3852};
myGroup = new H.map.Group();
myGroup.addObject(new H.map.Circle(position, 35));
myProvider.getRootGroup().addObjects([
myGroup,
new H.map.Marker(position)
]);
myMap.setCenter(position).setZoom(18);
Constructor Details
H.map.provider.LocalObjectProvider(opt_options)
- Parameters:
-
opt_options
: -
{H.map.provider.Provider.Options=} [optional]
- An object containing configuration options
Property Details
uri: {string}
This property holds the provider's unique resource identifier. If it is not provided at construction time, it defaults to provider's uid
.
min: {number}
This property holds a value indicating the minimum zoom level at which the given provider can serve data. The value is set at construction time.
max: {number}
This property holds a value indicating the maximum zoom level at which the given provider can server data. The value is set at construction time.
uid: {string}
This property holds the unique identifier for the provider instance. The value is generated at construction time.
Method Details
getRootGroup () : {H.map.Group}
This method retrieves the root group for the given provider.
- Returns:
-
{H.map.Group}
- An object representing the root group for the given provider
removeObject (object)
This method removes an object from the given provider's database. It must not called directly. It is invoked by H.map.Group
which checks beforehand that it is an H.map.Object instance and its provider is the given provider.
- Parameters:
-
object
: -
{!H.map.Object}
- The object to remove
getInvalidations (opt_type) : {H.map.provider.Invalidations}
This method retrieves the accumulated invalidations of the given provider's objects.
- Parameters:
-
opt_type
: -
{H.map.Object.Type=} [optional]
- The type of objects to consider for the invalidations. If undefined, all types are taken into account.
- Returns:
-
{H.map.provider.Invalidations}
- An object specifying invalidations
invalidateObject (mapObject, changes)
This method signals to the provider that a map object has changed. The method updates the Invalidations
of the given provider and the specified map object and triggers dispatchUpdate()
.
- Parameters:
-
mapObject
: -
{!H.map.Object}
- The map object to be invalidated
-
changes
: -
{H.math.BitMask}
- The flags indicating the types of changes that have occurred
requestOverlays (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Overlay>}
This method retrieves all overlay objects which intersect with the specified area.
- Parameters:
-
geoRect
: -
{H.geo.Rect}
- A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
-
zoomLevel
: -
{number}
- The zoom level for which the objects are requested
-
visiblesOnly
: -
{boolean}
- A value indicating whether only invisible objects are to be considered (
true
) or not (false
) -
cacheOnly
: -
{boolean}
- A value indicating whether only cached objects are to be considered (
true
) or not (false
)
- Returns:
-
{Array<H.map.Overlay>}
- A list of intersecting objects
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
This method retrieves all polyline, polygon, circle and rectangle objects which intersect with the provided area.
- Parameters:
-
geoRect
: -
{H.geo.Rect}
- A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
-
zoomLevel
: -
{number}
- The zoom level for which the objects are requested
-
visiblesOnly
: -
{boolean}
- A value indicating whether only invisible objects are to be considered (
true
) or not (false
) -
cacheOnly
: -
{boolean}
- A value indicating whether only cached objects are to be considered (
true
) or not (false
)
- Returns:
-
{Array<H.map.Spatial>}
- A list of intersecting objects
requestSpatialsByTile (tile, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}
This method retrieves the spatial objects which intersect the given tile.
- Parameters:
-
tile
: -
{H.map.provider.SpatialTile}
- The tile for which the objects are requested
-
visiblesOnly
: -
{boolean}
- A value indicating whether only invisible objects are to be considered (
true
) or not (false
) -
cacheOnly
: -
{boolean}
- A value indicating whether only cached objects are to be considered (
true
) or not (false
)
- Returns:
-
{Array<H.map.Spatial>}
- A list of intersecting objects
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Marker>}
This method retrieves all Marker
map objects which intersect with the provided rectangular area.
- Parameters:
-
geoRect
: -
{H.geo.Rect}
- A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
-
zoomLevel
: -
{number}
- The zoom level for which the objects are requested
-
visiblesOnly
: -
{boolean}
- A value indicating whether only invisible objects are to be considered (
true
) or not (false
) -
cacheOnly
: -
{boolean}
- A value indicating whether only cached objects are to be considered (
true
) or not (false
)
- Returns:
-
{Array<H.map.Marker>}
- A list of intersecting objects
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.DomMarker>}
This method retrieves all DomMarker
map objects which intersect with the provided rectangular area.
- Parameters:
-
geoRect
: -
{H.geo.Rect}
- A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
-
zoomLevel
: -
{number}
- The zoom level for which the objects are requested
-
visiblesOnly
: -
{boolean}
- A value indicating whether only invisible objects are to be considered (
true
) or not (false
) -
cacheOnly
: -
{boolean}
- A value indicating whether only cached objects are to be considered (
true
) or not (false
)
- Returns:
-
{Array<H.map.DomMarker>}
- A list of intersecting objects
getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}
This method retrieves the copyrights for the provided content for a certain geographical area and zoom level.
Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property
. The default implementation returns null
.
- Parameters:
-
bounds
: -
{H.geo.Rect}
- The bounding area for which to retrieve the copyright information
-
level
: -
{number}
- The zoom level for which to retrieve the copyright information
- Returns:
-
{?Array<H.map.ICopyright>}
- A list of copyright information objects for the provided area and zoom level
providesSpatials () : {boolean}
This method checks whether this provider currently provides spatial map objects. A concrete implementation of Provider
must override it if it currently provides Spatial
s.
- Returns:
-
{boolean}
- A value indicating whether the provider provides map objects (
true
) or not (false
)
providesOverlays () : {boolean}
This method checks whether this provider currently provides overlay map objects. A concrete implementation of Provider
must override it if it currently provides overlays.
- Returns:
-
{boolean}
-
true
if the provider provides overlays, otherwsefalse
providesMarkers () : {boolean}
This method checks whether this provider currently provides Marker
map objects. A concrete implementation of Provider
must override it if it currently provides Marker
s.
- Returns:
-
{boolean}
- A value indicating if the given provider provides Markers (
true
) or not (false
)
providesDomMarkers () : {boolean}
This method checks whether this provider currentky provides DomMarker
map objects. A concrete implementation of Provider
must override it if it currently provides Marker
s.
- Returns:
-
{boolean}
- A value indicating if the given provider provides Markers (
true
) or not (false
)
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
update: {H.util.Event}
Event fired when this provider's data updates.