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

History | View | Annotate | Download (9.69 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
         * Obtiene la altura del raster en p?xeles.
140
         * @return altura
141
         */
142
        public double getHeight();
143

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