*/
public static IMap drawMap(final DrawMapParameter drawMapParams) throws RenderException {
final DrawMapParameter params = new DrawMapParameter( drawMapParams );
IProgressMonitor monitor = params.monitor;
final Map map = (Map) EcoreUtil.copy((EObject) params.toDraw);
map.getBlackboard().addAll(drawMapParams.toDraw.getBlackboard());
for (int i = 0; i < map.getMapLayers().size(); i++) {
ILayer source = params.toDraw.getMapLayers().get(i);
Layer dest = map.getLayersInternal().get(i);
dest.setFilter(source.getFilter());
dest.getBlackboard().addAll(source.getBlackboard());
}
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
// Load IGeoResources using original map. The new map can't do this because it doesn't have a
// Resource(file) and therefore can't resolve relative URIs
List<ILayer> layers = drawMapParams.toDraw.getMapLayers();
for (ILayer layer : layers) {
layer.getGeoResources();
}
Color background = (Color) map.getBlackboard().get(ProjectBlackboardConstants.MAP__BACKGROUND_COLOR);
params.graphics.setBackground(background);
if (!drawMapParams.transparent) {
params.graphics.clearRect(0, 0, params.destinationSize.width, params.destinationSize.height);
}
List<Layer> layersToRender = params.selectionStyle.handleSelection(map.getLayersInternal());
ProjectUIPlugin
.trace(
ApplicationGIS.class,
"ApplicationGIS.drawMap() beginning rendering of map '" + map.getName() + "'", null); //$NON-NLS-1$ //$NON-NLS-2$
ReferencedEnvelope bounds = (ReferencedEnvelope) params.toDraw.getViewportModel().getBounds();
ReferencedEnvelope boundsCopy = new ReferencedEnvelope(bounds);
RenderContext tools = configureMapForRendering(map, params.destinationSize, params.dpi, params.boundsStrategy, boundsCopy);