Statistics
| Revision:

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 @ 186

History | View | Annotate | Download (12.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.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.Histogramable;
44
import org.gvsig.fmap.dal.coverage.store.props.Metadata;
45
import org.gvsig.fmap.dal.coverage.store.props.SerialInfo;
46
import org.gvsig.fmap.dal.coverage.store.props.Statistics;
47
import org.gvsig.fmap.dal.coverage.store.props.Transparency;
48
import org.gvsig.fmap.dal.exception.CloseException;
49
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider;
50

    
51
/**
52
 * Interfaz que deben implementar los almacenes de datos raster.
53
 * 
54
 * @author Nacho Brodin (nachobrodin@gmail.com)
55
 */
56
public interface RasterDataStore extends DataStore, Histogramable {
57
        public static final int              RED_BAND            = 0x01;
58
        public static final int              GREEN_BAND          = 0x02;
59
        public static final int              BLUE_BAND           = 0x04;
60
        public static final int              ALPHA_BAND          = 0x08;
61
        
62
        /**
63
         * Obtiene el tipo de dato por banda
64
         * @return tipo de dato por banda
65
         */
66
        public int[] getDataType();
67

    
68
        /**
69
         * Obtiene el valor NoData asociado al raster.
70
         * @return
71
         */
72
        public double getNoDataValue();
73

    
74
        /**
75
         * Vuelve a poner el valor noData como estaba inicialmente
76
         */
77
        public void resetNoDataValue();
78

    
79
        /**
80
         * Define el valor NoData asociado al raster.
81
         * @return
82
         */
83
        public void setNoDataValue(double value);
84

    
85
        /**
86
         * Obtiene si esta activo el valor NoData asociado al raster.
87
         * @return
88
         */
89
        public boolean isNoDataEnabled();
90

    
91
        /**
92
         * Define si se activa el valor NoData asociado al raster.
93
         * @return
94
         */
95
        public void setNoDataEnabled(boolean enabled);
96
        
97
        /**
98
         * Obtiene el n?mero de bandas del raster
99
         * @return N?mero de bandas
100
         */
101
        public int getBandCount();
102
                                
103
        /**
104
         * Gets the number of sources that this data store has
105
         * @return
106
         */
107
        public int getDataStoreCount();
108

    
109
        /**
110
         * Obtiene la altura del raster en p?xeles.
111
         * @return altura
112
         */
113
        public double getHeight();
114

    
115
        /**
116
         * Obtiene la anchura del raster en p?xeles.
117
         * @return anchura
118
         */
119
        public double getWidth();
120
        
121
        /**
122
         * Obtiene el tama?o de celda del raster
123
         * @return Valor del tama?o de celda
124
         */
125
        public double getCellSize();
126
        
127
        /**
128
         * Obtiene el tama?o de pixel en X
129
         * @return tama?o de pixel en X
130
         */
131
        public double getPixelSizeX();
132

    
133
        /**
134
         * Obtiene el tama?o de pixel en Y
135
         * @return tama?o de pixel en Y
136
         */
137
        public double getPixelSizeY();
138
        
139
        /**
140
         * Obtiene el extent asignado
141
         * @return        Extent
142
         */
143
        public Extent getView();
144
        
145
        /**
146
         * Este es el extent sobre el que se ajusta una petici?n para que esta no
147
         * exceda el extent m?ximo del raster. Para un raster sin rotar ser? igual al
148
         * extent pero para un raster rotado ser? igual al extent del raster como si
149
         * no tuviera rotaci?n. Esto ha de ser as? ya que la rotaci?n solo se hace
150
         * sobre la vista y las peticiones han de hacerse en coordenadas de la imagen
151
         * sin shearing aplicado.
152
         * @return Extent
153
         */
154
        public Extent getExtentWithoutRot();
155
        
156
        /**
157
         * Crea un un nuevo dataset que referencia al mismo fichero en disco
158
         * @return IRasterDataSource
159
         */
160
        public RasterDataStore newDataStore();
161
        
162
        /**
163
         * Obtiene el Tama?o de cada fichero de que consta el raster en bytes. 
164
         * @return long que representa el tama?o
165
         */
166
        public long getFileSize();
167
        
168
        /**
169
         * Obtiene el extent del raster.
170
         * @return Extent
171
         */
172
        public Extent getExtent();
173
        
174
        /**
175
         * Convierte un punto desde coordenadas pixel a coordenadas del mundo.
176
         * @param pt Punto a transformar
177
         * @return punto transformado en coordenadas del mundo
178
         */
179
        public Point2D rasterToWorld(Point2D pt);
180
        
181
        /**
182
         * Convierte un punto desde del mundo a coordenadas pixel.
183
         * @param pt Punto a transformar
184
         * @return punto transformado en coordenadas pixel
185
         */
186
        public Point2D worldToRaster(Point2D pt);
187
        
188
        /**
189
         * Obtiene el flag que dice si el raster est? o no georreferenciado
190
         * @return true si est? georreferenciado y false si no lo est?.
191
         */
192
        public boolean isGeoreferenced();
193
        
194
        /**
195
         * Obtiene el nombre del dataStore
196
         * @return String 
197
         *         nombre del fichero
198
         */
199
        public String getName();
200
        
201
        /**
202
         * Obtiene la proyecci?n asociada al raster. Como todos los dataset del 
203
         * multiDataset deben tener la misma proyecci?n obtenemos esta del primer
204
         * dataset.
205
         * @return Proyecci?n en formato cadena
206
         * @throws RasterDriverException
207
         */
208
        public String getWktProjection() throws RasterDriverException;
209
        
210
        /**
211
         * Metodo que obtiene si un punto cae dentro de los l?mites de la extensi?n de la fuente de 
212
         * datos raster o fuera de ellos.
213
         * @param p Punto a calcular
214
         * @return true si est? dentro de los l?mites y false si est? fuera
215
         */
216
        public boolean isInside(Point2D p); 
217
        
218
        /**
219
         * Returns true if this data store is reproyectable or false if not
220
         * @return
221
         */
222
        public boolean isReproyectable();
223
        
224
        /**
225
         * Obtiene la matriz de transformaci?n del propio raster. Esta matriz es la
226
         * encargada de convertir las coordenadas de la petici?n en coordenadas a las
227
         * que se pide a la libreria. En gdal, por ejemplo, se piden las coordenadas a
228
         * la libreria en coordenadas pixel por lo que esta matriz tendr? la
229
         * georreferenciaci?n asociada en el worldfile o cabecera. Otras librerias
230
         * como ermapper la petici?n a la libreria se hace en coordenadas geograficas
231
         * que son las mismas en las que pide el usuario de gvSIG por lo que esta
232
         * matriz en este caso se inicializa con la identidad.
233
         * @return
234
         */
235
        public AffineTransform getOwnAffineTransform();
236
        
237
        /**
238
         * Obtiene la transformaci?n afin aplicada en las peticiones con coordenadas
239
         * reales. Esta corresponde al producto matricial entre la transformaci?n de
240
         * la propia georreferenciaci?n del raster (ownTransformation) y la
241
         * transformaci?n que se le aplique de forma externa. Si esta ?ltima no existe
242
         * ser? la matriz identidad.
243
         * @return Matriz de la transformaci?n af?n.
244
         */
245
        public AffineTransform getAffineTransform();
246
        
247
        /**
248
         * Asigna una transformaci?n al raster para que se tenga en cuenta en la
249
         * asignaci?n del setView. Esta asignaci?n recalcula el extent, el
250
         * requestExtent y asigna el AffineTransform que se usar? para la
251
         * transformaci?n. Esta transformaci?n ser? considerada como si la imagen
252
         * tuviera asociado un rmf.
253
         * @param t Transformaci?n af?n a aplicar
254
         */
255
        public void setAffineTransform(AffineTransform transf);
256
        
257
        /**
258
         * Obtiene la proyecci?n del dataset
259
         * @return IProjection
260
         */
261
        public IProjection getProjection();
262
        
263
        /**
264
         * Consulta de si un raster tiene rotaci?n o no.
265
         * @return true si tiene rotaci?n y false si no la tiene.
266
         */
267
        public boolean isRotated();
268
        
269
        public Transparency getTransparencyFilesStatus();
270
        
271
        /**
272
         * Obtiene el n?mero de overviews de una banda
273
         * @return N?mero de overviews del raster.
274
         */
275
        public int getOverviewCount(int band) throws BandAccessException, RasterDriverException;
276
        
277
        /**
278
         * Informa de si el dataset soporta overviews o no.
279
         * @return true si soporta overviews y false si no las soporta.
280
         */
281
        public boolean overviewsSupport();
282
        
283
        /**
284
         * Gets an object which vectorize a raster
285
         * @return
286
         * @throws RasterDriverException
287
         * @throws ProcessInterruptedException
288
         *         When the object Vectorization is built the raster data buffer is loaded. 
289
         *         This operation can be interrupted
290
         */
291
        public Vectorization createVectorizeObject() throws RasterDriverException, ProcessInterruptedException;
292
        
293
        /**
294
         * Builds an render object using this RasterDataStore
295
         * @return Render
296
         */
297
        public Render getRender();
298
        
299
        /**
300
         * Assigns a render object
301
         * @param render
302
         */
303
        public void setRender(Render render);
304
        
305
        /**
306
         * Saves georeferencing information in the rmf file
307
         * @throws RmfSerializerException
308
         */
309
        public void saveGeoreferencingToRmf() throws RmfSerializerException;
310
        
311
        /**
312
         * Saves a color table
313
         * @param table
314
         * @throws RmfSerializerException
315
         */
316
        public void saveColorTableToRmf(ColorTable table) throws RmfSerializerException;
317
        
318
        /**
319
         * Tipo de fichero soportado.
320
         * Devuelve true si el tipo de fichero (extension) est? soportado, si no
321
         * devuelve false.
322
         *
323
         * @param fName Fichero raster
324
         * @return  true si est? soportado, si no false.
325
                */
326
        public boolean isFileSupported(String fName);
327
        
328
        /**
329
         * Returns true if this DataStore is open and false if not
330
         * @return
331
         */
332
        public boolean isOpen();
333
        
334
        /**
335
         * Obtiene el ancho de una overview de una banda
336
         * @return
337
         */
338
        public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException;
339

    
340
        /**
341
         * Obtiene el alto de una overview de una banda
342
         * @return
343
         */
344
        public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException;
345

    
346
        /**
347
         * Returns the band list
348
         * @return
349
         */
350
        public BandList getBands();
351
                
352
        /**
353
         * Clones this object
354
         * @return RasterDataStore
355
         */
356
        public RasterDataStore cloneDataStore();
357
        
358
        /**
359
         * Gets a provider
360
         * @return
361
         */
362
        public CoverageStoreProvider getProvider();
363
        
364
        /**
365
         * Closes this data store
366
         * @throws CloseException
367
         */
368
        public void close() throws CloseException;
369
        
370
        //******************************************
371
        //***********Dataset Properties*************
372
        
373
        /**
374
         * Obtiene el objeto que contiene que contiene la interpretaci?n de 
375
         * color por banda para el dataset seleccionado
376
         * @param dataset Dataset del que se necesesita la informaci?n de color dentro del RasterMultiDataset
377
         * @return DatasetColorInterpretation
378
         */
379
        public ColorInterpretation getColorInterpretation();
380
        
381
        /**
382
         * Gets the object with the metadata
383
         * @return
384
         */
385
        public Metadata getMetadata();
386
        
387
        /**
388
         * Obtiene la paleta correspondiente al dataset. 
389
         * @return Paleta asociada a este o null si no tiene
390
         */
391
        public ColorTable getColorTable();
392
        
393
        /**
394
         * Obtiene el estado de transparencia a partir de los estados de transparencia de todos
395
         * los ficheros que lo componen. Si varios de los ficheros que lo componen tienen banda de 
396
         * transparencia estas tendr?n que ser mezcladas sobre una banda de transparencia ?nica.
397
         * @return Objeto FileTransparency con el estado de transparencia
398
         */
399
        public Transparency getTransparency();
400
        
401
        /**
402
         * Obtiene el objeto con las estadisticas
403
         * @return MultiFileStatistics
404
         */
405
        public Statistics getStatistics();
406
        
407
        /**
408
         * Obtiene el histograma asociado al dataset. 
409
         *
410
         * @return Histograma asociado al dataset.
411
         */
412
        public Histogram getHistogram() throws HistogramException;
413
        
414
        /**
415
         * Gets the serial information
416
         * @return
417
         * @throws RmfSerializerException 
418
         */
419
        public SerialInfo getSerialInfo() throws RmfSerializerException;
420
        
421
        /**
422
         * Sets the serial information
423
         * @throws RmfSerializerException 
424
         */
425
        public void setSerialInfo(SerialInfo serialInfo) throws RmfSerializerException;
426
        
427
        
428
        //******************************************
429
        //***********Query methods******************
430
        
431
        /**
432
         * Returns the last buffer loaded if the flag storeLastBuffer in the query is true
433
         * @return
434
         */
435
        public Buffer getLastBuffer();
436
        
437
        /**
438
         * Gets the step
439
         * @return
440
         */
441
        public double[] getStep();
442
        
443
        /**
444
         * Hace una consulta para la carga de un buffer de datos.
445
         * @param query 
446
         * @return IBuffer
447
         */
448
        public Buffer query(RasterQuery query) throws ProcessInterruptedException, RasterDriverException, InvalidSetViewException;
449
}