feat: propagate QGIS selection color to map highlight layer#6599
Open
meyerlor wants to merge 12 commits into3liz:masterfrom
Open
feat: propagate QGIS selection color to map highlight layer#6599meyerlor wants to merge 12 commits into3liz:masterfrom
meyerlor wants to merge 12 commits into3liz:masterfrom
Conversation
f01cadf to
6ea6ab2
Compare
Read SelectionColor from the QGIS project Gui properties and expose it through the PHP→JSON→JS pipeline so the OpenLayers highlight/ selection overlay respects the user-configured color instead of the hardcoded yellow rgba(255,255,0,0.8). - ProjectGuiProperties: add getSelectionColor() with 0-255→0-1 alpha - QgisProject: cache and expose selectionColor property - Project: add getSelectionColor() wrapper; inject into getUpdatedConfig() - Options.js: add selectionColor optional property with default fallback - map.js: use initialConfig.options.selectionColor for highlight style
6ea6ab2 to
4643738
Compare
- Remove fill-color from highlight layer style so startup snapshot matches the stroke-only reference (polygon interiors are transparent as before) - Populate OL highlight layer via WFS when selection is made from the attribute table, so screenshots differ between selected/deselected states - Clear highlight layer in emptyLayerSelection to remove it when selection is cleared (filter applied, deselect) - Update attribute-table test to wait for WFS GetFeature request before taking the selectHash screenshot
With 3 polygon features rendered via OL highlight layer (instead of QGIS Server SELECTION yellow), the screenshot PNG grows beyond the previous 10000-byte upper bound. Raise the limit to 15000.
…highlight - Restore fill-color in _highlightLayer style (was removed to fix snapshot but broke the selection visual feedback for all polygon layers) - Use WFS FEATUREID instead of SELECTIONTOKEN to fetch selected features for OL highlight (SELECTIONTOKEN is not reliably supported on WFS endpoint) - Add olHighlightUpdated flag to layerSelectionChanged events fired by SelectionTool so updateMapLayerSelection skips duplicate WFS fetch (SelectionTool already calls addHighlightFeatures directly) - Add hasHighlightFeatures getter to map for external checks - Set startup.qgs SelectionColorAlpha to 204 (0.800 opacity) to match the existing reference snapshot taken with rgba(255,255,0,0.8)
…hlight fetch outside token chain
…l reports empty layer results
The OL highlight layer covers polygon interiors with semi-opaque yellow, reducing PNG entropy vs the complex map background. With 3 features highlighted, the byte size is consistently ~7222 (below the old 8000 threshold). Lower to 5000 and wait for WFS response before screenshot.
The fill-color added in a previous commit caused startup.spec.js to fail because the reference snapshot expects stroke-only yellow outlines. Polygon outlines are still clearly visible as selection indicators. Also revert startup.qgs SelectionColorAlpha to 255 (no longer needed).
Two distinct use cases shared the same _highlightLayer: - Popup/locate/search: shows feature location, stroke-only yellow is correct - SelectionTool/attribute table: user-chosen features, should use fill+stroke with the project's configured selection color Add _selectionLayer (fill + stroke) alongside _highlightLayer (stroke only). SelectionTool and attributeTable now use addSelectionFeatures / setSelectionFeatures / clearSelectionFeatures which operate on the new layer. Popup, locate, search, startup, atlas, etc. continue using _highlightLayer unchanged.
_highlightLayer (popup, locate, search, startup) uses fixed rgba(255,255,0,0.8) and is stroke-only — unaffected by project selection color setting. Only _selectionLayer (SelectionTool, attribute table) uses the project-configured selectionColor with fill+stroke.
Collaborator
Author
|
it should be good now.
|
rldhont
requested changes
Apr 14, 2026
Collaborator
rldhont
left a comment
There was a problem hiding this comment.
Hi @meyerlor,
Sorry for the delay, I am not in favor to display selection client-side. It is possible in QGIS project to defined for each layer a selection symbol, not only the color. With this changes, Lizmap will not be able to display the selection as configured in the QGIS Project.
I am more in favor to apply the selection color defined in the project to popup, locate, search and startup.
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.
Read SelectionColor from the QGIS project Gui properties and expose it through the PHP→JSON→JS pipeline so the OpenLayers highlight/ selection overlay respects the user-configured color instead of the hardcoded yellow rgba(255,255,0,0.8).
Superseeds #748
Fixes: #4520
ToDo: Respect "per layer" custom selection color as configured in the layer properties of QGIS