Package org.geotools.styling

Examples of org.geotools.styling.PointSymbolizer


        assertTrue(rbe.isEstimateAccurate());
    }

    @Test
    public void testSimpleGraphic() {
        PointSymbolizer ps = sb.createPointSymbolizer(sb.createGraphic(null, sb
                .createMark(sb.MARK_CIRCLE), null));
        ps.getGraphic().setSize(sb.literalExpression(15));
        Style style = sb.createStyle(ps);

        MetaBufferEstimator rbe = new MetaBufferEstimator();
        rbe.visit(style);
        assertEquals(16, rbe.getBuffer());
View Full Code Here


    }
   
    @Test
    public void testReachableExternalGraphic() {
        URL resource = TestData.getResource(this, "draw.png");
        PointSymbolizer ps = sb.createPointSymbolizer(sb.createGraphic(null, null, sb
                .createExternalGraphic(resource, "image/png")));
        ps.getGraphic().setSize(sb.literalExpression(null));
        Style style = sb.createStyle(ps);

        MetaBufferEstimator rbe = new MetaBufferEstimator();
        rbe.visit(style);
        assertEquals(24, rbe.getBuffer());
View Full Code Here

   
    @Test
    public void testUnreachableExternalGraphic() throws Exception {
        File file = new File(TestData.getResource(this, "draw.png").toURI());
        URL resource = new File(file.getParent(), "draw-not-there.png").toURI().toURL();
        PointSymbolizer ps = sb.createPointSymbolizer(sb.createGraphic(null, null, sb
                .createExternalGraphic(resource, "image/png")));
        ps.getGraphic().setSize(sb.literalExpression(null));
        Style style = sb.createStyle(ps);

        MetaBufferEstimator rbe = new MetaBufferEstimator();
        rbe.visit(style);
        assertEquals(0, rbe.getBuffer());
View Full Code Here

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

    city.graphicalSymbols().add(builder.createExternalGraphic("file:city.svg", "svg")); // svg
                                                                                        // preferred
    city.graphicalSymbols().add(builder.createExternalGraphic("file:city.png", "png")); // png next
    city.graphicalSymbols().add(
            builder.createMark(StyleBuilder.MARK_CIRCLE, Color.BLUE, Color.BLACK, 1));
    PointSymbolizer pointSymbolizer = builder.createPointSymbolizer(city, "the_geom");
   
    Rule rule1 = builder.createRule(pointSymbolizer);
    rule1.setName("rule1");
    rule1.getDescription().setTitle("City");
    rule1.getDescription().setAbstract("Rule for drawing cities");
    rule1.setFilter(ff.less(ff.property("POPULATION"), ff.literal(50000)));
   
    //
    // RULE 2 Default
    Graphic dotGraphic = builder.createGraphic(null, builder.createMark(StyleBuilder.MARK_CIRCLE),
            null);
    PointSymbolizer dotSymbolize = builder.createPointSymbolizer(dotGraphic);
    Rule rule2 = builder.createRule(dotSymbolize);
    rule2.setIsElseFilter(true);
   
    //
    // define feature type styles used to actually define how features are rendered
View Full Code Here

    // splatExample start
    StyleBuilder builder = new StyleBuilder();
    FilterFactory2 ff = builder.getFilterFactory();
   
    Graphic splat = builder.createGraphic(null, builder.createMark("splat"), null);
    PointSymbolizer symbolizer = builder.createPointSymbolizer(splat);
   
    // builder will fill in all the other classes with defaults
    Style style = builder.createStyle(symbolizer);
    // splatExample end
}
View Full Code Here

private void featureTypeStyleExample() {
    // featureTypeStyleExample start
    StyleBuilder styleBuilder = new StyleBuilder();
    Style style = styleBuilder.createStyle();
   
    PointSymbolizer pointSymbolizer = styleBuilder.createPointSymbolizer();
   
    Graphic graphic = styleBuilder.createGraphic();
    ExternalGraphic external = styleBuilder.createExternalGraphic("file:///C:/images/house.gif",
            "image/gif");
    graphic.graphicalSymbols().add(external);
    graphic.graphicalSymbols().add(styleBuilder.createMark("circle"));
   
    pointSymbolizer.setGraphic(graphic);
   
    Rule rule = styleBuilder.createRule(pointSymbolizer);
    FeatureTypeStyle featureTypeStyle = styleBuilder.createFeatureTypeStyle("Feature", rule);
    style.featureTypeStyles().add(featureTypeStyle);
   
View Full Code Here

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

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

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

TOP

Related Classes of org.geotools.styling.PointSymbolizer

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.