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 / RasterQuery.java @ 2443

History | View | Annotate | Download (9.79 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.Rectangle;
25

    
26
import org.gvsig.fmap.dal.DataQuery;
27
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
28
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
29
import org.gvsig.fmap.dal.coverage.datastruct.NoData;
30
import org.gvsig.fmap.dal.coverage.exception.QueryException;
31
import org.gvsig.raster.cache.tile.provider.CacheStruct;
32
import org.gvsig.raster.cache.tile.provider.TileListener;
33
import org.gvsig.timesupport.Time;
34
import org.gvsig.tools.task.TaskStatus;
35

    
36
/**
37
 * Parameters to load data from a raster data source.
38
 * <P>Use cases:</P>
39
 * <UL>
40
 * <LI>Select a window of pixels</LI>
41
 * <LI>Select a window of pixels with resampling</LI>
42
 * <LI>Select a bounding box</LI>
43
 * <LI>Select a bounding box with resampling</LI>
44
 * <LI>Enable or disable supersampling in all request above described</LI>
45
 * <LI>Adjust the request to the source limits or builds a buffer with a frame filled with nodata values (In all request above described)</LI>
46
 * <LI>All data in a buffer of the same size that the source</LI>
47
 * <LI>Select a bounding box and tiled the request</LI>
48
 * <LI>Get one tile</LI>
49
 * <LI></LI>
50
 * </UL>
51
 * @author Nacho Brodin (nachobrodin@gmail.com)
52
 */
53
public interface RasterQuery extends DataQuery {
54
        
55
        public void setAreaOfInterest();
56
        
57
        public void setAreaOfInterest(Rectangle pixelWindow);
58
        
59
        public void setAreaOfInterest(Rectangle pixelWindow, int bufWidth, int bufHeight);
60
        
61
        public void setAreaOfInterest(Extent boundingBox);
62
        
63
        public void setAreaOfInterest(Extent boundingBox, int bufWidth, int bufHeight);
64
        
65
        public void setAreaOfInterest(Extent requestBoundingBox, int bufWidth, int bufHeight, TileListener listener);
66
        
67
        public void setTileParameters(int level, int tileCol, int tileRow);
68
        
69
        /**
70
         * Parameters to make a tile request.
71
         * @param level
72
         *        Resolution level 
73
         * @param tileCol 
74
         *        Tile column in the matrix of its level
75
         * @param tileRow
76
         *        Tile row in the matrix of its level
77
         * @param extent
78
         *        Bounding box of the requested tile
79
         * @param cacheStruct
80
         *        Cache structure force by the client
81
         *        @deprecated 
82
         */
83
        public void setTileParameters(int level, int tileCol, int tileRow, Extent extent, CacheStruct cacheStruct);
84
        
85
        /**
86
         * Sets the number of the alpha band. This parameter is take into 
87
         * account only when the request is made using TileListener. In this case
88
         * the parameter transparencyBuffer in nextBuffer method will have the right
89
         * data.
90
         * @param bandNumber
91
         */
92
        public void setAlphaBand(int bandNumber);
93
        
94
        /**
95
         * The user can told if the buffer will be stored or not in the RasterDatasource.
96
         * @param store
97
         */
98
        public void storeLastBuffer(boolean store);
99
        
100
        /**
101
         * Asigna el flag que ajusta el extent de la petici?n al del raster. Si est? a
102
         * true en caso de que el extent de la petici?n sea mayor lo ajustar? a los limites
103
         * de este. Si est? a false no lo ajustar? rellenando los valores con NoData
104
         * @param adjustToExtent true para ajustar y false si no queremos que lo haga. Por defecto
105
         * estar? a true.
106
         */
107
        public void setAdjustToExtent(boolean adjustToExtent);
108
        
109
        /**
110
         * Obtiene el flag que ajusta el extent de la petici?n al del raster. Si est? a
111
         * true en caso de que el extent de la petici?n sea mayor lo ajustar? a los limites
112
         * de este. Si est? a false no lo ajustar? rellenando los valores con NoData. Por defecto
113
         * estar? a true.
114
         * @return true si ajusta y false si no lo hace
115
         */
116
        public boolean isAdjustToExtent();
117
        
118
        /**
119
         * Set the list of bands to write in a buffer when the call query be executed. 
120
         * Each position in the array represents a buffer band and the number inside 
121
         * of this position is the image band read which be write in the buffer 
122
         * @param drawableBands        Array with the list of bands to write
123
         */
124
        public void setDrawableBands(int[] drawableBands);
125
        
126
        /**
127
         * Gets a buffer of data with the same number of bands and the same order that
128
         * the original raster
129
         */
130
        public void setAllDrawableBands();
131
        
132
        /**
133
         * Gets the list of bands to write in a buffer when the call query be executed. 
134
         * Each position in the array represents a buffer band and the number inside 
135
         * of this position is the image band read which be write in the buffer 
136
         * @return Array with the list of bands
137
         */
138
        public int[] getDrawableBands();
139
        
140
        /**
141
         * Asigna el flag que dice si la carga del siguiente buffer es de solo lectura o lectura/escritura.
142
         * La asignaci?n del flag de solo lectura a true debe hacerse para cada consulta.
143
         * @param readOnly true si la siguiente carga de buffer se hace de solo lectura y false si es de lectura/escritura
144
         */
145
        public void setReadOnly(boolean readOnly);
146
        
147
        /**
148
         * Asigna el flag que dice si la carga del siguiente buffer es en memoria
149
         * @param memory true si la siguiente carga de buffer se hace en memoria y false se deja decidir al dataset 
150
         * el tipo de buffer
151
         */
152
        public void setMemoryBuffer(boolean readOnly);
153
        
154
        /**
155
         * Asigna el valor noData con el que se rellenan las celdas cuando se hace una petici?n
156
         * en la que no se quiere que se ajuste al ?rea del raster. Por defecto noData tendr? el valor
157
         * que aparece en IBuffer.
158
         * @param noData
159
         */
160
        public void setNoDataToFill(NoData noData);
161
        
162
        /**
163
         * Consulta el flag de supersampleo en la carga del buffer.
164
         * <P>
165
         * Si este flag es false
166
         * y pasamos un buffer de tama?o mayor que el n?mero de pixels del ?rea requerida en la
167
         * llamada setAreaOfInterest entonces se ajustar? este buffer al n?mero de pixeles contenidos
168
         * en el ?rea.
169
         * </P>
170
         * <P>
171
         * Por ejemplo, si solicitamos un ?rea de 5x4 pixels de un raster y pedimos que nos los grabe
172
         * en un buffer de 500x400, si esta variable es false el buffer lo generar? de 5x4. Si esta
173
         * variable es true el buffer lo generar? de 500x400.
174
         * </P>
175
         *
176
         * @return true si el supersampleo en la carga del buffer est? activado y false si no lo est?.
177
         */
178
        public boolean isSupersamplingOptionActive();
179
        
180
        /**
181
         * Returns true if the buffer is not writable
182
         * @return
183
         */
184
        public boolean isReadOnly();
185
        
186
        /**
187
         * Gets the time information of the viewport requested
188
         * @return
189
         */
190
        public Time getTime();
191

    
192
        /**
193
         * Sets the time information of the viewport requested
194
         * @return
195
         */
196
        public void setTime(Time time);
197

    
198
        /**
199
         * Activa o desactiva el supersampling en la carga del buffer.
200
         * <P>
201
         * Si este flag es false
202
         * y pasamos un buffer de tama?o mayor que el n?mero de pixels del ?rea requerida en la
203
         * llamada setAreaOfInterest entonces se ajustar? este buffer al n?mero de pixeles contenidos
204
         * en el ?rea.
205
         * </P>
206
         * <P>
207
         * Por ejemplo, si solicitamos un ?rea de 5x4 pixels de un raster y pedimos que nos los grabe
208
         * en un buffer de 500x400, si esta variable es false el buffer lo generar? de 5x4. Si esta
209
         * variable es true el buffer lo generar? de 500x400.
210
         * </P>
211
         *
212
         * @param supersamplingLoadingBuffer true o false para activar o desactivar el supersampling en la
213
         * carga del buffer.
214
         */
215
        public void setSupersamplingOption(boolean supersamplingLoadingBuffer);
216
        
217
        /**
218
         * Sets the task status
219
         * @param taskStatus
220
         */
221
        public void setTaskStatus(TaskStatus taskStatus);
222
        
223
        /**
224
         * Giving a world coordinates, a buffer size and a original raster size. If the 
225
         * buffer is bigger than the window requested in the source raster (supersampling), 
226
         * then it means that each pixel of the raster will be written several times in 
227
         * the destination buffer.
228
         * 
229
         * This function calculates the shift in pixels en X and Y coordinate that 
230
         * correspond with the first pixel, due to this pixel won't be drawn entirely.
231
         * 
232
         * Dado unas coordenadas reales, un tama?o de buffer y un tama?o de raster.
233
         * Si el buffer es de mayor tama?o que el raster (supersampleo) quiere decir que
234
         * por cada pixel de buffer se repiten varios del raster. Esta funci?n calcula el
235
         * n?mero de pixels de desplazamiento en X e Y que corresponden al primer pixel del
236
         * buffer en la esquina superior izquierda. Esto es necesario porque la coordenada
237
         * solicitada es real y puede no caer sobre un pixel completo. Este calculo es
238
         * util cuando un cliente quiere supersamplear sobre un buffer y que no se lo haga
239
         * el driver autom?ticamente.
240
         */
241
        public double[] getStep();
242

    
243
        /**
244
         * Force that the built of the buffer be ARGB. Be careful with the renderBands. It 
245
         * will have four bands as maximum.
246
         */
247
        public void forceARGBRequest();
248
        
249
        /**
250
         * Force that the built of the buffer be RGB. Be careful with the renderBands. It 
251
         * will have three bands as maximum.
252
         */
253
        public void forceRGBRequest();
254
        
255
        public boolean isforcingRGBRequest();
256
        
257
        public boolean isforcingARGBRequest();
258

    
259
        /**
260
         * Buffer loaded by the provider. This buffer is created by the <code>RasterQuery</code>  
261
         * but in some cases can be useful to pass the buffer already created by parameter. 
262
         * In any case,  is advisable not to do it.
263
         * @return
264
         */
265
        public void setBufferForProviders(Buffer buffer) throws QueryException;
266

    
267
        /**
268
         * Clones this RasterQuery
269
         * @return
270
         */
271
        public RasterQuery clone();
272
        
273
}