Worldwind public release 0.2.1
[worldwind-tracker.git] / gov / nasa / worldwind / wms / CapabilitiesV111.java
blob5b73fcdd32291f7c08197b33bd72cac6d6e1e8c6
1 /*
2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
5 All Rights Reserved.
6 */
7 package gov.nasa.worldwind.wms;
9 import org.w3c.dom.*;
11 import javax.xml.xpath.*;
12 import java.util.*;
14 /**
15 * Version-dependent class for gathering information from a wms capabilities document.
17 * @author Tom Gaskins
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)
25 super(doc, xpath);
28 @Override
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"),
36 null, null);
39 public BoundingBox[] getLayerBoundingBoxes(Element layer)
41 Element[] es = this.getElements(layer, "ancestor-or-self::wms:Layer/wms:BoundingBox");
42 if (es == null)
43 return null;
45 ArrayList<BoundingBox> bboxes = new ArrayList<BoundingBox>();
46 ArrayList<String> crses = new ArrayList<String>();
48 for (Element e : es)
50 if (e == null)
51 continue;
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));
58 if (bb != null)
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());
64 bboxes.add(bb);
69 return bboxes.size() > 0 ? bboxes.toArray(new BoundingBox[bboxes.size()]) : null;
72 @Override
73 public String getLayerMaxScaleDenominator(Element layer)
75 return this.getText(layer, "ancestor-or-self::wms:Layer/wms:ScaleHint/@wms:max");
78 @Override
79 public String getLayerMinScaleDenominator(Element layer)
81 return this.getText(layer, "ancestor-or-self::wms:Layer/wms:ScaleHint/@wms:min");