Worldwind public release 0.2.1
[worldwind-tracker.git] / gov / nasa / worldwind / wms / BoundingBox.java
blob7eba0926d7c799fe0ccf44a44c697388443d66cc
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 /**
12 * @author tag
13 * @version $Id: BoundingBox.java 1986 2007-06-09 00:33:50Z tgaskins $
15 public class BoundingBox
17 private String crs;
18 private double minx;
19 private double maxx;
20 private double miny;
21 private double maxy;
22 private double resx;
23 private double resy;
25 public static BoundingBox createFromStrings(String crs, String minx, String maxx, String miny, String maxy,
26 String resx, String resy)
28 BoundingBox bbox = new BoundingBox();
30 try
32 bbox.crs = crs;
33 bbox.minx = Double.parseDouble(minx);
34 bbox.maxx = Double.parseDouble(maxx);
35 bbox.miny = Double.parseDouble(miny);
36 bbox.maxy = Double.parseDouble(maxy);
37 bbox.resx = resx != null && !resx.equals("") ? Double.parseDouble(resx) : 0;
38 bbox.resy = resy != null && !resy.equals("") ? Double.parseDouble(resy) : 0;
40 catch (NumberFormatException e)
42 // TODO: log error
43 e.printStackTrace();
44 throw e;
47 return bbox;
50 public String getCrs()
52 return crs;
55 public double getMinx()
57 return minx;
60 public double getMaxx()
62 return maxx;
65 public double getMiny()
67 return miny;
70 public double getMaxy()
72 return maxy;
75 public double getResx()
77 return resx;
80 public double getResy()
82 return resy;
85 @Override
86 public String toString()
88 StringBuilder sb = new StringBuilder();
90 sb.append(this.crs);
91 sb.append(": minx = ");
92 sb.append(this.minx);
93 sb.append(" miny = ");
94 sb.append(this.miny);
95 sb.append(" maxx = ");
96 sb.append(this.maxx);
97 sb.append(" maxy = ");
98 sb.append(this.maxy);
99 sb.append(" resx = ");
100 sb.append(this.resx);
101 sb.append(" resy = ");
102 sb.append(this.resy);
104 return sb.toString();