fix NVG import handling of icon symbols

This commit is contained in:
Dave Conway-Jones 2020-10-28 19:34:25 +00:00
parent c5faa5726a
commit 0f4edcb95d
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 42 additions and 9 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.5.5 - Fix NVG import to handle symbols for points
- v2.5.4 - Fix delete of hulls
- v2.5.3 - Swap default satellite layer
- v2.5.2 - Add boolean parameter to feedback call to allow auto close of popup on click. Set Esc key to close all open popups. Issue #146

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates
- v2.5.5 - Fix NVG import to handle symbols for points
- v2.5.4 - Fix delete of hulls
- v2.5.3 - Swap default satellite layer
- v2.5.2 - Add boolean parameter to feedback call to allow auto close of popup on click. Set Esc key to close all open popups. Issue #146

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "2.5.4",
"version": "2.5.5",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": {
"cgi": "0.3.1",

View File

@ -1897,6 +1897,37 @@ function doCommand(cmd) {
}
}
return st;
},
pointToLayer: function (feature, latlng) {
if (feature.hasOwnProperty("properties") && feature.properties.hasOwnProperty('symbol')) {
var sidc = feature.properties.symbol.toUpperCase().replace("APP6A:",'')//.substr(0,13);
var country;
if (sidc.length > 12) { country = sidc.substr(12).replace(/-/g,''); sidc = sidc.substr(0,12); }
myMarker = new ms.Symbol( sidc, {
uniqueDesignation:feature.properties.label,
country:country,
direction:feature.properties.course,
additionalInformation:feature.properties.modifier,
size:24
});
var myicon = L.icon({
iconUrl: myMarker.toDataURL(),
iconAnchor: [myMarker.getAnchor().x, myMarker.getAnchor().y],
className: "natoicon",
});
return L.marker(latlng, { name:feature.properties.label, icon:myicon });
}
else {
var geojsonMarkerOptions = {
radius: 10,
fillColor: "#ff7800",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
return L.circleMarker(latlng, geojsonMarkerOptions);
}
}
});
if (!existsalready) {