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 / RasterManager.java @ 159
History | View | Annotate | Download (13.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; |
23 |
|
24 |
import java.awt.geom.AffineTransform; |
25 |
import java.awt.geom.Dimension2D; |
26 |
import java.io.FileNotFoundException; |
27 |
|
28 |
import org.cresques.cts.IProjection; |
29 |
import org.gvsig.fmap.dal.DataStoreParameters; |
30 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
31 |
import org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory; |
32 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
33 |
import org.gvsig.fmap.dal.coverage.datastruct.GridExtent; |
34 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
35 |
import org.gvsig.fmap.dal.coverage.datastruct.RasterLegend; |
36 |
import org.gvsig.fmap.dal.coverage.datastruct.ViewPortData; |
37 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
38 |
import org.gvsig.fmap.dal.coverage.exception.RasterBufferInvalidException; |
39 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
40 |
import org.gvsig.fmap.dal.coverage.exception.RasterLegendIONotFound; |
41 |
import org.gvsig.fmap.dal.coverage.grid.AbstractROI; |
42 |
import org.gvsig.fmap.dal.coverage.grid.Grid; |
43 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilterList; |
44 |
import org.gvsig.fmap.dal.coverage.process.TaskEventManager; |
45 |
import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder; |
46 |
import org.gvsig.fmap.dal.coverage.process.warp.Warp; |
47 |
import org.gvsig.fmap.dal.coverage.store.DataServerWriter; |
48 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
49 |
import org.gvsig.fmap.dal.coverage.store.RasterQuery; |
50 |
import org.gvsig.fmap.dal.coverage.store.RasterWriter; |
51 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
52 |
import org.gvsig.fmap.dal.coverage.store.props.Statistics; |
53 |
import org.gvsig.fmap.dal.coverage.util.CRSUtils; |
54 |
import org.gvsig.fmap.dal.coverage.util.ColorConversion; |
55 |
import org.gvsig.fmap.dal.coverage.util.FileUtils; |
56 |
import org.gvsig.fmap.dal.coverage.util.Historical; |
57 |
import org.gvsig.fmap.dal.coverage.util.MathUtils; |
58 |
import org.gvsig.fmap.dal.coverage.util.ProviderServices; |
59 |
import org.gvsig.fmap.dal.coverage.util.RasterUtils; |
60 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider; |
61 |
import org.gvsig.tools.service.ServiceException; |
62 |
|
63 |
/**
|
64 |
* This class is responsible of the management of the library's business logic.
|
65 |
* It is the library's main entry point, and provides all the services to manage
|
66 |
* {@link RasterService}s.
|
67 |
*
|
68 |
* @see RasterService
|
69 |
* @author gvSIG team
|
70 |
* @version $Id$
|
71 |
*/
|
72 |
public interface RasterManager { |
73 |
public int TYPE_MULTIDATA = 0; |
74 |
public int TYPE_MOSAICDATA = 1; |
75 |
|
76 |
/**
|
77 |
* Gets the factory for data structures
|
78 |
* @return
|
79 |
*/
|
80 |
public DataStructFactory getDataStructFactory();
|
81 |
|
82 |
/**
|
83 |
* Gets the Provider information object
|
84 |
* @return
|
85 |
*/
|
86 |
public ProviderServices getProviderServices();
|
87 |
|
88 |
/**
|
89 |
* Gets the CRS utilities
|
90 |
* @return
|
91 |
*/
|
92 |
public CRSUtils getCRSUtils();
|
93 |
|
94 |
/**
|
95 |
* Gets the file utilities
|
96 |
* @return
|
97 |
*/
|
98 |
public FileUtils getFileUtils();
|
99 |
|
100 |
/**
|
101 |
* Gets the raster utilities
|
102 |
* @return
|
103 |
*/
|
104 |
public RasterUtils getRasterUtils();
|
105 |
|
106 |
/**
|
107 |
* Gets the mathematical utilities
|
108 |
* @return
|
109 |
*/
|
110 |
public MathUtils getMathUtils();
|
111 |
|
112 |
/**
|
113 |
* Create an instance of a {@link RasterService}.
|
114 |
*
|
115 |
* @return {@link RasterService}
|
116 |
* @throws ServiceException
|
117 |
* if there is an error getting the service
|
118 |
*/
|
119 |
public RasterService getRasterService() throws ServiceException; |
120 |
|
121 |
/**
|
122 |
* Gets the object to convert color spaces
|
123 |
* @return
|
124 |
*/
|
125 |
public ColorConversion getColorConversion();
|
126 |
|
127 |
/**
|
128 |
* Lista de formatos soportados por RasterLegendIO
|
129 |
*
|
130 |
* @return
|
131 |
*/
|
132 |
public String[] getLegendFormats(); |
133 |
|
134 |
/**
|
135 |
* Devuelve un RasterLegend para el formato especificado por parametro.
|
136 |
*
|
137 |
* @param formatName
|
138 |
* @return
|
139 |
* @throws RasterLegendIONotFound
|
140 |
*/
|
141 |
public RasterLegend getRasterLegendIO(String formatName) throws RasterLegendIONotFound; |
142 |
|
143 |
/**
|
144 |
* Abre un dataset pasando como par?metros la proyecci?n y un objeto identificador del dataset. Este
|
145 |
* objeto puede ser una ruta a un fichero en disco. En este caso la extensi?n del fichero servir? para
|
146 |
* buscar el driver que lo gestiona. Si proporcionamos un array de cadenas se tratar?n como la ruta a N ficheros
|
147 |
* de disco. Tambi?n puede ser un buffer de datos en memoria o cualquier otro objeto
|
148 |
* que pueda aceptar un driver.
|
149 |
* @param param Par?metros al driver
|
150 |
* @return RasterMultiDatset
|
151 |
* @throws NotSupportedExtensionException
|
152 |
* @throws RasterDriverException
|
153 |
*/
|
154 |
public RasterDataStore open(DataStoreParameters param) throws NotSupportedExtensionException, RasterDriverException; |
155 |
|
156 |
public RasterDataStore open(CoverageStoreProvider prov, int type, DataStoreParameters params) throws NotSupportedExtensionException, RasterDriverException; |
157 |
|
158 |
/**
|
159 |
* Builds a new empty RasterQuery object
|
160 |
* @return
|
161 |
*/
|
162 |
public RasterQuery createQuery();
|
163 |
|
164 |
/**
|
165 |
* Genera instancias del buffer de datos adecuado al tama?o del raster. Si no hay muchos datos
|
166 |
* (menos de cacheMemorySize) crear? un buffer en memoria. Si hay m?s de esta cantidad
|
167 |
* entonces crearemos un buffer cacheado (RasterCache). A partir de la cantidad se?alada
|
168 |
* por multicacheMemorySize haremos un buffer cacheado donde cada p?gina no ocupa todo
|
169 |
* el ancho del raster ya que este ser? muy grande. La gesti?n de una cache donde cada
|
170 |
* pagina ha de partir una l?nea lleva una complejidad a?adida.
|
171 |
*
|
172 |
* @param dataType Tipo de dato
|
173 |
* @param width Ancho
|
174 |
* @param height Alto
|
175 |
* @param bandNr Banda
|
176 |
* @param flag En caso de buffers de memoria este flag a true significa que se reserva la memoria
|
177 |
* para el buffer de forma normal y si est? a false no se reserva por lo que la reserva deber? ser
|
178 |
* posterior.
|
179 |
* @return Objeto RasterBuffer
|
180 |
* @throws RasterDriverException
|
181 |
* @throws NotSupportedExtensionException
|
182 |
* @throws FileNotFoundException
|
183 |
*/
|
184 |
public Buffer createBuffer(int dataType, int width, int height, int bandNr, boolean malloc); |
185 |
|
186 |
/**
|
187 |
* Genera una instancia del buffer de solo lectura. Este buffer consta de una cache y unos apuntadores
|
188 |
* a las p?ginas en disco. Cuando se accede a los datos se carga en memoria la p?gina pedida.
|
189 |
*
|
190 |
* @param dataType Tipo de dato
|
191 |
* @param width Ancho
|
192 |
* @param height Alto
|
193 |
* @param bandNr Banda
|
194 |
*/
|
195 |
public Buffer createReadOnlyBuffer(int dataType, int width, int height, int bandNr); |
196 |
|
197 |
/**
|
198 |
* Genera una instancia del buffer de solo lectura. Este buffer consta de una cache y unos apuntadores
|
199 |
* a las p?ginas en disco. Cuando se accede a los datos se carga en memoria la p?gina pedida.
|
200 |
*
|
201 |
* @param dataType Tipo de dato
|
202 |
* @param width Ancho
|
203 |
* @param height Alto
|
204 |
* @param bandNr Banda
|
205 |
* @param flag En caso de buffers de memoria este flag a true significa que se reserva la memoria
|
206 |
* para el buffer de forma normal y si est? a false no se reserva por lo que la reserva deber? ser
|
207 |
* posterior.
|
208 |
*/
|
209 |
public Buffer createMemoryBuffer(int dataType, int width, int height, int bandNr, boolean malloc); |
210 |
|
211 |
/**
|
212 |
* Factoria para obtener escritores de los distintos tipos de raster.
|
213 |
* @param fName Nombre del fichero.
|
214 |
* @return GeoRasterWriter, o null si hay problemas.
|
215 |
*/
|
216 |
public RasterWriter createWriter(String fName) throws NotSupportedExtensionException, RasterDriverException; |
217 |
|
218 |
/**
|
219 |
* Factoria para obtener escritores de los distintos tipos de raster.
|
220 |
*
|
221 |
* @param fName Nombre del fichero.
|
222 |
* @return GeoRasterWriter, o null si hay problemas.
|
223 |
*/
|
224 |
public RasterWriter createWriter(DataServerWriter dataWriter,
|
225 |
String outFileName,
|
226 |
int nBands,
|
227 |
AffineTransform at,
|
228 |
int outSizeX,
|
229 |
int outSizeY,
|
230 |
int dataType,
|
231 |
Params params, |
232 |
IProjection proj) throws NotSupportedExtensionException, RasterDriverException;
|
233 |
|
234 |
/**
|
235 |
* Factoria para obtener escritores de los distintos tipos de raster.
|
236 |
*
|
237 |
* @param fName Nombre del fichero.
|
238 |
* @return GeoRasterWriter, o null si hay problemas.
|
239 |
*/
|
240 |
public RasterWriter createWriter(DataServerWriter dataWriter,
|
241 |
String outFileName,
|
242 |
int nBands,
|
243 |
AffineTransform at,
|
244 |
int outSizeX,
|
245 |
int outSizeY,
|
246 |
int dataType,
|
247 |
Params params, |
248 |
IProjection proj, |
249 |
boolean geo) throws NotSupportedExtensionException, RasterDriverException; |
250 |
|
251 |
/**
|
252 |
* Obtiene los par?metros del driver de escritura a partir del nombre de fichero de salida.
|
253 |
* @return WriterParams
|
254 |
*/
|
255 |
public Params createWriterParams(String fileName); |
256 |
|
257 |
/**
|
258 |
* Gets an instance of the overview builder registered
|
259 |
* @return OverviewBuilder
|
260 |
*/
|
261 |
public OverviewBuilder createOverviewBuilder();
|
262 |
|
263 |
/**
|
264 |
* Gets a new instance of a ColorInterpretation object
|
265 |
* @param A list of color interpretation strings
|
266 |
* @return
|
267 |
*/
|
268 |
public ColorInterpretation createColorInterpretation(String[] colorInterp); |
269 |
|
270 |
/**
|
271 |
* Crea un grid a partir de un MultiRasterDataset. Usa el extent de la fuente de datos como
|
272 |
* extent completo y el extent pasado como par?metro como extensi?n de ventana.
|
273 |
*
|
274 |
* Cuando se construye el reader se carga el buffer con la extensi?n definida en windowExtent
|
275 |
* y las bandas especificadas en bands.
|
276 |
*
|
277 |
* @param IRasterDataSource datasets que proporcionan los datos
|
278 |
* @param bands n?mero de bandas requeridas
|
279 |
* @param windowExtent Extensi?n de la ventana. Si este par?metro es null se usar? el
|
280 |
* mismo que el de la capa.
|
281 |
*/
|
282 |
public Grid createGrid(RasterDataStore datasource, int[] bands, GridExtent windowExtent) throws RasterBufferInvalidException; |
283 |
|
284 |
/**
|
285 |
* Crea un grid a partir de un BufferFactory. Se har? una petici?n del extent completo de la fuente.
|
286 |
* bufferFactory tiene asociada una fuente de datos pero se ignorar? si tiene el buffer lleno. La instanciaci?n
|
287 |
* de GridNotInterpolated har? que se haga la petici?n para cargar raster completo.
|
288 |
* @param bufferFactory Fuente de datos
|
289 |
* @param bands n?mero de bandas requeridas y orden de dibujado en el buffer
|
290 |
*/
|
291 |
public Grid createGrid(RasterDataStore datasource, int[] bands) throws RasterBufferInvalidException; |
292 |
|
293 |
/**
|
294 |
* Crea un grid a partir de un BufferFactory. Se har? una petici?n del extent completo de la fuente.
|
295 |
* bufferFactory tiene asociada una fuente de datos pero se ignorar? si tiene el buffer lleno. La instanciaci?n
|
296 |
* de GridNotInterpolated har? que se haga la petici?n para cargar raster completo. El buffer se cargar?
|
297 |
* con todas las bandas disponibles.
|
298 |
* @param datasource Fuente de datos
|
299 |
*/
|
300 |
public Grid createGrid(RasterDataStore datasource) throws RasterBufferInvalidException; |
301 |
|
302 |
/**
|
303 |
* Crea un grid vacio a partir de un extent y un tipo de datos. Se crea un buffer vacio en el
|
304 |
* que puede escribirse a trav?s del writer. Los datos escritos pueden ser consultados con el
|
305 |
* reader. No tiene una fuente de datos asociada ya que es un grid vacio basicamente para
|
306 |
* escritura.
|
307 |
* @param layerExtent Tama?o completo de la capa
|
308 |
* @param windowExtent Ventana de datos.
|
309 |
* @param dataType Tipo de datos del buffer
|
310 |
* @param bands n?mero de bandas requeridas y orden de dibujado en el buffer
|
311 |
*/
|
312 |
public Grid createGrid(GridExtent layerExtent,
|
313 |
GridExtent windowExtent, |
314 |
int dataType,
|
315 |
int[] bands) throws RasterBufferInvalidException; |
316 |
|
317 |
/**
|
318 |
* Crea un grid a partir de un BufferFactory. El buffer debe estar cargado de datos y el extent
|
319 |
* de este viene definido en el par?metro windowExtent.
|
320 |
* @param bufferFactory Fuente de datos
|
321 |
* @param windowExtent Extent de los datos cargados en bufferFactory
|
322 |
* @param notInterp Si es true fuerza a que el reader sea sin interpolaci?n. Si es false decide si
|
323 |
* el reader es interpolado o no a partir de los extents de capa y la ventana seleccionada.
|
324 |
*/
|
325 |
public Grid createGrid(Buffer buf, RasterDataStore datasource, boolean notInterp); |
326 |
|
327 |
/**
|
328 |
* Builds a Warp object
|
329 |
* @return
|
330 |
*/
|
331 |
public Warp createWarp();
|
332 |
|
333 |
/**
|
334 |
* Builds a new service to recover historical objects
|
335 |
* @return
|
336 |
*/
|
337 |
public Historical createHistoricalService();
|
338 |
|
339 |
/**
|
340 |
* Builds a new ViewPortData object
|
341 |
* @param proj
|
342 |
* @param extent
|
343 |
* @param size
|
344 |
* @return
|
345 |
*/
|
346 |
public ViewPortData createViewPortData(IProjection proj, Extent extent, Dimension2D size); |
347 |
|
348 |
/**
|
349 |
* Builds a new ViewPortData object
|
350 |
* @return
|
351 |
*/
|
352 |
public ViewPortData createViewPortData();
|
353 |
|
354 |
/**
|
355 |
* Returns a Statistics object for a ROI
|
356 |
* @param roi
|
357 |
* @return
|
358 |
*/
|
359 |
public Statistics createROIStatistics(AbstractROI roi);
|
360 |
|
361 |
/**
|
362 |
* Builds a new and empty filter list
|
363 |
* @return
|
364 |
*/
|
365 |
public RasterFilterList createEmptyFilterList();
|
366 |
|
367 |
/**
|
368 |
* Gets a register task. To get a task it will use the current thread ID
|
369 |
* @return TaskEventManager
|
370 |
*/
|
371 |
public TaskEventManager getRasterTask();
|
372 |
|
373 |
/**
|
374 |
* Registers the object as a task using the current thread ID. It returns
|
375 |
* a TaskEventManager
|
376 |
* @param process
|
377 |
* @return
|
378 |
*/
|
379 |
public TaskEventManager createRasterTask(Object process); |
380 |
|
381 |
/**
|
382 |
* Builds a new data server to write data in a buffer
|
383 |
* @return
|
384 |
*/
|
385 |
public DataServerWriter createDataServerWriter();
|
386 |
|
387 |
/**
|
388 |
* Builds a new parameter object. These parameters represents the fieds of a filter
|
389 |
* panel.
|
390 |
* @param id
|
391 |
* @param value
|
392 |
* @param type
|
393 |
* @param list
|
394 |
* @return
|
395 |
*/
|
396 |
public Params createParams(String id, Object value, int type, String[] list); |
397 |
} |