Examples of PolygonSymbolizer


Examples of org.geotools.styling.PolygonSymbolizer

        helper.setVersion(Versions.TWO);
        JSONObject json = new JSONObject();
        json.put(JsonStyleParserHelper.JSON_STROKE_DASHSTYLE, "5 4");

        PJsonObject pJson = new PJsonObject(json, "symbolizers");
        final PolygonSymbolizer polygonSymbolizer = this.helper.createPolygonSymbolizer(pJson);
        assertNotNull(polygonSymbolizer);

        final Stroke stroke = polygonSymbolizer.getStroke();
        assertArrayEquals(Arrays.toString(stroke.getDashArray()), new float[]{5f, 4f}, stroke.getDashArray(), FLOAT_DELTA);

        assertNotNull(polygonSymbolizer.getFill());
    }
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

        PJsonObject json = MapPrinter.parseSpec(jsonString).getJSONObject("*");

        final PJsonArray symb = json.getJSONArray(MapfishJsonStyleVersion2.JSON_SYMB);
        final PointSymbolizer pointSymbolizer = this.helper.createPointSymbolizer(symb.getJSONObject(0));
        final LineSymbolizer lineSymbolizer = this.helper.createLineSymbolizer(symb.getJSONObject(1));
        final PolygonSymbolizer polygonSymbolizer = this.helper.createPolygonSymbolizer(symb.getJSONObject(2));
        final TextSymbolizer textSymbolizer = this.helper.createTextSymbolizer(symb.getJSONObject(3));

        final Graphic graphic = pointSymbolizer.getGraphic();
        assertEquals("rotation", propertyName(graphic.getRotation()));
        assertEquals("graphicOpacity", propertyName(graphic.getOpacity()));
        assertEquals("pointRadius", propertyName(graphic.getSize()));

        Mark mark = (Mark) graphic.graphicalSymbols().get(0);
        assertEquals("graphicName", propertyName(mark.getWellKnownName()));

        assertEquals("fillOpacity", propertyName(mark.getFill().getOpacity()));
        assertEquals("fillColor", propertyName(mark.getFill().getColor()));

        assertEquals("strokeColor", propertyName(mark.getStroke().getColor()));
        assertEquals("strokeOpacity", propertyName(mark.getStroke().getOpacity()));
        assertEquals("strokeWidth", propertyName(mark.getStroke().getWidth()));
        assertEquals("strokeLinecap", propertyName(mark.getStroke().getLineCap()));

        assertEquals("lineStrokeColor", propertyName(lineSymbolizer.getStroke().getColor()));
        assertEquals("lineStrokeOpacity", propertyName(lineSymbolizer.getStroke().getOpacity()));
        assertEquals("lineStrokeWidth", propertyName(lineSymbolizer.getStroke().getWidth()));
        assertEquals("lineStrokeLinecap", propertyName(lineSymbolizer.getStroke().getLineCap()));

        assertEquals("PolyStrokeColor", propertyName(polygonSymbolizer.getStroke().getColor()));
        assertEquals("PolyStrokeOpacity", propertyName(polygonSymbolizer.getStroke().getOpacity()));
        assertEquals("PolyStrokeWidth", propertyName(polygonSymbolizer.getStroke().getWidth()));
        assertEquals("PolyStrokeLinecap", propertyName(polygonSymbolizer.getStroke().getLineCap()));

        assertEquals("PolyFillOpacity", propertyName(polygonSymbolizer.getFill().getOpacity()));
        assertEquals("PolyFillColor", propertyName(polygonSymbolizer.getFill().getColor()));

        assertEquals("fontColor", propertyName(textSymbolizer.getFill().getColor()));
        assertEquals("fontFamily", propertyName(textSymbolizer.getFont().getFamily().get(0)));
        assertEquals("fontSize", propertyName(textSymbolizer.getFont().getSize()));
        assertEquals("fontStyle", propertyName(textSymbolizer.getFont().getStyle()));
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

    @Test
    public void testSpatialNoReprojection() throws Exception {
        // a spatial filter in the same SRS as the geometry
        StyleBuilder sb = new StyleBuilder();
        PolygonSymbolizer ps = sb.createPolygonSymbolizer();
        Style style = sb.createStyle(ps);
        Rule rule = style.featureTypeStyles().get(0).rules().get(0);
        rule.setFilter(ff.bbox("geom", 1, 1, 4, 4, "EPSG:4326"));

        content.addLayer(new FeatureLayer(squareFS, style));
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

   
    @Test
    public void testSpatialDefaulter() throws Exception {
        // a spatial filter in the same SRS as the geometry
        StyleBuilder sb = new StyleBuilder();
        PolygonSymbolizer ps = sb.createPolygonSymbolizer();
        Style style = sb.createStyle(ps);
        Rule rule = style.featureTypeStyles().get(0).rules().get(0);
        rule.setFilter(ff.bbox("geom", 1, 1, 4, 4, null));

        content.addLayer(new FeatureLayer(squareFS, style));
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

        Graphics graphics = bi.getGraphics();
        Graphics2D g = (Graphics2D) graphics;
        if( symb instanceof PolygonSymbolizer){
            PolygonSymbolizer polySymb = (PolygonSymbolizer) symb;
            Color stroke=SLD.polyColor(polySymb);
            double opacity=SLD.polyFillOpacity(polySymb);
            Color fill=SLD.polyFill(polySymb);
            int width = SLD.width(SLD.stroke(polySymb));
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

        String xml = "<PolyStyle>" + "<color>ffff0000</color>" + "<outline>1</outline>"
            + "<fill>1</fill>" + "</PolyStyle>";

        buildDocument(xml);

        PolygonSymbolizer poly = (PolygonSymbolizer) parse();
        assertEquals(Color.RED, SLD.color(poly.getFill()));
        assertEquals(1, SLD.width(poly.getStroke()));

        xml = "<PolyStyle>" + "<color>ffff0000</color>" + "<outline>0</outline>" + "<fill>0</fill>"
            + "</PolyStyle>";

        buildDocument(xml);
        poly = (PolygonSymbolizer) parse();
        assertNull(poly.getFill());
        assertNull(poly.getStroke());

        xml = "<PolyStyle>" + "</PolyStyle>";

        buildDocument(xml);
        poly = (PolygonSymbolizer) parse();
        assertEquals(Color.WHITE, SLD.color(poly.getFill()));
        assertEquals(1, SLD.width(poly.getStroke()));
    }
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

            LineSymbolizer ps = (LineSymbolizer) sym;
            ps.accept(this);
        }

        if (sym instanceof PolygonSymbolizer) {
            PolygonSymbolizer ps = (PolygonSymbolizer) sym;
            ps.accept(this);
        }

        if (sym instanceof RasterSymbolizer) {
            RasterSymbolizer rs = (RasterSymbolizer) sym;
            rs.accept(this);
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

    public PolygonSymbolizer build() {
        if (unset) {
            return null;
        }
        PolygonSymbolizer ps = sf.createPolygonSymbolizer(stroke.build(), fill.build(), null);
        if (geometry != null) {
            ps.setGeometry(geometry);
        }
        if (uom != null) {
            ps.setUnitOfMeasure(uom);
        }
        if (parent == null) {
            reset();
        }
        return ps;
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

        StyleCollector collector = new StyleCollector();
        style.accept(collector);
        assertSimpleStyle(collector);

        // check the symbolizer
        PolygonSymbolizer ps = (PolygonSymbolizer) collector.symbolizers.get(0);
        assertEquals(Color.BLUE, ps.getFill().getColor().evaluate(null, Color.class));
        assertNull(ps.getStroke());
    }
View Full Code Here

Examples of org.geotools.styling.PolygonSymbolizer

        StyleCollector collector = new StyleCollector();
        style.accept(collector);
        assertSimpleStyle(collector);

        // check the symbolizer
        PolygonSymbolizer ps = (PolygonSymbolizer) collector.symbolizers.get(0);
        assertEquals(Color.BLUE, ps.getFill().getColor().evaluate(null, Color.class));
        assertEquals(Color.WHITE, ps.getStroke().getColor().evaluate(null, Color.class));
        assertEquals(2, (int) ps.getStroke().getWidth().evaluate(null, Integer.class));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.