private RenderExecutorComposite createRenderExecutor(ReferencedEnvelope bounds) {
checkState();
CompositeRendererImpl renderer = (CompositeRendererImpl)RenderFactory.eINSTANCE.createTiledCompositeRenderer();
CompositeRenderContext context = new CompositeRenderContextImpl() {
@Override
public synchronized BufferedImage getImage(int width, int height) {
if (image == null || image.getWidth() < width
|| image.getHeight() < height) {
image = new BufferedImage(width, height,
BufferedImage.TYPE_3BYTE_BGR);
Graphics2D g = image.createGraphics();
g.setBackground(Color.WHITE);
g.clearRect(0, 0, width, height);
g.dispose();
}
return image;
}
@Override
public synchronized void clearImage(Rectangle paintArea) {
if (image == null)
return;
Graphics2D g = image.createGraphics();
g.setBackground(Color.WHITE);
g.clearRect(paintArea.x, paintArea.y, paintArea.width,
paintArea.height);
g.dispose();
}
};
context.setMapInternal(getMapInternal());
context.setRenderManagerInternal(this);
context.setImageBounds(bounds);
context.setImageSize(new Dimension(getTileSize(), getTileSize()));
((CompositeRenderContextImpl)context).setLabelPainterLocal(new UDIGLabelCache(new LabelCacheImpl()));
renderer.setContext(context);
renderer.setName(Messages.RenderManagerDynamic_allLayers);