add another option to clear track from track store
This commit is contained in:
parent
e7b41e000d
commit
2e500c39d8
@ -531,7 +531,9 @@ then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the m
|
|||||||
<p>Holds all the points in memory, so if you have a lot of points held for a
|
<p>Holds all the points in memory, so if you have a lot of points held for a
|
||||||
large depth then memory usage may become excessive.</p>
|
large depth then memory usage may become excessive.</p>
|
||||||
<p>To delete a track send a msg.payload containing both the name of the object and
|
<p>To delete a track send a msg.payload containing both the name of the object and
|
||||||
set deleted to true - for example <code>msg.payload = { "name":"Fred", "deleted":true }</code></p>
|
set deleted to true - for example <code>msg.payload = { "name":"Fred", "deleted":true }</code>.</p>
|
||||||
|
<p>This will also delete the point. If you just want to clear the track set the msg.payload to the
|
||||||
|
name+"_", for example <code>msg.payload = { "name":"Fred_", "deleted":true }</code></p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
11
worldmap.js
11
worldmap.js
@ -264,9 +264,16 @@ module.exports = function(RED) {
|
|||||||
if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("name")) {
|
if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("name")) {
|
||||||
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];
|
if (msg.payload.name.substr(-1) === '_') {
|
||||||
|
var a = node.pointsarray[msg.payload.name.substr(0,msg.payload.name.length-1)].pop();
|
||||||
|
node.pointsarray[msg.payload.name.substr(0,msg.payload.name.length-1)] = [ a ];
|
||||||
|
node.send(newmsg);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
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);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!msg.payload.hasOwnProperty("lat") || !msg.payload.hasOwnProperty("lon")) { return; }
|
if (!msg.payload.hasOwnProperty("lat") || !msg.payload.hasOwnProperty("lon")) { return; }
|
||||||
|
Loading…
Reference in New Issue
Block a user