Package org.geotools.styling

Examples of org.geotools.styling.ExternalGraphic


        assertSimpleStyle(collector);

        // check the symbolizer
        PolygonSymbolizer ps = (PolygonSymbolizer) collector.symbolizers.get(0);
        assertNull(ps.getStroke());
        ExternalGraphic eg = (ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols()
                .get(0);
        assertEquals("colorblocks.png", eg.getOnlineResource().getLinkage().toString());
        assertEquals("image/png", eg.getFormat());
    }
View Full Code Here


        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

    public ExternalGraphic build() {
        if (unset) {
            return null;
        }
        ExternalGraphic externalGraphic;
        Collection<ColorReplacement> set = new HashSet<ColorReplacement>();
        for (ColorReplacementBuilder replacement : replacements) {
            set.add(replacement.build());
        }
        if (inline != null) {
View Full Code Here

    }
   
    public void testCreateDynamicExternalGraphics() throws Exception {
        URL url = StreamingRenderer.class.getResource("test-data/");
        PointSymbolizer symb = sf.createPointSymbolizer();
        ExternalGraphic eg = sf.createExternalGraphic(url + "${icon}", "image/png");
        symb.getGraphic().addExternalGraphic(eg);
       
        GraphicStyle2D gs = (GraphicStyle2D) sld.createStyle(feature, symb, range);
        // make sure the style has been recognized as dynamic
        SymbolizerKey key = new SymbolizerKey(symb, range);
View Full Code Here

    }
   
    public void testCreateDynamicExternalGraphicsVector() throws Exception {
        URL url = StreamingRenderer.class.getResource("test-data/");
        PointSymbolizer symb = sf.createPointSymbolizer();
        ExternalGraphic eg = sf.createExternalGraphic(url + "${icon}", "image/png");
        symb.getGraphic().addExternalGraphic(eg);
        sld.setVectorRenderingEnabled(true);
       
        GraphicStyle2D gs = (GraphicStyle2D) sld.createStyle(feature, symb, range);
        // make sure the style has been recognized as dynamic
View Full Code Here

    }
   
    public void testDefaultSizeExternalGraphic() throws Exception {
        URL url = StreamingRenderer.class.getResource("test-data/");
        PointSymbolizer symb = sf.createPointSymbolizer();
        ExternalGraphic eg = sf.createExternalGraphic(url + "icon64.png", "image/png");
        symb.getGraphic().addExternalGraphic(eg);
       
        GraphicStyle2D gs = (GraphicStyle2D) sld.createPointStyle(feature, symb, range);
        BufferedImage img = gs.getImage();
        assertEquals(64, img.getHeight());
View Full Code Here

   
    public void testCreateDynamicExternalFormat() throws Exception {
      feature.setAttribute("symb", "image/png");
        URL url = StreamingRenderer.class.getResource("test-data/");
        PointSymbolizer symb = sf.createPointSymbolizer();
        ExternalGraphic eg = sf.createExternalGraphic(url + "${icon}", "${symb}");
        symb.getGraphic().addExternalGraphic(eg);
       
        GraphicStyle2D gs = (GraphicStyle2D) sld.createStyle(feature, symb, range);
        // make sure the style has been recognized as dynamic
        SymbolizerKey key = new SymbolizerKey(symb, range);
View Full Code Here

    }

    public void testResizeExternalGraphic() throws Exception {
        URL url = StreamingRenderer.class.getResource("test-data/");
        PointSymbolizer symb = sf.createPointSymbolizer();
        ExternalGraphic eg = sf.createExternalGraphic(url + "icon64.png", "image/png");
        symb.getGraphic().graphicalSymbols().add(eg);
        symb.getGraphic().setSize(ff.literal(20));
       
        GraphicStyle2D gs = (GraphicStyle2D) sld.createPointStyle(feature, symb, range);
        BufferedImage img = gs.getImage();
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);
View Full Code Here

     }
   
   
     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

TOP

Related Classes of org.geotools.styling.ExternalGraphic

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.