node-red-contrib-web-worldmap 2.21.5 → 2.21.9

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
- - v2.21.5 - Fix handling of "old" sjip nav to ship navigat
3
+ - v2.21.8 - Let SIDC/icon short code be only 4 chars long
4
+ - v2.21.5 - Fix handling of "old" ship nav to ship navigation
4
5
  - v2.21.4 - Fix speed leader length. Add transparentPixels option.
5
6
  - v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels.
6
7
  - v2.21.2 - Expand ship nav to ship navigation.
package/README.md CHANGED
@@ -11,7 +11,9 @@ map web page for plotting "things" on.
11
11
 
12
12
  ### Updates
13
13
 
14
- - v2.21.5 - Fix handling of "old" sjip nav to ship navigation
14
+ - v2.21.9 - Unbreak Drawing layer that I must have broken recently
15
+ - v2.21.8 - Let SIDC/icon short code be only 4 chars long
16
+ - v2.21.5 - Fix handling of "old" ship nav to ship navigation
15
17
  - v2.21.4 - Fix speed leader length. Add transparentPixels option..
16
18
  - v2.21.3 - Add zoom to bounds action. Adjust map layers max zoom levels.
17
19
  - v2.21.2 - Expand ship nav to ship navigation.
@@ -28,13 +30,6 @@ map web page for plotting "things" on.
28
30
  - v2.16.3 - Ensure polygons can be deleted.
29
31
  - v2.16.2 - Better handling of unpacked kmz objects.
30
32
  - 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
33
 
39
34
  - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
40
35
 
@@ -463,6 +458,13 @@ Or with an input box
463
458
  contextmenu: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(this.name,this.value,"myEventName")\' >'
464
459
  }
465
460
 
461
+ Example simple form
462
+
463
+ ```
464
+ [{"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"]]}]
465
+ ```
466
+
467
+
466
468
  See the section on **Utility Functions** for details of the feedback function.
467
469
 
468
470
  #### To add and remove a legend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "2.21.5",
3
+ "version": "2.21.9",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~6.5.0",
@@ -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]{4}.*/i; // if it looks like a SIDC code
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
- var drawControl = new L.Control.Draw({
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
- var sendDrawing = function(n) {
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
- var sendRoute = function(n) {
1085
+ sendRoute = function(n) {
1082
1086
  var p = (polygons[n]._latlngs.map(function(x) {
1083
1087
  return x.lng+","+x.lat;
1084
1088
  })).join(';');
@@ -1783,8 +1787,9 @@ function setMarker(data) {
1783
1787
  opts.size = opts.size || sz;
1784
1788
  opts.size = opts.size * (opts.scale || 1);
1785
1789
  // escape out any isocodes eg flag symbols
1786
- var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed"];
1787
- const regex = /\p{Extended_Pictographic}/ug;
1790
+ var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed","country"];
1791
+ //const regex = /\p{Extended_Pictographic}/ug;
1792
+ const regex = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi;
1788
1793
  optfields.forEach(function (item) {
1789
1794
  if (opts.hasOwnProperty(item) && regex.test(opts[item])) {
1790
1795
  opts[item] = unescape(encodeURIComponent(opts[item]));
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
- }, 250);
220
+ }, 100);
221
+
223
222
 
224
223
  var WorldMapIn = function(n) {
225
224
  RED.nodes.createNode(this,n);
@@ -288,6 +287,7 @@ module.exports = function(RED) {
288
287
  }
289
288
  RED.nodes.registerType("worldmap in",WorldMapIn);
290
289
 
290
+
291
291
  var WorldMapTracks = function(n) {
292
292
  RED.nodes.createNode(this,n);
293
293
  this.depth = parseInt(Number(n.depth) || 20);
@@ -407,6 +407,7 @@ module.exports = function(RED) {
407
407
  }
408
408
  RED.nodes.registerType("worldmap-tracks",WorldMapTracks);
409
409
 
410
+
410
411
  var WorldMapHull = function(n) {
411
412
  RED.nodes.createNode(this,n);
412
413
  this.prop = n.prop || "layer";