import Openlayers from '@nautoguide/ourthings/ourthings/Queueable/Openlayers.js'
Method Summary
Public Methods | ||
public |
addFeature(pid: *, json: *) Add a feature to the Map TODO: This is old code for getting something working. |
|
public |
addGeojson(pid: *, json: *) Add geojson features to a layer |
|
public |
Add a layer to the map |
|
public |
Create a new map |
|
public |
addOverlay(pid: *, json: *) Add an overlay to the map |
|
public |
addRenderComplete(pid: int, json: object) Add an event that sets a register when render is complete |
|
public |
animateZoom(pid: *, json: *) Zoom a layer to the extent of its features (needs appropriate zoom levels to work well |
|
public |
centerOnCoordinate(pid: *, json: *) Move the map so the cords are at the center |
|
public |
changed(pid: *, json: *) Flag a layer as changed (cause redraw). |
|
public |
clearLayer(pid: *, json: *) Remove the data from a layer on the map. |
|
public |
controlSet(pid: *, json: *) Set a controls(s) to the requested mode and set others to opposit state |
|
public |
controlTrigger(pid: *, json: *) trigger a controls(s) sub functions (init is default) See example in simple select for how to code for this |
|
public |
coordinatesToWKT(pid: *, json: *) Convert a coordinate to WKT |
|
public |
deleteFeatureById(pid: *, json: *) Delete features from layer by id |
|
public |
enableAllMapsLoadedCheck(pid: *, json: *) |
|
public |
enableLoadCheck(pid: *, json: *) |
|
public |
findFeatures(pid: *, json: *): * Use a filter object to locate features on a single layer |
|
public |
flyTo(pid: *, json: *) Zoom a layer to the extent of its features (needs appropriate zoom levels to work well |
|
public |
getGeojson(pid: *, json: *) gets geojson features to a layer |
|
public |
init(queue: *) |
|
public |
makeContiguous(pid: *, json: *) |
|
public |
makeControl(pid: *, json: *): boolean Make a new control |
|
public |
mergeFeaturesById(pid: *, json: *) merge features from layer by id |
|
public |
propertiesClean(pid: *, json: *) Clean and/or default feature properties |
|
public |
removeOverlay(pid: *, json: *) Remove an overlay from the map |
|
public |
setFeaturePropertyById(pid: *, json: *) Set a features properties by id |
|
public |
setFeaturesPropertiesById(pid: *, json: *) Set features properties by id |
|
public |
setLayerActive(pid: *, json: *) set layer on or off |
|
public |
simpleClick(pid: *, json: *) Use the standard click event |
|
public |
splitFeatures(pid: *, json: *): boolean split featues using a line string |
|
public |
toggleLayer(pid: *, json: *) Toggle layer on and off |
|
public |
updateResolution(pid: *, json: *) |
|
public |
updateSize(pid: *, json: *) Update size of map (in the event of resize or rotation this will fix it) |
|
public |
zoomToLayerExtent(pid: *, json: *) Zoom a layer to the extent of its features (needs appropriate zoom levels to work well |
Private Methods | ||
private |
_addLayer_heatmap(options: *): VectorLayer Add a heatmap layer |
|
private |
_addLayer_osm(options: *): TileLayer Add an osm layer |
|
private |
_addLayer_vector(options: *): VectorLayer Add a vector layer |
|
private |
_addLayer_wms(options: *): TileLayer Add a wms layer |
|
private |
_addLayer_wmts(options: *): TileLayer Add an wmts layer |
|
private |
_addLayer_xyz(options: *): TileLayer Add an xyz layer |
|
private |
_checkLayerLoadState(map: *, register: *): boolean |
|
private |
|
|
private |
_cleanCoords(coords: *): * |
|
private |
_control_drawFeature(json: *): * |
|
private |
_control_multiEdit(json: *): * MultiEdit tool |
|
private |
_control_simpleSelect(json: *): * Use the standard openlayers select control |
|
private |
_control_snap(json: *): * |
|
private |
_debug(event: *) |
|
private |
_decodeCoords(cords: *, projection: *): number[] Clean up coordinates in any format and reproject |
|
private |
_featureSearch(source: *, searchString: *): * |
|
private |
_featureToTurfPolygon(feature: *): [] Convert a feature of polygons to a turf polygon of correct type |
|
private |
_featuresToGeojson(toProjection: *, fromProjection: *, features: *): * turn a features array into gejson |
|
private |
_idFeatures(features: *): * Openlayers doesn't ID features by default. This will apply a unique id to all features passed to it |
|
private |
_loadGeojson(geojson: *): * Loads geojson from var or object |
|
private |
_makeContiguous(featuresJSON: *, tolerance: *) |
|
private |
_multiFeatureToPolygon(feature: *): [] Convert a feature of multiPolygon to a featue(s) of Polygons. |
|
private |
_toggleControl(map: *, control: *) Toggle a control between on/off |
|
private |
_updateResolution(map: *, name: *) |
Inherited Summary
From class Queueable | ||
public |
queue: * |
|
public |
|
|
public |
finished(pid: *, mode: *) Call this method after you command has finished. |
|
public |
init(queue: *) init, override this for any promise based inits setting the self.ready=true after the promise |
|
public |
set(pid: *, value: *) |
|
public |
start(pid: *, command: *, json: *) Called from queue, starts running the actual command |
Public Methods
public addFeature(pid: *, json: *) source
Add a feature to the Map TODO: This is old code for getting something working. Needs functionising, not for production
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public addGeojson(pid: *, json: *) source
Add geojson features to a layer
public addLayer(pid: int, json: object): boolean source
Add a layer to the map
Params:
Name | Type | Attribute | Description |
pid | int | process ID |
|
json | object | queue arguments |
|
json.map | string | name for the map (used to reference) |
|
json.name | string | name for the layer (used to reference) |
|
json.typr | string | Layer type osm,vector |
|
json.opacity | float | layer opacity |
|
json.transparent | boolean | is the layer transparent? |
|
json.style | string | Style object to use |
|
json.active | boolean | Is the layer active |
|
json.loadIgnore | boolean | Ignore this layer for loadchecking |
|
json.geojson | object | string | geojson to add to the layer (vector) |
Example:
openlayer.addLayer();
public addMap(pid: int, json: object) source
Create a new map
Params:
Name | Type | Attribute | Description |
pid | int | process ID |
|
json | object | queue arguments |
|
json.map | string | name for the map (used to reference) |
|
json.target | string | id of element in the page to target |
|
json.zoom | int | initial zoom level |
|
json.maxZoom | int | Maximum zoom |
|
json.center | array | Center on |
|
json.renderer | string | Renderers to use |
Example:
openlayer.addMap();
public addOverlay(pid: *, json: *) source
Add an overlay to the map
Example:
openlayers.addOverlay({"targetId":"#functionOverlay","coordinate":"{{!^JSON.stringify(memory.simpleSelect.value.mapBrowserEvent.coordinate)}}"});
public addRenderComplete(pid: int, json: object) source
Add an event that sets a register when render is complete
Be warned this only works if you start it after all layers are added and those layer include their data
Example:
openlayer.addRenderComplete();
public animateZoom(pid: *, json: *) source
Zoom a layer to the extent of its features (needs appropriate zoom levels to work well
Example:
openlayers.animateZoom({"inc":"2});
public centerOnCoordinate(pid: *, json: *) source
Move the map so the cords are at the center
Example:
openlayers.centerOnCoordinate({"coordinate":"{{!^JSON.stringify(memory.simpleSelect.value.selected[0].getGeometry().getCoordinates())}}"});
public changed(pid: *, json: *) source
Flag a layer as changed (cause redraw).
public clearLayer(pid: *, json: *) source
Remove the data from a layer on the map.
public controlSet(pid: *, json: *) source
Set a controls(s) to the requested mode and set others to opposit state
public controlTrigger(pid: *, json: *) source
trigger a controls(s) sub functions (init is default) See example in simple select for how to code for this
public coordinatesToWKT(pid: *, json: *) source
Convert a coordinate to WKT
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public deleteFeatureById(pid: *, json: *) source
Delete features from layer by id
public enableAllMapsLoadedCheck(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public enableLoadCheck(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public findFeatures(pid: *, json: *): * source
Use a filter object to locate features on a single layer
Return:
* |
public flyTo(pid: *, json: *) source
Zoom a layer to the extent of its features (needs appropriate zoom levels to work well
Example:
openlayers.flyTo({"location":"2});
public getGeojson(pid: *, json: *) source
gets geojson features to a layer
public init(queue: *) source
init, override this for any promise based inits setting the self.ready=true after the promise
Override:
Queueable#initParams:
Name | Type | Attribute | Description |
queue | * |
public makeContiguous(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public mergeFeaturesById(pid: *, json: *) source
merge features from layer by id
public propertiesClean(pid: *, json: *) source
Clean and/or default feature properties
public removeOverlay(pid: *, json: *) source
Remove an overlay from the map
Example:
openlayers.removeOverlay();
public setFeaturePropertyById(pid: *, json: *) source
Set a features properties by id
public setFeaturesPropertiesById(pid: *, json: *) source
Set features properties by id
public setLayerActive(pid: *, json: *) source
set layer on or off
public simpleClick(pid: *, json: *) source
Use the standard click event
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public toggleLayer(pid: *, json: *) source
Toggle layer on and off
public updateResolution(pid: *, json: *) source
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * |
public updateSize(pid: *, json: *) source
Update size of map (in the event of resize or rotation this will fix it)
Params:
Name | Type | Attribute | Description |
pid | * | ||
json | * | ||
json.map | string | Map reference can be * and all maps will be targeted |
Example:
openlayers.updateSize({"map":"map_1"});
public zoomToLayerExtent(pid: *, json: *) source
Zoom a layer to the extent of its features (needs appropriate zoom levels to work well
Example:
openlayers.zoomToLayerExtent({"map":"map_1","layer":"data"});
Private Methods
private _addLayer_heatmap(options: *): VectorLayer source
Add a heatmap layer
Params:
Name | Type | Attribute | Description |
options | * |
Return:
VectorLayer |
private _addLayer_osm(options: *): TileLayer source
Add an osm layer
Params:
Name | Type | Attribute | Description |
options | * |
Return:
TileLayer |
private _addLayer_vector(options: *): VectorLayer source
Add a vector layer
Params:
Name | Type | Attribute | Description |
options | * |
Return:
VectorLayer |
private _addLayer_wms(options: *): TileLayer source
Add a wms layer
Params:
Name | Type | Attribute | Description |
options | * |
Return:
TileLayer |
private _addLayer_wmts(options: *): TileLayer source
Add an wmts layer
Params:
Name | Type | Attribute | Description |
options | * |
Return:
TileLayer |
private _addLayer_xyz(options: *): TileLayer source
Add an xyz layer
Params:
Name | Type | Attribute | Description |
options | * |
Return:
TileLayer |
private _checkLayerLoadState(map: *, register: *): boolean source
Params:
Name | Type | Attribute | Description |
map | * | ||
register | * |
private _control_drawFeature(json: *): * source
Params:
Name | Type | Attribute | Description |
json | * |
Return:
* |
private _control_simpleSelect(json: *): * source
Use the standard openlayers select control
Return:
* |
private _debug(event: *) source
Params:
Name | Type | Attribute | Description |
event | * |
private _decodeCoords(cords: *, projection: *): number[] source
Clean up coordinates in any format and reproject
Params:
Name | Type | Attribute | Description |
cords | * | ||
projection | * |
private _featureSearch(source: *, searchString: *): * source
Params:
Name | Type | Attribute | Description |
source | * | ||
searchString | * |
Return:
* |
private _featureToTurfPolygon(feature: *): [] source
Convert a feature of polygons to a turf polygon of correct type
Params:
Name | Type | Attribute | Description |
feature | * |
Return:
[] |
private _featuresToGeojson(toProjection: *, fromProjection: *, features: *): * source
turn a features array into gejson
Params:
Name | Type | Attribute | Description |
toProjection | * | ||
fromProjection | * | ||
features | * |
Return:
* |
private _idFeatures(features: *): * source
Openlayers doesn't ID features by default. This will apply a unique id to all features passed to it
Params:
Name | Type | Attribute | Description |
features | * |
Return:
* |
private _loadGeojson(geojson: *): * source
Loads geojson from var or object
Params:
Name | Type | Attribute | Description |
geojson | * |
Return:
* |
private _makeContiguous(featuresJSON: *, tolerance: *) source
Params:
Name | Type | Attribute | Description |
featuresJSON | * | ||
tolerance | * |
private _multiFeatureToPolygon(feature: *): [] source
Convert a feature of multiPolygon to a featue(s) of Polygons. No properies are copied
Params:
Name | Type | Attribute | Description |
feature | * |
Return:
[] |
private _toggleControl(map: *, control: *) source
Toggle a control between on/off
Params:
Name | Type | Attribute | Description |
map | * | ||
control | * |
private _updateResolution(map: *, name: *) source
Params:
Name | Type | Attribute | Description |
map | * | ||
name | * |