Provides a set of actions that perform common tasks on the map.
The interface of this bundle is described in detail in the API documentation.
This bundle provides an API to trigger common actions on the map.
Bundles have to inject the map-actions.ActionService
to trigger actions:
actionService.trigger(["zoomto"], {
"items": [{ geometry: "..." }],
"zoomto-scale": 1000
});
The following actions are provided by this bundle:
Action ID | Description |
---|---|
highlight |
The geometry of the items passed to the action's trigger method is drawn to the map. The drawn graphic persists on the map indefinitely unless the highlight-remove-timeout property is set. This removes the graphic from the map after the given amount of milliseconds. |
zoomto |
Sets the map extent to the geometries of the specified items. If multiple items are specified, then the union of their extents will be used as the new map extent. |
openpopup |
Opens the popup of the feature. Only the popup of the first feature will be shown. |
The following options can be passed to the highlight action:
Property | Type | Description |
---|---|---|
highlight-remove-timeout |
Integer | Number of milliseconds to wait before the highlight graphic is removed from the map again. If the value is not set or set to 0 , the highlight graphic is not removed. |
highlight-symbol-* |
Object | Styles of the symbols used for the different geometry types. Replace * with the corresponding geometry type: point , polyline , polygon , point-3d , polyline-3d , polygon-3d . See Symbol Objects. |
The following options can be passed to the zoomto action:
Property | Type | Description |
---|---|---|
zoomto-scale |
Integer | Scale to zoom to. No default value is defined. |
zoomto-point-scale |
Integer | Scale to zoom to if geometry is of type point . No default value is defined. |
zoomto-extent-expansion-factor |
Integer | Factor applied to the extent of a non-point input geometry. The expanded extent makes up the new zoom target geometry, so for a factor > 1 you get more map context around the input geometry. Only applies if zoomto-scale is not set. |
The following options can be passed to the openpopup action:
Property | Type | Description |
---|---|---|
highlight-remove-timeout |
Integer | Number of milliseconds to wait before the popup is closed. It reuses the option of the highlight action. |
source |
Store | If the feature is from a store, this reference to the store is needed to resolve the popup template. |
Developers can extend this bundle's functionality by providing custom actions.
An action is a class that must satisfy the following requirements:
id
property with a unique value.trigger(options)
method. The options
parameter is an object with an items
property containing the items on which the action may interact.class MyCustomAction {
constructor() {
// unique ID of the action
this.id = "my-custom-id";
// this is a sequential action
this.immediate = false;
}
// trigger method which is called with the search result items
trigger(options) {
const items = options.items;
const someProperty = options["my-custom-id-some-property"];
// Do something with the items...
}
}
To register the action as a service in map.apps add a component that provides the map-actions.Action
interface to the manifest.json
file of your bundle:
{
"components": [
{
"name": "MyCustomAction",
"provides": "map-actions.Action"
}
]
}