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 / grid / Grid.java @ 5462
History | View | Annotate | Download (9.83 KB)
1 | 2443 | nbrodin | /* 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.grid; |
||
23 | |||
24 | |||
25 | import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
||
26 | import org.gvsig.fmap.dal.coverage.datastruct.GridCell; |
||
27 | import org.gvsig.fmap.dal.coverage.datastruct.GridExtent; |
||
28 | import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
||
29 | import org.gvsig.fmap.dal.coverage.exception.FilterAddException; |
||
30 | import org.gvsig.fmap.dal.coverage.exception.GridException; |
||
31 | import org.gvsig.fmap.dal.coverage.exception.OutOfGridException; |
||
32 | import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
||
33 | import org.gvsig.fmap.dal.coverage.exception.RasterBufferInvalidAccessException; |
||
34 | import org.gvsig.fmap.dal.coverage.store.props.BasicStats; |
||
35 | import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
||
36 | import org.gvsig.tools.dispose.Disposable; |
||
37 | |||
38 | |||
39 | /**
|
||
40 | * Interfaz que deben implementar los grid en los que se puede consultar sus datos.
|
||
41 | * @author Nacho Brodin (nachobrodin@gmail.com)
|
||
42 | */
|
||
43 | public interface Grid extends Disposable { |
||
44 | |||
45 | /**
|
||
46 | *Aplica la lista de filtros sobre el buffer
|
||
47 | * @throws FilterAddException
|
||
48 | * @throws InterruptedException
|
||
49 | */
|
||
50 | public void applyFilters() throws ProcessInterruptedException, FilterAddException; |
||
51 | |||
52 | /**
|
||
53 | * Carga el buffer de datos desde el reader para poder escribir sobre los datos de
|
||
54 | * la ventana original. Esto es ?til cuando el GridWriter se crea asociado a un raster
|
||
55 | * pero el buffer est? vacio, por ejemplo en el caso de crear un GridInterpolated. Un
|
||
56 | * GridInterpolated no carga ning?n buffer en memoria sino que accede a los datos en disco
|
||
57 | * a medida que se le van solicitando. Por ello, no es posible modificarlos sino cargamos
|
||
58 | * un buffer con los datos previamente.
|
||
59 | */
|
||
60 | public void loadWriterData() throws GridException; |
||
61 | |||
62 | /**
|
||
63 | * Obtiene el buffer de datos del grid
|
||
64 | * @return RasterBuf
|
||
65 | */
|
||
66 | public Buffer getRasterBuf(); |
||
67 | |||
68 | /**
|
||
69 | * Asigna la banda sobre la que se realizan las operaciones. Por defecto es la banda 0
|
||
70 | * con lo que para el uso de MDTs no habr? que modificar este valor.
|
||
71 | * @param band Banda sobre la que se realizan las operaciones.
|
||
72 | */
|
||
73 | public void setBandToOperate(int band); |
||
74 | |||
75 | /**
|
||
76 | * Obtiene el n?mero de bandas del grid o 0 si no tiene buffer de
|
||
77 | * datos asociado.
|
||
78 | * @return N?mero de bandas
|
||
79 | */
|
||
80 | public int getBandCount(); |
||
81 | |||
82 | /**
|
||
83 | * Obtiene el objeto que calcula las estad?sticas del Grid
|
||
84 | * @return IBasicStats
|
||
85 | */
|
||
86 | public BasicStats getStatistics();
|
||
87 | |||
88 | /**
|
||
89 | * Obtiene el valor de una celda de tipo byte. Si el punto excede los l?mites
|
||
90 | * del grid devuelve un valor NoData. La excepci?n ser? lanzada si intentamos
|
||
91 | * acceder a un tipo de dato erroneo.
|
||
92 | * @param x Posici?n X a recuperar
|
||
93 | * @param y Posici?n Y a recuperar
|
||
94 | * @throws RasterBufferInvalidAccessException
|
||
95 | * @return Valor byte
|
||
96 | */
|
||
97 | public byte getCellValueAsByte(int x, int y)throws GridException; |
||
98 | |||
99 | /**
|
||
100 | * Obtiene el valor de una celda de tipo short. Si el punto excede los l?mites
|
||
101 | * del grid devuelve un valor NoData. La excepci?n ser? lanzada si intentamos
|
||
102 | * acceder a un tipo de dato erroneo.
|
||
103 | * @param x Posici?n X a recuperar
|
||
104 | * @param y Posici?n Y a recuperar
|
||
105 | * @throws RasterBufferInvalidAccessException
|
||
106 | * @return Valor short
|
||
107 | */
|
||
108 | public short getCellValueAsShort(int x, int y)throws GridException; |
||
109 | |||
110 | /**
|
||
111 | * Obtiene el valor de una celda de tipo int. Si el punto excede los l?mites
|
||
112 | * del grid devuelve un valor NoData. La excepci?n ser? lanzada si intentamos
|
||
113 | * acceder a un tipo de dato erroneo.
|
||
114 | * @param x Posici?n X a recuperar
|
||
115 | * @param y Posici?n Y a recuperar
|
||
116 | * @throws RasterBufferInvalidAccessException
|
||
117 | * @return Valor int
|
||
118 | */
|
||
119 | public int getCellValueAsInt(int x, int y)throws GridException; |
||
120 | |||
121 | /**
|
||
122 | * Obtiene el valor de una celda de tipo float. Si el punto excede los l?mites
|
||
123 | * del grid devuelve un valor NoData. La excepci?n ser? lanzada si intentamos
|
||
124 | * acceder a un tipo de dato erroneo.
|
||
125 | * @param x Posici?n X a recuperar
|
||
126 | * @param y Posici?n Y a recuperar
|
||
127 | * @throws RasterBufferInvalidAccessException
|
||
128 | * @return Valor float
|
||
129 | */
|
||
130 | public float getCellValueAsFloat(int x, int y)throws GridException; |
||
131 | |||
132 | /**
|
||
133 | * Obtiene el valor de una celda de tipo double. Si el punto excede los l?mites
|
||
134 | * del grid devuelve un valor NoData. La excepci?n ser? lanzada si intentamos
|
||
135 | * acceder a un tipo de dato erroneo.
|
||
136 | * @param x Posici?n X a recuperar
|
||
137 | * @param y Posici?n Y a recuperar
|
||
138 | * @throws RasterBufferInvalidAccessException
|
||
139 | * @return Valor double
|
||
140 | */
|
||
141 | public double getCellValueAsDouble(int x, int y)throws GridException; |
||
142 | |||
143 | /**
|
||
144 | * Asigna el m?todo de interpolaci?n. Si el lector no es interpolado se instanciar?
|
||
145 | * como interpolado sin necesidad de llamar a switchToInterpolationMethod. Los m?todos
|
||
146 | * de interpolaci?n soportados est?n definidos en la clase GridInterpolated como variables
|
||
147 | * est?ticas.
|
||
148 | *
|
||
149 | * @param iMethod
|
||
150 | */
|
||
151 | public void setInterpolationMethod(int iMethod); |
||
152 | |||
153 | /**
|
||
154 | * Consulta al grid si el valor pasado por par?metro coincide con el valor NoData del
|
||
155 | * buffer.
|
||
156 | * @param dValue valor para comparar con el NoData del buffer
|
||
157 | * @return true si el valor pasado es NoData y false si no lo es
|
||
158 | */
|
||
159 | public boolean isNoDataValue(double dValue); |
||
160 | |||
161 | /**
|
||
162 | * Obtiene la extensi?n de la ventana del raster accedida por el grid
|
||
163 | * @return Objeto GridExtent con la extensi?n.
|
||
164 | */
|
||
165 | public GridExtent getGridExtent();
|
||
166 | |||
167 | /**
|
||
168 | * Consulta si un punto est? dentro del grid o fuera de el
|
||
169 | * @param x Coordenada X del punto a consultar
|
||
170 | * @param y Coordenada Y del punto a consultar
|
||
171 | * @return true si el punto est? dentro del grid y false si est? fuera de ?l
|
||
172 | */
|
||
173 | public boolean isInGrid(int x, int y); |
||
174 | |||
175 | /**
|
||
176 | * Obtiene el ancho en p?xeles del grid
|
||
177 | * @return entero que representa el ancho en p?xeles
|
||
178 | */
|
||
179 | public int getNX(); |
||
180 | |||
181 | /**
|
||
182 | * Obtiene el alto en p?xeles del grid
|
||
183 | * @return entero que representa el alto en p?xeles
|
||
184 | */
|
||
185 | public int getNY(); |
||
186 | |||
187 | /**
|
||
188 | * Obtiene el ancho en p?xeles del dataset completo
|
||
189 | * @return entero que representa el ancho en p?xeles del dataset completo
|
||
190 | */
|
||
191 | public int getLayerNX(); |
||
192 | |||
193 | /**
|
||
194 | * Obtiene el alto en p?xeles del dataset completo
|
||
195 | * @return entero que representa el alto en p?xeles del dataset completo
|
||
196 | */
|
||
197 | public int getLayerNY(); |
||
198 | |||
199 | /**
|
||
200 | * Tama?o de celda
|
||
201 | * @return
|
||
202 | */
|
||
203 | public double getCellSize(); |
||
204 | |||
205 | /**
|
||
206 | * Obtiene el tipo de datos
|
||
207 | * @return
|
||
208 | */
|
||
209 | public int getDataType(); |
||
210 | |||
211 | /**
|
||
212 | * Valor nodata asociado al grid
|
||
213 | * @return
|
||
214 | */
|
||
215 | public NoData getNoDataValue();
|
||
216 | |||
217 | /**
|
||
218 | * Obtiene la lista de paletas asociadas al grid
|
||
219 | * @return Lista de objetos GridPalette
|
||
220 | */
|
||
221 | public ColorTable getPalette();
|
||
222 | |||
223 | /**
|
||
224 | * Obtiene la pendiente de un ?rea de 3x3 p?xeles que tiene como
|
||
225 | * centro las coordenadas que se le indican
|
||
226 | * @param x Coordenada pixel X
|
||
227 | * @param y Coordenada pixel Y
|
||
228 | * @return
|
||
229 | * @throws GridException
|
||
230 | */
|
||
231 | public double getSlope(int x, int y)throws GridException; |
||
232 | |||
233 | public double getAspect(int x, int y)throws GridException; |
||
234 | |||
235 | public double getDistToNeighborInDir(int iDir); |
||
236 | |||
237 | public int getDirToNextDownslopeCell(int x, int y)throws GridException; |
||
238 | |||
239 | public int getDirToNextDownslopeCell(int x, int y, boolean bForceDirToNoDataCell)throws GridException; |
||
240 | |||
241 | public GridCell[] getSortedArrayOfCells()throws GridException; |
||
242 | |||
243 | public void assign(byte value)throws GridException; |
||
244 | |||
245 | public void assign(short value)throws GridException; |
||
246 | |||
247 | public void assign(int value)throws GridException; |
||
248 | |||
249 | public void assign(float value)throws GridException; |
||
250 | |||
251 | public void assign(double value)throws GridException; |
||
252 | |||
253 | public void assign(Grid driver)throws GridException; |
||
254 | |||
255 | public void addToCellValue(int x, int y, byte value) throws GridException; |
||
256 | |||
257 | public void addToCellValue(int x, int y, short value) throws GridException; |
||
258 | |||
259 | public void addToCellValue(int x, int y, int value) throws GridException; |
||
260 | |||
261 | public void addToCellValue(int x, int y, float value) throws GridException; |
||
262 | |||
263 | public void addToCellValue(int x, int y, double value) throws GridException; |
||
264 | |||
265 | public void assignNoData(); |
||
266 | |||
267 | public void setCellValue(int x, int y, byte value)throws OutOfGridException; |
||
268 | |||
269 | public void setCellValue(int x, int y, short value)throws OutOfGridException; |
||
270 | |||
271 | public void setCellValue(int x, int y, int value)throws OutOfGridException; |
||
272 | |||
273 | public void setCellValue(int x, int y, float value)throws OutOfGridException; |
||
274 | |||
275 | public void setCellValue(int x, int y, double value)throws OutOfGridException; |
||
276 | |||
277 | public void add(Grid driver) throws GridException; |
||
278 | |||
279 | public void multiply(double dValue) throws GridException; |
||
280 | |||
281 | /**
|
||
282 | * Asigna el valor que indica que una celda no tiene datos para el buffer
|
||
283 | * @param dNoDataValue Valor NoData
|
||
284 | */
|
||
285 | public void setNoDataValue(NoData dNoDataValue); |
||
286 | |||
287 | public void setNoData(int x, int y); |
||
288 | |||
289 | /**
|
||
290 | * Obtiene la lista de filtros.
|
||
291 | * @return Lista de filtros.
|
||
292 | */
|
||
293 | public RasterFilterList getFilterList();
|
||
294 | |||
295 | /**
|
||
296 | * Asigna la lista de filtros
|
||
297 | * @param filterList
|
||
298 | */
|
||
299 | public void setFilterList(RasterFilterList filterList); |
||
300 | |||
301 | /**
|
||
302 | * Returns a GridCell object
|
||
303 | * @param iX
|
||
304 | * X position
|
||
305 | * @param iY
|
||
306 | * Y position
|
||
307 | * @return
|
||
308 | * @throws GridException
|
||
309 | */
|
||
310 | public GridCell getGridCell(int iX, int iY) throws GridException; |
||
311 | } |