Repository navigation
feat(karte): Lagekarte on lagebuch-geodata packs with Hydranten and address search - #798
Conversation
Groundwork for the Lagekarte in Führung. Stammdaten gains a Karten section that lists the packs published in CodeForFire/lagebuch-regions, downloads one per Landkreis onto the device, and shows it as a map that pans by dragging and zooms by wheel, pinch or keyboard. The map code is salvaged from #164, which never reached main, and moved out of the Wasserförderung: MapCanvasControl, the MBTiles reader, the Web-Mercator math and the pack installer. The #152 review findings that apply to it are fixed: decoded tiles are cached instead of re-decoded on every frame, failures surface as German status text, and a pack can be removed while nothing holds its file open. A pack belongs to the device, not to the Stammdaten: the Stammdaten travel to every joined client, and a folder on the host means nothing on a tablet. So the section acts at once and never marks the editor dirty. Downloads cross a trust boundary and are treated that way: https only, the body is cut off at the size the catalogue declared, only region.mbtiles and region.dem are unpacked under fixed names, and a failed update leaves the older copy in place. The privacy page lists the pack download as the fifth way data leaves the device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Addresses CodeQL alerts 291-296 on #789. - WebMercator.CenterOfTiles summed tile indices as int before widening. The indices come from an MBTiles file that caps the zoom but not the columns, so a tampered pack could wrap the int and open the map on the wrong side of the world. The arithmetic now runs in double; a test replays such a range. - MapDrawing does the same multiplication in double. The viewport's zoom clamp keeps it from overflowing today, but Draw is public. - RegionPackLibrary's best-effort cleanup catches IOException and UnauthorizedAccessException only, with the reason in the block, as SessionPdfExport.DeleteQuietly does, instead of an empty catch-all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
The mutation gate failed on Domain (72.7 %), Persistence (62.1 %) and AppLogic (70.3 %). Locally it now reads 100 %, 94.7 % and 94.8 %. - Boundary tests for GeoPoint, the MBTiles zoom and tile range, and the catalogue's caps, field types and bounding box. - The off-world tile test now stores a tile at the address an unchecked lookup would read, so it fails if the guard goes. - The oversized-body test claimed "no Content-Length" but its StreamContent computed one, so the byte-counting cut-off never ran. It now sends a body of unknown length; a second test sends a lying one. - Progress, leftovers of an interrupted install, timeout, an undeletable pack, the catalogue address, and the section's selection and catalogue rows after install and remove. - RegionPackInfo.Covers had no caller; removed until address search needs it. - Equivalent mutants carry a Stryker disable with the reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Führung gains a KARTE tab beside ORGANISATION, FUNKTIONEN and KRÄFTE. The Lagebuchführer picks the Einsatzort or a unit and taps the map to place it, or places it in the middle of the map from the keyboard; a mark already on the map is dragged to move it. Picking and tapping works the same on a desk and a tablet, where drag and drop does not. Positions live in the incident, not in the Kartenpaket: Incident.Location and ForceUnit.Position, saved in four nullable REAL columns (migration V36, declared in SchemaGuard). A file that stores something other than a position there loses the mark, not the Einsatz. The ETB records the Einsatzort being set, moved and removed, with its coordinates, and a unit's first placement and removal. Moving a unit already on the map writes nothing: that is tidying the picture, and an entry per drag would bury the ones that matter. Two new commands a client may send, setIncidentLocation and placeForceUnit, so the protocol and its floor rise to 26. Coordinates cross the wire as plain numbers and are checked on arrival; a half-given or impossible pair is refused, never read as "take it off". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
…ck with it #789 dropped Covers while nothing there called it. The Lagekarte does: it shows the installed pack whose box holds the Einsatzort. Restored with a test of the box edges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
The catalogue moves to CodeForFire/lagebuch-geodata's packs.json. A pack is now checked end to end before it is installed: the zip's SHA-256 against the catalogue, its entries against the six files FORMAT.md names (anything else refuses the pack rather than being skipped), and each data file's size and SHA-256 against the pack's own pack.json. The app's record of the catalogue entry moves to installed.json, since pack.json is now the publisher's. A pack is current when its version and checksum match, and the list shows "Stand <Tag> · Version n". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
A Kartenpaket from lagebuch-geodata carries water.geojson and addresses.sqlite, and the KARTE tab now uses both. - Hydranten, Saugstellen, Löschwasserbehälter and Löschteiche are drawn over the map from zoom 15 (red dot / blue square, "UH 100" labels from 17), behind a HYDRANTEN switch, with "Hydranten aus OpenStreetMap – nicht amtlich." under the attribution. Drawn, not controls: a Landkreis has thousands. - An address search over the map reads "Hauptstr 12a Maisach" as street, number and place, treats Str./Strasse/Straße alike, ranks the exact number and a confirmed place first, and a picked hit marks the Einsatzort with the usual ETB entry (read-only: it only centres). It starts from the Einsatz's recorded address while nothing is marked. - Both files are read off the UI thread through IRegionPackLibrary; addresses.sqlite is opened read-only with every value bound and LIKE wildcards escaped, water.geojson is size- and feature-capped. The pure map tests in MapCanvasControlTests now run on the Avalonia thread: touching MapCanvasControl from an xUnit thread raced the headless thread's InputElement initialisation once more test classes ran together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
|
Windows MSI for this pull request:
Remove the |
CodeQL's cs/loss-of-precision flagged 2 * radius as an int product cast to double. The radius is 5 or 7 and cannot overflow, but double literals keep the drawing math in one type, as the tile math already is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
The KARTE tab showed one pack at a time and switched only when something was placed or centred, so with FFB and STA installed, panning across the Landkreis border ran off the edge into blank land. It also read the installed packs once, when the incident was opened. - CombinedMapTileSource serves a tile from the first pack that has it, so a border is a seam; the attribution lists each distinct licence line once. - Hydranten come from every pack; an unreadable water file costs only that pack's points and is reported with its name. - Opening the KARTE tab re-reads the installed packs, so a pack downloaded or deleted under Stammdaten during an Einsatz shows up without reopening the incident. The view stays where it was. Refs #796 (tiles; stitching elevation belongs to the DGM sampler, #587) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
A pack's edge tiles are only partly map: its OSM data is cut to the Landkreis plus 3 km before rendering, so the rest of an edge tile is empty land. Taking a whole tile from the first pack that had one let FFB's empty margin cover STA's streets, as a cream band across the Ammersee and the Landkreis Starnberg. Each pack is now a MapTileLayer drawn clipped to its area (even-odd, so holes stay holes); in the overlap both packs show the same streets. The area comes from the zip when a pack carries boundary.geojson, then declared in pack.json and checked like any data file, and otherwise from the catalogue's boundaryUrl, fetched once at install over https, capped at 1 MB and refused unless it is a Polygon or MultiPolygon on the globe. A pack without a known area is drawn whole, underneath the others; packs installed before this need AKTUALISIEREN once to get theirs. The tile cache is keyed by pack as well, sharing its capacity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
A pack installed before the catalogue named its boundaryUrl has no area to be clipped to, but matched the catalogue's version and checksum and so showed as INSTALLIERT with no way to fetch it. A different boundaryUrl now makes it outdated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
AKTUALISIEREN appeared on a pack with the same version number and no explanation (a pack installed before its area was stored). The row now says why: a new version, a rebuild of the same version on another day, or the area still to fetch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
|
Three fixes since the description was written, from trying the branch against real FFB and STA packs. In the screenshots below, the first two pictures are your real FFB and STA packs rendered by a throwaway test from this branch; the third is the committed render test with a fictional pack. Every installed pack is one map, each drawn only within its own area. A pack's edge tiles are only partly map: outside the Landkreis plus 3 km they show empty land, because the OSM data is cut to that area before rendering. Taking a whole tile from the first pack that has one let FFB's empty margin cover STA's streets. The area comes from Before — tiles taken from the first pack (real FFB + STA): After — each pack clipped to its area: Opening KARTE re-reads the installed packs, so a pack downloaded during an Einsatz appears without reopening the incident. AKTUALISIEREN now says why it is offered. A pack installed before its area was stored shows version 1 both before and after the update. The row explains the update: a new version, a rebuild of the same version on a later day, or the area still to fetch. Local |
A pack's edge tiles are only partly map: the OSM data is cut to the Landkreis plus 3 km before rendering, so outside that area a tile shows empty land. An app that shows two neighbouring packs at once has to draw each clipped to its area, or one pack's empty margin covers the other's streets (CodeForFire/lagebuch#798). The area was only published through the manifest's boundaryUrl, which is not covered by the zip's SHA-256. The zip now carries the same simplified polygon as boundary.geojson, listed in pack.json with its size and SHA-256 like every data file. validate_pack.py checks that it is a Polygon or MultiPolygon Feature with closed rings, inside the pack's bounds and at most 1 MB, the cap the app enforces. formatVersion stays 2: the app accepts a zip with or without the file and falls back to boundaryUrl for packs built before this. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
#795 asked for a symbol per kind and a detail view. Hydranten stay red dots; a Saugstelle is now a blue ring, a Löschwasserbehälter a blue square and a Löschteich a blue diamond, with a key in the map's corner whenever they are drawn. A tap on the map with nothing picked to place opens the card of the water point under the finger (within a fingertip, only where symbols are drawn) and rings it; a tap beside it closes the card. The card lists what OSM holds from FORMAT.md's allowlist -- Bauart, Durchmesser, Druck, Förderleistung, Volumen, Kupplungen, Lage, Wasser aus, Nummer, Name, Betreiber, OSM id -- saying the well-known values in German ("Überflur", "DN 150", "Trinkwassernetz") and showing anything else as OSM spells it, and repeats that OSM is not the Wasserversorger's register. An OSM reference that is no object id is left off. WaterPointLayer holds the zoom thresholds and the hit test, so a point can be tapped exactly when it can be seen. Closes #795 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
|
#795: one symbol per kind, a key, and a card for each water point. When nothing is picked for placing, tapping a water point opens its card and rings the point on the map; tapping beside it closes the card. The card lists the OSM tags FORMAT.md allows. Well-known values are said in German ("Überflur", "DN 150", "Trinkwassernetz"), and anything else is shown as OSM spells it. After — fictional pack, the ÜH 150 clicked: Distance from a route to the nearest hydrant, the open question in #795, belongs with routes in #587. |
#794 listed what a Kartenpaket installer has to withstand. Two pieces were still missing: - A single entry was read until the whole pack reached the 2 GB cap and only compared with its declared size afterwards. pack.json is now unpacked first (capped at 64 KB), and every other file is read only up to the size pack.json declares for it, then checked against its declared SHA-256. A zip bomb behind a valid outer checksum stops after its first chunk. - A truncated zip had no test. It is refused as "beschädigt" and leaves the older copy in place. A declared size that is negative or not a number, or a checksum that is not 64 hex digits, refuses the pack before anything else is unpacked. Closes #794 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
|
@claude review |
|
Claude finished @DeepDiver1975's task in 39s —— View job Review of #798I read Security (pack install and address search)
Findings, none blocking
CodeQL alerts (#297, #298) Checklist from AGENTS.md
|
The SQL prefilter capped its candidates at 2000 rows before the street and place were compared, so a short stem such as "Haupt" filled the cap with other streets that sort first. The cap now counts matched hits. SQLite's LIKE folds ASCII only, so "ölmühlweg" never reached Normalize. The prefix now stops before the first non-ASCII letter and binds the first letter in both cases. Search also takes the cancellation token and checks it per row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
|
Thanks for the review. Each finding checked against the branch:
CodeQL #297/#298: closed. Code scanning shows no open alerts on Checklist: 🤖 Generated with Claude Code |
Every pack is rebuilt with boundary.geojson inside it, so the fallback that fetched the area from the catalogue's boundaryUrl is gone. The area is now one of the data files pack.json declares, a zip without it is refused, and it must still parse before the pack is installed. RegionPackInfo no longer carries BoundaryUrl, so a pack no longer counts as outdated only because the catalogue started naming its area. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
An app now reads the area from boundary.geojson in the zip only and refuses a zip without it (CodeForFire/lagebuch#798), and every pack is rebuilt with it. The sentence saying an app falls back to boundaryUrl for six-file packs, and the note that an app accepts a zip with or without the area, no longer hold. boundaryUrl itself stays in the manifest for its own use. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An app now reads the area from boundary.geojson in the zip only and refuses a zip without it (CodeForFire/lagebuch#798), and every pack is rebuilt with it. The sentence saying an app falls back to boundaryUrl for six-file packs, and the note that an app accepts a zip with or without the area, no longer hold. boundaryUrl itself stays in the manifest for its own use. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Stryker mutates every changed file whole and scores only the changed lines afterwards. A pull request that adds a migration therefore mutates all of Migrations.cs and IncidentRepository.cs, about 1,500 mutants run against some 600 Persistence tests. That took 27 of the 30 minutes on #798, and on #820 the Persistence job was cancelled at the limit with 1,417 mutants still running. Raise the limit to the 60 minutes the scheduled whole-project job already has. Mutating only the changed line ranges would remove the cost itself; that is a separate change. Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>




Supersedes #789 and #790. Closes #794, closes #795, closes #796 (distance from a route to a hydrant and elevation stitching move to #587). Both were built on the old
CodeForFire/lagebuch-regionspacks. This PR carries their five commits unchanged, rebased onto currentmain, and adds commits on top: the move to lagebuch-geodata format 2 (releaseffb-v1), the water points and address search that data makes possible, and every installed pack drawn as one map. Review everything after the first five commits, which were reviewed in #789/#790.What it does
Stammdaten → Karten (from feat(karte): download offline Kartenpakete and show them as a map #789) now loads
packs.jsonfrom lagebuch-geodata. The list shows "Stand 27.10.2026 · Version 1 · 253 MB". A pack counts as current when its version and SHA-256 match.KARTE tab in Führung (from feat(fuehrung): mark the Einsatzort and the units on a Lagekarte #790): mark the Einsatzort, place and drag units. Unchanged.
Hydranten and other water points (feat(karte): show water points and offer offline address search #795): from zoom 15 the map draws the pack's
water.geojson, one symbol per kind — red dot = Hydrant, blue ring = Saugstelle, blue square = Löschwasserbehälter, blue diamond = Löschteich. A key in the corner explains them. From zoom 17 each point gets a label in the style of its Hinweisschild ("UH 100", "ÜH 150", a name or a Nummer). Tapping a water point while nothing is picked for placing opens its card, with Bauart, Durchmesser, Druck, Kupplungen, Lage, Nummer, OSM id and so on. Well-known values are said in German, anything else is shown as OSM spells it. A HYDRANTEN switch turns the layer off. The card and the attribution both say that OSM is not the Wasserversorger's register. Everything is drawn on the canvas, not created as controls, because a Landkreis has thousands of points (FFB: 7 534).Offline address search on the map: "Hauptstr 12a Maisach" is read as street, house number and place, and Str./Strasse/Straße count as the same word in the query and in the data. An exact house number and a confirmed place rank first. Picking a hit marks the Einsatzort there with the usual ETB entry; on a read-only Einsatz it only centres the map. While no Einsatzort is marked, the search box starts with the address already recorded for the Einsatz. Search uses the pack only, never an online service.
Every installed pack is one map (for feat(karte): allow more than one installed Kartenpaket #796, tiles only): a tile comes from the first pack that has it, so the FFB/STA border is a seam rather than the edge of the map. The attribution lists each distinct licence line once, and hydrants come from every pack. Opening KARTE re-reads the installed packs, so a pack downloaded during an Einsatz appears without reopening the incident. Stitching elevation across packs is left for the DGM sampler in feat(wasserfoerderung): map mode salvage from #164 with pump markers and GeoJSON/GPX export #587, which is the first code that reads
elevation.tif.Format 2, checked end to end
What arrives over the network is untrusted, so:
formatVersion == 2("Lagebuch aktualisieren"). An entry is skipped when its SHA-256 is not 64 lower-case hex digits, its slug does not match FORMAT.md's^[a-z0-9]+(-[a-z0-9]+)*$(at most 32 characters), its bounds lie off the globe, or its zoom is out of range;FixedTimeEqualsbefore it is unpacked;pack.jsonis unpacked first, and every other file is read only up to the size it declares, so a zip bomb behind a valid outer checksum stops after its first chunk rather than at the 2 GB cap (fix(wasserfoerderung): harden the Kartenpaket installer #794); a truncated zip is refused and leaves the older copy;boundary.geojsonamong them. A path-traversal name, an extra file, a missing file or a duplicate refuses the whole pack (before, such entries were skipped);pack.json(capped at 64 KB) must name the same slug and declare the size and SHA-256 of each of the five data files exactly as unpacked;boundaryUrl, and it must parse as a Polygon or MultiPolygon of at most 1 MB before the pack is installed;pack.jsonis now the publisher's file, so the app's record of the catalogue entry moves toinstalled.json;addresses.sqliteis opened read-only. Every value is bound, LIKE wildcards in the query are escaped, the query is capped at 100 characters, and a cell of the wrong type or a position off the globe costs only that row.water.geojsonis capped at 32 MB and 200 000 features, and only Points with one of FORMAT.md's fouremergencyvalues are read.Each of these has a test that replays it.
elevation.tif(DGM5) is installed and checked but not yet read; it is for the Wasserförderung (#587).Also
MapCanvasControlTestshad three plain[Fact]/[Theory]tests that touch Avalonia types. Once more acceptance classes ran together, they raced the headless thread'sInputElementtype initialiser (TypeInitializationException, 44 failures). They now run as[AvaloniaFact]/[AvaloniaTheory].Merge order
Merge only after every pack is rebuilt with
boundary.geojsonandpacks.jsonlists the new editions. A zip without its area, such as today'sffb-v1, is refused as "unerwarteter Inhalt".Renumber at merge
Migration V36 and protocol 26/26 (from #790) still sit directly above
main(V35 / 25). Renumber them ifmainmoves first.Screenshots
Before — Führung has no KARTE tab (from #790):
Before — no Karten section in Stammdaten (from #789):
After — the Einsatzort and units on the KARTE tab (fictional pack):
After — Hydranten and a Saugstelle at zoom 17, the HYDRANTEN switch at top right, the OSM note bottom right:
After — address search with the hits listed; clicking one marks the Einsatzort:
After — Stammdaten → Karten with the format-2 detail line:
All fixtures are fictional: Musterstraße in Musterstadt, made-up hydrants, generated tiles.
Verification
make clean ci: 0 warnings, 0 errors, every test assembly passed (Domain 72, … Acceptance 897), noTest Run Failed.make format-checkpassed.WaterPointsGeoJsonTests,AddressIndexTests, Lagekarte VM water and address tests, hydrant pixel tests, and an address search driven by a real click in the view.packs.jsonparsed;ffb-v1.zip(SHA-256138a8f4a…matches) installed in 0.6 s with all six files (before the area moved into the zip); 7 534 water points read in 0.1 s; a search on 75 760 addresses takes about 8–30 ms.MainActivitywiring, which is unchanged from feat(karte): download offline Kartenpakete and show them as a map #789.🤖 Generated with Claude Code