Revision 39587 trunk/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.java
FLyrWMS.java | ||
---|---|---|
263 | 263 |
if (!drv.connect(null)) |
264 | 264 |
throw new ConnectionErrorLayerException(getName(),null); |
265 | 265 |
|
266 |
WMSLayerNode wmsNode = drv.getLayer(sLayer); |
|
266 |
WMSLayerNode[] wmsNodeList = new WMSLayerNode[sLayers.length]; |
|
267 |
for (int i=0; i<sLayers.length; i++) { |
|
268 |
wmsNodeList[i] = drv.getLayer(sLayers[i]); |
|
269 |
} |
|
267 | 270 |
|
268 |
if (wmsNode == null){
|
|
271 |
if (wmsNodeList == null || wmsNodeList.length==0){
|
|
269 | 272 |
throw new LoadLayerException(getName(),null); |
270 | 273 |
} |
271 | 274 |
if( sFormat == null ) { |
272 | 275 |
sFormat = this.getGreatFormat(drv.getFormats()); |
273 | 276 |
} |
274 | 277 |
// SRS |
275 |
Vector allSrs = wmsNode.getAllSrs(); |
|
278 |
ArrayList allSrs = new ArrayList(); |
|
279 |
for (int i=0; i<wmsNodeList.length; i++) { |
|
280 |
allSrs.addAll(wmsNodeList[i].getAllSrs()); |
|
281 |
} |
|
276 | 282 |
boolean isSRSSupported = false; |
277 | 283 |
if( sSRS != null ) { |
278 | 284 |
for (int i=0; i<allSrs.size() ; i++){ |
279 |
if (((String)allSrs.get(i)).compareTo(sSRS) == 0){
|
|
280 |
isSRSSupported = true;
|
|
281 |
}
|
|
282 |
}
|
|
285 |
if (((String)allSrs.get(i)).compareTo(sSRS) == 0){ |
|
286 |
isSRSSupported = true; |
|
287 |
} |
|
288 |
} |
|
283 | 289 |
} |
284 | 290 |
|
285 |
if(!isSRSSupported) {
|
|
286 |
for (int i=0; i<allSrs.size() ; i++){
|
|
287 |
if (((String)wmsNode.getAllSrs().get(i)).compareTo("EPSG:4326") == 0){
|
|
288 |
sSRS = (String)wmsNode.getAllSrs().get(i);
|
|
289 |
}
|
|
290 |
}
|
|
291 |
if (sSRS==null){
|
|
292 |
sSRS = (String)wmsNode.getAllSrs().get(0);
|
|
293 |
}
|
|
294 |
}
|
|
291 |
if(!isSRSSupported) { |
|
292 |
for (int i=0; i<allSrs.size() ; i++){ |
|
293 |
if (((String)allSrs.get(i)).compareTo("EPSG:4326") == 0){
|
|
294 |
sSRS = (String)allSrs.get(i);
|
|
295 |
} |
|
296 |
} |
|
297 |
if (sSRS==null){ |
|
298 |
sSRS = (String)allSrs.get(0);
|
|
299 |
} |
|
300 |
} |
|
295 | 301 |
if( fullExtent == null ) { |
296 | 302 |
fullExtent = drv.getLayersExtent(sLayers,sSRS); |
297 | 303 |
} |
... | ... | |
330 | 336 |
private String getGreatFormat(Vector formats){ |
331 | 337 |
for (int i=0 ; i<formats.size() ; i++){ |
332 | 338 |
String format = (String) formats.get(i); |
333 |
if (format.equals("image/jpg")){ |
|
334 |
return format; |
|
339 |
if (format.equals("image/png") |
|
340 |
|| format.equals("image/jpg") |
|
341 |
|| format.equals("image/jpeg")) { |
|
342 |
return format; |
|
335 | 343 |
} |
336 |
if (format.equals("image/jpeg")){ |
|
337 |
return format; |
|
338 |
} |
|
339 | 344 |
} |
340 | 345 |
|
341 | 346 |
return (String)formats.get(0); |
Also available in: Unified diff