Merge pull request #2844 from nxdefiant/master

openstmap & recorder changes
master
Gordon Williams 2023-06-28 11:59:36 +01:00 committed by GitHub
commit 2cd1caa2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 5 deletions

View File

@ -18,4 +18,5 @@
0.15: Make track drawing an option (default off) 0.15: Make track drawing an option (default off)
0.16: Draw waypoints, too. 0.16: Draw waypoints, too.
0.17: With new Recorder app allow track to be drawn in the background 0.17: With new Recorder app allow track to be drawn in the background
Switch tile layer URL for faster/more reliable map tiles Switch tile layer URL for faster/more reliable map tiles
0.18: Prefer map with highest resolution

View File

@ -183,7 +183,7 @@ TODO:
}).addTo(map); }).addTo(map);
let marker = new L.marker(latlon).addTo(map); let marker = new L.marker(latlon).addTo(map);
map.fitBounds(latlon.toBounds(2000/*meters*/), {animation: false}); map.fitBounds(latlon.toBounds(2000/*meters*/), {animation: false});
}, 100); }, 500);
} }
resolve(); resolve();
}); });

View File

@ -2,7 +2,7 @@
"id": "openstmap", "id": "openstmap",
"name": "OpenStreetMap", "name": "OpenStreetMap",
"shortName": "OpenStMap", "shortName": "OpenStMap",
"version": "0.17", "version": "0.18",
"description": "Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are. Once installed this also adds map functionality to `GPS Recorder` and `Recorder` apps", "description": "Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are. Once installed this also adds map functionality to `GPS Recorder` and `Recorder` apps",
"readme": "README.md", "readme": "README.md",
"icon": "app.png", "icon": "app.png",

View File

@ -30,6 +30,7 @@ m.maps = require("Storage").list(/openstmap\.\d+\.json/).map(f=>{
map.center = Bangle.project({lat:map.lat,lon:map.lon}); map.center = Bangle.project({lat:map.lat,lon:map.lon});
return map; return map;
}); });
m.maps.sort((a,b) => b.scale-a.scale); // sort by scale so highest resolution is drawn last
// we base our start position on the middle of the first map // we base our start position on the middle of the first map
m.map = m.maps[0]; m.map = m.maps[0];
m.scale = m.map.scale; // current scale (based on first map) m.scale = m.map.scale; // current scale (based on first map)

View File

@ -33,4 +33,5 @@
0.25: Widget now has `isRecording()` for retrieving recording status. 0.25: Widget now has `isRecording()` for retrieving recording status.
0.26: Now record filename based on date 0.26: Now record filename based on date
0.27: Fix first ever recorded filename being log0 (now all are dated) 0.27: Fix first ever recorded filename being log0 (now all are dated)
0.28: Automatically create new track if the filename is different 0.28: Automatically create new track if the filename is different
0.29: When plotting with OpenStMap scale map to track width & height

View File

@ -224,6 +224,12 @@ function viewTrack(filename, info) {
// Function to convert lat/lon to XY // Function to convert lat/lon to XY
var getMapXY; var getMapXY;
if (info.qOSTM) { if (info.qOSTM) {
// scale map to view full track
const max = Bangle.project({lat: info.maxLat, lon: info.maxLong});
const min = Bangle.project({lat: info.minLat, lon: info.minLong});
const scaleX = (max.x-min.x)/Bangle.appRect.w;
const scaleY = (max.y-min.y)/Bangle.appRect.h;
osm.scale = Math.ceil((scaleX > scaleY ? scaleX : scaleY)*1.1); // add 10% margin
getMapXY = osm.latLonToXY.bind(osm); getMapXY = osm.latLonToXY.bind(osm);
} else { } else {
getMapXY = function(lat, lon) { "ram" getMapXY = function(lat, lon) { "ram"

View File

@ -2,7 +2,7 @@
"id": "recorder", "id": "recorder",
"name": "Recorder", "name": "Recorder",
"shortName": "Recorder", "shortName": "Recorder",
"version": "0.28", "version": "0.29",
"description": "Record GPS position, heart rate and more in the background, then download to your PC.", "description": "Record GPS position, heart rate and more in the background, then download to your PC.",
"icon": "app.png", "icon": "app.png",
"tags": "tool,outdoors,gps,widget", "tags": "tool,outdoors,gps,widget",