Worldwind public release 0.2
[worldwind-tracker.git] / gov / nasa / worldwind / geom / Position.java
blob99d759f1e6b8173b1bd6c996db15379e7deec259
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.geom;
9 import gov.nasa.worldwind.*;
11 /**
12 * @author tag
13 * @version $Id: Position.java 1755 2007-05-06 23:38:05Z tgaskins $
15 public class Position
17 private final Angle latitude;
18 private final Angle longitude;
19 private final double elevation;
21 public static final Position ZERO = new Position(Angle.ZERO, Angle.ZERO, 0d);
23 public static Position fromRadians(double latitude, double longitude, double elevation)
25 return new Position(Angle.fromRadians(latitude), Angle.fromRadians(longitude), elevation);
28 public static Position fromDegrees(double latitude, double longitude, double elevation)
30 return new Position(Angle.fromDegrees(latitude), Angle.fromDegrees(longitude), elevation);
33 public Position(Angle latitude, Angle longitude, double elevation)
35 if (latitude == null || longitude == null)
37 String message = WorldWind.retrieveErrMsg("nullValue.LatitudeOrLongitudeIsNull");
38 WorldWind.logger().log(java.util.logging.Level.FINE, message);
39 throw new IllegalArgumentException(message);
42 this.latitude = latitude;
43 this.longitude = longitude;
44 this.elevation = elevation;
47 /**
48 * Obtains the latitude of this position
50 * @return this position's latitude
52 public final Angle getLatitude()
54 return this.latitude;
57 /**
58 * Obtains the longitude of this position
60 * @return this position's longitude
62 public final Angle getLongitude()
64 return this.longitude;
67 /**
68 * Obtains the elevation of this position
70 * @return this position's elevation
72 public final double getElevation()
74 return this.elevation;