From fc99940d997d0880e2314e29ff45a2e3a4e95f37 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 2 Jul 2021 13:15:03 +0100 Subject: [PATCH] Fix SIDC label icons --- README.md | 5 +---- worldmap/worldmap.js | 9 +++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7357b30..8dfe3ee 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ map web page for plotting "things" on. ### Updates +- v2.15.5 - Fix SDIC icons to accept iso-coded icons as labels. - v2.15.4 - Let clear heatmap command do what it says. - v2.15.3 - Fix panit command to work, try to use alt units, popup alignments. - v2.15.0 - let speed be text and specify units if required (kt,kn,knots,mph,kmh,kph) default m/s. @@ -21,10 +22,6 @@ map web page for plotting "things" on. - v2.13.0 - Tidy velocity layer. Feedback any url parameters. - v2.12.1 - Only show online layer options if we are online. - v2.12.0 - Add live rainfall radar data layer. Remove some non-loading overlays. -- v2.11.2 - Allow thicknesss of arc to be specified by weight. -- v2.11.1 - Better handle KML point info - add popup. -- v2.11.0 - Add option to smooth tracks using bezier curves. -- v2.10.0 - Save latest position to browser for refresh if in iframe/dashboard. Allow fractional Zoom levels. - see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes. diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index fdfff6e..5ee2e59 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -1259,7 +1259,7 @@ function setMarker(data) { return m; } - //console.log("DATA" typeof data, data); + // console.log("DATA", typeof data, data); if (data.deleted) { // remove markers we are told to delMarker(data.name); return; @@ -1686,7 +1686,7 @@ function setMarker(data) { } else if (data.hasOwnProperty("SIDC")) { // "SIDC":"SFGPU------E***","name":"1.C2 komp","fullname":"1.C2 komp/FTS/INSS" - myMarker = new ms.Symbol( data.SIDC.toUpperCase(), { uniqueDesignation:data.name }); + myMarker = new ms.Symbol( data.SIDC.toUpperCase(), { uniqueDesignation:unescape(encodeURIComponent(data.name)) }); // Now that we have a symbol we can ask for the echelon and set the symbol size var opts = data.options || {}; var sz = 25; @@ -1695,6 +1695,11 @@ function setMarker(data) { } opts.size = opts.size || sz; opts.size = opts.size * (opts.scale || 1); + // escape out any isocodes eg flag symbols + var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation"]; + optfields.forEach(function (item) { + if (opts.hasOwnProperty(item)) { opts[item] = unescape(encodeURIComponent(opts[item])); } + }); myMarker = myMarker.setOptions(opts); var myicon = L.icon({ iconUrl: myMarker.toDataURL(),