GeoNode / geonode-mapstore-client

MapStore Client for GeoNode
http://geonode.org/geonode-mapstore-client/master
Other
14 stars 105 forks source link

Provide option to create mutual exclusive layers #1265

Closed MarkusKonk closed 3 months ago

MarkusKonk commented 1 year ago

If a LayerGroup contains several layers, it might happen that some of the layers should not be visible in combination with the other layers of the same group (and layers in the sub-group). Creators of a layer should be able to configure it in a way that that it is "mutual exclusive".

This means that if a user clicks on the layer to make it visible, the other layers are made invisible automaically. There are two options to implement this feature: Option 1 (preferred): Since this is an optional configuration for layer creators, this might be a good enhancement of the core. Option 2: Implement a plugin to extend the TOC component.

gannebamm commented 1 year ago

@giohappy @allyoucanmap please take a look at the options

giohappy commented 1 year ago

@MarkusKonk @gannebamm here I guess you want a configuration at the group level (not per layer) to make the nodes under the group mutually exclusive. Something typical in many tree components, including the TOC in QGIS. Is it right?

This is something that will probably need to touch the core, and should itself be implemented inside the core. I don't think a plugin would be enough. I anticipate that it won't probably be that easy, but I think working with/inside the core is the way to go.

gannebamm commented 1 year ago

@giohappy yes on a group level. @MarkusKonk please give some insight about the current state of this task.

MarkusKonk commented 1 year ago

We made some progress regarding this issue as discussed with @gannebamm. However, we had to make some more or less minor changes to the MapStore2 and Client core.

allyoucanmap commented 5 months ago

@tdipisa @giohappy next mapstore version 2024.01.00 will include the mutually exclusive groups so as soon as we align the MapStore submodule to 2024.01.xx we will get this feature.

see here the behavoiur on MapStore

https://github.com/geosolutions-it/MapStore2/assets/19175505/af2d90ea-df90-4b4b-8dc5-c830404b6fe1

ridoo commented 5 months ago

@allyoucanmap it seems the option is always available to the map user. Is this also a configuration option the person who creates that map -- at least to choose what is the default for a layer? The intention I have in mind is, that the map creator may want to visualize the layers in one group mutual exclusive, while not exclusive for another group.

/cc @gannebamm

allyoucanmap commented 5 months ago

@allyoucanmap it seems the option is always available to the map user. Is this also a configuration option the person who creates that map -- at least to choose what is the default for a layer? The intention I have in mind is, that the map creator may want to visualize the layers in one group mutual exclusive, while not exclusive for another group.

@ridoo We introduced an options to group level called nodesMutuallyExclusive that is included in the map configuration so after saving it the state is persisted. if nodesMutuallyExclusive is true all the children nodes at the first level will become mutually exclusive and they will change the icon to a radio button style, some examples:

here new york is mutually exclusive while other are normal groups

image

you can have the exclusive group inside a nested group, here annotation group is mutually exclusive

image

this option can be activated to a specific group level and in this other example you can see that the new your group is mutually exclusive while the nested annotation group is normal. As you can see the context menu allows you to change a specific group at any level

image

gannebamm commented 5 months ago

@allyoucanmap I think the upstream implementation follows the same logic as ours. You can take a look at it here: https://geonode-demo.thuenen.de/catalogue/#/map/24

Each group (or subgroup) can be set as mutually exclusive. We also changed the button from 'eye' to 'radio button'. The state is saved.

allyoucanmap commented 5 months ago

@allyoucanmap I think the upstream implementation follows the same logic as ours. You can take a look at it here: https://geonode-demo.thuenen.de/catalogue/#/map/24

@gannebamm I tried to import the map you shared in the latest mapstore version. The logic of mutally exclusive applies to all the first children including groups, like this one

https://github.com/GeoNode/geonode-mapstore-client/assets/19175505/b3143c2e-f378-4726-adc8-7f129800c889

gannebamm commented 3 months ago

next mapstore version 2024.01.00 will include the mutually exclusive groups so as soon as we align the MapStore submodule to 2024.01.xx we will get this feature.

With above merged into 4.3.x this is now available and I did a quick test. Took me a while to understand that right-click is now an option 🚀

This seems to work quite well and is saved as state for the group. See working demo here: https://development.demo.geonode.org/catalogue/#/map/593

I think we can close this.

ridoo commented 3 months ago

I feel free to close this one then