Revision 9075

View differences:

trunk/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java
1734 1734
	}
1735 1735

  
1736 1736
	public Image getImageLegend() {
1737
		try {
1738 1737
			if (wms.hasLegendGraphic() ){
1739 1738
				wmsStatus.setOnlineResource((String) onlineResources.get("GetLegendGraphic"));
1740
				File legend = getDriver().getLegendGraphic(wmsStatus, layerQuery, null);
1739
				String path=getPathImage();//File legend = getDriver().getLegendGraphic(wmsStatus, layerQuery, null);
1741 1740
				Image img = null;
1742
				if ((legend!= null) && (legend.length() > 0))
1743
					//img = ImageIO.read(legend);
1744
					img = new ImageIcon(legend.getAbsolutePath()).getImage();
1741
				if ((path!= null) && (path.length() > 0))
1742
					img = new ImageIcon(path).getImage();
1745 1743
				return img;
1746
			}else{
1744
			}
1747 1745
				return null;
1748
			}
1746
	}
1747

  
1748
	public String getPathImage() {
1749
		try {
1750
			File legend = getDriver().getLegendGraphic(wmsStatus, layerQuery, null);
1751
			return legend.getAbsolutePath();
1749 1752
		}catch(Exception e){
1750 1753
			e.printStackTrace();
1751 1754
			return null;
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFramePicture.java
347 347
        } else if (iString.endsWith("svg")) {
348 348
            isSVG = true;
349 349
            obtainStaticRenderer(new File(file));
350
        }else {
351
        	tmpIcon=new ImageIcon(file);
350 352
        }
351 353

  
352 354
        if (!isSVG && (tmpIcon != null)) {
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrameLegend.java
43 43
import java.awt.Color;
44 44
import java.awt.Font;
45 45
import java.awt.Graphics2D;
46
import java.awt.Image;
46 47
import java.awt.Rectangle;
47 48
import java.awt.geom.AffineTransform;
48 49
import java.awt.geom.Rectangle2D;
......
56 57
import com.iver.cit.gvsig.fmap.layers.FLayer;
57 58
import com.iver.cit.gvsig.fmap.layers.FLayers;
58 59
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
60
import com.iver.cit.gvsig.fmap.layers.FLyrRaster;
59 61
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
60 62
import com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable;
63
import com.iver.cit.gvsig.fmap.layers.layerOperations.IHasImageLegend;
61 64
import com.iver.cit.gvsig.fmap.rendering.ClassifiedLegendInfo;
62 65
import com.iver.cit.gvsig.gui.layout.Layout;
63 66
import com.iver.cit.gvsig.project.documents.exceptions.SaveException;
......
234 237
                    	n[0]++;
235 238
                    drawLegendOrToFFrame(g, re, h, (FLayers) layer, n, layout);
236 239
                    n[0]++;
237
                } else if (layer instanceof AlphanumericData) {
240
                } else if (layer instanceof AlphanumericData && !(layer instanceof IHasImageLegend) ) {
238 241
                    AlphanumericData cO = (AlphanumericData) layer;
239 242

  
240 243
                    if (((Classifiable) cO).getLegend() instanceof ClassifiedLegendInfo && !(cO instanceof FLyrAnnotation)) {
......
299 302
                        }
300 303
                        n[0]++;
301 304
                    }
302
                }else{
305
                }else if (layer instanceof IHasImageLegend){
306
                	Image image=((IHasImageLegend)layer).getImageLegend();
307
                	String path=((IHasImageLegend)layer).getPathImage();
308
                	FFramePicture picture=new FFramePicture();
309
                	BufferedImage bi = new BufferedImage(image.getWidth(null),
310
                            image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
311
                    Graphics2D biContext = bi.createGraphics();
312
                    biContext.drawImage(image, 0, 0, null);
313
                    picture.setImage(bi);
314
                    double dY = n[0] * h;
315
                    Rectangle2D rectImage=new Rectangle2D.Double(re.getX(),re.getY()+dY,re.getWidth(),h);
316
                   if (layout!=null) {
317
                    	picture.setBoundBox(FLayoutUtilities.toSheetRect(rectImage, layout.getAT()));
318
                    	picture.setPath(path);
319
                    	layout.addFFrame(picture, false, true);
320
                    }else {
321
                    	picture.setBoundBox(FLayoutUtilities.toSheetRect(rectImage,new AffineTransform()));
322
                        picture.draw(g,new AffineTransform(),re,bi);
323
                    }
324
                    n[0]++;
325
                }else {
303 326
                	double dX = 0;
304 327
                    double dY = n[0] * h;
305 328

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/layerOperations/IHasImageLegend.java
43 43
import java.awt.Image;
44 44

  
45 45
public interface IHasImageLegend {
46
	
46

  
47 47
	Image getImageLegend();
48
	String getPathImage();
48 49

  
49 50
}
50 51

  

Also available in: Unified diff