Revision 7110
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.45/org.gvsig.raster.tilecache.io/src/test/resources/TemplateRasterProvider.java | ||
---|---|---|
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.dataset.io.netcdf; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
27 |
import org.gvsig.fmap.dal.DALLocator; |
|
28 |
import org.gvsig.fmap.dal.DataStore; |
|
29 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
30 |
import org.gvsig.fmap.dal.coverage.dataset.io.tile.downloader.FileTileServer; |
|
31 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
32 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
33 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
34 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
35 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
36 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
37 |
import org.gvsig.fmap.dal.coverage.exception.ParsingException; |
|
38 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
39 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
40 |
import org.gvsig.fmap.dal.coverage.store.RasterFileStoreParameters; |
|
41 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
42 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
43 |
import org.gvsig.metadata.MetadataLocator; |
|
44 |
import org.gvsig.raster.cache.tile.provider.TileListener; |
|
45 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
|
46 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
|
47 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
|
48 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
49 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
|
50 |
import org.gvsig.raster.impl.store.AbstractRasterDataStore; |
|
51 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
|
52 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
53 |
import org.gvsig.raster.impl.store.properties.DataStoreMetadata; |
|
54 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
|
55 |
import org.gvsig.tools.ToolsLocator; |
|
56 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
57 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
58 |
/** |
|
59 |
* Data provider for ... |
|
60 |
* |
|
61 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
62 |
*/ |
|
63 |
public class NetCDFProvider extends DefaultRasterProvider { |
|
64 |
public static String NAME = "Template Store"; |
|
65 |
public static String DESCRIPTION = "Template Raster file"; |
|
66 |
public final String METADATA_DEFINITION_NAME = "TemplateStore"; |
|
67 |
|
|
68 |
private static String[] formatList = new String[]{"*"}; |
|
69 |
|
|
70 |
private Extent viewRequest = null; |
|
71 |
private TileServer tileServer = null; |
|
72 |
private boolean open = false; |
|
73 |
|
|
74 |
public static void register() { |
|
75 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
76 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
77 |
dataman.registerStoreProvider(NAME, |
|
78 |
NetCDFProvider.class, NetCDFDataParameters.class); |
|
79 |
} |
|
80 |
|
|
81 |
if(DALFileLocator.getFilesystemServerExplorerManager() != null) |
|
82 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
|
83 |
NAME, DESCRIPTION, |
|
84 |
NetCDFFilesystemServerExplorer.class); |
|
85 |
|
|
86 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Returns true if the extension is supported and false if doesn't |
|
91 |
* @param ext |
|
92 |
* @return |
|
93 |
*/ |
|
94 |
public static boolean isExtensionSupported(String ext) { |
|
95 |
for (int i = 0; i < formatList.length; i++) { |
|
96 |
if(formatList[i].compareTo(ext) == 0) |
|
97 |
return true; |
|
98 |
} |
|
99 |
return false; |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Constructor. Abre el dataset. |
|
104 |
* @param proj Proyecci?n |
|
105 |
* @param fName Nombre del fichero |
|
106 |
* @throws NotSupportedExtensionException |
|
107 |
*/ |
|
108 |
public NetCDFProvider(String params) throws NotSupportedExtensionException { |
|
109 |
super(params); |
|
110 |
if(params instanceof String) { |
|
111 |
NetCDFDataParameters p = new NetCDFDataParameters(); |
|
112 |
p.setURI((String)params); |
|
113 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
|
114 |
.createDynObject( |
|
115 |
MetadataLocator.getMetadataManager().getDefinition( |
|
116 |
DataStore.METADATA_DEFINITION_NAME))); |
|
117 |
init(p, null); |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
public NetCDFProvider (NetCDFDataParameters params, |
|
122 |
AbstractRasterDataStore storeServices) throws NotSupportedExtensionException { |
|
123 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
124 |
.createDynObject( |
|
125 |
MetadataLocator.getMetadataManager().getDefinition( |
|
126 |
DataStore.METADATA_DEFINITION_NAME))); |
|
127 |
init(params, storeServices); |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* Crea las referencias al fichero y carga |
|
132 |
* las estructuras con la informaci?n y los metadatos. |
|
133 |
* @param proj Proyecci?n |
|
134 |
* @param param Parametros de carga |
|
135 |
* @throws NotSupportedExtensionException |
|
136 |
*/ |
|
137 |
public void init (AbstractRasterDataParameters params, |
|
138 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
139 |
//TODO: |
|
140 |
|
|
141 |
if(((RasterFileStoreParameters)params).getFile().exists()) { |
|
142 |
setParam(params); |
|
143 |
colorTable = null; |
|
144 |
noData = 0; |
|
145 |
wktProjection = null; |
|
146 |
//CrsWkt crs = new CrsWkt(wktProjection); |
|
147 |
//IProjection proj = CRSFactory.getCRS("EPSG:23030"); |
|
148 |
noDataEnabled = true; |
|
149 |
ownTransformation = null; |
|
150 |
externalTransformation = (AffineTransform)ownTransformation.clone(); |
|
151 |
load(); |
|
152 |
} else |
|
153 |
setParam(params); |
|
154 |
bandCount = 0; |
|
155 |
setDataType(null); |
|
156 |
super.init(); |
|
157 |
|
|
158 |
try { |
|
159 |
loadFromRmf(getRmfBlocksManager()); |
|
160 |
} catch (ParsingException e) { |
|
161 |
//No lee desde rmf |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
/* |
|
166 |
* (non-Javadoc) |
|
167 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#load() |
|
168 |
*/ |
|
169 |
public RasterProvider load() { |
|
170 |
return this; |
|
171 |
} |
|
172 |
|
|
173 |
/* |
|
174 |
* (non-Javadoc) |
|
175 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isOpen() |
|
176 |
*/ |
|
177 |
public boolean isOpen() { |
|
178 |
return open; |
|
179 |
} |
|
180 |
|
|
181 |
/* |
|
182 |
* (non-Javadoc) |
|
183 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#close() |
|
184 |
*/ |
|
185 |
public void close() { |
|
186 |
//TODO: |
|
187 |
} |
|
188 |
|
|
189 |
/* |
|
190 |
* (non-Javadoc) |
|
191 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#translateFileName(java.lang.String) |
|
192 |
*/ |
|
193 |
public String translateFileName(String fileName) { |
|
194 |
return fileName; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Asigna el extent de la vista actual. existe un fichero .rmf debemos hacer una transformaci?n |
|
199 |
* de la vista asignada ya que la petici?n viene en coordenadas del fichero .rmf y la vista (v) |
|
200 |
* ha de estar en coordenadas del fichero. |
|
201 |
*/ |
|
202 |
public void setView(Extent e) { |
|
203 |
viewRequest = new ExtentImpl(e); |
|
204 |
} |
|
205 |
|
|
206 |
/* |
|
207 |
* (non-Javadoc) |
|
208 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getView() |
|
209 |
*/ |
|
210 |
public Extent getView() { |
|
211 |
return viewRequest; |
|
212 |
} |
|
213 |
|
|
214 |
/* |
|
215 |
* (non-Javadoc) |
|
216 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWidth() |
|
217 |
*/ |
|
218 |
public double getWidth() { |
|
219 |
//TODO: |
|
220 |
return 0; |
|
221 |
} |
|
222 |
|
|
223 |
/* |
|
224 |
* (non-Javadoc) |
|
225 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getHeight() |
|
226 |
*/ |
|
227 |
public double getHeight() { |
|
228 |
//TODO: |
|
229 |
return 0; |
|
230 |
} |
|
231 |
|
|
232 |
/** |
|
233 |
* Read a line from the file |
|
234 |
* @param line |
|
235 |
* @param band |
|
236 |
* @return |
|
237 |
* @throws InvalidSetViewException |
|
238 |
* @throws FileNotOpenException |
|
239 |
* @throws RasterDriverException |
|
240 |
* @Deprecated This operation is deprecated because is not useful and in the future |
|
241 |
* it will not be maintained. The abstract operation has dissapear |
|
242 |
*/ |
|
243 |
public Object readCompleteLine(int line, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
244 |
if(line > this.getHeight() || band > this.getBandCount()) |
|
245 |
throw new InvalidSetViewException("Request out of grid"); |
|
246 |
|
|
247 |
//TODO: |
|
248 |
return null; |
|
249 |
} |
|
250 |
|
|
251 |
/* |
|
252 |
* (non-Javadoc) |
|
253 |
* @see org.gvsig.raster.dataset.RasterDataset#readBlock(int, int) |
|
254 |
*/ |
|
255 |
public Object readBlock(int pos, int blockHeight) |
|
256 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
257 |
if(pos < 0) |
|
258 |
throw new InvalidSetViewException("Request out of grid"); |
|
259 |
|
|
260 |
if((pos + blockHeight) > getHeight()) |
|
261 |
blockHeight = Math.abs(((int)getHeight()) - pos); |
|
262 |
|
|
263 |
//TODO: |
|
264 |
return null; |
|
265 |
} |
|
266 |
|
|
267 |
/* |
|
268 |
* (non-Javadoc) |
|
269 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getData(int, int, int) |
|
270 |
*/ |
|
271 |
public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
272 |
if(x < 0 || y < 0 || x >= getWidth() || y >= getHeight()) |
|
273 |
throw new InvalidSetViewException("Request out of grid"); |
|
274 |
|
|
275 |
//TODO |
|
276 |
return null; |
|
277 |
} |
|
278 |
|
|
279 |
/* |
|
280 |
* (non-Javadoc) |
|
281 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(double, double, double, double, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.raster.cache.tile.provider.TileListener) |
|
282 |
*/ |
|
283 |
public void getWindow(Extent ex, int bufWidth, int bufHeight, |
|
284 |
BandList bandList, TileListener listener) throws ProcessInterruptedException, RasterDriverException { |
|
285 |
//TODO |
|
286 |
} |
|
287 |
|
|
288 |
/* |
|
289 |
* (non-Javadoc) |
|
290 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(org.gvsig.fmap.dal.coverage.datastruct.Extent, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer) |
|
291 |
*/ |
|
292 |
public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf) |
|
293 |
throws ProcessInterruptedException, RasterDriverException { |
|
294 |
//TODO |
|
295 |
|
|
296 |
return rasterBuf; |
|
297 |
} |
|
298 |
|
|
299 |
/* |
|
300 |
* (non-Javadoc) |
|
301 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(double, double, double, double, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer, boolean) |
|
302 |
*/ |
|
303 |
public Buffer getWindow(double ulx, double uly, double w, double h, |
|
304 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
305 |
//TODO |
|
306 |
|
|
307 |
return rasterBuf; |
|
308 |
} |
|
309 |
|
|
310 |
/* |
|
311 |
* (non-Javadoc) |
|
312 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(double, double, double, double, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer, boolean) |
|
313 |
*/ |
|
314 |
public Buffer getWindow(Extent extent, |
|
315 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
316 |
//TODO |
|
317 |
|
|
318 |
return rasterBuf; |
|
319 |
} |
|
320 |
|
|
321 |
/* |
|
322 |
* (non-Javadoc) |
|
323 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(int, int, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer) |
|
324 |
*/ |
|
325 |
public Buffer getWindow(int x, int y, int w, int h, |
|
326 |
BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
327 |
//TODO |
|
328 |
|
|
329 |
return rasterBuf; |
|
330 |
} |
|
331 |
|
|
332 |
/* |
|
333 |
* (non-Javadoc) |
|
334 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(int, int, int, int, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer) |
|
335 |
*/ |
|
336 |
public Buffer getWindow(int x, int y, int w, int h, |
|
337 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
338 |
//TODO |
|
339 |
|
|
340 |
return rasterBuf; |
|
341 |
} |
|
342 |
|
|
343 |
/* |
|
344 |
* (non-Javadoc) |
|
345 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getBlockSize() |
|
346 |
*/ |
|
347 |
public int getBlockSize(){ |
|
348 |
//TODO |
|
349 |
|
|
350 |
return 0; |
|
351 |
} |
|
352 |
|
|
353 |
/* |
|
354 |
* (non-Javadoc) |
|
355 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getMetadata() |
|
356 |
*/ |
|
357 |
public DataStoreMetadata getMetadata() { |
|
358 |
//TODO |
|
359 |
|
|
360 |
return null; |
|
361 |
} |
|
362 |
|
|
363 |
/* |
|
364 |
* (non-Javadoc) |
|
365 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getColorInterpretation() |
|
366 |
*/ |
|
367 |
public DataStoreColorInterpretation getColorInterpretation(){ |
|
368 |
//TODO |
|
369 |
|
|
370 |
return null; |
|
371 |
} |
|
372 |
|
|
373 |
/* |
|
374 |
* (non-Javadoc) |
|
375 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setColorInterpretation(org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation) |
|
376 |
*/ |
|
377 |
public void setColorInterpretation(DataStoreColorInterpretation colorInterpretation){ |
|
378 |
//TODO |
|
379 |
} |
|
380 |
|
|
381 |
/* |
|
382 |
* (non-Javadoc) |
|
383 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getTransparency() |
|
384 |
*/ |
|
385 |
public DataStoreTransparency getTransparency() { |
|
386 |
//TODO |
|
387 |
|
|
388 |
return null; |
|
389 |
} |
|
390 |
|
|
391 |
/* |
|
392 |
* (non-Javadoc) |
|
393 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isGeoreferenced() |
|
394 |
*/ |
|
395 |
public boolean isGeoreferenced() { |
|
396 |
//TODO |
|
397 |
|
|
398 |
return false; |
|
399 |
} |
|
400 |
|
|
401 |
/** |
|
402 |
* Informa de si el driver ha supersampleado en el ?ltimo dibujado. Es el driver el que colocar? |
|
403 |
* el valor de esta variable cada vez que dibuja. |
|
404 |
* @return true si se ha supersampleado y false si no se ha hecho. |
|
405 |
*/ |
|
406 |
public boolean isSupersampling() { |
|
407 |
//TODO |
|
408 |
|
|
409 |
return false; |
|
410 |
} |
|
411 |
|
|
412 |
/* |
|
413 |
* (non-Javadoc) |
|
414 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setAffineTransform(java.awt.geom.AffineTransform) |
|
415 |
*/ |
|
416 |
public void setAffineTransform(AffineTransform t){ |
|
417 |
super.setAffineTransform(t); |
|
418 |
} |
|
419 |
|
|
420 |
/* |
|
421 |
* (non-Javadoc) |
|
422 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getOverviewCount(int) |
|
423 |
*/ |
|
424 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
425 |
if(band >= getBandCount()) |
|
426 |
throw new BandAccessException("Wrong band"); |
|
427 |
//TODO |
|
428 |
|
|
429 |
return 0; |
|
430 |
} |
|
431 |
|
|
432 |
/* |
|
433 |
* (non-Javadoc) |
|
434 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewWidth(int, int) |
|
435 |
*/ |
|
436 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
437 |
if (band >= getBandCount()) |
|
438 |
throw new BandAccessException("Wrong band"); |
|
439 |
//TODO |
|
440 |
|
|
441 |
return 0; |
|
442 |
} |
|
443 |
|
|
444 |
/* |
|
445 |
* (non-Javadoc) |
|
446 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewHeight(int, int) |
|
447 |
*/ |
|
448 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
449 |
if (band >= getBandCount()) |
|
450 |
throw new BandAccessException("Wrong band"); |
|
451 |
//TODO |
|
452 |
|
|
453 |
return 0; |
|
454 |
} |
|
455 |
|
|
456 |
/* |
|
457 |
* (non-Javadoc) |
|
458 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#overviewsSupport() |
|
459 |
*/ |
|
460 |
public boolean overviewsSupport() { |
|
461 |
return true; |
|
462 |
} |
|
463 |
|
|
464 |
/* |
|
465 |
* (non-Javadoc) |
|
466 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isReproyectable() |
|
467 |
*/ |
|
468 |
public boolean isReproyectable() { |
|
469 |
return true; |
|
470 |
} |
|
471 |
|
|
472 |
/* |
|
473 |
* (non-Javadoc) |
|
474 |
* @see org.gvsig.fmap.dal.spi.DataStoreProvider#getName() |
|
475 |
*/ |
|
476 |
public String getName() { |
|
477 |
return NAME; |
|
478 |
} |
|
479 |
|
|
480 |
/* |
|
481 |
* (non-Javadoc) |
|
482 |
* @see org.gvsig.raster.impl.provider.RasterProvider#setStatus(org.gvsig.raster.impl.provider.RasterProvider) |
|
483 |
*/ |
|
484 |
public void setStatus(RasterProvider provider) { |
|
485 |
if(provider instanceof NetCDFProvider) { |
|
486 |
//Not implemented yet |
|
487 |
} |
|
488 |
} |
|
489 |
|
|
490 |
/* |
|
491 |
* (non-Javadoc) |
|
492 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getTileServer() |
|
493 |
*/ |
|
494 |
public TileServer getTileServer() { |
|
495 |
if(tileServer == null) |
|
496 |
tileServer = new FileTileServer(this); |
|
497 |
return tileServer; |
|
498 |
} |
|
499 |
} |
|
0 | 500 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.45/org.gvsig.raster.tilecache.io/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
|
0 | 9 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.45/org.gvsig.raster.tilecache.io/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.raster"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
|
0 | 38 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.45/org.gvsig.raster.tilecache.io/src/main/java/org/gvsig/raster/tilecache/io/DefaultCacheIOLibrary.java | ||
---|---|---|
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.raster.tilecache.io; |
|
23 |
|
|
24 |
import org.gvsig.raster.cache.tile.impl.TileCacheDefaultImplLibrary; |
|
25 |
import org.gvsig.tools.library.AbstractLibrary; |
|
26 |
import org.gvsig.tools.library.LibraryException; |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
31 |
*/ |
|
32 |
public class DefaultCacheIOLibrary extends AbstractLibrary { |
|
33 |
|
|
34 |
public DefaultCacheIOLibrary() { |
|
35 |
registerAsServiceOf(TileCacheDefaultImplLibrary.class); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
protected void doInitialize() throws LibraryException { |
|
40 |
//RasterLibrary.wakeUp(); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doPostInitialize() throws LibraryException { |
|
45 |
TileDataParametersImpl.registerDynClass(); |
|
46 |
TileProvider.register(); |
|
47 |
} |
|
48 |
} |
|
0 | 49 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.45/org.gvsig.raster.tilecache.io/src/main/java/org/gvsig/raster/tilecache/io/TileServerExplorer.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.raster.tilecache.io; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
import java.io.FileInputStream; |
|
32 |
import java.util.List; |
|
33 |
|
|
34 |
import org.apache.commons.io.FilenameUtils; |
|
35 |
|
|
36 |
import org.gvsig.fmap.dal.DALLocator; |
|
37 |
import org.gvsig.fmap.dal.DataManager; |
|
38 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
39 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
40 |
import org.gvsig.fmap.dal.DataStore; |
|
41 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
42 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
43 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
44 |
import org.gvsig.fmap.dal.exception.CreateException; |
|
45 |
import org.gvsig.fmap.dal.exception.DataException; |
|
46 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
47 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
48 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
49 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
50 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProvider; |
|
51 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
|
52 |
import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters; |
|
53 |
|
|
54 |
public class TileServerExplorer extends AbstractFilesystemServerExplorerProvider implements DataServerExplorerProvider { |
|
55 |
public static final String NAME = "TileServerExplorer"; |
|
56 |
|
|
57 |
public TileServerExplorer() { |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
public TileServerExplorer( |
|
62 |
TileServerExplorerParameters parameters, |
|
63 |
DataServerExplorerProviderServices services) |
|
64 |
throws InitializeException { |
|
65 |
} |
|
66 |
|
|
67 |
public boolean canCreate() { |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
71 |
public boolean canCreate(NewDataStoreParameters parameters) { |
|
72 |
return false; |
|
73 |
} |
|
74 |
|
|
75 |
public void create(NewDataStoreParameters parameters, boolean overwrite) |
|
76 |
throws CreateException { |
|
77 |
throw new UnsupportedOperationException(); |
|
78 |
} |
|
79 |
|
|
80 |
public NewDataStoreParameters getCreateParameters() throws DataException { |
|
81 |
return null; |
|
82 |
} |
|
83 |
|
|
84 |
public void initialize( |
|
85 |
FilesystemServerExplorerProviderServices serverExplorer) { |
|
86 |
} |
|
87 |
|
|
88 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
89 |
throw new UnsupportedOperationException(); |
|
90 |
} |
|
91 |
|
|
92 |
public String getDataStoreProviderName() { |
|
93 |
return TileProvider.NAME; |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* When the source is a file then this method will check if exists a |
|
98 |
* provider that can manage it |
|
99 |
*/ |
|
100 |
public boolean accept(File pathname) { |
|
101 |
if (pathname.getParentFile() != null && |
|
102 |
pathname.getParentFile().getName().equals("cellhd")) { |
|
103 |
if (pathname.getName().endsWith(".rmf") |
|
104 |
|| pathname.getName().endsWith(".rmf~")) { |
|
105 |
return false; |
|
106 |
} |
|
107 |
return true; |
|
108 |
} |
|
109 |
|
|
110 |
// Comprobamos que no sea un rmf propio, osea, que contenga xml |
|
111 |
if (pathname.getName().toLowerCase().endsWith(".rmf")) { |
|
112 |
FileInputStream reader = null; |
|
113 |
try { |
|
114 |
reader = new FileInputStream(pathname); |
|
115 |
String xml = ""; |
|
116 |
for (int i = 0; i < 6; i++) { |
|
117 |
xml += (char) reader.read(); |
|
118 |
} |
|
119 |
if (xml.equals("<?xml ")) { |
|
120 |
return false; |
|
121 |
} |
|
122 |
} catch (Exception e) { |
|
123 |
} finally { |
|
124 |
try { |
|
125 |
reader.close(); |
|
126 |
} catch (Exception e) { |
|
127 |
} |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
//The formats will be registered if it hasn't been done yet |
|
132 |
RasterLocator.getManager().getProviderServices().registerTileProviderFormats(TileProvider.class); |
|
133 |
|
|
134 |
return RasterLocator.getManager().getProviderServices().isExtensionSupported( |
|
135 |
pathname.getName(), |
|
136 |
TileProvider.class); |
|
137 |
} |
|
138 |
|
|
139 |
public String getDescription() { |
|
140 |
return TileProvider.DESCRIPTION; |
|
141 |
} |
|
142 |
|
|
143 |
public DataStoreParameters getParameters(File file) throws DataException { |
|
144 |
DataManager manager = DALLocator.getDataManager(); |
|
145 |
AbstractRasterFileDataParameters params = (AbstractRasterFileDataParameters) manager |
|
146 |
.createStoreParameters(this.getDataStoreProviderName()); |
|
147 |
params.setFile(file); |
|
148 |
return params; |
|
149 |
} |
|
150 |
|
|
151 |
public DataServerExplorerParameters getParameters() { |
|
152 |
return null; |
|
153 |
} |
|
154 |
|
|
155 |
public int getMode() { |
|
156 |
return DataServerExplorer.MODE_RASTER; |
|
157 |
} |
|
158 |
|
|
159 |
public DataServerExplorerProviderServices getServerExplorerProviderServices() { |
|
160 |
return null; |
|
161 |
} |
|
162 |
|
|
163 |
public boolean add(String provider, NewDataStoreParameters parameters, |
|
164 |
boolean overwrite) throws DataException { |
|
165 |
return false; |
|
166 |
} |
|
167 |
|
|
168 |
public boolean canAdd() { |
|
169 |
return false; |
|
170 |
} |
|
171 |
|
|
172 |
public boolean canAdd(String storeName) throws DataException { |
|
173 |
return false; |
|
174 |
} |
|
175 |
|
|
176 |
public NewDataStoreParameters getAddParameters(String storeName) |
|
177 |
throws DataException { |
|
178 |
return null; |
|
179 |
} |
|
180 |
|
|
181 |
@SuppressWarnings("unchecked") |
|
182 |
public List getDataStoreProviderNames() { |
|
183 |
return null; |
|
184 |
} |
|
185 |
|
|
186 |
public String getProviderName() { |
|
187 |
return null; |
|
188 |
} |
|
189 |
|
|
190 |
@SuppressWarnings("unchecked") |
|
191 |
public List list() throws DataException { |
|
192 |
return null; |
|
193 |
} |
|
194 |
|
|
195 |
@SuppressWarnings("unchecked") |
|
196 |
public List list(int mode) throws DataException { |
|
197 |
return null; |
|
198 |
} |
|
199 |
|
|
200 |
public void dispose() { |
|
201 |
|
|
202 |
} |
|
203 |
|
|
204 |
@Override |
|
205 |
public DataStoreParameters get(String name) throws DataException { |
|
206 |
File theFile = new File(name); |
|
207 |
DataStoreParameters dsp = this.getParameters(theFile); |
|
208 |
return dsp; |
|
209 |
|
|
210 |
} |
|
211 |
|
|
212 |
/* (non-Javadoc) |
|
213 |
* @see org.gvsig.fmap.dal.DataServerExplorer#getResourcePath(org.gvsig.fmap.dal.DataStore, java.lang.String) |
|
214 |
*/ |
|
215 |
@Override |
|
216 |
public File getResourcePath(DataStore dataStore, String resourceName) throws DataException { |
|
217 |
String rootPathName = getResourceRootPathName(dataStore); |
|
218 |
if (rootPathName == null) { |
|
219 |
return null; |
|
220 |
} |
|
221 |
File f = new File(FilenameUtils.getPathNoEndSeparator(rootPathName),resourceName); |
|
222 |
if( f.exists() ) { |
|
223 |
return f; |
|
224 |
} |
|
225 |
return new File(rootPathName + "." + resourceName); |
|
226 |
} |
|
227 |
|
|
228 |
} |
|
0 | 229 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.45/org.gvsig.raster.tilecache.io/src/main/java/org/gvsig/raster/tilecache/io/TileProvider.java | ||
---|---|---|
1 |
package org.gvsig.raster.tilecache.io; |
|
2 |
|
|
3 |
import java.awt.Image; |
|
4 |
import java.awt.geom.AffineTransform; |
|
5 |
import java.awt.geom.NoninvertibleTransformException; |
|
6 |
import java.awt.geom.Point2D; |
|
7 |
import java.io.File; |
|
8 |
import java.io.FileNotFoundException; |
|
9 |
import java.io.IOException; |
|
10 |
import java.lang.reflect.Constructor; |
|
11 |
import java.lang.reflect.InvocationTargetException; |
|
12 |
import java.net.URI; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.gvsig.compat.net.ICancellable; |
|
16 |
import org.gvsig.fmap.dal.DALLocator; |
|
17 |
import org.gvsig.fmap.dal.DataStore; |
|
18 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
19 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
|
20 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
21 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
22 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
23 |
import org.gvsig.fmap.dal.coverage.datastruct.DatasetBand; |
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
25 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
26 |
import org.gvsig.fmap.dal.coverage.exception.BandNotFoundInListException; |
|
27 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
28 |
import org.gvsig.fmap.dal.coverage.exception.FileNotSupportedException; |
|
29 |
import org.gvsig.fmap.dal.coverage.exception.InfoByPointException; |
|
30 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
31 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException; |
|
32 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
33 |
import org.gvsig.fmap.dal.coverage.exception.ParsingException; |
|
34 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
35 |
import org.gvsig.fmap.dal.coverage.exception.QueryException; |
|
36 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
37 |
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException; |
|
38 |
import org.gvsig.fmap.dal.coverage.store.RasterQuery; |
|
39 |
import org.gvsig.fmap.dal.coverage.store.parameter.MultiDimensionalStoreParameters; |
|
40 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
41 |
import org.gvsig.fmap.dal.coverage.store.parameter.RemoteStoreParameters; |
|
42 |
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
|
43 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
44 |
import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
|
45 |
import org.gvsig.fmap.dal.coverage.util.MathUtils; |
|
46 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
47 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
48 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
49 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
50 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
51 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
|
52 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
53 |
import org.gvsig.fmap.dal.spi.DataStoreProvider; |
|
54 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
55 |
import org.gvsig.metadata.MetadataLocator; |
|
56 |
import org.gvsig.raster.cache.tile.Tile; |
|
57 |
import org.gvsig.raster.cache.tile.TileCache; |
|
58 |
import org.gvsig.raster.cache.tile.TileCacheLibrary; |
|
59 |
import org.gvsig.raster.cache.tile.TileCacheLocator; |
|
60 |
import org.gvsig.raster.cache.tile.TileCacheManager; |
|
61 |
import org.gvsig.raster.cache.tile.exception.TileBuildException; |
|
62 |
import org.gvsig.raster.cache.tile.exception.TileGettingException; |
|
63 |
import org.gvsig.raster.cache.tile.layer.TiledLayer; |
|
64 |
import org.gvsig.raster.cache.tile.provider.CacheStruct; |
|
65 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
|
66 |
import org.gvsig.raster.impl.buffer.SpiRasterQuery; |
|
67 |
import org.gvsig.raster.impl.datastruct.BandListImpl; |
|
68 |
import org.gvsig.raster.impl.datastruct.DatasetBandImpl; |
|
69 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
|
70 |
import org.gvsig.raster.impl.provider.AbstractRasterProvider; |
|
71 |
import org.gvsig.raster.impl.provider.MemoryTileMatrixBuffer; |
|
72 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
73 |
import org.gvsig.raster.impl.provider.RemoteRasterProvider; |
|
74 |
import org.gvsig.raster.impl.provider.TiledRasterProvider; |
|
75 |
import org.gvsig.raster.impl.store.DefaultRasterStore; |
|
76 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
|
77 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
78 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
|
79 |
import org.gvsig.raster.impl.store.properties.RemoteDataStoreStatistics; |
|
80 |
import org.gvsig.tools.ToolsLocator; |
|
81 |
import org.gvsig.tools.locator.LocatorException; |
|
82 |
|
|
83 |
import org.slf4j.Logger; |
|
84 |
import org.slf4j.LoggerFactory; |
|
85 |
|
|
86 |
/** |
|
87 |
* Provider for WMTS service |
|
88 |
* |
|
89 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
90 |
*/ |
|
91 |
public class TileProvider extends AbstractRasterProvider implements TiledRasterProvider { |
|
92 |
public static String NAME = "Tile Store"; |
|
93 |
public static String DESCRIPTION = "Raster Tiled Source"; |
|
94 |
public static final String METADATA_DEFINITION_NAME = "TileStore"; |
|
95 |
private static final Logger logger = LoggerFactory.getLogger(TileProvider.class); |
|
96 |
private RasterProvider provider = null; |
|
97 |
private boolean open = false; |
|
98 |
private Extent viewRequest = null; |
|
99 |
private TiledLayer tiledLayer = null; |
|
100 |
private MathUtils math = RasterLocator.getManager().getMathUtils(); |
|
101 |
private TileServer secondLevelTileServer = null; |
|
102 |
|
|
103 |
/** |
|
104 |
* Register in data manager |
|
105 |
*/ |
|
106 |
public static void register() { |
|
107 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
108 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
109 |
dataman.registerStoreProvider(NAME, |
|
110 |
TileProvider.class, TileDataParametersImpl.class); |
|
111 |
} |
|
112 |
|
|
113 |
/*if(DALFileLocator.getFilesystemServerExplorerManager() != null) |
|
114 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
|
115 |
NAME, DESCRIPTION, |
|
116 |
TileServerExplorer.class);*/ |
|
117 |
|
|
118 |
if (!dataman.getExplorerProviders().contains(TileServerExplorer.NAME)) { |
|
119 |
dataman.registerExplorerProvider(TileServerExplorer.NAME, TileServerExplorer.class, TileServerExplorerParameters.class); |
|
120 |
} |
|
121 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* Loads the specific provider to download data |
|
126 |
* @param file |
|
127 |
* @return |
|
128 |
* @throws NotSupportedExtensionException |
|
129 |
* @throws FileNotSupportedException |
|
130 |
*/ |
|
131 |
@SuppressWarnings("unchecked") |
|
132 |
private RasterProvider loadProvider(TileDataParametersImpl params, DataStoreProviderServices storeServices) throws ProviderNotRegisteredException, InitializeException { |
|
133 |
Object obj = params.getDataParameters(); |
|
134 |
DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager(); |
|
135 |
DataStoreProvider prov = null; |
|
136 |
|
|
137 |
if(obj != null && obj instanceof DataStoreParameters) //Remote |
|
138 |
prov = dataManager.createProvider(storeServices, (DataStoreParameters)obj); |
|
139 |
else { //File |
|
140 |
if(params.getFile() != null) { |
|
141 |
//We have to locate a provider's name which manages the selected file |
|
142 |
//A FilesystemServerExplorer will give a getProviderNames service |
|
143 |
FilesystemServerExplorerParameters paramsExplorer = (FilesystemServerExplorerParameters)dataManager.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
|
144 |
FilesystemServerExplorer serverExplorer = null; |
|
145 |
try { |
|
146 |
paramsExplorer.setRoot(File.separator); |
|
147 |
serverExplorer = (FilesystemServerExplorer)dataManager.openServerExplorer(FilesystemServerExplorer.NAME, paramsExplorer); |
|
148 |
} catch (ValidateDataParametersException e) { |
|
149 |
throw new InitializeException(e); |
|
150 |
} |
|
151 |
|
|
152 |
//Gets the list of provider's name to manage the file |
|
153 |
List<String> provName = serverExplorer.getProviderNameList(params.getFile()); |
|
154 |
if(provName.size() > 0) { |
|
155 |
for (int i = 0; i < provName.size(); i++) { |
|
156 |
//Gets the first provider what is not a TileProvider |
|
157 |
if(provName.get(i).compareTo(NAME) != 0) { |
|
158 |
DataStoreParameters newparams = dataManager.createStoreParameters(provName.get(i)); |
|
159 |
((FilesystemStoreParameters)newparams).setFile(params.getFile()); |
|
160 |
prov = dataManager.createProvider(storeServices, newparams); |
|
161 |
} |
|
162 |
} |
|
163 |
} |
|
164 |
} |
|
165 |
} |
|
166 |
|
|
167 |
if(prov != null && prov instanceof RasterProvider) { |
|
168 |
if(((RasterProvider)prov).isRotated()) |
|
169 |
throw new InitializeException("Rotation not supported tiling files", new Throwable()); |
|
170 |
|
|
171 |
return (RasterProvider)prov; |
|
172 |
} |
|
173 |
|
|
174 |
return null; |
|
175 |
} |
|
176 |
|
|
177 |
/** |
|
178 |
* @return the internal provider used to feed the TileProvider |
|
179 |
*/ |
|
180 |
public RasterProvider getInternalProvider() { |
|
181 |
return provider; |
|
182 |
} |
|
183 |
|
|
184 |
public Image getImageLegend() { |
|
185 |
return provider.getImageLegend(); |
|
186 |
} |
|
187 |
|
|
188 |
public ColorInterpretation getColorInterpretation() { |
|
189 |
return provider.getColorInterpretation(); |
|
190 |
} |
|
191 |
|
|
192 |
public String getFileSuffix() { |
|
193 |
try { |
|
194 |
return provider.getFileSuffix(); |
|
195 |
} catch(Throwable e) { |
|
196 |
return "tif"; |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
public File getRMFFile() { |
|
201 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
202 |
TileCache tileCache = manager.getTileCache(RasterLibrary.pathTileCache); |
|
203 |
|
|
204 |
String metadataDir = tiledLayer.getBaseLayerDirectory().substring(0, tiledLayer.getBaseLayerDirectory().lastIndexOf(File.separator) + 1) + |
|
205 |
tileCache.getConfigurationDirectory(); |
|
206 |
|
|
207 |
File metadaDirFile = new File(metadataDir); |
|
208 |
if(!metadaDirFile.exists()) |
|
209 |
metadaDirFile.mkdir(); |
|
210 |
|
|
211 |
String path = metadataDir + File.separator + tiledLayer.getID() + ".rmf"; |
|
212 |
|
|
213 |
try { |
|
214 |
if (!new File(path).exists() && provider != null && provider.getRMFFile() != null |
|
215 |
&& provider.getRMFFile().exists()) { |
|
216 |
RasterLocator.getManager().getFileUtils().copyFile(provider.getRMFFile().getAbsolutePath(), path); |
|
217 |
} |
|
218 |
|
|
219 |
if(provider != null && provider.getColorTable() != null) { |
|
220 |
ColorTable colorTable = provider.getColorTable(); |
|
221 |
RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(path, ColorTable.class, colorTable); |
|
222 |
} |
|
223 |
} catch (LocatorException e) { |
|
224 |
logger.info("No se ha podido copiar el fichero RMF a la capa tileada", e); |
|
225 |
} catch (FileNotFoundException e) { |
|
226 |
logger.info("No se ha podido copiar el fichero RMF a la capa tileada", e); |
|
227 |
} catch (IOException e) { |
|
228 |
logger.info("No se ha podido copiar el fichero RMF a la capa tileada", e); |
|
229 |
} catch (RmfSerializerException e) { |
|
230 |
logger.info("No se ha podido copiar la tabla de color a la capa tileada", e); |
|
231 |
} |
|
232 |
return new File(path); |
|
233 |
} |
|
234 |
|
|
235 |
/** |
|
236 |
* @throws NotSupportedExtensionException |
|
237 |
*/ |
|
238 |
public TileProvider() throws NotSupportedExtensionException { |
|
239 |
super(); |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* @param c |
|
244 |
*/ |
|
245 |
public void registerTileProviderFormats(Class<RasterProvider> c) { |
|
246 |
|
|
247 |
} |
|
248 |
|
|
249 |
/** |
|
250 |
* Assigns the provider associated to this tile server |
|
251 |
* @param prov |
|
252 |
* @throws InitializeException |
|
253 |
* @throws NotSupportedExtensionException |
|
254 |
*/ |
|
255 |
public void setProvider(RasterProvider prov) throws InitializeException { |
|
256 |
this.provider = prov; |
|
257 |
init(getDataStoreParameters(), getStoreServices()); |
|
258 |
} |
|
259 |
|
|
260 |
/** |
|
261 |
* @param params |
|
262 |
* @param storeServices |
|
263 |
* @throws InitializeException |
|
264 |
*/ |
|
265 |
public TileProvider(TileDataParametersImpl params, |
|
266 |
DataStoreProviderServices storeServices) throws InitializeException { |
|
267 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
268 |
.createDynObject( |
|
269 |
MetadataLocator.getMetadataManager().getDefinition( |
|
270 |
DataStore.METADATA_DEFINITION_NAME))); |
|
271 |
if(!params.isSecondLevelCache()) { |
|
272 |
try { |
|
273 |
provider = loadProvider(params, storeServices); |
|
274 |
} catch (ProviderNotRegisteredException e) { |
|
275 |
throw new InitializeException("Provider not registered", e); |
|
276 |
} |
|
277 |
init(params, storeServices); |
|
278 |
if(provider.getFileSizeByProvider() != null && provider.getFileSizeByProvider().length > 0) |
|
279 |
fileSize = provider.getFileSizeByProvider()[0]; |
|
280 |
} |
|
281 |
} |
|
282 |
|
|
283 |
/** |
|
284 |
* Creates the second level cache if the client has set a <code>TileServer</code> and the |
|
285 |
* <code>CacheStruct</code> is different that the old one. |
|
286 |
* <UL> |
|
287 |
* <LI>First level cache without TileServer from the client: do nothing</LI> |
|
288 |
* <LI>First level cache with TileServer from the client and the structure is |
|
289 |
* different to the old one: Builds a second level TileProvider</LI> |
|
290 |
* <LI>First level cache with TileServer from the client and the structure is |
|
291 |
* equal to the old one: do nothing</LI> |
|
292 |
* <LI>Second level cache: sets the TileServer</LI> |
|
293 |
* </UL> |
|
294 |
* @param params |
|
295 |
* @param storeServices |
|
296 |
* @throws NotSupportedExtensionException |
|
297 |
*/ |
|
298 |
/*private void createsSecondLevelCache(TileDataParametersImpl params) throws NotSupportedExtensionException { |
|
299 |
//Se obtiene el TileServer que haya pasado el cliente en los par?metros si ha pasado alguno. |
|
300 |
TileServer tileServer = params.getTileServer(); |
|
301 |
//Se obtiene el CacheStruct y se compara con el del provider |
|
302 |
CacheStruct cacheStruct = null; |
|
303 |
if(tileServer != null) |
|
304 |
cacheStruct = tileServer.getStruct(); |
|
305 |
|
|
306 |
if(params.isSecondLevelCache()) { //Cache de segundo nivel |
|
307 |
this.secondLevelTileServer = tileServer; |
|
308 |
} else if(cacheStruct != null && !provider.getTileServer().getStruct().compare(cacheStruct)) { //Cache de primer nivel |
|
309 |
//Si son distintos habr? que crear una cach? de segundo nivel por lo que creamos un nuevo TileProvider |
|
310 |
//que tenga como par?metro el provider viejo |
|
311 |
TileDataParametersImpl par = new TileDataParametersImpl(); |
|
312 |
par.setDataParameters(provider.getDataParameters()); |
|
313 |
par.setTileServer(tileServer); |
|
314 |
par.setSecondLevelCache(true); |
|
315 |
TileProvider newProvider = new TileProvider(par, null); |
|
316 |
newProvider.setProvider(this.provider); |
|
317 |
//Al TileProvider actual se le asigna como provider el TileProvider creado |
|
318 |
this.provider = newProvider; |
|
319 |
} |
|
320 |
}*/ |
|
321 |
|
|
322 |
/** |
|
323 |
* Crea las referencias al fichero y carga |
|
324 |
* las estructuras con la informaci?n y los metadatos. |
|
325 |
* @param params |
|
326 |
* @param storeServices |
|
327 |
* @throws InitializeException |
|
328 |
* @throws NotSupportedExtensionException |
|
329 |
*/ |
|
330 |
public void init (DataStoreParameters params, |
|
331 |
DataStoreProviderServices storeServices) throws InitializeException { |
|
332 |
setParam(storeServices, params); |
|
333 |
open = true; |
|
334 |
calculateDataType(); |
|
335 |
calculateBandCount(); |
|
336 |
calculateColorInterpretation(); |
|
337 |
calculateTransparency(); |
|
338 |
setColorTable(provider.getColorTable()); |
|
339 |
noData = provider.getNoDataValue(); |
|
340 |
uri = provider.getURIOfFirstProvider(); |
|
341 |
proj = provider.getProjection(); |
|
342 |
ownTransformation = provider.getAffineTransform(); |
|
343 |
externalTransformation = (AffineTransform)ownTransformation.clone(); |
|
344 |
|
|
345 |
createTiledLayer(); |
|
346 |
|
|
347 |
//Force to deletes the layer if the flag is to true |
|
348 |
if(tiledLayer != null) { |
|
349 |
if(param instanceof TileDataParameters) { |
|
350 |
if(((TileDataParameters)param).isDeletingCache()) { |
|
351 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
352 |
TileCache tileCache = manager.getTileCache(RasterLibrary.pathTileCache); |
|
353 |
tileCache.removeLayer(tiledLayer); |
|
354 |
((TileDataParameters)param).deleteCache(false); |
|
355 |
} |
|
356 |
} |
|
357 |
} |
|
358 |
|
|
359 |
if(provider instanceof RemoteRasterProvider) |
|
360 |
stats = new RemoteDataStoreStatistics(provider); |
|
361 |
} |
|
362 |
|
|
363 |
/** |
|
364 |
* Calculates the data type of this provider |
|
365 |
*/ |
|
366 |
public void calculateDataType() { |
|
367 |
int[] datatype = null; |
|
368 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE && provider.getBandCount() == 3) |
|
369 |
datatype = new int[provider.getBandCount() + 1]; |
|
370 |
else |
|
371 |
datatype = new int[provider.getBandCount()]; |
|
372 |
for (int i = 0; i < provider.getDataType().length; i++) { |
|
373 |
datatype[i] = provider.getDataType()[i]; |
|
374 |
} |
|
375 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE && provider.getBandCount() == 3) |
|
376 |
datatype[datatype.length - 1] = Buffer.TYPE_BYTE; |
|
377 |
setDataType(datatype); |
|
378 |
} |
|
379 |
|
|
380 |
/** |
|
381 |
* Calculates the number of bands |
|
382 |
*/ |
|
383 |
public void calculateBandCount() { |
|
384 |
bandCount = provider.getBandCount(); |
|
385 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE && provider.getBandCount() == 3) |
|
386 |
bandCount ++; |
|
387 |
} |
|
388 |
|
|
389 |
/** |
|
390 |
* Calculates the color interpretation |
|
391 |
*/ |
|
392 |
public void calculateColorInterpretation() { |
|
393 |
ColorInterpretation ci = provider.getColorInterpretation(); |
|
394 |
if(ci != null) { |
|
395 |
if(ci.isRGB() || ci.isBGR()) { |
|
396 |
ci = DataStoreColorInterpretation.createRGBAInterpretation(); |
|
397 |
} else |
|
398 |
ci = ci.cloneColorInterpretation(); |
|
399 |
} else { |
|
400 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE) { |
|
401 |
if(provider.getBandCount() == 3) |
|
402 |
ci = DataStoreColorInterpretation.createRGBAInterpretation(); |
|
403 |
else |
|
404 |
ci = DataStoreColorInterpretation.createDefaultInterpretation(getBandCount()); |
|
405 |
} else { |
|
406 |
if(getBandCount() == 1) |
|
407 |
ci = DataStoreColorInterpretation.createGrayInterpretation(); |
|
408 |
else |
|
409 |
ci = DataStoreColorInterpretation.createDefaultInterpretation(getBandCount()); |
|
410 |
} |
|
411 |
} |
|
412 |
|
|
413 |
super.setColorInterpretation(ci); |
|
414 |
} |
|
415 |
|
|
416 |
|
|
417 |
/** |
|
418 |
* Calculates the transparency |
|
419 |
*/ |
|
420 |
public void calculateTransparency() { |
|
421 |
if(provider.getTransparency() != null) |
|
422 |
transparency = provider.getTransparency().cloneTransparency(); |
|
423 |
else |
|
424 |
transparency = new DataStoreTransparency(getColorInterpretation()); |
|
425 |
if(getColorInterpretation() != null) { |
|
426 |
transparency.setColorInterpretation(getColorInterpretation()); |
|
427 |
transparency.setTransparencyBand(getColorInterpretation().getAlphaBand()); |
|
428 |
transparency.activeTransparency(); |
|
429 |
} |
|
430 |
} |
|
431 |
|
|
432 |
/** |
|
433 |
* Creates a new tiled layer if this hasn't been created yet or the ID has changed. |
|
434 |
* An ID could changed because the file type has changed when the user uses WMTS properties. |
|
435 |
*/ |
|
436 |
private void createTiledLayer() { |
|
437 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
438 |
TileCache tileCache = manager.getTileCache(RasterLibrary.pathTileCache); |
|
439 |
TiledLayer newLayer = tileCache.createLayer(provider.getTileServer(), TileCacheLibrary.DEFAULT_STRUCTURE); |
|
440 |
if(tiledLayer == null || newLayer.getID().compareTo(tiledLayer.getID()) != 0) |
|
441 |
tiledLayer = newLayer; |
|
442 |
} |
|
443 |
|
|
444 |
public void reload() { |
|
445 |
try { |
|
446 |
loadFromRmf(getRmfBlocksManager()); |
|
447 |
calculateColorInterpretation(); |
|
448 |
calculateTransparency(); |
|
449 |
} catch (ParsingException e) { |
|
450 |
logger.debug("No se ha podido leer el RMF", e); |
|
451 |
} |
|
452 |
} |
|
453 |
|
|
454 |
public int getZoomLevels() { |
|
455 |
if(provider.getTileServer() != null) |
|
456 |
return provider.getTileServer().getStruct().getNumberOfLevels(); |
|
457 |
return 0; |
|
458 |
} |
|
459 |
|
|
460 |
public int getNearestLevel(double pixelSize) { |
|
461 |
double[] pixelSizes = getPixelSizeByLevel(); |
|
462 |
for (int i = 0; i < pixelSizes.length - 1; i++) { |
|
463 |
if(pixelSize <= pixelSizes[i] && pixelSize > pixelSizes[i + 1]) { |
|
464 |
return i; |
|
465 |
} |
|
466 |
} |
|
467 |
if(pixelSize < pixelSizes[getZoomLevels() - 1]) |
|
468 |
return getZoomLevels() - 1; |
|
469 |
return 0; |
|
470 |
} |
|
471 |
|
|
472 |
/** |
|
473 |
* @return a list of pixel sizes by level |
|
474 |
*/ |
|
475 |
public double[] getPixelSizeByLevel() { |
|
476 |
double[] list = new double[getZoomLevels()]; |
|
477 |
CacheStruct struct = provider.getTileServer().getStruct(); |
|
478 |
for (int i = 0; i < struct.getNumberOfLevels(); i++) { |
|
479 |
list[i] = math.adjustDouble(struct.getPixelSizeByLevel(i)); |
|
480 |
} |
|
481 |
return list; |
|
482 |
} |
|
483 |
|
|
484 |
public Extent getCoordsInTheNearestLevel(Extent extent, int w, int h) { |
|
485 |
double[] pixelSizes = getPixelSizeByLevel(); |
|
486 |
double currentPixelSize = extent.width() / (double)w; |
|
487 |
|
|
488 |
int level = 0; |
|
489 |
for (int i = 0; i < (pixelSizes.length - 1); i++) { |
|
490 |
if(currentPixelSize < pixelSizes[i] && currentPixelSize >= pixelSizes[i + 1]) { |
|
491 |
level = i + 1; |
|
492 |
break; |
|
493 |
} |
|
494 |
} |
|
495 |
|
|
496 |
return getZoomLevelCoordinates(level, extent, w, h); |
|
497 |
} |
|
498 |
|
|
499 |
public Extent getCoordsInLevel(Point2D viewCenter, int level, int w, int h) { |
|
500 |
level = adjustLevel(level); |
|
501 |
double pixelSize = provider.getTileServer().getStruct().getPixelSizeByLevel(level); |
|
502 |
|
|
503 |
/*Rectangle2D worldExtent = provider.getTileServer().getStruct().getWorldExtent(); |
|
504 |
int nTiles = provider.getTileServer().getStruct().getLayerWidthOfTileMatrixByLevel(level); |
|
505 |
int[] nPixelsByTile = provider.getTileServer().getStruct().getTileSizeByLevel(level); |
|
506 |
|
|
507 |
double sizeWCByTile = worldExtent.getWidth() / (double)nTiles; |
|
508 |
double pixelSize = sizeWCByTile / (double)nPixelsByTile[0];*/ |
|
509 |
|
|
510 |
double ulx = viewCenter.getX() - ((w / 2) * pixelSize); |
|
511 |
double uly = viewCenter.getY() - ((h / 2) * pixelSize); |
|
512 |
double lrx = ulx + (w * pixelSize); |
|
513 |
double lry = uly + (h * pixelSize); |
|
514 |
return new ExtentImpl(ulx, uly, lrx, lry); |
|
515 |
} |
|
516 |
|
|
517 |
/** |
|
518 |
* Adjust de level to the range |
|
519 |
* @param level |
|
520 |
* @return |
|
521 |
*/ |
|
522 |
private int adjustLevel(int level) { |
|
523 |
if(level < 0) |
|
524 |
level = 0; |
|
525 |
if(level > getZoomLevels()) |
|
526 |
level = getZoomLevels(); |
|
527 |
return level; |
|
528 |
} |
|
529 |
|
|
530 |
public AffineTransform getAffineTransform() { |
|
531 |
return provider.getAffineTransform(); |
|
532 |
} |
|
533 |
|
|
534 |
/** |
|
535 |
* Gets the bounding box in world coordinates. If the layer has grid subsets (TileMatrixLimits) then |
|
536 |
* this will have a only extent but if the layer doesn't have grid subsets then this will have a different |
|
537 |
* extent in each level resolution. In this case we need to know the extent for each level. |
|
538 |
* @return Extent |
|
539 |
*/ |
|
540 |
public Extent getExtent() { |
|
541 |
return provider.getExtent(); |
|
542 |
} |
|
543 |
|
|
544 |
public RasterProvider load() { |
|
545 |
return this; |
|
546 |
} |
|
547 |
|
|
548 |
public boolean isOpen() { |
|
549 |
return open; |
|
550 |
} |
|
551 |
|
|
552 |
public boolean isTiled() { |
|
553 |
return true; |
|
554 |
} |
|
555 |
|
|
556 |
public void close() { |
|
557 |
open = false; |
|
558 |
if(provider != null) |
|
559 |
provider.close(); |
|
560 |
} |
|
561 |
|
|
562 |
public URI translateURI(URI uri) { |
|
563 |
return uri; |
|
564 |
} |
|
565 |
|
|
566 |
public void setView(Extent e) { |
|
567 |
viewRequest = e; |
|
568 |
} |
|
569 |
|
|
570 |
public Extent getView() { |
|
571 |
return viewRequest; |
|
572 |
} |
|
573 |
|
|
574 |
public double getWidth() { |
|
575 |
return provider.getWidth(); |
|
576 |
} |
|
577 |
|
|
578 |
public double getHeight() { |
|
579 |
return provider.getHeight(); |
|
580 |
} |
|
581 |
|
|
582 |
/** |
|
583 |
* @param line |
|
584 |
* @param band |
|
585 |
* @return a complete line |
|
586 |
* @throws InvalidSetViewException |
|
587 |
* @throws FileNotOpenException |
|
588 |
* @throws RasterDriverException |
|
589 |
*/ |
|
590 |
public Object readCompleteLine(int line, int band) |
|
591 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
592 |
return null; |
|
593 |
} |
|
594 |
|
|
595 |
/** |
|
596 |
* @return the file |
|
597 |
* @throws RasterDriverException |
|
598 |
*/ |
|
599 |
public File getFileLayer() throws RasterDriverException { |
|
600 |
return null; |
|
601 |
} |
|
602 |
|
|
603 |
@SuppressWarnings("deprecation") |
|
604 |
public Object readBlock(int pos, int blockHeight, double scale) |
|
605 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
606 |
//TODO: temporal hasta que haya un generador de estad?sticas parciales para realce. |
|
607 |
//Pongo este m?todo deprecated porque el objetivo es eliminarlo de los proveedores. |
|
608 |
if(provider.getBandCount() < getBandCount()) { |
|
609 |
switch (getDataType()[0]) { |
|
610 |
case Buffer.TYPE_BYTE: |
|
611 |
byte[][][] buf1 = (byte[][][])provider.readBlock(pos, blockHeight, scale); |
|
612 |
byte[][][] b1 = new byte[buf1.length + 1][][]; |
|
613 |
for (int i = 0; i < buf1.length; i++) { |
|
614 |
b1[i] = buf1[i]; |
|
615 |
} |
|
616 |
b1[b1.length - 1] = new byte[buf1[0].length][buf1[0][0].length]; |
|
617 |
return b1; |
|
618 |
case Buffer.TYPE_SHORT: |
Also available in: Unified diff