Constructor
(abstract) new MapBase(…args)
MapBase constructor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
Array |
<repeatable> |
List of arguments to be sent to State constructor |
Members
(static) CONTROLS
List of controls that maybe shown inside the rendered map.
(static) CONTROLS_MAP
Control mapping that should be overriden by child classes.
(static) DialogImpl
Class that will be used for creating dialog objects.
(static) GeocoderImpl
Class that will be used for parsing geoposition information.
(static) GeoJSONImpl
Class that will be used for creating GeoJSON instances.
This class must be replaced by another one extending GeoJSONBase.
(static) MarkerImpl
Class that will be used for creating map markers.
This class must be replaced by another one extending MarkerBase.
(static) POSITION
Available map positions.
(static) POSITION_MAP
Position mapping that should be overriden by child classes.
(static) SearchImpl
Class that will be used for creating an instance of searchbox.
This class must be replaced by another one extending MarkerBase.
(static, non-null) STATE :Object
State definition.
Type:
- Object
Methods
(static) get(id, callback)
Registers the given callback to be executed when the map identified
by the given id has been created. If the map has already been created, it
is executed immediatly.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Id of the map that needs to be created |
callback |
function | Callback being executed |
(static) register(id, map, portletId)
Registers the given map with the given id, and executes all existing
callbacks associated with the id. Then it clears the list of callbacks.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Id of the map that has been created |
map |
Object | Map that has been created |
portletId |
string | Id of the portlet that registers the map |
(protected) _bindUIMB()
- Source:
- See:
-
- this._geoJSONLayer
- this._geolocationMarker
- this._customControls All added listeners are implemented as binded methods:
- this._handleGeoJSONLayerFeaturesAdded
- this._handleGeoJSONLayerFeatureClicked
- this._handleGeoLocationMarkerDragended
- this._handleHomeButtonClicked
- this._handleSearchButtonClicked
(protected) _createCustomControls()
Creates existing custom controls and stores them inside _customControls.
It only adds the home button and the search box if the corresponding
flags are activated inside MapBase.controls.
(abstract, protected) _createMap(location, controlsConfig) → {Object}
Creates a new map for the given location and controlsConfig.
Parameters:
Name | Type | Description |
---|---|---|
location |
Object | |
controlsConfig |
Object |
Returns:
Created map
- Type
- Object
(protected) _getControlsConfig() → {Object}
Returns an object with the control configuration associated to the
existing controls (MapBase.controls).
Returns:
Object with the control options with the following shape:
for each control, there is a corresponding [control] attribute with a
boolean value indicating if there is a configuration for the control. If
true, where will be a [control]Options attribute with the configuration
content.
- Type
- Object
(protected) _getDialog() → {MapBase.DialogImpl|null}
If there is an existing this._dialog, it returns it.
Otherwise, if the MapBase.DialogImpl class has been set, it creates
a new instance with the existing map and returns it.
Returns:
- Type
- MapBase.DialogImpl | null
(protected) _getGeocoder() → {MapBase.GeocoderImpl|null}
If there is an existing this._geocoder, it returns it.
Otherwise, if the MapBase.GeocoderImpl class has been set, it creates
a new instance and returns it.
Returns:
- Type
- MapBase.GeocoderImpl | null
(protected) _handleGeoJSONLayerFeatureClicked(param0)
Event handler executed when a GeoJSONLayer feature is clicked. It
simple propagates the event with the given feature.
Parameters:
Name | Type | Description |
---|---|---|
param0 |
Object | Feature to be propagated. |
(protected) _handleGeoJSONLayerFeaturesAdded(param0)
Event handler executed when any feature is added to the existing.
GeoJSONLayer. It will update the current position if necesary.
Parameters:
Name | Type | Description |
---|---|---|
param0 |
Object | Array of features that will be processed. |
- Source:
- See:
-
- MapBase.getBounds()
- MapBase.position
(protected) _handleGeoLocationMarkerDragended(param0)
Event handler executed when the geolocation marker has been dragged to
a new position. It updates the instance position.
Parameters:
Name | Type | Description |
---|---|---|
param0 |
Object | New marker location. |
- Source:
- See:
-
- MapBase._getGeoCoder()
- MapBase.position
_handleHomeButtonClicked(event)
Event handler executed when the home button GeoJSONLayer feature is
clicked. It resets the instance position to _originalPosition and stops
the event propagation.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | Click event. |
- Source:
- See:
-
- MapBase.position
- MapBase._originalPosition
_handlePositionChanged(param0)
Event handler executed when the user position changes. It centers the map
and, if existing, updates the _geolocationMarker position.
Parameters:
Name | Type | Description |
---|---|---|
param0 |
Object | New location information. |
- Source:
- See:
-
- MapBase.setCenter()
- MapBase._geolocationMarker
_handleSearchButtonClicked(param0)
Event handler executed when the search button GeoJSONLayer feature has
been clicked. It updates the instance position.
Parameters:
Name | Type | Description |
---|---|---|
param0 |
Object | New position. |
- Source:
- See:
-
- MapBase.position
(protected) _initializeGeoJSONData()
If this.data has a truthy value and this._geoJSONLayer has been
set, it tries to parse geoJSON information with _geoJSONLayer.addData()
- Source:
- See:
-
- this._geoJSONLayer
- this.data
(protected) _initializeLocation(location)
Initializes the instance map using the given location and, if
this.geolocation property is true, tries to get the location using
the geocoder.
Parameters:
Name | Type | Description |
---|---|---|
location |
Object | Location object user for map initialization. |
- Source:
- See:
-
- this._initializeMap()
- this._getGeocoder()
(protected) _initializeMap(position)
Creates a new map with the given position and initialize the map
controls, loads the geoJSONData and, if geolocation is active, creates
a marker for it.
Parameters:
Name | Type | Description |
---|---|---|
position |
Object | Initial position added to the map. |
- Source:
- See:
-
- MapBase._getControlsConfig()
- MapBase._createMap()
- MapBase.GeoJSONImpl
- MapBase.addMarker()
- MapBase._createCustomControls()
- MapBase._bindUIMB()
- MapBase._initializeGeoJSONData()
addControl(control, position)
Adds a new control to the interface at the given position.
Parameters:
Name | Type | Description |
---|---|---|
control |
Object | Native control object |
position |
MapBase.POSITION | Position defined in MapBase class |
addMarker(location) → {MapBase.MarkerImpl}
If the class MapBase.MarkerImpl has been specified, creates an instance
of this class with the given location and the existing this._map object
and returns it.
Parameters:
Name | Type | Description |
---|---|---|
location |
Object | Location object used for the marker position |
Returns:
- Type
- MapBase.MarkerImpl
destructor()
Destroys the existing _geoJSONLayer and _customControls[SEARCH]
- Source:
- See:
-
- MapBase._initializeMap()
- MapBase._createCustomControls()
(abstract) getBounds() → {Object}
Returns the map bounds.
Returns:
Map bounds
- Type
- Object
getNativeMap() → {Object}
Returns the stored map
- Source:
- See:
-
- MapBase._initializeMap()
Returns:
- Type
- Object
on(eventName, callback, contextopt) → {*}
Adds a listener for the given event using the given context. This
methods uses MetalJS' functionality, but overrides the context binding
in order to avoid breaking changes with the old implementation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventName |
string | Event name that will be listened. | |
callback |
function | Callback executed when the event fires. | |
context |
Object |
<optional> |
Optional context that will be used for binding the callback when specified. |
- Source:
- See:
-
- State.on
Returns:
Result of the State.on method.
- Type
- *
openDialog(dialogConfig)
Opens a dialog if this_getDialog() returns a valid object.
Parameters:
Name | Type | Description |
---|---|---|
dialogConfig |
* | Dialog configuration that will be sent to the dialog.open() method. |
- Source:
- See:
-
- MapBase._getDialog()
(abstract) setCenter(location)
Centers the map on the given location.
Parameters:
Name | Type | Description |
---|---|---|
location |
Object |
setPosition(position) → {Object}
Setter called everytime the position attribute is changed.
Parameters:
Name | Type | Description |
---|---|---|
position |
Object | New position |
Returns:
The given position object
- Type
- Object