-
Notifications
You must be signed in to change notification settings - Fork 445
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
base: master
Are you sure you want to change the base?
Changes from 13 commits
014dbae
8977b5b
dc8f867
21d1a3b
be98cad
ca0a494
cb7625b
1ea363c
e23cb1e
2183893
6b790cb
bb840f7
0075d05
5ef5be2
d97c9f1
18e31bd
e61f57b
770b88e
05a1392
d41576b
44bc94c
b52da98
0a907e2
803bad7
1f0f922
c97723b
d931503
b590f45
e7c0394
d15cff0
d572f44
ad8b042
9ee69ed
830185b
4012a45
7b78fa2
cc60750
a350031
3358fb2
2767693
0c8396c
5bc14e2
0e6bf2f
938081c
84af025
ed54f71
d4c7bd3
f08342d
12387fa
6476a1d
80dfae1
f9aab22
c73bbda
8ad950a
adeed26
fc15b8d
545360b
e97ffc7
1976d18
45cf1eb
83ac5d5
262c841
0243cbe
6809ed0
5fbb600
de9b2f0
0173f7b
73f3362
5e95477
8634707
ee94b0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,29 @@ | |
| "zoomControl": false | ||
| } | ||
| }, | ||
| { | ||
| "name": "LayersSelection", | ||
| "cfg": { | ||
| "highlightOptions": { | ||
| "color": "#3388ff", | ||
| "dashArray": "", | ||
| "fillColor": "#3388ff", | ||
| "fillOpacity": 0.2, | ||
| "radius": 4, | ||
| "weight": 4 | ||
| }, | ||
| "queryOptions": { | ||
| "maxCount": -1 | ||
| }, | ||
| "selectTools": [ | ||
| "Point", | ||
| "Line", | ||
| "Circle", | ||
| "Rectangle", | ||
| "Polygon" | ||
| ] | ||
| } | ||
| }, | ||
|
||
| { | ||
| "name": "Help" | ||
| }, | ||
|
|
||
| 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('Select', { | ||
|
||
| 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('router') && (state('router').endsWith('new') || state('router').includes('newgeostory') || state('router').endsWith('dashboard'))}" | ||
|
||
| }, | ||
| 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 | ||
| } | ||
| } | ||
| }); | ||
| 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 | ||
| }; | ||
| } |
| 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; | ||
| } |
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.
This plugin should be available only in contexts so we should remove it from localConfig.json