Package ucar.nc2.dt.ugrid.geom
Class LatLonPoint2D
- java.lang.Object
-
- java.awt.geom.Point2D
-
- ucar.nc2.dt.ugrid.geom.LatLonPoint2D
-
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
LatLonPoint2D.Double,LatLonPoint2D.Float
public abstract class LatLonPoint2D extends Point2D implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLatLonPoint2D.DoubleDouble precision version of LatLonPoint2D.static classLatLonPoint2D.FloatThe Float version of a LatLonPoint2D, where coordinates are held to float precision.
-
Field Summary
Fields Modifier and Type Field Description static doubleEQUIVALENT_TOLERANCE
-
Constructor Summary
Constructors Modifier Constructor Description protectedLatLonPoint2D()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static LatLonPoint2DcalculateGeographicCenter(LatLonPoint2D[] points)doubledistance(double px, double py)doubledistance(Point2D pt)doubledistanceSq(double px, double py)doubledistanceSq(Point2D pt)booleanequals(Object obj)Determines whether two LatLonPoints are equal.static LatLonPoint2DgetDouble(Point2D pt2D)Factory method that will create a LatLonPoint2D.Double from a Point2D object.static LatLonPoint2DgetFloat(Point2D pt2D)Factory method that will create a LatLonPoint2D.Float from a Point2D object.abstract doublegetLatitude()abstract doublegetLongitude()abstract doublegetRadLat()abstract doublegetRadLon()static booleanisInvalidLatitude(double lat)Check if latitude is bogus.static booleanisInvalidLongitude(double lon)Check if longitude is bogus.static doublenormLat(double lat)Normalize the latitude to lie between +/-90static doublenormLon(double lon)Normalize the longitude to lie between +/-180static doublenormLon(double lon, double center)put longitude into the range [center +/- 180] degstatic doublenormLon360(double lon)put longitude into the range [0, 360] degstatic doublerange180(double lon)put longitude into the range [-180, 180] degabstract voidsetLatitude(double lat)Set decimal degree latitude.abstract voidsetLatLon(double lat, double lon)Set the latitude, longitude for this point.abstract voidsetLatLon(double lat, double lon, boolean isRadians)Set the latitude, longitude for this point, with the option of noting whether the values are in degrees or radians.voidsetLatLon(LatLonPoint2D llp)Set location values from another lat/lon point.abstract voidsetLongitude(double lon)Set decimal degree longitude.-
Methods inherited from class java.awt.geom.Point2D
clone, distance, distanceSq, getX, getY, hashCode, setLocation, setLocation
-
-
-
-
Field Detail
-
EQUIVALENT_TOLERANCE
public static final double EQUIVALENT_TOLERANCE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFloat
public static LatLonPoint2D getFloat(Point2D pt2D)
Factory method that will create a LatLonPoint2D.Float from a Point2D object. If pt2D is already a LatLonPoint2D.Float object, it is simply returned.- Parameters:
pt2D-- Returns:
- a LatLonPoint2D.Float object.
-
getDouble
public static LatLonPoint2D getDouble(Point2D pt2D)
Factory method that will create a LatLonPoint2D.Double from a Point2D object. If pt2D is already a LatLonPoint2D.Double object, it is simply returned.- Parameters:
pt2D-- Returns:
- a LatLonPoint2D.Double object.
-
setLatLon
public abstract void setLatLon(double lat, double lon)Set the latitude, longitude for this point.- Parameters:
lat- decimal degree latitudelon- decimal degree longitude.
-
setLatLon
public abstract void setLatLon(double lat, double lon, boolean isRadians)Set the latitude, longitude for this point, with the option of noting whether the values are in degrees or radians.- Parameters:
lat- latitudelon- longitude.isRadians- true of values are radians.
-
getLongitude
public abstract double getLongitude()
- Returns:
- decimal degree longitude as a float.
-
getLatitude
public abstract double getLatitude()
- Returns:
- decimal degree latitude as a float.
-
getRadLon
public abstract double getRadLon()
- Returns:
- radian longitude value.
-
getRadLat
public abstract double getRadLat()
- Returns:
- radian latitude value.
-
setLatitude
public abstract void setLatitude(double lat)
Set decimal degree latitude.
-
setLongitude
public abstract void setLongitude(double lon)
Set decimal degree longitude.
-
setLatLon
public void setLatLon(LatLonPoint2D llp)
Set location values from another lat/lon point.- Parameters:
llp-
-
distanceSq
public double distanceSq(double px, double py)- Overrides:
distanceSqin classPoint2D
-
distanceSq
public double distanceSq(Point2D pt)
- Overrides:
distanceSqin classPoint2D
-
range180
public static double range180(double lon)
put longitude into the range [-180, 180] deg- Parameters:
lon- lon to normalize- Returns:
- longitude in range [-180, 180] deg
-
normLon360
public static double normLon360(double lon)
put longitude into the range [0, 360] deg- Parameters:
lon- lon to normalize- Returns:
- longitude into the range [0, 360] deg
-
normLon
public static double normLon(double lon, double center)put longitude into the range [center +/- 180] deg- Parameters:
lon- lon to normalizecenter- center point- Returns:
- longitude into the range [center +/- 180] deg
-
normLon
public static double normLon(double lon)
Normalize the longitude to lie between +/-180- Parameters:
lon- east latitude in degrees- Returns:
- normalized lon
-
normLat
public static double normLat(double lat)
Normalize the latitude to lie between +/-90- Parameters:
lat- north latitude in degrees- Returns:
- normalized lat
-
isInvalidLatitude
public static boolean isInvalidLatitude(double lat)
Check if latitude is bogus. Latitude is invalid if lat > 90° or if lat < −90°.- Parameters:
lat- latitude in decimal degrees- Returns:
- boolean true if latitude is invalid
-
isInvalidLongitude
public static boolean isInvalidLongitude(double lon)
Check if longitude is bogus. Longitude is invalid if lon > 180° or if lon < −180°.- Parameters:
lon- longitude in decimal degrees- Returns:
- boolean true if longitude is invalid
-
calculateGeographicCenter
public static LatLonPoint2D calculateGeographicCenter(LatLonPoint2D[] points)
-
-