当前位置: 首页>>代码示例>>Java>>正文


Java TextSymbolizer.setHalo方法代码示例

本文整理汇总了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;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:27,代码来源:StyleConverterServiceImpl.java

示例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);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:39,代码来源:RuleRenderVisitor.java

示例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));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:33,代码来源:SLDTreeItemWrapperTest.java


注:本文中的org.geotools.styling.TextSymbolizer.setHalo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。