/mapview
- Source
Methods
(inner) changeEnd()
The changeEnd method is debounced by 400ms and will iterate over the changeEndCallbacks array methods. Each method will be called with the mapview [this] as argument.
- Source
(inner) decorate(mapview) → {mapview}
The mapview decorator method decorates the mapview object param as a typedef mapview object.
The mapview decorator may return the async mapviewPromise method which must be awaited if svgTemplates must be loaded or syncPlugins must be executed.
| Name | Type | Description |
|---|---|---|
mapview | object | JSON params for a new mapview. |
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mapview.host | string | <optional> | mapp.host | The host domain/path for queries. |
mapview.locale | object | The locale defintion for the mapview. | ||
locale.svgTemplates | Object | <optional> | Object of template key and src values to be loaded as svg strings. locale.svg_templates is the legacy property. | |
locale.syncPlugins | array | <optional> | An array plugins to be loaded in order. |
- Source
Decorated Mapview.
- Type:
- mapview
(inner) mapviewControls(mapview)
The method parses mapview control configs in the locale and creates the mapview.controls array of openlayer map control elements.
An array of mapviewControls, eg. mapviewControls = ['Zoom'] can be defined to add the control to the mapview.Map on creation.
| Name | Type | Description |
|---|---|---|
mapview | object | JSON params for the new mapview.Map. |
| Name | Type | Attributes | Description |
|---|---|---|---|
mapview.locale | locale | The mapview locale. | |
locale.mapviewControls | array | <optional> | Array of openlayers map controls eg. 'Zoom'. |
locale.showScaleBar | boolean | <optional> | Legacy config to show metric ScaleLine. |
locale.scalebar | string | <optional> | Legacy config to define ScaleLine units. |
locale.ScaleLine | string | <optional> | String configuration for openlayers ScaleLine units ['metric' or 'imperial']. |
- Source
(async, inner) mapviewPromise(mapview) → {Promise.<mapview>}
mapviewPromise is an async method which resolves to the mapview object. The method is returned from the mapview decorator if the creation of the mapview must be awaited in order to import and execute synchronous plugin methods or load svg_templates required for synchronous feature style render methods.
| Name | Type | Description |
|---|---|---|
mapview | object |
| Name | Type | Attributes | Description |
|---|---|---|---|
mapview.locale | locale | The locale defintion for the mapview. | |
locale.plugins | array | Array of plugins to dynamically import. | |
locale.syncPlugins | array | <optional> | Array of plugins [key] to be executed in sync. |
locale.svgTemplates | array | <optional> | Array of svg_templates [objects] to be loaded. |
- Source
The async method resolves to the decorated mapview object.
- Type:
- Promise.<mapview>
(inner) updateView(mapview)
The method updates the mapview.view object with the current lat, lng, and z from the OL Map object.
The view parameters will also be set as url params with the hooks option provided to the mapview decorator.
| Name | Type | Description |
|---|---|---|
mapview | mapview |
| Name | Type | Description |
|---|---|---|
mapview.view | object | The current Map view. |
view.z | float | The current Map view zoom level. |
view.lat | float | The current Map view latitude. |
view.lng | float | The current Map view longitude. |
- Source
(inner) viewConfig(mapview)
The method sets the view config for the mapview.
| Name | Type | Description |
|---|---|---|
mapview | object | JSON params for a new mapview. |
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mapview.view | object | <optional> | The view config. | |
view.lng | float | <optional> | 0 | Longitude |
view.lat | float | <optional> | 0 | Latitude |
- Source
(inner) viewExtent(mapview)
The methods checks the locale extent configuration and sets the view extent.
| Name | Type | Description |
|---|---|---|
mapview | object | JSON params for a new mapview. |
| Name | Type | Attributes | Description |
|---|---|---|---|
mapview.locale | locale | The mapview locale. | |
mapview.view | object | <optional> | The view config. |
locale.extent | object | <optional> | The locale/view extent. |
- Source
(inner) viewMask(mapview)
A mask layer will be added to the mapview map if the mask flag is set in the locale.extent.
| Name | Type | Description |
|---|---|---|
mapview | object | JSON params for a new mapview. |
| Name | Type | Attributes | Description |
|---|---|---|---|
mapview.locale | locale | The mapview locale. | |
locale.extent | object | <optional> | The locale/view extent. |
extent.mask | boolean | <optional> | Apply mask layer to the view extent. |
- Source