Skip to content

Improve positioning controls and add position indicator to map#8

Open
dodoradio wants to merge 4 commits into
AsteroidOS:masterfrom
dodoradio:mapcontrols
Open

Improve positioning controls and add position indicator to map#8
dodoradio wants to merge 4 commits into
AsteroidOS:masterfrom
dodoradio:mapcontrols

Conversation

@dodoradio

@dodoradio dodoradio commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

1: improves positioning control

This reworks the recenter button to turn on the position source instead of requesting oneshot updates. Oneshot position updates don't work the same for all position sources: for example, some GPS modules shut down after a oneshot update, and so every click of the 'recenter' button currently may take many minutes to respond, while providing no feedback.

This also introduces some new behaviours and states for the recenter button.

  • if the positioning source is off, one tap turns it on

  • subsequent taps centre the map to the latest position

  • a long press turns the module off (this needs further work, I'm not
    sure this is discoverable or intuitive)

  • the button changes visually to indicate when position is off,
    acquiring or acquired or invalid

  • this also adds a 'lock' icon which can also fit inside ios-locate, intended to indicate that the view is locked to user's position. This icon isn't currently used, but I want to include it so it's there for when this feature is added.

  • due to the amount of icons added, they've been moved into a subdirectory

To enable these changes, I refactored the map controls to reduce code duplication and make bindings a bit more explicit.

2: Adds an indicator for the user's current position on the map

screenshot_
This adds a circle to the map which follows the user's current position. The size of the circle indicates the position error.
Unfortunately, MapCircle has really obvious aliasing, but this is the way it's shown on the Qt website, so I don't think there's a clear fix. If this is too ugly, we can eventually replace it with a scaled MapQuickItem.
To enable this change, I had to fix up the code that refreshes waypoints, as it would remove all items from the map, rather than just waypoints.

- split out identical buttons
- remove z values
oneshot position updates don't work the same for all position sources.
For example, some GPS modules shut down after a oneshot update, and so
every click of the 'recenter' button may take over a minute to respond.

This introduces some new behaviours and states for the recenter button.
- if the positioning source is off, one tap turns it on
- subsequent taps centre the map to the latest position
- a long press turns the module off (this needs further work, I'm not
  sure this is discoverable or intuitive)
- the button changes visually to indicate when position is off,
  acquiring or acquired or invalid

- this also adds a 'lock' icon, which isn't currently used
- due to the amount of icons added, they've been moved into a
  subdirectory

@moWerk moWerk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a code review, but i tested on catfish just now. complied fine and the feature is working fine.
Great work pushing this forward!

@FlorentRevest FlorentRevest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment - otherwise looks good to me

Comment thread icons/CMakeLists.txt
install(FILES ios-locate-dot-alert.svg DESTINATION /usr/share/icons/asteroid/)
install(FILES ios-locate-lock.svg DESTINATION /usr/share/icons/asteroid/)
install(FILES waypoint.svg DESTINATION /usr/share/icons/asteroid/)
install(FILES ios-topographic-outline.svg DESTINATION /usr/share/icons/asteroid/)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to, as these icons aren't really reusable. I'd prefer not to install them here, but our Icon doesn't support loading from anything but the icons directory, and I decided not to mix Icons with Images

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we already have some icons that are not reusable and that's perfectly ok.
If you really really really think they have nothing to do in there, then I'd instead suggest fixing Icon in qml-asteroid to support full paths and install those icons to a separate directory that clearly distinguishes them from our default icon set. This will avoid conflict in case someone decides to name an icon like that. And even if it's unlikely with the current names, it's still an anti-pattern we should avoid as setting bad precedent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants