本文整理了Java中org.geoserver.wms.GetLegendGraphicRequest.setLocale()
方法的一些代码示例,展示了GetLegendGraphicRequest.setLocale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GetLegendGraphicRequest.setLocale()
方法的具体详情如下:
包路径:org.geoserver.wms.GetLegendGraphicRequest
类名称:GetLegendGraphicRequest
方法名:setLocale
[英]Sets the optional Locale to be used for text in legend output.
[中]设置用于图例输出中文本的可选区域设置。
代码示例来源:origin: org.geoserver/gs-wms
request.setLocale(new Locale(language));
代码示例来源:origin: org.geoserver/gs-wms
/** Tests that minSymbolSize legend option is respected. */
@org.junit.Test
public void testInternationalizedLabels() throws Exception {
GetLegendGraphicRequest req = new GetLegendGraphicRequest();
Map<String, String> options = new HashMap<String, String>();
options.put("forceLabels", "on");
req.setLegendOptions(options);
FeatureTypeInfo ftInfo =
getCatalog()
.getFeatureTypeByName(
MockData.MPOINTS.getNamespaceURI(),
MockData.MPOINTS.getLocalPart());
req.setLayer(ftInfo.getFeatureType());
req.setStyle(readSLD("Internationalized.sld"));
BufferedImage image = this.legendProducer.buildLegendGraphic(req);
int noLocalizedWidth = image.getWidth();
req.setLocale(Locale.ITALIAN);
image = this.legendProducer.buildLegendGraphic(req);
// test that using localized labels we get a different label than when not using it
int itWidth = image.getWidth();
assertTrue(itWidth != noLocalizedWidth);
req.setLocale(Locale.ENGLISH);
image = this.legendProducer.buildLegendGraphic(req);
// test that using localized labels we get a different label than when not using it
int enWidth = image.getWidth();
assertTrue(enWidth != noLocalizedWidth);
assertTrue(enWidth != itWidth);
}
内容来源于网络,如有侵权,请联系作者删除!