Revision 5810
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.32/org.gvsig.raster.tilecache.io/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.tilecache.io</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<version>2.2.32</version> |
|
7 |
<name>org.gvsig.raster.tilecache.io</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.raster.tilecache</artifactId> |
|
11 |
<version>2.2.32</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.raster.cache.lib.api</artifactId> |
|
17 |
<scope>compile</scope> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.raster.cache.lib.impl</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
27 |
<scope>compile</scope> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
32 |
<scope>compile</scope> |
|
33 |
</dependency> |
|
34 |
<dependency> |
|
35 |
<groupId>org.gvsig</groupId> |
|
36 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
37 |
<scope>compile</scope> |
|
38 |
</dependency> |
|
39 |
<dependency> |
|
40 |
<groupId>org.gvsig</groupId> |
|
41 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
42 |
<scope>compile</scope> |
|
43 |
</dependency> |
|
44 |
|
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
53 |
<scope>runtime</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
<dependency> |
|
86 |
<groupId>org.gvsig</groupId> |
|
87 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
88 |
<scope>compile</scope> |
|
89 |
</dependency> |
|
90 |
<!-- |
|
91 |
<dependency> |
|
92 |
<groupId>org.gvsig</groupId> |
|
93 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
94 |
<scope>runtime</scope> |
|
95 |
</dependency> |
|
96 |
<dependency> |
|
97 |
<groupId>org.gvsig</groupId> |
|
98 |
<artifactId>org.gvsig.fmap.geometry.operation</artifactId> |
|
99 |
<scope>runtime</scope> |
|
100 |
</dependency> |
|
101 |
--> |
|
102 |
</dependencies> |
|
103 |
</project> |
|
0 | 104 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.32/org.gvsig.raster.tilecache.io/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 |
/** |
|
91 |
* Returns true if the extension is supported and false if doesn't |
|
92 |
* @param ext |
|
93 |
* @return |
|
94 |
*/ |
|
95 |
public static boolean isExtensionSupported(String ext) { |
|
96 |
for (int i = 0; i < formatList.length; i++) { |
|
97 |
if(formatList[i].compareTo(ext) == 0) |
|
98 |
return true; |
|
99 |
} |
|
100 |
return false; |
|
101 |
} |
|
102 |
|
|
103 |
/** |
|
104 |
* Constructor. Abre el dataset. |
|
105 |
* @param proj Proyecci?n |
|
106 |
* @param fName Nombre del fichero |
|
107 |
* @throws NotSupportedExtensionException |
|
108 |
*/ |
|
109 |
public NetCDFProvider(String params) throws NotSupportedExtensionException { |
|
110 |
super(params); |
|
111 |
if(params instanceof String) { |
|
112 |
NetCDFDataParameters p = new NetCDFDataParameters(); |
|
113 |
p.setURI((String)params); |
|
114 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
|
115 |
.createDynObject( |
|
116 |
MetadataLocator.getMetadataManager().getDefinition( |
|
117 |
DataStore.METADATA_DEFINITION_NAME))); |
|
118 |
init(p, null); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
public NetCDFProvider (NetCDFDataParameters params, |
|
123 |
AbstractRasterDataStore storeServices) throws NotSupportedExtensionException { |
|
124 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
125 |
.createDynObject( |
|
126 |
MetadataLocator.getMetadataManager().getDefinition( |
|
127 |
DataStore.METADATA_DEFINITION_NAME))); |
|
128 |
init(params, storeServices); |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* Crea las referencias al fichero y carga |
|
133 |
* las estructuras con la informaci?n y los metadatos. |
|
134 |
* @param proj Proyecci?n |
|
135 |
* @param param Parametros de carga |
|
136 |
* @throws NotSupportedExtensionException |
|
137 |
*/ |
|
138 |
public void init (AbstractRasterDataParameters params, |
|
139 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
140 |
//TODO: |
|
141 |
|
|
142 |
if(((RasterFileStoreParameters)params).getFile().exists()) { |
|
143 |
setParam(params); |
|
144 |
colorTable = null; |
|
145 |
noData = 0; |
|
146 |
wktProjection = null; |
|
147 |
//CrsWkt crs = new CrsWkt(wktProjection); |
|
148 |
//IProjection proj = CRSFactory.getCRS("EPSG:23030"); |
|
149 |
noDataEnabled = true; |
|
150 |
ownTransformation = null; |
|
151 |
externalTransformation = (AffineTransform)ownTransformation.clone(); |
|
152 |
load(); |
|
153 |
} else |
|
154 |
setParam(params); |
|
155 |
bandCount = 0; |
|
156 |
setDataType(null); |
|
157 |
super.init(); |
|
158 |
|
|
159 |
try { |
|
160 |
loadFromRmf(getRmfBlocksManager()); |
|
161 |
} catch (ParsingException e) { |
|
162 |
//No lee desde rmf |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
/* |
|
167 |
* (non-Javadoc) |
|
168 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#load() |
|
169 |
*/ |
|
170 |
public RasterProvider load() { |
|
171 |
return this; |
|
172 |
} |
|
173 |
|
|
174 |
/* |
|
175 |
* (non-Javadoc) |
|
176 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isOpen() |
|
177 |
*/ |
|
178 |
public boolean isOpen() { |
|
179 |
return open; |
|
180 |
} |
|
181 |
|
|
182 |
/* |
|
183 |
* (non-Javadoc) |
|
184 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#close() |
|
185 |
*/ |
|
186 |
public void close() { |
|
187 |
//TODO: |
|
188 |
} |
|
189 |
|
|
190 |
/* |
|
191 |
* (non-Javadoc) |
|
192 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#translateFileName(java.lang.String) |
|
193 |
*/ |
|
194 |
public String translateFileName(String fileName) { |
|
195 |
return fileName; |
|
196 |
} |
|
197 |
|
|
198 |
/** |
|
199 |
* Asigna el extent de la vista actual. existe un fichero .rmf debemos hacer una transformaci?n |
|
200 |
* de la vista asignada ya que la petici?n viene en coordenadas del fichero .rmf y la vista (v) |
|
201 |
* ha de estar en coordenadas del fichero. |
|
202 |
*/ |
|
203 |
public void setView(Extent e) { |
|
204 |
viewRequest = new ExtentImpl(e); |
|
205 |
} |
|
206 |
|
|
207 |
/* |
|
208 |
* (non-Javadoc) |
|
209 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getView() |
|
210 |
*/ |
|
211 |
public Extent getView() { |
|
212 |
return viewRequest; |
|
213 |
} |
|
214 |
|
|
215 |
/* |
|
216 |
* (non-Javadoc) |
|
217 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWidth() |
|
218 |
*/ |
|
219 |
public double getWidth() { |
|
220 |
//TODO: |
|
221 |
return 0; |
|
222 |
} |
|
223 |
|
|
224 |
/* |
|
225 |
* (non-Javadoc) |
|
226 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getHeight() |
|
227 |
*/ |
|
228 |
public double getHeight() { |
|
229 |
//TODO: |
|
230 |
return 0; |
|
231 |
} |
|
232 |
|
|
233 |
/** |
|
234 |
* Read a line from the file |
|
235 |
* @param line |
|
236 |
* @param band |
|
237 |
* @return |
|
238 |
* @throws InvalidSetViewException |
|
239 |
* @throws FileNotOpenException |
|
240 |
* @throws RasterDriverException |
|
241 |
* @Deprecated This operation is deprecated because is not useful and in the future |
|
242 |
* it will not be maintained. The abstract operation has dissapear |
|
243 |
*/ |
|
244 |
public Object readCompleteLine(int line, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
245 |
if(line > this.getHeight() || band > this.getBandCount()) |
|
246 |
throw new InvalidSetViewException("Request out of grid"); |
|
247 |
|
|
248 |
//TODO: |
|
249 |
return null; |
|
250 |
} |
|
251 |
|
|
252 |
/* |
|
253 |
* (non-Javadoc) |
|
254 |
* @see org.gvsig.raster.dataset.RasterDataset#readBlock(int, int) |
|
255 |
*/ |
|
256 |
public Object readBlock(int pos, int blockHeight) |
|
257 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
258 |
if(pos < 0) |
|
259 |
throw new InvalidSetViewException("Request out of grid"); |
|
260 |
|
|
261 |
if((pos + blockHeight) > getHeight()) |
|
262 |
blockHeight = Math.abs(((int)getHeight()) - pos); |
|
263 |
|
|
264 |
//TODO: |
|
265 |
return null; |
|
266 |
} |
|
267 |
|
|
268 |
/* |
|
269 |
* (non-Javadoc) |
|
270 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getData(int, int, int) |
|
271 |
*/ |
|
272 |
public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
273 |
if(x < 0 || y < 0 || x >= getWidth() || y >= getHeight()) |
|
274 |
throw new InvalidSetViewException("Request out of grid"); |
|
275 |
|
|
276 |
//TODO |
|
277 |
return null; |
|
278 |
} |
|
279 |
|
|
280 |
/* |
|
281 |
* (non-Javadoc) |
|
282 |
* @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) |
|
283 |
*/ |
|
284 |
public void getWindow(Extent ex, int bufWidth, int bufHeight, |
|
285 |
BandList bandList, TileListener listener) throws ProcessInterruptedException, RasterDriverException { |
|
286 |
//TODO |
|
287 |
} |
|
288 |
|
|
289 |
/* |
|
290 |
* (non-Javadoc) |
|
291 |
* @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) |
|
292 |
*/ |
|
293 |
public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf) |
|
294 |
throws ProcessInterruptedException, RasterDriverException { |
|
295 |
//TODO |
|
296 |
|
|
297 |
return rasterBuf; |
|
298 |
} |
|
299 |
|
|
300 |
/* |
|
301 |
* (non-Javadoc) |
|
302 |
* @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) |
|
303 |
*/ |
|
304 |
public Buffer getWindow(double ulx, double uly, double w, double h, |
|
305 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
306 |
//TODO |
|
307 |
|
|
308 |
return rasterBuf; |
|
309 |
} |
|
310 |
|
|
311 |
/* |
|
312 |
* (non-Javadoc) |
|
313 |
* @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) |
|
314 |
*/ |
|
315 |
public Buffer getWindow(Extent extent, |
|
316 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
317 |
//TODO |
|
318 |
|
|
319 |
return rasterBuf; |
|
320 |
} |
|
321 |
|
|
322 |
/* |
|
323 |
* (non-Javadoc) |
|
324 |
* @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) |
|
325 |
*/ |
|
326 |
public Buffer getWindow(int x, int y, int w, int h, |
|
327 |
BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
328 |
//TODO |
|
329 |
|
|
330 |
return rasterBuf; |
|
331 |
} |
|
332 |
|
|
333 |
/* |
|
334 |
* (non-Javadoc) |
|
335 |
* @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) |
|
336 |
*/ |
|
337 |
public Buffer getWindow(int x, int y, int w, int h, |
|
338 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
339 |
//TODO |
|
340 |
|
|
341 |
return rasterBuf; |
|
342 |
} |
|
343 |
|
|
344 |
/* |
|
345 |
* (non-Javadoc) |
|
346 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getBlockSize() |
|
347 |
*/ |
|
348 |
public int getBlockSize(){ |
|
349 |
//TODO |
|
350 |
|
|
351 |
return 0; |
|
352 |
} |
|
353 |
|
|
354 |
/* |
|
355 |
* (non-Javadoc) |
|
356 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getMetadata() |
|
357 |
*/ |
|
358 |
public DataStoreMetadata getMetadata() { |
|
359 |
//TODO |
|
360 |
|
|
361 |
return null; |
|
362 |
} |
|
363 |
|
|
364 |
/* |
|
365 |
* (non-Javadoc) |
|
366 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getColorInterpretation() |
|
367 |
*/ |
|
368 |
public DataStoreColorInterpretation getColorInterpretation(){ |
|
369 |
//TODO |
|
370 |
|
|
371 |
return null; |
|
372 |
} |
|
373 |
|
|
374 |
/* |
|
375 |
* (non-Javadoc) |
|
376 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setColorInterpretation(org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation) |
|
377 |
*/ |
|
378 |
public void setColorInterpretation(DataStoreColorInterpretation colorInterpretation){ |
|
379 |
//TODO |
|
380 |
} |
|
381 |
|
|
382 |
/* |
|
383 |
* (non-Javadoc) |
|
384 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getTransparency() |
|
385 |
*/ |
|
386 |
public DataStoreTransparency getTransparency() { |
|
387 |
//TODO |
|
388 |
|
|
389 |
return null; |
|
390 |
} |
|
391 |
|
|
392 |
/* |
|
393 |
* (non-Javadoc) |
|
394 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isGeoreferenced() |
|
395 |
*/ |
|
396 |
public boolean isGeoreferenced() { |
|
397 |
//TODO |
|
398 |
|
|
399 |
return false; |
|
400 |
} |
|
401 |
|
|
402 |
/** |
|
403 |
* Informa de si el driver ha supersampleado en el ?ltimo dibujado. Es el driver el que colocar? |
|
404 |
* el valor de esta variable cada vez que dibuja. |
|
405 |
* @return true si se ha supersampleado y false si no se ha hecho. |
|
406 |
*/ |
|
407 |
public boolean isSupersampling() { |
|
408 |
//TODO |
|
409 |
|
|
410 |
return false; |
|
411 |
} |
|
412 |
|
|
413 |
/* |
|
414 |
* (non-Javadoc) |
|
415 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setAffineTransform(java.awt.geom.AffineTransform) |
|
416 |
*/ |
|
417 |
public void setAffineTransform(AffineTransform t){ |
|
418 |
super.setAffineTransform(t); |
|
419 |
} |
|
420 |
|
|
421 |
/* |
|
422 |
* (non-Javadoc) |
|
423 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getOverviewCount(int) |
|
424 |
*/ |
|
425 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
426 |
if(band >= getBandCount()) |
|
427 |
throw new BandAccessException("Wrong band"); |
|
428 |
//TODO |
|
429 |
|
|
430 |
return 0; |
|
431 |
} |
|
432 |
|
|
433 |
/* |
|
434 |
* (non-Javadoc) |
|
435 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewWidth(int, int) |
|
436 |
*/ |
|
437 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
438 |
if (band >= getBandCount()) |
|
439 |
throw new BandAccessException("Wrong band"); |
|
440 |
//TODO |
|
441 |
|
|
442 |
return 0; |
|
443 |
} |
|
444 |
|
|
445 |
/* |
|
446 |
* (non-Javadoc) |
|
447 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewHeight(int, int) |
|
448 |
*/ |
|
449 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
450 |
if (band >= getBandCount()) |
|
451 |
throw new BandAccessException("Wrong band"); |
|
452 |
//TODO |
|
453 |
|
|
454 |
return 0; |
|
455 |
} |
|
456 |
|
|
457 |
/* |
|
458 |
* (non-Javadoc) |
|
459 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#overviewsSupport() |
|
460 |
*/ |
|
461 |
public boolean overviewsSupport() { |
|
462 |
return true; |
|
463 |
} |
|
464 |
|
|
465 |
/* |
|
466 |
* (non-Javadoc) |
|
467 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isReproyectable() |
|
468 |
*/ |
|
469 |
public boolean isReproyectable() { |
|
470 |
return true; |
|
471 |
} |
|
472 |
|
|
473 |
/* |
|
474 |
* (non-Javadoc) |
|
475 |
* @see org.gvsig.fmap.dal.spi.DataStoreProvider#getName() |
|
476 |
*/ |
|
477 |
public String getName() { |
|
478 |
return NAME; |
|
479 |
} |
|
480 |
|
|
481 |
/* |
|
482 |
* (non-Javadoc) |
|
483 |
* @see org.gvsig.raster.impl.provider.RasterProvider#setStatus(org.gvsig.raster.impl.provider.RasterProvider) |
|
484 |
*/ |
|
485 |
public void setStatus(RasterProvider provider) { |
|
486 |
if(provider instanceof NetCDFProvider) { |
|
487 |
//Not implemented yet |
|
488 |
} |
|
489 |
} |
|
490 |
|
|
491 |
/* |
|
492 |
* (non-Javadoc) |
|
493 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getTileServer() |
|
494 |
*/ |
|
495 |
public TileServer getTileServer() { |
|
496 |
if(tileServer == null) |
|
497 |
tileServer = new FileTileServer(this); |
|
498 |
return tileServer; |
|
499 |
} |
|
500 |
} |
|
0 | 501 |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.32/org.gvsig.raster.tilecache.io/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.32/org.gvsig.raster.tilecache.io/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.32/org.gvsig.raster.tilecache.io/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.cache.io.DefaultCacheIOLibrary |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.32/org.gvsig.raster.tilecache.io/package.info | ||
---|---|---|
1 |
# |
|
2 |
#Thu Mar 07 10:25:56 CET 2013 |
|
3 |
owner=gvSIG Association |
|
4 |
code=org.gvsig.raster.tilecache.io |
|
5 |
java-version=j1_5 |
|
6 |
official=true |
|
7 |
type=plugin |
|
8 |
version=2.0.0-0 |
|
9 |
state=devel |
|
10 |
operating-system=all |
|
11 |
dependencies= |
|
12 |
sources-url=https\://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.tilecache/tags/2.0.0/org.gvsig.raster.tilecache.io |
|
13 |
web-url=http\://www.gvsig.com |
|
14 |
architecture=all |
|
15 |
model-version=1.0.1 |
|
16 |
categories= |
|
17 |
description=cache service for gvSIG |
|
18 |
buildNumber=0 |
|
19 |
gvSIG-version=2.0.0 |
|
20 |
name=org.gvsig.raster.tilecache.io |
org.gvsig.raster.tilecache/tags/org.gvsig.raster.tilecache-2.2.32/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 |
public static void register() { |
|
104 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
105 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
106 |
dataman.registerStoreProvider(NAME, |
|
107 |
TileProvider.class, TileDataParametersImpl.class); |
|
108 |
} |
|
109 |
|
|
110 |
/*if(DALFileLocator.getFilesystemServerExplorerManager() != null) |
|
111 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
|
112 |
NAME, DESCRIPTION, |
|
113 |
TileServerExplorer.class);*/ |
|
114 |
|
|
115 |
if (!dataman.getExplorerProviders().contains(TileServerExplorer.NAME)) { |
|
116 |
dataman.registerExplorerProvider(TileServerExplorer.NAME, TileServerExplorer.class, TileServerExplorerParameters.class); |
|
117 |
} |
|
118 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* Loads the specific provider to download data |
|
123 |
* @param file |
|
124 |
* @return |
|
125 |
* @throws NotSupportedExtensionException |
|
126 |
* @throws FileNotSupportedException |
|
127 |
*/ |
|
128 |
@SuppressWarnings("unchecked") |
|
129 |
private RasterProvider loadProvider(TileDataParametersImpl params, DataStoreProviderServices storeServices) throws ProviderNotRegisteredException, InitializeException { |
|
130 |
Object obj = params.getDataParameters(); |
|
131 |
DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager(); |
|
132 |
DataStoreProvider prov = null; |
|
133 |
|
|
134 |
if(obj != null && obj instanceof DataStoreParameters) //Remote |
|
135 |
prov = dataManager.createProvider(storeServices, (DataStoreParameters)obj); |
|
136 |
else { //File |
|
137 |
if(params.getFile() != null) { |
|
138 |
//We have to locate a provider's name which manages the selected file |
|
139 |
//A FilesystemServerExplorer will give a getProviderNames service |
|
140 |
FilesystemServerExplorerParameters paramsExplorer = (FilesystemServerExplorerParameters)dataManager.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
|
141 |
FilesystemServerExplorer serverExplorer = null; |
|
142 |
try { |
|
143 |
paramsExplorer.setRoot(File.separator); |
|
144 |
serverExplorer = (FilesystemServerExplorer)dataManager.openServerExplorer(FilesystemServerExplorer.NAME, paramsExplorer); |
|
145 |
} catch (ValidateDataParametersException e) { |
|
146 |
throw new InitializeException(e); |
|
147 |
} |
|
148 |
|
|
149 |
//Gets the list of provider's name to manage the file |
|
150 |
List<String> provName = serverExplorer.getProviderNameList(params.getFile()); |
|
151 |
if(provName.size() > 0) { |
|
152 |
for (int i = 0; i < provName.size(); i++) { |
|
153 |
//Gets the first provider what is not a TileProvider |
|
154 |
if(provName.get(i).compareTo(NAME) != 0) { |
|
155 |
DataStoreParameters newparams = dataManager.createStoreParameters(provName.get(i)); |
|
156 |
((FilesystemStoreParameters)newparams).setFile(params.getFile()); |
|
157 |
prov = dataManager.createProvider(storeServices, newparams); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
if(prov != null && prov instanceof RasterProvider) { |
|
165 |
if(((RasterProvider)prov).isRotated()) |
|
166 |
throw new InitializeException("Rotation not supported tiling files", new Throwable()); |
|
167 |
|
|
168 |
return (RasterProvider)prov; |
|
169 |
} |
|
170 |
|
|
171 |
return null; |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* Gets the internal provider used to feed the TileProvider |
|
176 |
* @return |
|
177 |
*/ |
|
178 |
public RasterProvider getInternalProvider() { |
|
179 |
return provider; |
|
180 |
} |
|
181 |
|
|
182 |
public Image getImageLegend() { |
|
183 |
return provider.getImageLegend(); |
|
184 |
} |
|
185 |
|
|
186 |
public ColorInterpretation getColorInterpretation() { |
|
187 |
return provider.getColorInterpretation(); |
|
188 |
} |
|
189 |
|
|
190 |
public String getFileSuffix() { |
|
191 |
try { |
|
192 |
return provider.getFileSuffix(); |
|
193 |
} catch(Throwable e) { |
|
194 |
return "tif"; |
|
195 |
} |
|
196 |
} |
|
197 |
|
|
198 |
public File getRMFFile() { |
|
199 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
200 |
TileCache tileCache = manager.getTileCache(RasterLibrary.pathTileCache); |
|
201 |
|
|
202 |
String metadataDir = tiledLayer.getBaseLayerDirectory().substring(0, tiledLayer.getBaseLayerDirectory().lastIndexOf(File.separator) + 1) + |
|
203 |
tileCache.getConfigurationDirectory(); |
|
204 |
|
|
205 |
File metadaDirFile = new File(metadataDir); |
|
206 |
if(!metadaDirFile.exists()) |
|
207 |
metadaDirFile.mkdir(); |
|
208 |
|
|
209 |
String path = metadataDir + File.separator + tiledLayer.getID() + ".rmf"; |
|
210 |
|
|
211 |
try { |
|
212 |
if (!new File(path).exists() && provider != null && provider.getRMFFile() != null |
|
213 |
&& provider.getRMFFile().exists()) { |
|
214 |
RasterLocator.getManager().getFileUtils().copyFile(provider.getRMFFile().getAbsolutePath(), path); |
|
215 |
} |
|
216 |
|
|
217 |
if(provider != null && provider.getColorTable() != null) { |
|
218 |
ColorTable colorTable = provider.getColorTable(); |
|
219 |
RasterLocator.getManager().getProviderServices().saveObjectToRmfFile(path, ColorTable.class, colorTable); |
|
220 |
} |
|
221 |
} catch (LocatorException e) { |
|
222 |
logger.info("No se ha podido copiar el fichero RMF a la capa tileada", e); |
|
223 |
} catch (FileNotFoundException e) { |
|
224 |
logger.info("No se ha podido copiar el fichero RMF a la capa tileada", e); |
|
225 |
} catch (IOException e) { |
|
226 |
logger.info("No se ha podido copiar el fichero RMF a la capa tileada", e); |
|
227 |
} catch (RmfSerializerException e) { |
|
228 |
logger.info("No se ha podido copiar la tabla de color a la capa tileada", e); |
|
229 |
} |
|
230 |
return new File(path); |
|
231 |
} |
|
232 |
|
|
233 |
public TileProvider() throws NotSupportedExtensionException { |
|
234 |
super(); |
|
235 |
} |
|
236 |
|
|
237 |
public void registerTileProviderFormats(Class<RasterProvider> c) { |
|
238 |
|
|
239 |
} |
|
240 |
|
|
241 |
/** |
|
242 |
* Assigns the provider associated to this tile server |
|
243 |
* @param prov |
|
244 |
* @throws NotSupportedExtensionException |
|
245 |
*/ |
|
246 |
public void setProvider(RasterProvider prov) throws InitializeException { |
|
247 |
this.provider = prov; |
|
248 |
init(getDataStoreParameters(), getStoreServices()); |
|
249 |
} |
|
250 |
|
|
251 |
public TileProvider(TileDataParametersImpl params, |
|
252 |
DataStoreProviderServices storeServices) throws InitializeException { |
|
253 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
254 |
.createDynObject( |
|
255 |
MetadataLocator.getMetadataManager().getDefinition( |
|
256 |
DataStore.METADATA_DEFINITION_NAME))); |
|
257 |
if(!params.isSecondLevelCache()) { |
|
258 |
try { |
|
259 |
provider = loadProvider(params, storeServices); |
|
260 |
} catch (ProviderNotRegisteredException e) { |
|
261 |
throw new InitializeException("Provider not registered", e); |
|
262 |
} |
|
263 |
init(params, storeServices); |
|
264 |
if(provider.getFileSizeByProvider() != null && provider.getFileSizeByProvider().length > 0) |
|
265 |
fileSize = provider.getFileSizeByProvider()[0]; |
|
266 |
} |
|
267 |
} |
|
268 |
|
|
269 |
/** |
|
270 |
* Creates the second level cache if the client has set a <code>TileServer</code> and the |
|
271 |
* <code>CacheStruct</code> is different that the old one. |
|
272 |
* <UL> |
|
273 |
* <LI>First level cache without TileServer from the client: do nothing</LI> |
|
274 |
* <LI>First level cache with TileServer from the client and the structure is |
|
275 |
* different to the old one: Builds a second level TileProvider</LI> |
|
276 |
* <LI>First level cache with TileServer from the client and the structure is |
|
277 |
* equal to the old one: do nothing</LI> |
|
278 |
* <LI>Second level cache: sets the TileServer</LI> |
|
279 |
* </UL> |
|
280 |
* @param params |
|
281 |
* @param storeServices |
|
282 |
* @throws NotSupportedExtensionException |
|
283 |
*/ |
|
284 |
/*private void createsSecondLevelCache(TileDataParametersImpl params) throws NotSupportedExtensionException { |
|
285 |
//Se obtiene el TileServer que haya pasado el cliente en los par?metros si ha pasado alguno. |
|
286 |
TileServer tileServer = params.getTileServer(); |
|
287 |
//Se obtiene el CacheStruct y se compara con el del provider |
|
288 |
CacheStruct cacheStruct = null; |
|
289 |
if(tileServer != null) |
|
290 |
cacheStruct = tileServer.getStruct(); |
|
291 |
|
|
292 |
if(params.isSecondLevelCache()) { //Cache de segundo nivel |
|
293 |
this.secondLevelTileServer = tileServer; |
|
294 |
} else if(cacheStruct != null && !provider.getTileServer().getStruct().compare(cacheStruct)) { //Cache de primer nivel |
|
295 |
//Si son distintos habr? que crear una cach? de segundo nivel por lo que creamos un nuevo TileProvider |
|
296 |
//que tenga como par?metro el provider viejo |
|
297 |
TileDataParametersImpl par = new TileDataParametersImpl(); |
|
298 |
par.setDataParameters(provider.getDataParameters()); |
|
299 |
par.setTileServer(tileServer); |
|
300 |
par.setSecondLevelCache(true); |
|
301 |
TileProvider newProvider = new TileProvider(par, null); |
|
302 |
newProvider.setProvider(this.provider); |
|
303 |
//Al TileProvider actual se le asigna como provider el TileProvider creado |
|
304 |
this.provider = newProvider; |
|
305 |
} |
|
306 |
}*/ |
|
307 |
|
|
308 |
/** |
|
309 |
* Crea las referencias al fichero y carga |
|
310 |
* las estructuras con la informaci?n y los metadatos. |
|
311 |
* @param proj Proyecci?n |
|
312 |
* @param param Parametros de carga |
|
313 |
* @throws NotSupportedExtensionException |
|
314 |
*/ |
|
315 |
public void init (DataStoreParameters params, |
|
316 |
DataStoreProviderServices storeServices) throws InitializeException { |
|
317 |
setParam(storeServices, params); |
|
318 |
open = true; |
|
319 |
calculateDataType(); |
|
320 |
calculateBandCount(); |
|
321 |
calculateColorInterpretation(); |
|
322 |
calculateTransparency(); |
|
323 |
setColorTable(provider.getColorTable()); |
|
324 |
noData = provider.getNoDataValue(); |
|
325 |
uri = provider.getURIOfFirstProvider(); |
|
326 |
proj = provider.getProjection(); |
|
327 |
ownTransformation = provider.getAffineTransform(); |
|
328 |
externalTransformation = (AffineTransform)ownTransformation.clone(); |
|
329 |
|
|
330 |
createTiledLayer(); |
|
331 |
|
|
332 |
//Force to deletes the layer if the flag is to true |
|
333 |
if(tiledLayer != null) { |
|
334 |
if(param instanceof TileDataParameters) { |
|
335 |
if(((TileDataParameters)param).isDeletingCache()) { |
|
336 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
337 |
TileCache tileCache = manager.getTileCache(RasterLibrary.pathTileCache); |
|
338 |
tileCache.removeLayer(tiledLayer); |
|
339 |
((TileDataParameters)param).deleteCache(false); |
|
340 |
} |
|
341 |
} |
|
342 |
} |
|
343 |
|
|
344 |
if(provider instanceof RemoteRasterProvider) |
|
345 |
stats = new RemoteDataStoreStatistics(provider); |
|
346 |
} |
|
347 |
|
|
348 |
/** |
|
349 |
* Calculates the data type of this provider |
|
350 |
* @return |
|
351 |
*/ |
|
352 |
public void calculateDataType() { |
|
353 |
int[] datatype = null; |
|
354 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE && provider.getBandCount() == 3) |
|
355 |
datatype = new int[provider.getBandCount() + 1]; |
|
356 |
else |
|
357 |
datatype = new int[provider.getBandCount()]; |
|
358 |
for (int i = 0; i < provider.getDataType().length; i++) { |
|
359 |
datatype[i] = provider.getDataType()[i]; |
|
360 |
} |
|
361 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE && provider.getBandCount() == 3) |
|
362 |
datatype[datatype.length - 1] = Buffer.TYPE_BYTE; |
|
363 |
setDataType(datatype); |
|
364 |
} |
|
365 |
|
|
366 |
/** |
|
367 |
* Calculates the number of bands |
|
368 |
*/ |
|
369 |
public void calculateBandCount() { |
|
370 |
bandCount = provider.getBandCount(); |
|
371 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE && provider.getBandCount() == 3) |
|
372 |
bandCount ++; |
|
373 |
} |
|
374 |
|
|
375 |
/** |
|
376 |
* Calculates the color interpretation |
|
377 |
*/ |
|
378 |
public void calculateColorInterpretation() { |
|
379 |
ColorInterpretation ci = provider.getColorInterpretation(); |
|
380 |
if(ci != null) { |
|
381 |
if(ci.isRGB() || ci.isBGR()) { |
|
382 |
ci = DataStoreColorInterpretation.createRGBAInterpretation(); |
|
383 |
} else |
|
384 |
ci = ci.cloneColorInterpretation(); |
|
385 |
} else { |
|
386 |
if(provider.getDataType()[0] == Buffer.TYPE_BYTE) { |
|
387 |
if(provider.getBandCount() == 3) |
|
388 |
ci = DataStoreColorInterpretation.createRGBAInterpretation(); |
|
389 |
else |
|
390 |
ci = DataStoreColorInterpretation.createDefaultInterpretation(getBandCount()); |
|
391 |
} else { |
|
392 |
if(getBandCount() == 1) |
|
393 |
ci = DataStoreColorInterpretation.createGrayInterpretation(); |
|
394 |
else |
|
395 |
ci = DataStoreColorInterpretation.createDefaultInterpretation(getBandCount()); |
|
396 |
} |
|
397 |
} |
|
398 |
|
|
399 |
super.setColorInterpretation(ci); |
|
400 |
} |
|
401 |
|
|
402 |
|
|
403 |
public void calculateTransparency() { |
|
404 |
if(provider.getTransparency() != null) |
|
405 |
transparency = provider.getTransparency().cloneTransparency(); |
|
406 |
else |
|
407 |
transparency = new DataStoreTransparency(getColorInterpretation()); |
|
408 |
if(getColorInterpretation() != null) { |
|
409 |
transparency.setColorInterpretation(getColorInterpretation()); |
|
410 |
transparency.setTransparencyBand(getColorInterpretation().getAlphaBand()); |
|
411 |
transparency.activeTransparency(); |
|
412 |
} |
|
413 |
} |
|
414 |
|
|
415 |
/** |
|
416 |
* Creates a new tiled layer if this hasn't been created yet or the ID has changed. |
|
417 |
* An ID could changed because the file type has changed when the user uses WMTS properties. |
|
418 |
*/ |
|
419 |
private void createTiledLayer() { |
|
420 |
TileCacheManager manager = TileCacheLocator.getManager(); |
|
421 |
TileCache tileCache = manager.getTileCache(RasterLibrary.pathTileCache); |
|
422 |
TiledLayer newLayer = tileCache.createLayer(provider.getTileServer(), TileCacheLibrary.DEFAULT_STRUCTURE); |
|
423 |
if(tiledLayer == null || newLayer.getID().compareTo(tiledLayer.getID()) != 0) |
|
424 |
tiledLayer = newLayer; |
|
425 |
} |
|
426 |
|
|
427 |
public void reload() { |
|
428 |
try { |
|
429 |
loadFromRmf(getRmfBlocksManager()); |
|
430 |
calculateColorInterpretation(); |
|
431 |
calculateTransparency(); |
|
432 |
} catch (ParsingException e) { |
|
433 |
logger.debug("No se ha podido leer el RMF", e); |
|
434 |
} |
|
435 |
} |
|
436 |
|
|
437 |
public int getZoomLevels() { |
|
438 |
if(provider.getTileServer() != null) |
|
439 |
return provider.getTileServer().getStruct().getNumberOfLevels(); |
|
440 |
return 0; |
|
441 |
} |
|
442 |
|
|
443 |
public int getNearestLevel(double pixelSize) { |
|
444 |
double[] pixelSizes = getPixelSizeByLevel(); |
|
445 |
for (int i = 0; i < pixelSizes.length - 1; i++) { |
|
446 |
if(pixelSize <= pixelSizes[i] && pixelSize > pixelSizes[i + 1]) { |
|
447 |
return i; |
|
448 |
} |
|
449 |
} |
|
450 |
if(pixelSize < pixelSizes[getZoomLevels() - 1]) |
|
451 |
return getZoomLevels() - 1; |
|
452 |
return 0; |
|
453 |
} |
|
454 |
|
|
455 |
/** |
|
456 |
* Returns a list of pixel sizes by level |
|
457 |
* @return |
|
458 |
*/ |
|
459 |
public double[] getPixelSizeByLevel() { |
|
460 |
double[] list = new double[getZoomLevels()]; |
|
461 |
CacheStruct struct = provider.getTileServer().getStruct(); |
|
462 |
for (int i = 0; i < struct.getNumberOfLevels(); i++) { |
|
463 |
list[i] = math.adjustDouble(struct.getPixelSizeByLevel(i)); |
|
464 |
} |
|
465 |
return list; |
|
466 |
} |
|
467 |
|
|
468 |
public Extent getCoordsInTheNearestLevel(Extent extent, int w, int h) { |
|
469 |
double[] pixelSizes = getPixelSizeByLevel(); |
|
470 |
double currentPixelSize = extent.width() / (double)w; |
|
471 |
|
|
472 |
int level = 0; |
|
473 |
for (int i = 0; i < (pixelSizes.length - 1); i++) { |
|
474 |
if(currentPixelSize < pixelSizes[i] && currentPixelSize >= pixelSizes[i + 1]) { |
|
475 |
level = i + 1; |
|
476 |
break; |
|
477 |
} |
|
478 |
} |
|
479 |
|
|
480 |
return getZoomLevelCoordinates(level, extent, w, h); |
|
481 |
} |
|
482 |
|
|
483 |
public Extent getCoordsInLevel(Point2D viewCenter, int level, int w, int h) { |
|
484 |
level = adjustLevel(level); |
|
485 |
double pixelSize = provider.getTileServer().getStruct().getPixelSizeByLevel(level); |
|
486 |
|
|
487 |
/*Rectangle2D worldExtent = provider.getTileServer().getStruct().getWorldExtent(); |
|
488 |
int nTiles = provider.getTileServer().getStruct().getLayerWidthOfTileMatrixByLevel(level); |
|
489 |
int[] nPixelsByTile = provider.getTileServer().getStruct().getTileSizeByLevel(level); |
|
490 |
|
|
491 |
double sizeWCByTile = worldExtent.getWidth() / (double)nTiles; |
|
492 |
double pixelSize = sizeWCByTile / (double)nPixelsByTile[0];*/ |
|
493 |
|
|
494 |
double ulx = viewCenter.getX() - ((w / 2) * pixelSize); |
|
495 |
double uly = viewCenter.getY() - ((h / 2) * pixelSize); |
|
496 |
double lrx = ulx + (w * pixelSize); |
|
497 |
double lry = uly + (h * pixelSize); |
|
498 |
return new ExtentImpl(ulx, uly, lrx, lry); |
|
499 |
} |
|
500 |
|
|
501 |
/** |
|
502 |
* Adjust de level to the range |
|
503 |
* @param level |
|
504 |
* @return |
|
505 |
*/ |
|
506 |
private int adjustLevel(int level) { |
|
507 |
if(level < 0) |
|
508 |
level = 0; |
|
509 |
if(level > getZoomLevels()) |
|
510 |
level = getZoomLevels(); |
|
511 |
return level; |
|
512 |
} |
|
513 |
|
|
514 |
public AffineTransform getAffineTransform() { |
|
515 |
return provider.getAffineTransform(); |
|
516 |
} |
|
517 |
|
|
518 |
/** |
|
519 |
* Gets the bounding box in world coordinates. If the layer has grid subsets (TileMatrixLimits) then |
|
520 |
* this will have a only extent but if the layer doesn't have grid subsets then this will have a different |
|
521 |
* extent in each level resolution. In this case we need to know the extent for each level. |
|
522 |
* @return Extent |
|
523 |
*/ |
|
524 |
public Extent getExtent() { |
|
525 |
return provider.getExtent(); |
|
526 |
} |
|
527 |
|
|
528 |
public RasterProvider load() { |
|
529 |
return this; |
|
530 |
} |
|
531 |
|
|
532 |
public boolean isOpen() { |
|
533 |
return open; |
|
534 |
} |
|
535 |
|
|
536 |
public boolean isTiled() { |
|
537 |
return true; |
|
538 |
} |
|
539 |
|
|
540 |
public void close() { |
|
541 |
open = false; |
|
542 |
if(provider != null) |
|
543 |
provider.close(); |
|
544 |
} |
|
545 |
|
|
546 |
public URI translateURI(URI uri) { |
|
547 |
return uri; |
|
548 |
} |
|
549 |
|
|
550 |
public void setView(Extent e) { |
|
551 |
viewRequest = e; |
|
552 |
} |
|
553 |
|
|
554 |
public Extent getView() { |
|
555 |
return viewRequest; |
|
556 |
} |
|
557 |
|
|
558 |
public double getWidth() { |
|
559 |
return provider.getWidth(); |
|
560 |
} |
|
561 |
|
|
562 |
public double getHeight() { |
|
563 |
return provider.getHeight(); |
|
564 |
} |
|
565 |
|
|
566 |
public Object readCompleteLine(int line, int band) |
|
567 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
568 |
return null; |
|
569 |
} |
|
570 |
|
|
571 |
public File getFileLayer() throws RasterDriverException { |
|
572 |
return null; |
|
573 |
} |
|
574 |
|
|
575 |
@SuppressWarnings("deprecation") |
|
576 |
public Object readBlock(int pos, int blockHeight, double scale) |
|
577 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
578 |
//TODO: temporal hasta que haya un generador de estad?sticas parciales para realce. |
|
579 |
//Pongo este m?todo deprecated porque el objetivo es eliminarlo de los proveedores. |
|
580 |
if(provider.getBandCount() < getBandCount()) { |
|
581 |
switch (getDataType()[0]) { |
|
582 |
case Buffer.TYPE_BYTE: |
|
583 |
byte[][][] buf1 = (byte[][][])provider.readBlock(pos, blockHeight, scale); |
|
584 |
byte[][][] b1 = new byte[buf1.length + 1][][]; |
|
585 |
for (int i = 0; i < buf1.length; i++) { |
|
586 |
b1[i] = buf1[i]; |
|
587 |
} |
|
588 |
b1[b1.length - 1] = new byte[buf1[0].length][buf1[0][0].length]; |
|
589 |
return b1; |
|
590 |
case Buffer.TYPE_SHORT: |
|
591 |
short[][][] buf2 = (short[][][])provider.readBlock(pos, blockHeight, scale); |
|
592 |
short[][][] b2 = new short[buf2.length + 1][][]; |
|
593 |
for (int i = 0; i < buf2.length; i++) { |
|
594 |
b2[i] = buf2[i]; |
|
595 |
} |
|
596 |
b2[b2.length - 1] = new short[buf2[0].length][buf2[0][0].length]; |
|
597 |
return b2; |
|
598 |
case Buffer.TYPE_FLOAT: |
|
599 |
float[][][] buf3 = (float[][][])provider.readBlock(pos, blockHeight, scale); |
|
600 |
float[][][] b3 = new float[buf3.length + 1][][]; |
|
601 |
for (int i = 0; i < buf3.length; i++) { |
|
602 |
b3[i] = buf3[i]; |
|
603 |
} |
|
604 |
b3[b3.length - 1] = new float[buf3[0].length][buf3[0][0].length]; |
|
605 |
return b3; |
|
606 |
case Buffer.TYPE_DOUBLE: |
|
607 |
double[][][] buf4 = (double[][][])provider.readBlock(pos, blockHeight, scale); |
|
608 |
double[][][] b4 = new double[buf4.length + 1][][]; |
|
609 |
for (int i = 0; i < buf4.length; i++) { |
|
610 |
b4[i] = buf4[i]; |
|
611 |
} |
|
612 |
b4[b4.length - 1] = new double[buf4[0].length][buf4[0][0].length]; |
|
613 |
return b4; |
|
614 |
case Buffer.TYPE_INT: |
|
615 |
int[][][] buf5 = (int[][][])provider.readBlock(pos, blockHeight, scale); |
|
616 |
int[][][] b5 = new int[buf5.length + 1][][]; |
|
617 |
for (int i = 0; i < buf5.length; i++) { |
|
618 |
b5[i] = buf5[i]; |
|
619 |
} |
|
620 |
b5[b5.length - 1] = new int[buf5[0].length][buf5[0][0].length]; |
|
621 |
return b5; |
|
622 |
} |
|
623 |
|
|
624 |
} |
|
625 |
return provider.readBlock(pos, blockHeight, scale); |
|
626 |
} |
|
627 |
|
|
628 |
public Object getData(int x, int y, int band) |
|
629 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
630 |
return provider.getData(x, y, band); |
|
631 |
} |
|
632 |
|
|
633 |
/** |
|
634 |
* Assigns the list of bands RGB and read a window of data |
|
635 |
* @param rasterBuf |
|
636 |
* @param bandList |
|
637 |
* @param lastFile |
|
638 |
* @param ulx |
|
639 |
* @param uly |
|
640 |
* @param lrx |
|
641 |
* @param lry |
|
642 |
* @return |
|
643 |
* @throws RasterDriverException |
|
644 |
* @throws ProcessInterruptedException |
|
645 |
*/ |
|
646 |
public Buffer getBuffer(Buffer rasterBuf, BandList bandList, File lastFile, |
|
647 |
double ulx, double uly, double lrx, double lry) throws RasterDriverException, ProcessInterruptedException { |
|
648 |
return null; |
|
649 |
} |
|
650 |
|
|
651 |
/** |
|
652 |
* Calculates the extent of a zoom level using other extent as a reference. The new extent is |
|
653 |
* calculated with the same coordinate at the center. |
|
654 |
* @param level |
|
655 |
* @param extent |
|
656 |
* @param w |
|
657 |
* @param h |
|
658 |
* @return |
|
659 |
*/ |
|
660 |
public Extent getZoomLevelCoordinates(int level, Extent extent, int w, int h) { |
|
661 |
double centerX = extent.getCenterX(); |
|
662 |
double centerY = extent.getCenterY(); |
|
663 |
return getCoordsInLevel(new Point2D.Double(centerX, centerY), level, w, h); |
|
664 |
} |
|
665 |
|
|
666 |
public boolean isRasterEnclosed() { |
|
667 |
if(provider != null) |
|
668 |
return provider.isRasterEnclosed(); |
|
669 |
return super.isRasterEnclosed(); |
|
670 |
} |
|
671 |
|
|
672 |
/** |
|
673 |
* Gets the tile list in a selected extent |
|
674 |
* @param ex |
|
675 |
* @param bandList |
|
676 |
* @param bufWidth |
|
677 |
* @param bufHeight |
|
678 |
* @return |
|
679 |
* @throws TileBuildException |
|
680 |
*/ |
|
681 |
private List<Tile> getTileList(SpiRasterQuery q) throws TileBuildException { |
|
682 |
TileServer tileServer = provider.getTileServer(); |
|
683 |
CacheStruct struct = tileServer.getStruct(); |
|
684 |
|
|
685 |
createTiledLayer(); //Creates a new layer when the file type changes |
|
686 |
|
|
687 |
double pixelSizeRequest = q.getRequestBoundingBox().width() / q.getBufWidth(); |
|
688 |
|
|
689 |
List<Tile> tileList = struct.getTileList( |
|
690 |
q.getAdjustedRequestBoundingBox().getUL(), |
|
691 |
q.getAdjustedRequestBoundingBox().getLR(), |
|
692 |
pixelSizeRequest); |
|
693 |
|
|
694 |
for (int i = 0; i < tileList.size(); i++) { |
|
695 |
loadTileTimeParameters(tileList.get(i)); |
|
696 |
} |
|
697 |
|
|
698 |
for (int i = 0; i < tileList.size(); i++) { |
|
699 |
tileList.get(i).setDownloaderParams("BandList", q.getBandList().clone()); |
|
700 |
} |
|
701 |
return tileList; |
|
702 |
} |
|
703 |
|
|
704 |
/** |
|
705 |
* Loads the multidimensional parameters in a tile |
|
706 |
* @param tile |
|
707 |
*/ |
|
708 |
private void loadTileTimeParameters(Tile tile) { |
|
709 |
if(provider.getDataParameters() instanceof MultiDimensionalStoreParameters) { |
|
710 |
MultiDimensionalStoreParameters par = (MultiDimensionalStoreParameters)provider.getDataParameters(); |
|
711 |
tile.setVariable(par.getStringVariable()); |
|
712 |
tile.setZ(par.getStringLevel()); |
|
713 |
tile.setTimeInstant(par.getStringTime()); |
|
714 |
} |
|
715 |
} |
|
716 |
|
|
717 |
public boolean needEnhanced() { |
|
718 |
return provider.needEnhanced(); |
|
719 |
} |
|
720 |
|
|
721 |
public Tile getTile(SpiRasterQuery q) throws TileGettingException { |
|
722 |
if(q.getCacheStruct() == null) |
|
723 |
q.setCacheStruct(provider.getTileServer().getStruct()); |
|
724 |
else |
|
725 |
provider.getTileServer().setStruct(q.getCacheStruct()); |
|
726 |
|
|
727 |
Tile tile = null; |
|
728 |
try { |
|
729 |
tile = q.getCacheStruct().getTileStructure( |
|
730 |
q.getResolutionLevel(), q.getTileCol(), q.getTileRow(), |
|
731 |
q.getAdjustedRequestBoundingBox().getUL(), |
|
732 |
q.getAdjustedRequestBoundingBox().getLR()); |
|
733 |
} catch (TileBuildException e1) { |
|
734 |
throw new TileGettingException(e1); |
|
735 |
} |
|
736 |
|
|
737 |
loadTileTimeParameters(tile); |
|
738 |
|
|
739 |
//Creamos un BandList con todas las bandas del fichero |
|
740 |
BandList bandList = new BandListImpl(); |
|
741 |
for(int i = 0; i < provider.getBandCount(); i++) { |
|
742 |
try { |
|
743 |
DatasetBand band = new DatasetBandImpl( |
|
744 |
provider.getURIOfFirstProvider(), |
|
745 |
i, |
|
746 |
provider.getDataType()[i], |
|
747 |
provider.getBandCount()); |
|
748 |
|
|
749 |
bandList.addBand(band); |
|
750 |
} catch(BandNotFoundInListException e) { |
|
751 |
//No a?adimos la banda |
|
752 |
} |
|
753 |
} |
|
754 |
bandList.setDrawableBands(new int[]{0, 1, 2}); |
|
755 |
|
|
756 |
tile.setDownloaderParams("BandList", bandList); |
|
757 |
createTiledLayer(); |
|
758 |
return tiledLayer.getTile(tile); |
|
759 |
} |
|
760 |
|
|
761 |
@Override |
|
762 |
public void loadBuffer(SpiRasterQuery q) |
|
763 |
throws ProcessInterruptedException, RasterDriverException { |
|
764 |
try { |
|
765 |
|
|
766 |
if(q.requestIsTiled()) { |
|
767 |
List<Tile> tileList = getTileList(q); |
|
768 |
tiledLayer.getTiles(tileList, q.getTileListener(), q.getTaskStatus()); |
|
769 |
} else { |
|
770 |
if(provider.isTiled()) { |
Also available in: Unified diff