/layer/formats/vector
The module exports the "vector" format method for the Mapp layer decorator method.
- Source
Requires
Members
(inner, constant) ALL_EXTENT
The loaded extent of a vector source with the default 'all' loading strategy.
- Source
Methods
(inner) clusterConfig(layer)
Configures the clustering options for a layer.
| Name | Type | Description |
|---|---|---|
layer | Object | The layer object. |
| Name | Type | Attributes | Description |
|---|---|---|---|
layer.key | string | The key of the layer. | |
layer.srid | string | The spatial reference system identifier (SRID) for the layer. | |
layer.params | Object | Parameter for data request. | |
layer.cluster | Object | The clustering configuration for the layer. | |
cluster.distance | number | <optional> | The distance threshold for clustering. |
cluster.resolution | number | <optional> | The resolution threshold for clustering. |
cluster.hexgrid | boolean | <optional> | Flag indicating whether to use hexgrid clustering. |
- Source
(inner) clusterGeometry(F, layer) → {Object}
The clusterGeometry method is the geometryFunction for the OL cluster source. Features which are not displayed by the featureStyle method return a null geometry and will not be considered for clustering. These are features excluded by the layer featureSet or featureLookup, and features without a style from a categorized or graduated layer theme [eg. a category toggled off in a filterOnly theme].
A cluster without displayed features will not be created and a cluster with a single displayed feature will be rendered as a single location.
| Name | Type | Description |
|---|---|---|
F | Object | The OL feature in the cluster source. |
layer | layer | The Mapp layer object. |
| Name | Type | Attributes | Description |
|---|---|---|---|
layer.style | layer-style | The layer style config. | |
style.theme | Object | <optional> | The layer theme. |
- Source
The feature geometry or null if the feature is not displayed.
- Type:
- Object
(inner) clusterSourceChange(layer)
The clusterSourceChange event method is called by changes to the cluster source. The method will map all features in cluster source to return an array of features [counts] for each feature in the cluster source. The largest features count from the array will be assigned as the cluster.max_size.
| Name | Type | Description |
|---|---|---|
layer | layer | The Mapp layer object. |
| Name | Type | Description |
|---|---|---|
layer.cluster | layer-cluster | The vector layer cluster configuration. |
cluster.max_size | integer | The length of features in the largest cluster feature. |
- Source
(inner) createSource(layer, featuresopt) → {Object}
The createSource method creates the Openlayers vector source for a vector layer.
The vector layer data is requested by the layer.reload() method. The source loader doesn't load any features but completes once the layer has finished loading. The Openlayers vector source is loading while the loader is pending, and the Openlayers Map will not dispatch the rendercomplete event while the source of a visible layer is loading.
| Name | Type | Attributes | Description |
|---|---|---|---|
layer | layer | The vector layer. | |
features | Array | <optional> | The Openlayers features for the source. |
- Source
Openlayers vector source.
- Type:
- Object
(inner) endLoading(layer)
The endLoading method resolves the layer.loading promise for pending source loaders to complete.
The layer is changed to trigger the render which dispatches the rendercomplete event.
| Name | Type | Description |
|---|---|---|
layer | layer | The vector layer. |
- Source
(inner) reload()
The layer.reload() method determines the table and geometry for the current zoom level. And uses the layer.params{} to create a request for layer features to be added to the layer source.
The xhr request is debounced by 100ms to prevent requests in quick succession on panning, scroll, and touch zooming.
The layer source is loading until the features of the latest request have been set. The Openlayers Map doesn't dispatch the rendercomplete event while the source of a visible layer is loading.
The layer.request is assigned when the reload method is called, before the debounce timeout. The response of a superseded request is discarded and will neither set the layer source nor end the loading of the layer, also if the response arrives during the debounce timeout of the latest reload.
The reload method is bound to the layer object and doesn't require any arguments.
| Name | Type | Attributes | Description |
|---|---|---|---|
layer.params | Object | Parameter for data request. | |
layer.timeout | Object | Timeout for the xhr request. | |
layer.request | Object | The latest request for the layer data. | |
layer.loading | Promise | <optional> | Resolves once the features of the latest request have been set. |
- Source
(async, inner) setSource(featuresopt)
The setSource method receives the features to be set on a vector layer source. Providing a null argument will remove any features by setting the layer source to null.
The method will trigger methods to reset and process featureFields to update dynamic legends.
The clusterSourceChange method is triggered for cluster layer.
| Name | Type | Attributes | Description |
|---|---|---|---|
features | array | <optional> | The features to be added to the vector layer source. |
- Source
(inner) startLoading(layer)
The startLoading method assigns the layer.loading promise which is resolved by the endLoading method once the features of the latest request have been set.
A layer without a source is assigned an empty source to be loading until the features are set.
The loaded extent of the layer source is removed for the source loader to be called on the next render.
The Openlayers cluster source doesn't call a loader. The loading flag is set on a cluster source directly.
| Name | Type | Description |
|---|---|---|
layer | layer | The vector layer. |
- Source
(inner) vector(layer)
Creates Openlayers layer and source for vector format mapp layer.
| Name | Type | Description |
|---|---|---|
layer | layer | The Mapp layer object. |
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
layer.srid | string | <optional> | The spatial reference system identifier (SRID) for the layer. | |
layer.params | Object | <optional> | {} | Parameters for the layer data query. |
layer.setSource | function | Method pass features to layer source. | ||
layer.reload | function | Method to reload layer data. | ||
layer.features | Array | <optional> | An array of features for the layer. | |
layer.fade | boolean | <optional> | Flag indicating whether to apply a fade effect to the layer. | |
layer.cluster | layer-cluster | <optional> | Point layer cluster configuration. | |
layer.source | Object | <optional> | OpenLayers vector source. | |
layer.style | layer-style | The mapp-layer style configuration. | ||
layer.zIndex | number | <optional> | The zIndex for the layer canvas element. |
- Source