Skip to content

measurements-playground: switch to maplibre + wire up terra-draw#649

Open
helllth wants to merge 12 commits intodevfrom
feature/00648-adding-maplibre-measurments
Open

measurements-playground: switch to maplibre + wire up terra-draw#649
helllth wants to merge 12 commits intodevfrom
feature/00648-adding-maplibre-measurments

Conversation

@helllth
Copy link
Copy Markdown
Member

@helllth helllth commented Apr 29, 2026

deploy: ["measurements-playground"]

helllth added 4 commits April 28, 2026 18:01
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.
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 29, 2026

View your CI Pipeline Execution ↗ for commit 306ce5f

Command Status Duration Result
nx run potenzialflaechen-online:build --configu... ✅ Succeeded 11s View ↗
nx run kulturstadtplan:build --configuration=pr... ✅ Succeeded 8s View ↗
nx run rasterfari-tileserver-wms-companion:buil... ✅ Succeeded <1s View ↗
nx run parkscheinautomaten:build --configuratio... ✅ Succeeded 3s View ↗
nx run geoportal:build --configuration=producti... ✅ Succeeded 4s View ↗
nx run rainhazardmap-olpe:build --configuration... ✅ Succeeded 11s View ↗
nx run rainhazard-meschede:build --configuratio... ✅ Succeeded 5s View ↗
nx run belis-online:build --configuration=produ... ✅ Succeeded 10s View ↗
Additional runs (51) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-04-29 16:43:05 UTC

@github-actions
Copy link
Copy Markdown

🚀 Deployed measurements-playground

Preview URL: https://cismet.github.io/carma-pr-deployments/649/measurements-playground/

Based on commit 01d8a30

@github-actions
Copy link
Copy Markdown

🚀 Deployed measurements-playground

Preview URL: https://cismet.github.io/carma-pr-deployments/649/measurements-playground/

Based on commit e65e4fb

@github-actions
Copy link
Copy Markdown

🚀 Deployed measurements-playground

Preview URL: https://cismet.github.io/carma-pr-deployments/649/measurements-playground/

Based on commit 6deb191

@github-actions
Copy link
Copy Markdown

🚀 Deployed measurements-playground

Preview URL: https://cismet.github.io/carma-pr-deployments/649/measurements-playground/

Based on commit f1e0b28

helllth added 2 commits April 29, 2026 16:14
…eview, radius slider, reset, skipSnapping filter
@github-actions
Copy link
Copy Markdown

🚀 Deployed measurements-playground

Preview URL: https://cismet.github.io/carma-pr-deployments/649/measurements-playground/

Based on commit 03dc6a9

…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.
@github-actions
Copy link
Copy Markdown

🚀 Deployed measurements-playground

Preview URL: https://cismet.github.io/carma-pr-deployments/649/measurements-playground/

Based on commit c792caf

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.

1 participant