diff --git a/CHANGELOG.md b/CHANGELOG.md index d3bd247..a2445c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ### Change Log for Node-RED Worldmap + - v2.22.0 - Separate out layer events in worldmap in + - v2.21.9 - Unbreak Drawing layer that I must have broken recently - v2.21.8 - Let SIDC/icon short code be only 4 chars long - v2.21.5 - Fix handling of "old" ship nav to ship navigation - v2.21.4 - Fix speed leader length. Add transparentPixels option. diff --git a/README.md b/README.md index 56c9f82..4a2426e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ map web page for plotting "things" on. ### Updates +- v2.22.0 - Separate out layer events in worldmap in +- v2.21.9 - Unbreak Drawing layer that I must have broken recently - v2.21.8 - Let SIDC/icon short code be only 4 chars long - v2.21.5 - Fix handling of "old" ship nav to ship navigation - v2.21.4 - Fix speed leader length. Add transparentPixels option.. @@ -29,13 +31,6 @@ map web page for plotting "things" on. - v2.16.3 - Ensure polygons can be deleted. - v2.16.2 - Better handling of unpacked kmz objects. - v2.16.0 - Allow specifying custom base map server. -- v2.15.8 - Adjust ui check timing for UI worldmap. -- v2.15.7 - Tidy up geoJson handling a bit more. -- v2.15.5 - Fix SIDC icons to accept unicoded icons as labels. -- v2.15.4 - Let clear heatmap command do what it says. -- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments. -- v2.15.0 - Let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s. -- v2.14.0 - Let geojson features be clickable if added as overlay. - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes. @@ -464,6 +459,13 @@ Or with an input box contextmenu: '' } +Example simple form + +``` +[{"id":"7351100bacb1f5fe","type":"function","z":"4aa2ed2fd1b11362","name":"","func":"msg.payload = { command: {\ncontextmenu: String.raw`\nText
\nNumber
\n\n`\n}}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":360,"wires":[["a6a82f2e8efc44fc"]]},{"id":"7b595f0c8f6ac710","type":"worldmap in","z":"4aa2ed2fd1b11362","name":"","path":"/worldmap","events":"connect","x":195,"y":360,"wires":[["7351100bacb1f5fe"]]}] +``` + + See the section on **Utility Functions** for details of the feedback function. #### To add and remove a legend diff --git a/package.json b/package.json index e73322c..a667975 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-web-worldmap", - "version": "2.21.8", + "version": "2.22.0", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "@turf/bezier-spline": "~6.5.0", diff --git a/worldmap.html b/worldmap.html index d683abb..410825a 100644 --- a/worldmap.html +++ b/worldmap.html @@ -604,7 +604,7 @@ If Web Path is left empty, then by default ⌘⇧m - c defaults: { name: {value:""}, path: {value:"/worldmap"}, - events: {value:"connect,disconnect,point,bounds,files,draw,other"} + events: {value:"connect,disconnect,point,layer,bounds,files,draw,other"} }, inputs:0, outputs:1, @@ -620,7 +620,7 @@ If Web Path is left empty, then by default ⌘⇧m - c }, oneditprepare: function() { if ($("#node-input-events").val() === "all") { - $("#node-input-events").val("connect,disconnect,point,bounds,files,draw,other"); + $("#node-input-events").val("connect,disconnect,point,layer,bounds,files,draw,other"); } $("#node-input-events").typedInput({type:"event", types:[{ value: "event", @@ -629,6 +629,7 @@ If Web Path is left empty, then by default ⌘⇧m - c { value: "connect", label: "Connect"}, { value: "disconnect", label: "Disconnect"}, { value: "point", label: "Add, move, delete point"}, + { value: "layer", label: "Add, remove layers"}, { value: "bounds", label: "Boundary change"}, { value: "files", label: "File drop"}, { value: "draw", label: "Drawing"}, diff --git a/worldmap.js b/worldmap.js index 4982933..5b8def7 100644 --- a/worldmap.js +++ b/worldmap.js @@ -252,6 +252,9 @@ module.exports = function(RED) { if ((node.events.indexOf("point")!==-1) && ((message.action === "point")||(message.action === "move")||(message.action === "delete") )) { setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})}); } + if ((node.events.indexOf("layer")!==-1) && ((message.action === "layer") )) { + setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})}); + } if ((node.events.indexOf("files")!==-1) && (message.action === "file")) { message.content = Buffer.from(message.content.split('base64,')[1], 'base64'); setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})}); diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index 2f7b9d9..847c62e 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -28,7 +28,10 @@ var heat; var minimap; var sidebyside; var layercontrol; +var drawControl; var drawingColour = "#910000"; +var sendRoute; +var sendDrawing; var iconSz = { "Team/Crew": 24, @@ -930,7 +933,7 @@ var addOverlays = function(overlist) { overlays["drawing"] = layers["_drawing"]; map.options.drawControlTooltips = false; var drawCount = 0; - var drawControl = new L.Control.Draw({ + drawControl = new L.Control.Draw({ draw: { polyline: { shapeOptions: { clickable:true } }, marker: false, @@ -996,7 +999,7 @@ var addOverlays = function(overlist) { setTimeout(function() {map.openPopup(rightmenuMarker)},25); }); - var sendDrawing = function(n) { + sendDrawing = function(n) { var thing = document.getElementById('dinput').value; map.closePopup(); shape.m.name = thing; @@ -1079,7 +1082,7 @@ var addOverlays = function(overlist) { return numbers; } - var sendRoute = function(n) { + sendRoute = function(n) { var p = (polygons[n]._latlngs.map(function(x) { return x.lng+","+x.lat; })).join(';');