Updated to worldwind release 20070817
[worldwind-tracker.git] / gov / nasa / worldwind / wms / CapabilitiesV130.java
blob601b7aa90ecdf7fa07d55daa74d2c2930b80f091
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.XPath;
12 import java.util.ArrayList;
14 /**
15 * Version-dependent class for gathering information from a wms capabilities document.
17 * @author Tom Gaskins
18 * @version $Id: CapabilitiesV130.java 2471 2007-07-31 21:50:57Z tgaskins $
21 public class CapabilitiesV130 extends Capabilities
23 public CapabilitiesV130(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:EX_GeographicBoundingBox");
33 return e == null ? null : BoundingBox.createFromStrings("CRS:84",
34 this.getWestBoundLongitude(e), this.getEastBoundLongitude(e),
35 this.getSouthBoundLatitude(e), this.getNorthBoundLatitude(e),
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.getBoundingBoxCRS(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:MaxScaleDenominator");
78 @Override
79 public String getLayerMinScaleDenominator(Element layer)
81 return this.getText(layer, "ancestor-or-self::wms:Layer/wms:MinScaleDenominator");