measurements-playground: switch to maplibre + wire up terra-draw#649
measurements-playground: switch to maplibre + wire up terra-draw#649
Conversation
helllth
commented
Apr 29, 2026
Replace the react-cismap TopicMapComponent + @carma-commons/measurements stack with the ng-topicmap-playground provider chain (TopicMapContextProvider + Gaz/Selection/Libre/MapSelection/MapHighlight) wrapping a single <CarmaMap mapEngine="maplibre">. Drag-and-drop layer loading is preserved for both URL drops and local-file drops; local style.json files ride through VectorStyle.style by wrapping the parsed JSON in a Blob URL (revoked on remove). LocalStorage key moved to measurements-playground-maplibre:vector-styles. styles.css realigned with ng-topicmap-playground so Tailwind preflight no longer collapses the Bootstrap heading styles in the modal menu. Removed: redux store + ui/mapping slices, measurement-mode UI components, helper constants, coordinate-extraction util — all of which only existed to drive the old MEASUREMENT mode. Terra Draw integration follows.
…w-mode buttons
Add an optional extraControls?: React.ReactNode prop to CarmaMap, rendered
inside its internal <ControlLayout> right after the built-in controls. Any
<Control position="..." order={...}> siblings passed via this prop register
through the same ControlContext the built-ins use, so they auto-stack with
zoom / compass / terrain / fullscreen / locator by order. Same mechanism
apps/geoportal MapWrapper uses for its own buttons.
In measurements-playground, replace the absolute-positioned overlay with
three <Control position="topleft" order={70|80|90}> siblings (point, line,
polygon) emitted via extraControls. UI state only (drawMode useState); no
draw library wired up yet -- terra-draw integration is the next step.
Pulls in terra-draw@^1.28.8 and terra-draw-maplibre-gl-adapter@^1.3.0 for the upcoming FeatureCollection-authoring tool in measurements-playground. maplibre-gl peer dep (>=4) is already satisfied by the workspace 5.18. No imports yet; wiring follows in a separate commit.
…gon) Hook the four draw-mode buttons into terra-draw via TerraDrawMapLibreGLAdapter. TerraDraw is instantiated once the maplibre map exists and its style has loaded; "none" UI state maps to terra-draw's built-in `static` (inert) mode so drawn features remain visible but uneditable. Modes registered with default styling: - TerraDrawPointMode - TerraDrawLineStringMode - TerraDrawPolygonMode - TerraDrawSelectMode with the canonical fully-editable flags (drag the feature, drag/delete vertices, add midpoints) for all three geometry types. Visually, the four buttons now live inside a single <Control> rendered as one fused button group (top = !border-b-0 !rounded-b-none, middle = no rounding + thin top border, bottom = !rounded-t-none !border-t-[1px]) - same pattern apps/geoportal uses for compass + 3D and zoom +/-. Snapping, finish-event handoff, and length/area readouts still pending.
|
View your CI Pipeline Execution ↗ for commit 306ce5f
☁️ Nx Cloud last updated this comment at |
🚀 Deployed
|
🚀 Deployed
|
🚀 Deployed
|
…is already loaded
🚀 Deployed
|
…eview, radius slider, reset, skipSnapping filter
…, rAF throttle, cache snappable layer ids)
🚀 Deployed
|
…ed opt-in default excludes basemap.de) - findSnapTarget now does vertex-first, then closest-point-on-edge fallback (screen-space projection + clamped t, linear lng/lat blend); same dot for both, vertex always wins when both are in range. - iterateGeomSegments / findClosestPointOnSegment helpers added next to the existing iterateGeomCoords; skips degenerate segments and Point / MultiPoint geometries. - New snap-mode toggle: derived-opt-in (default) only treats sources that ship at least one metadata.carmaConf.skipSnapping flag as curated snap targets, mirroring the legacy curated-maplibre-maps pattern at the source level — basemap.de is now excluded by default. Flipping the toggle restores the previous opt-out behavior. Live recompute via a separate [map, snapMode] effect, no terra-draw teardown. - Persisted in localStorage under measurements-playground-maplibre:snap-mode; reset by the overlay's Reset button.
🚀 Deployed
|