root / trunk / extensions / extRasterTools-SE / src / org / gvsig / fmap / layers / RasterSEAdapter.java @ 11084
History | View | Annotate | Download (6.88 KB)
1 |
/*
|
---|---|
2 |
* Created on 20-dic-2004
|
3 |
*/
|
4 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
package org.gvsig.fmap.layers; |
45 |
|
46 |
import java.awt.Dimension; |
47 |
import java.awt.Graphics2D; |
48 |
import java.awt.Image; |
49 |
import java.awt.geom.Rectangle2D; |
50 |
import java.awt.image.BufferedImage; |
51 |
import java.io.IOException; |
52 |
import java.util.ArrayList; |
53 |
|
54 |
import org.cresques.cts.ICoordTrans; |
55 |
import org.gvsig.fmap.drivers.GenericRasterDriver; |
56 |
import org.gvsig.raster.buffer.BufferFactory; |
57 |
import org.gvsig.raster.grid.render.Rendering; |
58 |
|
59 |
import com.hardcode.driverManager.Driver; |
60 |
import com.iver.cit.gvsig.fmap.ViewPort; |
61 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
62 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
63 |
import com.iver.utiles.swing.threads.Cancellable; |
64 |
|
65 |
public class RasterSEAdapter { |
66 |
private GenericRasterDriver driver;
|
67 |
|
68 |
/**
|
69 |
* Establece el driver sobre el que act?a el adaptador
|
70 |
*/
|
71 |
public void setDriver(Driver driver) { |
72 |
this.driver = (GenericRasterDriver) driver;
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* Obtiene una referencia al objeto que implementa la interfaz vectorial con
|
77 |
* el fin de que las Strategy puedan optimizar en funci?n del driver.
|
78 |
*/
|
79 |
public Driver getDriver(){ |
80 |
return driver;
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* Obtiene una imagen de tama?o especificado, de la zona (en
|
85 |
* coordenadas de usuario) que se le pide.
|
86 |
* @param size Tama?o (en p?xeles de im?gen).
|
87 |
* @param userSize Zona especificada (en coordenadas de usuario).
|
88 |
* @param rp Reproyecci?n.
|
89 |
* @return La imagen.
|
90 |
*/
|
91 |
public Image getImage(Dimension size, Rectangle2D userSize, ICoordTrans rp) { |
92 |
return ((GenericRasterDriver) driver).getImage(size, userSize, rp);
|
93 |
} |
94 |
|
95 |
/**
|
96 |
* Obtiene el valor de transparencia
|
97 |
* @return entero que representa el valor de transparencia
|
98 |
*/
|
99 |
public int getTransparency() { |
100 |
return ((GenericRasterDriver) driver).getTransparency();
|
101 |
} |
102 |
|
103 |
/**
|
104 |
* Asigna el valor de transparencia
|
105 |
* @param trans entero que representa el valor de transparencia
|
106 |
*/
|
107 |
public void setTransparency(int trans) { |
108 |
((GenericRasterDriver) driver).setTransparency(trans); |
109 |
} |
110 |
|
111 |
/**
|
112 |
* @see com.iver.cit.gvsig.fmap.layers.LayerOperations#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, ISymbol)
|
113 |
*/
|
114 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, Cancellable cancel) throws DriverIOException { |
115 |
((GenericRasterDriver) driver).draw(image,g, vp); |
116 |
} |
117 |
|
118 |
/**
|
119 |
* Obtiene la lista de atributos de raster
|
120 |
* @return lista de atributos. Cada elmento de la lista es un array Object
|
121 |
* con dos elementos. El primero el nombre del atributo y el segundo el valor
|
122 |
* del mismo.
|
123 |
*/
|
124 |
public ArrayList getAttributes() { |
125 |
return ((GenericRasterDriver) driver).getAttributes();
|
126 |
} |
127 |
|
128 |
/**
|
129 |
* Devuelve el colorBand activo en la banda especificada.
|
130 |
* @param flag banda.
|
131 |
* @return color de banda activo
|
132 |
*/
|
133 |
public int getBand(int flag){ |
134 |
return ((GenericRasterDriver) driver).getBand(flag);
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* Devuelve la posici?n del fichero para la banda especificada.
|
139 |
* @param flag banda.
|
140 |
* @return posici?n del fichero
|
141 |
*/
|
142 |
public int getPosFile(int flag){ |
143 |
return ((GenericRasterDriver) driver).getPosFile(flag);
|
144 |
} |
145 |
|
146 |
/**
|
147 |
* Activa o desactiva la transparencia
|
148 |
* @param t true activa la transparencia y false la desactiva
|
149 |
*/
|
150 |
public void setTransparency(boolean t){ |
151 |
((GenericRasterDriver) driver).setTransparency(t); |
152 |
} |
153 |
|
154 |
/**
|
155 |
* Asocia un colorBand al rojo, verde o azul.
|
156 |
* @param flag cual (o cuales) de las bandas.
|
157 |
* @param nBand que colorBand
|
158 |
*/
|
159 |
public void setBand(int flag, int nBand){ |
160 |
((GenericRasterDriver) driver).setBand(flag, nBand); |
161 |
} |
162 |
|
163 |
/**
|
164 |
* Obtiene el tipo de dato de la imagen
|
165 |
* @return entero que representa el tipo de dato. La clase RasterBuf
|
166 |
* tiene accesible de forma est?tica todos los tipos de datos permitidos
|
167 |
*/
|
168 |
public int getDataType(){ |
169 |
return ((GenericRasterDriver) driver).getRasterDataType();
|
170 |
} |
171 |
|
172 |
/**
|
173 |
* Obtiene la pila de filtros
|
174 |
* @return pila de filtros
|
175 |
*/
|
176 |
/*public RasterFilterStack getFilterStack(){
|
177 |
return ((GenericRasterDriver) driver).getFilterStack();
|
178 |
}*/
|
179 |
|
180 |
/**
|
181 |
* Asigna la pila de filtros
|
182 |
* @param pila de filtros
|
183 |
*/
|
184 |
/*public void setFilterStack(RasterFilterStack stack){
|
185 |
((GenericRasterDriver) driver).setFilterStack(stack);
|
186 |
}*/
|
187 |
|
188 |
/**
|
189 |
*
|
190 |
* @return
|
191 |
*/
|
192 |
/*public GeoRasterFile[] getFiles(){
|
193 |
return ((GenericRasterDriver) driver).getFiles();
|
194 |
}*/
|
195 |
|
196 |
/**
|
197 |
* Obtiene el n?mero de bandas de la imagen
|
198 |
* @return n?mero de bandas
|
199 |
*/
|
200 |
public int getNumBands(){ |
201 |
return ((GenericRasterDriver)driver).getNumBands();
|
202 |
} |
203 |
|
204 |
/**
|
205 |
* Obtiene el extent de la vista
|
206 |
* @return extent
|
207 |
*/
|
208 |
public Rectangle2D getFullExtent(){ |
209 |
return ((GenericRasterDriver)driver).getFullExtent();
|
210 |
} |
211 |
|
212 |
/**
|
213 |
* Asigna un fichero al PxRaster
|
214 |
* @param fileName Nombre del fichero
|
215 |
*/
|
216 |
public void addFile(String fileName)throws IOException{ |
217 |
((GenericRasterDriver)driver).addFile(fileName); |
218 |
} |
219 |
|
220 |
/**
|
221 |
* Elimina un fichero al PxRaster
|
222 |
* @param fileName Nombre del fichero
|
223 |
*/
|
224 |
public void delFile(String fileName){ |
225 |
((GenericRasterDriver)driver).delFile(fileName); |
226 |
} |
227 |
|
228 |
/**
|
229 |
* Obtiene el valor del pixel del Image en la posici?n x,y
|
230 |
* @param x Posici?n x
|
231 |
* @param y Posici?n y
|
232 |
* @return valor de pixel
|
233 |
*/
|
234 |
public int[] getPixel(double wcx, double wcy){ |
235 |
return ((GenericRasterDriver)driver).getPixel(wcx, wcy);
|
236 |
} |
237 |
|
238 |
/**
|
239 |
* Obtiene el flag que dice si la imagen est? o no georreferenciada
|
240 |
* @return true si est? georreferenciada y false si no lo est?.
|
241 |
*/
|
242 |
public boolean isGeoreferenced() { |
243 |
return ((GenericRasterDriver)driver).isGeoreferenced();
|
244 |
} |
245 |
|
246 |
/**
|
247 |
* Get datasource object
|
248 |
* @return
|
249 |
*/
|
250 |
public BufferFactory getDatasource(){
|
251 |
return ((GenericRasterDriver)driver).getDatasource();
|
252 |
} |
253 |
|
254 |
/**
|
255 |
* Get render object
|
256 |
* @return Rendering
|
257 |
*/
|
258 |
public Rendering getRender(){
|
259 |
return ((GenericRasterDriver)driver).getRender();
|
260 |
} |
261 |
} |