-
Notifications
You must be signed in to change notification settings - Fork 405
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
Showing spatial filter selection area when FeatureGrid is open #2906
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
41bbb25
Task #46: implemented configuration for enabling/disabling visibility…
Mloweedgar 2f24d35
Task #46: showing spatial filter selection area when featuregrid is open
Mloweedgar 2778e30
Task #46: adding tests for show spacial filter selection logic
Mloweedgar b451a05
Task #46: fixed minor errors in showing spatial filter selection area
Mloweedgar 7c234f1
Task #46: uncommenting test in the feature grid reducer test
Mloweedgar 168995b
Task #46: fixed error on query panel search when spatial filter is no…
Mloweedgar 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,7 +1,53 @@ | ||
const {get} = require('lodash'); | ||
const {createSelector} = require('reselect'); | ||
const {reprojectGeoJson} = require('../utils/CoordinatesUtils'); | ||
|
||
const selectedFeatures = (state) => get(state, state && state.highlight && state.highlight.featuresPath || "highlight.emptyFeatures"); | ||
const filteredspatialObject = (state) => get(state, state && state.featuregrid.open && state.featuregrid.showFilteredObject && "query.filterObj.spatialField" || "emptyObject"); | ||
const filteredGeometry = (state) => filteredspatialObject(state) && filteredspatialObject(state).geometry; | ||
const filteredspatialObjectType = (state) => filteredGeometry(state) && filteredGeometry(state).type || "Polygon"; | ||
const filteredspatialObjectCoord = (state) => filteredGeometry(state) && filteredGeometry(state).coordinates || []; | ||
const filteredSpatialObjectCrs = (state) => filteredGeometry(state) && filteredGeometry(state).projection || "EPSG:3857"; | ||
const filteredSpatialObjectId = (state) => filteredGeometry(state) && filteredGeometry(state).id || "spatial_object"; | ||
const filteredFeatures = createSelector( | ||
[ | ||
filteredspatialObjectCoord, | ||
filteredspatialObjectType, | ||
filteredSpatialObjectId, | ||
filteredSpatialObjectCrs | ||
], | ||
( geometryCoordinates, geometryType, geometryId, geometryCrs) => { | ||
let geometry = { | ||
type: "FeatureCollection", | ||
features: [ | ||
{ | ||
type: "Feature", | ||
geometry: { | ||
type: geometryType, | ||
coordinates: geometryCoordinates | ||
}, | ||
style: { | ||
fillColor: 'rgba(255, 255, 255, 0.2)', | ||
color: '#ffcc33' | ||
}, | ||
id: geometryId | ||
} | ||
] | ||
}; | ||
return geometryCoordinates.length > 0 && geometryType ? reprojectGeoJson(geometry, geometryCrs, 'EPSG:4326').features : []; | ||
} | ||
|
||
module.exports = { | ||
selectedFeatures: (state) => get(state, state && state.highlight && state.highlight.featuresPath || "highlight.emptyFeatures") | ||
); | ||
|
||
const highlighedFeatures = createSelector( | ||
[ | ||
filteredFeatures, | ||
selectedFeatures | ||
], | ||
(featuresFiltered, featuresSelected) => [ ...featuresSelected, ...featuresFiltered] | ||
); | ||
|
||
module.exports = { | ||
selectedFeatures, filteredFeatures, filteredSpatialObjectId, filteredSpatialObjectCrs, filteredspatialObjectCoord, | ||
filteredspatialObjectType, filteredGeometry, filteredspatialObject, highlighedFeatures | ||
}; |
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.
Document this prop in jsdoc