"Overwrites" followups#108
Conversation
(PR a-b-street#103) Keep SetTags(WayID, Vec<String>, Vec<(String, String)>) with explicit fields. Add doc comment and inline comments (remove_keys, add_tags) so the two vecs are clearly defined.
(PR a-b-street#103) - Add SEVERANCE_HIGHWAY_TYPES in lib.rs as single source of truth for motorway through tertiary_link (no service). - Add is_severance_highway(tags) and is_road_without_sidewalks_implicit(tags); the latter is severance types OR highway=service for RoadWithoutSidewalksImplicit. - Way::is_severance() now uses is_severance_highway(); classify uses is_road_without_sidewalks_implicit() so service stays explicit and the rest reuse the same definition.
- Store "overrides" with keyPath "id"; single record id "default" (no region). - DB version 2; create store when oldVersion < 2 so existing v1 DBs don’t break (no data migration). - Remove legacy migration and deleteOverrides(); simplify file comment.
- Add mapillaryLayers.ts with stable layer IDs; use them in Mapillary.svelte and OverwritesMode. - Skip setting pointA/pointB when the click hits a Mapillary pin. - Only query layers that exist in the current style so it works when Mapillary is off.
- Apply overwrites immediately after import: when importing a file, segments in the current boundary are applied right away (no need to switch modes). - Store snapped geometry: new crossings use snapCrossingSegment() before apply; start/end are saved as snapped coords so re-apply and import snap correctly. - Backend: add snap_crossing_segment() and snapCrossingSegment WASM; reuse same RTree/snap logic as AddCrossingSegment, return snapped WGS84 coords. - Surface backend snap/apply errors in the UI via applyError state and a dismissible danger alert (e.g. "Couldn't find a line to snap to"). - Normalize imported segments (ids, valid start/end) and fix appliedCount when applying only newly imported segments. - Remove unused LineString/WayProps imports in OverwritesMode.
- Replace three crossing buttons with one radio group (major / minor / all) - Persist choice in crossingScopeBulk (LocalStorageWrapper on card header) - Option C labels: Major only, Major+minor excl. service/track, All roads - Single 'Generate missing crossings' button; 'all' uses only_major_roads=false
Use marker, add bbox guard, add buttons
dabreegster
left a comment
There was a problem hiding this comment.
Quick skim LGTM! Some optional stuff for later. Thanks for this PR, merging
| #[derive(Clone, Serialize)] | ||
| pub enum UserCmd { | ||
| SetTags(WayID, Vec<String>, Vec<(String, String)>), | ||
| /// Set tags on a way. First: tag keys to remove. Second: key-value pairs to add or set (applied after removals). |
There was a problem hiding this comment.
Thanks for fixing this. FYI for the future, https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html#listing-6-2 is an example of the struct-style for an enum case. Then the docs are unnecessary, the field names are clear
| } | ||
| } | ||
|
|
||
| /** Backend may return a plain object or a Map (from WASM/serde). Normalize to { start: { lng, lat }, end: { lng, lat } }. */ |
There was a problem hiding this comment.
This feels messy -- why are there two formats in the first place? Could clean up later, not worried about it now
There was a problem hiding this comment.
100%. The backend provides one data structure and the import (json) a different one. We also don't have something like Zod in the dependencies yet which means quite verbose validation code is needed.
Note to self: Look into Zod Mini and use one structure for both "input" sources.
| ) -> Result<(Point, Point)> { | ||
| let start_pt = model.mercator.to_mercator(&start_wgs84); | ||
| let end_pt = model.mercator.to_mercator(&end_wgs84); | ||
| let closest_line = RTree::bulk_load( |
There was a problem hiding this comment.
I bet this is the thing slowing down undo in the override mode. We could get more clever about caching this or only calculating once + updating if we're doing multiple undos. Just an idea for later, not important now
This is a mixed bag again; a follow up to #103
Same discosures apply.
I adressed the review comments from UI Update; Editing mode Update; Bulk-Update-Page; Manual-Update-Page #103 (comment)
The "Generate crossings" section is now a radio button group with better labels and stored in localstorage
The Overwrites Page now has a button to set and delete the draft crossing.
The undo code is a bit more performant ("Remove" button next to manual crossings).
The manual crossing backend now looks at more way types; uses a shared helper to keep the different code parts in sync.
We restore the manual crossings now after loading them from file and store them a bit differently so they load more like we had them before.
The manual override marker are now dragable; and dont interfere with the Mapillary Pins (when Mapillary is active)