node-red-contrib-web-worldmap 2.21.6 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/README.md +10 -7
- package/package.json +1 -1
- package/worldmap/worldmap.js +9 -5
- package/worldmap.html +3 -2
- package/worldmap.js +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.22.0 - Separate out layer events in worldmap in
|
|
4
|
+
- v2.21.9 - Unbreak Drawing layer that I must have broken recently
|
|
5
|
+
- v2.21.8 - Let SIDC/icon short code be only 4 chars long
|
|
3
6
|
- v2.21.5 - Fix handling of "old" ship nav to ship navigation
|
|
4
7
|
- v2.21.4 - Fix speed leader length. Add transparentPixels option.
|
|
5
8
|
- v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels.
|
package/README.md
CHANGED
|
@@ -11,6 +11,9 @@ map web page for plotting "things" on.
|
|
|
11
11
|
|
|
12
12
|
### Updates
|
|
13
13
|
|
|
14
|
+
- v2.22.0 - Separate out layer events in worldmap in
|
|
15
|
+
- v2.21.9 - Unbreak Drawing layer that I must have broken recently
|
|
16
|
+
- v2.21.8 - Let SIDC/icon short code be only 4 chars long
|
|
14
17
|
- v2.21.5 - Fix handling of "old" ship nav to ship navigation
|
|
15
18
|
- v2.21.4 - Fix speed leader length. Add transparentPixels option..
|
|
16
19
|
- v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels.
|
|
@@ -28,13 +31,6 @@ map web page for plotting "things" on.
|
|
|
28
31
|
- v2.16.3 - Ensure polygons can be deleted.
|
|
29
32
|
- v2.16.2 - Better handling of unpacked kmz objects.
|
|
30
33
|
- v2.16.0 - Allow specifying custom base map server.
|
|
31
|
-
- v2.15.8 - Adjust ui check timing for UI worldmap.
|
|
32
|
-
- v2.15.7 - Tidy up geoJson handling a bit more.
|
|
33
|
-
- v2.15.5 - Fix SIDC icons to accept unicoded icons as labels.
|
|
34
|
-
- v2.15.4 - Let clear heatmap command do what it says.
|
|
35
|
-
- v2.15.3 - Fix panit command to work, try to use alt units, popup alignments.
|
|
36
|
-
- v2.15.0 - Let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s.
|
|
37
|
-
- v2.14.0 - Let geojson features be clickable if added as overlay.
|
|
38
34
|
|
|
39
35
|
- see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
|
|
40
36
|
|
|
@@ -463,6 +459,13 @@ Or with an input box
|
|
|
463
459
|
contextmenu: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(this.name,this.value,"myEventName")\' >'
|
|
464
460
|
}
|
|
465
461
|
|
|
462
|
+
Example simple form
|
|
463
|
+
|
|
464
|
+
```
|
|
465
|
+
[{"id":"7351100bacb1f5fe","type":"function","z":"4aa2ed2fd1b11362","name":"","func":"msg.payload = { command: {\ncontextmenu: String.raw`\nText <input type=\"text\" id=\"sometext\" value=\"hello\"><br/>\nNumber <input type=\"number\" id=\"somenum\" value=\"5\"><br/>\n<input type=\"button\" value=\"Send\" onclick=\n'feedback(\"myform\",{\n \"st\":document.getElementById(\"sometext\").value,\n \"sn\":document.getElementById(\"somenum\").value,\n})'\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"]]}]
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
|
|
466
469
|
See the section on **Utility Functions** for details of the feedback function.
|
|
467
470
|
|
|
468
471
|
#### To add and remove a legend
|
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -28,7 +28,10 @@ var heat;
|
|
|
28
28
|
var minimap;
|
|
29
29
|
var sidebyside;
|
|
30
30
|
var layercontrol;
|
|
31
|
+
var drawControl;
|
|
31
32
|
var drawingColour = "#910000";
|
|
33
|
+
var sendRoute;
|
|
34
|
+
var sendDrawing;
|
|
32
35
|
|
|
33
36
|
var iconSz = {
|
|
34
37
|
"Team/Crew": 24,
|
|
@@ -653,7 +656,8 @@ map.on('moveend', function() {
|
|
|
653
656
|
//});
|
|
654
657
|
|
|
655
658
|
// single right click to add a marker
|
|
656
|
-
var addmenu = "<b>Add marker</b><br><input type='text' id='rinput' autofocus onkeydown='if (event.keyCode == 13) addThing();' placeholder='name (,icon, layer, colour, heading)'/>";
|
|
659
|
+
var addmenu = "<b>Add marker</b><br><input type='text' id='rinput' autofocus onkeydown='if (event.keyCode == 13) addThing();' placeholder='name (,icon/SIDC, layer, colour, heading)'/>";
|
|
660
|
+
if (navigator.onLine) { addmenu += '<br/><a href="https://spatialillusions.com/unitgenerator/" target="_new">MilSymbol SIDC generator</a>'; }
|
|
657
661
|
var rightmenuMap = L.popup({keepInView:true, minWidth:250}).setContent(addmenu);
|
|
658
662
|
|
|
659
663
|
var rclk = {};
|
|
@@ -668,7 +672,7 @@ var addThing = function() {
|
|
|
668
672
|
var colo = (bits[3] || "#910000").trim();
|
|
669
673
|
var hdg = parseFloat(bits[4] || 0);
|
|
670
674
|
var drag = true;
|
|
671
|
-
var regi = /^[S,G,E,I,O][A-Z]{
|
|
675
|
+
var regi = /^[S,G,E,I,O][A-Z]{3}.*/i; // if it looks like a SIDC code
|
|
672
676
|
var d = {action:"point", name:bits[0].trim(), layer:lay, draggable:drag, lat:rclk.lat, lon:rclk.lng, hdg:hdg};
|
|
673
677
|
if (regi.test(icon)) {
|
|
674
678
|
d.SIDC = (icon.toUpperCase()+"------------").substr(0,12);
|
|
@@ -929,7 +933,7 @@ var addOverlays = function(overlist) {
|
|
|
929
933
|
overlays["drawing"] = layers["_drawing"];
|
|
930
934
|
map.options.drawControlTooltips = false;
|
|
931
935
|
var drawCount = 0;
|
|
932
|
-
|
|
936
|
+
drawControl = new L.Control.Draw({
|
|
933
937
|
draw: {
|
|
934
938
|
polyline: { shapeOptions: { clickable:true } },
|
|
935
939
|
marker: false,
|
|
@@ -995,7 +999,7 @@ var addOverlays = function(overlist) {
|
|
|
995
999
|
setTimeout(function() {map.openPopup(rightmenuMarker)},25);
|
|
996
1000
|
});
|
|
997
1001
|
|
|
998
|
-
|
|
1002
|
+
sendDrawing = function(n) {
|
|
999
1003
|
var thing = document.getElementById('dinput').value;
|
|
1000
1004
|
map.closePopup();
|
|
1001
1005
|
shape.m.name = thing;
|
|
@@ -1078,7 +1082,7 @@ var addOverlays = function(overlist) {
|
|
|
1078
1082
|
return numbers;
|
|
1079
1083
|
}
|
|
1080
1084
|
|
|
1081
|
-
|
|
1085
|
+
sendRoute = function(n) {
|
|
1082
1086
|
var p = (polygons[n]._latlngs.map(function(x) {
|
|
1083
1087
|
return x.lng+","+x.lat;
|
|
1084
1088
|
})).join(';');
|
package/worldmap.html
CHANGED
|
@@ -604,7 +604,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|
|
604
604
|
defaults: {
|
|
605
605
|
name: {value:""},
|
|
606
606
|
path: {value:"/worldmap"},
|
|
607
|
-
events: {value:"connect,disconnect,point,bounds,files,draw,other"}
|
|
607
|
+
events: {value:"connect,disconnect,point,layer,bounds,files,draw,other"}
|
|
608
608
|
},
|
|
609
609
|
inputs:0,
|
|
610
610
|
outputs:1,
|
|
@@ -620,7 +620,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|
|
620
620
|
},
|
|
621
621
|
oneditprepare: function() {
|
|
622
622
|
if ($("#node-input-events").val() === "all") {
|
|
623
|
-
$("#node-input-events").val("connect,disconnect,point,bounds,files,draw,other");
|
|
623
|
+
$("#node-input-events").val("connect,disconnect,point,layer,bounds,files,draw,other");
|
|
624
624
|
}
|
|
625
625
|
$("#node-input-events").typedInput({type:"event", types:[{
|
|
626
626
|
value: "event",
|
|
@@ -629,6 +629,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|
|
629
629
|
{ value: "connect", label: "Connect"},
|
|
630
630
|
{ value: "disconnect", label: "Disconnect"},
|
|
631
631
|
{ value: "point", label: "Add, move, delete point"},
|
|
632
|
+
{ value: "layer", label: "Add, remove layers"},
|
|
632
633
|
{ value: "bounds", label: "Boundary change"},
|
|
633
634
|
{ value: "files", label: "File drop"},
|
|
634
635
|
{ value: "draw", label: "Drawing"},
|
package/worldmap.js
CHANGED
|
@@ -151,13 +151,11 @@ module.exports = function(RED) {
|
|
|
151
151
|
var height = config.height;
|
|
152
152
|
if (height == 0) { height = 10; }
|
|
153
153
|
var size = ui.getSizes();
|
|
154
|
-
var frameWidth = (size.sx +size.cx) * width - size.cx;
|
|
155
|
-
var frameHeight = (size.sy +size.cy) * height - size.cy;
|
|
154
|
+
var frameWidth = (size.sx + size.cx) * width - size.cx;
|
|
155
|
+
var frameHeight = (size.sy + size.cy) * height - size.cy;
|
|
156
156
|
var url = encodeURI(config.path);
|
|
157
157
|
var html = `<style>.nr-dashboard-ui_worldmap{padding:0;}</style><div style="overflow:hidden;">
|
|
158
|
-
<iframe src="${url}" width="${frameWidth}px" height="${frameHeight}px" style="border:none;"></iframe
|
|
159
|
-
</div>
|
|
160
|
-
`;
|
|
158
|
+
<iframe src="${url}" width="${frameWidth}px" height="${frameHeight}px" style="border:none;"></iframe></div>`;
|
|
161
159
|
return html;
|
|
162
160
|
}
|
|
163
161
|
|
|
@@ -219,7 +217,8 @@ module.exports = function(RED) {
|
|
|
219
217
|
}
|
|
220
218
|
setImmediate(function() { RED.nodes.registerType("ui_worldmap", UIWorldMap) });
|
|
221
219
|
}
|
|
222
|
-
},
|
|
220
|
+
}, 100);
|
|
221
|
+
|
|
223
222
|
|
|
224
223
|
var WorldMapIn = function(n) {
|
|
225
224
|
RED.nodes.createNode(this,n);
|
|
@@ -253,6 +252,9 @@ module.exports = function(RED) {
|
|
|
253
252
|
if ((node.events.indexOf("point")!==-1) && ((message.action === "point")||(message.action === "move")||(message.action === "delete") )) {
|
|
254
253
|
setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
|
|
255
254
|
}
|
|
255
|
+
if ((node.events.indexOf("layer")!==-1) && ((message.action === "layer") )) {
|
|
256
|
+
setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
|
|
257
|
+
}
|
|
256
258
|
if ((node.events.indexOf("files")!==-1) && (message.action === "file")) {
|
|
257
259
|
message.content = Buffer.from(message.content.split('base64,')[1], 'base64');
|
|
258
260
|
setImmediate(function() {node.send({payload:message, topic:node.path.substr(1), _sessionid:client.id, _sessionip:sessionip})});
|
|
@@ -288,6 +290,7 @@ module.exports = function(RED) {
|
|
|
288
290
|
}
|
|
289
291
|
RED.nodes.registerType("worldmap in",WorldMapIn);
|
|
290
292
|
|
|
293
|
+
|
|
291
294
|
var WorldMapTracks = function(n) {
|
|
292
295
|
RED.nodes.createNode(this,n);
|
|
293
296
|
this.depth = parseInt(Number(n.depth) || 20);
|
|
@@ -407,6 +410,7 @@ module.exports = function(RED) {
|
|
|
407
410
|
}
|
|
408
411
|
RED.nodes.registerType("worldmap-tracks",WorldMapTracks);
|
|
409
412
|
|
|
413
|
+
|
|
410
414
|
var WorldMapHull = function(n) {
|
|
411
415
|
RED.nodes.createNode(this,n);
|
|
412
416
|
this.prop = n.prop || "layer";
|