Fix track node to also be able to delete layers
This commit is contained in:
parent
ca8cd8e24e
commit
83c726966a
@ -1,7 +1,8 @@
|
||||
### Change Log for Node-RED Worldmap
|
||||
|
||||
- v2.0.16 - Revert use of ES6 import. Keep IE11 happy for while.
|
||||
- v2.0.13 - Fix tracks colour.
|
||||
- v2.0.17 - Let clear command also clear tracks from tracks node
|
||||
- v2.0.16 - Revert use of ES6 import. Keep IE11 happy for while
|
||||
- v2.0.13 - Fix tracks colour
|
||||
- v2.0.12 - Ensure default icon is in place if not specified (regression)
|
||||
- v2.0.9 - Only update maxage on screen once it exists
|
||||
- v2.0.8 - Drop beta flag, re-organise index, js and css files. Now using leaflet 1.4
|
||||
|
@ -9,7 +9,8 @@ map web page for plotting "things" on.
|
||||
|
||||
### Updates
|
||||
|
||||
- v2.0.14 - Revert use of ES6 import.
|
||||
- v2.0.17 - Let clear command also clear tracks from tracks node
|
||||
- v2.0.16 - Revert use of ES6 import. Keep IE11 happy for while
|
||||
- v2.0.13 - Fix tracks colour.
|
||||
- v2.0.12 - Ensure default icon is in place if not specified (regression)
|
||||
- v2.0.9 - Only update maxage on screen once it exists
|
||||
@ -296,7 +297,7 @@ Optional properties include
|
||||
- **bounds** - sets the bounds of an Overlay-Image. 2 Dimensional Array that defines the top-left and bottom-right Corners (lat/lon Points)
|
||||
- **delete** - name or array of names of base layers and/or overlays to delete and remove from layer menu.
|
||||
- **heatmap** - set heatmap options object see https://github.com/Leaflet/Leaflet.heat#reference
|
||||
- **clear** - layer name - to clear a complete layer and remove from layer menu
|
||||
- **clear** - layer name - to clear a complete layer and remove from layer menu - `{"command":{"clear":"myOldLayer"}}`
|
||||
- **panlock** - lock the map area to the current visible area. - `{"command":{"panlock":true}}`
|
||||
- **zoomlock** - locks the zoom control to the current value and removes zoom control - `{"command":{"zoomlock":true}}`
|
||||
- **hiderightclick** - disables the right click that allows adding or deleting points on the map - `{"command":{"hiderightclick":true}}`
|
||||
@ -473,7 +474,9 @@ see https://github.com/cloudybay/leaflet.latlng-graticule for more details about
|
||||
|
||||
#### To clear all markers from a layer, or an overlay from the map
|
||||
|
||||
msg.payload.command.clear = "name of your layer/overlay to remove";
|
||||
msg.payload.command.clear = "name of the layer/overlay you wish to clear";
|
||||
|
||||
Feeding this into the tracks node will also remove the tracks stored for that layer.
|
||||
|
||||
### Using a local Map Server (WMS server)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-contrib-web-worldmap",
|
||||
"version": "2.0.16",
|
||||
"version": "2.0.17",
|
||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||
"dependencies": {
|
||||
"cgi": "0.3.1",
|
||||
|
@ -237,6 +237,15 @@ module.exports = function(RED) {
|
||||
node.send(newmsg); // send the track
|
||||
}
|
||||
}
|
||||
if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("command") && msg.payload.command.hasOwnProperty("clear")) {
|
||||
for (var p in node.pointsarray) {
|
||||
if (node.pointsarray.hasOwnProperty(p)) {
|
||||
if (node.pointsarray[p][0].layer === msg.payload.command.clear) {
|
||||
delete node.pointsarray[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
node.on("close", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user