Package org.geotools.styling

Examples of org.geotools.styling.Graphic


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

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

        // check the mark
        List<GraphicalSymbol> symbols = graphic.graphicalSymbols();
        assertEquals(1, symbols.size());
        ExternalGraphic eg = (ExternalGraphic) symbols.get(0);
        assertEquals("image/png", eg.getFormat());
        assertEquals("smileyface.png", eg.getOnlineResource().getLinkage().toString());
    }
View Full Code Here


        assertEquals(1, collector.rules.size());
        assertEquals(2, collector.symbolizers.size());

        // check the size and rotation of the point symbolizer
        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));
        Fill fill = mark.getFill();
        assertEquals(Color.RED, fill.getColor().evaluate(null, Color.class));
View Full Code Here

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

        // check the function is there were we expect it
        PointSymbolizer ps = (PointSymbolizer) collector.symbolizers.get(0);
        Graphic graphic = ps.getGraphic();
        assertTrue(graphic.getSize() instanceof CategorizeFunction);
    }
View Full Code Here

   
    public void testResizeGraphicFill() throws Exception {
        URL url = StreamingRenderer.class.getResource("test-data/");
        PolygonSymbolizer symb = sf.createPolygonSymbolizer();
        ExternalGraphic eg = sf.createExternalGraphic(url + "icon64.png", "image/png");
        Graphic g = sf.createGraphic(new ExternalGraphic[] {eg}, null, null, null, ff.literal(20), null);
        Fill fill = sf.createFill(null, null, null, g);
        symb.setFill(fill);
       
        PolygonStyle2D ps = sld.createPolygonStyle(feature, symb, range);
        assertTrue(ps.getFill() instanceof TexturePaint);
View Full Code Here

            buffer = Math.max(buffer, total);
        }
       
        // take into account label shields if any
        if(text instanceof TextSymbolizer2) {
            Graphic graphic = ((TextSymbolizer2) text).getGraphic();
            if(graphic != null) {
                graphic.accept(this);
            }
        }
    }
View Full Code Here

      ts2d.setHaloFill(getPaint(halo.getFill(), feature, symbolizer));
      ts2d.setHaloComposite(getComposite(halo.getFill(), feature));
      ts2d.setHaloRadius(evalToFloat(halo.getRadius(), feature, 1));
    }

    Graphic graphicShield = null;
    if (symbolizer instanceof TextSymbolizer2) {
      graphicShield = ((TextSymbolizer2) symbolizer).getGraphic();
      if (graphicShield != null) {
        Style2D shieldStyle = createPointStyle(feature, symbolizer, graphicShield, scaleRange, true);
        ts2d.setGraphic(shieldStyle);
View Full Code Here

        assertTrue(rbe.isEstimateAccurate());
    }
   
    @Test
    public void testLiteralParseGraphics() {
        Graphic g = sb.createGraphic();
        g.setSize(sb.literalExpression("10.0"));
        MetaBufferEstimator rbe = new MetaBufferEstimator();
        rbe.visit(g);
        assertEquals(11, rbe.getBuffer());
        assertTrue(rbe.isEstimateAccurate());
    }
View Full Code Here

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

   
    // RULE 1
    // first rule to draw cities
   
    // define a point symbolizer representing a city
    Graphic city = builder.createGraphic();
    city.setSize(ff.literal(10));
    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);
   
View Full Code Here

private void splatExample() {
    // 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

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.