/location/decorate
The location decorator module provides methods to decorate an object as location typedef.
Dictionary entries:
- confirm_delete
- location_save_changes
- Source
Requires
Methods
(async, inner) confirmUpdate(callbackopt) → {Promise.<(true|null)>}
The method checks for unsaved changes in the location infoj entries.
A confirm dialog is presented if unsaved changes are detected.
Confirming the dialog will call the location update method with the provided callback param. The method will return true in this case.
null will be returned if the user cancels the confirm dialog.
Name | Type | Attributes | Description |
---|---|---|---|
callback | function | <optional> | The callback function overrides the default location updateCallbacks. |
- Source
Returns true after the location update has been executed. Returns null if the update is cancelled.
- Type:
- Promise.<(true|null)>
(inner) decorate(location) → {location}
The location decorator method creates mapp-location typedef object from a JSON location.
Name | Type | Description |
---|---|---|
location | object | JSON location. |
- Source
Decorated Mapp Location.
- Type:
- location
(async, inner) flyTo(maxZoomopt)
Centers the mapview arround the outermost extent of a location, this will also adhere to the maximum zoom level specified on the layer.
The greatest extent of these is used in module:/mapview/fitView.
Name | Type | Attributes | Description |
---|---|---|---|
maxZoom | integer | <optional> | The maximum zoom level of the layer. |
- Source
(async, inner) getExtent() → {Promise.<Array>}
The method iterates over the location Layers and calculates the overall extent returned from the individual extent methods.
- Source
The overall extent returned from the Extents methods.
- Type:
- Promise.<Array>
(inner) remove()
The remove method is bound to a location in the location.decorate method.
this being the location, the method will first remove itself to prevent the method being called twice.
The remove method will free the location record by deleting the location.hook.
A location.view HTMLElement will be removed from the DOM.
Any Openlayers layer in the location.Layers[] array will be removed from the mapview.
The highlight interaction will be assigned to the location mapview.
The location layer will be reload [and restyled in the process].
Any methods in the location.removeCallbacks[] array will be executed.
- Source
(inner) removeEdits()
The method parses the location infoj entries deletes newValue properties of each entry and assigns the edit property as _edit which makes edits unvailable for this location.
- Source
(inner) removeEdits()
The method parses the location infoj entries and assigns the _edit property of each entry as edit property to enable location edits.
- Source
(inner) removeLayer()
The location method removes an OL layer from the locations mapview and Layers array.
- Source
(async, inner) syncFields(fields)
The syncFields method sends a parameterised query to the location_get query template. The fields parameter will be populated from the fields params argument.
Values of the location [this] infoj entry matching the fields will be updated with values from the query response.
Name | Type | Description |
---|---|---|
fields | array |
- Source
(async, inner) update(callbackopt)
The update method will abort if some of the location.infoj entries is invalid.
JSON newValues are created for any json or jsonb type entries in the location.infoj array.
An xhr POST request with all newValues is passed to location_update query template.
infoj entry values are set to the newValues after a successful update.
Dependent fields for updated entries is an array of fields that is passed to the syncFields method, to retrieve the updated values from the location.
These dependents fields are reloaded with the updated values from the location.
Dependent layers is an array of layer keys that will be reloaded after the update.
A callback function can be provided to override the execution of methods in the location updateCallbacks array. This allows to provide a function to render the location view without changing the editing state and execute a modify or draw interaction from a geometry entry.
Name | Type | Attributes | Description |
---|---|---|---|
callback | function | <optional> | The callback function overrides the default location updateCallbacks. |
- Source