本文整理汇总了Java中org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo类的典型用法代码示例。如果您正苦于以下问题:Java MapRasterizingInfo类的具体用法?Java MapRasterizingInfo怎么用?Java MapRasterizingInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapRasterizingInfo类属于org.geomajas.plugin.rasterizing.command.dto包,在下文中一共展示了MapRasterizingInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMap
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
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;
}
示例2: render
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@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);
}
示例3: execute
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
public void execute(PipelineContext context, RasterizingContainer response) throws GeomajasException {
MapContext mapContext = context.get(RasterizingPipelineCode.MAP_CONTEXT_KEY, MapContext.class);
RenderingHints renderingHints = context.get(RasterizingPipelineCode.RENDERING_HINTS, RenderingHints.class);
@SuppressWarnings("unchecked")
Map<Object, Object> rendererHints = context.get(RasterizingPipelineCode.RENDERER_HINTS, Map.class);
Rectangle paintArea = mapContext.getViewport().getScreenArea();
MapRasterizingInfo mapRasterizingInfo = (MapRasterizingInfo) mapContext.getUserData().get(
LayerFactory.USERDATA_RASTERIZING_INFO);
Graphics2D graphics = context.getOptional(RasterizingPipelineCode.GRAPHICS_2D, Graphics2D.class);
if (graphics != null) {
renderingService.paintMap(mapContext, graphics, rendererHints);
} else {
BufferedImage image = createImage(paintArea.width, paintArea.height, mapRasterizingInfo.isTransparent());
graphics = getGraphics(image, mapRasterizingInfo.isTransparent(), renderingHints);
renderingService.paintMap(mapContext, graphics, rendererHints);
context.put(RasterizingPipelineCode.RENDERED_IMAGE, image);
}
}
示例4: prepareMap
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
private ClientMapInfo prepareMap(GetTileContainer tileContainer, TileMetadata tileMetadata, NamedStyleInfo style) {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(converterService.toDto(tileContainer.getTile().getBounds()));
mapInfo.setCrs(tileMetadata.getCrs());
mapRasterizingInfo.setScale(tileMetadata.getScale());
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientVectorLayerInfo = new ClientVectorLayerInfo();
clientVectorLayerInfo.setServerLayerId(tileMetadata.getLayerId());
clientVectorLayerInfo.setNamedStyleInfo(style);
VectorLayerRasterizingInfo vectorLayerRasterizingInfo = new VectorLayerRasterizingInfo();
vectorLayerRasterizingInfo.setFilter(tileMetadata.getFilter());
vectorLayerRasterizingInfo.setPaintGeometries(tileMetadata.isPaintGeometries());
vectorLayerRasterizingInfo.setPaintLabels(tileMetadata.isPaintLabels());
vectorLayerRasterizingInfo.setFilter(tileMetadata.getFilter());
vectorLayerRasterizingInfo.setStyle(style);
clientVectorLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorLayerRasterizingInfo);
mapInfo.getLayers().add(clientVectorLayerInfo);
return mapInfo;
}
示例5: callPipeline
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
private RasterizingContainer callPipeline(ClientMapInfo clientMapInfo, PipelineContext context, String pipelineKey)
throws GeomajasException {
DefaultMapContext mapContext = new DefaultMapContext();
mapContext.setCoordinateReferenceSystem(geoService.getCrs2(clientMapInfo.getCrs()));
MapRasterizingInfo mapInfo = (MapRasterizingInfo) clientMapInfo.getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
mapContext.setAreaOfInterest(new ReferencedEnvelope(dtoConverterService.toInternal(mapInfo.getBounds()),
mapContext.getCoordinateReferenceSystem()));
RenderingHints renderingHints = new Hints();
renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
RasterizingContainer response = new RasterizingContainer();
context.put(RasterizingPipelineCode.CLIENT_MAP_INFO_KEY, clientMapInfo);
context.put(RasterizingPipelineCode.RENDERING_HINTS, renderingHints);
Map<Object, Object> rendererHints = new HashMap<Object, Object>();
if (mapInfo.getDpi() > 0) {
rendererHints.put(StreamingRenderer.DPI_KEY, mapInfo.getDpi());
}
context.put(RasterizingPipelineCode.RENDERER_HINTS, rendererHints);
context.put(RasterizingPipelineCode.MAP_CONTEXT_KEY, mapContext);
pipelineService.execute(pipelineKey, null, context, response);
mapContext.dispose();
return response;
}
示例6: checkOrRender
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
protected void checkOrRender(String fileName, boolean paintLabels, boolean paintGeometries, VectorLayer layer,
NamedStyleInfo styleInfo, Bbox box) throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(box);
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientVectorLayerInfo = new ClientVectorLayerInfo();
clientVectorLayerInfo.setVisible(true);
clientVectorLayerInfo.setServerLayerId(layer.getId());
clientVectorLayerInfo.setNamedStyleInfo(styleInfo);
VectorLayerRasterizingInfo vectorLayerRasterizingInfo = new VectorLayerRasterizingInfo();
vectorLayerRasterizingInfo.setPaintGeometries(true);
vectorLayerRasterizingInfo.setPaintLabels(true);
vectorLayerRasterizingInfo.setStyle(styleInfo);
clientVectorLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorLayerRasterizingInfo);
mapInfo.getLayers().add(clientVectorLayerInfo);
new MapAssert(mapInfo).assertEqualImage(fileName, writeImages, DELTA);
}
示例7: testOneVectorLayer
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@Test
public void testOneVectorLayer() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientBeansPointLayerInfo = new ClientVectorLayerInfo();
clientBeansPointLayerInfo.setServerLayerId(layerBeansPoint.getId());
VectorLayerRasterizingInfo layerRasterizingInfo = new VectorLayerRasterizingInfo();
layerRasterizingInfo.setStyle(layerBeansPointStyleInfo);
clientBeansPointLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, layerRasterizingInfo);
mapInfo.getLayers().add(clientBeansPointLayerInfo);
new MapAssert(mapInfo).assertEqualImage("onevector.png", writeImages, DELTA);
}
示例8: testTwoVectorLayers
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@Test
public void testTwoVectorLayers() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo cl1 = new ClientVectorLayerInfo();
cl1.setServerLayerId(layerBeansPoint.getId());
VectorLayerRasterizingInfo lr1 = new VectorLayerRasterizingInfo();
lr1.setStyle(layerBeansPointStyleInfo);
cl1.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr1);
mapInfo.getLayers().add(cl1);
ClientVectorLayerInfo cl2 = new ClientVectorLayerInfo();
cl2.setServerLayerId(layerBeansMultiLine.getId());
VectorLayerRasterizingInfo lr2 = new VectorLayerRasterizingInfo();
lr2.setStyle(layerBeansMultiLineStyleInfo);
cl2.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr2);
mapInfo.getLayers().add(cl2);
new MapAssert(mapInfo).assertEqualImage("twovector.png", writeImages, DELTA);
}
示例9: testDpi
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@Test
public void testDpi() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
mapInfo.setCrs("EPSG:4326");
// increase scale by factor 5
mapRasterizingInfo.setScale(5);
// increase dpi accordingly so labels stay the same size
mapRasterizingInfo.setDpi(96*5);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientBeansPointLayerInfo = new ClientVectorLayerInfo();
clientBeansPointLayerInfo.setServerLayerId(layerBeansPoint.getId());
VectorLayerRasterizingInfo layerRasterizingInfo = new VectorLayerRasterizingInfo();
layerRasterizingInfo.setStyle(layerBeansPointStyleInfo);
clientBeansPointLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, layerRasterizingInfo);
mapInfo.getLayers().add(clientBeansPointLayerInfo);
new MapAssert(mapInfo).assertEqualImage("dpi.png", writeImages, DELTA);
}
示例10: testGraphics2D
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@Test
public void testGraphics2D() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientBeansPointLayerInfo = new ClientVectorLayerInfo();
clientBeansPointLayerInfo.setServerLayerId(layerBeansPoint.getId());
VectorLayerRasterizingInfo layerRasterizingInfo = new VectorLayerRasterizingInfo();
layerRasterizingInfo.setStyle(layerBeansPointStyleInfo);
clientBeansPointLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, layerRasterizingInfo);
mapInfo.getLayers().add(clientBeansPointLayerInfo);
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
RenderingHints renderingHints = new Hints();
renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Graphics2D graphics2d = image.createGraphics();
graphics2d.setRenderingHints(renderingHints);
imageService.writeMap(graphics2d, mapInfo);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
imageService.writeMap(baos, mapInfo);
BufferedImage image2 = ImageIO.read(new ByteArrayInputStream(baos.toByteArray()));
Assert.assertArrayEquals(image2.getRGB(0, 0, 100, 100, null, 0, 100),image.getRGB(0, 0, 100, 100, null, 0, 100));
}
示例11: testGeometry
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@Test
public void testGeometry() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientGeometryLayerInfo geo = new ClientGeometryLayerInfo();
Geometry point = new Geometry(Geometry.POINT, 4326, 5);
point.setCoordinates(new Coordinate[] { new Coordinate(20, 50) });
geo.getGeometries().add(point);
geo.setStyle(styleConverterService.convert(layerBeansPointStyleInfo, GeometryDirectLayer.DEFAULT_GEOMETRY_NAME));
geo.setLayerType(LayerType.POINT);
mapInfo.getLayers().add(geo);
new MapAssert(mapInfo).assertEqualImage("geometry.png", writeImages, DELTA);
}
示例12: testOneRasterLayer
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
@Test
public void testOneRasterLayer() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-180, -90, 360, 180));
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(2);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientRasterLayerInfo cl1 = new ClientRasterLayerInfo();
cl1.setServerLayerId(layerBluemarble.getId());
RasterLayerRasterizingInfo rr1 = new RasterLayerRasterizingInfo();
rr1.setCssStyle("opacity:0.5");
cl1.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rr1);
mapInfo.getLayers().add(cl1);
new MapAssert(mapInfo).assertEqualImage("oneraster.png", writeImages, DELTA);
}
示例13: checkOrRender
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
private void checkOrRender(String fileName, boolean paintLabels, boolean paintGeometries, VectorLayer layer,
NamedStyleInfo styleInfo, Bbox box) throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(box);
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientVectorLayerInfo = new ClientVectorLayerInfo();
clientVectorLayerInfo.setVisible(true);
clientVectorLayerInfo.setServerLayerId(layer.getId());
clientVectorLayerInfo.setNamedStyleInfo(styleInfo);
VectorLayerRasterizingInfo vectorLayerRasterizingInfo = new VectorLayerRasterizingInfo();
vectorLayerRasterizingInfo.setPaintGeometries(true);
vectorLayerRasterizingInfo.setPaintLabels(true);
vectorLayerRasterizingInfo.setStyle(styleInfo);
clientVectorLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorLayerRasterizingInfo);
mapInfo.getLayers().add(clientVectorLayerInfo);
new MapAssert(mapInfo).assertEqualImage(fileName, writeImages, DELTA);
}
示例14: createWidgetPrintLayers
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
private void createWidgetPrintLayers(MapPresenter mapPresenter, MapRasterizingInfo mapRasterizingInfo,
Bbox worldBounds, double rasterResolution) {
AbsolutePanel mapPresenterAsAbsolutePanel = ((AbsolutePanel) mapPresenter.asWidget());
for (int i = 0 ; i < mapPresenterAsAbsolutePanel.getWidgetCount(); i++) {
Widget widget = mapPresenterAsAbsolutePanel.getWidget(i);
for (PrintableWidgetLayerBuilder widgetLayerPrintBuilder : getWidgetLayerBuilders()) {
if (widgetLayerPrintBuilder.supports(widget)) {
mapRasterizingInfo.getExtraLayers().add(
widgetLayerPrintBuilder.build(mapPresenter, widget, worldBounds, rasterResolution));
break;
}
}
}
}
示例15: prepareMap
import org.geomajas.plugin.rasterizing.command.dto.MapRasterizingInfo; //导入依赖的package包/类
private void prepareMap() {
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
mapRasterizingInfo.setTransparent(true);
mapRasterizingInfo.setDpi(96);
for (ClientLayerInfo clientLayerInfo : mapInfo.getLayers()) {
if (clientLayerInfo instanceof ClientVectorLayerInfo) {
ClientVectorLayerInfo vectorLayerInfo = (ClientVectorLayerInfo) clientLayerInfo;
VectorLayerRasterizingInfo vectorLayerRasterizingInfo = new VectorLayerRasterizingInfo();
vectorLayerRasterizingInfo.setPaintGeometries(true);
vectorLayerRasterizingInfo.setStyle(vectorLayerInfo.getNamedStyleInfo());
vectorLayerRasterizingInfo.setShowing(true);
vectorLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorLayerRasterizingInfo);
} else if (clientLayerInfo instanceof ClientRasterLayerInfo) {
ClientRasterLayerInfo rasterLayerInfo = (ClientRasterLayerInfo) clientLayerInfo;
RasterLayerRasterizingInfo rasterLayerRasterizingInfo = new RasterLayerRasterizingInfo();
rasterLayerRasterizingInfo.setCssStyle(rasterLayerInfo.getStyle());
rasterLayerRasterizingInfo.setShowing(true);
rasterLayerInfo.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rasterLayerRasterizingInfo);
}
}
LegendRasterizingInfo legend = new LegendRasterizingInfo();
FontStyleInfo fontStyleInfo = new FontStyleInfo();
fontStyleInfo.applyDefaults();
legend.setFont(fontStyleInfo);
legend.setTitle("test");
legend.setWidth(100);
legend.setHeight(500);
mapRasterizingInfo.setLegendRasterizingInfo(legend);
}