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


Java StyleFactory.createFeatureTypeStyle方法代码示例

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


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

示例1: createDefaultLineFeatureTypeStyle

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
private FeatureTypeStyle createDefaultLineFeatureTypeStyle(String strokeWidth, String strokeColor, String opacity){		
	StyleFactory sf = CommonFactoryFinder.getStyleFactory(new Hints(Hints.KEY_RENDERING, Hints.VALUE_RENDER_SPEED));
	FilterFactory filterFactory = new FilterFactoryImpl();

	Stroke lineStroke = sf.getDefaultStroke();
       lineStroke.setWidth(filterFactory.literal(new Integer(strokeWidth)));
       lineStroke.setColor(filterFactory.literal(strokeColor));
       lineStroke.setOpacity(filterFactory.literal(opacity));
       
       LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
       lineSymbolizer.setStroke(lineStroke);
       
       Rule lineRule = sf.createRule();
       lineRule.symbolizers().add(lineSymbolizer);
       FeatureTypeStyle lineFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{lineRule});
       
       return lineFeatureTypeStyle;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:19,代码来源:LayerFactory.java

示例2: createStyle

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
@SuppressWarnings({"deprecation"})
private static Style createStyle() {
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
    FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);
    PolygonSymbolizer symbolizer = styleFactory.createPolygonSymbolizer();
    Fill fill = styleFactory.createFill(
            filterFactory.literal("#FFAA00"),
            filterFactory.literal(0.5)
    );
    symbolizer.setFill(fill);
    Rule rule = styleFactory.createRule();
    rule.setSymbolizers(new Symbolizer[]{symbolizer});
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.setRules(new Rule[]{rule});

    Style style = styleFactory.createStyle();
    style.addFeatureTypeStyle(fts);
    return style;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:FeatureLayerConfigurationPersistencyTest.java

示例3: getDirectRasterStyle

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
private static FeatureTypeStyle getDirectRasterStyle(
		final String geometryPropertyName,
		final Expression transformation ) {
	final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
	final FeatureTypeStyle style = styleFactory.createFeatureTypeStyle();
	final Rule rule = styleFactory.createRule();
	rule.setName("distributed render - direct raster");
	rule.setTitle("Distributed Render - Direct Raster");

	final RasterSymbolizer symbolizer = styleFactory.createRasterSymbolizer();
	symbolizer.setGeometryPropertyName(geometryPropertyName);
	rule.symbolizers().add(
			symbolizer);
	style.rules().add(
			rule);
	style.setTransformation(transformation);
	return style;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:19,代码来源:DistributedRenderCallback.java

示例4: twoFeatureTypeStyles

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
private void twoFeatureTypeStyles() {
    // twoFeatureTypeStyles start
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
    FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2();
    
    Style style = styleFactory.getDefaultStyle();
    
    // Feature type style 1
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.featureTypeNames().add(new NameImpl("feature-type-1"));
    style.featureTypeStyles().add(fts);
    
    // Feature type style 2
    FeatureTypeStyle fts2 = styleFactory.createFeatureTypeStyle();
    fts2.featureTypeNames().add(new NameImpl("feature-type-2"));
    
    // creating the rule 1
    Rule rule1 = styleFactory.createRule();
    rule1.setName("rule1");
    Filter aFilter = filterFactory.id(Collections.singleton(filterFactory.featureId("FID")));
    rule1.setFilter(aFilter);
    fts2.rules().add(rule1);
    
    // creating the rule 2
    Rule rule2 = styleFactory.createRule();
    rule2.setIsElseFilter(true);
    rule2.setName("rule2");
    fts2.rules().add(rule2);
    
    style.featureTypeStyles().add(fts2);
    // twoFeatureTypeStyles end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:33,代码来源:StyleExamples.java

示例5: createPolygonStyle

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
private static Style createPolygonStyle() {
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
    FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);

    PolygonSymbolizer symbolizer = styleFactory.createPolygonSymbolizer();
    org.geotools.styling.Stroke stroke = styleFactory.createStroke(
            filterFactory.literal("#FFFFFF"),
            filterFactory.literal(0.0)
    );
    symbolizer.setStroke(stroke);
    Fill fill = styleFactory.createFill(
            filterFactory.literal("#FFFFFF"),
            filterFactory.literal(1.0)
    );
    symbolizer.setFill(fill);

    Rule rule = styleFactory.createRule();
    rule.symbolizers().add(symbolizer);

    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.rules().add(rule);

    Style style = styleFactory.createStyle();
    style.featureTypeStyles().add(fts);

    return style;
}
 
开发者ID:bcdev,项目名称:esa-pfa,代码行数:28,代码来源:CoastDistGen.java

示例6: getSuitabilityStyle

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
public StyledLayerDescriptor getSuitabilityStyle(String columnName) {

    LOGGER.debug("creating a style for suitability column: for", columnName);

    StyleFactory sf = CommonFactoryFinder.getStyleFactory();
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    UserLayer layer = sf.createUserLayer();
    layer.setName("layer");

    StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
    sld.setName("sld");
    sld.setTitle("Example");
    sld.setAbstract("Example Style Layer Descriptor");

    // define constraint limited what features the sld applies to
    FeatureTypeConstraint constraint = sf.createFeatureTypeConstraint(
        "Feature", Filter.INCLUDE, null);

    layer.layerFeatureConstraints().add(constraint);

    //
    // create a "user defined" style
    Style style = sf.createStyle();
    style.setName("style");
    style.getDescription().setTitle("User Style");
    style.getDescription().setAbstract("Definition of Style");

    // define feature type styles used to actually define how features are
    // rendered
    FeatureTypeStyle featureTypeStyle = sf.createFeatureTypeStyle();

    // RULE 1
    // first rule to draw cities
    Rule rule1 = sf.createRule();
    rule1.setName("rule1");
    rule1.getDescription().setTitle("City");
    rule1.getDescription().setAbstract("Rule for drawing cities");
    rule1.setFilter(ff.less(ff.property("POPULATION"), ff.literal(50000)));

    //
    // create the graphical mark used to represent a city
    Stroke stroke = sf.stroke(ff.literal("#000000"), null, null, null, null,
        null, null);
    Fill fill = sf.fill(null, ff.literal(Color.BLUE), ff.literal(1.0));
    
StyleBuilder styleBuilder = new StyleBuilder();

PolygonSymbolizer polygonSymbolizer = styleBuilder.createPolygonSymbolizer(Color.BLUE);
polygonSymbolizer.getFill().setOpacity(ff.literal(0.5)); // 50% blue

polygonSymbolizer.setStroke(styleBuilder.createStroke(Color.BLACK, 2.0));

// will create a default feature type style and rule etc...
//Style style = styleBuilder.createStyle(polygonSymbolizer);
rule1.symbolizers().add(polygonSymbolizer);

    featureTypeStyle.rules().add(rule1);
    
style.featureTypeStyles().add(featureTypeStyle);
    
    layer.userStyles().add(style);
    
    sld.layers().add(layer);
    
    // // create the parser with the sld configuration
    // org.geotools.xml.Configuration configuration = new
    // org.geotools.sld.SLDConfiguration();
    // Parser parser = new org.geotools.xml.Parser(configuration);

    // // the xml instance document above
    // InputStream xml = new FileInputStream("markTest.sld");

    // // parse
    // StyledLayerDescriptor sld = (StyledLayerDescriptor) parser.parse(xml);

    // DuplicatingStyleVisitor xerox = new DuplicatingStyleVisitor();
    // style.accepts( xerox );
    // Style copy = (Style) xerox.getCopy();
    return sld;
  }
 
开发者ID:AURIN,项目名称:online-whatif,代码行数:82,代码来源:GeodataStyler.java

示例7: createTestLine

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
/**
 * Creates the test line.
 *
 * @param url the url
 * @return the styled layer descriptor
 */
private StyledLayerDescriptor createTestLine(URL url) {
    StyleBuilder sb = new StyleBuilder();
    StyleFactory styleFactory = sb.getStyleFactory();

    StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();

    NamedLayer namedLayer = styleFactory.createNamedLayer();

    sld.addStyledLayer(namedLayer);

    Style style = styleFactory.createStyle();
    namedLayer.addStyle(style);

    List<FeatureTypeStyle> ftsList = style.featureTypeStyles();

    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();

    ftsList.add(fts);

    Rule rule = styleFactory.createRule();

    fts.rules().add(rule);

    LineSymbolizer line = styleFactory.createLineSymbolizer();

    rule.symbolizers().add(line);

    Graphic graphicFill = createGraphic(url, styleFactory);
    Graphic graphicStroke = createGraphic(url, styleFactory);

    Stroke stroke = styleFactory.createStroke(null, null, null, null, null, null, null,
            graphicFill, graphicStroke);
    line.setStroke(stroke);

    return sld;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:43,代码来源:SLDExternalImagesTest.java

示例8: createTestPoint

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
/**
 * Creates the test point.
 *
 * @param url the url
 * @return the styled layer descriptor
 */
private StyledLayerDescriptor createTestPoint(URL url) {
    StyleBuilder sb = new StyleBuilder();
    StyleFactory styleFactory = sb.getStyleFactory();

    StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();

    NamedLayer namedLayer = styleFactory.createNamedLayer();

    sld.addStyledLayer(namedLayer);

    Style style = styleFactory.createStyle();
    namedLayer.addStyle(style);

    List<FeatureTypeStyle> ftsList = style.featureTypeStyles();

    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();

    ftsList.add(fts);

    Rule rule = styleFactory.createRule();

    fts.rules().add(rule);

    PointSymbolizer point = styleFactory.createPointSymbolizer();

    rule.symbolizers().add(point);

    Graphic graphic = createGraphic(url, styleFactory);

    point.setGraphic(graphic);

    return sld;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:40,代码来源:SLDExternalImagesTest.java

示例9: createTestPolygon

import org.geotools.styling.StyleFactory; //导入方法依赖的package包/类
/**
 * Creates the test polygon.
 *
 * @param url the url
 * @return the styled layer descriptor
 */
private StyledLayerDescriptor createTestPolygon(URL url) {
    StyleBuilder sb = new StyleBuilder();
    StyleFactory styleFactory = sb.getStyleFactory();

    StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();

    NamedLayer namedLayer = styleFactory.createNamedLayer();

    sld.addStyledLayer(namedLayer);

    Style style = styleFactory.createStyle();
    namedLayer.addStyle(style);

    List<FeatureTypeStyle> ftsList = style.featureTypeStyles();

    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();

    ftsList.add(fts);

    Rule rule = styleFactory.createRule();

    fts.rules().add(rule);

    PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();

    rule.symbolizers().add(polygon);

    Graphic graphicFill1 = createGraphic(url, styleFactory);
    Graphic graphicFill2 = createGraphic(url, styleFactory);
    Graphic graphicStroke = createGraphic(url, styleFactory);
    Fill fill = styleFactory.createFill(null, null, null, graphicFill1);

    polygon.setFill(fill);

    Stroke stroke = styleFactory.createStroke(null, null, null, null, null, null, null,
            graphicFill2, graphicStroke);
    polygon.setStroke(stroke);

    return sld;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:47,代码来源:SLDExternalImagesTest.java


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