Class: module:Action

module:Action()

new module:Action()

Build the lizmap Action instance
Source:

Classes

Action

Members

ACTIVE_LIZMAP_ACTION

Source:

CallbackMethods :string

Callbacks - List of available callbacks for the actions
Type:
  • string
Source:

Scopes :string

Scopes - List of available scopes for the actions
Type:
  • string
Source:

actionLayer

OpenLayers vector layer to draw the action results
Source:

hasActions

Source:

Methods

addFeaturesFromActionResponse(data, style) → {object}

Add the features returned by a action to the OpenLayers layer in the map
Parameters:
Name Type Description
data object The data returned by the action
style object | undefined Optional OpenLayers style object
Source:
Returns:
features The OpenLayers features converted from the data
Type
object

addPopupActionButton(action, layerId, featureId, popupContainerId)

Add an action button for the given popup feature and the given action item.
Parameters:
Name Type Description
action object The action configuration object
layerId string The layer ID
featureId string The feature ID
popupContainerId string The popup container ID
Source:

buildActionInstanceUniqueId(actionName, scope, layerId, featureId) → {string}

Build the unique ID of an action based on its scope
Parameters:
Name Type Description
actionName string The action name
scope string The action scope
layerId string The layer ID
featureId string The feature ID
Source:
Returns:
uniqueId - The action unique ID.
Type
string

createActionMapLayer()

Create the OpenLayers layer to display the action geometries.
Source:

explodeActionInstanceUniqueId(uniqueId) → {array}

Explode the action unique ID into its components action name, layer ID, feature ID
Parameters:
Name Type Description
uniqueId string The instance object unique ID
Source:
Returns:
components - The components [actionName, layerId, featureId]
Type
array

getActionItemByName(name, scope, layerId) → {object}

Get an action item by its name and scope. If no layer id is given, return the first item corresponding to the given name. If the layer ID is given, only return the action if it concerns the given layer ID.
Parameters:
Name Type Default Description
name string Name of the action
scope Scopes Scope of the action
layerId string null Layer ID (optional)
Source:
Returns:
The corresponding action
Type
object

getActions(scope, layerId) → {array}

Get the list of actions A scope and/or a layer ID can be given to filter the actions
Parameters:
Name Type Default Description
scope string null Scope of the actions to filter
layerId string null Layer ID of the actions to filter
Source:
Returns:
actions - Array of the actions
Type
array

popupActionButtonClickHandler()

Reacts to the click on a popup action button.
Source:

resetLizmapAction(destroyFeatures, removeMessage, resetGlobalVariable, resetActiveInterfaceElements)

Reset action
Parameters:
Name Type Default Description
destroyFeatures boolean true If we must remove the geometries in the map.
removeMessage boolean true If we must remove the message displayed at the top.
resetGlobalVariable boolean true If we must empty the global variable ACTIVE_LIZMAP_ACTION
resetActiveInterfaceElements boolean true If we must remove the "active" interface for the buttons
Source:

runCallbacks(action, features)

Run the callbacks as defined in the action configuration
Parameters:
Name Type Default Description
action object The action
features array null The OpenLayers features created by the action from the response
Source:

(async) runLizmapAction(actionName, scope, layerId, featureId, wkt)

Run a Lizmap action.
Parameters:
Name Type Default Description
actionName string The action name
scope Scopes The action scope
layerId string null The optional layer ID
featureId string null The optional feature ID
wkt string null An optional geometry in WKT format and project EPSG:4326
Source:

Events

actionResultReceived

Lizmap event to allow other scripts to process the data if needed
Properties:
Name Type Description
action string Name of the action
layerId string Layer ID of the current layer
featureId string Feature ID of the current feature
features Array.<*> List of features returned in the map projection
Source: