本文整理汇总了Java中org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Java VectorLayerRasterizingInfo.setStyle方法的具体用法?Java VectorLayerRasterizingInfo.setStyle怎么用?Java VectorLayerRasterizingInfo.setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geomajas.plugin.rasterizing.command.dto.VectorLayerRasterizingInfo
的用法示例。
在下文中一共展示了VectorLayerRasterizingInfo.setStyle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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));
}
示例7: 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);
}
示例8: 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);
}
示例9: 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;
}
示例10: 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);
}
示例11: 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);
}