node-red-contrib-web-worldmap 5.0.8 → 5.1.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/.github/dependabot.yml +11 -0
- package/CHANGELOG.md +2 -0
- package/README.md +7 -1
- package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bezier-spline/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/bezier-spline/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bezier-spline/package.json +10 -10
- package/node_modules/@turf/helpers/README.md +199 -154
- package/node_modules/@turf/helpers/dist/cjs/index.cjs +10 -7
- package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/helpers/dist/cjs/index.d.cts +149 -110
- package/node_modules/@turf/helpers/dist/esm/index.d.ts +149 -110
- package/node_modules/@turf/helpers/dist/esm/index.js +10 -7
- package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/helpers/package.json +8 -8
- package/node_modules/@turf/invariant/README.md +4 -0
- package/node_modules/@turf/invariant/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/invariant/dist/cjs/index.d.cts +6 -6
- package/node_modules/@turf/invariant/dist/esm/index.d.ts +6 -6
- package/node_modules/@turf/invariant/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/invariant/package.json +9 -9
- package/node_modules/@types/geojson/README.md +1 -1
- package/node_modules/@types/geojson/index.d.ts +4 -1
- package/node_modules/@types/geojson/package.json +4 -3
- package/node_modules/express/History.md +10 -1
- package/node_modules/express/package.json +6 -2
- package/node_modules/path-to-regexp/index.js +13 -3
- package/node_modules/path-to-regexp/package.json +1 -1
- package/package.json +3 -3
- package/worldmap/index.html +2 -2
- package/worldmap/leaflet/leaflet-side-by-side.js +148 -147
- package/worldmap/worldmap.js +94 -81
- package/worldmap.js +8 -7
- package/worldmap/leaflet/dialog-polyfill.css +0 -37
- package/worldmap/leaflet/dialog-polyfill.js +0 -736
package/worldmap/worldmap.js
CHANGED
|
@@ -118,17 +118,17 @@ console.log("CONNECT TO",location.pathname + 'socket');
|
|
|
118
118
|
var handleData = function(data) {
|
|
119
119
|
if (Array.isArray(data)) {
|
|
120
120
|
// console.log("ARRAY:",data.length);
|
|
121
|
-
for (var prop
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
-
setMarker(
|
|
125
|
-
// bnds.extend(markers[
|
|
126
|
-
}
|
|
127
|
-
else if (
|
|
128
|
-
data = {command:{map:{overlay:"KML", kml:
|
|
121
|
+
for (var prop of data) {
|
|
122
|
+
if (prop.command) { doCommand(prop.command); delete prop.command; }
|
|
123
|
+
if (prop.hasOwnProperty("name")) {
|
|
124
|
+
setMarker(prop);
|
|
125
|
+
// bnds.extend(markers[prop.name].getLatLng());
|
|
126
|
+
}
|
|
127
|
+
else if (prop.hasOwnProperty("filename") && prop.filename === "doc.kml") {
|
|
128
|
+
data = {command:{map:{overlay:"KML", kml:prop.payload}}};
|
|
129
129
|
doCommand(data.command); return;
|
|
130
130
|
}
|
|
131
|
-
else { console.log("SKIP array item",
|
|
131
|
+
else { console.log("SKIP array item",prop); }
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
@@ -146,25 +146,25 @@ var handleData = function(data) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// handle any commands in the data
|
|
149
|
-
if (data
|
|
149
|
+
if (data?.command) { doCommand(data.command); delete data.command; }
|
|
150
150
|
|
|
151
151
|
// handle raw geojson type msg
|
|
152
|
-
if (data
|
|
152
|
+
if (data?.type && data.type.indexOf("Feature") === 0) {
|
|
153
153
|
if (data?.properties?.title) {
|
|
154
154
|
doGeojson(data.properties.title,data,data?.layer,data?.options,data?.icon) // name, geojson, layer, options, icon
|
|
155
155
|
}
|
|
156
156
|
else { doGeojson("geojson",data,data?.layer,data?.options,data?.icon); }
|
|
157
157
|
}
|
|
158
158
|
// handle TAK json (from tak-ingest node or fastxml node)
|
|
159
|
-
else if (data
|
|
159
|
+
else if (data?.event?.point) {
|
|
160
160
|
doTAKjson(data.event);
|
|
161
161
|
}
|
|
162
162
|
// handle TAK json (from multicast Protobuf via tak-ingest node)
|
|
163
|
-
else if (data
|
|
163
|
+
else if (data?.cotEvent && data.cotEvent.hasOwnProperty("lat") && data.cotEvent.hasOwnProperty("lon")) {
|
|
164
164
|
doTAKMCjson(data.cotEvent);
|
|
165
165
|
}
|
|
166
166
|
// handle default worldmap json msg
|
|
167
|
-
else if (data
|
|
167
|
+
else if (data?.name) { setMarker(data); }
|
|
168
168
|
else {
|
|
169
169
|
if (JSON.stringify(data) !== '{}') {
|
|
170
170
|
console.log("SKIP",data);
|
|
@@ -329,7 +329,7 @@ var errRing;
|
|
|
329
329
|
function onLocationFound(e) {
|
|
330
330
|
if (followState === true) { map.panTo(e.latlng); }
|
|
331
331
|
if (followMode.icon) {
|
|
332
|
-
var self = {name:followMode.name || "self", lat:e.latlng.lat, lon:e.latlng.lng, hdg:e
|
|
332
|
+
var self = {name:followMode.name || "self", lat:e.latlng.lat, lon:e.latlng.lng, hdg:isNaN(e?.heading * 1) ? undefined : e?.heading * 1, speed:isNaN(e?.speed * 1) ? undefined : e?.speed * 1, layer:followMode.layer, icon:followMode.icon, iconColor:followMode.iconColor ?? "#910000" };
|
|
333
333
|
setMarker(self);
|
|
334
334
|
}
|
|
335
335
|
if (e.heading !== null) { map.setBearing(e.heading); }
|
|
@@ -344,7 +344,7 @@ function onLocationFound(e) {
|
|
|
344
344
|
// L.polygon([ e.latlng, lla ], {color:"00ffff", weight:3, opacity:0.5, clickable:false}).addTo(map);
|
|
345
345
|
// }
|
|
346
346
|
}
|
|
347
|
-
ws.send(JSON.stringify({action:"point", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5), point:"self", hdg:e
|
|
347
|
+
ws.send(JSON.stringify({action:"point", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5), point:"self", hdg:isNaN(e?.heading * 1) ? undefined : e?.heading * 1, speed:isNaN(e?.speed * 1) ? undefined : e?.speed * 1}));
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
function onLocationError(e) { console.log(e.message); }
|
|
@@ -452,8 +452,9 @@ var edgeAware = function () {
|
|
|
452
452
|
var viewBounds = L.latLngBounds(map.options.crs.pointToLatLng(L.point(pSW.x - (pCenter.x - pSW.x ), pSW.y - (pCenter.y - pSW.y )), map.getZoom()) , map.options.crs.pointToLatLng(L.point(pNE.x + (pNE.x - pCenter.x) , pNE.y + (pNE.y - pCenter.y) ), map.getZoom()) );
|
|
453
453
|
for (var id in markers) {
|
|
454
454
|
if (allData[id] && allData[id].hasOwnProperty("SIDC")) {
|
|
455
|
-
markerLatLng = markers[id].getLatLng();
|
|
455
|
+
var markerLatLng = markers[id].getLatLng();
|
|
456
456
|
if ( viewBounds.contains(markerLatLng) && !mapBounds.contains(markerLatLng) ) {
|
|
457
|
+
var x,y;
|
|
457
458
|
var k = (markerLatLng.lat - mapBoundsCenter.lat) / (markerLatLng.lng - mapBoundsCenter.lng);
|
|
458
459
|
|
|
459
460
|
if (markerLatLng.lng > mapBoundsCenter.lng) { x = mapBounds.getEast() - mapBoundsCenter.lng; }
|
|
@@ -726,12 +727,12 @@ function clearSearch() {
|
|
|
726
727
|
}
|
|
727
728
|
}
|
|
728
729
|
removeMarks();
|
|
729
|
-
if (lockit) {
|
|
730
|
+
// if (lockit) {
|
|
730
731
|
document.getElementById('searchResult').innerHTML = "";
|
|
731
|
-
}
|
|
732
|
-
else {
|
|
733
|
-
|
|
734
|
-
}
|
|
732
|
+
// }
|
|
733
|
+
// else {
|
|
734
|
+
// document.getElementById('searchResult').innerHTML = "";
|
|
735
|
+
// }
|
|
735
736
|
}
|
|
736
737
|
|
|
737
738
|
function removeMarks() {
|
|
@@ -902,7 +903,7 @@ var addThing = function() {
|
|
|
902
903
|
colo = colorKeywordToRGB(colo);
|
|
903
904
|
var hdg = parseFloat(bits[4] || 0);
|
|
904
905
|
var drag = true;
|
|
905
|
-
var regi = /^[
|
|
906
|
+
var regi = /^[SGEIO][A-Z]{3}.*/i; // if it looks like a SIDC code
|
|
906
907
|
var d = {action:"point", name:bits[0].trim(), layer:lay, draggable:drag, lat:rclk.lat, lon:rclk.lng, hdg:hdg, ttl:0 };
|
|
907
908
|
if (regi.test(icon)) {
|
|
908
909
|
d.SIDC = (icon.toUpperCase()+"------------").substr(0,12);
|
|
@@ -1266,7 +1267,7 @@ var addOverlays = function(overlist) {
|
|
|
1266
1267
|
};
|
|
1267
1268
|
|
|
1268
1269
|
var decode = function (encoded, options) {
|
|
1269
|
-
options = defaultOptions(
|
|
1270
|
+
options = defaultOptions();
|
|
1270
1271
|
var flatPoints = decodeDeltas(encoded);
|
|
1271
1272
|
var points = [];
|
|
1272
1273
|
for (var i = 0, len = flatPoints.length; i + (options.dimension - 1) < len;) {
|
|
@@ -1280,7 +1281,7 @@ var addOverlays = function(overlist) {
|
|
|
1280
1281
|
}
|
|
1281
1282
|
|
|
1282
1283
|
var decodeDeltas = function (encoded, options) {
|
|
1283
|
-
options = defaultOptions(
|
|
1284
|
+
options = defaultOptions();
|
|
1284
1285
|
var lastNumbers = [];
|
|
1285
1286
|
var numbers = decodeFloats(encoded, options);
|
|
1286
1287
|
for (var i = 0, len = numbers.length; i < len;) {
|
|
@@ -1292,7 +1293,7 @@ var addOverlays = function(overlist) {
|
|
|
1292
1293
|
}
|
|
1293
1294
|
|
|
1294
1295
|
var decodeFloats = function (encoded, options) {
|
|
1295
|
-
options = defaultOptions(
|
|
1296
|
+
options = defaultOptions();
|
|
1296
1297
|
var numbers = decodeSignedIntegers(encoded);
|
|
1297
1298
|
for (var i = 0, len = numbers.length; i < len; ++i) {
|
|
1298
1299
|
numbers[i] /= options.factor;
|
|
@@ -1564,6 +1565,7 @@ var rangerings = function(latlng, options) {
|
|
|
1564
1565
|
|
|
1565
1566
|
// the MAIN add marker or shape to map function
|
|
1566
1567
|
function setMarker(data) {
|
|
1568
|
+
if (!data) { return; }
|
|
1567
1569
|
var rightmenu = function(m) {
|
|
1568
1570
|
m.on('click', function(e) {
|
|
1569
1571
|
var fb = allData[data["name"]];
|
|
@@ -1756,7 +1758,7 @@ function setMarker(data) {
|
|
|
1756
1758
|
polygons[data["name"]].lay = lay;
|
|
1757
1759
|
// if clickable then add popup
|
|
1758
1760
|
if (opt.clickable === true) {
|
|
1759
|
-
|
|
1761
|
+
let words = "<b>"+data["name"]+"</b>";
|
|
1760
1762
|
if (data.popup) { words = words + "<br/>" + data.popup.replace(/\${name}/g,data["name"]); }
|
|
1761
1763
|
polygons[data["name"]].bindPopup(words, {autoClose:false, closeButton:true, closeOnClick:true, minWidth:200});
|
|
1762
1764
|
}
|
|
@@ -1822,6 +1824,14 @@ function setMarker(data) {
|
|
|
1822
1824
|
|
|
1823
1825
|
if (data.hasOwnProperty("icon")) {
|
|
1824
1826
|
var dir = parseFloat(data.track ?? data.hdg ?? data.heading ?? data.bearing ?? "0") + map.getBearing();
|
|
1827
|
+
var siz = 32;
|
|
1828
|
+
var sizc = 16;
|
|
1829
|
+
if (data?.iconSize && !isNaN(data.iconSize)) {
|
|
1830
|
+
if (data.iconSize >= 8 && data.iconSize <= 256) {
|
|
1831
|
+
siz = data.iconSize;
|
|
1832
|
+
sizc = Math.round(siz/2);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1825
1835
|
if (data.icon === "ship") {
|
|
1826
1836
|
marker = L.boatMarker(ll, {
|
|
1827
1837
|
title: data["name"],
|
|
@@ -1843,20 +1853,20 @@ function setMarker(data) {
|
|
|
1843
1853
|
var svgplane = "data:image/svg+xml;base64," + btoa(icon);
|
|
1844
1854
|
myMarker = L.divIcon({
|
|
1845
1855
|
className:"planeicon",
|
|
1846
|
-
iconAnchor: [
|
|
1847
|
-
html:'<img src="'+svgplane+'" style="width:
|
|
1856
|
+
iconAnchor: [sizc, sizc],
|
|
1857
|
+
html:'<img src="'+svgplane+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>'
|
|
1848
1858
|
});
|
|
1849
1859
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1850
1860
|
}
|
|
1851
1861
|
else if (data.icon === "smallplane") {
|
|
1852
1862
|
data.iconColor = data.iconColor ?? "black";
|
|
1853
|
-
icon = '<svg xmlns="http://www.w3.org/2000/svg" version="1.0"
|
|
1863
|
+
icon = '<svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 20 20">';
|
|
1854
1864
|
icon += '<path d="M15.388 4.781c.068.068.061.154-.171.656-.028.06-.18.277-.18.277s.102.113.13.14c.054.055.078.175.056.27-.068.295-.89 1.47-1.35 1.93-.285.286-.432.481-.422.56.009.068.117.356.24.64.219.5.3.599 2.762 3.339 1.95 2.169 2.546 2.87 2.582 3.028.098.439-.282.847-1.264 1.356l-.507.263-7.389-5.29-4.43 3.365.102.18c.056.099.519.676 1.029 1.283.51.607.933 1.161.94 1.232.026.284-1.111 1.177-1.282 1.006-.27-.27-1.399-1.131-1.494-1.14-.068-.007-1.04-.747-1.37-1.077-.329-.33-1.07-1.301-1.076-1.37-.01-.094-.871-1.224-1.14-1.493-.171-.171.722-1.308 1.006-1.282.07.007.625.43 1.231.94.607.51 1.185.973 1.283 1.029l.18.101 3.365-4.43-5.29-7.388.263-.507c.51-.982.918-1.362 1.357-1.264.158.035.859.632 3.028 2.581 2.74 2.462 2.838 2.544 3.339 2.762.284.124.572.232.639.24.08.01.274-.136.56-.422.46-.46 1.635-1.282 1.93-1.35.095-.022.216.003.27.057.028.028.139.129.139.129s.217-.153.277-.18c.502-.233.59-.238.657-.17z" fill="'+data.iconColor+'"/></svg>';
|
|
1855
|
-
var
|
|
1865
|
+
var svgsplane = "data:image/svg+xml;base64," + btoa(icon);
|
|
1856
1866
|
myMarker = L.divIcon({
|
|
1857
1867
|
className:"planeicon",
|
|
1858
|
-
iconAnchor: [
|
|
1859
|
-
html:'<img src="'+
|
|
1868
|
+
iconAnchor: [sizc, sizc],
|
|
1869
|
+
html:'<img src="'+svgsplane+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+(dir - 45)+'deg); -moz-transform:rotate('+(dir - 45)+'deg);"/>'
|
|
1860
1870
|
});
|
|
1861
1871
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1862
1872
|
}
|
|
@@ -1871,8 +1881,8 @@ function setMarker(data) {
|
|
|
1871
1881
|
var svgbus = "data:image/svg+xml;base64," + btoa(icon);
|
|
1872
1882
|
myMarker = L.divIcon({
|
|
1873
1883
|
className:"busicon",
|
|
1874
|
-
iconAnchor: [
|
|
1875
|
-
html:'<img src="'+svgbus+'" style="width:
|
|
1884
|
+
iconAnchor: [sizc, sizc],
|
|
1885
|
+
html:'<img src="'+svgbus+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:scaleY('+sc+') rotate('+dir*sc+'deg); -moz-transform:scaleY('+sc+') rotate('+dir*sc+'deg);"/>'
|
|
1876
1886
|
});
|
|
1877
1887
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1878
1888
|
}
|
|
@@ -1888,8 +1898,8 @@ function setMarker(data) {
|
|
|
1888
1898
|
var svgheli = "data:image/svg+xml;base64," + btoa(icon);
|
|
1889
1899
|
myMarker = L.divIcon({
|
|
1890
1900
|
className:"heliicon",
|
|
1891
|
-
iconAnchor: [
|
|
1892
|
-
html:'<img src="'+svgheli+'" style="width:
|
|
1901
|
+
iconAnchor: [sizc, sizc],
|
|
1902
|
+
html:'<img src="'+svgheli+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>'
|
|
1893
1903
|
});
|
|
1894
1904
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1895
1905
|
}
|
|
@@ -1905,8 +1915,8 @@ function setMarker(data) {
|
|
|
1905
1915
|
var svguav = "data:image/svg+xml;base64," + btoa(icon);
|
|
1906
1916
|
myMarker = L.divIcon({
|
|
1907
1917
|
className:"uavicon",
|
|
1908
|
-
iconAnchor: [
|
|
1909
|
-
html:'<img src="'+svguav+'" style="width:
|
|
1918
|
+
iconAnchor: [sizc, sizc],
|
|
1919
|
+
html:'<img src="'+svguav+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
|
|
1910
1920
|
});
|
|
1911
1921
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1912
1922
|
}
|
|
@@ -1917,8 +1927,8 @@ function setMarker(data) {
|
|
|
1917
1927
|
var svgquad = "data:image/svg+xml;base64," + btoa(icon);
|
|
1918
1928
|
myMarker = L.divIcon({
|
|
1919
1929
|
className:"quadicon",
|
|
1920
|
-
iconAnchor: [
|
|
1921
|
-
html:'<img src="'+svgquad+'" style="width:
|
|
1930
|
+
iconAnchor: [sizc, sizc],
|
|
1931
|
+
html:'<img src="'+svgquad+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
|
|
1922
1932
|
});
|
|
1923
1933
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1924
1934
|
}
|
|
@@ -1929,8 +1939,8 @@ function setMarker(data) {
|
|
|
1929
1939
|
var svgcar = "data:image/svg+xml;base64," + btoa(icon);
|
|
1930
1940
|
myMarker = L.divIcon({
|
|
1931
1941
|
className:"caricon",
|
|
1932
|
-
iconAnchor: [
|
|
1933
|
-
html:'<img src="'+svgcar+'" style="width:
|
|
1942
|
+
iconAnchor: [sizc, sizc],
|
|
1943
|
+
html:'<img src="'+svgcar+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
|
|
1934
1944
|
});
|
|
1935
1945
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1936
1946
|
}
|
|
@@ -1940,21 +1950,22 @@ function setMarker(data) {
|
|
|
1940
1950
|
var svgcam = "data:image/svg+xml;base64," + btoa(icon);
|
|
1941
1951
|
myMarker = L.divIcon({
|
|
1942
1952
|
className:"camicon",
|
|
1943
|
-
iconAnchor: [
|
|
1944
|
-
html:'<img src="'+svgcam+'" style="width:
|
|
1953
|
+
iconAnchor: [sizc, sizc],
|
|
1954
|
+
html:'<img src="'+svgcam+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
|
|
1945
1955
|
});
|
|
1946
1956
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1947
1957
|
}
|
|
1948
1958
|
else if (data.icon === "arrow") {
|
|
1949
1959
|
data.iconColor = data.iconColor || "black";
|
|
1950
|
-
icon = '<svg xmlns="http://www.w3.org/2000/svg"
|
|
1951
|
-
icon += '<path d="m16.2
|
|
1960
|
+
icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">';
|
|
1961
|
+
icon += '<path d="m16.2.6-10.9 31L16 20.5l10.5 11.1z" fill="'+data.iconColor+'"/></svg>';
|
|
1952
1962
|
var svgarrow = "data:image/svg+xml;base64," + btoa(icon);
|
|
1953
1963
|
myMarker = L.divIcon({
|
|
1954
1964
|
className:"arrowicon",
|
|
1955
|
-
iconAnchor: [
|
|
1956
|
-
html:
|
|
1965
|
+
iconAnchor: [sizc, sizc],
|
|
1966
|
+
html:'<img src="'+svgarrow+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
|
|
1957
1967
|
});
|
|
1968
|
+
console.log("MM",myMarker)
|
|
1958
1969
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1959
1970
|
}
|
|
1960
1971
|
else if (data.icon === "wind") {
|
|
@@ -1964,8 +1975,8 @@ function setMarker(data) {
|
|
|
1964
1975
|
var svgwind = "data:image/svg+xml;base64," + btoa(icon);
|
|
1965
1976
|
myMarker = L.divIcon({
|
|
1966
1977
|
className:"windicon",
|
|
1967
|
-
iconAnchor: [
|
|
1968
|
-
html:'<img src="'+svgwind+'" style="width:
|
|
1978
|
+
iconAnchor: [sizc, sizc],
|
|
1979
|
+
html:'<img src="'+svgwind+'" style="width:'+siz+'px; height:'+siz+'px; -webkit-transform:rotate('+dir+'deg); -moz-transform:rotate('+dir+'deg);"/>',
|
|
1969
1980
|
});
|
|
1970
1981
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1971
1982
|
}
|
|
@@ -1981,8 +1992,8 @@ function setMarker(data) {
|
|
|
1981
1992
|
var svgsat = "data:image/svg+xml;base64," + btoa(icon);
|
|
1982
1993
|
myMarker = L.divIcon({
|
|
1983
1994
|
className:"satelliteicon",
|
|
1984
|
-
iconAnchor: [
|
|
1985
|
-
html:'<img src="'+svgsat+'" style="width:
|
|
1995
|
+
iconAnchor: [sizc, sizc],
|
|
1996
|
+
html:'<img src="'+svgsat+'" style="width:'+siz+'px; height:'+siz+'px;"/>',
|
|
1986
1997
|
});
|
|
1987
1998
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
1988
1999
|
}
|
|
@@ -2026,8 +2037,8 @@ function setMarker(data) {
|
|
|
2026
2037
|
var svglocate = "data:image/svg+xml;base64," + btoa(icon);
|
|
2027
2038
|
myMarker = L.divIcon({
|
|
2028
2039
|
className:"locateicon",
|
|
2029
|
-
iconAnchor: [
|
|
2030
|
-
html:'<img src="'+svglocate+'" style="width:
|
|
2040
|
+
iconAnchor: [sizc, sizc],
|
|
2041
|
+
html:'<img src="'+svglocate+'" style="width:'+siz+'px; height:'+siz+'px;"/>',
|
|
2031
2042
|
});
|
|
2032
2043
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
2033
2044
|
labelOffset = [12,-4];
|
|
@@ -2052,7 +2063,7 @@ function setMarker(data) {
|
|
|
2052
2063
|
}
|
|
2053
2064
|
else if (data.icon.match(/^:.*:$/g)) { // emoji icon :smile:
|
|
2054
2065
|
var em = emojify(data.icon);
|
|
2055
|
-
|
|
2066
|
+
let col = data.iconColor ?? "#910000";
|
|
2056
2067
|
myMarker = L.divIcon({
|
|
2057
2068
|
className:"emicon",
|
|
2058
2069
|
html: '<center><span style="font-size:2em; color:'+col+'">'+em+'</span></center>',
|
|
@@ -2062,20 +2073,18 @@ function setMarker(data) {
|
|
|
2062
2073
|
labelOffset = [12,-4];
|
|
2063
2074
|
}
|
|
2064
2075
|
else if (data.icon.match(/^https?:.*$|^\/|^data:image\//)) { // web url icon https://...
|
|
2065
|
-
var sz = data.iconSize ?? 32;
|
|
2066
2076
|
myMarker = L.icon({
|
|
2067
2077
|
iconUrl: data.icon,
|
|
2068
|
-
iconSize: [
|
|
2069
|
-
iconAnchor: [
|
|
2070
|
-
popupAnchor: [0, -
|
|
2078
|
+
iconSize: [siz, siz],
|
|
2079
|
+
iconAnchor: [sizc, sizc],
|
|
2080
|
+
popupAnchor: [0, -siz/2]
|
|
2071
2081
|
});
|
|
2072
2082
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag, rotationAngle:dir, rotationOrigin:"center"});
|
|
2073
|
-
labelOffset = [
|
|
2074
|
-
delete data.iconSize;
|
|
2083
|
+
labelOffset = [sizc-4,-4];
|
|
2075
2084
|
}
|
|
2076
2085
|
else if (data.icon.substr(0,3) === "fa-") { // fa icon
|
|
2077
|
-
|
|
2078
|
-
|
|
2086
|
+
let col = data.iconColor ?? "#910000";
|
|
2087
|
+
let imod = "";
|
|
2079
2088
|
if (data.icon.indexOf(" ") === -1) { imod = "fa-2x "; }
|
|
2080
2089
|
myMarker = L.divIcon({
|
|
2081
2090
|
className:"faicon",
|
|
@@ -2088,8 +2097,8 @@ function setMarker(data) {
|
|
|
2088
2097
|
labelOffset = [8,-8];
|
|
2089
2098
|
}
|
|
2090
2099
|
else if (data.icon.substr(0,3) === "wi-") { // weather icon
|
|
2091
|
-
|
|
2092
|
-
|
|
2100
|
+
let col = data.iconColor ?? "#910000";
|
|
2101
|
+
let imod = "";
|
|
2093
2102
|
if (data.icon.indexOf(" ") === -1) { imod = "wi-2x "; }
|
|
2094
2103
|
myMarker = L.divIcon({
|
|
2095
2104
|
className:"wiicon",
|
|
@@ -2111,6 +2120,7 @@ function setMarker(data) {
|
|
|
2111
2120
|
marker = L.marker(ll, {title:data["name"], icon:myMarker, draggable:drag});
|
|
2112
2121
|
labelOffset = [6,-6];
|
|
2113
2122
|
}
|
|
2123
|
+
delete data.iconSize;
|
|
2114
2124
|
}
|
|
2115
2125
|
else if (data.hasOwnProperty("SIDC")) { // NATO mil2525 icons
|
|
2116
2126
|
// "SIDC":"SFGPU------E***","name":"1.C2 komp","fullname":"1.C2 komp/FTS/INSS"
|
|
@@ -2123,12 +2133,15 @@ function setMarker(data) {
|
|
|
2123
2133
|
}
|
|
2124
2134
|
opts.size = opts.size || sz;
|
|
2125
2135
|
opts.size = opts.size * (opts.scale || 1);
|
|
2126
|
-
if (data.SIDC.length > 12 && /^[A-Za-z]{2}$/gm.test(data.SIDC.substr(12,2))) {
|
|
2136
|
+
if (!data.flag && data.SIDC.length > 12 && /^[A-Za-z]{2}$/gm.test(data.SIDC.substr(12,2))) {
|
|
2127
2137
|
var cc = data.SIDC.substr(12,2).toLowerCase();
|
|
2128
2138
|
opts.country = cc.toUpperCase();
|
|
2129
2139
|
opts.staffComments = emojify(":flag-"+cc+":") + " " + (opts?.staffComments || "");
|
|
2130
2140
|
data.flag = opts.country.toUpperCase() + " " + emojify(":flag-"+cc+":");
|
|
2131
2141
|
}
|
|
2142
|
+
else if(/\p{Emoji}/u.test(data.flag)) {
|
|
2143
|
+
opts.staffComments = data.flag + " " + (opts?.staffComments || "");
|
|
2144
|
+
}
|
|
2132
2145
|
if (data.SIDC.length == 12 && data?.flag && data.flag.length == 2) {
|
|
2133
2146
|
opts.staffComments = emojify(":flag-"+data.flag.toLowerCase()+":") + " " + (opts?.staffComments || "");
|
|
2134
2147
|
}
|
|
@@ -2141,7 +2154,7 @@ function setMarker(data) {
|
|
|
2141
2154
|
opts.country = data.flag.toUpperCase() + " " + emojify(":flag-"+data.flag.toLowerCase()+":");
|
|
2142
2155
|
}
|
|
2143
2156
|
}
|
|
2144
|
-
console.log("OPTS",opts)
|
|
2157
|
+
//console.log("OPTS",opts)
|
|
2145
2158
|
data.speed = opts?.speed || data?.speed; // If SIDC then options.speed can override the speed.
|
|
2146
2159
|
if (data?.speed && !opts?.direction) { opts.direction = data?.track || data?.hdg || data?.heading || data?.COG || data?.bearing }
|
|
2147
2160
|
if (data.speed == undefined) { delete data.speed; }
|
|
@@ -2195,9 +2208,9 @@ function setMarker(data) {
|
|
|
2195
2208
|
marker.on('dragend', function (e) {
|
|
2196
2209
|
var l = marker.getLatLng().toString().replace('LatLng(','lat, lon : ').replace(')','')
|
|
2197
2210
|
marker.setPopupContent(marker.getPopup().getContent().split("lat, lon")[0] + l);
|
|
2198
|
-
var b = marker.getPopup().getContent().split("heading : ");
|
|
2199
|
-
if (b.length === 2) { b = parseFloat(b[1].split("<br")[0]); }
|
|
2200
|
-
else { b = undefined; }
|
|
2211
|
+
// var b = marker.getPopup().getContent().split("heading : ");
|
|
2212
|
+
// if (b.length === 2) { b = parseFloat(b[1].split("<br")[0]); }
|
|
2213
|
+
// else { b = undefined; }
|
|
2201
2214
|
|
|
2202
2215
|
var fb = allData[marker.name];
|
|
2203
2216
|
fb.action = "move";
|
|
@@ -2304,7 +2317,7 @@ function setMarker(data) {
|
|
|
2304
2317
|
delete data.popped;
|
|
2305
2318
|
}
|
|
2306
2319
|
// If .label then use that rather than name tooltip
|
|
2307
|
-
if (data.label) {
|
|
2320
|
+
if (data.hasOwnProperty("label")) {
|
|
2308
2321
|
if (typeof data.label === "boolean" && data.label === true) {
|
|
2309
2322
|
marker.bindTooltip(data["name"], data.tooltipOptions || { permanent:true, direction:"right", offset:labelOffset });
|
|
2310
2323
|
}
|
|
@@ -2315,7 +2328,7 @@ function setMarker(data) {
|
|
|
2315
2328
|
delete data.label;
|
|
2316
2329
|
}
|
|
2317
2330
|
// otherwise check for .tooltip then use that rather than name tooltip
|
|
2318
|
-
else if (data.tooltip) {
|
|
2331
|
+
else if (data.hasOwnProperty("tooltip")) {
|
|
2319
2332
|
if (typeof data.tooltip === "string" && data.tooltip.length > 0) {
|
|
2320
2333
|
marker.bindTooltip(data.tooltip, data.tooltipOptions || { direction:"bottom", offset:[0,4] });
|
|
2321
2334
|
delete marker.options.title;
|
|
@@ -2447,7 +2460,7 @@ function setMarker(data) {
|
|
|
2447
2460
|
polygon.setStyle({opacity:0});
|
|
2448
2461
|
}
|
|
2449
2462
|
}
|
|
2450
|
-
polygon.name = data["name"];
|
|
2463
|
+
if (polygon !== null) { polygon.name = data["name"]; }
|
|
2451
2464
|
if (polygons[data["name"]] != null && polygons[data["name"]].hasOwnProperty("_layers")) {
|
|
2452
2465
|
polygons[data["name"]].addLayer(polygon);
|
|
2453
2466
|
}
|
|
@@ -2553,7 +2566,7 @@ function doCommand(cmd) {
|
|
|
2553
2566
|
}
|
|
2554
2567
|
if (cmd.hasOwnProperty("grid")) {
|
|
2555
2568
|
if (cmd.grid.hasOwnProperty("showgrid")) {
|
|
2556
|
-
|
|
2569
|
+
let changed = false;
|
|
2557
2570
|
if ((cmd.grid.showgrid == "true" || cmd.grid.showgrid == true ) && !showGrid) { changed = true; }
|
|
2558
2571
|
if ((cmd.grid.showgrid == "false" || cmd.grid.showgrid == false ) && showGrid) { changed = true; }
|
|
2559
2572
|
if (changed) {
|
|
@@ -2572,7 +2585,7 @@ function doCommand(cmd) {
|
|
|
2572
2585
|
}
|
|
2573
2586
|
if (cmd.hasOwnProperty("ruler")) {
|
|
2574
2587
|
if (cmd.ruler.hasOwnProperty("showruler")) {
|
|
2575
|
-
|
|
2588
|
+
let changed = false;
|
|
2576
2589
|
if ((cmd.ruler.showruler == "true" || cmd.ruler.showruler == true ) && !showRuler) { changed = true; }
|
|
2577
2590
|
if ((cmd.ruler.showruler == "false" || cmd.ruler.showruler == false ) && showRuler) { changed = true; }
|
|
2578
2591
|
if (changed) {
|
|
@@ -2702,7 +2715,7 @@ function doCommand(cmd) {
|
|
|
2702
2715
|
basemaps[cmd.map.name].removeFrom(map);
|
|
2703
2716
|
existsalready = true;
|
|
2704
2717
|
}
|
|
2705
|
-
|
|
2718
|
+
let opt = {};
|
|
2706
2719
|
if (cmd.map.hasOwnProperty("opt")) { opt = cmd.map.opt || {}; }
|
|
2707
2720
|
|
|
2708
2721
|
if (!opt.paintRules && !opt.labelRules && !opt.backgroundColor && !opt.theme) {
|
|
@@ -2758,7 +2771,7 @@ function doCommand(cmd) {
|
|
|
2758
2771
|
existsalready = true;
|
|
2759
2772
|
}
|
|
2760
2773
|
try {
|
|
2761
|
-
|
|
2774
|
+
let opt = cmd.map.opt || {};
|
|
2762
2775
|
if (opt.hasOwnProperty("style")) { opt.style = new Function('return ' + opt.style)(); }
|
|
2763
2776
|
else {
|
|
2764
2777
|
opt.style = function(feature) {
|
|
@@ -3225,7 +3238,7 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
|
|
|
3225
3238
|
opt.pointToLayer = function (feature, latlng) {
|
|
3226
3239
|
var myMarker;
|
|
3227
3240
|
if (feature.properties.hasOwnProperty("icon")) {
|
|
3228
|
-
var regi = /^[
|
|
3241
|
+
var regi = /^[SGEIO][A-Z]{3}.*/i; // if it looks like a SIDC code
|
|
3229
3242
|
if (regi.test(feature.properties.icon)) {
|
|
3230
3243
|
feature.properties.SIDC = (feature.properties.icon.toUpperCase()+"------------").substr(0,12);
|
|
3231
3244
|
delete feature.properties.icon;
|
|
@@ -3271,7 +3284,7 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
|
|
|
3271
3284
|
});
|
|
3272
3285
|
}
|
|
3273
3286
|
if (!feature.properties.hasOwnProperty("title") && feature.properties.hasOwnProperty("marker-symbol")) {
|
|
3274
|
-
if (
|
|
3287
|
+
if (feature.properties["marker-symbol"].indexOf('fa-') !== 0) {
|
|
3275
3288
|
feature.properties.title = feature.properties["marker-symbol"];
|
|
3276
3289
|
}
|
|
3277
3290
|
}
|
|
@@ -3422,7 +3435,7 @@ function doTAKMCjson(p) {
|
|
|
3422
3435
|
}
|
|
3423
3436
|
|
|
3424
3437
|
function convertCOTtoCIFColour(color) {
|
|
3425
|
-
const c = parseInt(color);
|
|
3438
|
+
// const c = parseInt(color);
|
|
3426
3439
|
const arr = new ArrayBuffer(4);
|
|
3427
3440
|
const view = new DataView(arr);
|
|
3428
3441
|
view.setUint32(0, color, false);
|
package/worldmap.js
CHANGED
|
@@ -201,7 +201,7 @@ module.exports = function(RED) {
|
|
|
201
201
|
if (msg.payload.ttl && msg.payload.ttl < t) { t = msg.payload.ttl; }
|
|
202
202
|
allPoints[msg.payload.name].tout = setTimeout( function() { delete allPoints[msg.payload.name] }, t * 1000 );
|
|
203
203
|
}
|
|
204
|
-
if (msg
|
|
204
|
+
if (msg.payload?.command?.map?.delete) {
|
|
205
205
|
var ddd = msg.payload.command.map.delete;
|
|
206
206
|
if (!Array.isArray(ddd)) { ddd = [cmd.map.delete]; }
|
|
207
207
|
for (let a=0; a < ddd.length; a++) {
|
|
@@ -227,7 +227,8 @@ module.exports = function(RED) {
|
|
|
227
227
|
for (var i=0; i < RED.httpNode._router.stack.length; i++) {
|
|
228
228
|
var r = RED.httpNode._router.stack[i];
|
|
229
229
|
if ((r.name === "serveStatic") && (r.regexp.test(node.path))) {
|
|
230
|
-
RED.httpNode._router.stack.splice(i, 1)
|
|
230
|
+
RED.httpNode._router.stack.splice(i, 1);
|
|
231
|
+
i = i-1;
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
node.status({});
|
|
@@ -479,7 +480,7 @@ module.exports = function(RED) {
|
|
|
479
480
|
node.send(newmsg); // send the track
|
|
480
481
|
}
|
|
481
482
|
}
|
|
482
|
-
if (msg
|
|
483
|
+
if (msg.payload?.command?.map?.delete) {
|
|
483
484
|
var ddd = msg.payload.command.map.delete;
|
|
484
485
|
if (!Array.isArray(ddd)) { ddd = [cmd.map.delete]; }
|
|
485
486
|
for (let a=0; a < ddd.length; a++) {
|
|
@@ -492,8 +493,8 @@ module.exports = function(RED) {
|
|
|
492
493
|
}
|
|
493
494
|
}
|
|
494
495
|
}
|
|
495
|
-
if (msg
|
|
496
|
-
if (!isArray(msg
|
|
496
|
+
if (msg.payload?.command?.clear) {
|
|
497
|
+
if (!isArray(msg.payload?.command?.clear)) {
|
|
497
498
|
msg.payload.command.clear = [ msg.payload.command.clear ]
|
|
498
499
|
}
|
|
499
500
|
msg.payload.command.clear.forEach(function(el) {
|
|
@@ -506,8 +507,8 @@ module.exports = function(RED) {
|
|
|
506
507
|
}
|
|
507
508
|
})
|
|
508
509
|
}
|
|
509
|
-
if (msg
|
|
510
|
-
if (!isArray(msg
|
|
510
|
+
if (msg.payload?.command?.clearlayer) {
|
|
511
|
+
if (!isArray(msg.payload?.command?.clearlayer)) {
|
|
511
512
|
msg.payload.command.clearlayer = [ msg.payload.command.clearlayer ]
|
|
512
513
|
}
|
|
513
514
|
msg.payload.command.clearlayer.forEach(function(el) {
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
dialog {
|
|
2
|
-
position: absolute;
|
|
3
|
-
left: 0; right: 0;
|
|
4
|
-
width: -moz-fit-content;
|
|
5
|
-
width: -webkit-fit-content;
|
|
6
|
-
width: fit-content;
|
|
7
|
-
height: -moz-fit-content;
|
|
8
|
-
height: -webkit-fit-content;
|
|
9
|
-
height: fit-content;
|
|
10
|
-
margin: auto;
|
|
11
|
-
border: solid;
|
|
12
|
-
padding: 1em;
|
|
13
|
-
background: white;
|
|
14
|
-
color: black;
|
|
15
|
-
display: block;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
dialog:not([open]) {
|
|
19
|
-
display: none;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
dialog + .backdrop {
|
|
23
|
-
position: fixed;
|
|
24
|
-
top: 0; right: 0; bottom: 0; left: 0;
|
|
25
|
-
background: rgba(0,0,0,0.1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
._dialog_overlay {
|
|
29
|
-
position: fixed;
|
|
30
|
-
top: 0; right: 0; bottom: 0; left: 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
dialog.fixed {
|
|
34
|
-
position: fixed;
|
|
35
|
-
top: 50%;
|
|
36
|
-
transform: translate(0, -50%);
|
|
37
|
-
}
|