-
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 5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,7 @@ class MapPlugin extends React.Component { | |
key={feature.id} | ||
crs={projection} | ||
type={feature.type} | ||
style={feature.style || null } | ||
geometry={feature.geometry}/>); | ||
})} | ||
</plugins.Layer>); | ||
|
@@ -316,16 +317,54 @@ class MapPlugin extends React.Component { | |
const {mapSelector, projectionDefsSelector} = require('../selectors/map'); | ||
const { mapTypeSelector } = require('../selectors/maptype'); | ||
const {layerSelectorWithMarkers} = require('../selectors/layers'); | ||
const {selectedFeatures} = require('../selectors/highlight'); | ||
const {selectedFeatures, filteredspatialObjectCoord, filteredspatialObjectType, filteredSpatialObjectCrs, filteredSpatialObjectId} = require('../selectors/highlight'); | ||
const {securityTokenSelector} = require('../selectors/security'); | ||
const {reprojectGeoJson} = require('../utils/CoordinatesUtils'); | ||
|
||
const filteredFeatures = createSelector( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this into the selectors/highlight file |
||
[ | ||
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 : []; | ||
} | ||
|
||
); | ||
|
||
const getFeatures = createSelector( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move also this. Export is as "highlighedFeatures" |
||
[ | ||
filteredFeatures, | ||
selectedFeatures | ||
], | ||
(featuresFiltered, featuresSelected) => [ ...featuresSelected, ...featuresFiltered] | ||
); | ||
const selector = createSelector( | ||
[ | ||
projectionDefsSelector, | ||
mapSelector, | ||
mapTypeSelector, | ||
layerSelectorWithMarkers, | ||
selectedFeatures, | ||
getFeatures, | ||
(state) => state.mapInitialConfig && state.mapInitialConfig.loadingError && state.mapInitialConfig.loadingError.data, | ||
securityTokenSelector, | ||
(state) => state.mousePosition && state.mousePosition.enabled | ||
|
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,14 @@ | ||
const {get} = require('lodash'); | ||
|
||
const filteredspatialObject = state => get(state, state && state.featuregrid.open && state.featuregrid.showFilteredObject && "query.filterObj.spatialField" || "emptyObject"); | ||
const filteredGeometry = state => filteredspatialObject(state) && filteredspatialObject(state).geometry; | ||
|
||
module.exports = { | ||
selectedFeatures: (state) => get(state, state && state.highlight && state.highlight.featuresPath || "highlight.emptyFeatures") | ||
selectedFeatures: (state) => get(state, state && state.highlight && state.highlight.featuresPath || "highlight.emptyFeatures"), | ||
filteredspatialObjectType: (state) => filteredspatialObject(state) && filteredGeometry(state).type || "Polygon", | ||
filteredspatialObjectCoord: (state) => filteredGeometry(state) && filteredGeometry(state).coordinates || [], | ||
filteredSpatialObjectCrs: (state) => filteredGeometry(state) && filteredGeometry(state).projection || "EPSG:3857", | ||
filteredSpatialObjectId: (state) => filteredGeometry(state) && filteredGeometry(state).id || "spatial_object", | ||
filteredspatialObject, | ||
filteredGeometry | ||
|
||
}; |
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