From e79c95022abfe0a6fc7f0daad221b5f5ac1d3774 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Thu, 2 Mar 2023 00:26:50 +0100 Subject: [PATCH 1/3] openstmap: display waypoints If waypoints module is available, display the waypoints on the map. Also update the documentation and fix some english in the documentation. --- apps/openstmap/README.md | 12 ++++++------ apps/openstmap/app.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/apps/openstmap/README.md b/apps/openstmap/README.md index f19b13bd1..bf247c7b7 100644 --- a/apps/openstmap/README.md +++ b/apps/openstmap/README.md @@ -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 diff --git a/apps/openstmap/app.js b/apps/openstmap/app.js index 89e2d2ddb..e7629f2e1 100644 --- a/apps/openstmap/app.js +++ b/apps/openstmap/app.js @@ -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,23 @@ function redraw() { g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1); } +// Draw the POIs +function drawPOI() { + var waypoints = require("waypoints").load(); + if (!waypoints) + 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; From c18d1d4a42f5eb8882e12b0797c5c5605b1989f1 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 3 Mar 2023 17:50:48 +0100 Subject: [PATCH 2/3] openstmap: fix operation without waypoints, increase version --- apps/openstmap/ChangeLog | 1 + apps/openstmap/app.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openstmap/ChangeLog b/apps/openstmap/ChangeLog index 7f788c139..a256b459c 100644 --- a/apps/openstmap/ChangeLog +++ b/apps/openstmap/ChangeLog @@ -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. diff --git a/apps/openstmap/app.js b/apps/openstmap/app.js index e7629f2e1..a5130d23e 100644 --- a/apps/openstmap/app.js +++ b/apps/openstmap/app.js @@ -28,9 +28,12 @@ function redraw() { // Draw the POIs function drawPOI() { - var waypoints = require("waypoints").load(); - if (!waypoints) + 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); From 2f53b732bc8384beb6c8f2787d514891f71c21e0 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 3 Mar 2023 17:54:53 +0100 Subject: [PATCH 3/3] openstmap: We updated changelog, so increase version. --- apps/openstmap/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openstmap/metadata.json b/apps/openstmap/metadata.json index 819dc4122..4419cd411 100644 --- a/apps/openstmap/metadata.json +++ b/apps/openstmap/metadata.json @@ -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",