diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fe55f1..0ab72cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ ### Change Log for Node-RED Worldmap + - v1.5.1 - Make manually added icons moveable by default. - v1.5.0 - Add multi-map capability - can now have multiple map endpoints. Issue #40 PR #51 - Also add built-in world countries overlay layer for offline use. - - v1.4.6 - allow more variation in fa-icon modifiers + - v1.4.6 - allow more variation in fa-icon modifiers, so fa-3x and fa-spin work. - v1.4.5 - fix clearing overlays - v1.4.4 - add a couple of extra overlay layers, roads, rail, sea - v1.4.3 - support custom icon for GPX and KML. Better readme for geojson. diff --git a/README.md b/README.md index 310025f..69e594b 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,16 @@ map web page for plotting "things" on. ### Updates +- v1.5.1 - Make manually added icons moveable by default. - v1.5.0 - Add multi-map capability - can now have multiple map endpoints. - Also add built-in world countries overlay layer for offline use. -- v1.4.6 - allow more variation in fa-icon modifiers +- v1.4.6 - allow more variation in fa-icon modifiers, so fa-3x and fa-spin work. - v1.4.5 - fix clearing overlays - v1.4.4 - add a couple of extra overlay layers, roads, rail, sea - v1.4.3 - support custom icon for GPX and KML. Better readme for geojson. - v1.4.2 - add NVG layer capability - v1.4.1 - let `msg.payload.popup` set the popup contents. -- v1.4.0 - only send to specific _ sessionid if specified. +- v1.4.0 - only send to specific \_sessionid if specified. - v1.3.7 - rescale NATO symbols (less variation, not so small) - v1.3.6 - setting `msg.payload.draggable = true` will allow a marker to be moved and create a move event on the input node. - v1.3.5 - parse numeric inputs (speed, bearing etc) to remove any extra text. diff --git a/package.json b/package.json index aaa5fec..170798f 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "node-red-contrib-web-worldmap", - "version": "1.5.0", + "version": "1.5.1", "description": "A Node-RED node to provide a web page of a world map for plotting things on.", "dependencies": { "cgi": "0.3.1", - "express": "^4.16.3", + "express": "^4.16.4", "sockjs": "^0.3.19" }, "repository": { diff --git a/worldmap/index.html b/worldmap/index.html index 38a186c..d3926fb 100644 --- a/worldmap/index.html +++ b/worldmap/index.html @@ -513,22 +513,31 @@ map.on('zoomend', function() { // ws.send(JSON.stringify({action:"rightclick", lat:e.latlng.lat.toFixed(5), lon:e.latlng.lng.toFixed(5)})); //}); -var rightmenuMap = L.popup({keepInView:true, minWidth:250}).setContent(""); +var rightmenuMap = L.popup({keepInView:true, minWidth:250}).setContent(""); var rclk; var addThing = function() { var thing = document.getElementById('rinput').value; //console.log(thing); - ws.send(JSON.stringify({action:"point", lat:rclk.lat.toFixed(5), lon:rclk.lng.toFixed(5), point:thing})); map.closePopup(); var bits = thing.split(","); var icon = (bits[1] || "circle").trim(); var lay = (bits[2] || "drawing").trim(); var colo = (bits[3] || "#910000").trim(); - var drag = !!(bits[4] || false); - var d = {name:bits[0].trim(),layer:lay,icon:icon,iconColor:colo,draggable:drag,lat:rclk.lat,lon:rclk.lng}; - setMarker(d); + var drag = true; + var regi = /^[S,G,E,I,O][A-Z]{4}.*/; // if it looks like a SIDC code + var d; + if (regi.test(icon)) { + icon = (icon+"------------").substr(0,12); + d = {name:bits[0].trim(),layer:lay,SIDC:icon,draggable:drag,lat:rclk.lat,lon:rclk.lng}; + } + else { + d = {name:bits[0].trim(),layer:lay,icon:icon,iconColor:colo,draggable:drag,lat:rclk.lat,lon:rclk.lng}; + } map.addLayer(layers[lay]); + setMarker(d); + d.action = "point"; + ws.send(JSON.stringify(d)); } // allow double right click to zoom out @@ -1094,8 +1103,10 @@ function setMarker(data) { if (data.draggable === true) { marker.name = data.name; marker.icon = data.icon; + marker.iconColor = data.iconColor; + marker.SIDC = data.SIDC; marker.on('dragend', function (e) { - ws.send(JSON.stringify({action:"move",name:marker.name,layer:marker.lay,icon:marker.icon,lat:parseFloat(marker.getLatLng().lat.toFixed(6)),lon:parseFloat(marker.getLatLng().lng.toFixed(6))})); + ws.send(JSON.stringify({action:"move",name:marker.name,layer:marker.lay,icon:marker.icon,iconColor:marker.iconColor,SIDC:marker.SIDC,lat:parseFloat(marker.getLatLng().lat.toFixed(6)),lon:parseFloat(marker.getLatLng().lng.toFixed(6))})); }); } if (data.draggable) { delete data.draggable; } diff --git a/worldmap/worldmap.appcache b/worldmap/worldmap.appcache index 2370fd1..f3b790d 100644 --- a/worldmap/worldmap.appcache +++ b/worldmap/worldmap.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# date: Oct 13th 2018 - v1.5.0 +# date: Oct 13th 2018 - v1.5.1 CACHE: index.html