Bump to 1.2.0 - improve deletion of markers and tracks)
(should have bumped when adding velocity layer)
This commit is contained in:
parent
c5ebded6ef
commit
029bc14b77
@ -1,5 +1,6 @@
|
|||||||
### Change Log for Node-RED Worldmap
|
### Change Log for Node-RED Worldmap
|
||||||
|
|
||||||
|
- v1.2.0 - Bump version (should have done it for adding velocity layer). Tidy up deletion of marker and tracks.
|
||||||
- v1.1.16 - Add Velocity layer - for velocity grid type overlays (eg wind, currents, etc)
|
- v1.1.16 - Add Velocity layer - for velocity grid type overlays (eg wind, currents, etc)
|
||||||
- v1.1.15 - Tidy of Info, Readme and NATO symbol options.
|
- v1.1.15 - Tidy of Info, Readme and NATO symbol options.
|
||||||
- v1.1.14 - Add proper NATO symbology via <a href="https://github.com/spatialillusions/milsymbol" target="mapinfo">milsymbol.js</a>
|
- v1.1.14 - Add proper NATO symbology via <a href="https://github.com/spatialillusions/milsymbol" target="mapinfo">milsymbol.js</a>
|
||||||
|
@ -9,6 +9,7 @@ map web page for plotting "things" on.
|
|||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
|
- v1.2.0 - Bump version (should have done it for adding velocity layer). Tidy up deletion of marker and tracks.
|
||||||
- v1.1.16 - Add Velocity layer - for velocity grid type overlays (eg wind, currrents, etc)
|
- v1.1.16 - Add Velocity layer - for velocity grid type overlays (eg wind, currrents, etc)
|
||||||
- v1.1.15 - Tidy of Info, Readme and NATO symbol options.
|
- v1.1.15 - Tidy of Info, Readme and NATO symbol options.
|
||||||
- v1.1.14 - Add proper NATO symbology via <a href="https://github.com/spatialillusions/milsymbol" target="mapinfo">milsymbol.js</a>
|
- v1.1.14 - Add proper NATO symbology via <a href="https://github.com/spatialillusions/milsymbol" target="mapinfo">milsymbol.js</a>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-web-worldmap",
|
"name": "node-red-contrib-web-worldmap",
|
||||||
"version": "1.1.16",
|
"version": "1.2.0",
|
||||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cgi": "0.3.1",
|
"cgi": "0.3.1",
|
||||||
|
@ -140,7 +140,7 @@ module.exports = function(RED) {
|
|||||||
var newmsg = RED.util.cloneMessage(msg);
|
var newmsg = RED.util.cloneMessage(msg);
|
||||||
if (msg.payload.deleted) {
|
if (msg.payload.deleted) {
|
||||||
delete node.pointsarray[msg.payload.name];
|
delete node.pointsarray[msg.payload.name];
|
||||||
newmsg.payload.name = msg.payload.name + "_";
|
//newmsg.payload.name = msg.payload.name + "_";
|
||||||
node.send(newmsg); // send the track to be deleted
|
node.send(newmsg); // send the track to be deleted
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ if ( window.localStorage.hasOwnProperty("maxage") ) {
|
|||||||
// Create the Initial Map object.
|
// Create the Initial Map object.
|
||||||
map = new L.map('map').setView(startpos, startzoom);
|
map = new L.map('map').setView(startpos, startzoom);
|
||||||
|
|
||||||
var menuButton = L.easyButton( 'fa-bars fa-lg', function() { toggleMenu(); }, "Toggle menu", "topright").addTo(map);
|
var menuButton = L.easyButton( 'fa-bars fa-lg', function() { toggleMenu(); }, "Toggle menu", "topright");
|
||||||
|
|
||||||
// Move some bits around if in an iframe
|
// Move some bits around if in an iframe
|
||||||
if (window.self !== window.top) {
|
if (window.self !== window.top) {
|
||||||
@ -252,7 +252,7 @@ if (!inIframe) {
|
|||||||
heat.setLatLngs([]);
|
heat.setLatLngs([]);
|
||||||
}, "Clears the current heatmap", "bottomright");
|
}, "Clears the current heatmap", "bottomright");
|
||||||
}
|
}
|
||||||
//else { if (showUserMenu) { menuButton.addTo(map); } }
|
else { if (showUserMenu) { menuButton.addTo(map); } }
|
||||||
|
|
||||||
// Handle the dialog for popup help
|
// Handle the dialog for popup help
|
||||||
var dialog = document.querySelector('dialog');
|
var dialog = document.querySelector('dialog');
|
||||||
@ -429,7 +429,6 @@ map.on('overlayadd', function(e) {
|
|||||||
map.addControl(drawControl);
|
map.addControl(drawControl);
|
||||||
overlays["drawing"].bringToFront();
|
overlays["drawing"].bringToFront();
|
||||||
}
|
}
|
||||||
//else { console.log("layer add :",e.name); }
|
|
||||||
ws.send(JSON.stringify({action:"addlayer", name:e.name}));
|
ws.send(JSON.stringify({action:"addlayer", name:e.name}));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -496,7 +495,7 @@ var rightmenuMap = L.popup().setContent("<input type='text' id='rinput' onkeydow
|
|||||||
var rclk;
|
var rclk;
|
||||||
var addThing = function() {
|
var addThing = function() {
|
||||||
var thing = document.getElementById('rinput').value;
|
var thing = document.getElementById('rinput').value;
|
||||||
console.log(thing);
|
//console.log(thing);
|
||||||
ws.send(JSON.stringify({action:"point", lat:rclk.lat.toFixed(5), lon:rclk.lng.toFixed(5), point:thing}));
|
ws.send(JSON.stringify({action:"point", lat:rclk.lat.toFixed(5), lon:rclk.lng.toFixed(5), point:thing}));
|
||||||
map.closePopup();
|
map.closePopup();
|
||||||
var bits = thing.split(",");
|
var bits = thing.split(",");
|
||||||
@ -583,11 +582,11 @@ var Esri_OceanBasemap = L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/
|
|||||||
});
|
});
|
||||||
basemaps["Esri Ocean"] = Esri_OceanBasemap;
|
basemaps["Esri Ocean"] = Esri_OceanBasemap;
|
||||||
|
|
||||||
var OpenMapSurfer_Roads = L.tileLayer('http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}', {
|
// var OpenMapSurfer_Roads = L.tileLayer('http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}', {
|
||||||
maxZoom: 18,
|
// maxZoom: 18,
|
||||||
attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">University of Heidelberg</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
// attribution: 'Imagery from <a href="http://giscience.uni-hd.de/">University of Heidelberg</a> — Map data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||||
});
|
// });
|
||||||
basemaps["Mapsurfer"] = OpenMapSurfer_Roads;
|
// basemaps["Mapsurfer"] = OpenMapSurfer_Roads;
|
||||||
|
|
||||||
// var MapQuestOpen_OSM = L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}', {
|
// var MapQuestOpen_OSM = L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}', {
|
||||||
// type: 'map',
|
// type: 'map',
|
||||||
@ -636,13 +635,11 @@ basemaps["UK OS 1919-47"] = NLS_OS_1919_1947;
|
|||||||
//});
|
//});
|
||||||
//basemaps["CartoDB Light"] = CartoPos;
|
//basemaps["CartoDB Light"] = CartoPos;
|
||||||
|
|
||||||
// Terrain map of US only
|
// Terrain map by Stamen Design
|
||||||
var usterrainmap = new L.StamenTileLayer('terrain');
|
basemaps["Terrain"] = new L.StamenTileLayer('terrain');
|
||||||
basemaps["US terrain"] = usterrainmap;
|
|
||||||
|
|
||||||
// Nice watercolour based maps by Stamen Design
|
// Nice watercolour based maps by Stamen Design
|
||||||
var watermap = new L.StamenTileLayer('watercolor');
|
basemaps["Watercolor"] = new L.StamenTileLayer('watercolor');
|
||||||
basemaps["Watercolor"] = watermap;
|
|
||||||
|
|
||||||
// Now add the overlays
|
// Now add the overlays
|
||||||
|
|
||||||
@ -718,23 +715,26 @@ else { showLayerMenu = false;}
|
|||||||
|
|
||||||
// Delete a marker (and notify websocket)
|
// Delete a marker (and notify websocket)
|
||||||
var delMarker = function(dname) {
|
var delMarker = function(dname) {
|
||||||
//console.log("Deleting",dname);
|
|
||||||
if (typeof polygons[dname] != "undefined") {
|
if (typeof polygons[dname] != "undefined") {
|
||||||
layers[polygons[dname].lay].removeLayer(polygons[dname]);
|
layers[polygons[dname].lay].removeLayer(polygons[dname]);
|
||||||
ws.send(JSON.stringify({action:"delete", name:dname}));
|
|
||||||
delete polygons[dname];
|
delete polygons[dname];
|
||||||
}
|
}
|
||||||
|
if (typeof polygons[dname+"_"] != "undefined") {
|
||||||
|
layers[polygons[dname+"_"].lay].removeLayer(polygons[dname+"_"]);
|
||||||
|
delete polygons[dname+"_"];
|
||||||
|
}
|
||||||
if (typeof markers[dname] != "undefined") {
|
if (typeof markers[dname] != "undefined") {
|
||||||
ws.send(JSON.stringify({action:"delete", name:dname}));
|
|
||||||
layers[markers[dname].lay].removeLayer(markers[dname]);
|
layers[markers[dname].lay].removeLayer(markers[dname]);
|
||||||
|
map.removeLayer(markers[dname]);
|
||||||
delete markers[dname];
|
delete markers[dname];
|
||||||
}
|
}
|
||||||
|
ws.send(JSON.stringify({action:"delete", name:dname}));
|
||||||
map.closePopup();
|
map.closePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the MAIN add something to map function
|
// the MAIN add something to map function
|
||||||
function setMarker(data) {
|
function setMarker(data) {
|
||||||
//console.log(typeof data, data);
|
//console.log("DATA",typeof data, data);
|
||||||
var ll;
|
var ll;
|
||||||
var lli = null;
|
var lli = null;
|
||||||
var stay = popped;
|
var stay = popped;
|
||||||
@ -763,20 +763,23 @@ function setMarker(data) {
|
|||||||
}
|
}
|
||||||
var lay = data.layer || "unknown";
|
var lay = data.layer || "unknown";
|
||||||
if (typeof layers[lay] == "undefined") { // add layer if if doesn't exist
|
if (typeof layers[lay] == "undefined") { // add layer if if doesn't exist
|
||||||
//layers[lay] = new L.LayerGroup().addTo(map);
|
//layers[lay] = new L.LayerGroup();
|
||||||
layers[lay] = new L.MarkerClusterGroup({
|
layers[lay] = new L.MarkerClusterGroup({
|
||||||
maxClusterRadius:50,
|
maxClusterRadius:50,
|
||||||
spiderfyDistanceMultiplier:1.8,
|
spiderfyDistanceMultiplier:1.8,
|
||||||
disableClusteringAtZoom:clusterAt,
|
disableClusteringAtZoom:clusterAt
|
||||||
//zoomToBoundsOnClick:false
|
//zoomToBoundsOnClick:false
|
||||||
}).addTo(map);
|
});
|
||||||
overlays[lay] = layers[lay];
|
overlays[lay] = layers[lay];
|
||||||
//if (!inIframe) {
|
|
||||||
layercontrol.addOverlay(layers[lay],lay);
|
layercontrol.addOverlay(layers[lay],lay);
|
||||||
//}
|
map.addLayer(overlays[lay]);
|
||||||
|
console.log("ADDED LAYER",lay,layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof markers[data.name] != "undefined") { layers[lay].removeLayer(markers[data.name]); }
|
if (typeof markers[data.name] != "undefined") {
|
||||||
|
try {layers[lay].removeLayer(markers[data.name]); }
|
||||||
|
catch(e) { console.log("OOPS"); }
|
||||||
|
}
|
||||||
if (typeof polygons[data.name] != "undefined") { layers[lay].removeLayer(polygons[data.name]); }
|
if (typeof polygons[data.name] != "undefined") { layers[lay].removeLayer(polygons[data.name]); }
|
||||||
|
|
||||||
if (data.deleted) { // remove markers we are told to
|
if (data.deleted) { // remove markers we are told to
|
||||||
@ -1191,21 +1194,19 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
overlays[cmd.map.overlay].addTo(map);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
}
|
}
|
||||||
// Add a new velocity overlay layer
|
// Add a new velocity overlay layer
|
||||||
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("velocity") ) {
|
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("velocity") ) {
|
||||||
console.log("M",cmd.map);
|
|
||||||
if (overlays.hasOwnProperty(cmd.map.overlay)) {
|
if (overlays.hasOwnProperty(cmd.map.overlay)) {
|
||||||
map.removeLayer(overlays[cmd.map.overlay]);
|
map.removeLayer(overlays[cmd.map.overlay]);
|
||||||
existsalready = true;
|
existsalready = true;
|
||||||
}
|
}
|
||||||
console.log("E",existsalready);
|
|
||||||
overlays[cmd.map.overlay] = L.velocityLayer(cmd.map.velocity);
|
overlays[cmd.map.overlay] = L.velocityLayer(cmd.map.velocity);
|
||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
overlays[cmd.map.overlay].addTo(map);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
}
|
}
|
||||||
// Add a new overlay layer
|
// Add a new overlay layer
|
||||||
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("url") && cmd.map.hasOwnProperty("opt")) {
|
if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("url") && cmd.map.hasOwnProperty("opt")) {
|
||||||
@ -1231,7 +1232,7 @@ function doCommand(cmd) {
|
|||||||
if (!existsalready) {
|
if (!existsalready) {
|
||||||
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
||||||
}
|
}
|
||||||
overlays[cmd.map.overlay].addTo(map);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
}
|
}
|
||||||
// Swap a base layer
|
// Swap a base layer
|
||||||
if (cmd.layer && basemaps.hasOwnProperty(cmd.layer)) {
|
if (cmd.layer && basemaps.hasOwnProperty(cmd.layer)) {
|
||||||
@ -1241,7 +1242,7 @@ function doCommand(cmd) {
|
|||||||
}
|
}
|
||||||
// Add an overlay
|
// Add an overlay
|
||||||
if (cmd.layer && overlays.hasOwnProperty(cmd.layer)) {
|
if (cmd.layer && overlays.hasOwnProperty(cmd.layer)) {
|
||||||
overlays[cmd.layer].addTo(map);
|
map.addLayer(overlays[cmd.map.overlay]);
|
||||||
}
|
}
|
||||||
var clat = map.getCenter().lat;
|
var clat = map.getCenter().lat;
|
||||||
var clon = map.getCenter().lng;
|
var clon = map.getCenter().lng;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# date: May 30th 2018 - v1.1.16
|
# date: June 6th 2018 - v1.2.0
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
index.html
|
index.html
|
||||||
|
Loading…
Reference in New Issue
Block a user