// now, if a definition query has been established for this layer,
// be sure to respect it by combining it with the bounding box one.
q = DataUtilities.mixQueries(q, layer.getQuery(), "KMLEncoder");
// check the regionating strategy
RegionatingStrategy regionatingStrategy = null;
String stratname = (String) mapContent.getRequest().getFormatOptions().get("regionateBy");
if (("auto").equals(stratname)) {
Catalog catalog = wms.getGeoServer().getCatalog();
Name name = layer.getFeatureSource().getName();
stratname = catalog.getFeatureTypeByName(name).getMetadata()
.get("kml.regionateStrategy", String.class);
if (stratname == null || "".equals(stratname)) {
stratname = "best_guess";
LOGGER.log(Level.FINE, "No default regionating strategy has been configured in "
+ name + "; using automatic best-guess strategy.");
}
}
Filter regionatingFilter = Filter.INCLUDE;
if (stratname != null) {
regionatingStrategy = findStrategyByName(stratname);
// if a strategy was specified but we did not find it, let the user
// know
if (regionatingStrategy == null) {
throw new ServiceException("Unknown regionating strategy " + stratname);
} else {
regionatingFilter = regionatingStrategy.getFilter(mapContent, layer);
}
}
// try to load less features by leveraging regionating strategy and the SLD
Filter ruleFilter = getStyleFilter(schema, layer.getStyle(), scaleDenominator);