Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / store / QueryableRaster.java @ 186

History | View | Annotate | Download (9.83 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.raster.impl.store;
23

    
24
import java.awt.geom.AffineTransform;
25
import java.awt.geom.Point2D;
26
import java.util.ArrayList;
27

    
28
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
29
import org.gvsig.fmap.dal.coverage.datastruct.BandList;
30
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
31
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
32
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
33
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
34
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
35
import org.gvsig.fmap.dal.coverage.store.props.ColorTable;
36
import org.gvsig.raster.impl.provider.RasterProvider;
37

    
38

    
39

    
40
/**
41
 * A kind of dataset which can be queried should implement this interface.
42
 *
43
 * @author Nacho Brodin (nachobrodin@gmail.com)
44
 */
45
public interface QueryableRaster {
46
        
47
        /**
48
         * Gets the dataset of this queryable raster
49
         * @return RasterDataSet
50
         */
51
        public RasterDataStore getDataStore();
52
        
53
        /**
54
         * Gets the rater providers
55
         * @return RasterProvider
56
         *         returns the list of providers
57
         */
58
        public ArrayList<RasterProvider> getProviders();
59
        
60
        /**
61
         * Gets the provider in the i position
62
         * @return RasterProvider
63
         *         returns a RasterProvider 
64
         */
65
        public RasterProvider getProvider(int i);
66
        
67
        /**
68
         * Obtiene el n?mero de ficheros en la lista
69
         * @return integer.
70
         */
71
        public int getDataStoreCount();
72
        
73
        /**
74
         * Obtiene la lista de bandas
75
         * @return BandList
76
         */
77
        public BandList getBands();
78
        
79
        /**
80
         * Asigna las bandas dibujables cuando se solicita una acci?n de lectura de datos
81
         * @param db int[]
82
         */
83
        public void setDrawableBands(int[] db);
84
        
85
        /**
86
         * Removes the drawable bands
87
         */
88
        public void clearDrawableBands();
89
        
90
        /**
91
         * Obtiene las bandas dibujables cuando se solicita una acci?n de lectura de datos
92
         * @return
93
         */
94
        public int[] getDrawableBands();
95
        
96
        /**
97
         * Obtiene el n?mero de bandas del raster
98
         * @return N?mero de bandas
99
         */
100
        public int getBandCount();
101
        
102
        /**
103
         * Obtiene el valor NoData asociado al raster.
104
         * @return
105
         */
106
        public double getNoDataValue();
107
        
108
        /**
109
         * Para este dataset asigna que bandas se pintaran
110
         * sobre el RasterBuf cuando se haga un update. Especificamos a 
111
         * trav?s de los par?metros para que posici?n del RasterBuf ir? 
112
         * dibujada con que banda del fichero de imagen.
113
         * @param posRasterBuf        Posici?n del RasterBuf que queremos pintar.
114
         * @param imageBand        Banda de la imagen que se pintar?
115
         */
116
        public void addDrawableBand(int posRasterBuf, int imageBand);
117
        
118
        /**
119
         * Obtiene la paleta correspondiente al nombre del fichero pasado por par?metro. 
120
         * @param fileName Nombre del fichero
121
         * @return Paleta o null si no la tiene
122
         */
123
        public ColorTable getColorTable(String fileName);
124
        
125
        /**
126
         * Obtiene la paleta correspondiente a uno de los ficheros que forman el GeoMultiRasterFile
127
         * @param i Posici?n del raster
128
         * @return Paleta asociada a este o null si no tiene
129
         */
130
        public ColorTable getColorTable(int i);
131
        
132
        /**
133
         * Obtiene el extent del raster.
134
         * @return Extent
135
         */
136
        public Extent getExtent();
137
        
138
        /**
139
         * Gets an extent adjusted to the bounding box of this raster
140
         * @param e
141
         * @return
142
         */
143
        public Extent adjustToExtent(Extent e);
144
        
145
        /**
146
         * Obtiene la altura del raster en p?xeles.
147
         * @return altura
148
         */
149
        public double getHeight();
150

    
151
        /**
152
         * Obtiene la anchura del raster en p?xeles.
153
         * @return anchura
154
         */
155
        public double getWidth();
156
        
157
        /**
158
         * Recupera del raster la matriz de transformaci?n que lo situa en cualquier parte de la vista
159
         * @param band
160
         * @return AffineTransform
161
         */
162
        public AffineTransform getAffineTransform();
163
        
164
        /**
165
         * Convierte un punto desde coordenadas pixel a coordenadas del mundo.
166
         * @param pt Punto a transformar
167
         * @return punto transformado en coordenadas del mundo
168
         */
169
        public Point2D rasterToWorld(Point2D pt);
170
        
171
        /**
172
         * Convierte un punto desde del mundo a coordenadas pixel.
173
         * @param pt Punto a transformar
174
         * @return punto transformado en coordenadas pixel
175
         */
176
        public Point2D worldToRaster(Point2D pt);
177
        
178
        /**
179
         * Asigna el flag que dice si la carga del siguiente buffer es en memoria. El poner este flag a true hace que se
180
         * ponga a false el de readOnly autom?ticamente.
181
         * @param memory true si la siguiente carga de buffer se hace en memoria y false se deja decidir al dataset 
182
         * el tipo de buffer
183
         */
184
        public void setMemoryBuffer(boolean memoryBuffer);
185
        
186
        /**
187
         * Obtiene una ventana de datos de la imagen a partir de coordenadas reales. 
188
         * No aplica supersampleo ni subsampleo sino que devuelve una matriz de igual tama?o a los
189
         * pixeles de disco. 
190
         * @param x Posici?n X superior izquierda
191
         * @param y Posici?n Y superior izquierda
192
         * @param w Ancho en coordenadas reales
193
         * @param h Alto en coordenadas reales
194
         * @param adjustToExtent Flag que dice si el extent solicitado debe ajustarse al extent del raster o no.
195
         * @param bandList
196
         * @return Buffer de datos
197
         */
198
        public Buffer getWindowRaster(double ulx, double uly, double lrx, double lry) 
199
                throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException;
200
        
201
        /**
202
         * Obtiene una ventana de datos de la imagen a partir de coordenadas reales. 
203
         * No aplica supersampleo ni subsampleo sino que devuelve una matriz de igual tama?o a los
204
         * pixeles de disco. 
205
         * @param x Posici?n X superior izquierda
206
         * @param y Posici?n Y superior izquierda
207
         * @param w Ancho en coordenadas reales
208
         * @param h Alto en coordenadas reales
209
         * @param adjustToExtent Flag que dice si el extent solicitado debe ajustarse al extent del raster o no.
210
         * @param bandList
211
         * @return Buffer de datos
212
         */
213
        public Buffer getWindowRaster(double ulx, double uly, double w, double h, boolean adjustToExtent) 
214
                throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException;
215
                
216
        /**
217
         * Obtiene una ventana de datos de la imagen a partir de coordenadas reales. 
218
         * Aplica supersampleo o subsampleo en funci?n del tama?o del buffer. Esta operaci?n la gestiona
219
         * el driver.
220
         * @param minX Valor m?nimo de la X en coordenadas reales
221
         * @param minY Valor m?nimo de la Y en coordenadas reales
222
         * @param maxX Valor m?ximo de la X en coordenadas reales
223
         * @param maxY Valor m?ximo de la Y en coordenadas reales
224
         * @param bufWidth ancho del buffer lde datos
225
         * @param bufHeight alto del buffer de datos
226
         * @param adjustToExtent Flag que dice si el extent solicitado debe ajustarse al extent del raster o no.
227
         * @param bandList
228
         * @return Buffer de datos
229
         */
230
        public Buffer getWindowRaster(double ulx, double uly, double lrx, double lry, int bufWidth, int bufHeight, boolean adjustToExtent) 
231
                throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException;
232
                
233
        
234
        /**
235
         * Obtiene una ventana de datos de la imagen a partir de coordenadas reales. 
236
         * No aplica supersampleo ni subsampleo sino que devuelve una matriz de igual tama?o a los
237
         * pixeles de disco. 
238
         * @param x Posici?n X superior izquierda
239
         * @param y Posici?n Y superior izquierda
240
         * @param w Ancho en coordenadas pixel
241
         * @param h Alto en coordenadas pixel
242
         * @param bandList
243
         * @return Buffer de datos
244
         */
245
        public Buffer getWindowRaster(int x, int y, int w, int h) 
246
                throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException;
247
                
248
        /**
249
         * Obtiene una ventana de datos de la imagen a partir de coordenadas reales. 
250
         * Aplica supersampleo o subsampleo en funci?n del tama?o del buffer
251
         * @param x Posici?n X superior izquierda en pixels
252
         * @param y Posici?n Y superior izquierda en pixels
253
         * @param w Ancho en pixels
254
         * @param h Alto en pixels
255
         * @param bufWidth ancho del buffer de datos
256
         * @param bufHeight alto del buffer de datos
257
         * @param bandList
258
         * @return Buffer de datos
259
         */
260
        public Buffer getWindowRaster(int x, int y, int w, int h, int bufWidth, int bufHeight) 
261
                throws InvalidSetViewException, ProcessInterruptedException, RasterDriverException;
262
        
263
        /**
264
         * Dado unas coordenadas reales, un tama?o de buffer y un tama?o de raster. 
265
         * Si el buffer es de mayor tama?o que el raster (supersampleo) quiere decir que 
266
         * por cada pixel de buffer se repiten varios del raster. Esta funci?n calcula el 
267
         * n?mero de pixels de desplazamiento en X e Y que corresponden al primer pixel del
268
         * buffer en la esquina superior izquierda. Esto es necesario porque la coordenada
269
         * solicitada es real y puede no caer sobre un pixel completo. Este calculo es
270
         * util cuando un cliente quiere supersamplear sobre un buffer y que no se lo haga
271
         * el driver autom?ticamente.
272
         * @param dWorldTLX Coordenada real X superior izquierda
273
         * @param dWorldTLY Coordenada real Y superior izquierda
274
         * @param nWidth Ancho del raster
275
         * @param nHeight Alto del raster
276
         * @param bufWidth Ancho del buffer
277
         * @param bufHeight Alto del buffer
278
         * @return Array de cuatro. Los dos primeros elementos son el desplazamiento en X e Y y los dos segundos
279
         * el tama?o en pixels de buffer de un pixel de la imagen en ancho y alto.  
280
         */
281
        public double[] calcSteps(double dWorldTLX, double dWorldTLY, double dWorldBRX, double dWorldBRY,
282
                        double nWidth, double nHeight, int bufWidth, int bufHeight);
283
        
284
}