gvsig-raster / org.gvsig.raster.wms / trunk / org.gvsig.raster.wms / org.gvsig.raster.wms.io / src / main / java / org / gvsig / raster / wms / io / WMSProvider.java @ 479
History | View | Annotate | Download (33.6 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.raster.wms.io; |
23 |
|
24 |
import java.awt.geom.AffineTransform; |
25 |
import java.awt.geom.NoninvertibleTransformException; |
26 |
import java.awt.geom.Point2D; |
27 |
import java.awt.geom.Rectangle2D; |
28 |
import java.io.File; |
29 |
import java.io.IOException; |
30 |
import java.net.URL; |
31 |
import java.util.Hashtable; |
32 |
import java.util.Vector; |
33 |
|
34 |
import org.gvsig.compat.net.ICancellable; |
35 |
import org.gvsig.fmap.dal.DALLocator; |
36 |
import org.gvsig.fmap.dal.DataStore; |
37 |
import org.gvsig.fmap.dal.DataStoreParameters; |
38 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
39 |
import org.gvsig.fmap.dal.coverage.dataset.io.gdal.GdalProvider; |
40 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
41 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
42 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
43 |
import org.gvsig.fmap.dal.coverage.exception.BandNotFoundInListException; |
44 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
45 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
46 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
47 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
48 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
49 |
import org.gvsig.fmap.dal.coverage.exception.RemoteServiceException; |
50 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
51 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
52 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
53 |
import org.gvsig.metadata.MetadataLocator; |
54 |
import org.gvsig.raster.cache.tile.TileCacheLocator; |
55 |
import org.gvsig.raster.cache.tile.TileCacheManager; |
56 |
import org.gvsig.raster.cache.tile.exception.TileGettingException; |
57 |
import org.gvsig.raster.cache.tile.provider.TileListener; |
58 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
59 |
import org.gvsig.raster.impl.DefaultRasterManager; |
60 |
import org.gvsig.raster.impl.datastruct.BandListImpl; |
61 |
import org.gvsig.raster.impl.datastruct.DatasetBandImpl; |
62 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
63 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
64 |
import org.gvsig.raster.impl.provider.RasterProvider; |
65 |
import org.gvsig.raster.impl.provider.RemoteRasterProvider; |
66 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
67 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
68 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
69 |
import org.gvsig.remoteclient.utils.Utilities; |
70 |
import org.gvsig.remoteclient.wms.WMSStatus; |
71 |
import org.gvsig.tools.ToolsLocator; |
72 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
73 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
74 |
/**
|
75 |
* Clase que representa al driver de acceso a datos de wms.
|
76 |
*
|
77 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
78 |
*/
|
79 |
public class WMSProvider extends DefaultRasterProvider implements RemoteRasterProvider { |
80 |
public static String NAME = "Wms Store"; |
81 |
public static String DESCRIPTION = "Wms Raster file"; |
82 |
public static final String METADATA_DEFINITION_NAME = "WmsStore"; |
83 |
private static final int FIXED_SIZE = 800; |
84 |
|
85 |
private Extent viewRequest = null; |
86 |
private static Hashtable<URL, WMSConnector> |
87 |
drivers = new Hashtable<URL, WMSConnector> (); |
88 |
private boolean open = false; |
89 |
private DataStoreTransparency fileTransparency = null; |
90 |
private final int minTilePrintWidth = 12; |
91 |
private final int minTilePrintHeight = 12; |
92 |
//The out size depends on the last request
|
93 |
private int lastWidthRequest = 0; |
94 |
private int lastHeightRequest = 0; |
95 |
private Rectangle2D lastExtent = null; |
96 |
//Only for fixed size. Complete extent and FIXED_SIZE in long side
|
97 |
private File fileLayerPixelSize = null; |
98 |
private File lastRequest = null; |
99 |
|
100 |
public static void register() { |
101 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
102 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
103 |
dataman.registerStoreProvider(NAME, |
104 |
WMSProvider.class, WMSDataParameters.class); |
105 |
} |
106 |
|
107 |
if (!dataman.getExplorerProviders().contains(WMSServerExplorer.NAME)) {
|
108 |
dataman.registerExplorerProvider(WMSServerExplorer.NAME, WMSServerExplorer.class, WMSServerExplorerParameters.class); |
109 |
} |
110 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
111 |
} |
112 |
|
113 |
public WMSProvider() throws NotSupportedExtensionException { |
114 |
super();
|
115 |
} |
116 |
|
117 |
/*
|
118 |
* (non-Javadoc)
|
119 |
* @see org.gvsig.raster.impl.provider.RasterProvider#registerTileProviderFormats(java.lang.Class)
|
120 |
*/
|
121 |
public void registerTileProviderFormats(Class<RasterProvider> c) { |
122 |
|
123 |
} |
124 |
|
125 |
/**
|
126 |
* Constructor. Abre el dataset.
|
127 |
* @param proj Proyecci?n
|
128 |
* @param fName Nombre del fichero
|
129 |
* @throws NotSupportedExtensionException
|
130 |
*/
|
131 |
public WMSProvider(String params) throws NotSupportedExtensionException { |
132 |
super(params);
|
133 |
if(params instanceof String) { |
134 |
WMSDataParameters p = new WMSDataParameters();
|
135 |
p.setHost((String)params);
|
136 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
137 |
.createDynObject( |
138 |
MetadataLocator.getMetadataManager().getDefinition( |
139 |
DataStore.METADATA_DEFINITION_NAME))); |
140 |
init(p, null);
|
141 |
} |
142 |
} |
143 |
|
144 |
public WMSProvider(WMSDataParameters params,
|
145 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
|
146 |
super(params, storeServices, ToolsLocator.getDynObjectManager()
|
147 |
.createDynObject( |
148 |
MetadataLocator.getMetadataManager().getDefinition( |
149 |
DataStore.METADATA_DEFINITION_NAME))); |
150 |
init(params, storeServices); |
151 |
} |
152 |
|
153 |
/**
|
154 |
* Gets the connector from the URL
|
155 |
* @return
|
156 |
* @throws RemoteServiceException
|
157 |
*/
|
158 |
private WMSConnector getConnector() throws RemoteServiceException { |
159 |
WMSDataParameters p = (WMSDataParameters)parameters; |
160 |
URL url = null; |
161 |
try {
|
162 |
url = new URL(p.getHost()); |
163 |
} catch (Exception e) { |
164 |
throw new RemoteServiceException("Malformed URL",e); |
165 |
} |
166 |
try {
|
167 |
return WMSProvider.getConnectorFromURL(url);
|
168 |
} catch (IOException e) { |
169 |
throw new RemoteServiceException("Error getting the connector",e); |
170 |
} |
171 |
} |
172 |
|
173 |
/**
|
174 |
* Crea las referencias al fichero y carga
|
175 |
* las estructuras con la informaci?n y los metadatos.
|
176 |
* @param proj Proyecci?n
|
177 |
* @param param Parametros de carga
|
178 |
* @throws NotSupportedExtensionException
|
179 |
*/
|
180 |
public void init (DataStoreParameters params, |
181 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
|
182 |
setParam(storeServices, params); |
183 |
setDataType(new int[]{Buffer.TYPE_BYTE, Buffer.TYPE_BYTE, Buffer.TYPE_BYTE}); |
184 |
bandCount = 3;
|
185 |
mustTileRequest = false;
|
186 |
} |
187 |
|
188 |
public static final WMSConnector getConnectorFromURL(URL url) throws IOException { |
189 |
WMSConnector drv = (WMSConnector) drivers.get(url); |
190 |
if (drv == null) { |
191 |
drv = new WMSConnector(url);
|
192 |
drivers.put(url, drv); |
193 |
} |
194 |
return drv;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* Obtiene el objeto que contiene que contiene la interpretaci?n de
|
199 |
* color por banda
|
200 |
* @return
|
201 |
*/
|
202 |
public DataStoreColorInterpretation getColorInterpretation() {
|
203 |
if(colorInterpretation == null) { |
204 |
colorInterpretation = new DataStoreColorInterpretation();
|
205 |
colorInterpretation.initColorInterpretation(getBandCount()); |
206 |
colorInterpretation.setColorInterpValue(0, DataStoreColorInterpretation.RED_BAND);
|
207 |
colorInterpretation.setColorInterpValue(1, DataStoreColorInterpretation.GREEN_BAND);
|
208 |
colorInterpretation.setColorInterpValue(2, DataStoreColorInterpretation.BLUE_BAND);
|
209 |
} |
210 |
return colorInterpretation;
|
211 |
} |
212 |
|
213 |
/*
|
214 |
* (non-Javadoc)
|
215 |
* @see org.gvsig.fmap.dal.coverage.dataset.RasterDataSet#getAffineTransform()
|
216 |
*/
|
217 |
public AffineTransform getAffineTransform() { |
218 |
WMSDataParameters p = (WMSDataParameters)parameters; |
219 |
Extent e = getExtent(); |
220 |
if(p.isSizeFixed()) {
|
221 |
double psX = e.width() / (p.getWidth() - 1); |
222 |
double psY = -(e.height() / (p.getHeight() - 1)); |
223 |
ownTransformation = new AffineTransform( |
224 |
psX , |
225 |
0,
|
226 |
0,
|
227 |
psY, |
228 |
e.getULX() - (psX / 2),
|
229 |
e.getULY() - (psY / 2));
|
230 |
} else {
|
231 |
double psX = e.width() / (lastWidthRequest <= 0 ? p.getWidth() : lastWidthRequest); |
232 |
double psY = -(e.height() / (lastHeightRequest <= 0 ? p.getHeight() : lastHeightRequest)); |
233 |
ownTransformation = new AffineTransform( |
234 |
psX, |
235 |
0,
|
236 |
0,
|
237 |
psY, |
238 |
e.getULX() - (psX / 2),
|
239 |
e.getULY() - (psY / 2));
|
240 |
/*ownTransformation = new AffineTransform(
|
241 |
p.getExtent().getWidth() / (lastWidthRequest <= 0 ? p.getWidth() : lastWidthRequest) ,
|
242 |
0,
|
243 |
0,
|
244 |
-(p.getExtent().getHeight() / (lastHeightRequest <= 0 ? p.getHeight() : lastHeightRequest)),
|
245 |
p.getExtent().getMinX(),
|
246 |
p.getExtent().getMinY());*/
|
247 |
} |
248 |
externalTransformation = (AffineTransform) ownTransformation.clone();
|
249 |
return ownTransformation;
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* Calcula el extent en coordenadas del mundo real
|
254 |
* @return Extent
|
255 |
*/
|
256 |
public Extent getExtent() {
|
257 |
WMSDataParameters p = (WMSDataParameters)parameters; |
258 |
Vector<?> layerNames = Utilities.createVector(p.getLayerQuery(), ","); |
259 |
|
260 |
String[] ln = new String[layerNames.size()]; |
261 |
for (int i = 0; i < ln.length; i++) { |
262 |
ln[i] = (String)layerNames.get(i);
|
263 |
} |
264 |
Rectangle2D r = null; |
265 |
try {
|
266 |
r = getConnector().getLayersExtent(ln, p.getSRSCode()); |
267 |
} catch (RemoteServiceException e) {
|
268 |
} |
269 |
return new ExtentImpl(r.getMinX(), r.getMaxY(), r.getMaxX(), r.getMinY()); |
270 |
} |
271 |
|
272 |
|
273 |
/*
|
274 |
* (non-Javadoc)
|
275 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getLayerExtent(java.lang.String, java.lang.String)
|
276 |
*/
|
277 |
public Rectangle2D getLayerExtent(String layerName, String srs) throws RemoteServiceException { |
278 |
return getConnector().getLayersExtent(new String[]{layerName}, srs); |
279 |
} |
280 |
|
281 |
/*
|
282 |
* (non-Javadoc)
|
283 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#load()
|
284 |
*/
|
285 |
public RasterProvider load() {
|
286 |
return this; |
287 |
} |
288 |
|
289 |
/*
|
290 |
* (non-Javadoc)
|
291 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isOpen()
|
292 |
*/
|
293 |
public boolean isOpen() { |
294 |
return open;
|
295 |
} |
296 |
|
297 |
/*
|
298 |
* (non-Javadoc)
|
299 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#close()
|
300 |
*/
|
301 |
public void close() { |
302 |
open = false;
|
303 |
} |
304 |
|
305 |
/*
|
306 |
* (non-Javadoc)
|
307 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getTransparency()
|
308 |
*/
|
309 |
public Transparency getTransparency() { |
310 |
if(fileTransparency == null) |
311 |
fileTransparency = new DataStoreTransparency();
|
312 |
return fileTransparency;
|
313 |
} |
314 |
|
315 |
/*
|
316 |
* (non-Javadoc)
|
317 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#translateFileName(java.lang.String)
|
318 |
*/
|
319 |
public String translateFileName(String fileName) { |
320 |
return fileName;
|
321 |
} |
322 |
|
323 |
/*
|
324 |
* (non-Javadoc)
|
325 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setView(org.gvsig.fmap.dal.coverage.datastruct.Extent)
|
326 |
*/
|
327 |
public void setView(Extent e) { |
328 |
viewRequest = e; |
329 |
} |
330 |
|
331 |
/*
|
332 |
* (non-Javadoc)
|
333 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getView()
|
334 |
*/
|
335 |
public Extent getView() {
|
336 |
return viewRequest;
|
337 |
} |
338 |
|
339 |
/*
|
340 |
* (non-Javadoc)
|
341 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWidth()
|
342 |
*/
|
343 |
public double getWidth() { |
344 |
WMSDataParameters p = (WMSDataParameters)parameters; |
345 |
if(p.isSizeFixed()) {
|
346 |
return p.getWidth();
|
347 |
} |
348 |
if (lastWidthRequest <= 0) |
349 |
return p.getWidth();
|
350 |
if (lastWidthRequest < minTilePrintWidth)
|
351 |
return minTilePrintWidth;
|
352 |
return lastWidthRequest;
|
353 |
} |
354 |
|
355 |
/*
|
356 |
* (non-Javadoc)
|
357 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getHeight()
|
358 |
*/
|
359 |
public double getHeight() { |
360 |
WMSDataParameters p = (WMSDataParameters)parameters; |
361 |
if(p.isSizeFixed()) {
|
362 |
return p.getHeight();
|
363 |
} |
364 |
if (lastHeightRequest <= 0) |
365 |
return p.getHeight();
|
366 |
if (lastHeightRequest < minTilePrintHeight)
|
367 |
return minTilePrintHeight;
|
368 |
return lastHeightRequest;
|
369 |
} |
370 |
|
371 |
/*
|
372 |
* (non-Javadoc)
|
373 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#readCompleteLine(int, int)
|
374 |
*/
|
375 |
public Object readCompleteLine(int line, int band) |
376 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
|
377 |
return null; |
378 |
} |
379 |
|
380 |
/**
|
381 |
* When the remote layer has fixed size this method downloads the file and return its reference.
|
382 |
* File layer has in the long side FIXED_SIZE pixels and the bounding box is complete. This file could be
|
383 |
* useful to build an histogram or calculate statistics. This represents a sample of data.
|
384 |
* @return
|
385 |
* @throws RasterDriverException
|
386 |
*/
|
387 |
public File getFileLayer() throws RasterDriverException { |
388 |
if(fileLayerPixelSize != null) |
389 |
return fileLayerPixelSize;
|
390 |
|
391 |
WMSDataParameters p = (WMSDataParameters)parameters; |
392 |
Extent e = getExtent(); |
393 |
Rectangle2D bBox = new Rectangle2D.Double(e.getULX(), e.getLRY(), e.width(), e.height()); |
394 |
WMSStatus wmsStatus = loadWMSStatus(bBox); |
395 |
|
396 |
if(!p.isSizeFixed()) {
|
397 |
int w = 0; |
398 |
int h = 0; |
399 |
if(e.width() > e.height()) {
|
400 |
w = FIXED_SIZE; |
401 |
h = (int)((e.height() * FIXED_SIZE) / e.width());
|
402 |
} else {
|
403 |
h = FIXED_SIZE; |
404 |
w = (int)((e.width() * FIXED_SIZE) / e.height());
|
405 |
} |
406 |
wmsStatus.setWidth(w); |
407 |
wmsStatus.setHeight(h); |
408 |
fileLayerPixelSize = downloadFile(wmsStatus, e.getULX(), e.getULY(), e.getLRX(), e.getLRY(), w, h); |
409 |
} else {
|
410 |
fileLayerPixelSize = downloadFile(wmsStatus, e.getULX(), e.getULY(), e.getLRX(), e.getLRY(), |
411 |
p.getFixedSize().width, p.getFixedSize().height); |
412 |
} |
413 |
return fileLayerPixelSize;
|
414 |
} |
415 |
|
416 |
/**
|
417 |
* Reads a complete block of data and returns an tridimensional array of the right type. This function is useful
|
418 |
* to read a file very fast without setting a view. In a WMS service when the size is fixed then it will read the
|
419 |
* entire image but when the source hasn't pixel size it will read a sample of data. This set of data will have
|
420 |
* the size defined in FIXED_SIZE.
|
421 |
*
|
422 |
* @param pos Posici?n donde se empieza a leer
|
423 |
* @param blockHeight Altura m?xima del bloque leido
|
424 |
* @return Object que es un array tridimendional del tipo de datos del raster. (Bandas X Filas X Columnas)
|
425 |
* @throws InvalidSetViewException
|
426 |
* @throws FileNotOpenException
|
427 |
* @throws RasterDriverException
|
428 |
*/
|
429 |
public Object readBlock(int pos, int blockHeight) |
430 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException {
|
431 |
File lastFile = getFileLayer();
|
432 |
BandList bandList = new BandListImpl();
|
433 |
for (int i = 0; i < 3; i++) { |
434 |
try {
|
435 |
bandList.addBand(new DatasetBandImpl(lastFile.getPath(), pos, Buffer.TYPE_BYTE, 3), pos); |
436 |
} catch (BandNotFoundInListException e1) {
|
437 |
} |
438 |
} |
439 |
bandList.setDrawableBands(new int[]{0, 1, 2}); |
440 |
|
441 |
try {
|
442 |
GdalProvider driver = new GdalProvider(lastFile.getPath());
|
443 |
return driver.readBlock(pos, blockHeight);
|
444 |
} catch (NotSupportedExtensionException exc) {
|
445 |
throw new RasterDriverException("Error building GdalDriver", exc); |
446 |
} |
447 |
} |
448 |
|
449 |
/*
|
450 |
* (non-Javadoc)
|
451 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getData(int, int, int)
|
452 |
*/
|
453 |
public Object getData(int x, int y, int band) |
454 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
|
455 |
return null; |
456 |
} |
457 |
|
458 |
/**
|
459 |
* Gets the georeferencing file name form a raster file
|
460 |
* @param file
|
461 |
* a raster file
|
462 |
* @return
|
463 |
* a georeferencing file
|
464 |
*/
|
465 |
private String getWorldFile(String file){ |
466 |
String worldFile = file;
|
467 |
int index = file.lastIndexOf("."); |
468 |
if (index > 0){ |
469 |
worldFile = file.substring(0, index) + getExtensionWorldFile();
|
470 |
} |
471 |
return worldFile;
|
472 |
} |
473 |
|
474 |
/**
|
475 |
* Obtiene la extensi?n del fichero de georreferenciaci?n
|
476 |
* @return String con la extensi?n del fichero de georreferenciaci?n dependiendo
|
477 |
* del valor del formato obtenido del servidor. Por defecto asignaremos un .wld
|
478 |
*/
|
479 |
private String getExtensionWorldFile() { |
480 |
WMSDataParameters p = (WMSDataParameters)parameters; |
481 |
String extWorldFile = ".wld"; |
482 |
if(p.getFormat().equals("image/tif") || p.getFormat().equals("image/tiff")) { |
483 |
extWorldFile = ".tfw";
|
484 |
} |
485 |
return extWorldFile;
|
486 |
} |
487 |
|
488 |
private WMSStatus loadWMSStatus(Rectangle2D bBox) { |
489 |
lastExtent = bBox; |
490 |
WMSDataParameters p = (WMSDataParameters)parameters; |
491 |
WMSStatus wmsStatus = new WMSStatus();
|
492 |
wmsStatus.setLayerNames(Utilities.createVector(p.getLayerQuery(), ",")); |
493 |
wmsStatus.setSrs(p.getSRSCode()); |
494 |
wmsStatus.setFormat(p.getFormat()); |
495 |
wmsStatus.setStyles(p.getStyles()); |
496 |
wmsStatus.setDimensions(p.getDimensions()); |
497 |
wmsStatus.setTransparency(p.isWmsTransparent()); |
498 |
wmsStatus.setOnlineResource((String) p.getOnlineResource().get("GetMap")); |
499 |
if(p.isSizeFixed()) {
|
500 |
wmsStatus.setExtent(getExtent().toRectangle2D()); |
501 |
} else
|
502 |
wmsStatus.setExtent(bBox); |
503 |
wmsStatus.setHeight(p.getHeight()); |
504 |
wmsStatus.setWidth(p.getWidth()); |
505 |
return wmsStatus;
|
506 |
} |
507 |
|
508 |
/**
|
509 |
* This function downloads the file and creates the georeferencing file
|
510 |
* @param wmsStatus
|
511 |
* @param ulx
|
512 |
* @param uly
|
513 |
* @param lrx
|
514 |
* @param lry
|
515 |
* @param w
|
516 |
* @param h
|
517 |
* @return
|
518 |
* @throws RasterDriverException
|
519 |
*/
|
520 |
private File downloadFile(WMSStatus wmsStatus, double ulx, double uly, double lrx, double lry, int w, int h) throws RasterDriverException { |
521 |
WMSDataParameters p = (WMSDataParameters)parameters; |
522 |
try {
|
523 |
lastRequest = getConnector().getMap(wmsStatus, ((WMSDataParameters)parameters).getCancellable()); |
524 |
} catch (RemoteServiceException e) {
|
525 |
throw new RasterDriverException(e.getMessage(), e); |
526 |
} |
527 |
|
528 |
if(lastRequest == null) |
529 |
return null; |
530 |
|
531 |
String nameWorldFile = getWorldFile(lastRequest.getPath());
|
532 |
try {
|
533 |
if(p.isSizeFixed()) {
|
534 |
Extent e = getExtent(); |
535 |
fileUtil.createWorldFile(nameWorldFile, e, p.getWidth(), p.getHeight()); |
536 |
} else {
|
537 |
fileUtil.createWorldFile(nameWorldFile, new ExtentImpl(ulx, uly, lrx, lry), w, h);
|
538 |
} |
539 |
} catch (IOException e) { |
540 |
throw new RasterDriverException("Error creating world file", e); |
541 |
} |
542 |
|
543 |
return lastRequest;
|
544 |
} |
545 |
|
546 |
/**
|
547 |
* Assigns the list of bands RGB and read a window of data
|
548 |
* @param rasterBuf
|
549 |
* @param bandList
|
550 |
* @param lastFile
|
551 |
* @param ulx
|
552 |
* @param uly
|
553 |
* @param lrx
|
554 |
* @param lry
|
555 |
* @return
|
556 |
* @throws RasterDriverException
|
557 |
* @throws ProcessInterruptedException
|
558 |
*/
|
559 |
public Buffer getBuffer(Buffer rasterBuf, BandList bandList, File lastFile, |
560 |
double ulx, double uly, double lrx, double lry) throws RasterDriverException, ProcessInterruptedException { |
561 |
try {
|
562 |
//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
|
563 |
String serverName = bandList.getBand(0).getFileName(); |
564 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
565 |
bandList.getBand(i).setFileName(lastFile.getPath()); |
566 |
} |
567 |
|
568 |
GdalProvider driver = new GdalProvider(lastFile.getPath());
|
569 |
Buffer buf = driver.getWindow(new ExtentImpl(ulx, uly, lrx, lry), bandList, rasterBuf); |
570 |
|
571 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
572 |
bandList.getBand(i).setFileName(serverName); |
573 |
} |
574 |
|
575 |
return buf;
|
576 |
} catch (NotSupportedExtensionException e) {
|
577 |
throw new RasterDriverException("Error building GdalDriver", e); |
578 |
} |
579 |
} |
580 |
|
581 |
/*
|
582 |
* (non-Javadoc)
|
583 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isTiled()
|
584 |
*/
|
585 |
public boolean isTiled() { |
586 |
return mustTileRequest;
|
587 |
} |
588 |
|
589 |
/*
|
590 |
* (non-Javadoc)
|
591 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(org.gvsig.fmap.dal.coverage.datastruct.Extent, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.raster.cache.tile.provider.TileListener)
|
592 |
*/
|
593 |
public void getWindow(Extent ex, int bufWidth, int bufHeight, |
594 |
BandList bandList, TileListener listener) throws ProcessInterruptedException, RasterDriverException {
|
595 |
if(mustTileRequest) {
|
596 |
|
597 |
} else {
|
598 |
Buffer raster = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], bufWidth, bufHeight, 3, true); |
599 |
getWindow(ex, bufWidth, bufHeight, bandList, raster, true);
|
600 |
raster.setDataExtent(ex.toRectangle2D()); |
601 |
|
602 |
TileCacheManager m = TileCacheLocator.getManager(); |
603 |
org.gvsig.raster.cache.tile.Tile t = m.createTile(-1, 0, 0); |
604 |
t.setData(new Object[]{raster}); |
605 |
t.setUl(new Point2D.Double(ex.getULX(), ex.getULY())); |
606 |
t.setLr(new Point2D.Double(ex.getLRX(), ex.getLRY())); |
607 |
t.setDownloaderParams("AffineTransform", getAffineTransform());
|
608 |
t.setDownloaderParams("Tiling", new Boolean(false)); |
609 |
try {
|
610 |
listener.tileReady(t); |
611 |
} catch (TileGettingException e) {
|
612 |
throw new RasterDriverException("Error throwing a tile", e); |
613 |
} |
614 |
|
615 |
//listener.nextBuffer(raster, null, new ExtentImpl(minX, minY, maxX, maxY), getAffineTransform(), null, false);
|
616 |
listener.endReading(); |
617 |
} |
618 |
} |
619 |
|
620 |
/*
|
621 |
* (non-Javadoc)
|
622 |
* @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)
|
623 |
*/
|
624 |
public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf) |
625 |
throws ProcessInterruptedException, RasterDriverException {
|
626 |
Rectangle2D bBox = ex.toRectangle2D();
|
627 |
lastWidthRequest = rasterBuf.getWidth(); |
628 |
lastHeightRequest = rasterBuf.getHeight(); |
629 |
WMSStatus wmsStatus = loadWMSStatus(bBox); |
630 |
|
631 |
lastRequest = downloadFile(wmsStatus, ex.getULX(), ex.getULY(), ex.getLRX(), ex.getLRY(), rasterBuf.getWidth(), rasterBuf.getHeight()); |
632 |
|
633 |
if (lastRequest == null) { |
634 |
return rasterBuf;
|
635 |
} |
636 |
|
637 |
try {
|
638 |
//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
|
639 |
String serverName = bandList.getBand(0).getFileName(); |
640 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
641 |
bandList.getBand(i).setFileName(lastRequest.getPath()); |
642 |
} |
643 |
|
644 |
GdalProvider driver = new GdalProvider(lastRequest.getPath());
|
645 |
Buffer buf = driver.getWindow(ex, bandList, rasterBuf);
|
646 |
|
647 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
648 |
bandList.getBand(i).setFileName(serverName); |
649 |
} |
650 |
driver.close(); |
651 |
return buf;
|
652 |
} catch (NotSupportedExtensionException e) {
|
653 |
throw new RasterDriverException("Error building GdalDriver", e); |
654 |
} |
655 |
} |
656 |
|
657 |
/*
|
658 |
* (non-Javadoc)
|
659 |
* @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)
|
660 |
*/
|
661 |
public Buffer getWindow(double ulx, double uly, double w, double h, |
662 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
663 |
Rectangle2D bBox = new Rectangle2D.Double(ulx, uly, w, h); |
664 |
lastWidthRequest = rasterBuf.getWidth(); |
665 |
lastHeightRequest = rasterBuf.getHeight(); |
666 |
WMSStatus wmsStatus = loadWMSStatus(bBox); |
667 |
|
668 |
lastRequest = downloadFile(wmsStatus, ulx, uly, ulx + w, uly - h, rasterBuf.getWidth(), rasterBuf.getHeight()); |
669 |
|
670 |
if (lastRequest == null) { |
671 |
return rasterBuf;
|
672 |
} |
673 |
|
674 |
try {
|
675 |
//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
|
676 |
String serverName = bandList.getBand(0).getFileName(); |
677 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
678 |
bandList.getBand(i).setFileName(lastRequest.getPath()); |
679 |
} |
680 |
|
681 |
GdalProvider driver = new GdalProvider(lastRequest.getPath());
|
682 |
Buffer buf = driver.getWindow(ulx, uly, w, h, bandList, rasterBuf, adjustToExtent);
|
683 |
|
684 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
685 |
bandList.getBand(i).setFileName(serverName); |
686 |
} |
687 |
|
688 |
return buf;
|
689 |
} catch (NotSupportedExtensionException e) {
|
690 |
throw new RasterDriverException("Error building GdalDriver", e); |
691 |
} |
692 |
} |
693 |
|
694 |
/*
|
695 |
* (non-Javadoc)
|
696 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(org.gvsig.fmap.dal.coverage.datastruct.Extent, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer, boolean)
|
697 |
*/
|
698 |
public Buffer getWindow(Extent extent, |
699 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
700 |
Rectangle2D bBox = extent.toRectangle2D();//new Rectangle2D.Double(ulx, lry, Math.abs(lrx - ulx), Math.abs(lry - uly)); |
701 |
lastWidthRequest = rasterBuf.getWidth(); |
702 |
lastHeightRequest = rasterBuf.getHeight(); |
703 |
WMSStatus wmsStatus = loadWMSStatus(bBox); |
704 |
lastRequest = downloadFile(wmsStatus, extent.getULX(), extent.getULY(), extent.getLRX(), extent.getLRY(), rasterBuf.getWidth(), rasterBuf.getHeight()); |
705 |
|
706 |
if (lastRequest == null) { |
707 |
return rasterBuf;
|
708 |
} |
709 |
|
710 |
try {
|
711 |
//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
|
712 |
String serverName = bandList.getBand(0).getFileName(); |
713 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
714 |
bandList.getBand(i).setFileName(lastRequest.getPath()); |
715 |
} |
716 |
|
717 |
GdalProvider driver = new GdalProvider(lastRequest.getPath());
|
718 |
Buffer buf = driver.getWindow(extent, bufWidth, bufHeight, bandList, rasterBuf, adjustToExtent);
|
719 |
|
720 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
721 |
bandList.getBand(i).setFileName(serverName); |
722 |
} |
723 |
|
724 |
return buf;
|
725 |
} catch (NotSupportedExtensionException e) {
|
726 |
throw new RasterDriverException("Error building GdalDriver", e); |
727 |
} |
728 |
} |
729 |
|
730 |
/*
|
731 |
* (non-Javadoc)
|
732 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer)
|
733 |
*/
|
734 |
public Buffer getWindow(int x, int y, |
735 |
BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
736 |
int w = rasterBuf.getWidth();
|
737 |
int h = rasterBuf.getHeight();
|
738 |
Point2D p1 = rasterToWorld(new Point2D.Double(x, y)); |
739 |
Point2D p2 = rasterToWorld(new Point2D.Double(x + w, y + h)); |
740 |
lastWidthRequest = rasterBuf.getWidth(); |
741 |
lastHeightRequest = rasterBuf.getHeight(); |
742 |
Rectangle2D bBox = new Rectangle2D.Double(p1.getX(), p1.getY(), Math.abs(p1.getX() - p1.getX()), Math.abs(p1.getY() - p2.getY())); |
743 |
WMSStatus wmsStatus = loadWMSStatus(bBox); |
744 |
|
745 |
lastRequest = downloadFile(wmsStatus, p1.getX(), p1.getY(), p2.getX(), p2.getY(), rasterBuf.getWidth(), rasterBuf.getHeight()); |
746 |
|
747 |
if (lastRequest == null) { |
748 |
return rasterBuf;
|
749 |
} |
750 |
|
751 |
GdalProvider driver = null;
|
752 |
try {
|
753 |
//El nombre de fichero que ha puesto en el bandList es el del servidor y no el del fichero en disco
|
754 |
String serverName = bandList.getBand(0).getFileName(); |
755 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
756 |
bandList.getBand(i).setFileName(lastRequest.getPath()); |
757 |
} |
758 |
|
759 |
driver = new GdalProvider(lastRequest.getPath());
|
760 |
Buffer buf = driver.getWindow(0, 0, w, h, rasterBuf.getWidth(), rasterBuf.getHeight(), bandList, rasterBuf); |
761 |
|
762 |
for (int i = 0; i < bandList.getBandCount(); i++) { |
763 |
bandList.getBand(i).setFileName(serverName); |
764 |
} |
765 |
|
766 |
return buf;
|
767 |
} catch (NotSupportedExtensionException e) {
|
768 |
throw new RasterDriverException("Error building GdalDriver", e); |
769 |
} |
770 |
} |
771 |
|
772 |
/*
|
773 |
* (non-Javadoc)
|
774 |
* @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)
|
775 |
*/
|
776 |
public Buffer getWindow(int x, int y, int w, int h, int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
777 |
lastWidthRequest = rasterBuf.getWidth(); |
778 |
lastHeightRequest = rasterBuf.getHeight(); |
779 |
return null; |
780 |
} |
781 |
|
782 |
/*
|
783 |
* (non-Javadoc)
|
784 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getBlockSize()
|
785 |
*/
|
786 |
public int getBlockSize() { |
787 |
return 0; |
788 |
} |
789 |
|
790 |
/*
|
791 |
* (non-Javadoc)
|
792 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setAffineTransform(java.awt.geom.AffineTransform)
|
793 |
*/
|
794 |
public void setAffineTransform(AffineTransform t){ |
795 |
|
796 |
} |
797 |
|
798 |
/*
|
799 |
* (non-Javadoc)
|
800 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getOverviewCount(int)
|
801 |
*/
|
802 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
803 |
return 0; |
804 |
} |
805 |
|
806 |
/*
|
807 |
* (non-Javadoc)
|
808 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewWidth(int, int)
|
809 |
*/
|
810 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
811 |
return 0; |
812 |
} |
813 |
|
814 |
/*
|
815 |
* (non-Javadoc)
|
816 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewHeight(int, int)
|
817 |
*/
|
818 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
819 |
return 0; |
820 |
} |
821 |
|
822 |
/*
|
823 |
* (non-Javadoc)
|
824 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#overviewsSupport()
|
825 |
*/
|
826 |
public boolean overviewsSupport() { |
827 |
return false; |
828 |
} |
829 |
|
830 |
/*
|
831 |
* (non-Javadoc)
|
832 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isReproyectable()
|
833 |
*/
|
834 |
public boolean isReproyectable() { |
835 |
return false; |
836 |
} |
837 |
|
838 |
/*
|
839 |
* (non-Javadoc)
|
840 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider#getName()
|
841 |
*/
|
842 |
public String getName() { |
843 |
return NAME;
|
844 |
} |
845 |
|
846 |
/**
|
847 |
* Convierte un punto desde coordenadas pixel a coordenadas del mundo.
|
848 |
* @param pt Punto a transformar
|
849 |
* @return punto transformado en coordenadas del mundo
|
850 |
*/
|
851 |
public Point2D rasterToWorld(Point2D pt) { |
852 |
Point2D p = new Point2D.Double(); |
853 |
getAffineTransform().transform(pt, p); |
854 |
return p;
|
855 |
} |
856 |
|
857 |
/**
|
858 |
* Convierte un punto desde del mundo a coordenadas pixel.
|
859 |
* @param pt Punto a transformar
|
860 |
* @return punto transformado en coordenadas pixel
|
861 |
*/
|
862 |
public Point2D worldToRaster(Point2D pt) { |
863 |
Point2D p = new Point2D.Double(); |
864 |
try {
|
865 |
getAffineTransform().inverseTransform(pt, p); |
866 |
} catch (NoninvertibleTransformException e) { |
867 |
return pt;
|
868 |
} |
869 |
return p;
|
870 |
} |
871 |
|
872 |
/*
|
873 |
* (non-Javadoc)
|
874 |
* @see org.gvsig.raster.impl.provider.RasterProvider#setStatus(org.gvsig.raster.impl.provider.RasterProvider)
|
875 |
*/
|
876 |
public void setStatus(RasterProvider provider) { |
877 |
if(provider instanceof WMSProvider) { |
878 |
} |
879 |
} |
880 |
|
881 |
/*
|
882 |
* (non-Javadoc)
|
883 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getLastRequest()
|
884 |
*/
|
885 |
public File getLastRequest() { |
886 |
return lastRequest;
|
887 |
} |
888 |
|
889 |
/*
|
890 |
* (non-Javadoc)
|
891 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getBufferLastRequest()
|
892 |
*/
|
893 |
public Buffer getBufferLastRequest() throws ProcessInterruptedException, RasterDriverException { |
894 |
try {
|
895 |
GdalProvider driver = new GdalProvider(lastRequest.getPath());
|
896 |
|
897 |
BandList bandList = new BandListImpl();
|
898 |
for (int i = 0; i < driver.getBandCount(); i++) { |
899 |
try {
|
900 |
bandList.addBand(new DatasetBandImpl(lastRequest.getPath(), i, Buffer.TYPE_BYTE, 3), i); |
901 |
} catch (BandNotFoundInListException e1) {
|
902 |
} |
903 |
} |
904 |
bandList.setDrawableBands(new int[]{0, 1, 2}); |
905 |
Buffer newBuffer = DefaultRasterManager.getInstance().createBuffer(driver.getDataType()[0], (int)driver.getWidth(), (int)driver.getHeight(), driver.getBandCount(), true); |
906 |
Buffer buf = driver.getWindow(driver.getExtent(),
|
907 |
(int)driver.getWidth(),
|
908 |
(int)driver.getHeight(),
|
909 |
bandList, |
910 |
newBuffer, |
911 |
true);
|
912 |
driver.close(); |
913 |
return buf;
|
914 |
} catch (NotSupportedExtensionException e) {
|
915 |
throw new RasterDriverException("Error building GdalDriver", e); |
916 |
} |
917 |
} |
918 |
|
919 |
/**
|
920 |
* ASigna el par?metro de inicializaci?n del driver.
|
921 |
*/
|
922 |
public void setParam(DataStoreProviderServices storeServices, DataStoreParameters param) { |
923 |
if(param instanceof WMSDataParameters) |
924 |
this.name = ((WMSDataParameters)param).getHost();
|
925 |
this.param = param;
|
926 |
} |
927 |
|
928 |
/**
|
929 |
* @param wmsStatus
|
930 |
* @param i
|
931 |
* @param j
|
932 |
* @param max_value
|
933 |
* @return
|
934 |
* @throws RemoteServiceException
|
935 |
*/
|
936 |
public String getFeatureInfo(int i, int j, int max_value, ICancellable cancellable) throws RemoteServiceException { |
937 |
WMSStatus wmsStatus = loadWMSStatus(lastExtent); |
938 |
return getConnector().getFeatureInfo(wmsStatus, i, j, max_value, cancellable);
|
939 |
} |
940 |
|
941 |
/*
|
942 |
* (non-Javadoc)
|
943 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getInfoByPoint(double, double)
|
944 |
*/
|
945 |
public String getInfoByPoint(double x, double y, ICancellable cancellable) throws RemoteServiceException { |
946 |
return getFeatureInfo((int) x, (int) y, Integer.MAX_VALUE, cancellable); |
947 |
} |
948 |
|
949 |
/**
|
950 |
* Gets the suffix of the downloaded image
|
951 |
* @return
|
952 |
*/
|
953 |
public String getFileSuffix() { |
954 |
WMSDataParameters p = (WMSDataParameters)parameters; |
955 |
String format = p.getFormat();
|
956 |
if (format == null){ |
957 |
return "xml"; |
958 |
} |
959 |
if (format.indexOf("png") >= 0){ |
960 |
return "png"; |
961 |
} |
962 |
if (format.indexOf("xml") >= 0){ |
963 |
return "xml"; |
964 |
} |
965 |
if (format.indexOf("gif") >= 0){ |
966 |
return "gif"; |
967 |
} |
968 |
if (format.indexOf("tif") >= 0){ |
969 |
return "tif"; |
970 |
} |
971 |
if (format.indexOf("bmp") >= 0){ |
972 |
return "bmp"; |
973 |
} |
974 |
if (format.indexOf("jpg") >= 0 |
975 |
|| format.indexOf("jpeg") >= 0){ |
976 |
return "jpg"; |
977 |
} |
978 |
return "xml"; |
979 |
} |
980 |
|
981 |
/*
|
982 |
* (non-Javadoc)
|
983 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getTileServer()
|
984 |
*/
|
985 |
public TileServer getTileServer() {
|
986 |
return null; |
987 |
} |
988 |
|
989 |
/*
|
990 |
* (non-Javadoc)
|
991 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isRasterEnclosed()
|
992 |
*/
|
993 |
public boolean isRasterEnclosed() { |
994 |
WMSDataParameters p = (WMSDataParameters)parameters; |
995 |
if(p.isSizeFixed()) {
|
996 |
return false; |
997 |
} |
998 |
return true; |
999 |
} |
1000 |
|
1001 |
/*
|
1002 |
* (non-Javadoc)
|
1003 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getRMFFile()
|
1004 |
*/
|
1005 |
public String getRMFFile() { |
1006 |
if(lastRequest != null) |
1007 |
return fileUtil.getNameWithoutExtension(lastRequest.getAbsolutePath()) + ".rmf"; |
1008 |
return null; |
1009 |
} |
1010 |
} |