Package org.geotools.styling

Examples of org.geotools.styling.Graphic


    @Test
    public void testGraphicSizeFunction() throws Exception {
        StyleBuilder sb = new StyleBuilder();
        Mark mark = sb.createMark("square");
        mark.setStroke(null);
        Graphic graphic = sb.createGraphic(null, mark, null);
        FilterFactory2 ff = sb.getFilterFactory();
        graphic.setSize(ff.function("env", ff.literal("test")));
        PointSymbolizer ps = sb.createPointSymbolizer(graphic);
        Style style = sb.createStyle(ps);

        try {
            EnvFunction.setGlobalValue("test", 10);
View Full Code Here


    private static Style createPointStyle() {
        StyleFactory sf = CommonFactoryFinder.getStyleFactory();
        URL iconUrl = ScreenMapShapefileTest.class.getResource("icon.png");
        ExternalGraphic icon = sf.createExternalGraphic(iconUrl, "image/png");
        Graphic graphic = sf.createGraphic(new ExternalGraphic[] { icon }, null, null, null, null,
                null);
        PointSymbolizer symbolizer = sf.createPointSymbolizer(graphic, "the_geom");

        Rule rule = sf.createRule();
        rule.symbolizers().add(symbolizer);
View Full Code Here

        }
        List<GraphicalSymbol> list = new ArrayList<GraphicalSymbol>();
        for (Builder<? extends Symbol> symbol : symbols) {
            list.add(symbol.build());
        }
        Graphic g = sf.graphic(list, opacity, size, rotation, anchor.build(), displacement.build());
       
        if (parent == null) {
            reset();
        }
        return g;
View Full Code Here

            symb = sb.createLineSymbolizer(color);
        } else if ((geometryAttrType.getType().getBinding() == MultiPoint.class)
                || (geometryAttrType.getType().getBinding() == Point.class)) {
            Fill fill = sb.createFill(color, opacity);
            Mark square = sb.createMark(StyleBuilder.MARK_SQUARE, fill, defaultStroke);
            Graphic graphic = sb.createGraphic(null, square, null); //, 1, 4, 0);
            symb = sb.createPointSymbolizer(graphic);

            //TODO: handle Text and Raster
        } else {
            //we don't know what the heck you are, *snip snip* you're a line.
View Full Code Here

                Mark mark = sf.getCircleMark();
                mark.setFill(fill);
                mark.setStroke(stroke);

                Graphic graphic = sf.createDefaultGraphic();
                graphic.graphicalSymbols().clear();
                graphic.graphicalSymbols().add(mark);
                graphic.setSize(ff.literal(POINT_SIZE));

                symbolizer = sf.createPointSymbolizer(graphic, geometryAttributeName);
        }

        Rule rule = sf.createRule();
View Full Code Here

        style.accept(collector);
        assertSimpleStyle(collector);

        // check the size
        PointSymbolizer ps = (PointSymbolizer) collector.symbolizers.get(0);
        Graphic graphic = ps.getGraphic();
        assertEquals(6, (int) graphic.getSize().evaluate(null, Integer.class));

        // check the mark
        List<GraphicalSymbol> symbols = graphic.graphicalSymbols();
        assertEquals(1, symbols.size());
        Mark mark = (Mark) symbols.get(0);
        assertEquals("circle", mark.getWellKnownName().evaluate(null));
        assertEquals(Color.RED, mark.getFill().getColor().evaluate(null, Color.class));
    }
View Full Code Here

        style.accept(collector);
        assertSimpleStyle(collector);

        // check the size
        PointSymbolizer ps = (PointSymbolizer) collector.symbolizers.get(0);
        Graphic graphic = ps.getGraphic();
        assertEquals(6, (int) graphic.getSize().evaluate(null, Integer.class));

        // check the mark
        List<GraphicalSymbol> symbols = graphic.graphicalSymbols();
        assertEquals(1, symbols.size());
        Mark mark = (Mark) symbols.get(0);
        assertEquals("circle", mark.getWellKnownName().evaluate(null));
        assertEquals(Color.RED, mark.getFill().getColor().evaluate(null, Color.class));
        Stroke stroke = mark.getStroke();
View Full Code Here

    /**
     * Create a Style to draw point features as circles with blue outlines
     * and cyan fill
     */
    private Style createPointStyle() {
        Graphic gr = styleFactory.createDefaultGraphic();

        Mark mark = styleFactory.getCircleMark();

        mark.setStroke(styleFactory.createStroke(
                filterFactory.literal(Color.BLUE), filterFactory.literal(1)));

        mark.setFill(styleFactory.createFill(filterFactory.literal(Color.CYAN)));

        gr.graphicalSymbols().clear();
        gr.graphicalSymbols().add(mark);
        gr.setSize(filterFactory.literal(5));

        /*
         * Setting the geometryPropertyName arg to null signals that we want to
         * draw the default geomettry of features
         */
 
View Full Code Here

        style.accept(collector);
        assertSimpleStyle(collector);

        // check the size and rotation
        PointSymbolizer ps = (PointSymbolizer) collector.symbolizers.get(0);
        Graphic graphic = ps.getGraphic();
        assertEquals(12, (int) graphic.getSize().evaluate(null, Integer.class));
        assertEquals(45, (int) graphic.getRotation().evaluate(null, Integer.class));

        // check the mark
        List<GraphicalSymbol> symbols = graphic.graphicalSymbols();
        assertEquals(1, symbols.size());
        Mark mark = (Mark) symbols.get(0);
        assertEquals("square", mark.getWellKnownName().evaluate(null));
        assertEquals(Color.GREEN, mark.getFill().getColor().evaluate(null, Color.class));
    }
View Full Code Here

        style.accept(collector);
        assertSimpleStyle(collector);

        // check the size and rotation
        PointSymbolizer ps = (PointSymbolizer) collector.symbolizers.get(0);
        Graphic graphic = ps.getGraphic();
        assertEquals(12, (int) graphic.getSize().evaluate(null, Integer.class));

        // check the mark
        List<GraphicalSymbol> symbols = graphic.graphicalSymbols();
        assertEquals(1, symbols.size());
        Mark mark = (Mark) symbols.get(0);
        assertEquals("triangle", mark.getWellKnownName().evaluate(null));
        Fill fill = mark.getFill();
        assertEquals(Color.RED, fill.getColor().evaluate(null, Color.class));
View Full Code Here

TOP

Related Classes of org.geotools.styling.Graphic

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.