Skip to content

Add "Dashed line" track appearance option#25243

Open
rustyqt wants to merge 1 commit into
osmandapp:masterfrom
rustyqt:feature/dashed-line-track
Open

Add "Dashed line" track appearance option#25243
rustyqt wants to merge 1 commit into
osmandapp:masterfrom
rustyqt:feature/dashed-line-track

Conversation

@rustyqt

@rustyqt rustyqt commented Jun 9, 2026

Copy link
Copy Markdown

What

Adds a per-track Dashed line option to the track Appearance editor. When enabled, the track is rendered as a dashed line instead of solid.

Why

A simple, frequently-wished way to visually distinguish tracks (e.g. planned vs. recorded, variants) without changing colour or width.

How

Mirrors the existing SHOW_ARROWS appearance option end-to-end:

  • New LINE_DASHED GpxParameter (boolean):
    • persisted in the gpx database — DB_VERSION 36 → 37; the generic onUpgrade column-add migrates both the gpx and gpx-dir tables,
    • written to / read from the GPX file <extensions> as line_dashed (GpxFile.isLineDashed()/setLineDashed()).
  • DashedLineCard (BaseSwitchCard) added to TrackAppearanceFragment, next to "Direction arrows". Persisted on save for saved tracks and for the current recording track (CURRENT_TRACK_LINE_DASHED).
  • TrackDrawInfo carries the flag; GpxAppearanceHelper.isLineDashedForTrack(...) resolves it (editor → current track → DB → GPX file).
  • Rendering reuses the existing dash pipeline: GPXLayer supplies a width-proportional dash pattern to RenderableSegment.drawGeometry(...), which already feeds VectorLineBuilder.setLineDash(...) for the OpenGL core. A small Renderable.setDashed() change-detector (mirroring setDrawArrows) makes a toggle rebuild the geometry.

Notes

  • Single colour for now (an alternating second dash colour is a natural follow-up).
  • Only the English string is added; translations go through Weblate.
  • Built and verified on-device (androidFull / opengl / arm64).
  • Provided under the project's licence (MIT, per PULL_REQUEST.MIT.LICENSE).

🤖 Generated with Claude Code

Adds a per-track "Dashed line" switch to the track Appearance editor.
When enabled, the track is drawn as a dashed line.

- New LINE_DASHED GpxParameter (boolean), persisted in the gpx database
  (DB version 36 -> 37 migration adds the column) and in the GPX file
  <extensions> as "line_dashed".
- DashedLineCard in the appearance editor; persisted per saved track and
  for the current recording track (CURRENT_TRACK_LINE_DASHED).
- Rendering reuses the existing VectorLine setLineDash pipeline; a
  Renderable.setDashed() change-detector rebuilds the geometry on toggle.
  Dash length is proportional to the line width.
@rustyqt

rustyqt commented Jun 9, 2026

Copy link
Copy Markdown
Author
feature-dashed-line-track-2 feature-dashed-line-track-1

@vshcherb

Copy link
Copy Markdown
Member

We will need to review UI cause some options won't be possible or desirable like dash + gradient

@vshcherb

Copy link
Copy Markdown
Member

Nice addition for solid color

@sonora

sonora commented Jun 11, 2026

Copy link
Copy Markdown
Member

Nice addition for solid color

#9953

@Chumva Chumva linked an issue Jun 17, 2026 that may be closed by this pull request
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.

Feature request dashed line for tracks

3 participants