-
Notifications
You must be signed in to change notification settings - Fork 441
Layer Selection Plugin on ArcGIS, WFS & WMS layers #11119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arxitpln
wants to merge
17
commits into
geosolutions-it:master
Choose a base branch
from
arxitpln:arxit-select
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
014dbae
Add Translations
arxitpln 8977b5b
Add configs
arxitpln dc8f867
Add Select to plugins
arxitpln 21d1a3b
Correction on getCQLGeometryElement
arxitpln be98cad
Add treeHeadr to TOC and LayerTree
arxitpln ca0a494
tooltip → description
arxitpln cb7625b
Salect → SelectPlugin
arxitpln 1ea363c
Add select Code
arxitpln e23cb1e
Select → LayersSelection in translations
arxitpln 2183893
Select → LayersSelection for configs
arxitpln 6b790cb
Select → LayersSelection for plugins
arxitpln bb840f7
Select → LayersSelection for the plugin
arxitpln 0075d05
Add LayersSelect JsDoc
arxitpln 5ef5be2
Remove extra comments and extra ={true}
jlo-arxit d97c9f1
Correct plugin name in CreatePlugin function
jlo-arxit 18e31bd
Remove LayersSelection plugin from localconfig.json and simple.json
jlo-arxit e61f57b
Disable plugin in 3D
jlo-arxit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import React from 'react'; | ||
| import { connect } from 'react-redux'; | ||
| import { createSelector } from 'reselect'; | ||
| import { get } from 'lodash'; | ||
| import { Glyphicon } from 'react-bootstrap'; | ||
|
|
||
| import { createPlugin } from '../utils/PluginsUtils'; | ||
| import { layersSelector } from '../selectors/layers'; | ||
| import { updateNode, addLayer, changeLayerProperties } from '../actions/layers'; | ||
| import { zoomToExtent } from '../actions/map'; | ||
| import controls from '../reducers/controls'; | ||
| import { toggleControl } from '../actions/controls'; | ||
| import Message from '../components/I18N/Message'; | ||
|
|
||
| import SelectComponent from './layersSelection/components/LayersSelection'; | ||
| import epics from './layersSelection/epics/layersSelection'; | ||
| import select from './layersSelection/reducers/layersSelection'; | ||
| import { storeConfiguration, cleanSelection, addOrUpdateSelection } from './layersSelection/actions/layersSelection'; | ||
| import { getSelectSelections, getSelectQueryMaxFeatureCount } from './layersSelection/selectors/layersSelection'; | ||
|
|
||
| /** | ||
| * Select plugin that enables layer feature selection in the map. | ||
| * It connects Redux state and actions to the SelectComponent UI. | ||
| * Uses selectors to retrieve visibility, layers, selection results, and feature count. | ||
| * | ||
| * @function | ||
| * @returns {Object} A plugin definition object used by the application to render and control the Select tool. | ||
| */ | ||
| export default createPlugin('LayersSelection', { | ||
| component: connect( | ||
| createSelector([ | ||
| (state) => get(state, 'controls.select.enabled'), | ||
| layersSelector, | ||
| getSelectSelections, | ||
| getSelectQueryMaxFeatureCount | ||
| ], (isVisible, layers, selections, maxFeatureCount) => ({ | ||
| isVisible, | ||
| layers, | ||
| selections, | ||
| maxFeatureCount | ||
| })), | ||
| { | ||
| onClose: toggleControl.bind(null, 'select', null), | ||
| onUpdateNode: updateNode, | ||
| storeConfiguration, | ||
| cleanSelection, | ||
| addOrUpdateSelection, | ||
| zoomToExtent, | ||
| addLayer, | ||
| changeLayerProperties | ||
| } | ||
| )(SelectComponent), | ||
| options: { | ||
| disablePluginIf: "{state('mapType') === 'cesium'}" | ||
| }, | ||
| reducers: { | ||
| ...controls, | ||
| select | ||
| }, | ||
| epics: epics, | ||
| containers: { | ||
| BurgerMenu: { | ||
| name: 'select', | ||
| position: 1000, | ||
| priority: 2, | ||
| doNotHide: true, | ||
| text: <Message msgId="layersSelection.title"/>, | ||
| tooltip: <Message msgId="layersSelection.tooltip"/>, | ||
| icon: <Glyphicon glyph="hand-down"/>, | ||
| action: toggleControl.bind(null, 'select', null), | ||
| toggle: true | ||
| }, | ||
| SidebarMenu: { | ||
| name: 'select', | ||
| position: 1000, | ||
| priority: 1, | ||
| doNotHide: true, | ||
| text: <Message msgId="layersSelection.title"/>, | ||
| tooltip: <Message msgId="layersSelection.tooltip"/>, | ||
| icon: <Glyphicon glyph="hand-down"/>, | ||
| action: toggleControl.bind(null, 'select', null), | ||
| toggle: true | ||
| }, | ||
| Toolbar: { | ||
| name: 'select', | ||
| alwaysVisible: true, | ||
| position: 2, | ||
| priority: 0, | ||
| doNotHide: true, | ||
| tooltip: <Message msgId="layersSelection.title"/>, | ||
| icon: <Glyphicon glyph="hand-down"/>, | ||
| action: toggleControl.bind(null, 'select', null), | ||
| toggle: true | ||
| } | ||
| } | ||
| }); | ||
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
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
44 changes: 44 additions & 0 deletions
44
web/client/plugins/layersSelection/actions/layersSelection.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| export const SELECT_CLEAN_SELECTION = "SELECT:CLEAN_SELECTION"; | ||
| export const SELECT_STORE_CFG = "SELECT:STORE_CFG"; | ||
| export const ADD_OR_UPDATE_SELECTION = "SELECT:ADD_OR_UPDATE_SELECTION"; | ||
|
|
||
| /** | ||
| * Action creator to clean the current selection based on geometry type. | ||
| * | ||
| * @param {string} geomType - The type of geometry to clean (e.g., "Point", "Polygon"). | ||
| * @returns {{ type: string, geomType: string }} The action object. | ||
| */ | ||
| export function cleanSelection(geomType) { | ||
| return { | ||
| type: SELECT_CLEAN_SELECTION, | ||
| geomType | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Action creator to store configuration settings related to selection. | ||
| * | ||
| * @param {Object} cfg - Configuration object to store. | ||
| * @returns {{ type: string, cfg: Object }} The action object. | ||
| */ | ||
| export function storeConfiguration(cfg) { | ||
| return { | ||
| type: SELECT_STORE_CFG, | ||
| cfg | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Action creator to add or update a layer selection with GeoJSON data. | ||
| * | ||
| * @param {string} layer - The name or ID of the layer. | ||
| * @param {Object} geoJsonData - The GeoJSON data representing the selection. | ||
| * @returns {{ type: string, layer: string, geoJsonData: Object }} The action object. | ||
| */ | ||
| export function addOrUpdateSelection(layer, geoJsonData) { | ||
| return { | ||
| type: ADD_OR_UPDATE_SELECTION, | ||
| layer, | ||
| geoJsonData | ||
| }; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| .ms-resizable-modal > .modal-content.select-dialog { | ||
| top: 0vh; | ||
| right: -100vw; | ||
| } | ||
|
|
||
| .select-content * .ms-node-title { | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| .select-content * .ms-node-header-info > .ms-node-header-addons:nth-child(3) { | ||
| flex: 1 ; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .features-count-displayer{ | ||
| display: flex; | ||
| } | ||
|
|
||
| .title-container { | ||
| display: flex; | ||
| } | ||
|
|
||
| .title-icon { | ||
| height: 100%; | ||
| width: auto; | ||
| margin-right: 0.5em; | ||
| } | ||
|
|
||
| .title-title { | ||
| flex-grow: 1; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .tree-header { | ||
| background-color: #E9EDF4; | ||
| } | ||
|
|
||
| .features-count { | ||
| font-weight: bold; | ||
| } |
57 changes: 57 additions & 0 deletions
57
web/client/plugins/layersSelection/components/EllipsisButton/EllipsisButton.css
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| .ellipsis-container { | ||
| position: relative; | ||
| display: inline-block; | ||
| opacity: 1; | ||
| } | ||
|
|
||
| .ellipsis-button { | ||
| padding: 2%; | ||
| background-color: lightgray; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the styles related to theme colors should be included in the lesscss files under a including a new file with the name of plugin, in this case layer-selection.less. This is needed to use variables instead of hardcoded value for colors |
||
| /* border: none; */ | ||
| border: 1px solid #ccc; | ||
| border-radius: 50%; | ||
| /* font-size: 16px; */ | ||
| font-weight: bold; | ||
| cursor: pointer; | ||
| text-align: center; | ||
| line-height: 1; | ||
| } | ||
|
|
||
| .ellipsis-button:hover { | ||
| background-color: #e0e0e0; | ||
| } | ||
|
|
||
| .ellipsis-menu { | ||
| position: absolute; | ||
| top: 100%; | ||
| right: 0; | ||
| background-color: white; | ||
| border: 1px solid #ccc; | ||
| border-radius: 5px; | ||
| /* margin-top: 5px; */ | ||
| box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); | ||
| z-index: 1; | ||
| width: 10vw; | ||
| } | ||
|
|
||
| .ellipsis-menu p { | ||
| margin: 0; | ||
| padding: 5%; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .ellipsis-menu p:hover { | ||
| background-color: #f0f0f0; | ||
| } | ||
|
|
||
| .export-toggle { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| cursor: pointer; | ||
| padding: 5px 10px; | ||
| } | ||
|
|
||
| .export-toggle span:nth-of-type(2) { | ||
| font-weight: bold; | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reducer should not be spread. In this case if we want also to ensure controls reducer is included we should review reducers as:
And instead of
selectI propose to change the name of reducer tolayersSelection