*/
protected Query adaptQuery(Query query, SimpleFeatureType schema) throws IOException {
// if needed, reproject the filter to the native srs
Query newQuery = makeDefinitionQuery(query, schema);
// // see if the CRS got xfered over
// // a. old had a CRS, new doesnt
// boolean requireXferCRS = (newQuery.getCoordinateSystem() == null)
// && (query.getCoordinateSystem() != null);
//
// if ((newQuery.getCoordinateSystem() != null) && (query.getCoordinateSystem() != null)) {
// //b. both have CRS, but they're different
// requireXferCRS = !(newQuery.getCoordinateSystem().equals(query.getCoordinateSystem()));
// }
//
// if (requireXferCRS) {
// //carry along the CRS
// if (!(newQuery instanceof DefaultQuery)) {
// newQuery = new DefaultQuery(newQuery);
// }
//
// ((DefaultQuery) newQuery).setCoordinateSystem(query.getCoordinateSystem());
// }
//JD: this is a huge hack... but its the only way to ensure that we
// we get what we ask for ... which is not reprojection, since
// datastores are unreliable in this aspect we dont know if they will
// reproject or not.
// AA: added force coordinate system reset as well, since we cannot
// trust GT2 datastores there neither.
if ( newQuery.getCoordinateSystemReproject() != null ) {
((DefaultQuery)newQuery).setCoordinateSystemReproject(null);
}
if ( newQuery.getCoordinateSystem() != null ) {
((DefaultQuery)newQuery).setCoordinateSystem(null);
}
return newQuery;
}