Skip to content

Commit

Permalink
Add support for layerTreeHiddenSublayers theme item config
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Mar 5, 2024
1 parent a505537 commit bdff74c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qwc2",
"version": "2024.03.04-master",
"version": "2024.03.05-master",
"description": "QGIS Web Client 2 core",
"author": "Sourcepole AG",
"license": "BSD-2-Clause",
Expand Down
3 changes: 3 additions & 0 deletions plugins/LayerTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ class LayerTree extends React.Component {
if (this.state.filtervisiblelayers && !sublayer.visibility) {
return null;
}
if (Array.isArray(layer.layerTreeHiddenSublayers) && layer.layerTreeHiddenSublayers.includes(sublayer.name)) {
return null;
}
const allowRemove = ConfigUtils.getConfigProp("allowRemovingThemeLayers", this.props.theme) === true || layer.role !== LayerRole.THEME;
const allowReordering = ConfigUtils.getConfigProp("allowReorderingLayers", this.props.theme) === true;
let checkboxstate = sublayer.visibility === true ? 'checked' : 'unchecked';
Expand Down
3 changes: 3 additions & 0 deletions scripts/themesConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ function getTheme(config, configItem, result, resultItem, proxy) {
if (configItem.themeInfoLinks) {
resultItem.themeInfoLinks = configItem.themeInfoLinks;
}
if (configItem.layerTreeHiddenSublayers) {
resultItem.layerTreeHiddenSublayers = configItem.layerTreeHiddenSublayers;
}

resultItem.skipEmptyFeatureAttributes = configItem.skipEmptyFeatureAttributes;
resultItem.config = configItem.config;
Expand Down
2 changes: 2 additions & 0 deletions scripts/themesConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ def getTheme(config, configItem, result, resultItem):
resultItem["minSearchScaleDenom"] = configItem["minSearchScale"]
if "themeInfoLinks" in configItem:
resultItem["themeInfoLinks"] = configItem["themeInfoLinks"]
if "layerTreeHiddenSublayers" in configItem:
resultItem["layerTreeHiddenSublayers"] = configItem["layerTreeHiddenSublayers"]
resultItem["searchProviders"] = configItem["searchProviders"] if "searchProviders" in configItem else []
if "additionalMouseCrs" in configItem:
resultItem["additionalMouseCrs"] = configItem["additionalMouseCrs"]
Expand Down
1 change: 1 addition & 0 deletions utils/ThemeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const ThemeUtils = {
printUrl: ThemeUtils.inheritBaseUrlParams(theme.printUrl, theme.url, baseParams),
featureInfoUrl: ThemeUtils.inheritBaseUrlParams(theme.featureInfoUrl, theme.url, baseParams),
infoFormats: theme.infoFormats,
layerTreeHiddenSublayers: theme.layerTreeHiddenSublayers,
externalLayerMap: {
...theme.externalLayerMap,
...(theme.externalLayers || []).reduce((res, cur) => {
Expand Down

0 comments on commit bdff74c

Please sign in to comment.