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 / util / ProviderServices.java @ 4181
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.util; |
23 |
|
24 |
import java.io.File; |
25 |
import java.io.IOException; |
26 |
import java.util.ArrayList; |
27 |
|
28 |
import org.gvsig.fmap.dal.DataStoreParameters; |
29 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
30 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
31 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
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.exception.RmfSerializerException; |
35 |
import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder; |
36 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
37 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
38 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
39 |
import org.gvsig.fmap.dal.exception.InitializeException; |
40 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
41 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider; |
42 |
|
43 |
/**
|
44 |
* Providers information and basic operations
|
45 |
*
|
46 |
* @author Nacho Brodin nachobrodin@gmail.com
|
47 |
*/
|
48 |
public interface ProviderServices { |
49 |
|
50 |
/**
|
51 |
* Abre un dataset pasando como par?metros la proyecci?n y un objeto
|
52 |
* identificador del dataset. Este
|
53 |
* objeto puede ser una ruta a un fichero en disco. En este caso la
|
54 |
* extensi?n del fichero servir? para
|
55 |
* buscar el driver que lo gestiona. Si proporcionamos un array de cadenas
|
56 |
* se tratar?n como la ruta a N ficheros
|
57 |
* de disco. Tambi?n puede ser un buffer de datos en memoria o cualquier
|
58 |
* otro objeto que pueda aceptar un driver.
|
59 |
*
|
60 |
* @param param
|
61 |
* Par?metros al driver
|
62 |
* @return RasterMultiDatset
|
63 |
* @throws NotSupportedExtensionException
|
64 |
* @throws RasterDriverException
|
65 |
*/
|
66 |
public RasterDataStore open(DataStoreParameters param) throws NotSupportedExtensionException, RasterDriverException; |
67 |
|
68 |
public RasterDataStore open(String file) throws NotSupportedExtensionException, RasterDriverException, |
69 |
InitializeException, ProviderNotRegisteredException; |
70 |
|
71 |
public RasterDataStore open(CoverageStoreProvider prov, DataStoreParameters params)
|
72 |
throws NotSupportedExtensionException, RasterDriverException;
|
73 |
|
74 |
/**
|
75 |
* Registers raster providers that support tiles. This method is only for
|
76 |
* providers.
|
77 |
* In a far future it will be in the SPI.
|
78 |
*
|
79 |
* @param provider
|
80 |
*/
|
81 |
public void registerFileProvidersTiled(Class<?> provider); |
82 |
|
83 |
/**
|
84 |
* Gets the list of raster providers that support tiles. This method is only
|
85 |
* for providers.
|
86 |
* In a far future it will be in the SPI.
|
87 |
*
|
88 |
* @return
|
89 |
*/
|
90 |
public void registerTileProviderFormats(Class<?> c); |
91 |
|
92 |
/**
|
93 |
* Registers a implementation to create overviews
|
94 |
*
|
95 |
* @param ovBuilder
|
96 |
*/
|
97 |
public void registerOverviewBuilderImplementation(String id, OverviewBuilder ovBuilder); |
98 |
|
99 |
/**
|
100 |
* Registers a implementation for the CRS service
|
101 |
*
|
102 |
* @param crsUtil
|
103 |
*/
|
104 |
public void registerCRSUtilImplementation(CRSUtils crsUtil); |
105 |
|
106 |
/**
|
107 |
* Register a format and a provider which is capable to manage this format
|
108 |
*
|
109 |
* @param ext
|
110 |
* Extension
|
111 |
* @param c
|
112 |
* Provider class
|
113 |
*/
|
114 |
public void addFormat(String ext, Class<?> c); |
115 |
|
116 |
/**
|
117 |
* Returns true if the extension is supported and false if doesn't
|
118 |
*
|
119 |
* @param ext
|
120 |
* @return
|
121 |
*/
|
122 |
public boolean isExtensionSupported(String ext, Class<?> c); |
123 |
|
124 |
/**
|
125 |
* Returns true if the extension is supported and false if doesn't
|
126 |
*
|
127 |
* @param ext
|
128 |
* @return
|
129 |
*/
|
130 |
public boolean isExtensionSupported(String ext); |
131 |
|
132 |
/**
|
133 |
* Returns the list of supported formats in read only mode
|
134 |
*
|
135 |
* @return
|
136 |
*/
|
137 |
public String[] getReadOnlyFormatList(); |
138 |
|
139 |
/**
|
140 |
* Obtiene la lista de extensiones registradas
|
141 |
*
|
142 |
* @return Lista de extensiones registradas o null si no hay ninguna
|
143 |
*/
|
144 |
public String[] getDriversExtensions(); |
145 |
|
146 |
/**
|
147 |
* Obtiene la lista de extensiones de ficheros sobre los que se puede salvar
|
148 |
* en un determinado tipo de datos. Como par?metro de la funci?n se
|
149 |
* especifica
|
150 |
* el tipo de datos sobre el que se desea consultar. Este m?todo consulta
|
151 |
* para
|
152 |
* cada driver registrado que extensiones soportan un tipo.
|
153 |
*
|
154 |
* @param dataType
|
155 |
* Tipo de datos
|
156 |
* @param bands
|
157 |
* Numero de bandas
|
158 |
* @param reprojectable
|
159 |
* Especifica si devuelve solo los formatos reproyectables
|
160 |
* @return Lista de extensiones registradas que soportan el tipo de datos
|
161 |
* pasado por par?metro.
|
162 |
* @throws RasterDriverException
|
163 |
*/
|
164 |
public ArrayList<String> getExtensionsSupported(int dataType, int bands) throws RasterDriverException; |
165 |
|
166 |
/**
|
167 |
* Obtiene la lista de tipos de driver
|
168 |
*
|
169 |
* @return Lista de tipos de driver registradas o null si no hay ninguno
|
170 |
*/
|
171 |
public String[] getWriteDriversType(); |
172 |
|
173 |
/**
|
174 |
* Obtiene el tipo de driver a partir de la extensi?n
|
175 |
*
|
176 |
* @param ext
|
177 |
* Extensi?n
|
178 |
* @return Tipo
|
179 |
*/
|
180 |
public String getWriteDriverType(String ext); |
181 |
|
182 |
/**
|
183 |
* Devuelve el n?mero de drivers soportados
|
184 |
*
|
185 |
* @return N?mero de drivers soportados
|
186 |
*/
|
187 |
public int getWriteNDrivers(); |
188 |
|
189 |
/**
|
190 |
* Devuelve el n?mero de tipos de driver registrados
|
191 |
*
|
192 |
* @return N?mero de tipos de driver soportados
|
193 |
*/
|
194 |
public int getWriteNTypes(); |
195 |
|
196 |
/**
|
197 |
* M?todo que pregunta si la extensi?n pasada por par?metro est? soportada
|
198 |
* con
|
199 |
* el tipo y n?mero de bandas indicadas.
|
200 |
*
|
201 |
* @param dataType
|
202 |
* Tipo de dato
|
203 |
* @param bands
|
204 |
* N?mero de bandas
|
205 |
* @param extensi?n
|
206 |
* @return true si est? soportada y false si no lo est?
|
207 |
*/
|
208 |
public boolean isSupportedThisFileToWrite(String ext, int dataType, int bands); |
209 |
|
210 |
/**
|
211 |
* Guarda en el fichero file (en formato RMF) el objecto value usando el
|
212 |
* serializador que trata
|
213 |
* las clases class1.
|
214 |
*
|
215 |
* Si el fichero RMF no existe se crea. Ha de ser un RMF de formato valido.
|
216 |
*
|
217 |
* @param file
|
218 |
* @param class1
|
219 |
* @param value
|
220 |
* @throws RmfSerializerException
|
221 |
*/
|
222 |
public void saveObjectToRmfFile(String file, Class<?> class1, Object value) throws RmfSerializerException; |
223 |
|
224 |
/**
|
225 |
* The object passed by parameter is saved in the selected file (in RMF
|
226 |
* format)
|
227 |
* using the serializer. If the RMF file does not exists it is created
|
228 |
*
|
229 |
* @param file
|
230 |
* @param value
|
231 |
* @throws RmfSerializerException
|
232 |
*/
|
233 |
public void saveObjectToRmfFile(String file, Object value) throws RmfSerializerException; |
234 |
|
235 |
/**
|
236 |
* Builds a <code>RasterStoreParameters</code> using a file name.
|
237 |
* It is only valid for files.
|
238 |
*/
|
239 |
public RasterDataParameters createParameters(String id); |
240 |
|
241 |
/**
|
242 |
* Builds a <code>RasterStoreParameters</code> using a file name.
|
243 |
* It is only valid for files but the provider will be not tiled
|
244 |
*
|
245 |
* @throws ProviderNotRegisteredException
|
246 |
* @throws InitializeException
|
247 |
*/
|
248 |
public RasterDataParameters createNotTiledParameters(String id) throws InitializeException, |
249 |
ProviderNotRegisteredException; |
250 |
|
251 |
/**
|
252 |
* Builds a <code>RasterStoreParameters</code> using a file name. If exists
|
253 |
* more than one
|
254 |
* provider which support this file this method will return a list of
|
255 |
* parameters
|
256 |
* It is only valid for files.
|
257 |
*/
|
258 |
public ArrayList<RasterDataParameters> createParametersList(String id); |
259 |
|
260 |
/**
|
261 |
* Builds a <code>RasterStoreParameters</code> using a file. If exists more
|
262 |
* than one
|
263 |
* provider which support this file this method will return a list of
|
264 |
* parameters
|
265 |
* It is only valid for files.
|
266 |
*/
|
267 |
public ArrayList<RasterDataParameters> createParametersList(File file); |
268 |
|
269 |
/**
|
270 |
* Builds a <code>RasterStoreParameters</code> for tiled files using a file
|
271 |
* name.
|
272 |
*/
|
273 |
public RasterDataParameters createParametersForTiledFiled(String id); |
274 |
|
275 |
/**
|
276 |
* Saves a buffer to disk
|
277 |
*
|
278 |
* @param bufResult
|
279 |
* Buffer to save
|
280 |
* @param pixelSize
|
281 |
* Pixel size
|
282 |
* @param extension
|
283 |
* output file format
|
284 |
* @param alphaBand
|
285 |
* true if it has alpha band
|
286 |
* @param file
|
287 |
* Path to the new file
|
288 |
* @param extent
|
289 |
* Bounding box of the buffer
|
290 |
* @throws NotSupportedExtensionException
|
291 |
* @throws RasterDriverException
|
292 |
* @throws ProcessInterruptedException
|
293 |
* @throws IOException
|
294 |
*/
|
295 |
public void exportBufferToFile(Buffer bufResult, double pixelSize, String extension, boolean alphaBand, File file, |
296 |
Extent extent, ColorInterpretation colorInterpretation) throws NotSupportedExtensionException,
|
297 |
RasterDriverException, ProcessInterruptedException, IOException;
|
298 |
} |