Add heatmap options to control message options to close #10

This commit is contained in:
Dave Conway-Jones 2017-03-04 14:13:05 +00:00
parent bf2aad4bf6
commit e1d8734c1c
5 changed files with 13 additions and 5 deletions

View File

@ -7,6 +7,7 @@ map web page for plotting "things" on.
![Map Image](https://dceejay.github.io/pages/images/redmap.png) ![Map Image](https://dceejay.github.io/pages/images/redmap.png)
### Changes ### Changes
- v1.0.23 - Add msg.payload.command.heatmap to allow setting of heatmap config.
- v1.0.22 - Add example how to embed into Node-RED-Dashboard template. - v1.0.22 - Add example how to embed into Node-RED-Dashboard template.
- v1.0.21 - If you specify range and icon then you get a marker and a range circle, if you just specify range with no icon, you just get a circle, and vice versa. - v1.0.21 - If you specify range and icon then you get a marker and a range circle, if you just specify range with no icon, you just get a circle, and vice versa.
- v1.0.20 - Add buildings overlay. - v1.0.20 - Add buildings overlay.
@ -23,7 +24,7 @@ map web page for plotting "things" on.
Run the following command in your Node-RED user directory - typically `~/.node-red` Run the following command in your Node-RED user directory - typically `~/.node-red`
npm install node-red-contrib-web-worldmap npm i --save node-red-contrib-web-worldmap
### Usage ### Usage
@ -111,6 +112,7 @@ Optional properties include
- **name** - name of the map base layer OR **overlay** - name of overlay layer - **name** - name of the map base layer OR **overlay** - name of overlay layer
- **url** - url of the map layer - **url** - url of the map layer
- **opt** - options object for the new layer - **opt** - options object for the new layer
- **heatmap** - set heatmap options object see https://github.com/Leaflet/Leaflet.heat#reference
#### For example #### For example

View File

@ -1,10 +1,10 @@
{ {
"name" : "node-red-contrib-web-worldmap", "name" : "node-red-contrib-web-worldmap",
"version" : "1.0.21", "version" : "1.0.23",
"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" : {
"express": "4.*", "express": "^4.15.0",
"socket.io": "^1.4.6" "socket.io": "^1.7.3"
}, },
"repository" : { "repository" : {
"type":"git", "type":"git",

View File

@ -117,6 +117,7 @@
}, },
info: function() { info: function() {
return 'The map can be found [here]('+RED.settings.httpNodeRoot.slice(0,-1)+'/worldmap).'; return 'The map can be found [here]('+RED.settings.httpNodeRoot.slice(0,-1)+'/worldmap).';
//return 'The map can be found <a href="'+RED.settings.httpNodeRoot.slice(0,-1)+'/worldmap" target="_blank">here</a>.';
}, },
oneditprepare: function() { oneditprepare: function() {
$( "#node-input-zoom" ).spinner({min:0, max:18}); $( "#node-input-zoom" ).spinner({min:0, max:18});

View File

@ -619,6 +619,7 @@ overlays["day/night"] = layers["_daynight"];
var heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}}); var heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}});
layers["heat"] = new L.LayerGroup().addLayer(heat); layers["heat"] = new L.LayerGroup().addLayer(heat);
overlays["heatmap"] = layers["heat"]; overlays["heatmap"] = layers["heat"];
console.log("HEAT",heat);
// Add the drawing layer for fun... // Add the drawing layer for fun...
layers["drawing"] = new L.FeatureGroup(); layers["drawing"] = new L.FeatureGroup();
@ -1006,6 +1007,10 @@ function doCommand(cmd) {
document.getElementById("maxage").value = cmd.maxage; document.getElementById("maxage").value = cmd.maxage;
setMaxAge(); setMaxAge();
} }
if (cmd.hasOwnProperty("heatmap")) {
heat.setOptions(cmd.heatmap);
heat.redraw();
}
map.setView([clat,clon],czoom); map.setView([clat,clon],czoom);
} }
</script> </script>

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# date: Nov 22nd v1.0.22 # date: Mar 4th 2017 - v1.0.23
CACHE: CACHE:
index.html index.html