Skip to content

Commit

Permalink
Layer selectable even if the group it belongs to is turned off geosol…
Browse files Browse the repository at this point in the history
  • Loading branch information
rowheat02 committed Nov 21, 2024
1 parent e5b153f commit 29d3ab0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ web/docs
debug.log
.vscode/settings.json
site
.DS_Store
36 changes: 36 additions & 0 deletions web/client/epics/__tests__/identify-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,42 @@ describe('identify Epics', () => {
}, state);
});

it('getFeatureInfoOnFeatureInfoClick, no queryable if layer is visible but it"s group is invisible', (done)=>{
// remove previous hook
registerHook('RESOLUTION_HOOK', undefined);
const state = {
map: TEST_MAP_STATE,
mapInfo: {
clickPoint: { latlng: { lat: 36.95, lng: -79.84 } }
},
layers: {
flat: [{
id: "TEST",
name: "TEST",
"title": "TITLE",
type: "wfs",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json',
group: "TEST_GROUP"
}],
groups: [
{
id: "TEST_GROUP",
title: "TEST_GROUP",
visibility: false
}
]
}
};
const sentActions = [featureInfoClick({ latlng: { lat: 36.95, lng: -79.84 } })];
testEpic(getFeatureInfoOnFeatureInfoClick, 2, sentActions, ([a0, a1]) => {
expect(a0.type).toBe(PURGE_MAPINFO_RESULTS);
expect(a1.type).toBe(NO_QUERYABLE_LAYERS);
done();
}, state);

});

it('getFeatureInfoOnFeatureInfoClick WMS', (done) => {
// remove previous hook
registerHook('RESOLUTION_HOOK', undefined);
Expand Down
12 changes: 9 additions & 3 deletions web/client/epics/identify.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
itemIdSelector, overrideParamsSelector, filterNameListSelector,
currentEditFeatureQuerySelector, mapTriggerSelector, enableInfoForSelectedLayersSelector
} from '../selectors/mapInfo';
import { centerToMarkerSelector, getSelectedLayers, layersSelector, queryableLayersSelector, queryableSelectedLayersSelector, selectedNodesSelector } from '../selectors/layers';
import { centerToMarkerSelector, getSelectedLayers, layersSelector, queryableLayersSelector, queryableSelectedLayersSelector, rawGroupsSelector, selectedNodesSelector } from '../selectors/layers';
import { modeSelector, getAttributeFilters, isFeatureGridOpen } from '../selectors/featuregrid';
import { spatialFieldSelector } from '../selectors/queryform';
import { mapSelector, projectionDefsSelector, projectionSelector, isMouseMoveIdentifyActiveSelector } from '../selectors/map';
Expand All @@ -64,6 +64,7 @@ const stopFeatureInfo = state => stopGetFeatureInfoSelector(state) || isFeatureG
import {getFeatureInfo} from '../api/identify';
import { VISUALIZATION_MODE_CHANGED } from '../actions/maptype';
import {updatePointWithGeometricFilter} from "../utils/IdentifyUtils";
import { getDerivedLayersVisibility } from '../utils/LayersUtils';

/**
* Epics for Identify and map info
Expand All @@ -76,14 +77,19 @@ import {updatePointWithGeometricFilter} from "../utils/IdentifyUtils";
export const getFeatureInfoOnFeatureInfoClick = (action$, { getState = () => { } }) =>
action$.ofType(FEATURE_INFO_CLICK)
.switchMap(({ point, filterNameList = [], overrideParams = {}, ignoreVisibilityLimits }) => {
const groups = rawGroupsSelector(getState());

// ignoreVisibilityLimits is for ignore limits of layers visibility
// Reverse - To query layer in same order as in TOC
let queryableLayers = ignoreVisibilityLimits ? reverse([...layersSelector(getState())].filter(l=>defaultQueryableFilter(l))) : reverse(queryableLayersSelector(getState()));
const queryableSelectedLayers = ignoreVisibilityLimits ? [...getSelectedLayers(getState())].filter(l => defaultQueryableFilter(l)) : queryableSelectedLayersSelector(getState());
let queryableLayers = ignoreVisibilityLimits ? reverse(getDerivedLayersVisibility([...layersSelector(getState())], groups).filter(l=>defaultQueryableFilter(l))) : reverse(getDerivedLayersVisibility(queryableLayersSelector(getState()), groups));
const queryableSelectedLayers = ignoreVisibilityLimits ? getDerivedLayersVisibility([...getSelectedLayers(getState())].filter(l => defaultQueryableFilter(l)), groups) : getDerivedLayersVisibility(queryableSelectedLayersSelector(getState()), groups);
const enableInfoForSelectedLayers = enableInfoForSelectedLayersSelector(getState());
if (enableInfoForSelectedLayers && queryableSelectedLayers.length) {
queryableLayers = queryableSelectedLayers;
}
// remove invisible layers, visible layer with invisible group already converted to invisible layer using getDerivedLayersVisibility
queryableLayers = queryableLayers.filter(l=>l.visibility);


const selectedLayers = selectedNodesSelector(getState());

Expand Down

0 comments on commit 29d3ab0

Please sign in to comment.