本文整理了Java中org.geoserver.wms.GetLegendGraphicRequest.setHeight()
方法的一些代码示例,展示了GetLegendGraphicRequest.setHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GetLegendGraphicRequest.setHeight()
方法的具体详情如下:
包路径:org.geoserver.wms.GetLegendGraphicRequest
类名称:GetLegendGraphicRequest
方法名:setHeight
暂无
代码示例来源:origin: org.geoserver/gs-wms
/**
* Ensures the online resource is stored on the GetLegendGraphicRequest and native dimensions
* are configured if not specified on the original request.
*
* @param request GetLegendGraphicRequest original KWP Request
* @param legend LegendRequest internal Class containing references to Resources
* @param legendInfo LegendInfo used to document use external graphic
*/
private void configureLegendInfo(
GetLegendGraphicRequest request, LegendRequest legend, LegendInfo legendInfo) {
legend.setLegendInfo(legendInfo);
if (legendInfo.getHeight() > 0 && !request.getKvp().containsKey("HEIGHT")) {
request.setHeight(legendInfo.getHeight());
}
if (legendInfo.getWidth() > 0 && !request.getKvp().containsKey("WIDTH")) {
request.setWidth(legendInfo.getWidth());
}
}
/**
代码示例来源:origin: robward-scisys/sldeditor
request.setHeight(legendOptionData.getImageHeight());
request.setTransparent(legendOptionData.isTransparent());
request.setStrict(false);
代码示例来源:origin: org.geoserver/gs-wms
/** Tests horizontal layout for vector */
@org.junit.Test
public void testVectorLayersHorizontal() throws Exception {
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
FeatureTypeInfo ftInfo =
getCatalog()
.getFeatureTypeByName(
MockData.ROAD_SEGMENTS.getNamespaceURI(),
MockData.ROAD_SEGMENTS.getLocalPart());
req.setLayer(ftInfo.getFeatureType());
req.setStyle(getCatalog().getStyleByName(MockData.ROAD_SEGMENTS.getLocalPart()).getStyle());
final int HEIGHT_HINT = 20;
req.setHeight(HEIGHT_HINT);
HashMap legendOptions = new HashMap();
legendOptions.put("layout", "horizontal");
legendOptions.put("forceLabels", "off");
req.setLegendOptions(legendOptions);
this.legendProducer.buildLegendGraphic(req);
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
assertEquals(HEIGHT_HINT, image.getHeight());
assertPixel(image, 10, HEIGHT_HINT / 2, new Color(192, 160, 0));
assertPixel(image, 50, HEIGHT_HINT / 2, new Color(224, 64, 0));
}
代码示例来源:origin: org.geoserver/gs-wms
/** Tests that symbols relative sizes are proportional. */
@org.junit.Test
public void testThickPolygonBorder() throws Exception {
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
req.setWidth(20);
req.setHeight(20);
FeatureTypeInfo ftInfo =
getCatalog()
.getFeatureTypeByName(
MockData.MPOINTS.getNamespaceURI(),
MockData.MPOINTS.getLocalPart());
req.setLayer(ftInfo.getFeatureType());
req.setStyle(readSLD("ThickBorder.sld"));
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
assertNotBlank("testThickPolygonBorder", image, LegendUtils.DEFAULT_BG_COLOR);
// thick symbol, there is padding, black thick border, and center
assertPixel(image, 1, 1, new Color(255, 255, 255));
assertPixel(image, 6, 6, new Color(0, 0, 0));
assertPixel(image, 10, 10, new Color(255, 0, 0));
// second symbol, padding, border, green center
assertPixel(image, 1, 21, new Color(255, 255, 255));
// assertPixel(image, 4, 25, new Color(0, 0, 0)); // unsafe, the border is thin here
assertPixel(image, 10, 30, new Color(0, 255, 0));
}
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
/** Tests that symbols relative sizes are proportional. */
@org.junit.Test
public void testThickPolygonAsymmetricSymbol() throws Exception {
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
req.setWidth(40);
req.setHeight(20);
FeatureTypeInfo ftInfo =
getCatalog()
.getFeatureTypeByName(
MockData.MPOINTS.getNamespaceURI(),
MockData.MPOINTS.getLocalPart());
req.setLayer(ftInfo.getFeatureType());
req.setStyle(readSLD("ThickBorder.sld"));
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
assertNotBlank("testThickPolygonBorder", image, LegendUtils.DEFAULT_BG_COLOR);
// thick symbol, there is padding, black thick border, and center
assertPixel(image, 1, 1, new Color(255, 255, 255));
assertPixel(image, 9, 6, new Color(0, 0, 0));
assertPixel(image, 20, 10, new Color(255, 0, 0));
// second symbol, padding, border, green center
assertPixel(image, 1, 23, new Color(255, 255, 255));
// assertPixel(image, 4, 25, new Color(0, 0, 0)); // unsafe, the border is thin here
assertPixel(image, 20, 30, new Color(0, 255, 0));
}
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
HashMap legendOptions = new HashMap();
req.setLegendOptions(legendOptions);
代码示例来源:origin: org.geoserver/gs-wms
/** Tests that symbols relative sizes are proportional. */
@org.junit.Test
public void testSimpleLine() throws Exception {
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
req.setWidth(20);
req.setHeight(20);
FeatureTypeInfo ftInfo =
getCatalog()
.getFeatureTypeByName(
MockData.MPOINTS.getNamespaceURI(),
MockData.MPOINTS.getLocalPart());
req.setLayer(ftInfo.getFeatureType());
req.setStyle(readSLD("line.sld"));
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
assertNotBlank("line", image, LegendUtils.DEFAULT_BG_COLOR);
// line in the middle, but off the middle, it's white
Color colorCenter = getPixelColor(image, 10, 10);
assertColorSimilar(Color.BLUE, colorCenter, 20);
Color colorOutsideCenter = getPixelColor(image, 6, 6);
assertColorSimilar(Color.WHITE, colorOutsideCenter, 20);
}
代码示例来源:origin: org.geoserver/gs-wms
/** Tests that symbols relative sizes are proportional. */
@org.junit.Test
public void testLargeCirclePlacement() throws Exception {
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
req.setWidth(48);
req.setHeight(25);
FeatureTypeInfo ftInfo =
getCatalog()
.getFeatureTypeByName(
MockData.MPOINTS.getNamespaceURI(),
MockData.MPOINTS.getLocalPart());
req.setLayer(ftInfo.getFeatureType());
req.setStyle(readSLD("largeCircle.sld"));
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
assertNotBlank("largeCircle", image, LegendUtils.DEFAULT_BG_COLOR);
// the border is visible both top middle and bottom middle. Different JDK
// build wildly different colors for the border unfortunately, so the test
// checks that pixels at top/middle bottom/middle are similar color (they used to be
// different, significantly)
Color colorTop = getPixelColor(image, 24, 0);
Color colorBottom = getPixelColor(image, 24, 24);
assertColorSimilar(colorTop, colorBottom, 20);
}
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
/**
* Tests that the legend graphic is still produced when the request's strict parameter is set to
* false and a layer is not specified
*/
@org.junit.Test
public void testNoLayerProvidedAndNonStrictRequest() throws Exception {
Style style = getCatalog().getStyleByName("rainfall").getStyle();
assertNotNull(style);
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
req.setStrict(false);
req.setLayer(null);
req.setStyle(style);
final int HEIGHT_HINT = 30;
req.setHeight(HEIGHT_HINT);
// use default values for the rest of parameters
this.legendProducer.buildLegendGraphic(req);
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
// was the legend painted?
assertNotBlank("testRainfall", image, LegendUtils.DEFAULT_BG_COLOR);
// was the legend painted?
assertNotBlank("testRainfall", image, LegendUtils.DEFAULT_BG_COLOR);
}
/** Tests that the legend graphic is produced for multiple layers */
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
代码示例来源:origin: org.geoserver/gs-wms
req.setHeight(HEIGHT_HINT);
内容来源于网络,如有侵权,请联系作者删除!