本文整理汇总了Java中org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo类的典型用法代码示例。如果您正苦于以下问题:Java VectorLayerRasterizingInfo类的具体用法?Java VectorLayerRasterizingInfo怎么用?Java VectorLayerRasterizingInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VectorLayerRasterizingInfo类属于org.geomajas.plugin.rasterizing.command.dto包,在下文中一共展示了VectorLayerRasterizingInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
public void onClick(ClickEvent clickEvent) {
imageUrlService.makeRasterizable(mapWidget);
if (showAllLayers) {
for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
if (layer instanceof VectorLayer) {
VectorLayerRasterizingInfo vectorInfo = (VectorLayerRasterizingInfo) layer.getLayerInfo()
.getWidgetInfo().get(VectorLayerRasterizingInfo.WIDGET_KEY);
vectorInfo.setShowing(true);
} else if (layer instanceof RasterLayer) {
RasterLayerRasterizingInfo rasterInfo = (RasterLayerRasterizingInfo) layer.getLayerInfo()
.getWidgetInfo().get(RasterLayerRasterizingInfo.WIDGET_KEY);
rasterInfo.setShowing(true);
}
}
}
imageUrlService.createImageUrl(mapWidget, new ImageUrlCallback() {
public void onImageUrl(String mapUrl, String legendUrl) {
com.google.gwt.user.client.Window.open(legendUrl, "_blank", null);
}
}, !showAllLayers);
if (showAllLayers) {
imageUrlService.makeRasterizable(mapWidget);
}
}
示例2: prepareMap
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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;
}
示例3: checkOrRender
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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);
}
示例4: testOneVectorLayer
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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);
}
示例5: testTwoVectorLayers
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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);
}
示例6: testDpi
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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);
}
示例7: testGraphics2D
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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));
}
示例8: checkOrRender
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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);
}
示例9: prepareMap
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的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);
}
示例10: execute
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
@Override
public void execute(RasterizeMapRequest request, RasterizeMapResponse response) throws Exception {
ClientMapInfo mapInfo = request.getClientMapInfo();
if (null == mapInfo) {
throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "clientMapInfo");
}
MapRasterizingInfo mapRasterizingInfo = (MapRasterizingInfo) mapInfo
.getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
if (mapRasterizingInfo == null) {
throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapRasterizingInfo");
}
for (ClientLayerInfo clientLayer : mapInfo.getLayers()) {
if (clientLayer instanceof ClientVectorLayerInfo) {
if (null == clientLayer.getWidgetInfo(VectorLayerRasterizingInfo.WIDGET_KEY)) {
throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "vectorLayerRasterizingInfo ("
+ clientLayer.getId() + ")");
}
} else if (clientLayer instanceof ClientRasterLayerInfo) {
if (null == clientLayer.getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY)) {
throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "rasterLayerRasterizingInfo ("
+ clientLayer.getId() + ")");
}
}
}
ByteArrayOutputStream mapStream = new ByteArrayOutputStream(MAP_BUFFER_SIZE);
imageService.writeMap(mapStream, request.getClientMapInfo());
String mapKey = putInCache(mapStream.toByteArray(), mapRasterizingInfo.getBounds());
ByteArrayOutputStream legendStream = new ByteArrayOutputStream(MAP_LEGEND_SIZE);
imageService.writeLegend(legendStream, request.getClientMapInfo());
String legendKey = putInCache(legendStream.toByteArray(), mapRasterizingInfo.getBounds());
// remove last '/' from dispatcher URL
String baseUrl = dispatcherUrlService.getDispatcherUrl().substring(0,
dispatcherUrlService.getDispatcherUrl().length() - 1);
response.setMapKey(mapKey);
response.setMapUrl(baseUrl + RasterizingController.IMAGE_MAPPING + mapKey + ".png");
response.setLegendKey(legendKey);
response.setLegendUrl(baseUrl + RasterizingController.IMAGE_MAPPING + legendKey + ".png");
}
示例11: cloneInfo
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
private VectorLayerRasterizingInfo cloneInfo(VectorLayerRasterizingInfo input) throws GeomajasException {
try {
JBossObjectOutputStream jbossSerializer = new JBossObjectOutputStream(null);
Object obj = jbossSerializer.smartClone(input);
return (VectorLayerRasterizingInfo) obj;
} catch (IOException e) {
// should not happen
throw new GeomajasException(e, ExceptionCode.UNEXPECTED_PROBLEM);
}
}
示例12: getLayerUserData
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
public Map<String, Object> getLayerUserData(MapContext mapContext, ClientLayerInfo clientLayerInfo) {
Map<String, Object> userData = new HashMap<String, Object>();
VectorLayerRasterizingInfo extraInfo = (VectorLayerRasterizingInfo) clientLayerInfo
.getWidgetInfo(VectorLayerRasterizingInfo.WIDGET_KEY);
userData.put(USERDATA_KEY_SHOWING, extraInfo.isShowing());
return userData;
}
示例13: build
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
@Override
public ClientLayerInfo build(MapPresenter mapPresenter, Layer layer, Bbox worldBounds, double resolution) {
VectorServerLayer vectorLayer = (VectorServerLayer) layer;
VectorLayerRasterizingInfo vectorRasterizingInfo = new VectorLayerRasterizingInfo();
vectorRasterizingInfo.setPaintGeometries(true);
vectorRasterizingInfo.setPaintLabels(vectorLayer.isLabeled());
vectorRasterizingInfo.setShowing(layer.isShowing());
ClientVectorLayerInfo layerInfo = (ClientVectorLayerInfo) vectorLayer.getLayerInfo();
vectorRasterizingInfo.setStyle(layerInfo.getNamedStyleInfo());
if (!vectorLayer.getSelectedFeatures().isEmpty()) {
Collection<Feature> selectedFeatures = vectorLayer.getSelectedFeatures();
Iterator<Feature> iterator = selectedFeatures.iterator();
List<String> featureIds = new ArrayList<String>(selectedFeatures.size());
while (iterator.hasNext()) {
Feature feature = iterator.next();
featureIds.add(feature.getId());
}
vectorRasterizingInfo.setSelectedFeatureIds(featureIds.toArray(new String[selectedFeatures.size()]));
ClientMapInfo mapInfo = mapPresenter.getConfiguration().getHintValue(GeomajasServerExtension.MAPINFO);
FeatureStyleInfo selectStyle;
switch (layerInfo.getLayerType()) {
case GEOMETRY:
case LINESTRING:
case MULTILINESTRING:
selectStyle = mapInfo.getLineSelectStyle();
break;
case MULTIPOINT:
case POINT:
selectStyle = mapInfo.getPointSelectStyle();
break;
case MULTIPOLYGON:
case POLYGON:
selectStyle = mapInfo.getPolygonSelectStyle();
break;
default:
throw new IllegalArgumentException("Unknown layer type " + layerInfo.getLayerType());
}
selectStyle.applyDefaults();
RuleInfo selectionRule = StyleUtil.createRule(layerInfo.getLayerType(), selectStyle);
vectorRasterizingInfo.setSelectionRule(selectionRule);
}
layerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorRasterizingInfo);
return layerInfo;
}
示例14: testLegend
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
@Test
public void testLegend() 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());
cl1.setLabel("Blue Marble");
RasterLayerRasterizingInfo rr1 = new RasterLayerRasterizingInfo();
rr1.setCssStyle("opacity:0.5");
cl1.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rr1);
mapInfo.getLayers().add(cl1);
ClientVectorLayerInfo cl2 = new ClientVectorLayerInfo();
cl2.setServerLayerId(layerBeansPoint.getId());
cl2.setLayerInfo(layerBeansPoint.getLayerInfo());
cl2.setLabel(layerBeansPoint.getId());
VectorLayerRasterizingInfo lr2 = new VectorLayerRasterizingInfo();
lr2.setStyle(layerBeansPointStyleInfo);
cl2.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr2);
mapInfo.getLayers().add(cl2);
ClientVectorLayerInfo cl3 = new ClientVectorLayerInfo();
cl3.setServerLayerId(layerBeansMultiLine.getId());
cl3.setLayerInfo(layerBeansMultiLine.getLayerInfo());
cl3.setLabel(layerBeansMultiLine.getId());
VectorLayerRasterizingInfo lr3 = new VectorLayerRasterizingInfo();
lr3.setStyle(layerBeansMultiLineStyleInfo);
cl3.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr3);
mapInfo.getLayers().add(cl3);
LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo();
legendRasterizingInfo.setFont(new FontStyleInfo());
legendRasterizingInfo.getFont().applyDefaults();
legendRasterizingInfo.getFont().setSize(12);
legendRasterizingInfo.getFont().setFamily("Arial");
legendRasterizingInfo.setTitle("legend");
mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo);
new LegendAssert(mapInfo).assertEqualImage("legend.png", writeImages, DELTA);
}
示例15: testLegendDynamic
import org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo; //导入依赖的package包/类
@Test
public void testLegendDynamic() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
// set the bounds so no features are visible
mapRasterizingInfo.setBounds(new Bbox(-180, -90, -170, -80));
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());
cl1.setLabel("Blue Marble");
RasterLayerRasterizingInfo rr1 = new RasterLayerRasterizingInfo();
rr1.setCssStyle("opacity:0.5");
cl1.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rr1);
mapInfo.getLayers().add(cl1);
ClientVectorLayerInfo cl2 = new ClientVectorLayerInfo();
cl2.setServerLayerId(layerBeansPoint.getId());
cl2.setLayerInfo(layerBeansPoint.getLayerInfo());
cl2.setLabel(layerBeansPoint.getId());
VectorLayerRasterizingInfo lr2 = new VectorLayerRasterizingInfo();
lr2.setStyle(layerBeansPointStyleInfo);
cl2.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr2);
mapInfo.getLayers().add(cl2);
ClientVectorLayerInfo cl3 = new ClientVectorLayerInfo();
cl3.setServerLayerId(layerBeansMultiLine.getId());
cl3.setLayerInfo(layerBeansMultiLine.getLayerInfo());
cl3.setLabel(layerBeansMultiLine.getId());
VectorLayerRasterizingInfo lr3 = new VectorLayerRasterizingInfo();
lr3.setStyle(layerBeansMultiLineStyleInfo);
cl3.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr3);
mapInfo.getLayers().add(cl3);
LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo();
legendRasterizingInfo.setFont(new FontStyleInfo());
legendRasterizingInfo.getFont().applyDefaults();
legendRasterizingInfo.getFont().setSize(12);
legendRasterizingInfo.getFont().setFamily("Arial");
legendRasterizingInfo.setTitle("legend");
mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo);
new LegendAssert(mapInfo).assertEqualImage("legend_dynamic.png", writeImages, DELTA);
}