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


Java Fill.getColor方法代码示例

本文整理汇总了Java中org.geotools.styling.Fill.getColor方法的典型用法代码示例。如果您正苦于以下问题:Java Fill.getColor方法的具体用法?Java Fill.getColor怎么用?Java Fill.getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.styling.Fill的用法示例。


在下文中一共展示了Fill.getColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: polyFill

import org.geotools.styling.Fill; //导入方法依赖的package包/类
public static Color polyFill(final PolygonSymbolizer symbolizer) {
	if (symbolizer == null) {
		return null;
	}

	final Fill fill = symbolizer.getFill();

	if (fill == null) {
		return null;
	}

	final Expression color = fill.getColor();
	return color(color);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:15,代码来源:SLDs.java

示例2: testGetFill

import org.geotools.styling.Fill; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#getFill(org.opengis.style.GraphicFill, com.sldeditor.ui.detail.GraphicPanelFieldManager)}.
 */
@Test
public void testGetFill() {
    // Test it with null values
    boolean valueOnly = true;
    ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL,
            FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
    ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE,
            FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY,
            FieldIdEnum.STROKE_FILL_WIDTH);
    FieldConfigMarker field = new FieldConfigMarker(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            fillConfig, strokeConfig, null);

    assertNull(field.getStringValue());

    GraphicFill graphicFill = null;
    GraphicPanelFieldManager fieldConfigManager = null;
    Fill actualValue = field.getFill(graphicFill, fieldConfigManager);

    assertNull(actualValue);

    Class<?> panelId = PointFillDetails.class;
    fieldConfigManager = new GraphicPanelFieldManager(panelId);
    actualValue = field.getFill(graphicFill, fieldConfigManager);
    assertNotNull(actualValue);
    assertNull(actualValue.getColor());
    assertNull(actualValue.getGraphicFill());
    assertNull(actualValue.getOpacity());

    // Test it with non null values
    FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;

    FieldConfigColour colourField = new FieldConfigColour(
            new FieldConfigCommonData(panelId, colourFieldId, "", false));
    colourField.createUI();
    String expectedColourValue = "#012345";
    colourField.setTestValue(null, expectedColourValue);
    double expectedOpacityValue = 0.72;
    FieldConfigSlider opacityField = new FieldConfigSlider(
            new FieldConfigCommonData(panelId, colourFieldId, "", false));
    opacityField.createUI();
    opacityField.populateField(expectedOpacityValue);
    FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(
            new FieldConfigCommonData(panelId, colourFieldId, "", false));
    symbolSelectionField.createUI();

    fieldConfigManager.add(colourFieldId, colourField);
    FieldIdEnum opacityFieldId = FieldIdEnum.OVERALL_OPACITY;
    fieldConfigManager.add(opacityFieldId, opacityField);
    FieldIdEnum symbolSelectionFieldId = FieldIdEnum.SYMBOL_TYPE;
    fieldConfigManager.add(symbolSelectionFieldId, symbolSelectionField);

    FieldConfigMarker field2 = new FieldConfigMarker(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            fillConfig, strokeConfig, symbolSelectionFieldId);
    actualValue = field2.getFill(graphicFill, fieldConfigManager);
    assertNotNull(actualValue);
    LiteralExpressionImpl literalExpressionImpl = (LiteralExpressionImpl) actualValue
            .getColor();
    String actualColourString = literalExpressionImpl.toString();
    assertTrue(actualColourString.compareTo(expectedColourValue) == 0);

    StyleBuilder styleBuilder = new StyleBuilder();

    graphicFill = styleBuilder.createGraphic();
    actualValue = field2.getFill(graphicFill, fieldConfigManager);
    assertNull(actualValue.getColor());
    assertNull(actualValue.getOpacity());
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:74,代码来源:FieldConfigMarkerTest.java


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