node-red-contrib-web-worldmap 2.26.1 → 2.27.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 +2 -0
- package/README.md +5 -0
- package/package.json +1 -1
- package/worldmap/worldmap.js +4 -3
- package/worldmap.html +2 -0
- package/worldmap.js +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v2.27.0 - Reload existing markers for late joiners
|
|
4
|
+
- v2.26.1 - Add QTH/Maidenhead option also
|
|
3
5
|
- v2.26.0 - Add UTM and MGRS to coordinate display options.
|
|
4
6
|
- v2.25.0 - Add bounds command to set overall map bounds.
|
|
5
7
|
- v2.24.3 - Fix geojson incorrect fill.
|
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@ map web page for plotting "things" on.
|
|
|
11
11
|
|
|
12
12
|
### Updates
|
|
13
13
|
|
|
14
|
+
- v2.27.0 - Reload existing markers for late joiners
|
|
15
|
+
- v2.26.1 - Add QTH/Maidenhead option also
|
|
14
16
|
- v2.26.0 - Add UTM and MGRS to coordinate display options.
|
|
15
17
|
- v2.25.0 - Add bounds command to set overall map bounds.
|
|
16
18
|
- v2.24.3 - Fix geojson incorrect fill.
|
|
@@ -141,6 +143,8 @@ following the great circle between the two co-ordinates is plotted.
|
|
|
141
143
|
|
|
142
144
|
msg.payload = {name:"GC1", color:"#ff00ff", greatcircle:[ [51.464,0], [25.76,-80.18] ] }
|
|
143
145
|
|
|
146
|
+
Shapes can also have a **popup** property containing html, but you MUST also set a property `clickable:true` in order to allow it to be seen.
|
|
147
|
+
|
|
144
148
|
There are extra optional properties you can specify - see Options below.
|
|
145
149
|
|
|
146
150
|
|
|
@@ -255,6 +259,7 @@ Areas, Rectangles, Lines, Circles and Ellipses can also specify more optional pr
|
|
|
255
259
|
|
|
256
260
|
Other properties can be found in the leaflet documentation.
|
|
257
261
|
|
|
262
|
+
Shapes can also have a **popup** property containing html, but you MUST also set a property `clickable:true` in order to allow it to be seen.
|
|
258
263
|
|
|
259
264
|
### Drawing
|
|
260
265
|
|
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -170,6 +170,9 @@ if (inIframe === true) {
|
|
|
170
170
|
|
|
171
171
|
// Create the Initial Map object.
|
|
172
172
|
map = new L.map('map',{zoomSnap: 0.1}).setView(startpos, startzoom);
|
|
173
|
+
map.whenReady(function() {
|
|
174
|
+
connect();
|
|
175
|
+
});
|
|
173
176
|
|
|
174
177
|
var droplatlng;
|
|
175
178
|
var target = document.getElementById("map")
|
|
@@ -912,7 +915,6 @@ var addBaseMaps = function(maplist,first) {
|
|
|
912
915
|
}
|
|
913
916
|
}
|
|
914
917
|
|
|
915
|
-
|
|
916
918
|
// Now add the overlays
|
|
917
919
|
var addOverlays = function(overlist) {
|
|
918
920
|
//console.log("OVERLAYS",overlist)
|
|
@@ -2190,6 +2192,7 @@ function doCommand(cmd) {
|
|
|
2190
2192
|
if (cmd.coords == "dms") { opts.gpsLong = true; }
|
|
2191
2193
|
if (cmd.coords == "utm") { opts.utm = true; }
|
|
2192
2194
|
if (cmd.coords == "mgrs") { opts.utmref = true; }
|
|
2195
|
+
if (cmd.coords == "qth") { opts.qth = true; }
|
|
2193
2196
|
coords.options = opts;
|
|
2194
2197
|
coords.addTo(map);
|
|
2195
2198
|
}
|
|
@@ -2711,5 +2714,3 @@ function doGeojson(n,g,l,o) {
|
|
|
2711
2714
|
layers[lay].addLayer(markers[n]);
|
|
2712
2715
|
map.addLayer(layers[lay]);
|
|
2713
2716
|
}
|
|
2714
|
-
|
|
2715
|
-
connect();
|
package/worldmap.html
CHANGED
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
<option value="dms">D.M.S</option>
|
|
86
86
|
<option value="utm">UTM</option>
|
|
87
87
|
<option value="mgrs">MGRS</option>
|
|
88
|
+
<option value="qth">QTH/Maidenhead</option>
|
|
88
89
|
</select>
|
|
89
90
|
<i class="fa fa-th" style="margin-left:22px;"></i> Graticule
|
|
90
91
|
<select id="node-input-showgrid" style="width:101px;">
|
|
@@ -243,6 +244,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|
|
243
244
|
<option value="dms">D.M.S</option>
|
|
244
245
|
<option value="utm">UTM</option>
|
|
245
246
|
<option value="mgrs">MGRS</option>
|
|
247
|
+
<option value="gth">QTH/Maidenhead</option>
|
|
246
248
|
</select>
|
|
247
249
|
<i class="fa fa-th" style="margin-left:22px;"></i> Graticule
|
|
248
250
|
<select id="node-input-showgrid" style="width:101px;">
|
package/worldmap.js
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = function(RED) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function worldMap(node, n) {
|
|
18
|
+
var allPoints = {};
|
|
18
19
|
RED.nodes.createNode(node,n);
|
|
19
20
|
node.lat = n.lat || "";
|
|
20
21
|
node.lon = n.lon || "";
|
|
@@ -61,6 +62,17 @@ module.exports = function(RED) {
|
|
|
61
62
|
RED.httpNode.use(node.path, express.static(__dirname + '/worldmap'));
|
|
62
63
|
// RED.httpNode.use(node.path, express.static(__dirname + '/worldmap', {maxage:3600000}));
|
|
63
64
|
|
|
65
|
+
// var cleanup = function() {
|
|
66
|
+
// var d = Date.now();
|
|
67
|
+
// for (var m in allPoints) {
|
|
68
|
+
// if (allPoints[m].ts < d) {
|
|
69
|
+
// console.log("DING",m)
|
|
70
|
+
// delete allPoints[m];
|
|
71
|
+
// }
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
// var stale = setInterval(function() { cleanup() }, 20000);
|
|
75
|
+
|
|
64
76
|
var callback = function(client) {
|
|
65
77
|
if (!client.headers.hasOwnProperty("user-agent")) { client.close(); }
|
|
66
78
|
//client.setMaxListeners(0);
|
|
@@ -100,6 +112,10 @@ module.exports = function(RED) {
|
|
|
100
112
|
if (node.name) { c.toptitle = node.name; }
|
|
101
113
|
//console.log("INIT",c)
|
|
102
114
|
client.write(JSON.stringify({command:c}));
|
|
115
|
+
var o = Object.values(allPoints);
|
|
116
|
+
o.map(v => delete v.tout);
|
|
117
|
+
//console.log("AP",o.length);
|
|
118
|
+
setTimeout(function() { client.write(JSON.stringify(o)) }, 250);
|
|
103
119
|
}
|
|
104
120
|
});
|
|
105
121
|
client.on('close', function() {
|
|
@@ -121,8 +137,15 @@ module.exports = function(RED) {
|
|
|
121
137
|
}
|
|
122
138
|
}
|
|
123
139
|
}
|
|
140
|
+
if (msg.payload.hasOwnProperty("name")) {
|
|
141
|
+
allPoints[msg.payload.name] = msg.payload;
|
|
142
|
+
var t = node.maxage || 3600;
|
|
143
|
+
if (msg.payload.ttl && msg.payload.ttl < t) { t = msg.payload.ttl; }
|
|
144
|
+
allPoints[msg.payload.name].tout = setTimeout( function() { delete allPoints[msg.payload.name] }, t * 1000 );
|
|
145
|
+
}
|
|
124
146
|
});
|
|
125
147
|
node.on("close", function() {
|
|
148
|
+
// if (stale) { clearInterval(stale); }
|
|
126
149
|
for (var c in clients) {
|
|
127
150
|
if (clients.hasOwnProperty(c)) {
|
|
128
151
|
clients[c].end();
|