Package org.geotools.styling

Examples of org.geotools.styling.Graphic


        notEq.setUnitOfMeasure(UomOgcMapping.METRE.getUnit());
        assertEqualsContract(clone, notEq, lineSymb);
    }

    public void testGraphic() {
        Graphic graphic = sf.getDefaultGraphic();
        graphic.addMark(sf.getDefaultMark());

        Graphic clone = (Graphic) visitor.copy( graphic);
        assertCopy(graphic, clone);
        assertEqualsContract(clone, graphic);
        assertEquals(clone.getSymbols().length, graphic.getSymbols().length);

        Graphic notEq = sf.getDefaultGraphic();
        assertEqualsContract(clone, notEq, graphic);
    }
View Full Code Here


   

    public void testPointSymbolizerWithGeomFunction() throws Exception {
        URL urlExternal = getClass().getResource("/data/sld/blob.gif");
        ExternalGraphic extg = sb.createExternalGraphic(urlExternal, "image/svg+xml");
        Graphic graphic = sb.createGraphic(extg, null, null);
        PointSymbolizer pointSymb = sb.createPointSymbolizer(graphic);
       
        // Set a function as geometry
        Function geomFunc = ff.function("centroid", ff.property("thr_geom"));
        pointSymb.setGeometry(geomFunc);
View Full Code Here

        geometryName.setInput(schema);
        String name = DEFAULT_GEOMETRY;

        Stroke stroke = null;
        Fill fill = null;
        Graphic graphic = null;
        TextSymbolizer text = null;
        LabelPlacement placement = null;

        List<Rule> rules = Collections.emptyList();
        if (fts != null)
View Full Code Here

    }

    public void test() throws Exception {
        SLDMockData.graphic(document, document);

        Graphic graphic = (Graphic) parse();
        assertNotNull(graphic);

        assertEquals(graphic.getMarks().length, 1);

        Mark mark = graphic.getMarks()[0];

        Color c = org.geotools.styling.SLD.color(mark.getFill().getColor());
        assertEquals(Integer.parseInt("12", 16), c.getRed());
        assertEquals(Integer.parseInt("34", 16), c.getGreen());
        assertEquals(Integer.parseInt("56", 16), c.getBlue());

        assertEquals(1, Filters.asInt(graphic.getSize()));
        assertEquals(1, Filters.asInt(graphic.getOpacity()));
        assertEquals(90, Filters.asInt(graphic.getRotation()));
    }
View Full Code Here

    public QName getTarget() {
        return SE.GraphicStroke;
    }

    public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
        Graphic g = (Graphic) super.parse(instance, node, value);
       
        //&lt;xsd:element minOccurs="0" ref="se:InitialGap"/&gt;
        if (node.hasChild("InitialGap")) {
            g.setInitialGap((Expression)node.getChildValue("InitialGap"));
        }
        //&lt;xsd:element minOccurs="0" ref="se:Gap"/&gt;
        if (node.hasChild("Gap")) {
            g.setGap((Expression)node.getChildValue("Gap"));
        }
        return g;
    }
View Full Code Here

    }

    public void test() throws Exception {
        SLDMockData.graphicStroke(document, document);

        Graphic graphic = (Graphic) parse();
        assertNotNull(graphic);
    }
View Full Code Here

        PointSymbolizer sym = (PointSymbolizer) parse("example-pointsymbolizer1.xml");
        assertEquals("Example Pointsymbolizer", sym.getDescription().getTitle().toString());
        assertEquals("This is just a simple example of a point symbolizer.",
                sym.getDescription().getAbstract().toString());
       
        Graphic g = sym.getGraphic();
        assertEquals(8.0, g.getSize().evaluate(null, Double.class));
        assertEquals(1, g.getMarks().length);
       
        Mark m = g.getMarks()[0];
        assertEquals("star", m.getWellKnownName().evaluate(null, String.class));
        Color c = m.getFill().getColor().evaluate(null, Color.class);
        assertEquals(255, c.getRed());
    }
View Full Code Here

        assertEquals("MyPointSymbolizer", sym.getName());
        assertEquals("Example Pointsymbolizer", sym.getDescription().getTitle().toString());
        assertEquals("This is just a simple example of a point symbolizer.",
                sym.getDescription().getAbstract().toString());
       
        Graphic g = sym.getGraphic();
        assertEquals(15.0, g.getSize().evaluate(null, Double.class));
        assertEquals(2, g.getExternalGraphics().length);
       
        ExternalGraphic eg = g.getExternalGraphics()[0];
        assertEquals("http://www.vendor.com/geosym/2267.svg", eg.getLocation().toString());
        assertEquals("image/svg+xml", eg.getFormat());
       
        eg = g.getExternalGraphics()[1];
        assertEquals("http://www.vendor.com/geosym/2267.png", eg.getLocation().toString());
        assertEquals("image/png", eg.getFormat());
    }
View Full Code Here

        assertEquals("MyPointSymbolizer", sym.getName());
        assertEquals("Example Pointsymbolizer", sym.getDescription().getTitle().toString());
        assertEquals("This is just a simple example of a point symbolizer.",
                sym.getDescription().getAbstract().toString());

        Graphic g = sym.getGraphic();
        assertEquals(15.0, g.getSize().evaluate(null, Double.class));
        assertEquals(1, g.graphicalSymbols().size());

        ExternalGraphic eg = (ExternalGraphic) g.graphicalSymbols().get(0);
        assertNull(eg.getLocation());
        assertEquals("image/png", eg.getFormat());
        assertImagesEqual(referenceImage, eg.getInlineContent());
        assertNull(eg.getLocation());
    }
View Full Code Here

        assertEquals("MyPointSymbolizer", sym.getName());
        assertEquals("Example Pointsymbolizer", sym.getDescription().getTitle().toString());
        assertEquals("This is just a simple example of a point symbolizer.",
                sym.getDescription().getAbstract().toString());

        Graphic g = sym.getGraphic();
        assertEquals(15.0, g.getSize().evaluate(null, Double.class));
        assertEquals(1, g.graphicalSymbols().size());

        Mark mark = (Mark) g.graphicalSymbols().get(0);
        ExternalMark em = mark.getExternalMark();
        assertNotNull(em);
        assertEquals("image/png", em.getFormat());
        assertImagesEqual(referenceImage, em.getInlineContent());
        assertNull(em.getOnlineResource());
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.