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 @ 2438
History | View | Annotate | Download (12.4 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.io.FileNotFoundException; |
26 |
import java.util.Set; |
27 |
|
28 |
import org.cresques.cts.IProjection; |
29 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
30 |
import org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory; |
31 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
32 |
import org.gvsig.fmap.dal.coverage.datastruct.RasterLegend; |
33 |
import org.gvsig.fmap.dal.coverage.exception.FileNotExistsException; |
34 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
35 |
import org.gvsig.fmap.dal.coverage.exception.ROIException; |
36 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
37 |
import org.gvsig.fmap.dal.coverage.exception.RasterLegendIONotFound; |
38 |
import org.gvsig.fmap.dal.coverage.filter.FilterLoader; |
39 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilterList; |
40 |
import org.gvsig.fmap.dal.coverage.grid.render.ImageDrawer; |
41 |
import org.gvsig.fmap.dal.coverage.process.TaskEventManager; |
42 |
import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder; |
43 |
import org.gvsig.fmap.dal.coverage.store.DataServerWriter; |
44 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
45 |
import org.gvsig.fmap.dal.coverage.store.RasterQuery; |
46 |
import org.gvsig.fmap.dal.coverage.store.RasterWriter; |
47 |
import org.gvsig.fmap.dal.coverage.store.parameter.NewRasterStoreParameters; |
48 |
import org.gvsig.fmap.dal.coverage.store.props.Statistics; |
49 |
import org.gvsig.fmap.dal.coverage.util.CRSUtils; |
50 |
import org.gvsig.fmap.dal.coverage.util.ColorConversion; |
51 |
import org.gvsig.fmap.dal.coverage.util.FileUtils; |
52 |
import org.gvsig.fmap.dal.coverage.util.Historical; |
53 |
import org.gvsig.fmap.dal.coverage.util.MathUtils; |
54 |
import org.gvsig.fmap.dal.coverage.util.ProviderServices; |
55 |
import org.gvsig.fmap.dal.coverage.util.RasterUtils; |
56 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
57 |
import org.gvsig.raster.roi.AbstractROI; |
58 |
import org.gvsig.raster.roi.ROIReader; |
59 |
import org.gvsig.raster.roi.ROIWriter; |
60 |
import org.gvsig.raster.roi.VectorialROI; |
61 |
|
62 |
/**
|
63 |
* This class is responsible of the management of the library's business logic.
|
64 |
* It is the library's main entry point, and provides all the services to manage
|
65 |
* {@link RasterService}s.
|
66 |
*
|
67 |
* @see RasterService
|
68 |
* @author gvSIG team
|
69 |
* @version $Id$
|
70 |
*/
|
71 |
public interface RasterManager { |
72 |
public int TYPE_MULTIDATA = 0; |
73 |
public int TYPE_MOSAICDATA = 1; |
74 |
|
75 |
/* **************************
|
76 |
* SERVICES
|
77 |
************************** */
|
78 |
|
79 |
/**
|
80 |
* Gets the factory to build buffers which store pixel data
|
81 |
* @return {@link BufferFactory}
|
82 |
*/
|
83 |
public BufferFactory getBufferFactory();
|
84 |
|
85 |
/**
|
86 |
* Gets the factory for data structures
|
87 |
* @return
|
88 |
*/
|
89 |
public DataStructFactory getDataStructFactory();
|
90 |
|
91 |
/**
|
92 |
* Gets the data source services
|
93 |
* @return
|
94 |
*/
|
95 |
public ProviderServices getProviderServices();
|
96 |
|
97 |
/**
|
98 |
* Gets projection utilities
|
99 |
* @return
|
100 |
*/
|
101 |
public CRSUtils getCRSUtils();
|
102 |
|
103 |
/**
|
104 |
* Returns true if exists any implementation registered for
|
105 |
* this service
|
106 |
* @return
|
107 |
*/
|
108 |
public boolean isCRSUtilSupported(); |
109 |
|
110 |
/**
|
111 |
* Gets utilities for files management
|
112 |
* @return
|
113 |
*/
|
114 |
public FileUtils getFileUtils();
|
115 |
|
116 |
/**
|
117 |
* Gets utilities for raster management
|
118 |
* @return
|
119 |
*/
|
120 |
public RasterUtils getRasterUtils();
|
121 |
|
122 |
/**
|
123 |
* Gets mathematical utilities
|
124 |
* @return
|
125 |
*/
|
126 |
public MathUtils getMathUtils();
|
127 |
|
128 |
/**
|
129 |
* Gets the object to convert color spaces
|
130 |
* @return
|
131 |
*/
|
132 |
public ColorConversion getColorConversion();
|
133 |
|
134 |
/**
|
135 |
* Builds a new empty RasterQuery object
|
136 |
* @return {@link RasterQuery}
|
137 |
*/
|
138 |
public RasterQuery createQuery();
|
139 |
|
140 |
/**
|
141 |
* Gets an instance of the overview builder registered
|
142 |
* @return OverviewBuilder
|
143 |
*/
|
144 |
public OverviewBuilder getOverviewBuilder(String id); |
145 |
|
146 |
/**
|
147 |
* REturns true if the overview builder is supported
|
148 |
* @return
|
149 |
*/
|
150 |
public boolean isOverviewBuilderSupported(); |
151 |
|
152 |
/**
|
153 |
* Gets the list of keys in the overview builder
|
154 |
* @return
|
155 |
*/
|
156 |
public Set<String> getOverviewBuilderKeyList(); |
157 |
|
158 |
/**
|
159 |
* Builds a new service to recover historical objects
|
160 |
* @return
|
161 |
*/
|
162 |
public Historical createHistoricalService();
|
163 |
|
164 |
/**
|
165 |
* Returns a Statistics object for a ROI
|
166 |
* @param roi
|
167 |
* @return
|
168 |
*/
|
169 |
public Statistics createROIStatistics(AbstractROI roi);
|
170 |
|
171 |
/**
|
172 |
* Creates a service to render a buffer on a java Image object
|
173 |
* @return
|
174 |
*/
|
175 |
public ImageDrawer createImageDrawerService();
|
176 |
|
177 |
/* **************************
|
178 |
* LEGENDS
|
179 |
************************** */
|
180 |
|
181 |
/**
|
182 |
* Lista de formatos soportados por RasterLegendIO
|
183 |
*
|
184 |
* @return
|
185 |
*/
|
186 |
public String[] getLegendFormats(); |
187 |
|
188 |
/**
|
189 |
* Devuelve un RasterLegend para el formato especificado por parametro.
|
190 |
*
|
191 |
* @param formatName
|
192 |
* @return
|
193 |
* @throws RasterLegendIONotFound
|
194 |
*/
|
195 |
public RasterLegend getRasterLegendIO(String formatName) throws RasterLegendIONotFound; |
196 |
|
197 |
|
198 |
/* **************************
|
199 |
* TASK
|
200 |
************************** */
|
201 |
|
202 |
/**
|
203 |
* Gets a register task. To get a task it will use the current thread ID
|
204 |
* @return TaskEventManager
|
205 |
*/
|
206 |
public TaskEventManager getRasterTask();
|
207 |
|
208 |
/**
|
209 |
* Registers the object as a task using the current thread ID. It returns
|
210 |
* a TaskEventManager
|
211 |
* @param process
|
212 |
* @return
|
213 |
*/
|
214 |
public TaskEventManager createRasterTask(Object process); |
215 |
|
216 |
/* **************************
|
217 |
* FILTER
|
218 |
************************** */
|
219 |
|
220 |
/**
|
221 |
* Builds a new and empty filter list
|
222 |
* @return
|
223 |
*/
|
224 |
public RasterFilterList createEmptyFilterList(int type); |
225 |
|
226 |
/**
|
227 |
* Builds a new parameter object. These parameters represents the fieds of a filter
|
228 |
* panel.
|
229 |
* @param id
|
230 |
* @param value
|
231 |
* @param type
|
232 |
* @param list
|
233 |
* @return
|
234 |
*/
|
235 |
public Params createParams(String id, Object value, int type, String[] list); |
236 |
|
237 |
/**
|
238 |
* Builds loader of filters using a default list of filters. This loader avoids the
|
239 |
* use of a Grid
|
240 |
* @param dataType
|
241 |
* @return
|
242 |
*/
|
243 |
public FilterLoader createFilterLoader(int dataType); |
244 |
|
245 |
/**
|
246 |
* Builds loader of filters using a specific list of filters. ThOis loader avoids the
|
247 |
* use of a Grid
|
248 |
* @param dataType
|
249 |
* @return
|
250 |
*/
|
251 |
public FilterLoader createFilterLoader(RasterFilterList filterList);
|
252 |
|
253 |
/* **************************
|
254 |
* ROI
|
255 |
************************** */
|
256 |
|
257 |
/**
|
258 |
* Creates a reader for a ROI file
|
259 |
* @param filename
|
260 |
* file name where the regions
|
261 |
* @param store
|
262 |
* data store associated to these regions
|
263 |
* @param projection
|
264 |
* Regions projection
|
265 |
* @param bbox
|
266 |
*
|
267 |
* @return
|
268 |
* @throws FileNotExistsException
|
269 |
* @throws ROIException
|
270 |
*/
|
271 |
public ROIReader createROIReader(
|
272 |
String filename,
|
273 |
RasterDataStore store, |
274 |
IProjection projection) throws ROIException, FileNotExistsException;
|
275 |
|
276 |
/**
|
277 |
* Creates a reader from a <code>FeatureStore</code>
|
278 |
* @param roiStore
|
279 |
* @param store
|
280 |
* @param projection
|
281 |
* @return
|
282 |
* @throws ROIException
|
283 |
* @throws FileNotExistsException
|
284 |
*/
|
285 |
public ROIReader createVectorialROIReader(
|
286 |
FeatureStore roiStore, |
287 |
RasterDataStore store, |
288 |
IProjection projection); |
289 |
|
290 |
/**
|
291 |
* Creates a writer for a ROI file
|
292 |
* @param filename
|
293 |
* @param projection
|
294 |
* @return
|
295 |
*/
|
296 |
public ROIWriter createROIWriter(
|
297 |
String filename,
|
298 |
IProjection projection); |
299 |
|
300 |
/**
|
301 |
* Creates a vectorial region of interest
|
302 |
* @param roi
|
303 |
* @return
|
304 |
*/
|
305 |
public VectorialROI createVectorialROI(RasterDataStore roi);
|
306 |
|
307 |
/* **************************
|
308 |
* DEPRECATED
|
309 |
************************** */
|
310 |
|
311 |
/**
|
312 |
* Genera instancias del buffer de datos adecuado al tama?o del raster. Si no hay muchos datos
|
313 |
* (menos de cacheMemorySize) crear? un buffer en memoria. Si hay m?s de esta cantidad
|
314 |
* entonces crearemos un buffer cacheado (RasterCache). A partir de la cantidad se?alada
|
315 |
* por multicacheMemorySize haremos un buffer cacheado donde cada p?gina no ocupa todo
|
316 |
* el ancho del raster ya que este ser? muy grande. La gesti?n de una cache donde cada
|
317 |
* pagina ha de partir una l?nea lleva una complejidad a?adida.
|
318 |
*
|
319 |
* @param dataType Tipo de dato
|
320 |
* @param width Ancho
|
321 |
* @param height Alto
|
322 |
* @param bandNr Banda
|
323 |
* @param flag En caso de buffers de memoria este flag a true significa que se reserva la memoria
|
324 |
* para el buffer de forma normal y si est? a false no se reserva por lo que la reserva deber? ser
|
325 |
* posterior.
|
326 |
* @return Objeto RasterBuffer
|
327 |
* @throws RasterDriverException
|
328 |
* @throws NotSupportedExtensionException
|
329 |
* @throws FileNotFoundException
|
330 |
* @deprecated Use {@link BufferFactory} to get a {@link BufferParams} and build a {@link Buffer}
|
331 |
* BufferParam params = RasterManager.getBufferFactory().createBufferParams(dataType, width, height, bandNr, malloc);
|
332 |
* Buffer buffer = RasterManager.getBufferFactory().createBuffer(params);
|
333 |
*/
|
334 |
public Buffer createBuffer(int dataType, int width, int height, int bandNr, boolean malloc); |
335 |
|
336 |
/**
|
337 |
* Genera una instancia del buffer de solo lectura. Este buffer consta de una cache y unos apuntadores
|
338 |
* a las p?ginas en disco. Cuando se accede a los datos se carga en memoria la p?gina pedida.
|
339 |
*
|
340 |
* @param dataType Tipo de dato
|
341 |
* @param width Ancho
|
342 |
* @param height Alto
|
343 |
* @param bandNr Banda
|
344 |
* @param flag En caso de buffers de memoria este flag a true significa que se reserva la memoria
|
345 |
* para el buffer de forma normal y si est? a false no se reserva por lo que la reserva deber? ser
|
346 |
* posterior.
|
347 |
* @deprecated Use {@link BufferFactory} to get a {@link BufferParams} and build a {@link Buffer}
|
348 |
* BufferParam params = RasterManager.getBufferFactory().createMemoryBufferParams(dataType, width, height, bandNr, malloc);
|
349 |
* Buffer buffer = RasterManager.getBufferFactory().createBuffer(params);
|
350 |
*/
|
351 |
public Buffer createMemoryBuffer(int dataType, int width, int height, int bandNr, boolean malloc); |
352 |
|
353 |
/**
|
354 |
* Factoria para obtener escritores de los distintos tipos de raster.
|
355 |
* @param fName Nombre del fichero.
|
356 |
* @return GeoRasterWriter, o null si hay problemas.
|
357 |
* @deprecated Use DAL API {@link NewRasterStoreParameters}
|
358 |
*/
|
359 |
public RasterWriter createWriter(String fName) throws NotSupportedExtensionException, RasterDriverException; |
360 |
|
361 |
/**
|
362 |
* Factoria para obtener escritores de los distintos tipos de raster.
|
363 |
*
|
364 |
* @param fName Nombre del fichero.
|
365 |
* @return GeoRasterWriter, o null si hay problemas.
|
366 |
* @deprecated Use DAL API {@link NewRasterStoreParameters}
|
367 |
*/
|
368 |
public RasterWriter createWriter(DataServerWriter dataWriter,
|
369 |
String outFileName,
|
370 |
int nBands,
|
371 |
AffineTransform at,
|
372 |
int outSizeX,
|
373 |
int outSizeY,
|
374 |
int dataType,
|
375 |
Params params, |
376 |
IProjection proj) throws NotSupportedExtensionException, RasterDriverException;
|
377 |
|
378 |
/**
|
379 |
* Factoria para obtener escritores de los distintos tipos de raster.
|
380 |
*
|
381 |
* @param fName Nombre del fichero.
|
382 |
* @return GeoRasterWriter, o null si hay problemas.
|
383 |
* @deprecated Use DAL API {@link NewRasterStoreParameters}
|
384 |
*/
|
385 |
public RasterWriter createWriter(DataServerWriter dataWriter,
|
386 |
String outFileName,
|
387 |
int nBands,
|
388 |
AffineTransform at,
|
389 |
int outSizeX,
|
390 |
int outSizeY,
|
391 |
int dataType,
|
392 |
Params params, |
393 |
IProjection proj, |
394 |
boolean geo) throws NotSupportedExtensionException, RasterDriverException; |
395 |
|
396 |
/**
|
397 |
* Obtiene los par?metros del driver de escritura a partir del nombre de fichero de salida.
|
398 |
* @return WriterParams
|
399 |
* @deprecated Use DAL API {@link NewRasterStoreParameters}
|
400 |
*/
|
401 |
public Params createWriterParams(String fileName); |
402 |
|
403 |
/**
|
404 |
* Builds a new data server to write data in a buffer
|
405 |
* @return
|
406 |
* @deprecated Use DAL API {@link NewRasterStoreParameters}
|
407 |
*/
|
408 |
public DataServerWriter createDataServerWriter();
|
409 |
|
410 |
} |