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


Java StyleBuilder.createMark方法代码示例

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


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

示例1: testAccept

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertTrue(field.accept(externalGraphic));

    Mark marker = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:FieldConfigFilenameTest.java

示例2: testAccept

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker1 = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker1));

    Mark marker2 = styleBuilder.createMark("ttf://Arial");
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:FieldConfigTTFTest.java

示例3: testAccept

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigWKT field = new FieldConfigWKT(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker1 = styleBuilder.createMark("star");
    assertFalse(field.accept(marker1));

    //CHECKSTYLE:OFF
    Mark marker2 = styleBuilder.createMark(
            "wkt://MULTILINESTRING((-0.25 -0.25, -0.125 -0.25), (0.125 -0.25, 0.25 -0.25), (-0.25 0.25, -0.125 0.25), (0.125 0.25, 0.25 0.25))");
    //CHECKSTYLE:ON
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:FieldConfigWKTTest.java

示例4: testAccept

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.arrow.FieldConfigArrow#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigArrow field = new FieldConfigArrow(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();

    Mark marker1 = styleBuilder.createMark("star");
    assertFalse(field.accept(marker1));

    Mark marker2 = styleBuilder.createMark("extshape://arrow?hr=1.2&t=0.34&ab=0.56");
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:FieldConfigArrowTest.java

示例5: testAccept

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker1 = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker1));

    Mark marker2 = styleBuilder.createMark("windbarbs://default(15)[kts]");
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:FieldConfigWindBarbsTest.java

示例6: createDefaultPointFeatureTypeStyle

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private FeatureTypeStyle createDefaultPointFeatureTypeStyle(String radius, String color, String opacity){	
	Fill pointFill = sf.getDefaultFill();        
	pointFill.setColor(filterFactory.literal(color));        
	pointFill.setOpacity(filterFactory.literal(opacity));
       
	Stroke pointStroke = sf.getDefaultStroke();
	pointStroke.setWidth(filterFactory.literal(new Integer(DEFAULT_STROKE_WIDTH)));
	pointStroke.setColor(filterFactory.literal(DEFAULT_COLOR));
	pointStroke.setOpacity(filterFactory.literal(opacity));

	StyleBuilder sb = new StyleBuilder();
	Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, pointFill,pointStroke);
	Graphic graph = sb.createGraphic(null, circle, null, Double.parseDouble(opacity), Double.parseDouble(radius) , DEFAULT_POINT_ROTATION);
       PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph);		
       
       Rule pointRule = sf.createRule();
       pointRule.symbolizers().add(pointSymbolizer);
       FeatureTypeStyle pointFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{pointRule});
	
       return pointFeatureTypeStyle;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:LayerFactory.java

示例7: quickPointSymbolizer

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void quickPointSymbolizer() {
    // quickPointSymbolizer start
    // "testPoint" feature type style
    StyleBuilder sb = new StyleBuilder();
    FilterFactory2 ff = sb.getFilterFactory();
    
    Mark testMark = sb.createMark(sb.attributeExpression("name"), sb.createFill(Color.RED, 0.5),
            null);
    Graphic graph = sb.createGraphic(null, // An external graphics if needed
            new Mark[] { testMark }, // a Mark if not an external graphics
            null, // aSymbol
            ff.literal(1), // opacity
            ff.property("size"), // read from feature "size" attribute
            ff.property("rotation")); // rotation, here read into the feature
    PointSymbolizer aPointSymbolizer = sb.createPointSymbolizer(graph);
    
    // creation of the style
    Style style = sb.createStyle(aPointSymbolizer);
    // quickPointSymbolizer end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:21,代码来源:StyleExamples.java

示例8: testAccept

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigMarker field = new FieldConfigMarker(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker));

    List<ValueComboBoxData> dataList = new ArrayList<ValueComboBoxData>();

    dataList.add(new ValueComboBoxData("star", "Star", this.getClass()));
    dataList.add(new ValueComboBoxData("square", "Square", this.getClass()));
    dataList.add(new ValueComboBoxData("triangle", "Triangle", this.getClass()));

    List<ValueComboBoxDataGroup> groupList = new ArrayList<ValueComboBoxDataGroup>();
    groupList.add(new ValueComboBoxDataGroup(dataList));

    field.populateSymbolList(String.class, groupList);
    field.populateSymbolList(PointFillDetails.class, groupList);
    assertTrue(field.accept(marker));
    field.populateSymbolList(PointFillDetails.class, groupList);
    assertTrue(field.accept(marker));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:37,代码来源:FieldConfigMarkerTest.java

示例9: testSetValue

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#setValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, com.sldeditor.ui.detail.config.FieldConfigSymbolType, org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testSetValue() {

    GraphicPanelFieldManager fieldConfigManager = null;

    Class<?> panelId = PointFillDetails.class;
    fieldConfigManager = new GraphicPanelFieldManager(panelId);
    FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
    FieldConfigColour colourField = new FieldConfigColour(
            new FieldConfigCommonData(panelId, colourFieldId, "", false));
    colourField.createUI();
    String expectedColourValue = "#012345";
    colourField.setTestValue(null, expectedColourValue);
    fieldConfigManager.add(colourFieldId, colourField);

    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);
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            fillConfig, strokeConfig, null);

    field.setValue(null, null, null, null, null);
    field.setValue(null, fieldConfigManager, null, null, null);

    field.createUI();
    StyleBuilder styleBuilder = new StyleBuilder();
    Mark marker = styleBuilder.createMark("star", Color.green, Color.black, 2.0);

    field.setValue(null, null, null, null, marker);
    field.setValue(null, fieldConfigManager, null, null, marker);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:40,代码来源:FieldConfigTTFTest.java

示例10: quickTextSymbolizer

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void quickTextSymbolizer() {
    // quickTextSymbolizer start
    // "labelPoint" feature type style
    StyleBuilder sb = new StyleBuilder();
    FilterFactory2 ff = sb.getFilterFactory();
    
    // creation of the TextSymbolizer
    AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
            sb.attributeExpression("Y"));
    PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
            sb.literalExpression(0));
    TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK), new Font[] {
            sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) }, sb.createHalo(),
            sb.attributeExpression("name"), pointPlacement, null);
    
    // creation of the Point symbolizer
    Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, Color.RED);
    Graphic graph2 = sb.createGraphic(null, circle, null, 1, 4, 0);
    PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph2);
    
    // creation of the style
    Style style = sb.createStyle();
    FeatureTypeStyle featureTypeStyle = sb.createFeatureTypeStyle("labelPoint", new Symbolizer[] {
            textSymbolizer, pointSymbolizer });
    style.featureTypeStyles().add(featureTypeStyle);
    
    // creation of the style
    // quickTextSymbolizer end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:30,代码来源:StyleExamples.java

示例11: markTestSLD

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
private void markTestSLD() {
    // markTestSLD start
    StyleBuilder sb = new StyleBuilder();
    FilterFactory ff = sb.getFilterFactory();
    Style style = sb.createStyle();
    style.setName("MyStyle");
    
    // "testPoint" feature type style
    Mark testMark = sb.createMark(sb.attributeExpression("name"), sb.createFill(Color.RED, 0.5),
            null);
    Graphic graph = sb.createGraphic(null, new Mark[] { testMark }, null, sb.literalExpression(1),
            sb.attributeExpression("size"), sb.attributeExpression("rotation"));
    style.featureTypeStyles().add(
            sb.createFeatureTypeStyle("testPoint", sb.createPointSymbolizer(graph)));
    
    // "labelPoint" feature type style
    AnchorPoint anchorPoint = sb.createAnchorPoint(sb.attributeExpression("X"),
            sb.attributeExpression("Y"));
    PointPlacement pointPlacement = sb.createPointPlacement(anchorPoint, null,
            sb.literalExpression(0));
    TextSymbolizer textSymbolizer = sb.createTextSymbolizer(sb.createFill(Color.BLACK), new Font[] {
            sb.createFont("Lucida Sans", 10), sb.createFont("Arial", 10) }, sb.createHalo(),
            sb.attributeExpression("name"), pointPlacement, null);
    Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, Color.RED);
    Graphic graph2 = sb.createGraphic(null, circle, null, 1, 4, 0);
    PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph2);
    style.featureTypeStyles().add(
            sb.createFeatureTypeStyle("labelPoint", new Symbolizer[] { textSymbolizer,
                    pointSymbolizer }));
    // markTestSLD end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:32,代码来源:StyleExamples.java

示例12: testSetValue

import org.geotools.styling.StyleBuilder; //导入方法依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#setValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, com.sldeditor.ui.detail.config.FieldConfigSymbolType, org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testSetValue() {

    GraphicPanelFieldManager fieldConfigManager = null;

    Class<?> panelId = PointFillDetails.class;
    fieldConfigManager = new GraphicPanelFieldManager(panelId);

    // 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);

    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 field2 = new FieldConfigMarker(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            fillConfig, strokeConfig, null);

    field2.setValue(null, null, null, null, null);
    field2.setValue(null, fieldConfigManager, null, null, null);

    StyleBuilder styleBuilder = new StyleBuilder();
    Mark marker = styleBuilder.createMark("star");
    field2.setValue(null, null, null, null, marker);
    field2.setValue(null, fieldConfigManager, null, null, marker);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:55,代码来源:FieldConfigMarkerTest.java


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