View Javadoc

1   /*
2    * Trip Tracker, a real-time position tracking system for the Internet.
3    * Copyright (C) 2006  Team Trip Tracker
4    *
5    * This program is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License as published by the
7    * Free Software Foundation; either version 2 of the License, or (at your
8    * option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful, but
11   * WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13   * General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License along
16   * with this program; if not, write to the Free Software Foundation, Inc.,
17   * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18   */
19  
20  package triptracker.core;
21  
22  /***
23   * The Earth is not an exact ellipsoid.  In fact, because the Earth is such a
24   * "lumpy" ellipsoid no single smooth ellipsoid will provide a perfect reference
25   * surface for the entire Earth. 
26   * <p>
27   * The practical solution to this is to measure the Earth's shape in different
28   * areas and to then create different reference ellipsoids used for mapping
29   * different regions on Earth.
30   * <p>
31   * Different datums is used for flattening out this lumpy ellipsoid. They create
32   * an reference ellipsoid used for mapping different regions on earth. The
33   * reference ellipsoid is created by the Earth's radius and the Earths
34   * eccentricity values. Evidently, this values is different for the each datums.
35   *  
36   * @see 
37   * <a href="http://exchange.manifold.net/manifold/manuals/5_userman/mfd50The_Earth_as_an_Ellipsoid.htm">
38   * The Earth as an Ellipsoid:</a>
39   */
40  public class Ellipsoid {
41  
42  	private final String name;
43  	private final double radius;
44  
45  	//The square of this ellipsoid's eccentricity
46  	private final double eccentricity;
47  
48  	public Ellipsoid(String name, double radius, double eccentricity) {
49  		this.name = name;
50  		this.radius = radius;
51  		this.eccentricity = eccentricity;
52  	}
53  
54  	@Override
55  	public String toString() {
56  		return (new StringBuilder()).append("Ellipsoid[radius=").append(
57  				radius).append(",eccentricity=").append(eccentricity).append(
58  				"]").toString();
59  	}
60  
61  	/***
62  	 * Returns earths eccentricity value based on the active datum
63  	 * 
64  	 * @return eccentricity value based on the datum
65  	 */
66  	public double getEccentricity() {
67  		return eccentricity;
68  	}
69  
70  	/***
71  	 * Returns the datum's name
72  	 * 
73  	 * @return name of the datum
74  	 */
75  	public String getName() {
76  		return name;
77  	}
78  
79  	/***
80  	 * Returns earths radius value based on the active datum
81  	 * 
82  	 * @return radius value based on the datum
83  	 */
84  	public double getRadius() {
85  		return radius;
86  	}
87  }