"VectorLayerFactory.createLayer() should only be called using ClientVectorLayerInfo");
}
ClientVectorLayerInfo vectorInfo = (ClientVectorLayerInfo) clientLayerInfo;
VectorLayerRasterizingInfo extraInfo = (VectorLayerRasterizingInfo) vectorInfo
.getWidgetInfo(VectorLayerRasterizingInfo.WIDGET_KEY);
ReferencedEnvelope areaOfInterest = mapContext.getAreaOfInterest();
VectorLayer layer = configurationService.getVectorLayer(vectorInfo.getServerLayerId());
// need to clone the extra info object before changing it !
VectorLayerRasterizingInfo copy = cloneInfo(extraInfo);
// we now replace the style filters by simple filters on an artificial extra style attribute
for (FeatureStyleInfo style : copy.getStyle().getFeatureStyles()) {
style.setFormula(STYLE_INDEX_ATTRIBUTE_NAME + " = " + style.getIndex());
}
// create the style
Style style = styleFactoryService.createStyle(layer, copy);
// estimate the buffer
MetaBufferEstimator estimator = new MetaBufferEstimator();
estimator.visit(style);
int bufferInPixels = estimator.getBuffer();
// expand area to include buffer
Rectangle tileInpix = mapContext.getViewport().getScreenArea();
ReferencedEnvelope metaArea = new ReferencedEnvelope(areaOfInterest);
metaArea.expandBy(bufferInPixels / tileInpix.getWidth() * areaOfInterest.getWidth(),
bufferInPixels / tileInpix.getHeight() * areaOfInterest.getHeight());
// fetch features in meta area
Crs layerCrs = vectorLayerService.getCrs(layer);
Envelope layerBounds = geoService.transform(metaArea, (Crs) areaOfInterest.getCoordinateReferenceSystem(),
layerCrs);