Class: module:Action

module:Action(map, selectionTool, digitizing, lizmap3)

new module:Action(map, selectionTool, digitizing, lizmap3)

Build the lizmap Action instance

Parameters:
Name Type Description
map Map

OpenLayers map

selectionTool SelectionTool

The lizmap selection tool

digitizing Digitizing

The Lizmap digitizing instance

lizmap3 object

The old lizmap object

Source:

Classes

Action

Members

ACTIVE_LIZMAP_ACTION :string

Unique ID of an action object We allow only one active action at a time

Type:
  • string
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 :boolean

If the project has actions

Type:
  • boolean
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) → {boolean|void}

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:
Returns:
  • If the action failed
Type
boolean | void

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 Action.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(event) → {boolean}

Reacts to the click on a popup action button.

Parameters:
Name Type Description
event Event

The click event

Source:
Returns:
  • If the action was successful
Type
boolean

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) → {boolean}

Run a Lizmap action.

Parameters:
Name Type Default Description
actionName string

The action name

scope Action.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:
Returns:
  • If the action was successful
Type
boolean

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: