本文整理汇总了Java中org.geotools.styling.TextSymbolizer.setUnitOfMeasure方法的典型用法代码示例。如果您正苦于以下问题:Java TextSymbolizer.setUnitOfMeasure方法的具体用法?Java TextSymbolizer.setUnitOfMeasure怎么用?Java TextSymbolizer.setUnitOfMeasure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.TextSymbolizer
的用法示例。
在下文中一共展示了TextSymbolizer.setUnitOfMeasure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.geotools.styling.TextSymbolizer; //导入方法依赖的package包/类
/**
* (non-Javadoc)
*
* @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.TextSymbolizer)
*/
public void visit(TextSymbolizer text) {
TextSymbolizer copy = sf.createTextSymbolizer();
copy.setFill(copy(text.getFill()));
copy.fonts().clear();
copy.fonts().addAll(copyFonts(text.fonts()));
// Ignore geometry field so that symbol is rendered
copy.setGeometry(copy(text.getGeometry()));
copy.setUnitOfMeasure(text.getUnitOfMeasure());
copy.setHalo(copy(text.getHalo()));
copy.setLabel(copy(text.getLabel()));
copy.setLabelPlacement(copy(text.getLabelPlacement()));
copy.setPriority(copy(text.getPriority()));
copy.getOptions().putAll(text.getOptions());
if (text instanceof TextSymbolizer2) {
TextSymbolizer2 text2 = (TextSymbolizer2) text;
TextSymbolizer2 copy2 = (TextSymbolizer2) copy;
copy2.setGraphic(copy(text2.getGraphic()));
copy2.setSnippet(copy(text2.getSnippet()));
copy2.setFeatureDescription(copy(text2.getFeatureDescription()));
copy2.setOtherText(copy(text2.getOtherText()));
}
if (STRICT && !copy.equals(text)) {
throw new IllegalStateException(
"Was unable to duplicate provided TextSymbolizer:" + text);
}
pages.push(copy);
}
示例2: convert
import org.geotools.styling.TextSymbolizer; //导入方法依赖的package包/类
@Override
public void convert(List<Rule> labelRuleList, Rule rule, JsonElement json, int transparency)
{
if((json != null) && (rule != null) && (labelRuleList != null))
{
JsonObject jsonObj = json.getAsJsonObject();
TextSymbolizer textSymbolizer = styleFactory.createTextSymbolizer();
textSymbolizer.setUnitOfMeasure(NonSI.PIXEL);
textSymbolizer.setLabel(extractExpression(jsonObj));
JsonElement jsonElement = jsonObj.get(LabelEngineLayerPropertiesKey.SYMBOL);
SymbolManager.getInstance().convertTextSymbols(textSymbolizer, transparency, jsonElement);
// Yes, this really is round the wrong way
double maxScale = extractDouble(jsonObj, LabelEngineLayerPropertiesKey.ANNOTATION_MINIMUM_SCALE);
double minScale = extractDouble(jsonObj, LabelEngineLayerPropertiesKey.ANNOTATION_MAXIMUM_SCALE);
if((minScale > 0.0) || (maxScale > 0.0))
{
Rule labelRule = styleFactory.createRule();
labelRule.setName(extractString(jsonObj, LabelEngineLayerPropertiesKey.CLASS));
if(minScale > 0.0)
{
labelRule.setMinScaleDenominator(minScale);
}
if(maxScale > 0.0)
{
labelRule.setMaxScaleDenominator(maxScale);
}
labelRule.symbolizers().add(textSymbolizer);
labelRuleList.add(labelRule);
}
else
{
rule.symbolizers().add(textSymbolizer);
}
}
}