2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
7 package gov
.nasa
.worldwind
.wms
;
11 import javax
.xml
.xpath
.*;
15 * Version-dependent class for gathering information from a wms capabilities document.
18 * @version $Id: CapabilitiesV111.java 2131 2007-06-22 22:45:35Z jason $
21 public class CapabilitiesV111
extends Capabilities
23 public CapabilitiesV111(Document doc
, XPath xpath
)
29 public BoundingBox
getLayerGeographicBoundingBox(Element layer
)
31 Element e
= this.getElement(layer
, "ancestor-or-self::wms:Layer/wms:LatLonBoundingBox");
33 return e
== null ?
null : BoundingBox
.createFromStrings("CRS:84",
34 this.getText(e
, "@wms:minx"), this.getText(e
, "@wms:maxx"),
35 this.getText(e
, "@wms:miny"), this.getText(e
, "@wms:maxy"),
39 public BoundingBox
[] getLayerBoundingBoxes(Element layer
)
41 Element
[] es
= this.getElements(layer
, "ancestor-or-self::wms:Layer/wms:BoundingBox");
45 ArrayList
<BoundingBox
> bboxes
= new ArrayList
<BoundingBox
>();
46 ArrayList
<String
> crses
= new ArrayList
<String
>();
53 BoundingBox bb
= BoundingBox
.createFromStrings(this.getBoundingBoxSRS(e
),
54 this.getBoundingBoxMinx(e
), this.getBoundingBoxMaxx(e
),
55 this.getBoundingBoxMiny(e
), this.getBoundingBoxMaxy(e
),
56 this.getBoundingBoxResx(e
), this.getBoundingBoxResy(e
));
60 // Add the bbox only if the ancestor's crs is not one of those in the node's crs.
61 if (bb
.getCrs() != null && !crses
.contains(bb
.getCrs()))
63 crses
.add(bb
.getCrs());
69 return bboxes
.size() > 0 ? bboxes
.toArray(new BoundingBox
[bboxes
.size()]) : null;
73 public String
getLayerMaxScaleDenominator(Element layer
)
75 return this.getText(layer
, "ancestor-or-self::wms:Layer/wms:ScaleHint/@wms:max");
79 public String
getLayerMinScaleDenominator(Element layer
)
81 return this.getText(layer
, "ancestor-or-self::wms:Layer/wms:ScaleHint/@wms:min");