Ol10 edition baseline#6829
Draft
meyerlor wants to merge 2 commits into
Draft
Conversation
* Replace OpenLayers.Control.Snapping with the OL10 Snap interaction. * Render snap features as a solid orange overlay while snapping is active. * Drop the manual refresh button: getSnappingData() now runs automatically on moveend and on layer-tree visibility changes (the snapLayersRefreshable state and snapping.refreshable event are gone, no consumers remained). * OL10 Snap exposes a single vertex flag and a single pixelTolerance, so snap_vertices is OR-ed with snap_intersections and pixelTolerance is max(snap_vertices_tolerance, snap_segments_tolerance). Worth flagging for projects that configure vertex vs intersection independently. * Public reorderSnapInteraction() lets future callers re-add the Snap interaction so OL processes it before any recently-added Draw / Modify / Translate. No-op when snap is inactive. Tests: * snap.spec.js: remove three WFS 1.1.0 / SRSNAME / datum-shift tests that exercised the OL2 snap WFS path (replaced by OL10 GeoJSON parsing). Strip refresh-button click / disabled-state assertions from the snap panel test now that refresh is automatic. This PR ships the snap infrastructure but does not visibly engage with the OL2 edition Draw / Modify yet. Snapping starts to actually snap once the follow-up OL10 edition migration lands.
2817f9c to
edcda01
Compare
397a29b to
c0bbf8c
Compare
* Replace OpenLayers.Control.DrawFeature / ModifyFeature / SelectFeature with OL10 Draw, Modify and Select interactions. The OL2 vector edit layer becomes an OL10 VectorLayer / VectorSource on mainLizmap.map. * Auto-activate Modify after a feature is drawn, including for point layers. Feature highlights use the OL10 draw layer. * Route WMS extent / size queries through the OL10 view. Required because the OL10 map is now the source of truth for the visible viewport during edition. * New modules/Edition.js owns the WKT bridge between the digitizing module and the hidden geometry form field, and emits user-facing toasts via #lizmap-editing-message (the legacy #lizmap-edition-message is still used for save-success / error toasts). * Duplicate toast dispatches removed from legacy/edition.js so the "Edit vertices" / "Draw on the map" toast no longer appears twice. * For point edition the digitizing toolbar is hidden; drawing begins automatically on click. * New baseline locale keys: edition.toolbar.redraw plus four digitizing.toolbar.<tool>.help keys (edit / split / rotate / scaling). * Remove ~120 lines of dead OL2 split helpers from legacy/edition.js (afterReshapeSpliting, beforeFeatureSpliting, afterFeatureSpliting and their editCtrls.reshape / editCtrls.featsplit entries). Builds on the snapping migration. The new digitizing module calls mainLizmap.snapping.reorderSnapInteraction() after adding interactions, so the OL10 Snap follows each new Draw / Modify / Translate. Tests: * 9 spec files updated for OL10 map / interactions (clickOnMapLegacy → clickOnMap, mapOl2 → map, #map → #newOlMap, waitForFunction guards for Select/Modify). * edition-form.spec.js: "must allow modification without creation" now expects #lizmap-editing-message (the new id) for the on-form edit-vertices toast. * editing-copy-paste-geometry.spec.js: mark the 11 interaction tests test.fixme(). They cover behaviour that needs the OL10 GeometryCopy port (lands in the follow-up Copy/Paste PR). * draw.spec.js: mark "Length and angle constraints" test.fixme() — the distance/angle constraint feature is deferred to a follow-up PR. Deferred to follow-up PRs: reshape, parallel offset, move (in edition), distance/angle drawing constraints, split-with-server-save (the digitizing-split button is therefore hidden in edition context for now, remains available in draw context), ReverseGeom port, draw.spec.js new-tool tests and pages/drawpage.js new-tool locators.
c0bbf8c to
5059826
Compare
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.
Migrate edition Draw/Modify/Select from OL2 to OL10
with OL10 Draw, Modify and Select interactions. The OL2 vector edit
layer becomes an OL10 VectorLayer / VectorSource on mainLizmap.map.
layers. Feature highlights use the OL10 draw layer.
because the OL10 map is now the source of truth for the visible
viewport during edition.
module and the hidden geometry form field, and emits user-facing
toasts. Duplicate toast dispatches removed from legacy/edition.js.
automatically on click.
digitizing.toolbar..help keys (edit / split / rotate / scaling).
(afterReshapeSpliting, beforeFeatureSpliting, afterFeatureSpliting and
their editCtrls.reshape / editCtrls.featsplit entries).
Builds on the snapping migration. The new digitizing module calls
mainLizmap.snapping.reorderSnapInteraction() after adding interactions,
so the OL10 Snap follows each new Draw / Modify / Translate.
Tests:
edition-form.spec.js, form_advanced.spec.js, form_edition.spec.js,
form_edition_value_relation_field.spec.js, dnd-form.spec.js,
print.spec.js, singleWMS.spec.js: switch edition map interactions
from clickOnMapLegacy / mapOl2 / #map to clickOnMap / map / #newOlMap,
adjust coordinates for the OL10 safe zone, and add waitForFunction
guards so tests wait for the OL10 Select / Modify interaction to be
ready before dragTo.
Deferred to follow-up PRs: reshape, parallel offset, move (in edition),
distance/angle drawing constraints, split-with-server-save (the
digitizing-split button is therefore hidden in edition context for now,
remains available in draw context), ReverseGeom port, draw.spec.js
new-tool tests and pages/drawpage.js new-tool locators.