* @param boundsStrategy the strategy to use for setting the bounds on the viewport model
* @param baseMapBounds the bounds of the reference map, depending on the boundsStrategy it may be null.
* @return a render context
*/
public static RenderContext configureMapForRendering(Map map, final Dimension destinationSize, final int dpi, BoundsStrategy boundsStrategy, ReferencedEnvelope baseMapBounds) {
RenderManager manager = RenderFactory.eINSTANCE.createRenderManagerViewer();
map.setRenderManagerInternal(manager);
RenderContext tools = new RenderContextImpl();
tools.setMapInternal(map);
tools.setRenderManagerInternal(manager);
ProjectUIPlugin
.trace(
ApplicationGIS.class,
"Firing size changed event. Changing to size: " + destinationSize.width + " by " + destinationSize.height, null); //$NON-NLS-1$ //$NON-NLS-2$
manager.setMapInternal(map);
manager.setMapDisplay(new IMapDisplay(){
public java.awt.Dimension getDisplaySize() {
return new java.awt.Dimension(destinationSize.width,
destinationSize.height);
}
public int getWidth() {
return destinationSize.width;
}
public int getHeight() {
return destinationSize.height;
}
public int getDPI() {
return dpi;
}
});
ViewportModel model = map.getViewportModelInternal();
manager.setViewportModelInternal(model);
model.setCRS(map.getViewportModel().getCRS());
model.zoomToBox(map.getViewportModel().getBounds());
ProjectUIPlugin.trace(ApplicationGIS.class,