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