-
Notifications
You must be signed in to change notification settings - Fork 400
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
Fix #1392 added viewport into spatial filter list #1822
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
/* | ||
* Copyright 2016, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
|
@@ -103,12 +103,11 @@ function createQuery(searchUrl, filterObj) { | |
}; | ||
} | ||
|
||
function query(searchUrl, filterObj, retry) { | ||
function query(searchUrl, filterObj) { | ||
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. is retry not used? 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. nope, it's been removed in getFeatures method of DockerFeatureGrid component |
||
return { | ||
type: QUERY, | ||
searchUrl, | ||
filterObj, | ||
retry | ||
filterObj | ||
}; | ||
} | ||
|
||
|
@@ -147,28 +146,18 @@ function closeResponse() { | |
} | ||
|
||
module.exports = { | ||
FEATURE_TYPE_SELECTED, | ||
FEATURE_TYPE_LOADED, | ||
FEATURE_TYPE_SELECTED, featureTypeSelected, | ||
FEATURE_TYPE_LOADED, featureTypeLoaded, | ||
FEATURE_TYPE_ERROR, featureTypeError, | ||
FEATURE_ERROR, featureError, | ||
FEATURE_CLOSE, featureClose, | ||
QUERY_CREATE, createQuery, | ||
QUERY_RESULT, querySearchResponse, | ||
QUERY_ERROR, queryError, | ||
RESET_QUERY, resetQuery, | ||
QUERY, query, | ||
FEATURE_LOADED, | ||
FEATURE_TYPE_ERROR, | ||
FEATURE_ERROR, | ||
FEATURE_CLOSE, | ||
QUERY_CREATE, | ||
QUERY_RESULT, | ||
QUERY_ERROR, | ||
RESET_QUERY, | ||
QUERY, | ||
featureTypeSelected, | ||
featureTypeLoaded, | ||
featureTypeError, | ||
featureError, | ||
loadFeature, | ||
createQuery, | ||
query, | ||
featureClose, | ||
resetQuery, | ||
toggleQueryPanel, | ||
closeResponse, | ||
queryError, | ||
querySearchResponse | ||
closeResponse | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ const QueryBuilder = React.createClass({ | |
onChangeDrawingStatus: () => {}, | ||
onRemoveSpatialSelection: () => {}, | ||
onShowSpatialSelectionDetails: () => {}, | ||
onSelectViewportSM: () => {}, | ||
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. don't be shy |
||
onEndDrawing: () => {}, | ||
onChangeDwithinValue: () => {} | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
|
||
const Rx = require('rxjs'); | ||
const axios = require('../libs/ajax'); | ||
const {changeSpatialAttribute} = require('../actions/queryform'); | ||
const {changeSpatialAttribute, SELECT_VIEWPORT_SPATIAL_METHOD, updateGeometrySpatialField} = require('../actions/queryform'); | ||
const {CHANGE_MAP_VIEW} = require('../actions/map'); | ||
const {FEATURE_TYPE_SELECTED, QUERY, featureTypeLoaded, featureTypeError, createQuery, querySearchResponse, queryError, featureClose} = require('../actions/wfsquery'); | ||
const FilterUtils = require('../utils/FilterUtils'); | ||
const assign = require('object-assign'); | ||
|
@@ -227,6 +228,33 @@ const closeFeatureEpic = action$ => | |
return action.control && action.control === 'drawer' ? Rx.Observable.of(featureClose()) : Rx.Observable.empty(); | ||
}); | ||
|
||
function validateExtent(extent) { | ||
if (extent[0] <= -180.0 || extent[2] >= 180.0) { | ||
extent[0] = -180.0; | ||
extent[2] = 180.0; | ||
} | ||
return extent; | ||
} | ||
const viewportSelectedEpic = (action$, store) => | ||
action$.ofType(SELECT_VIEWPORT_SPATIAL_METHOD, CHANGE_MAP_VIEW) | ||
.switchMap((action) => { | ||
// calculate new geometry from map properties | ||
const map = action.type === CHANGE_MAP_VIEW ? action : store.getState().map.present; | ||
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. are you updating the geometry also if the spatial filter is not Viewport? |
||
const bounds = Object.keys(map.bbox.bounds).reduce((p, c) => { | ||
return assign({}, p, {[c]: parseFloat(map.bbox.bounds[c])}); | ||
}, {}); | ||
const extent = validateExtent([bounds.minx, bounds.miny, bounds.maxx, bounds.maxy]); | ||
const center = [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2]; | ||
const start = [extent[0], extent[1]]; | ||
const end = [extent[2], extent[3]]; | ||
const coordinates = [[start, [start[0], end[1]], end, [end[0], start[1]], start]]; | ||
let geometry = { | ||
type: "Polygon", radius: 0, projection: "EPSG:4326", | ||
extent, center, coordinates | ||
}; | ||
return Rx.Observable.of(updateGeometrySpatialField(geometry)); | ||
}); | ||
|
||
/** | ||
* Epics for WFS query requests | ||
* @name epics.wfsquery | ||
|
@@ -236,5 +264,6 @@ const closeFeatureEpic = action$ => | |
module.exports = { | ||
featureTypeSelectedEpic, | ||
wfsQueryEpic, | ||
closeFeatureEpic | ||
closeFeatureEpic, | ||
viewportSelectedEpic | ||
}; |
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.
don't be shy, selectViewportSpatialMethod