@Override public void render(PdfContext context) { try { bbox = createBbox(); MapRasterizingInfo mapRasterizingInfo = (MapRasterizingInfo) clientMapInfo .getWidgetInfo(MapRasterizingInfo.WIDGET_KEY); mapRasterizingInfo.setBounds(new Bbox(bbox.getMinX(), bbox.getMinY(), bbox.getWidth(), bbox.getHeight())); mapRasterizingInfo.setScale(getMap().getPpUnit()); Graphics2D graphics = context.getGraphics2D(getBounds()); imageService.writeMap(graphics, clientMapInfo); graphics.dispose(); } catch (Exception e) { log.warn("Failed to render rasterized layers", e); } super.render(context); }
protected MapRasterizingInfo buildMap(MapPresenter mapPresenter) { MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo(); ViewPort viewPort = mapPresenter.getViewPort(); mapRasterizingInfo.setBounds(viewPort.getBounds()); mapRasterizingInfo.setScale(viewPort.getScale()); mapRasterizingInfo.setTransparent(true); LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo(); legendRasterizingInfo.setTitle("Legend"); FontStyleInfo font = new FontStyleInfo(); font.applyDefaults(); legendRasterizingInfo.setFont(font); mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo); // Support for selection of layer object : create container for info on selected features; // store the selections layer per layer List<ClientLayerInfo> selectedLayers = new ArrayList<ClientLayerInfo>(); mapRasterizingInfo.setExtraLayers(selectedLayers); ClientMapInfo mapInfo = mapPresenter.getConfiguration().getServerConfiguration(); mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo); // Note: mapRasterizingInfo at this time is pretty empty (rastering info for // layers not yet filled in) return mapRasterizingInfo; }
private MapRasterizingInfo buildMap(MapPresenter mapPresenter) { MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo(); ViewPort viewPort = mapPresenter.getViewPort(); mapRasterizingInfo.setBounds(viewPort.getBounds()); mapRasterizingInfo.setScale(1 / viewPort.getResolution()); mapRasterizingInfo.setTransparent(true); LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo(); legendRasterizingInfo.setTitle("Legend"); FontStyleInfo font = new FontStyleInfo(); font.applyDefaults(); legendRasterizingInfo.setFont(font); mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo); // Support for selection of layer object : create container for info on selected features; // store the selections layer per layer List<ClientLayerInfo> selectedLayers = new ArrayList<ClientLayerInfo>(); mapRasterizingInfo.setExtraLayers(selectedLayers); ClientMapInfo mapInfo = mapPresenter.getConfiguration().getHintValue(GeomajasServerExtension.MAPINFO); mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo); // Note: mapRasterizingInfo at this time is pretty empty (rastering info for // layers not yet filled in) return mapRasterizingInfo; }
mapRasterizingInfo.setScale(scale); imageService.writeMap(stream, request.getClientMapInfo()); container.setMapImageData(stream.toByteArray());