Skip to content

Feature/gpx planner - #259

Closed
Gro2mi wants to merge 73 commits into
AlpineMapsOrg:mainfrom
Gro2mi:feature/gpx-planner
Closed

Gro2mi wants to merge 73 commits into
AlpineMapsOrg:mainfrom
Gro2mi:feature/gpx-planner

Conversation

@Gro2mi

@Gro2mi Gro2mi commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

wasm fixes

Markus Rampp added 30 commits November 3, 2026 18:39
icons/material/steepness.png and icons/steepness_legend.png were
referenced in QML but not embedded in the resource system. Native
builds load QML from the source directory (file: URL), so they
displayed anyway; the WebAssembly build loads from qrc:///, where
the images were missing.
Plan routes by clicking on the displayed dem: clicks are detected without
hindering camera navigation (press/release within 30px), resolved into geo
coordinates via the camera depth readback, and added to an editable plan.

- nucleus/planner/PlannerManager: click vs drag detection (mouse + touch)
- nucleus/track/GPX: plan operations (delete/insert/move/reverse), haversine
  stats, gpx 1.1 writer, rte parsing, name/desc round-trip
- app/PlannerModel: dem-interpolated line (20m samples, matches dem
  resolution, capped per segment), flat point markers, average/max
  steepness, import/export with camera fly-to
- gl_engine/TrackManager: renders the planned route thinner in cyan,
  per-polyline end_index fix (last segment of every polyline was discarded)
- app/GpxEditor.qml: sidebar with point list (delete/reorder), close button,
  stats, qml file dialogs for import/export (suggests NAME.gpx / route.gpx)
- main.cpp: QApplication whenever widgets are linked, so widget-based file
  dialogs cannot crash the app (QGuiApplication build crashed on import)
- also switches the geometry tile service to at_dtm_alpinemaps, the old
  alpine_png dataset no longer exists on the server
…eepness colouring

- the planned line scales its width with the camera distance, so it covers
  a roughly constant ~5px on screen (clamped to 2-150m world width)
- route points render as round dots instead of flat bars: the capsule
  shader's cap spheres dominate a ~1m marker segment (horizontal, so the
  ribbon quad stays valid in top-down views), slightly larger than the
  line, in a distinct darker blue, with a small polygon offset so the line
  does not swallow them
- while the steepness terrain overlay is off, the line is coloured per
  segment by its steepness, using the steepness overlay colour map
  (flat cyan while the overlay is on, markers keep their colour). slope
  measured from the horizontal plane (asin of the vertical direction
  component)
Keys pressed before the window loses focus never see their release event
(e.g. alt+tab while dragging): the interaction styles kept a stuck alt
modifier, so left-button drags zoomed instead of panning until the user
pressed and released alt again.

InteractionStyle gains clear_keyboard_state(), implemented by Orbit
(ctrl/alt/shift), Cad (ctrl/alt) and FirstPerson (shift, wasd/e/q and the
pressed-key counter). TerrainRendererItem calls it via
Controller::clear_keyboard_state() from focusOutEvent.
- sample the route line every 5m instead of 20m and apply a moving average
  over the sampled elevations, so the dem cell staircase does not produce
  slope spikes (route points keep their exact clicked elevation)
- blend the steepness colours piecewise-linearly between the legend bin
  colours instead of jumping between the discrete bins
- average the slope over a segment and its two neighbours in the track
  shader, guarding the out-of-range neighbour fetches at the line ends
- also fixes a shader compile error from the previous attempt: glsl const
  locals require constant initializers
TileGeometry, TextureLayer and SSAO hold QOpenGLBuffer/QOpenGLTexture/
QOpenGLVertexArrayObject/gl_engine::Texture in unique_ptr members while only
forward declaring them. msvc accepts the implicitly instantiated destructors,
clang (android ndk) does not.
The smooth gradient indexed the const colour array with loop variables,
which gles 3.0 compilers (mali) reject. replace the loop with a progressive
mix chain using constant indices - the piecewise-linear blend between the
legend bins is unchanged.
- collapse the editor to a compact status bar (points, distance, expand and
  close buttons), so the map stays visible and clickable on phone portrait
  screens where the expanded panel covers everything. starts minimized on
  narrow screens, edit mode stays active while minimized
- replace the U+2715 multiplication x with U+00D7: the embedded Roboto font
  has no U+2715 glyph, so the close buttons rendered blank
Android file dialogs return content:// uris which have no local file path -
toLocalFile() returned an empty string, so nothing was written and the file
picker left a 0 byte placeholder (reported as damaged by outdooractive).
open the returned uri directly with QFile. also write the metadata time as
utc xsd:dateTime (with timezone), which strict gpx parsers expect.
gnss updates (location fab) render a magenta dot at the user position: a
single marker segment rendered as a sphere by the capsule pipeline, with its
own colour, distance-based size and a polygon offset like the route dots.
the dot floats 3m above the dem so it is not swallowed by the terrain; the
dem altitude is preferred over the gnss altitude. toggling the location fab
off removes the dot. PlannerModel also gained the content:// uri handling
for gpx export/import.
The generated mix chain now samples the steepness legend palette at 200
stops (0.325 degrees per bin) instead of 20, held at constant indices to
stay gles-compatible. Generated by script; do not hand-edit.
RouteOptimizer fetches dem tiles for the planning area on demand (deepest
zoom whose tile count fits 256, capped at z18 like the renderer), decodes
them once into a local metric raster, and runs an a* per consecutive
waypoint pair. cost model for steep ski descents:
- terrain gradient per cell (central differences), not the slope along
  the travelled edge: crossing steep ground sideways is penalised like
  descending it. 30-45 degrees ideal, up to 60 fine, above heavily
  penalised (rappel), below 20 avoided
- across-travel-direction slope (side-tilt) penalty, scaled by a weight:
  contouring a steep gulley sidewall must cost extra even in the ideal
  gradient band
- per-vertical-metre surcharge for climbing; small distance floor so
  pure-steepness weighting does not drift along zero-cost plateaus
- bbox padding (search radius) is a parameter
altitudes are emitted in true metres, never routed through the
mercator-stretched world z (metres/cos(lat)) - that bug sank the route
32% below the terrain at alpine latitudes. unit tests cover the penalty
curves, raster sampling, descent monotonicity, cliff avoidance and the
cross-slope behaviour; plus a hidden network repro test against real
tiles.
An optimise_route() entry runs a RouteOptimisationSession (tile fetch on
the gui thread, a* on a thread pool via QtConcurrent) and replaces the
straight-line interpolation between waypoints with the optimised descent
path for rendering and export; editing waypoints invalidates it and
falls back to the approximate route. new tuneables exposed to qml:
steepness/distance/cross-slope weights and the search radius (percent of
route extent). export writes the dense optimised line when present.
- Optimize Route button with a chevron that expands the four weight
  sliders (slope, distance, cross slope, search radius), collapsed by
  default
- name and description fields move right above the import/reset/export
  row; the 'steep ski route' section label is gone
- the panel body becomes a flickable with a scrollbar, so the buttons at
  the bottom stay reachable on small screens
- the 'click on the map' hint hides behind a ? toggle next to the heading
- ignore the local build-android directory
Adding a point keeps the optimised paths of all existing waypoint pairs
rendering; only the new pair falls back to the approximate straight line
until the next optimise. deleting a point merges its two adjacent pairs
(index shift handled), moving a point invalidates only its adjacent
pairs. reset/import still clear everything, in-flight results are
generation-guarded on every edit, and the status clears so a partially
optimised route is not reported as optimised. adds undo_last_point(),
which removes the last waypoint across segment boundaries.
The compact bar gains an undo button (deletes the last route point) and
an optimize button, so common actions work without expanding the panel.
the stats text shows the distance in 0.1 km and the larger of vertical
gain/loss, keeping the bar narrow.
RoutePreviewAnimation descends along a world-space polyline slightly
above the terrain (arclength parameterised, speed adjustable, seekable).
The controller owns it as dedicated preview state: drags rotate around
the current position, the wheel changes the height, mouse release ends
the drag (new slot - without it desktop drags stuck and killed the
flight), arrow keys seek/speed, escape stops. the camera definition is
saved on start and restored on stop, and the preview is never cancelled
by ordinary navigation. reaching the end auto-pauses (reported as
paused, so the ui offers play, which restarts from the top). default
speed 24 m/s ("normal"); the throttled state signal reports the actual
speed so the ui cannot desync. unit tests cover progress, pause/drag,
seek, rotation, end-of-route and the speed plumbing.
The line z now comes from the surface the gpu actually draws: dem tiles
are a triangle strip over the texel grid (south-west/north-east
diagonal), so DemTile::mesh_sample and the new query_mesh_altitude
evaluate the exact triangle plane instead of a bilinear patch - the two
differ most when travelling diagonal to the grid, which was the
remaining wiggle. the track shader additionally gets a terrain_tolerance
opacity band: the capsule-vs-terrain distance test flipped between
opaque and half-transparent on sub-metre noise and lod swaps; within the
band the planned line stays opaque while real occlusion still fades.
A 3d capsule line always floats above the surface and slides sideways
against it with parallax while the camera moves - no z-sampling can fix
horizontal drift. RouteOverlay instead rasterises the planned route
(steepness coloured) into a world-space texture, and the terrain shader
blends it into the albedo: as part of the drawn surface it has no
parallax at all. the origin uniform is computed camera-relative in
double precision on the cpu (absolute web-mercator metres do not fit
fp32). while the overlay is active the 3d capsules are suppressed; the
planned line is also lifted 2m for its 3d rendering (render-only, the
exported gpx keeps exact altitudes) and the planned-line-visibility slot
rounds out the track manager additions.
PlannerModel::fill_preview_route converts the rendered route line into
world coordinates and stores it in a RenderingContext buffer (mutex
guarded, gui -> render thread handoff). TerrainRendererItem starts and
stops the preview (enabling continuous updates for the frame loop),
exposes active/paused/progress/speed properties fed by the throttled
controller signal, and forwards pause/seek/speed calls. the approximate
line samples its z from the exact rendered surface (query_mesh_altitude)
so the unoptimised line benefits from the same anti-wiggle treatment.
A Fly Route button next to Optimize Route. while flying, the planner
window is hidden entirely (restored afterwards, point picking disabled
meanwhile), and a bottom control strip shows play/pause, a draggable
progress slider, a speed combo box (labels only, default normal,
imperatively synced to the actual speed so dropdown picks and arrow keys
always display correctly, sized to fit inside the bar) and a close
button; the map takes keyboard focus on preview start. editing
waypoints stops the preview.
ElevationProfile is a small QQuickPaintedItem chart (no QtCharts
dependency): the profile line is coloured per segment with the steepness
legend colours used on the map, the area below is filled with the same
colour at low opacity, axes show elevation and total distance. the data
comes from the dense interpolated route line (PlannerModel::
elevation_profile). a white marker follows the camera during the
fly-through. hovering/tapping shows a readout with distance, steepness
and vertical from the start. the widget also gains a slope angle overlay
switch driving the steepness terrain overlay (mode 101), so the map and
the chart can be compared directly. GpxEditor.qml imports the app module
for the new type.
…flight

The RouteOverlay decal (route rasterised into a world-space texture,
blended into the terrain albedo to avoid parallax) broke the tile pass on
webassembly: webgl drops an instanced draw when a sampler unit's texture
type mismatches the shader, and firefox reported exactly that for the
route sampler unit - the whole terrain vanished as soon as a second
route point existed. remoting the leftover texture bindings did not fix
it reliably.

No route visualisation is wanted during the fly-through anyway, so the
overlay is removed entirely (shader uniforms, decal sampler, layer
plumbing) and TrackManager instead gains set_flight_mode: while the
preview flies, the planned 3d line and markers are skipped in draw().
the camera restore on exit makes the route reappear in its old place.
Editing a waypoint while an optimisation was running bumped the
generation, so the finished lambda returned before optimisation_finished()
could reset m_optimisation_running. the ui then stayed stuck at
"Optimizing..." with every optimise button disabled until restart.
clear the flag and the stale status in the discard path: exactly one
optimisation can be in flight (optimise_route guards on the flag), so a
finished session always means not running anymore, even when its result
is thrown away.
moving a point erased the two entries around it from
m_optimised_segments, but a move does not change the pair count: every
cached path after the moved point shifted onto the wrong pair and the
last two pairs lost their entries (a-b-c-d-e, move c up: pair a-c
rendered the old a-b path, pair c-b the old d-e path). deleting an
interior waypoint merged its two adjacent pairs into one, but erasing
both entries left the vector one element short for the new pair count,
shifting all later paths one pair to the left - the exported gpx of the
rendered line inherited the mixup.

a move now clears exactly the three pair slots whose geometry changed or
reversed direction (the moved point and its swapped neighbour both
change partners, and move_point's return value detects the boundary
no-op), and deleting a waypoint erases its two dead neighbour pairs and
re-inserts an empty placeholder for the merged pair, so the vector stays
aligned with the pair numbering of update_render_data. deleting an
out-of-range index no longer touches the cache at all.
the gpx editor lists the points of all segments flat and passes those
indices back to delete/move, but Gpx::delete_point and move_point
interpreted them as positions inside the last segment: deleting or
reordering a point of an imported multi-trkseg/rte track silently
no-op'ed (flat index beyond the last segment) or hit the wrong point.
the optimised-pair bookkeeping had the same blind spot, and the
optimiser's flat pair numbering disagreed with the per-segment pair
numbering of update_render_data for multi-segment plans.

the editing helpers now resolve flattened indices across all segments
(locate_point) and cross segment boundaries when moving, dropping
segments that empty out; delete_last_point skips empty trailing
segments (an empty <trkseg/> from the parser would no-op the undo
button), insert_point inserts at a flat index, and the unused
Gpx::reverse is gone. imports into the planner flatten the track into
one continuous leg: the planner edits and lists a single sequence, and
with a single-segment plan the ui indices, the optimiser's pair
numbering and the rendered line agree by construction. unit tests cover
delete/move/insert across boundaries, segment purging, undo across
trailing empty segments and flattening.
change_user_position added the marker with planned=true, which pushes
into m_planned_tracks: the dedicated m_user_position list never
received anything, so the pink user position colour (keyed on the
user_position flag, set in a loop over the always-empty list) never
applied and the dot rendered blue. it was also wiped by every
change_planned_track, i.e. on every route edit, until the next gnss
update recreated it.

add_track now takes a TrackList destination (recorded / planned /
user position) that decides both the list and the rendering behaviour,
the user_position flag is set on insertion, and the write-only
PolyLine::planned member is gone - planned-ness is derived from the
list in draw(). the dot keeps its colour across route edits and is
pink now.
update_render_data ran on the gui thread on every plan edit and decoded
the tile png for every single sample (query_mesh_altitude has no decode
cache): a click re-decoded the same tiles hundreds of times and
importing a longer track stalled the ui for seconds.

the line construction moves into compute_render_data, which runs on a
thread pool via QtConcurrent and touches only snapshots of the plan and
the optimised segments plus the tile cache (internally synchronised,
app-lifetime); a generation counter discards results of superseded
snapshots, an empty plan is still handled synchronously. the new
DemMeshSampler in cache_queries decodes each touched tile once, keeps a
last-tile shortcut for the spatially coherent route samples and a decode
map for queries alternating across a tile boundary; query_mesh_altitude
shares the extracted sample_tile_mesh now.

interpolation steps are spaced at one dem cell of the tile the renderer
displays at the segment midpoint (dem resolution instead of the previous
fixed 5 m oversampling; 20 m fallback when no tile is cached), so the
rendered line matches the drawn terrain resolution and the steepness
colouring steps at dem granularity. the dem-derived steepness and
elevation profile properties are notified via a separate
render_data_changed signal, emitted when an async computation lands -
points_changed keeps meaning "the editable plan changed".

unit test: the sampler matches query_mesh_altitude on a synthetic cache
chain, reports the tile cell size and handles an empty cache.
set_name and set_description emitted points_changed, so every keystroke
in the name or description field rebuilt the whole points QVariantList:
the point ListView re-created all its delegates and lost its scroll
position, and the elevation profile list was rebuilt for nothing. the
two properties now notify name_changed/description_changed (with a
no-op guard), and import and reset emit them alongside points_changed
so the editable fields still sync when the imported/replaced metadata
differs. the gpx editor's field sync moved to the new signal handlers,
which also stops re-syncing the fields on every route edit, and fixes
the mangled indentation of the planner Connections block.
Markus Rampp added 29 commits November 15, 2026 11:16
imported tracks keep the elevations stored in the file, which come from
a different height model: the rendered line floated above or sank into
the displayed terrain. compute_render_data now re-samples every line
point - waypoints included - from the dem after interpolation, so
imported routes read exactly like planned ones (the interior points
were dem-sampled before; re-sampling them is idempotent).
with round caps the per-segment strokes drew protruding dots at every
vertex; on crowded profiles (imported tracks land sub-pixel per
segment) the dots overlapped and the skipped sub-pixel segments made
the fill gappy, so the line looked shifted against the fill. the
stroke now uses a flat cap and every segment is drawn: line and fill
cover exactly the same span.
the gpx editor opens on a saved-routes overview instead of the planner:
the list shows the routes saved in the app data directory (name, point
count, distance) with load and delete, plus buttons to create a new
route or import a gpx file. the planner panel gains a back button to
the overview and a save button that writes the current plan under its
name into <app data>/routes/<name>.gpx, replacing an existing route of
the same name. loading, importing and creating all open the planner;
the routes view disables the map click-to-plan mode. import and load
share the gpx file adoption path now.
the save button moves from the header to the bottom button row (import
gpx leaves the planner - it lives in the routes overview) and is
disabled until the plan actually changed since the last save
(route_dirty, set by every plan mutator, cleared by save and load).
the "Route saved" status disappears on its own after 3 seconds. saving
never overwrites another route: when <name>.gpx already exists the name
is extended with a counter ("Haidenspitze 2", ...) and the stored route
carries that name. the saved-routes list scrolls and shows a scrollbar
when it overflows the panel.
the expiry interval constant was declared but never passed to the
timer (the desktop gcc build does not warn about it, the android clang
build does): the single-shot timer would have fired immediately and
cleared the 'Route saved' status at once instead of after 3 seconds.
the uphill surcharge goes from 1.5 to 5 penalty metres per vertical
metre: at the default weights crossing a 100 m hill now costs about as
much as walking half a kilometre of ideal-slope terrain, so the
optimiser detours around hills instead of crossing them.
gdal/skitourenguru exports lead with <wpt> landmarks, and the parser
aborted on them ('wpt' NOT IMPLEMENTED) - routes like
Alps_ID001512.gpx could not be imported at all. the wpt subtree is
skipped now (its <ele> would otherwise leak into the track points),
with a regression test on an inline export.
import_gpx reports success and the editor only switches to the route
planner when the file actually parsed - a failed import left the user
in an empty planner with no way back except the back button.
the a* priced the terrain steepness of the cells regardless of travel
direction with the single descent curve (ideal 30-45 degrees). now the
steepness of the travelled edge itself is priced, with the direction
deciding the curve: descending edges keep the descent curve (ideal
30-45), climbing edges use a new skin-friendly curve - optimum 20-25
degrees, 15-20 ok, flatter suboptimal, above 30 degrees the skins come
off and the cost rises steeply (bootpack). the side-tilt penalty and
the per-vertical-metre climb surcharge stay, and the distance weight is
shared by both direction mixes (the a* heuristic uses the smaller
distance fraction to stay admissible).

the optimiser ui gains sliders for the uphill steepness weight (slope
up) and the climb surcharge (climb 0-10), the downhill slider is
relabeled (slope down), and the weights struct carries
uphill_steepness/uphill_penalty. the cross-slope behavioural test now
uses a ~50 degree face so the side-tilt is the only differentiator: on
the old 35 degree face the diagonal descents ride the ideal band and
the bench can no longer win under the directional model.
LabledSlider gave the value label a fixed 50px and stretched the slider
over the rest, so longer labels (slope down/up, climb) were cut off.
the label now sizes to its text (right-aligned, so the values line up
across sliders) and the slider takes the remaining width.

the gpx editor always opened on the saved-routes overview, and with a
route in progress there was no way back into the planner (create new
would have reset it). the editor now opens directly in the planner when
a plan exists - the overview stays reachable via the back button - and
only shows the overview for an empty plan.
the drawn width was clamped to a 2 m world-width minimum and scaled
with the distance to the route CENTRE, so zooming in close left a fat
ribbon (2 m of world width at a few metres viewing distance, and long
routes never got near the pixel target at all). the width now follows
the distance to the nearest of up to 512 decimated route points stored
per polyline, and the minimum world width drops to 0.25 m: the line
tracks its ~5 px screen target at every zoom level and only bottoms out
at 25 cm when practically touching it.
recorded tracks carry thousands of points and their per-point marker
dots drowned the map: markers are only built for plans up to 500 points
now.

clicking onto the planned route (within ~25 m of the line) no longer
silently appends a waypoint to the route end - a dialog asks whether a
waypoint should be created at that position, and accepting inserts it
into the route after the nearest route point (the affected optimised
pair is invalidated, the two new pairs start uncached). clicks onto an
existing point do nothing (hold to move it).

holding a press near a route point for 350 ms starts a drag: move
events re-resolve the pointer position via the depth readback and move
the point live, releasing commits it. while the drag runs the camera
controller is cut off from mouse/touch navigation events and
reconnected on release, so dragging a point does not orbit the camera.
the planner manager reports the raw press/move/release gestures for
this (move events throttled to 20 hz, each resolved through a tagged
depth-readback queue that separates clicks from drag events).
a segment's points are uploaded into a 1d texture whose width is capped
by GL_MAX_TEXTURE_SIZE (4096 on many phones), and add_track aborted the
whole track when a segment exceeded it - recorded gpx tracks with
thousands of points per segment silently failed to render. segments are
now split into texture-sized chunks that share their boundary point, so
the drawn line stays connected no matter how many points a track has.
loading a recorded gpx (thousands of points) blew the render budget
even with chunked textures and crashed shortly after showing the line.
imported routes now render as a light skeleton of at most 50 points,
evenly spaced along the route (by world-space arclength) and dem-sampled
like the planned lines; steepness stats and the elevation profile come
from the skeleton. the plan itself keeps every point, so editing,
saving and exporting stay full resolution - exports of imported routes
always write the original track, never the skeleton. the flag resets on
create-new.
imported routes render 1:1 again (the chunked textures handle the point
count) - the 50-point skeleton is gone. point markers are only built
for routes with up to 50 points.

the crash right after the route renders was not the render volume (it
survived the skeleton): every notification churned tens of thousands of
variant maps into the gui - the elevation profile property built one
map per render-line point and the point list / stats bindings rebuilt
the whole points list. the elevation profile is now resampled to at
most 300 entries while it is built, a cheap point_count property
replaces the points.length bindings, and the editor hides the
editable point list for imported routes (the model binding never
materialises the list).
two bugs from the gesture rework:

the press/move geo queries called Controller::query_world_position
directly from the gui thread - the depth readback needs the gl context,
which only exists on the render thread, and the app crashed on the
first tap in edit mode. the queries now run like the click path:
receiver-threaded onto the controller (queued to the render thread),
with the tagging queue filled on the gui thread first, so tag order
still matches query order.

withholding navigation during a point drag disconnected the
touch/move->controller signals, so the camera's gesture controller
missed gesture end events and its state stuck: later one-finger drags
were misinterpreted as two-finger gestures and zoomed instead of
panning. the connections now stay intact; the controller itself
withholds presses, moves and touch updates while the drag runs and
passes only releases through, so every started gesture also ends
cleanly.
the click handler checked the point grab radius first: a recorded track
has points every few metres, so every click near the line was also
within the grab radius of some point and silently early-returned - the
waypoint-insertion popup was unreachable for imported tracks. both the
click and the hold-arming now count as a point interaction only when
the point is strictly nearer than the route line; otherwise a click on
the line opens the popup and a hold near the line does nothing, which
also keeps add_point_at and press_at consistent with each other.
insertion after the nearest route point could land on the wrong side of
the click: clicking a piece of line whose far endpoint is the nearer
point inserted after it. nearest_route_geometry now also returns the
flat index of the closest segment's start point, and the popup inserts
after that - the new waypoint lands exactly between the two points of
the clicked piece of line.

pressing near a point and moving before the 350 ms hold fires used to
pan for a moment and then switch to dragging the point mid gesture.
movement beyond 1.5 m from the press position (haversine, so touch
jitter at typical zooms stays below it) now cancels the pending grab
and the gesture stays a camera pan.

also: the waypoint popup request and the route point drag state were
forwarded from a Connections block targeting the map, but they are
planner model signals - the block only delivers signals from its target,
so neither ever reached the ui (the popup never opened and the camera
was not suppressed during point drags). they live in a
Connections { target: _planner_model } block now. debug logging from
the gesture investigation is removed.
dragging a route point no longer waits for a 350 ms hold: pressing a
point starts the drag right away and camera navigation is suppressed
until release (panning stays available by pressing anywhere else).

the waypoint insertion popup is replaced by a small add-waypoint button
that floats right above the click position (clamped to the window,
flipped below the click near the top edge). any press outside the
button cancels the insertion without adding a point - a full-window
press catcher swallows that press so it cannot reach the map either.
the screen position rides along the geo-query queue (a parallel deque)
and through the insertion signal.

importing a gpx file now saves it as a route automatically, under its
name, without overwriting an existing route (counter extension).
a forward arrow next to the close button switches back to the planner
while a route is in progress, mirroring the planner header's back
button - back and forth between the overview and the current route
without loading a saved route or creating a new one. the arrow only
shows when a plan exists.
clicking on the displayed line of an optimised route silently appended
the waypoint at the route's end: the insert decision measured the
distance against the plan's straight chords, but the rendered line
follows the a* paths, which stray far from those chords - a click
within 25 m of the drawn line could be hundreds of metres from the
chord and fall through to the append branch, drawing a long backtrack
line across the screen. re-optimising cleaned it up, which is why it
looked like the display was broken rather than the route.

compute_render_data now records the waypoint pair each rendered point
belongs to; add_point_at measures against the rendered line and the
popup inserts into the clicked pair (the new waypoint sits on the
rendered path between the pair's waypoints, the two adjacent pairs
start uncached). also fixes iterator misuse in insert_pairs_at (an
iterator captured before an insert was reused after it, which is
invalidated by the insert).
a 14px gap put the button within reach of a fingertip on touchscreens,
covering it. the button now floats 60px above the click position
(flipped below near the top edge, as before).
insert(pos, {}) on a std::vector binds to the initializer_list overload
- inserting an EMPTY list, i.e. nothing. insert_pairs_at grew the cache
by zero: after inserting a waypoint the optimised cache had n-3 entries
for n pairs, the stale path of the erased pair rendered on the wrong
pair (criss-cross lines) until moving the new waypoint cleared the
misaligned entries. the inserts are emplace(pos) now, which constructs
one empty element, and insert_waypoint guards the invariant (cache =
waypoint count - 1, else the cache is cleared and the route falls back
to straight lines instead of rendering wrong paths).
track_imported used map.set_position, whose fixed look-at-from-the-south
pose overwrote the camera rotation and zoom on every import or saved
route load. it uses move_position now, which translates the camera so
the route start lands at the screen centre while the current
orientation and distance stay as they are.
the arrow glyphs used for minimize/move/reorder buttons and the gain and
loss markers are not in the font shipped to the webassembly build and
rendered as empty boxes there. a new DirectionButton component draws a
rotated chevron icon png instead, used by the minimize/back/continue/
weights/move buttons; the gain/loss markers in the stats texts became
plain + and - prefixes and the optimiser slider labels now say "slope
down"/"slope up".

routes are persisted on webassembly too: the routes directory lives in
the idbfs mount (IndexedDB), which qt never flushes on its own - saves
and deletions are followed by a syncfs(false), and a syncfs(true) at
startup pulls the routes of previous sessions back, refreshing the
saved-routes list when it lands. gpx import on wasm uses the same
browser-file-picker mount pattern as the track upload (the qml file
dialog cannot provide file contents there); the picker request returns
false on other platforms so the desktop keeps its native dialog.
… wasm

the chevron rotation mapping was inverted (qml rotation is clockwise: a
left chevron rotated 90 degrees points up, not down), which made the
minimize button point up instead of down, the maximize button in the
minimized bar point left instead of up, and the move/reorder and weight
toggle arrows point the wrong way. the expand button in the minimized
bar now also sits left of the close button.

routes persist on webassembly: nothing mounted an idbfs filesystem, so
qstandardpaths pointed into volatile memory and syncfs had nothing to
flush. the app now links idbfs.js, mounts idbfs at /idbfs at startup,
keeps the saved routes in /idbfs/routes and flushes to IndexedDB after
every save and deletion; a syncfs(true) at startup pulls the routes of
previous sessions back and refreshes the saved-routes list via callback.
two independent wasm problems fell out of a browser run against the
served build:

GpxEditor imported QtCore for the export dialog's default folder
(StandardPaths), but the lite wasm qt does not ship that qml module -
the whole editor component failed to instantiate and the sidebar was
gone. the import and the default folder are dropped; the export dialog
opens with its default location everywhere.

the idbfs mount threw: the mount point directory did not exist -
fs.mkdir('/idbfs') now runs before fs.mount, and the mount error
reports the errno/message instead of "[object Object]". the init also
moves from EM_JS to EM_ASM, whose body emscripten scans for js library
symbols so IDBFS from -lidbfs.js is actually resolved (an EM_JS body is
included verbatim and left the symbol undefined at runtime).

verified end to end against the served build: sidebar renders, plan +
save + page reload restores the route from IndexedDB, loading it back
opens the planner with all points and a clean dirty state.
the picker sanitizes the browser file name by replacing every character
outside [a-zA-Z0-9_()] with an underscore - including the dot of the
extension - so the mounted file had no .gpx extension and the *.gpx
listing in finish_wasm_import found nothing ('imported file did not
arrive'). the file is always mounted as /tmp/planner_import/import.gpx
now and read by that exact path; the original name is irrelevant, the
route name comes from the gpx content.
@Gro2mi Gro2mi closed this Nov 17, 2026
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.

1 participant