node-red-contrib-web-worldmap 4.8.1 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/README.md +1 -0
- package/package.json +1 -1
- package/worldmap/worldmap.js +26 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v4.9.0 - If payload.flag is two char ISO code replace it with flag emoji. Revert part of PR #271
|
|
3
4
|
- v4.8.1 - Slight tidy of some of the geojson handling
|
|
4
5
|
- v4.8.0 - Merged PR for feedback functionality cleanup and example. PR #271 and #272
|
|
5
6
|
- v4.7.0 - Update pmtiles library, fix feedback function inconsistency. Issue #270
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Feel free to [ {
|
|
|
865
865
|
var form = {};
|
|
866
866
|
var addToForm = function(n,v) { form[n] = v; }
|
|
867
867
|
var feedback = function(n,v,a,c) {
|
|
868
|
-
/*
|
|
869
|
-
// suggest to reove all the special handling for simplification, no reason to send information
|
|
870
|
-
// about entities that the backend generaed, the need is only to get recognizable actions from the frontend
|
|
871
|
-
//
|
|
872
868
|
if (v === "_form") { v = form; }
|
|
873
869
|
if (markers[n]) {
|
|
874
|
-
console.log("FB1",n,v,a,c)
|
|
870
|
+
// console.log("FB1",n,v,a,c)
|
|
875
871
|
allData[n].action = a || "feedback";
|
|
876
872
|
//if (v !== undefined) { allData[n][a||"value"] = v; }
|
|
877
873
|
if (v !== undefined) { allData[n]["value"] = v; }
|
|
@@ -879,19 +875,17 @@ var feedback = function(n,v,a,c) {
|
|
|
879
875
|
setMarker(allData[n]);
|
|
880
876
|
}
|
|
881
877
|
else if (polygons[n]) {
|
|
882
|
-
console.log("FB2", n, v, a);
|
|
878
|
+
// console.log("FB2", n, v, a);
|
|
883
879
|
const polyData = { "name": n, "action": a || "feedback", "value": v || null };
|
|
884
880
|
//sendDrawing(n,v,a)
|
|
885
881
|
ws.send(JSON.stringify(polyData));
|
|
886
882
|
}
|
|
887
883
|
else {
|
|
888
884
|
if (n === undefined) { n = "map"; }
|
|
889
|
-
console.log("FB3",n,v,a,c)
|
|
885
|
+
// console.log("FB3",n,v,a,c)
|
|
890
886
|
rmenudata = v;
|
|
891
887
|
ws.send(JSON.stringify({action:a||"feedback", name:n, value:v, lat:rclk.lat, lon:rclk.lng}));
|
|
892
888
|
}
|
|
893
|
-
*/
|
|
894
|
-
|
|
895
889
|
const dataToSend = { "name": n, "action": a || "feedback", "value": v || null };
|
|
896
890
|
ws.send(JSON.stringify(dataToSend));
|
|
897
891
|
if (c === true) { map.closePopup(); }
|
|
@@ -1514,6 +1508,15 @@ var rangerings = function(latlng, options) {
|
|
|
1514
1508
|
return rings;
|
|
1515
1509
|
}
|
|
1516
1510
|
|
|
1511
|
+
// var mmsiList = {"M201":"AL","M202":"AD","M203":"AT","M204":"PT","M205":"BE","M206":"BY","M207":"BG","M208":"VA","M209":"CY","M210":"CY","M211":"DE","M212":"CY","M213":"GE","M214":"MD","M215":"MT","M216":"AM","M218":"DE","M219":"DK","M220":"DK","M224":"ES","M225":"ES","M226":"FR","M227":"FR","M228":"FR","M229":"MT","M230":"FI","M231":"FO","M232":"GB","M233":"GB","M234":"GB","M235":"GB","M236":"GI","M237":"GR","M238":"HR","M239":"GR","M240":"GR","M241":"GR","M242":"MA","M243":"HU","M244":"NL","M245":"NL","M246":"NL","M247":"IT","M248":"MT","M249":"MT","M250":"IE","M251":"IS","M252":"LI","M253":"LU","M254":"MC","M255":"PT","M256":"MT","M257":"NO","M258":"NO","M259":"NO","M261":"PL","M262":"ME","M263":"PT","M264":"RO","M265":"SE","M266":"SE","M267":"SK","M268":"SM","M269":"CH","M270":"CZ","M271":"TR","M272":"UA","M273":"RU","M274":"MK","M275":"LV","M276":"EE","M277":"LT","M278":"SI","M279":"RS","M301":"AI","M303":"US","M304":"AG","M305":"AG","M306":"CW","M307":"AW","M308":"BS","M309":"BS","M310":"BM","M311":"BS","M312":"BZ","M314":"BB","M316":"CA","M319":"KY","M321":"CR","M323":"CU","M325":"DM","M327":"DO","M329":"GP","M330":"GD","M331":"GL","M332":"GT","M334":"HN","M336":"HT","M338":"US","M339":"JM","M341":"KN","M343":"LC","M345":"MX","M347":"MQ","M348":"MS","M350":"NI","M351":"PA","M352":"PA","M353":"PA","M354":"PA","M355":"PA","M356":"PA","M357":"PA","M358":"PR","M359":"SV","M361":"PM","M362":"TT","M364":"TC","M366":"US","M367":"US","M368":"US","M369":"US","M370":"PA","M371":"PA","M372":"PA","M373":"PA","M374":"PA","M375":"VC","M376":"VC","M377":"VC","M378":"VG","M379":"VI","M401":"AF","M403":"SA","M405":"BD","M408":"BH","M410":"BT","M412":"CN","M413":"CN","M414":"CN","M416":"TW","M417":"LK","M419":"IN","M422":"IR","M423":"AZ","M425":"IQ","M428":"IL","M431":"JP","M432":"JP","M434":"TM","M436":"KZ","M437":"UZ","M438":"JO","M440":"KR","M441":"KR","M443":"PS","M445":"KP","M447":"KW","M450":"LB","M451":"KG","M453":"MO","M455":"MV","M457":"MN","M459":"NP","M461":"OM","M463":"PK","M466":"QA","M468":"SY","M470":"AE","M471":"AE","M472":"TJ","M473":"YE","M475":"YE","M477":"HK","M478":"BA","M501":"AQ","M503":"AU","M506":"MM","M508":"BN","M510":"FM","M511":"PW","M512":"NZ","M514":"KH","M515":"KH","M516":"CX","M518":"CK","M520":"FJ","M523":"CC","M525":"ID","M529":"KI","M531":"LA","M533":"MY","M536":"MP","M538":"MH","M540":"NC","M542":"NU","M544":"NR","M546":"PF","M548":"PH","M553":"PG","M555":"PN","M557":"SB","M559":"AS","M561":"WS","M563":"SG","M564":"SG","M565":"SG","M566":"SG","M567":"TH","M570":"TO","M572":"TV","M574":"VN","M576":"VU","M577":"VU","M578":"WF","M601":"ZA","M603":"AO","M605":"DZ","M607":"TF","M608":"IO","M609":"BI","M610":"BJ","M611":"BW","M612":"CF","M613":"CM","M615":"CG","M616":"KM","M617":"CV","M618":"AQ","M619":"CI","M620":"KM","M621":"DJ","M622":"EG","M624":"ET","M625":"ER","M626":"GA","M627":"GH","M629":"GM","M630":"GW","M631":"GQ","M632":"GN","M633":"BF","M634":"KE","M635":"AQ","M636":"LR","M637":"LR","M642":"LY","M644":"LS","M645":"MU","M647":"MG","M649":"ML","M650":"MZ","M654":"MR","M655":"MW","M656":"NE","M657":"NG","M659":"NA","M660":"RE","M661":"RW","M662":"SD","M663":"SN","M664":"SC","M665":"SH","M666":"SO","M667":"SL","M668":"ST","M669":"SZ","M670":"TD","M671":"TG","M672":"TN","M674":"TZ","M675":"UG","M676":"CD","M677":"TZ","M678":"ZM","M679":"ZW","M701":"AR","M710":"BR","M720":"BO","M725":"CL","M730":"CO","M735":"EC","M740":"UK","M745":"GF","M750":"GY","M755":"PY","M760":"PE","M765":"SR","M770":"UY","M775":"VE"}
|
|
1512
|
+
|
|
1513
|
+
// var mmsiToCountry = function(str) {
|
|
1514
|
+
// if (!str) { return ''; }
|
|
1515
|
+
// var co = mmsiList[("M"+str).substr(0,4)];
|
|
1516
|
+
// if (co.length === 2) { return co; }
|
|
1517
|
+
// else { return str; }
|
|
1518
|
+
// };
|
|
1519
|
+
|
|
1517
1520
|
// the MAIN add marker or shape to map function
|
|
1518
1521
|
function setMarker(data) {
|
|
1519
1522
|
var rightmenu = function(m) {
|
|
@@ -2075,6 +2078,12 @@ function setMarker(data) {
|
|
|
2075
2078
|
}
|
|
2076
2079
|
opts.size = opts.size || sz;
|
|
2077
2080
|
opts.size = opts.size * (opts.scale || 1);
|
|
2081
|
+
if (data.SIDC.length > 12) {
|
|
2082
|
+
var cc = data.SIDC.substr(12,2).toLowerCase();
|
|
2083
|
+
opts.country = cc.toUpperCase();
|
|
2084
|
+
opts.staffComments = emojify(":flag-"+cc+":") + " " + (opts?.staffComments || "");
|
|
2085
|
+
data.flag = emojify(":flag-"+cc+":");
|
|
2086
|
+
}
|
|
2078
2087
|
// escape out any isocodes eg flag symbols
|
|
2079
2088
|
var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed","country"];
|
|
2080
2089
|
//const regex = /\p{Extended_Pictographic}/ug;
|
|
@@ -2169,6 +2178,14 @@ function setMarker(data) {
|
|
|
2169
2178
|
if (data.hasOwnProperty("icon")) { delete data.icon; }
|
|
2170
2179
|
if (data.hasOwnProperty("iconSize")) { delete data.iconSize; }
|
|
2171
2180
|
if (data.hasOwnProperty("iconColor")) { delete data.iconColor; }
|
|
2181
|
+
|
|
2182
|
+
// if (data?.MMSI && !data?.flag) {
|
|
2183
|
+
// data.flag = mmsiToCountry(data.MMSI)
|
|
2184
|
+
// }
|
|
2185
|
+
if (data?.flag && data.flag.length == 2) {
|
|
2186
|
+
const tflg = emojify(":flag-"+data.flag.toLowerCase()+":");
|
|
2187
|
+
if (!tflg.includes("flag-")) { data.flag = tflg; }
|
|
2188
|
+
}
|
|
2172
2189
|
if (data.hasOwnProperty("photourl")) {
|
|
2173
2190
|
words += "<img src=\"" + data.photourl + "\" style=\"max-width:100%; max-height:250px; margin-top:10px;\"><br/>";
|
|
2174
2191
|
delete data.photourl;
|