root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / FLyrRaster.java @ 993
History | View | Annotate | Download (3.17 KB)
1 |
/* Generated by Together */
|
---|---|
2 |
package com.iver.cit.gvsig.fmap.layers; |
3 |
|
4 |
import java.awt.Graphics2D; |
5 |
import java.awt.Point; |
6 |
import java.awt.geom.Rectangle2D; |
7 |
import java.awt.image.BufferedImage; |
8 |
|
9 |
import org.cresques.cts.IProjection; |
10 |
|
11 |
import com.iver.cit.gvsig.fmap.DriverException; |
12 |
import com.iver.cit.gvsig.fmap.ViewPort; |
13 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
14 |
import com.iver.cit.gvsig.fmap.drivers.GeorreferencedRasterDriver; |
15 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
16 |
import com.iver.utiles.XMLEntity; |
17 |
|
18 |
/**
|
19 |
* DOCUMENT ME!
|
20 |
*
|
21 |
* @author Vicente Caballero Navarro
|
22 |
*/
|
23 |
public class FLyrRaster extends FLyrDefault implements RasterOperations { |
24 |
private RasterAdapter source;
|
25 |
|
26 |
public RasterAdapter getSource() {
|
27 |
return source;
|
28 |
} |
29 |
|
30 |
public void setSource(RasterAdapter ra) { |
31 |
source = ra; |
32 |
} |
33 |
|
34 |
/*
|
35 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#load()
|
36 |
*/
|
37 |
public void load() { |
38 |
try {
|
39 |
((RasterFileAdapter) source).start(); |
40 |
} catch (DriverIOException e) {
|
41 |
// TODO LWS Guarradita. Arreglarlo cuanto antes 20-12-04
|
42 |
e.printStackTrace(); |
43 |
} |
44 |
} |
45 |
|
46 |
/**
|
47 |
* @see com.iver.cit.gvsig.fmap.layers.LayerOperations#draw(java.awt.image.BufferedImage,
|
48 |
* java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort,
|
49 |
* com.iver.cit.gvsig.fmap.operations.Cancellable)
|
50 |
*/
|
51 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, |
52 |
Cancellable cancel) throws DriverException {
|
53 |
try {
|
54 |
((RasterFileAdapter) source).draw(image, g, vp, cancel); |
55 |
} catch (DriverIOException e) {
|
56 |
throw new DriverException(e); |
57 |
} |
58 |
if (getVirtualLayers() != null) |
59 |
getVirtualLayers().draw(image, g, vp, cancel); |
60 |
} |
61 |
|
62 |
public void setProjection(IProjection proj) { |
63 |
super.setProjection(proj);
|
64 |
if (source.getDriver() instanceof GeorreferencedRasterDriver) { |
65 |
GeorreferencedRasterDriver geoDrv = (GeorreferencedRasterDriver) source.getDriver(); |
66 |
if (geoDrv.getProjection() == null) |
67 |
geoDrv.setProjection(proj); |
68 |
} |
69 |
} |
70 |
|
71 |
/*
|
72 |
* @see com.iver.cit.gvsig.fmap.layers.LayerOperations#getFullExtent()
|
73 |
*/
|
74 |
public Rectangle2D getFullExtent() throws DriverException { |
75 |
return ((RasterFileAdapter) source).getFullExtent();
|
76 |
} |
77 |
|
78 |
/**
|
79 |
* @see com.iver.cit.gvsig.fmap.layers.RasterOperations#queryByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint)
|
80 |
*/
|
81 |
public String queryByPoint(Point point) { |
82 |
return null; |
83 |
} |
84 |
|
85 |
/**
|
86 |
* DOCUMENT ME!
|
87 |
*
|
88 |
* @return DOCUMENT ME!
|
89 |
*
|
90 |
* @throws DriverException
|
91 |
*
|
92 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getProperties()
|
93 |
*/
|
94 |
public XMLEntity getXMLEntity(){
|
95 |
XMLEntity xml = super.getXMLEntity();
|
96 |
if (source instanceof RasterFileAdapter) { |
97 |
xml.putProperty("file", ((RasterFileAdapter) source).getFile());
|
98 |
} |
99 |
xml.putProperty("driverName", getSource().getDriver().getName());
|
100 |
//TODO Falta que implementar.
|
101 |
return xml;
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* DOCUMENT ME!
|
106 |
*
|
107 |
* @param xml DOCUMENT ME!
|
108 |
*/
|
109 |
public void setXMLEntity(XMLEntity xml) { |
110 |
} |
111 |
|
112 |
/* (non-Javadoc)
|
113 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.operations.Cancellable)
|
114 |
*/
|
115 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel) throws DriverException { |
116 |
draw(null,g,viewPort,cancel);
|
117 |
} |
118 |
} |