Package org.geotools.styling

Examples of org.geotools.styling.FeatureTypeStyle


         */
        LineSymbolizer sym = styleFactory.createLineSymbolizer(stroke, null);

        Rule rule = styleFactory.createRule();
        rule.symbolizers().add(sym);
        FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[]{rule});
        Style style = styleFactory.createStyle();
        style.featureTypeStyles().add(fts);

        return style;
    }
View Full Code Here


         */
        PointSymbolizer sym = styleFactory.createPointSymbolizer(gr, null);

        Rule rule = styleFactory.createRule();
        rule.symbolizers().add(sym);
        FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[]{rule});
        Style style = styleFactory.createStyle();
        style.featureTypeStyles().add(fts);

        return style;
    }
View Full Code Here

   
        Rule rule = sf.createRule();
        rule.symbolizers().add(lineSymbolizer);
       
        Rule[] rules = new Rule[] { rule };
        FeatureTypeStyle featureTypeStyle = sf.createFeatureTypeStyle(rules);
   
        List<FeatureTypeStyle> featureTypeStyles = new ArrayList<FeatureTypeStyle>();
        featureTypeStyles.add(featureTypeStyle);
       
        double dpi90 = 25.4 / 0.28;
View Full Code Here

    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        List l = node.getChildValues(Symbolizer.class);
        Symbolizer[] syms = (Symbolizer[]) l.toArray(new Symbolizer[l.size()]);

        FeatureTypeStyle style = sb.createFeatureTypeStyle(syms, 1.0, 1.0);

        //if the style has an id, throw it in to the style cache
        if (node.hasAttribute("id")) {
            String id = (String) node.getAttributeValue("id");
View Full Code Here

    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));
   
    // OnLineResource implemented by gt-metadata - so no factory!
    OnLineResourceImpl svg = new OnLineResourceImpl(new URI("file:city.svg"));
    svg.freeze(); // freeze to prevent modification at runtime
   
    OnLineResourceImpl png = new OnLineResourceImpl(new URI("file:city.png"));
    png.freeze(); // freeze to prevent modification at runtime
   
    //
    // List of symbols is considered in order with the rendering engine choosing
    // the first one it can handle. Allowing for svg, png, mark order
    List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
    symbols.add(sf.externalGraphic(svg, "svg", null)); // svg preferred
    symbols.add(sf.externalGraphic(png, "png", null)); // png preferred
    symbols.add(sf.mark(ff.literal("circle"), fill, stroke)); // simple circle backup plan
   
    Expression opacity = null; // use default
    Expression size = ff.literal(10);
    Expression rotation = null; // use default
    AnchorPoint anchor = null; // use default
    Displacement displacement = null; // use default
   
    // define a point symbolizer of a small circle
    Graphic city = sf.graphic(symbols, opacity, size, rotation, anchor, displacement);
    PointSymbolizer pointSymbolizer = sf.pointSymbolizer("point", ff.property("the_geom"), null,
            null, city);
   
    rule1.symbolizers().add(pointSymbolizer);
   
    featureTypeStyle.rules().add(rule1);
   
    //
    // RULE 2 Default
   
    List<GraphicalSymbol> dotSymbols = new ArrayList<GraphicalSymbol>();
    dotSymbols.add(sf.mark(ff.literal("circle"), null, null));
    Graphic dotGraphic = sf.graphic(dotSymbols, null, ff.literal(3), null, null, null);
    PointSymbolizer dotSymbolizer = sf.pointSymbolizer("dot", null, null, null, dotGraphic);
    List<org.opengis.style.Symbolizer> symbolizers = new ArrayList<org.opengis.style.Symbolizer>();
    symbolizers.add(dotSymbolizer);
    Filter other = null; // null will mark this rule as "other" accepting all remaining features
    Rule rule2 = sf.rule("default", null, null, Double.MIN_VALUE, Double.MAX_VALUE, symbolizers,
            other);
    featureTypeStyle.rules().add(rule2);
   
    style.featureTypeStyles().add(featureTypeStyle);
   
    layer.userStyles().add(style);
   
View Full Code Here

    rule2.setIsElseFilter(true);
   
    //
    // define feature type styles used to actually define how features are rendered
    Rule rules[] = new Rule[] { rule1, rule2 };
    FeatureTypeStyle featureTypeStyle = builder.createFeatureTypeStyle("Feature", rules);
   
    //
    // create a "user defined" style
    Style style = builder.createStyle();
    style.setName("style");
View Full Code Here

    graphic.graphicalSymbols().add(styleBuilder.createMark("circle"));
   
    pointSymbolizer.setGraphic(graphic);
   
    Rule rule = styleBuilder.createRule(pointSymbolizer);
    FeatureTypeStyle featureTypeStyle = styleBuilder.createFeatureTypeStyle("Feature", rule);
    style.featureTypeStyles().add(featureTypeStyle);
   
    // featureTypeStyleExample end
}
View Full Code Here

    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
}
View Full Code Here

    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
View Full Code Here

    String paletteName = "GrBu";
    Color[] colors = brewer.getPalette(paletteName).getColors(5);
   
    // STEP 3 - ask StyleGenerator to make a set of rules for the Classifier
    // assigning features the correct color based on height
    FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
            groups,
            propteryExpression,
            colors,
            "Generated FeatureTypeStyle for GreeBlue",
            featureCollection.getSchema().getGeometryDescriptor(),
View Full Code Here

TOP

Related Classes of org.geotools.styling.FeatureTypeStyle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.