/layer/formats/vector

The module exports the "vector" format method for the Mapp layer decorator method.

Requires

Members

(inner, constant) ALL_EXTENT

The loaded extent of a vector source with the default 'all' loading strategy.

Methods

(inner) clusterConfig(layer)

Configures the clustering options for a layer.

Parameters:
NameTypeDescription
layerObject

The layer object.

Properties
NameTypeAttributesDescription
layer.keystring

The key of the layer.

layer.sridstring

The spatial reference system identifier (SRID) for the layer.

layer.paramsObject

Parameter for data request.

layer.clusterObject

The clustering configuration for the layer.

cluster.distancenumber<optional>

The distance threshold for clustering.

cluster.resolutionnumber<optional>

The resolution threshold for clustering.

cluster.hexgridboolean<optional>

Flag indicating whether to use hexgrid clustering.

(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.

Parameters:
NameTypeDescription
FObject

The OL feature in the cluster source.

layerlayer

The Mapp layer object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The layer style config.

style.themeObject<optional>

The layer theme.

Returns:

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.

Parameters:
NameTypeDescription
layerlayer

The Mapp layer object.

Properties
NameTypeDescription
layer.clusterlayer-cluster

The vector layer cluster configuration.

cluster.max_sizeinteger

The length of features in the largest cluster feature.

(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.

Parameters:
NameTypeAttributesDescription
layerlayer

The vector layer.

featuresArray<optional>

The Openlayers features for the source.

Returns:

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.

Parameters:
NameTypeDescription
layerlayer

The vector layer.

(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.

Properties
NameTypeAttributesDescription
layer.paramsObject

Parameter for data request.

layer.timeoutObject

Timeout for the xhr request.

layer.requestObject

The latest request for the layer data.

layer.loadingPromise<optional>

Resolves once the features of the latest request have been set.

(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.

This:
Parameters:
NameTypeAttributesDescription
featuresarray<optional>

The features to be added to the vector layer 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.

Parameters:
NameTypeDescription
layerlayer

The vector layer.

(inner) vector(layer)

Creates Openlayers layer and source for vector format mapp layer.

Parameters:
NameTypeDescription
layerlayer

The Mapp layer object.

Properties
NameTypeAttributesDefaultDescription
layer.sridstring<optional>

The spatial reference system identifier (SRID) for the layer.

layer.paramsObject<optional>
{}

Parameters for the layer data query.

layer.setSourcefunction

Method pass features to layer source.

layer.reloadfunction

Method to reload layer data.

layer.featuresArray<optional>

An array of features for the layer.

layer.fadeboolean<optional>

Flag indicating whether to apply a fade effect to the layer.

layer.clusterlayer-cluster<optional>

Point layer cluster configuration.

layer.sourceObject<optional>

OpenLayers vector source.

layer.stylelayer-style

The mapp-layer style configuration.

layer.zIndexnumber<optional>

The zIndex for the layer canvas element.