mapp.layer.decorate()

Decorates a layer object with additional properties and methods.

A mapview must be assigned to the layer object in order to decorate a layer.

The layer decorator passes the layer to a defined format method which assigns the Openlayers layer object (L).

Common interface methods such as layer.show, and hide are assigned to the layer object.

A blank layer.filter object will be set if the filter has not been defined in the JSON layer.

Any plugins matching layer keys will be executed with the layer being passed as argument to the plugin method.

The layer object is returned from the decorator.

Requires

Methods

(inner) changeEnd(layer)

The layer decorator method assigns an event listener to the layer mapview map object for layers with a tables or viewport param property.

The changeEnd method checks whether the layer should be displayed and requests a layer reload if necessary.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer.

(async, inner) decorator(layer) → {Promise.<layer>}

The layer decorator method create mapp-layer typedef object from a json-layer.

Parameters:
NameTypeDescription
layerobject

JSON layer.

Properties
NameTypeDescription
layer.featureLocationboolean

Locations will be gotten from layer.features.

Returns:

Decorated Mapp Layer.

Type: 
Promise.<layer>

(inner) geomCurrent() → {string}

Returns the current geometry associated with the layer.

Returns:

The current geometry associated with the layer.

Type: 
string

(async, inner) getExtent(layer) → {array}

Send a query to the layer_extent query template with a POST body if the layer has an array of ID defined as featureSet or featureLookup.

Parameters:
NameTypeDescription
layerlayer
Properties
NameTypeAttributesDescription
layer.featureSetarray<optional>

The layer has an of feature id.

layer.featureLookuparray<optional>

The layer has lookup features.

Returns:

an array of floats, representing the extent

Type: 
array

(inner) hide()

Hides the layer from the map.

(inner) remove()

The layer.remove method will remove the layer view from the document. Hide the layer in the mapview and finally dispose the Openlayers layer before the layer object is deleted from the mapview.layers{}.

(inner) show()

Shows the layer on the map.

(inner) tableCurrent() → {string}

Returns the current table associated with the layer.

Returns:

The current table associated with the layer.

Type: 
string

(async, inner) update(jsonLayer) → {layer}

The layer.update() method receives a json layer and attempts to decorate a new layer.

The layer itself will be removed once the newly decorated layer view as been inserted before the existing layer view.

The new layer will be returned from the method.

Parameters:
NameTypeDescription
jsonLayerjson

A json layer object.

Returns:

A decorated mapp layer.

Type: 
layer

(async, inner) zoomToExtent(params) → {Promise.<boolean>}

Zooms to a specific extent on the map.

Parameters:
NameTypeDescription
paramsObject

Parameters for zooming to extent.

Returns:

A promise that resolves with a boolean indicating the success of the operation.

Type: 
Promise.<boolean>