Updated to worldwind release 20070817
[worldwind-tracker.git] / gov / nasa / worldwind / wms / BoundingBox.java
blob0c5cc854607d97a0c7658e1fc1996ca5d579c191
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 /**
10 * @author tag
11 * @version $Id: BoundingBox.java 2471 2007-07-31 21:50:57Z tgaskins $
13 public class BoundingBox
15 private String crs;
16 private double minx;
17 private double maxx;
18 private double miny;
19 private double maxy;
20 private double resx;
21 private double resy;
23 public static BoundingBox createFromStrings(String crs, String minx, String maxx, String miny, String maxy,
24 String resx, String resy)
26 BoundingBox bbox = new BoundingBox();
28 try
30 bbox.crs = crs;
31 bbox.minx = Double.parseDouble(minx);
32 bbox.maxx = Double.parseDouble(maxx);
33 bbox.miny = Double.parseDouble(miny);
34 bbox.maxy = Double.parseDouble(maxy);
35 bbox.resx = resx != null && !resx.equals("") ? Double.parseDouble(resx) : 0;
36 bbox.resy = resy != null && !resy.equals("") ? Double.parseDouble(resy) : 0;
38 catch (NumberFormatException e)
40 // TODO: logger error
41 e.printStackTrace();
42 throw e;
45 return bbox;
48 public String getCrs()
50 return crs;
53 public double getMinx()
55 return minx;
58 public double getMaxx()
60 return maxx;
63 public double getMiny()
65 return miny;
68 public double getMaxy()
70 return maxy;
73 public double getResx()
75 return resx;
78 public double getResy()
80 return resy;
83 @Override
84 public String toString()
86 StringBuilder sb = new StringBuilder();
88 sb.append(this.crs);
89 sb.append(": minx = ");
90 sb.append(this.minx);
91 sb.append(" miny = ");
92 sb.append(this.miny);
93 sb.append(" maxx = ");
94 sb.append(this.maxx);
95 sb.append(" maxy = ");
96 sb.append(this.maxy);
97 sb.append(" resx = ");
98 sb.append(this.resx);
99 sb.append(" resy = ");
100 sb.append(this.resy);
102 return sb.toString();