Revision 15773
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.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.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.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.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.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.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSServerExplorerParameters.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.wmts.io; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
31 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
|
32 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
35 |
import org.gvsig.tools.dynobject.DynClass; |
|
36 |
import org.gvsig.tools.dynobject.DynStruct; |
|
37 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
38 |
|
|
39 |
/** |
|
40 |
* Parameters for the WMTS provider |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
42 |
*/ |
|
43 |
public class WMTSServerExplorerParameters extends AbstractDataParameters implements DataServerExplorerParameters { |
|
44 |
protected static final String FIELD_HOST = "host"; |
|
45 |
protected static DynClass DYNCLASS = null; |
|
46 |
private DelegatedDynObject delegatedDynObject = null; |
|
47 |
private static final String AXIS_ORDER = "axisorder"; |
|
48 |
|
|
49 |
public WMTSServerExplorerParameters() { |
|
50 |
super(); |
|
51 |
initialize(); |
|
52 |
} |
|
53 |
|
|
54 |
protected void initialize() { |
|
55 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
56 |
.getDynObjectManager().createDynObject( |
|
57 |
registerDynClass()); |
|
58 |
} |
|
59 |
|
|
60 |
public static DynStruct registerDynClass() { |
|
61 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
62 |
DynStruct definition = manager.getDefinition("WMTSServerExplorerParameters_Persistent"); |
|
63 |
if( definition == null ) { |
|
64 |
definition = manager.addDefinition( |
|
65 |
WMTSDataParametersImpl.class, |
|
66 |
"WMTSServerExplorerParameters_Persistent", |
|
67 |
"WMTS Explorer DataParameters Persistency", |
|
68 |
null, |
|
69 |
null |
|
70 |
); |
|
71 |
} |
|
72 |
|
|
73 |
AbstractRasterDataParameters.registerDynClass(definition); |
|
74 |
|
|
75 |
definition.addDynFieldBoolean(AXIS_ORDER) |
|
76 |
.setDescription("Longitude first in axis order") |
|
77 |
.setMandatory(false); |
|
78 |
|
|
79 |
definition.addDynFieldString(FIELD_HOST) |
|
80 |
.setDescription("Uniform Resource Identifier (File name or URL)") |
|
81 |
.setMandatory(false); |
|
82 |
return definition; |
|
83 |
} |
|
84 |
|
|
85 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
86 |
return delegatedDynObject; |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Returns true if the longitude is first in axis order |
|
91 |
* @return |
|
92 |
*/ |
|
93 |
public boolean isLongitudeFirst() { |
|
94 |
Object obj = getDynValue(AXIS_ORDER); |
|
95 |
if(obj instanceof Boolean) { |
|
96 |
Boolean b = (Boolean)getDynValue(AXIS_ORDER); |
|
97 |
if(b != null) |
|
98 |
return ((Boolean)b).booleanValue(); |
|
99 |
} |
|
100 |
if(obj instanceof String) { |
|
101 |
String b = (String)getDynValue(AXIS_ORDER); |
|
102 |
if(b != null) |
|
103 |
return new Boolean(((String)b)); |
|
104 |
} |
|
105 |
return false; |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* Sets the longitude first in axis order |
|
110 |
* @param longFirst |
|
111 |
*/ |
|
112 |
public void setLongitudeFirst(boolean longFirst) { |
|
113 |
this.setDynValue(AXIS_ORDER, new Boolean(longFirst)); |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* Gets the assigned host |
|
118 |
* @return |
|
119 |
*/ |
|
120 |
public String getHost() { |
|
121 |
return (String) this.getDynValue(FIELD_HOST); |
|
122 |
} |
|
123 |
|
|
124 |
public void setHost(String host) { |
|
125 |
this.setDynValue(FIELD_HOST, host); |
|
126 |
} |
|
127 |
|
|
128 |
public String getDataStoreName() { |
|
129 |
return WMTSProvider.NAME; |
|
130 |
} |
|
131 |
|
|
132 |
public String getDescription() { |
|
133 |
return WMTSProvider.DESCRIPTION; |
|
134 |
} |
|
135 |
|
|
136 |
public String getExplorerName() { |
|
137 |
return WMTSServerExplorer.NAME; |
|
138 |
} |
|
139 |
} |
|
0 | 140 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParameters.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 |
package org.gvsig.raster.wmts.io; |
|
24 |
|
|
25 |
import java.awt.geom.Rectangle2D; |
|
26 |
import java.net.URI; |
|
27 |
|
|
28 |
import org.cresques.cts.IProjection; |
|
29 |
|
|
30 |
import org.gvsig.compat.net.ICancellable; |
|
31 |
import org.gvsig.fmap.dal.coverage.store.parameter.RemoteStoreParameters; |
|
32 |
import org.gvsig.raster.wmts.ogc.WMTSClient; |
|
33 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
34 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle; |
|
35 |
|
|
36 |
/** |
|
37 |
* Parameters for the WMTS provider |
|
38 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
39 |
*/ |
|
40 |
public interface WMTSDataParameters extends RemoteStoreParameters { |
|
41 |
public static final String DYNCLASS_NAME = "WMTSDataParameters"; |
|
42 |
public static final String FIELD_IMAGE_FORMAT = "imageformat"; |
|
43 |
public static final String FIELD_INFO_FORMAT = "infoformat"; |
|
44 |
public static final String FIELD_NAME = "name"; |
|
45 |
public static final String FIELD_SRSSTR = "srsstr"; |
|
46 |
public static final String FIELD_OVERRIDE = "override"; |
|
47 |
public static final String FIELD_WIDTH = "width"; |
|
48 |
public static final String FIELD_HEIGHT = "height"; |
|
49 |
public static final String FIELD_DELETECACHE = "deletecache"; |
|
50 |
public static final String FIELD_STYLE_NAME = "style"; |
|
51 |
public static final String FIELD_EXTENT = "extent"; |
|
52 |
public static final String FIELD_DIMENSION = "dimension"; |
|
53 |
public static final String FIELD_DIMENSION_VALUE = "selected_dimension_value"; |
|
54 |
|
|
55 |
/** |
|
56 |
* Gets the selected dimension |
|
57 |
* @return |
|
58 |
*/ |
|
59 |
public String getDimension(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Sets the selected dimension |
|
63 |
* @param dimension |
|
64 |
*/ |
|
65 |
public void setDimension(String dimension); |
|
66 |
|
|
67 |
/** |
|
68 |
* Gets the value for the selected dimension |
|
69 |
* @return |
|
70 |
*/ |
|
71 |
public String getDimensionSelectedValue(); |
|
72 |
|
|
73 |
/** |
|
74 |
* Sets the value for the selected dimension |
|
75 |
* @param dimension |
|
76 |
*/ |
|
77 |
public void setDimensionSelectedValue(String dimension); |
|
78 |
|
|
79 |
/** |
|
80 |
* Sets the style selected |
|
81 |
* @param layer |
|
82 |
*/ |
|
83 |
public void setStyle(WMTSStyle layer); |
|
84 |
|
|
85 |
/** |
|
86 |
* Gets the style |
|
87 |
* @return |
|
88 |
*/ |
|
89 |
public WMTSStyle getStyle(); |
|
90 |
|
|
91 |
/** |
|
92 |
* Gets the image format |
|
93 |
* @return Format |
|
94 |
*/ |
|
95 |
public String getImageFormat(); |
|
96 |
|
|
97 |
/** |
|
98 |
* Sets the image format |
|
99 |
* @param format |
|
100 |
*/ |
|
101 |
public void setImageFormat(String format); |
|
102 |
|
|
103 |
/** |
|
104 |
* Gets the format of the info by point |
|
105 |
* @return |
|
106 |
*/ |
|
107 |
public String getInfoFormat(); |
|
108 |
|
|
109 |
/** |
|
110 |
* Sets the format of the info by point |
|
111 |
*/ |
|
112 |
public void setInfoFormat(String format); |
|
113 |
|
|
114 |
/** |
|
115 |
* Sets the layer selected |
|
116 |
* @param layer |
|
117 |
*/ |
|
118 |
public void setLayer(WMTSLayer layer); |
|
119 |
|
|
120 |
/** |
|
121 |
* Gets the layer |
|
122 |
* @return |
|
123 |
*/ |
|
124 |
public WMTSLayer getLayer(); |
|
125 |
|
|
126 |
/** |
|
127 |
* Devuelve el SRS. |
|
128 |
* @return SRS. |
|
129 |
*/ |
|
130 |
public String getSRSCode(); |
|
131 |
|
|
132 |
public void setSRS(String m_srs); |
|
133 |
|
|
134 |
public void setSRS(IProjection srs); |
|
135 |
|
|
136 |
/** |
|
137 |
* Returns the projection |
|
138 |
* @return |
|
139 |
*/ |
|
140 |
public IProjection getSRS(); |
|
141 |
|
|
142 |
/** |
|
143 |
* Returns true if the layer is projected |
|
144 |
* @return |
|
145 |
*/ |
|
146 |
public boolean isProjected(); |
|
147 |
|
|
148 |
public String getSRSID(); |
|
149 |
|
|
150 |
public void setSRSID(String srsid); |
|
151 |
|
|
152 |
/** |
|
153 |
* Returns the current selected SRS. |
|
154 |
* @return |
|
155 |
*/ |
|
156 |
public String getEPSG(String value); |
|
157 |
|
|
158 |
public String getName(); |
|
159 |
|
|
160 |
public void setName(String name); |
|
161 |
|
|
162 |
public void setCancellable(ICancellable cancel); |
|
163 |
|
|
164 |
public ICancellable getCancellable(); |
|
165 |
|
|
166 |
public boolean isOverridingHost(); |
|
167 |
|
|
168 |
public void setOverrideHost(boolean over); |
|
169 |
/** |
|
170 |
* Assigns the extent. |
|
171 |
* When a provider is initialized this will need to know what is the extent before the request. |
|
172 |
* |
|
173 |
* @param bBox |
|
174 |
*/ |
|
175 |
public void setExtent(Rectangle2D bBox); |
|
176 |
|
|
177 |
/** |
|
178 |
* Sets the width |
|
179 |
* When a provider is initialized this will need to know what is the width before the request. |
|
180 |
* @param w |
|
181 |
*/ |
|
182 |
public void setWidth(int w); |
|
183 |
|
|
184 |
/** |
|
185 |
* Sets the height |
|
186 |
* When a provider is initialized this will need to know what is the height before the request. |
|
187 |
* @param h |
|
188 |
*/ |
|
189 |
public void setHeight(int h); |
|
190 |
|
|
191 |
/** |
|
192 |
* Gets the bounding box |
|
193 |
* @return |
|
194 |
*/ |
|
195 |
public Rectangle2D getExtent(); |
|
196 |
|
|
197 |
/** |
|
198 |
* Gets the width |
|
199 |
* @return |
|
200 |
*/ |
|
201 |
public int getWidth(); |
|
202 |
|
|
203 |
/** |
|
204 |
* Gets the height |
|
205 |
* @return |
|
206 |
*/ |
|
207 |
public int getHeight(); |
|
208 |
|
|
209 |
public boolean isSizeFixed(); |
|
210 |
|
|
211 |
public void setURI(URI uri); |
|
212 |
|
|
213 |
public URI getURI(); |
|
214 |
|
|
215 |
public WMTSClient getOGCClient(); |
|
216 |
|
|
217 |
public void setOGCClient(WMTSClient ogcClient); |
|
218 |
} |
|
0 | 219 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParametersImpl.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 |
package org.gvsig.raster.wmts.io; |
|
24 |
|
|
25 |
|
|
26 |
import java.awt.geom.Rectangle2D; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import org.cresques.cts.IProjection; |
|
30 |
import org.gvsig.compat.net.ICancellable; |
|
31 |
import org.gvsig.fmap.crs.CRSFactory; |
|
32 |
import org.gvsig.fmap.dal.coverage.store.RasterDataServerExplorer; |
|
33 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
34 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
|
35 |
import org.gvsig.raster.wmts.ogc.WMTSClient; |
|
36 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
37 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle; |
|
38 |
import org.gvsig.tools.ToolsLocator; |
|
39 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
40 |
import org.gvsig.tools.dynobject.DynStruct; |
|
41 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
42 |
import org.slf4j.LoggerFactory; |
|
43 |
|
|
44 |
/** |
|
45 |
* Parameters for the WMTS provider |
|
46 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
47 |
*/ |
|
48 |
public class WMTSDataParametersImpl extends AbstractRasterDataParameters implements WMTSDataParameters { |
|
49 |
private DelegatedDynObject delegatedDynObject = null; |
|
50 |
private WMTSClient ogcClient = null; |
|
51 |
private ICancellable cancel = null; |
|
52 |
private WMTSStyle style = null; |
|
53 |
private WMTSLayer layer = null; |
|
54 |
|
|
55 |
public WMTSDataParametersImpl() { |
|
56 |
super(); |
|
57 |
initialize(); |
|
58 |
} |
|
59 |
|
|
60 |
protected void initialize() { |
|
61 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
62 |
.getDynObjectManager().createDynObject(registerDynClass()); |
|
63 |
} |
|
64 |
|
|
65 |
public static DynStruct registerDynClass() { |
|
66 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
67 |
DynStruct definition = manager.getDefinition("WMTSDataParameters_Persistent"); |
|
68 |
if( definition == null ) { |
|
69 |
definition = manager.addDefinition( |
|
70 |
WMTSDataParametersImpl.class, |
|
71 |
"WMTSDataParameters_Persistent", |
|
72 |
"WMTS DataParameters Persistency", |
|
73 |
null, |
|
74 |
null |
|
75 |
); |
|
76 |
} |
|
77 |
|
|
78 |
AbstractRasterDataParameters.registerDynClass(definition); |
|
79 |
|
|
80 |
definition.addDynFieldBoolean(FIELD_DELETECACHE) |
|
81 |
.setDescription("Flag to delete cache the next request") |
|
82 |
.setMandatory(false); |
|
83 |
|
|
84 |
definition.addDynFieldInt(FIELD_WIDTH) |
|
85 |
.setDescription("Width") |
|
86 |
.setMandatory(false); |
|
87 |
|
|
88 |
definition.addDynFieldInt(FIELD_HEIGHT) |
|
89 |
.setDescription("Height") |
|
90 |
.setMandatory(false); |
|
91 |
|
|
92 |
definition.addDynFieldBoolean(FIELD_OVERRIDE) |
|
93 |
.setDescription("Override a host capabilities") |
|
94 |
.setMandatory(false); |
|
95 |
|
|
96 |
definition.addDynFieldString(FIELD_SRSSTR) |
|
97 |
.setDescription("String that represents the SRS") |
|
98 |
.setMandatory(false); |
|
99 |
|
|
100 |
definition.addDynFieldString(FIELD_NAME) |
|
101 |
.setDescription("Layer name") |
|
102 |
.setMandatory(false); |
|
103 |
|
|
104 |
definition.addDynFieldString(FIELD_INFO_FORMAT) |
|
105 |
.setDescription("Info Format") |
|
106 |
.setMandatory(false); |
|
107 |
|
|
108 |
definition.addDynFieldString(FIELD_IMAGE_FORMAT) |
|
109 |
.setDescription("Image Format") |
|
110 |
.setMandatory(false); |
|
111 |
|
|
112 |
definition.addDynFieldString(FIELD_STYLE_NAME) |
|
113 |
.setDescription("Style") |
|
114 |
.setMandatory(false); |
|
115 |
|
|
116 |
definition.addDynFieldObject(FIELD_EXTENT) |
|
117 |
.setClassOfValue(Rectangle2D.class) |
|
118 |
.setDescription("Bounding box") |
|
119 |
.setMandatory(false); |
|
120 |
|
|
121 |
definition.addDynFieldString(FIELD_DIMENSION) |
|
122 |
.setDescription("Dimensions") |
|
123 |
.setMandatory(false); |
|
124 |
|
|
125 |
definition.addDynFieldString(FIELD_DIMENSION_VALUE) |
|
126 |
.setDescription("Value selected for the current dimension") |
|
127 |
.setMandatory(false); |
|
128 |
|
|
129 |
return definition; |
|
130 |
} |
|
131 |
|
|
132 |
/** |
|
133 |
* Gets the selected dimension |
|
134 |
* @return |
|
135 |
*/ |
|
136 |
public String getDimension() { |
|
137 |
return (String)getDynValue(FIELD_DIMENSION); |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* Sets the selected dimension |
|
142 |
* @param dimension |
|
143 |
*/ |
|
144 |
public void setDimension(String dimension) { |
|
145 |
setDynValue(FIELD_DIMENSION, dimension); |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* Gets the value for the selected dimension |
|
150 |
* @return |
|
151 |
*/ |
|
152 |
public String getDimensionSelectedValue() { |
|
153 |
return (String)getDynValue(FIELD_DIMENSION_VALUE); |
|
154 |
} |
|
155 |
|
|
156 |
/** |
|
157 |
* Sets the value for the selected dimension |
|
158 |
* @param dimension |
|
159 |
*/ |
|
160 |
public void setDimensionSelectedValue(String dimension) { |
|
161 |
setDynValue(FIELD_DIMENSION_VALUE, dimension); |
|
162 |
} |
|
163 |
|
|
164 |
/** |
|
165 |
* Gets the bounding box |
|
166 |
* @return |
|
167 |
*/ |
|
168 |
public Rectangle2D getExtent() { |
|
169 |
return (Rectangle2D)getDynValue(FIELD_EXTENT); |
|
170 |
} |
|
171 |
|
|
172 |
/** |
|
173 |
* Assigns the extent. |
|
174 |
* When a provider is initialized this will need to know what is the extent before the request. |
|
175 |
* |
|
176 |
* @param bBox |
|
177 |
*/ |
|
178 |
public void setExtent(Rectangle2D bBox) { |
|
179 |
setDynValue(FIELD_EXTENT, bBox); |
|
180 |
} |
|
181 |
|
|
182 |
/** |
|
183 |
* Sets the style selected |
|
184 |
* @param layer |
|
185 |
*/ |
|
186 |
public void setStyle(WMTSStyle style) { |
|
187 |
setDynValue(FIELD_STYLE_NAME, style.getTitle()); |
|
188 |
this.style = style; |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* Gets the style |
|
193 |
* @return |
|
194 |
*/ |
|
195 |
public WMTSStyle getStyle() { |
|
196 |
return style; |
|
197 |
} |
|
198 |
|
|
199 |
/** |
|
200 |
* Gets the image format |
|
201 |
* @return Format |
|
202 |
*/ |
|
203 |
public String getImageFormat() { |
|
204 |
return (String) this.getDynValue(FIELD_IMAGE_FORMAT); |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Sets the image format |
|
209 |
* @param format |
|
210 |
*/ |
|
211 |
public void setImageFormat(String format) { |
|
212 |
this.setDynValue(FIELD_IMAGE_FORMAT, format); |
|
213 |
} |
|
214 |
|
|
215 |
public String getInfoFormat() { |
|
216 |
return (String) this.getDynValue(FIELD_INFO_FORMAT); |
|
217 |
} |
|
218 |
|
|
219 |
public void setInfoFormat(String format) { |
|
220 |
this.setDynValue(FIELD_INFO_FORMAT, format); |
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* Devuelve el SRS. |
|
225 |
* @return SRS. |
|
226 |
*/ |
|
227 |
public String getSRSCode() { |
|
228 |
return (String) this.getDynValue(FIELD_SRSSTR); |
|
229 |
} |
|
230 |
|
|
231 |
public void setSRS(String m_srs) { |
|
232 |
m_srs = srsValidation(m_srs); |
|
233 |
this.setDynValue(FIELD_SRSSTR, m_srs); |
|
234 |
if(getEPSG(m_srs) != null) |
|
235 |
setSRS(CRSFactory.getCRS(getEPSG(m_srs))); |
|
236 |
} |
|
237 |
|
|
238 |
private String srsValidation(String srs) { |
|
239 |
if(srs == null) |
|
240 |
return null; |
|
241 |
if(srs.contains("CRS:84") || srs.contains("CRS84")) { |
|
242 |
return "EPSG:4326"; |
|
243 |
} |
|
244 |
|
|
245 |
if(srs.startsWith("EPSG") && !srs.startsWith("EPSG:")) { |
|
246 |
return "EPSG:" + srs.substring(srs.lastIndexOf("EPSG") + 1); |
|
247 |
} |
|
248 |
|
|
249 |
if(srs.contains("EPSG:") && !srs.startsWith("EPSG:")) { |
|
250 |
return "EPSG:" + srs.substring(srs.lastIndexOf(":") + 1); |
|
251 |
} |
|
252 |
return srs; |
|
253 |
} |
|
254 |
|
|
255 |
/** |
|
256 |
* Returns true if the layer is projected |
|
257 |
* @return |
|
258 |
*/ |
|
259 |
public boolean isProjected() { |
|
260 |
IProjection proj = getSRS(); |
|
261 |
if(proj == null) |
|
262 |
return true; |
|
263 |
else { |
|
264 |
try { |
|
265 |
return proj.isProjected(); |
|
266 |
} catch (Exception e) { |
|
267 |
LoggerFactory.getLogger(WMTSDataParameters.class).debug("error in projection", e); |
|
268 |
return true; |
|
269 |
} |
|
270 |
} |
|
271 |
} |
|
272 |
|
|
273 |
/** |
|
274 |
* Returns the current selected SRS. |
|
275 |
* @return |
|
276 |
*/ |
|
277 |
public String getEPSG(String value) { |
|
278 |
if(value != null) { |
|
279 |
if(value.compareTo("CRS:84") == 0) |
|
280 |
return "EPSG:4326"; |
|
281 |
|
|
282 |
String s = value.substring(value.lastIndexOf(":") + 1); |
|
283 |
return "EPSG:" + s; |
|
284 |
} |
|
285 |
return null; |
|
286 |
} |
|
287 |
|
|
288 |
public String getName() { |
|
289 |
return (String) this.getDynValue(FIELD_NAME); |
|
290 |
} |
|
291 |
|
|
292 |
public void setName(String name) { |
|
293 |
this.setDynValue(FIELD_NAME, name); |
|
294 |
} |
|
295 |
|
|
296 |
public boolean isOverridingHost() { |
|
297 |
Boolean b = (Boolean)getDynValue(FIELD_OVERRIDE); |
|
298 |
if(b != null) |
|
299 |
return ((Boolean)b).booleanValue(); |
|
300 |
return false; |
|
301 |
} |
|
302 |
|
|
303 |
public void setOverrideHost(boolean over) { |
|
304 |
this.setDynValue(FIELD_OVERRIDE, new Boolean(over));; |
|
305 |
} |
|
306 |
|
|
307 |
/** |
|
308 |
* Sets the width |
|
309 |
* When a provider is initialized this will need to know what is the width before the request. |
|
310 |
* @param w |
|
311 |
*/ |
|
312 |
public void setWidth(int w) { |
|
313 |
this.setDynValue(FIELD_WIDTH, new Integer(w)); |
|
314 |
} |
|
315 |
|
|
316 |
/** |
|
317 |
* Sets the height |
|
318 |
* When a provider is initialized this will need to know what is the height before the request. |
|
319 |
* @param h |
|
320 |
*/ |
|
321 |
public void setHeight(int h) { |
|
322 |
this.setDynValue(FIELD_HEIGHT, new Integer(h)); |
|
323 |
} |
|
324 |
|
|
325 |
/** |
|
326 |
* Gets the width |
|
327 |
* @return |
|
328 |
*/ |
|
329 |
public int getWidth() { |
|
330 |
Integer b = (Integer)getDynValue(FIELD_WIDTH); |
|
331 |
if(b != null) |
|
332 |
return ((Integer)b).intValue(); |
|
333 |
return 0; |
|
334 |
} |
|
335 |
|
|
336 |
/** |
|
337 |
* Gets the height |
|
338 |
* @return |
|
339 |
*/ |
|
340 |
public int getHeight() { |
|
341 |
Integer b = (Integer)getDynValue(FIELD_HEIGHT); |
|
342 |
if(b != null) |
|
343 |
return ((Integer)b).intValue(); |
|
344 |
return 0; |
|
345 |
} |
|
346 |
|
|
347 |
public void deleteCache(boolean deleteCache) { |
|
348 |
this.setDynValue(FIELD_DELETECACHE, new Boolean(deleteCache)); |
|
349 |
} |
|
350 |
|
|
351 |
public boolean isDeletingCache() { |
|
352 |
return ((Boolean)getDynValue(FIELD_DELETECACHE)).booleanValue(); |
|
353 |
} |
|
354 |
|
|
355 |
//********************************************** |
|
356 |
|
|
357 |
public String getDataStoreName() { |
|
358 |
return WMTSProvider.NAME; |
|
359 |
} |
|
360 |
|
|
361 |
public String getDescription() { |
|
362 |
return WMTSProvider.DESCRIPTION; |
|
363 |
} |
|
364 |
|
|
365 |
public String getExplorerName() { |
|
366 |
return WMTSServerExplorer.NAME; |
|
367 |
} |
|
368 |
|
|
369 |
public boolean isValid() { |
|
370 |
return (this.getURI() != null); |
|
371 |
} |
|
372 |
|
|
373 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
374 |
return delegatedDynObject; |
|
375 |
} |
|
376 |
|
|
377 |
/** |
|
378 |
* Clones this structure |
|
379 |
* @return |
|
380 |
*/ |
|
381 |
public WMTSDataParameters clone() { |
|
382 |
WMTSDataParametersImpl p = new WMTSDataParametersImpl(); |
|
383 |
p.setImageFormat(getImageFormat()); |
|
384 |
p.setInfoFormat(getInfoFormat()); |
|
385 |
p.setHeight(getHeight()); |
|
386 |
p.setWidth(getWidth()); |
|
387 |
p.setExtent(getExtent()); |
|
388 |
p.setURI(getURI()); |
|
389 |
p.setName(getName()); |
|
390 |
p.setOverrideHost(isOverridingHost()); |
|
391 |
p.setSRS(getSRS()); |
|
392 |
p.setSRS(getSRSCode()); |
|
393 |
p.setCancellable(getCancellable()); |
|
394 |
return p; |
|
395 |
} |
|
396 |
|
|
397 |
public boolean isSizeFixed() { |
|
398 |
return true; |
|
399 |
} |
|
400 |
|
|
401 |
public WMTSClient getOGCClient() { |
|
402 |
return ogcClient; |
|
403 |
} |
|
404 |
|
|
405 |
public void setOGCClient(WMTSClient ogcClient) { |
|
406 |
this.ogcClient = ogcClient; |
|
407 |
} |
|
408 |
|
|
409 |
/** |
|
410 |
* Sets the layer selected |
|
411 |
* @param layer |
|
412 |
*/ |
|
413 |
public void setLayer(WMTSLayer layer) { |
|
414 |
setName(layer.getTitle()); |
|
415 |
this.layer = layer; |
|
416 |
} |
|
417 |
|
|
418 |
/** |
|
419 |
* Gets the layer |
|
420 |
* @return |
|
421 |
*/ |
|
422 |
public WMTSLayer getLayer() { |
|
423 |
return layer; |
|
424 |
} |
|
425 |
|
|
426 |
public void setCancellable(ICancellable cancel) { |
|
427 |
this.cancel = cancel; |
|
428 |
} |
|
429 |
|
|
430 |
public ICancellable getCancellable() { |
|
431 |
return cancel; |
|
432 |
} |
|
433 |
|
|
434 |
public void assignFields(RasterDataParameters par, RasterDataServerExplorer explorer) { |
|
435 |
super.assignFields(par, explorer); |
|
436 |
WMTSDataParameters p = null; |
|
437 |
if(par instanceof WMTSDataParameters) |
|
438 |
p = (WMTSDataParameters)par; |
|
439 |
else |
|
440 |
return; |
|
441 |
|
|
442 |
setWidth(p.getWidth()); |
|
443 |
setHeight(p.getHeight()); |
|
444 |
setImageFormat(p.getImageFormat()); |
|
445 |
setInfoFormat(p.getInfoFormat()); |
|
446 |
setName(p.getName()); |
|
447 |
setSRS(p.getSRSCode()); |
|
448 |
setOverrideHost(p.isOverridingHost()); |
|
449 |
setExtent(p.getExtent()); |
|
450 |
|
|
451 |
if(explorer instanceof WMTSServerExplorer) { |
|
452 |
WMTSLayer wmtsLayer = ((WMTSServerExplorer)explorer).getOGCClient().getLayer(p.getName()); |
|
453 |
setLayer(wmtsLayer); |
|
454 |
List<WMTSStyle> wmtsStyles = wmtsLayer.getStyle(); |
|
455 |
for (int i = 0; i < wmtsStyles.size(); i++) { |
|
456 |
WMTSStyle style = wmtsStyles.get(i); |
|
457 |
if(style.getTitle() != null && style.getTitle().equals((String)getDynValue(FIELD_STYLE_NAME))) { |
|
458 |
this.style = style; |
|
459 |
} |
|
460 |
} |
|
461 |
if(this.style == null && wmtsStyles.size() > 0) |
|
462 |
this.style = wmtsStyles.get(0); |
|
463 |
} |
|
464 |
} |
|
465 |
|
|
466 |
} |
|
0 | 467 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.154/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/TilePipe.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.wmts.io; |
|
23 |
|
|
24 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* This class manages transactions between the producer and the consumer. The |
|
29 |
* producer download tiles from a server and the consumer is a tile provider |
|
30 |
* which will return downloaded tiles. |
|
31 |
* |
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
33 |
*/ |
|
34 |
public class TilePipe { |
|
35 |
//N?mero de threads m?ximos a lanzar para descarga. Cuando se lanzan m?s de estos el |
|
36 |
//invocador debe dormir hasta que se haya liberado alguno. |
|
37 |
public static int NTHREADS_QUEUE = 5; |
|
38 |
//N?mero m?ximo de elementos en la tuberia. Cuando se llene esta el setTile de esta clase debe |
|
39 |
//dormir hasta que getTile lo despierte. |
|
40 |
private final static int BUFFER_SIZE = 10; |
|
41 |
|
|
42 |
private WMTSTile buffer[] = new WMTSTile[BUFFER_SIZE]; |
|
43 |
private int next = 0; |
|
44 |
private boolean isFull = false; |
|
45 |
private boolean isEmpty = true; |
|
46 |
private Thread threadManager = null; |
|
47 |
|
|
48 |
/** |
|
49 |
* El thread manager no se usa con la pool solo para la implementaci?n de RequestThreadManager |
|
50 |
* @param threadManager |
|
51 |
*/ |
|
52 |
public void setRequestManager(Thread threadManager) { |
|
53 |
this.threadManager = threadManager; |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Sets a tile in the pipe |
|
58 |
* @param tile |
|
59 |
*/ |
|
60 |
public synchronized void setTile(WMTSTile tile) { |
Also available in: Unified diff