gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.api / src / main / java / org / gvsig / fmap / dal / coverage / store / RasterDataStore.java @ 162
History | View | Annotate | Download (12.4 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.fmap.dal.coverage.store; |
23 |
|
24 |
import java.awt.geom.AffineTransform; |
25 |
import java.awt.geom.Point2D; |
26 |
|
27 |
import org.cresques.cts.IProjection; |
28 |
import org.gvsig.fmap.dal.DataStore; |
29 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
30 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
31 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
32 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
33 |
import org.gvsig.fmap.dal.coverage.exception.HistogramException; |
34 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
35 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
36 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
37 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
38 |
import org.gvsig.fmap.dal.coverage.grid.render.Render; |
39 |
import org.gvsig.fmap.dal.coverage.process.vector.Vectorization; |
40 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
41 |
import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
42 |
import org.gvsig.fmap.dal.coverage.store.props.Histogram; |
43 |
import org.gvsig.fmap.dal.coverage.store.props.Metadata; |
44 |
import org.gvsig.fmap.dal.coverage.store.props.SerialInfo; |
45 |
import org.gvsig.fmap.dal.coverage.store.props.Statistics; |
46 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
47 |
import org.gvsig.fmap.dal.exception.CloseException; |
48 |
|
49 |
/**
|
50 |
* Interfaz que deben implementar los almacenes de datos raster.
|
51 |
*
|
52 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
53 |
*/
|
54 |
public interface RasterDataStore extends DataStore { |
55 |
public static final int RED_BAND = 0x01; |
56 |
public static final int GREEN_BAND = 0x02; |
57 |
public static final int BLUE_BAND = 0x04; |
58 |
public static final int ALPHA_BAND = 0x08; |
59 |
|
60 |
/**
|
61 |
* Obtiene el tipo de dato por banda
|
62 |
* @return tipo de dato por banda
|
63 |
*/
|
64 |
public int[] getDataType(); |
65 |
|
66 |
/**
|
67 |
* Obtiene el valor NoData asociado al raster.
|
68 |
* @return
|
69 |
*/
|
70 |
public double getNoDataValue(); |
71 |
|
72 |
/**
|
73 |
* Vuelve a poner el valor noData como estaba inicialmente
|
74 |
*/
|
75 |
public void resetNoDataValue(); |
76 |
|
77 |
/**
|
78 |
* Define el valor NoData asociado al raster.
|
79 |
* @return
|
80 |
*/
|
81 |
public void setNoDataValue(double value); |
82 |
|
83 |
/**
|
84 |
* Obtiene si esta activo el valor NoData asociado al raster.
|
85 |
* @return
|
86 |
*/
|
87 |
public boolean isNoDataEnabled(); |
88 |
|
89 |
/**
|
90 |
* Define si se activa el valor NoData asociado al raster.
|
91 |
* @return
|
92 |
*/
|
93 |
public void setNoDataEnabled(boolean enabled); |
94 |
|
95 |
/**
|
96 |
* Obtiene el n?mero de bandas del raster
|
97 |
* @return N?mero de bandas
|
98 |
*/
|
99 |
public int getBandCount(); |
100 |
|
101 |
/**
|
102 |
* Gets the number of sources that this data store has
|
103 |
* @return
|
104 |
*/
|
105 |
public int getDataStoreCount(); |
106 |
|
107 |
/**
|
108 |
* Obtiene la altura del raster en p?xeles.
|
109 |
* @return altura
|
110 |
*/
|
111 |
public double getHeight(); |
112 |
|
113 |
/**
|
114 |
* Obtiene la anchura del raster en p?xeles.
|
115 |
* @return anchura
|
116 |
*/
|
117 |
public double getWidth(); |
118 |
|
119 |
/**
|
120 |
* Obtiene el tama?o de celda del raster
|
121 |
* @return Valor del tama?o de celda
|
122 |
*/
|
123 |
public double getCellSize(); |
124 |
|
125 |
/**
|
126 |
* Obtiene el tama?o de pixel en X
|
127 |
* @return tama?o de pixel en X
|
128 |
*/
|
129 |
public double getPixelSizeX(); |
130 |
|
131 |
/**
|
132 |
* Obtiene el tama?o de pixel en Y
|
133 |
* @return tama?o de pixel en Y
|
134 |
*/
|
135 |
public double getPixelSizeY(); |
136 |
|
137 |
/**
|
138 |
* Obtiene el extent asignado
|
139 |
* @return Extent
|
140 |
*/
|
141 |
public Extent getView();
|
142 |
|
143 |
/**
|
144 |
* Este es el extent sobre el que se ajusta una petici?n para que esta no
|
145 |
* exceda el extent m?ximo del raster. Para un raster sin rotar ser? igual al
|
146 |
* extent pero para un raster rotado ser? igual al extent del raster como si
|
147 |
* no tuviera rotaci?n. Esto ha de ser as? ya que la rotaci?n solo se hace
|
148 |
* sobre la vista y las peticiones han de hacerse en coordenadas de la imagen
|
149 |
* sin shearing aplicado.
|
150 |
* @return Extent
|
151 |
*/
|
152 |
public Extent getExtentWithoutRot();
|
153 |
|
154 |
/**
|
155 |
* Crea un un nuevo dataset que referencia al mismo fichero en disco
|
156 |
* @return IRasterDataSource
|
157 |
*/
|
158 |
public RasterDataStore newDataStore();
|
159 |
|
160 |
/**
|
161 |
* Obtiene el Tama?o de cada fichero de que consta el raster en bytes.
|
162 |
* @return long que representa el tama?o
|
163 |
*/
|
164 |
public long getFileSize(); |
165 |
|
166 |
/**
|
167 |
* Obtiene el extent del raster.
|
168 |
* @return Extent
|
169 |
*/
|
170 |
public Extent getExtent();
|
171 |
|
172 |
/**
|
173 |
* Convierte un punto desde coordenadas pixel a coordenadas del mundo.
|
174 |
* @param pt Punto a transformar
|
175 |
* @return punto transformado en coordenadas del mundo
|
176 |
*/
|
177 |
public Point2D rasterToWorld(Point2D pt); |
178 |
|
179 |
/**
|
180 |
* Convierte un punto desde del mundo a coordenadas pixel.
|
181 |
* @param pt Punto a transformar
|
182 |
* @return punto transformado en coordenadas pixel
|
183 |
*/
|
184 |
public Point2D worldToRaster(Point2D pt); |
185 |
|
186 |
/**
|
187 |
* Obtiene el flag que dice si el raster est? o no georreferenciado
|
188 |
* @return true si est? georreferenciado y false si no lo est?.
|
189 |
*/
|
190 |
public boolean isGeoreferenced(); |
191 |
|
192 |
/**
|
193 |
* Obtiene el nombre del dataStore
|
194 |
* @return String
|
195 |
* nombre del fichero
|
196 |
*/
|
197 |
public String getName(); |
198 |
|
199 |
/**
|
200 |
* Obtiene la proyecci?n asociada al raster. Como todos los dataset del
|
201 |
* multiDataset deben tener la misma proyecci?n obtenemos esta del primer
|
202 |
* dataset.
|
203 |
* @return Proyecci?n en formato cadena
|
204 |
* @throws RasterDriverException
|
205 |
*/
|
206 |
public String getWktProjection() throws RasterDriverException; |
207 |
|
208 |
/**
|
209 |
* Metodo que obtiene si un punto cae dentro de los l?mites de la extensi?n de la fuente de
|
210 |
* datos raster o fuera de ellos.
|
211 |
* @param p Punto a calcular
|
212 |
* @return true si est? dentro de los l?mites y false si est? fuera
|
213 |
*/
|
214 |
public boolean isInside(Point2D p); |
215 |
|
216 |
/**
|
217 |
* Returns true if this data store is reproyectable or false if not
|
218 |
* @return
|
219 |
*/
|
220 |
public boolean isReproyectable(); |
221 |
|
222 |
/**
|
223 |
* Obtiene la matriz de transformaci?n del propio raster. Esta matriz es la
|
224 |
* encargada de convertir las coordenadas de la petici?n en coordenadas a las
|
225 |
* que se pide a la libreria. En gdal, por ejemplo, se piden las coordenadas a
|
226 |
* la libreria en coordenadas pixel por lo que esta matriz tendr? la
|
227 |
* georreferenciaci?n asociada en el worldfile o cabecera. Otras librerias
|
228 |
* como ermapper la petici?n a la libreria se hace en coordenadas geograficas
|
229 |
* que son las mismas en las que pide el usuario de gvSIG por lo que esta
|
230 |
* matriz en este caso se inicializa con la identidad.
|
231 |
* @return
|
232 |
*/
|
233 |
public AffineTransform getOwnAffineTransform(); |
234 |
|
235 |
/**
|
236 |
* Obtiene la transformaci?n afin aplicada en las peticiones con coordenadas
|
237 |
* reales. Esta corresponde al producto matricial entre la transformaci?n de
|
238 |
* la propia georreferenciaci?n del raster (ownTransformation) y la
|
239 |
* transformaci?n que se le aplique de forma externa. Si esta ?ltima no existe
|
240 |
* ser? la matriz identidad.
|
241 |
* @return Matriz de la transformaci?n af?n.
|
242 |
*/
|
243 |
public AffineTransform getAffineTransform(); |
244 |
|
245 |
/**
|
246 |
* Asigna una transformaci?n al raster para que se tenga en cuenta en la
|
247 |
* asignaci?n del setView. Esta asignaci?n recalcula el extent, el
|
248 |
* requestExtent y asigna el AffineTransform que se usar? para la
|
249 |
* transformaci?n. Esta transformaci?n ser? considerada como si la imagen
|
250 |
* tuviera asociado un rmf.
|
251 |
* @param t Transformaci?n af?n a aplicar
|
252 |
*/
|
253 |
public void setAffineTransform(AffineTransform transf); |
254 |
|
255 |
/**
|
256 |
* Obtiene la proyecci?n del dataset
|
257 |
* @return IProjection
|
258 |
*/
|
259 |
public IProjection getProjection();
|
260 |
|
261 |
/**
|
262 |
* Consulta de si un raster tiene rotaci?n o no.
|
263 |
* @return true si tiene rotaci?n y false si no la tiene.
|
264 |
*/
|
265 |
public boolean isRotated(); |
266 |
|
267 |
public Transparency getTransparencyFilesStatus(); |
268 |
|
269 |
/**
|
270 |
* Obtiene el n?mero de overviews de una banda
|
271 |
* @return N?mero de overviews del raster.
|
272 |
*/
|
273 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException; |
274 |
|
275 |
/**
|
276 |
* Informa de si el dataset soporta overviews o no.
|
277 |
* @return true si soporta overviews y false si no las soporta.
|
278 |
*/
|
279 |
public boolean overviewsSupport(); |
280 |
|
281 |
/**
|
282 |
* Gets an object which vectorize a raster
|
283 |
* @return
|
284 |
* @throws RasterDriverException
|
285 |
* @throws ProcessInterruptedException
|
286 |
* When the object Vectorization is built the raster data buffer is loaded.
|
287 |
* This operation can be interrupted
|
288 |
*/
|
289 |
public Vectorization createVectorizeObject() throws RasterDriverException, ProcessInterruptedException; |
290 |
|
291 |
/**
|
292 |
* Builds an render object using this RasterDataStore
|
293 |
* @return Render
|
294 |
*/
|
295 |
public Render getRender();
|
296 |
|
297 |
/**
|
298 |
* Saves georeferencing information in the rmf file
|
299 |
* @throws RmfSerializerException
|
300 |
*/
|
301 |
public void saveGeoreferencingToRmf() throws RmfSerializerException; |
302 |
|
303 |
/**
|
304 |
* Tipo de fichero soportado.
|
305 |
* Devuelve true si el tipo de fichero (extension) est? soportado, si no
|
306 |
* devuelve false.
|
307 |
*
|
308 |
* @param fName Fichero raster
|
309 |
* @return true si est? soportado, si no false.
|
310 |
*/
|
311 |
public boolean isFileSupported(String fName); |
312 |
|
313 |
/**
|
314 |
* Returns true if this DataStore is open and false if not
|
315 |
* @return
|
316 |
*/
|
317 |
public boolean isOpen(); |
318 |
|
319 |
/**
|
320 |
* Obtiene el ancho de una overview de una banda
|
321 |
* @return
|
322 |
*/
|
323 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException; |
324 |
|
325 |
/**
|
326 |
* Obtiene el alto de una overview de una banda
|
327 |
* @return
|
328 |
*/
|
329 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException; |
330 |
|
331 |
/**
|
332 |
* Returns the band list
|
333 |
* @return
|
334 |
*/
|
335 |
public BandList getBands();
|
336 |
|
337 |
/**
|
338 |
* Clones this object
|
339 |
* @return RasterDataStore
|
340 |
*/
|
341 |
public RasterDataStore cloneDataStore();
|
342 |
|
343 |
/**
|
344 |
* Closes this data store
|
345 |
* @throws CloseException
|
346 |
*/
|
347 |
public void close() throws CloseException; |
348 |
|
349 |
//******************************************
|
350 |
//***********Dataset Properties*************
|
351 |
|
352 |
/**
|
353 |
* Obtiene el objeto que contiene que contiene la interpretaci?n de
|
354 |
* color por banda para el dataset seleccionado
|
355 |
* @param dataset Dataset del que se necesesita la informaci?n de color dentro del RasterMultiDataset
|
356 |
* @return DatasetColorInterpretation
|
357 |
*/
|
358 |
public ColorInterpretation getColorInterpretation();
|
359 |
|
360 |
/**
|
361 |
* Gets the object with the metadata
|
362 |
* @return
|
363 |
*/
|
364 |
public Metadata getMetadata();
|
365 |
|
366 |
/**
|
367 |
* Obtiene la paleta correspondiente al dataset.
|
368 |
* @return Paleta asociada a este o null si no tiene
|
369 |
*/
|
370 |
public ColorTable getColorTable();
|
371 |
|
372 |
/**
|
373 |
* Obtiene el estado de transparencia a partir de los estados de transparencia de todos
|
374 |
* los ficheros que lo componen. Si varios de los ficheros que lo componen tienen banda de
|
375 |
* transparencia estas tendr?n que ser mezcladas sobre una banda de transparencia ?nica.
|
376 |
* @return Objeto FileTransparency con el estado de transparencia
|
377 |
*/
|
378 |
public Transparency getTransparency(); |
379 |
|
380 |
/**
|
381 |
* Obtiene el objeto con las estadisticas
|
382 |
* @return MultiFileStatistics
|
383 |
*/
|
384 |
public Statistics getStatistics();
|
385 |
|
386 |
/**
|
387 |
* Obtiene el histograma asociado al dataset.
|
388 |
*
|
389 |
* @return Histograma asociado al dataset.
|
390 |
*/
|
391 |
public Histogram getHistogram() throws HistogramException; |
392 |
|
393 |
/**
|
394 |
* Gets the serial information
|
395 |
* @return
|
396 |
* @throws RmfSerializerException
|
397 |
*/
|
398 |
public SerialInfo getSerialInfo() throws RmfSerializerException; |
399 |
|
400 |
/**
|
401 |
* Sets the serial information
|
402 |
* @throws RmfSerializerException
|
403 |
*/
|
404 |
public void setSerialInfo(SerialInfo serialInfo) throws RmfSerializerException; |
405 |
|
406 |
|
407 |
//******************************************
|
408 |
//***********Query methods******************
|
409 |
|
410 |
/**
|
411 |
* Returns the last buffer loaded if the flag storeLastBuffer in the query is true
|
412 |
* @return
|
413 |
*/
|
414 |
public Buffer getLastBuffer(); |
415 |
|
416 |
/**
|
417 |
* Gets the step
|
418 |
* @return
|
419 |
*/
|
420 |
public double[] getStep(); |
421 |
|
422 |
/**
|
423 |
* Hace una consulta para la carga de un buffer de datos.
|
424 |
* @param query
|
425 |
* @return IBuffer
|
426 |
*/
|
427 |
public Buffer query(RasterQuery query) throws ProcessInterruptedException, RasterDriverException, InvalidSetViewException; |
428 |
} |