Skip to content

feat(editor): imported GIS data draws under the network (p7-s2) - #489

Merged
JArmandoAnaya merged 2 commits into
mainfrom
feat/242-p7-s2-gis-editor
Jul 28, 2026
Merged

JArmandoAnaya merged 2 commits into
mainfrom
feat/242-p7-s2-gis-editor

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

Last of three PRs for #242 (p7-s2). #487 landed the decision (ADR-0010), #488 the kernel; this is the editor. Closes #242.

What lands

File ▸ Import ▸ GIS Vector… / GIS Raster… put a shapefile, GeoJSON, GeoTIFF or world-filed image under the network as authoring reference, reprojected into the world frame the scene already carries. Edit ▸ Terrain ▸ Import Elevation Raster… turns a single-band height GeoTIFF into the scene's terrain.

Three rulings worth review attention

The menu split follows what the data BECOMES, not what format it arrived in. Imagery and vectors are Layer-2 backdrop that never enters the .xodr, so they live under File ▸ Import. An elevation raster becomes real scene content through the same edit::set_terrain_field a .asc DEM uses — one undo entry, every p5-s2 invariant inherited — so it sits under Edit ▸ Terrain beside it. A raster imported as a backdrop that turns out to be elevation is refused and told where to go, rather than drawn as a grey height map over the ground while the user wonders why it affects nothing.

A reference layer is RE-DERIVED where the workspace box is DISCARDED. Both store the CRS they were framed in and the two rules look alike, but they are opposite for a reason: a reference layer has a source file, so a changed georeference re-places it in the new frame and says so. The workspace box has no source to re-derive from, which is why p7-s5 drops it. Two tests pin the distinction so a later tidy-up cannot collapse them into one rule.

Adding a layer is not undoable, and does not dirty the document. Dirtiness here is !undo_stack_.isClean(), and Layer 2 is framing, never content (ADR-0008) — the same ruling fit_workspace_to_selection already carried. A missing source file comes back listed but unloaded rather than dropped: silently forgetting a reference the user added because a drive was not mounted is worse than showing it unavailable.

No new Renderer virtual

An underlay is a textured unlit quad and a vector layer is a Lines mesh — both already expressible with upload(TextureData), Material{base_color, unlit} and PrimitiveKind::Lines. The two mesh builders are free functions in scene_builder, so they are pure and headless-testable; the viewport only owns the uploads.

Underlays draw first, just above the procedural ground and below the network, stepping 1 mm per layer so a stack is ordered rather than z-fighting. They are unlit because an orthophoto already contains its own lighting — shading it again makes the imagery disagree with itself. Textures use ClampToEdge, or the image's own edge wraps back over itself across the quad.

Persistence

Paths are stored relative to the scene with / separators — the contract every external reference in this repository keeps, so a project survives being copied or committed. The sidecar's reference_layers block parses per-entry rather than all-or-nothing, unlike view and workspace: those are each one indivisible thing, while this is a list, and dropping five good layers because a sixth is malformed helps nobody. The forward-compat raw merge still carries unknown keys through, now tested alongside a second array-valued block.

GW-2

Gains steps 28–33 and four pass criteria — including that a resample must be reported (a reprojected orthophoto quietly passing for the source file is the kind of thing you notice much later) and that a refusal must name the coordinate system ("unsupported" alone is a regression: the point of computing a bounded family is being able to say precisely what fell outside it).

Verification

ctest --preset ci-macos 2583/2583 · clang-format --dry-run --Werror clean over the whole tree.

Six sabotages, each caught by its own gate. The first one FAILED TO BUILD on the first attempt and would have reported a false "caught" off a stale binary — it was redone as a runtime change, and every result below is from a run whose build exit code was checked first: refit discards instead of re-deriving; absolute paths persisted; underlay v flipped (mirrored orthophoto); rings always re-closed; sidecar made all-or-nothing; a missing source silently dropped.

Closes #242

The editor half of #242. File ▸ Import ▸ GIS Vector…/GIS Raster… put a
shapefile, GeoJSON, GeoTIFF or world-filed image under the network as authoring
reference, reprojected into the world frame the scene already carries. Edit ▸
Terrain ▸ Import Elevation Raster… turns a single-band height GeoTIFF into the
scene's terrain.

★ THE MENU SPLIT FOLLOWS WHAT THE DATA BECOMES, not what format it arrived in.
Imagery and vectors are Layer-2 backdrop that never enters the .xodr, so they
live under File ▸ Import. An elevation raster becomes real scene content
through the same edit::set_terrain_field a .asc DEM uses — one undo entry,
every p5-s2 invariant inherited — so it lives under Edit ▸ Terrain beside it. A
raster imported as a backdrop that turns out to be elevation is refused and
told where to go, rather than drawn as a grey height map over the ground while
the user wonders why it affects nothing.

★ A REFERENCE LAYER IS RE-DERIVED WHERE THE WORKSPACE BOX IS DISCARDED. Both
store the CRS they were framed in, and the two rules look alike, but they are
opposite for a reason: a reference layer has a SOURCE FILE, so a changed
georeference re-places it in the new frame and says so. The workspace box has
no source to re-derive from, which is why p7-s5 drops it instead. Two tests pin
the distinction so a later tidy-up cannot collapse them into one rule.

Adding a layer is deliberately NOT undoable, and deliberately does not dirty
the document: dirtiness here is !undo_stack_.isClean(), and Layer 2 is framing,
never content (ADR-0008) — the same ruling fit_workspace_to_selection already
carried. A missing source file comes back listed-but-unloaded rather than
dropped, because silently forgetting a reference the user added because a drive
was not mounted is worse than showing it unavailable.

NO NEW Renderer VIRTUAL. An underlay is a textured unlit quad and a vector
layer is a Lines mesh — both already expressible with upload(TextureData),
Material{base_color, unlit} and PrimitiveKind::Lines. The two mesh builders are
free functions in scene_builder, so they are pure and headless-testable; the
viewport only owns the uploads. Underlays draw first, just above the procedural
ground and below the network, stepping 1 mm per layer so a stack is ordered
rather than z-fighting. They are unlit because an orthophoto already contains
its own lighting and shading it again makes the imagery disagree with itself.

Paths persist RELATIVE to the scene with '/' separators — the contract every
external reference in this repo keeps, so a project survives being copied or
committed. The sidecar's reference_layers block parses per-entry rather than
all-or-nothing, unlike view and workspace: dropping five good layers because a
sixth is malformed helps nobody.

GW-2 gains steps 28–33 and four pass criteria, including that a resample must
be REPORTED and that a refusal must NAME the coordinate system.

ctest 2583/2583 · clang-format clean.

Closes #242
Linux-only build break. `QWidget` has a `data` member, and GCC's
-Werror=shadow rejects a local of that name inside a QWidget subclass while
clang does not — so it built clean on macOS and failed the mandatory Linux
gate. The same trap p4-s4 and p4-s8 hit.

Renamed to `lines`, with a comment at the site so the next person does not
re-introduce it. The identically-named locals in scene_builder.cpp are fine:
that file holds free functions and inherits no Qt members.

Refs #242
@JArmandoAnaya JArmandoAnaya mentioned this pull request Jul 28, 2026
6 of 18 tasks
@JArmandoAnaya
JArmandoAnaya merged commit 791cde5 into main Jul 28, 2026
15 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the feat/242-p7-s2-gis-editor branch July 28, 2026 20:02
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.

p7-s2: GIS vector/raster import (GDAL/PROJ)

1 participant