Examples of ExternalGraphic


Examples of org.geotools.styling.ExternalGraphic

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

Examples of org.geotools.styling.ExternalGraphic

     }
   
   
     public void testFallbackGraphicMark() throws Exception {
         PointSymbolizer symb = sf.createPointSymbolizer();
         ExternalGraphic eg = sf.createExternalGraphic("http://foo.com/invalid_or_missing_image_url", null);
         symb.getGraphic().graphicalSymbols().add(eg);
        
         Style2D icon = sld.createPointStyle(feature, symb, range);
         assertNotNull(icon);
     }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

            }
           

            for (GraphicalSymbol gs : gr.graphicalSymbols()) {
                if(gs instanceof ExternalGraphic) {
                    ExternalGraphic eg = (ExternalGraphic) gs;
                    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)) {
                            estimateAccurate = false;
                            return;
                        }
                       
                        Iterator<ExternalGraphicFactory> it  = DynamicSymbolFactoryFinder.getExternalGraphicFactories();
                        while(it.hasNext() && icon == null) {
                            try {
                                ExternalGraphicFactory factory = it.next();
                                icon = factory.getIcon(null, expanded, eg.getFormat(), imageSize);
                            } catch(Exception e) {
                                LOGGER.log(Level.FINE, "Error occurred evaluating external graphic", e);
                            }
                        }
                    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

    List<GraphicalSymbol> symbols = sldGraphic.graphicalSymbols();
    if (symbols == null || symbols.isEmpty()) {
      return null;
    }
    final int length = symbols.size();
    ExternalGraphic eg;
    BufferedImage img = null;
    double dsize;
    AffineTransform scaleTx;
    AffineTransformOp ato;
    BufferedImage scaledImage;
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

        Icon icon = null;
        Mark mark = null;
        Shape shape = null;
        for (GraphicalSymbol symbol : gr.graphicalSymbols()) {
            if(symbol instanceof ExternalGraphic) {
                ExternalGraphic eg = (ExternalGraphic) symbol;
                icon = getIcon(eg, feature, graphicSize);
                if (icon != null) {
                    break;
                }   
            } else if(symbol instanceof Mark) {
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

    Style style = styleBuilder.createStyle();
   
    PointSymbolizer pointSymbolizer = styleBuilder.createPointSymbolizer();
   
    Graphic graphic = styleBuilder.createGraphic();
    ExternalGraphic external = styleBuilder.createExternalGraphic("file:///C:/images/house.gif",
            "image/gif");
    graphic.graphicalSymbols().add(external);
    graphic.graphicalSymbols().add(styleBuilder.createMark("circle"));
   
    pointSymbolizer.setGraphic(graphic);
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

        catch (MalformedURLException huh ){
           
        }
        String format = exgr.getFormat();
        Icon inlineContent = exgr.getInlineContent();
        ExternalGraphic copy;
        if (inlineContent != null) {
            copy = sf.createExternalGraphic(inlineContent, format);
        } else {
            copy = sf.createExternalGraphic(uri, format);
        }
        copy.setCustomProperties( copy(exgr.getCustomProperties()));
       
        if( STRICT && !copy.equals( exgr )){
            throw new IllegalStateException("Was unable to duplicate provided ExternalGraphic:"+exgr );
        }
        pages.push(copy);      
    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

        assertTrue(!rule.equals(clone));
    }

    public void testPointSymbolizer() 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);

        pointSymb.accept(visitor);
        PointSymbolizer clone = (PointSymbolizer) visitor.getCopy();
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

        Graphic notEq = sf.getDefaultGraphic();
        assertEqualsContract(clone, notEq, graphic);
    }

    public void testExternalGraphic() {
        ExternalGraphic exGraphic = sf.createExternalGraphic("http://somewhere",
                "image/png");
        ExternalGraphic clone = visitor.copy( exGraphic);
        assertCopy(exGraphic, clone);

        ExternalGraphic notEq = sf.createExternalGraphic("http://somewhereelse",
                "image/jpeg");
        assertEqualsContract(clone, notEq, exGraphic);

        // make sure it works for different format, same url
        ExternalGraphic notEq2 = visitor.copy( clone);
        notEq2.setFormat("image/jpeg");
        assertEqualsContract(clone, notEq2, exGraphic);
    }
View Full Code Here

Examples of org.geotools.styling.ExternalGraphic

            public int getIconHeight() {
                return 16;
            }
        };

        ExternalGraphic exGraphic = sf.createExternalGraphic(icon, "image/png");
        ExternalGraphic clone = visitor.copy(exGraphic);
        assertCopy(exGraphic, clone);
        assertSame(exGraphic.getInlineContent(), clone.getInlineContent());

        ExternalGraphic notEq = sf.createExternalGraphic(icon, "image/jpeg");
        assertEqualsContract(clone, notEq, exGraphic);

        // make sure it works for different format, same content
        ExternalGraphic notEq2 = visitor.copy(clone);
        notEq2.setFormat("image/jpeg");
        assertEqualsContract(clone, notEq2, exGraphic);
    }
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.