Repository navigation
feat(editor): imported GIS data draws under the network (p7-s2) - #489
Merged
Merged
Conversation
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
6 of 18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 sameedit::set_terrain_fielda.ascDEM 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 rulingfit_workspace_to_selectionalready 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
RenderervirtualAn underlay is a textured unlit quad and a vector layer is a Lines mesh — both already expressible with
upload(TextureData),Material{base_color, unlit}andPrimitiveKind::Lines. The two mesh builders are free functions inscene_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'sreference_layersblock parses per-entry rather than all-or-nothing, unlikeviewandworkspace: 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-compatrawmerge 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-macos2583/2583 ·clang-format --dry-run --Werrorclean 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
vflipped (mirrored orthophoto); rings always re-closed; sidecar made all-or-nothing; a missing source silently dropped.Closes #242