node-red-contrib-web-worldmap 2.28.0 → 2.28.3
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/.github/workflows/codeql-analysis.yml +70 -0
- package/CHANGELOG.md +3 -1
- package/README.md +6 -2
- package/package.json +1 -1
- package/worldmap/worldmap.js +41 -35
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ master ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ master ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '39 16 * * 6'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'javascript' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout repository
|
|
41
|
+
uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
|
44
|
+
- name: Initialize CodeQL
|
|
45
|
+
uses: github/codeql-action/init@v2
|
|
46
|
+
with:
|
|
47
|
+
languages: ${{ matrix.language }}
|
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
52
|
+
|
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
55
|
+
- name: Autobuild
|
|
56
|
+
uses: github/codeql-action/autobuild@v2
|
|
57
|
+
|
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
59
|
+
# 📚 https://git.io/JvXDl
|
|
60
|
+
|
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
62
|
+
# and modify them (or add more) to build your code if your project
|
|
63
|
+
# uses a compiled language
|
|
64
|
+
|
|
65
|
+
#- run: |
|
|
66
|
+
# make bootstrap
|
|
67
|
+
# make release
|
|
68
|
+
|
|
69
|
+
- name: Perform CodeQL Analysis
|
|
70
|
+
uses: github/codeql-action/analyze@v2
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
-
- v2.
|
|
3
|
+
- v2.28.3 - Let button declaration be an array
|
|
4
|
+
- v2.28.1 - Fix layer command bug for non-core layers. Issue #195
|
|
5
|
+
- v2.28.0 - Better Handling of sidc icons in geojson
|
|
4
6
|
- v2.27.3 - Try to handle greatcircles crossing antimeridian
|
|
5
7
|
- v2.27.1 - Reload existing markers for late joiners
|
|
6
8
|
- v2.26.1 - Add QTH/Maidenhead option also
|
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ map web page for plotting "things" on.
|
|
|
11
11
|
|
|
12
12
|
### Updates
|
|
13
13
|
|
|
14
|
-
- v2.
|
|
14
|
+
- v2.28.3 - Let button declaration be an array
|
|
15
|
+
- v2.28.1 - Fix layer command bug for non-core layers. Issue #195
|
|
16
|
+
- v2.28.0 - Better Handling of sidc icons in geojson
|
|
15
17
|
- v2.27.3 - Try to handle greatcircles crossing antimeridian
|
|
16
18
|
- v2.27.1 - Reload existing markers for late joiners
|
|
17
19
|
- v2.26.1 - Add QTH/Maidenhead option also
|
|
@@ -419,7 +421,7 @@ Optional properties include
|
|
|
419
421
|
- **hiderightclick** - disables the right click that allows adding or deleting points on the map - `{"command":{"hiderightclick":true}}`
|
|
420
422
|
- **coords** - turns on and off a display of the current mouse co-ordinates. Values can be "deg", "dms", or "none" (default). - `{"command":{"coords":"deg"}}`
|
|
421
423
|
- **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
|
|
422
|
-
a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default).
|
|
424
|
+
a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default). button can also be an array of button objects.
|
|
423
425
|
- **contextmenu** - html string to define the right click menu when not on a marker. Defaults to the simple add marker input. Empty string `""` disables this right click.
|
|
424
426
|
- **toptitle** - Words to replace title in title bar (if not in iframe)
|
|
425
427
|
- **toplogo** - URL to logo image for top tile bar (if not in iframe) - ideally 60px by 24px.
|
|
@@ -444,6 +446,8 @@ to remove
|
|
|
444
446
|
|
|
445
447
|
msg.payload.command = { "button": { "name":"My Fancy Button" } };
|
|
446
448
|
|
|
449
|
+
Multiple buttons can declared by using an array of button objects.
|
|
450
|
+
|
|
447
451
|
#### To add a custom popup or contextmenu
|
|
448
452
|
|
|
449
453
|
You can customise a marker's popup, or context menu (right click), by setting the
|
package/package.json
CHANGED
package/worldmap/worldmap.js
CHANGED
|
@@ -733,16 +733,21 @@ map.on('contextmenu', function(e) {
|
|
|
733
733
|
}
|
|
734
734
|
});
|
|
735
735
|
|
|
736
|
+
|
|
737
|
+
// Layer control based on select box rather than radio buttons.
|
|
738
|
+
//var layercontrol = L.control.selectLayers(basemaps, overlays).addTo(map);
|
|
739
|
+
layercontrol = L.control.layers(basemaps, overlays);
|
|
740
|
+
|
|
736
741
|
// Add all the base layer maps if we are online.
|
|
737
742
|
var addBaseMaps = function(maplist,first) {
|
|
738
743
|
// console.log("MAPS",first,maplist)
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
744
|
+
var layerlookup = { OSMG:"OSM grey", OSMC:"OSM", OSMH:"OSM Humanitarian", EsriC:"Esri", EsriS:"Esri Satellite",
|
|
745
|
+
EsriR:"Esri Relief", EsriT:"Esri Topography", EsriO:"Esri Ocean", EsriDG:"Esri Dark Grey", NatGeo: "National Geographic",
|
|
746
|
+
UKOS:"UK OS OpenData", OS45:"UK OS 1919-1947", OS00:"UK OS 1900", OpTop:"Open Topo Map",
|
|
747
|
+
HB:"Hike Bike OSM", ST:"Stamen Topography", SW:"Stamen Watercolor", AN:"AutoNavi (Chinese)"
|
|
748
|
+
}
|
|
745
749
|
|
|
750
|
+
if (navigator.onLine) {
|
|
746
751
|
// Use this for OSM online maps
|
|
747
752
|
var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
748
753
|
var osmAttrib='Map data © OpenStreetMap contributors';
|
|
@@ -903,18 +908,19 @@ var addBaseMaps = function(maplist,first) {
|
|
|
903
908
|
attribution: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
|
|
904
909
|
});
|
|
905
910
|
}
|
|
911
|
+
}
|
|
906
912
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
913
|
+
if (first) {
|
|
914
|
+
if (layerlookup[first]) { baselayername = layerlookup[first]; }
|
|
915
|
+
else { basenayername = first; }
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
basenayername = Object.keys(basemaps)[0];
|
|
919
|
+
}
|
|
920
|
+
basemaps[baselayername].addTo(map);
|
|
921
|
+
if (showLayerMenu) {
|
|
922
|
+
map.removeControl(layercontrol);
|
|
923
|
+
layercontrol = L.control.layers(basemaps, overlays).addTo(map);
|
|
918
924
|
}
|
|
919
925
|
}
|
|
920
926
|
|
|
@@ -960,7 +966,7 @@ var addOverlays = function(overlist) {
|
|
|
960
966
|
});
|
|
961
967
|
var changeDrawColour = function(col) {
|
|
962
968
|
drawingColour = col;
|
|
963
|
-
console.log("COLOR",col)
|
|
969
|
+
// console.log("COLOR",col)
|
|
964
970
|
drawControl.setDrawingOptions({
|
|
965
971
|
polyline: { shapeOptions: { color:drawingColour } },
|
|
966
972
|
circle: { shapeOptions: { color:drawingColour } },
|
|
@@ -1111,7 +1117,7 @@ var addOverlays = function(overlist) {
|
|
|
1111
1117
|
}
|
|
1112
1118
|
|
|
1113
1119
|
// Add the countries (world-110m) for offline use
|
|
1114
|
-
if (overlist.indexOf("CO")
|
|
1120
|
+
if (overlist.indexOf("CO") !== -1 || !navigator.onLine) {
|
|
1115
1121
|
var customTopoLayer = L.geoJson(null, {clickable:false, style: {color:"blue", weight:2, fillColor:"#cf6", fillOpacity:0.04}});
|
|
1116
1122
|
layers["_countries"] = omnivore.topojson('images/world-50m-flat.json',null,customTopoLayer);
|
|
1117
1123
|
overlays["countries"] = layers["_countries"];
|
|
@@ -1196,10 +1202,6 @@ var addOverlays = function(overlist) {
|
|
|
1196
1202
|
}
|
|
1197
1203
|
}
|
|
1198
1204
|
|
|
1199
|
-
// Layer control based on select box rather than radio buttons.
|
|
1200
|
-
//var layercontrol = L.control.selectLayers(basemaps, overlays).addTo(map);
|
|
1201
|
-
layercontrol = L.control.layers(basemaps, overlays);
|
|
1202
|
-
|
|
1203
1205
|
// Add the layers control widget
|
|
1204
1206
|
if (!inIframe) { layercontrol.addTo(map); }
|
|
1205
1207
|
else { showLayerMenu = false;}
|
|
@@ -2164,19 +2166,22 @@ function doCommand(cmd) {
|
|
|
2164
2166
|
}
|
|
2165
2167
|
}
|
|
2166
2168
|
if (cmd.hasOwnProperty("button")) {
|
|
2167
|
-
if (cmd.button
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2169
|
+
if (!Array.isArray(cmd.button)) { cmd.button = [cmd.button]; }
|
|
2170
|
+
cmd.button.forEach(function(b) {
|
|
2171
|
+
if (b.icon) {
|
|
2172
|
+
if (!buttons[b.name]) {
|
|
2173
|
+
buttons[b.name] = L.easyButton( b.icon, function() {
|
|
2174
|
+
ws.send(JSON.stringify({action:"button", name:b.name}));
|
|
2175
|
+
}, b.name, { position:b.position||'topright' }).addTo(map);
|
|
2176
|
+
}
|
|
2172
2177
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
+
else {
|
|
2179
|
+
if (buttons[b.name]) {
|
|
2180
|
+
buttons[b.name].removeFrom(map);
|
|
2181
|
+
delete buttons[b.name];
|
|
2182
|
+
}
|
|
2178
2183
|
}
|
|
2179
|
-
}
|
|
2184
|
+
})
|
|
2180
2185
|
}
|
|
2181
2186
|
if (cmd.hasOwnProperty("contextmenu")) {
|
|
2182
2187
|
if (typeof cmd.contextmenu === "string") {
|
|
@@ -2224,7 +2229,7 @@ function doCommand(cmd) {
|
|
|
2224
2229
|
var existsalready = false;
|
|
2225
2230
|
// Add a new base map layer
|
|
2226
2231
|
if (cmd.map && cmd.map.hasOwnProperty("name") && cmd.map.name.length>0 && cmd.map.hasOwnProperty("url") && cmd.map.hasOwnProperty("opt")) {
|
|
2227
|
-
console.log("BASE",cmd.map);
|
|
2232
|
+
// console.log("BASE",cmd.map);
|
|
2228
2233
|
if (basemaps.hasOwnProperty(cmd.map.name)) { existsalready = true; }
|
|
2229
2234
|
if (cmd.map.hasOwnProperty("wms")) { // special case for wms
|
|
2230
2235
|
console.log("New WMS:",cmd.map.name);
|
|
@@ -2523,6 +2528,7 @@ function doCommand(cmd) {
|
|
|
2523
2528
|
baselayername = cmd.layer;
|
|
2524
2529
|
basemaps[baselayername].addTo(map);
|
|
2525
2530
|
}
|
|
2531
|
+
// If set to none then remove the baselayer...
|
|
2526
2532
|
if (cmd.layer && (cmd.layer === "none")) {
|
|
2527
2533
|
map.removeLayer(basemaps[baselayername]);
|
|
2528
2534
|
baselayername = cmd.layer;
|