Merge pull request #2625 from pavelmachek/merge_1

openstmap: display waypoints
master
Gordon Williams 2023-03-06 09:51:08 +00:00 committed by GitHub
commit d2d41e1404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 7 deletions

View File

@ -16,3 +16,4 @@
Support for zooming in on map
Satellite count moved to widget bar to leave more room for the map
0.15: Make track drawing an option (default off)
0.16: Draw waypoints, too.

View File

@ -17,20 +17,20 @@ To add a map:
* Scroll and zoom to the area of interest or use the Search button in the top left
* Now choose the size you want to upload (Small/Medium/etc)
* On Bangle.js 1 you can choose if you want a 3 bits per pixel map (this is lower
quality but uploads faster and takes less space). On Bangle.js 2 you only have a 3bpp
display so can only use 3bpp.
quality, but uploads faster and takes less space). Bangle.js 2 is limited to 3bpp.
* Click `Get Map`, and a preview will be displayed. If you need to adjust the area you
can change settings, move the map around, and click `Get Map` again.
* When you're ready, click `Upload`
## Bangle.js App
The Bangle.js app allows you to view a map - it also turns the GPS on and marks
the path that you've been travelling (if enabled).
The Bangle.js app allows you to view a map. It also turns the GPS on
and marks the path that you've been travelling (if enabled), and
displays waypoints in the watch (if dependencies exist).
* Drag on the screen to move the map
* Press the button to bring up a menu, where you can zoom, go to GPS location
, put the map back in its default location, or choose whether to draw the currently
* Press the button to bring up a menu, where you can zoom, go to GPS location,
put the map back in its default location, or choose whether to draw the currently
recording GPS track (from the `Recorder` app).
**Note:** If enabled, drawing the currently recorded GPS track can take a second

View File

@ -10,6 +10,7 @@ var settings = require("Storage").readJSON("openstmap.json",1)||{};
function redraw() {
g.setClipRect(R.x,R.y,R.x2,R.y2);
m.draw();
drawPOI();
drawMarker();
// if track drawing is enabled...
if (settings.drawTrack) {
@ -25,6 +26,26 @@ function redraw() {
g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1);
}
// Draw the POIs
function drawPOI() {
try {
var waypoints = require("waypoints").load();
} catch (ex) {
// Waypoints module not available.
return;
}
g.setFont("Vector", 18);
waypoints.forEach((wp, idx) => {
var p = m.latLonToXY(wp.lat, wp.lon);
var sz = 2;
g.setColor(0,0,0);
g.fillRect(p.x-sz, p.y-sz, p.x+sz, p.y+sz);
g.setColor(0,0,0);
g.drawString(wp.name, p.x, p.y);
print(wp.name);
})
}
// Draw the marker for where we are
function drawMarker() {
if (!fix.fix) return;

View File

@ -2,7 +2,7 @@
"id": "openstmap",
"name": "OpenStreetMap",
"shortName": "OpenStMap",
"version": "0.15",
"version": "0.16",
"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",
"icon": "app.png",