public List<FeatureCollection> identify(FeatureInfoRequestParameters params, int maxFeatures) throws Exception {
LOGGER.log(Level.FINER, "Appliying bbox based feature info identifier");
final MapLayerInfo layer = params.getLayer();
final Filter filter = params.getFilter();
final Style style = params.getStyle();
// ok, internally rendered layer then, we check the style to see what's active
final List<Rule> rules = getActiveRules(style, params.getScaleDenominator());
if (rules.size() == 0) {
return null;
}
// compute the request radius
double radius = getSearchRadius(params, layer, rules);
// compute the bbox for the request
ReferencedEnvelope queryEnvelope = getEnvelopeFilter(params, radius);
CoordinateReferenceSystem requestedCRS = params.getRequestedCRS();
CoordinateReferenceSystem dataCRS = layer.getCoordinateReferenceSystem();
if ((requestedCRS != null) && !CRS.equalsIgnoreMetadata(dataCRS, requestedCRS)) {
if (dataCRS.getCoordinateSystem().getDimension() == 3
&& requestedCRS.getCoordinateSystem().getDimension() == 2) {
queryEnvelope = JTS.transformTo3D(queryEnvelope, dataCRS, true, 10);
} else {
queryEnvelope = queryEnvelope.transform(dataCRS, true);
}
}
final FeatureSource<? extends FeatureType, ? extends Feature> featureSource;
featureSource = layer.getFeatureSource(false);
FeatureType schema = featureSource.getSchema();
Filter getFInfoFilter = null;
FilterFactory2 ff = params.getFilterFactory();
try {
GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
String localName = geometryDescriptor.getLocalName();
Polygon queryPolygon = JTS.toGeometry(queryEnvelope);
getFInfoFilter = ff.intersects(ff.property(localName), ff.literal(queryPolygon));
} catch (IllegalFilterException e) {
e.printStackTrace();
throw new ServiceException("Internal error : " + e.getMessage(), e);
}
// include the eventual layer definition filter
if (filter != null) {
getFInfoFilter = ff.and(getFInfoFilter, filter);
}
// see if we can include the rule filters as well, if too many we'll do them in
// memory
Filter postFilter = Filter.INCLUDE;
Filter rulesFilters = buildRulesFilter(ff, rules);
if (!(featureSource.getSchema() instanceof SimpleFeatureType)
|| !(rulesFilters instanceof Or)
|| (rulesFilters instanceof Or && ((Or) rulesFilters).getChildren().size() <= 20)) {
getFInfoFilter = ff.and(getFInfoFilter, rulesFilters);
} else {
postFilter = rulesFilters;
}
// handle time/elevation
Filter timeElevationFilter = wms.getTimeElevationToFilter(params.getTimes(),
params.getElevations(), layer.getFeature());
getFInfoFilter = Filters.and(ff, getFInfoFilter, timeElevationFilter);
// simplify the filter
SimplifyingFilterVisitor simplifier = new SimplifyingFilterVisitor();
getFInfoFilter = (Filter) getFInfoFilter.accept(simplifier, null);