本文整理汇总了Java中org.geotools.styling.TextSymbolizer.setHalo方法的典型用法代码示例。如果您正苦于以下问题:Java TextSymbolizer.setHalo方法的具体用法?Java TextSymbolizer.setHalo怎么用?Java TextSymbolizer.setHalo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.TextSymbolizer
的用法示例。
在下文中一共展示了TextSymbolizer.setHalo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextSymbolizer
import org.geotools.styling.TextSymbolizer; //导入方法依赖的package包/类
private TextSymbolizer createTextSymbolizer(LabelStyleInfo labelStyle, LayerType layerType) {
Fill fontFill = styleBuilder.createFill(styleBuilder.literalExpression(labelStyle.getFontStyle().getColor()),
styleBuilder.literalExpression(labelStyle.getFontStyle().getOpacity()));
TextSymbolizer symbolizer = styleBuilder.createTextSymbolizer();
symbolizer.setFill(fontFill);
FontStyleInfo fontInfo = labelStyle.getFontStyle();
symbolizer.setFont(styleBuilder.createFont(styleBuilder.literalExpression(fontInfo.getFamily()),
styleBuilder.literalExpression(fontInfo.getStyle()),
styleBuilder.literalExpression(fontInfo.getWeight()),
styleBuilder.literalExpression(fontInfo.getSize())));
symbolizer.setLabel(styleBuilder.attributeExpression(labelStyle.getLabelAttributeName()));
Fill haloFill = styleBuilder.createFill(
styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillColor()),
styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillOpacity()));
symbolizer.setHalo(styleBuilder.createHalo(haloFill, 1));
// label placement : point at bottom-center of label (same as vectorized)
switch (layerType) {
case MULTIPOINT:
case POINT:
symbolizer.setLabelPlacement(styleBuilder.createPointPlacement(0.5, 0, 0));
break;
default:
break;
}
return symbolizer;
}
示例2: 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);
}
示例3: testSLDTreeItemWrapper
import org.geotools.styling.TextSymbolizer; //导入方法依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.tree.SLDTreeItemWrapper#SLDTreeItemWrapper(java.lang.Object)}.
*/
@Test
public void testSLDTreeItemWrapper() {
// Try with null objects first
String testObj1 = SLDTreeItemWrapper.generateKey(null);
String testObj2 = SLDTreeItemWrapper.generateKey(null);
assertTrue(testObj1.equals(testObj1));
assertTrue(testObj1.equals(testObj2));
// Try with 2 different text symbolizers instances but the same contents, hash codes should
// be different
String testObj3 = SLDTreeItemWrapper
.generateKey(DefaultSymbols.createDefaultTextSymbolizer());
String testObj4 = SLDTreeItemWrapper
.generateKey(DefaultSymbols.createDefaultTextSymbolizer());
assertTrue(testObj3.equals(testObj3));
assertFalse(testObj3.equals(testObj4));
// Try with one text symbolizer instances the same contents, hash codes should be the same
TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
textSymbolizer.setHalo(new HaloImpl());
String testObj5 = SLDTreeItemWrapper.generateKey(textSymbolizer);
String testObj6 = SLDTreeItemWrapper.generateKey(textSymbolizer);
assertTrue(testObj5.equals(testObj5));
assertTrue(testObj5.equals(testObj6));
}