new InputActionByDefaut(map)
The constructor initializes the action with an optional map instance.
If no map is provided, it defaults to null.
It also initializes properties for data, coordinates, and event listeners.
Name | Type | Description |
---|---|---|
map | ol.Map |
optional
Optional OpenLayers map instance. |
Methods
-
active()
Controls/Reporting/Reporting.js, line 183 -
This method sets up the action to listen for single click events on the map.
When a single click occurs, it triggers the handler method to capture the coordinates. -
clear()
Controls/Reporting/Reporting.js, line 163 -
This method resets the data and coordinate properties to null,
and removes the event listener if it exists. -
disable()
Controls/Reporting/Reporting.js, line 192 -
This method removes the event listeners that were added during activation.
-
getData(){Object}
Controls/Reporting/Reporting.js, line 116 -
This method returns a GeoJSON FeatureCollection with a single Point feature.
The Point's coordinates are set to the last clicked coordinate on the map.
The FeatureCollection also includes a CRS (Coordinate Reference System) definition
based on the map's current projection.Returns:
- Data for this action.
Example
var data = inputAction.getData(); console.log(data); // Output: // { // location: { // type: "FeatureCollection", // crs: { // type: "name", // properties: { // name: "EPSG:4326" // } // }, // features: [ // { // type: "Feature", // geometry: { // type: "Point", // coordinates: [longitude, latitude] // }, // properties: { // description: "Point de signalement", // date: "2023-10-01T12:00:00Z", // }, // } // ] // } // }
-
setIcon(icon)
Controls/Reporting/Reporting.js, line 72 -
This method sets the icon for the input action.
It updates the icon property with the provided value.
If the icon is not provided, it defaults to a base64 encoded SVG string.Name Type Description icon String Icon URL or base64 encoded string.
-
setMap(map)
Controls/Reporting/Reporting.js, line 59 -
Set the map for this action
Name Type Description map ol.Map Map.