Examples of ExternalGraphic


Examples of org.geotools.styling.ExternalGraphic

    }
   

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

Examples of org.geotools.styling.ExternalGraphic

        f.appendChild(document.createTextNode("image/png"));

        document.getDocumentElement().appendChild(c);
        document.getDocumentElement().appendChild(f);

        ExternalGraphic externalGraphic = (ExternalGraphic) parse();
        assertNotNull(externalGraphic);

        assertEquals("image/png", externalGraphic.getFormat());
        assertImagesEqual(getReferenceImage("inlineContent-image.png"), externalGraphic.getInlineContent());
        assertNull(externalGraphic.getLocation());
    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

        f.appendChild(document.createTextNode("image/png"));

        document.getDocumentElement().appendChild(c);
        document.getDocumentElement().appendChild(f);

        ExternalGraphic externalGraphic = (ExternalGraphic) parse();
        assertNotNull(externalGraphic);

        assertEquals("image/png", externalGraphic.getFormat());
        assertNotNull(externalGraphic.getInlineContent());
        assertEquals(1, externalGraphic.getInlineContent().getIconWidth());
        assertEquals(1, externalGraphic.getInlineContent().getIconHeight());
        assertNull(externalGraphic.getLocation());
    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

       
        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

Examples of org.geotools.styling.ExternalGraphic

        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

Examples of org.geotools.styling.ExternalGraphic

        f.appendChild(document.createTextNode("image/png"));

        document.getDocumentElement().appendChild(r);
        document.getDocumentElement().appendChild(f);

        ExternalGraphic externalGraphic = (ExternalGraphic) parse();
        assertNotNull(externalGraphic);

        assertEquals(getClass().getResource("eclipse.png"), externalGraphic.getLocation());
        assertEquals("image/png", externalGraphic.getFormat());
    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

     * <!-- begin-user-doc --> <!-- end-user-doc -->
     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
        ExternalGraphic g;
        if (node.hasChild("InlineContent")) {
            String format = (String) node.getChildValue("Format");
            Icon icon = (Icon) node.getChildValue("InlineContent");
            g = styleFactory.createExternalGraphic(icon, format);
        } else {
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

        f.appendChild(document.createTextNode("image/png"));

        document.getDocumentElement().appendChild(r);
        document.getDocumentElement().appendChild(f);

        ExternalGraphic externalGraphic = (ExternalGraphic) parse();
        assertNotNull(externalGraphic);

        assertEquals(SETestSupport.class.getResource("inlineContent-image.png"), externalGraphic.getLocation());
        assertEquals("image/png", externalGraphic.getFormat());
        assertNull(externalGraphic.getInlineContent());
    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

    private boolean hasDynamicGraphic(Graphic gr) {
        // not a fixed size, let's see if it has dynamic graphics inside
        for (GraphicalSymbol gs : gr.graphicalSymbols()) {
            if (gs instanceof ExternalGraphic) {
                ExternalGraphic eg = (ExternalGraphic) gs;
                try {
                    Icon icon = null;
                    if (eg.getInlineContent() != null) {
                        icon = eg.getInlineContent();
                    } else {
                        String location = eg.getLocation().toExternalForm();
                        // expand embedded cql expression
                        Expression expanded = ExpressionExtractor.extractCqlExpressions(location);
                        // if not a literal there is an attribute dependency
                        if (!(expanded instanceof Literal)) {
                            return true;
                        }

                        Iterator<ExternalGraphicFactory> it = DynamicSymbolFactoryFinder
                                .getExternalGraphicFactories();
                        while (it.hasNext()) {
                            try {
                                icon = it.next().getIcon(null, expanded, eg.getFormat(), 16);
                            } catch (Exception e) {
                                LOGGER.log(Level.FINE,
                                        "Error occurred evaluating external graphic", e);
                            }
                        }
View Full Code Here

Examples of org.opengis.style.ExternalGraphic

               
                // Note: Converting to Radians here due to direct use of SLD Expressions which uses degrees
                double rotation = Math.toRadians( ((Literal)legend.getRotation()).evaluate(null,  Double.class));
                float opacity = ((Literal)legend.getOpacity()).evaluate(null,  Float.class);

                ExternalGraphic graphic = (ExternalGraphic) symbol;

                while (!(iter.isDone())) {
                    iter.currentSegment(coords);
                    try {
                        BufferedImage image = ImageIO.read(graphic.getOnlineResource().getLinkage().toURL());
                        if (symbolScale != 1.0){
                            int w = (int) (image.getWidth() / symbolScale);
                            int h = (int) (image.getHeight() / symbolScale);
                            int imageType = image.getType() == 0 ? BufferedImage.TYPE_4BYTE_ABGR : image.getType();
                            BufferedImage rescaled = new BufferedImage(w, h, imageType);
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.