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
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDouble precision version of LatLonPoint2D.static classThe Float version of a LatLonPoint2D, where coordinates are held to float precision. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LatLonPoint2DcalculateGeographicCenter(LatLonPoint2D[] points) doubledistance(double px, double py) doubledoubledistanceSq(double px, double py) doubledistanceSq(Point2D pt) booleanDetermines whether two LatLonPoints are equal.static LatLonPoint2DFactory method that will create a LatLonPoint2D.Double from a Point2D object.static LatLonPoint2DFactory method that will create a LatLonPoint2D.Float from a Point2D object.abstract doubleabstract doubleabstract doubleabstract doublestatic 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 Details
-
EQUIVALENT_TOLERANCE
public static final double EQUIVALENT_TOLERANCE- See Also:
-
-
Constructor Details
-
LatLonPoint2D
protected LatLonPoint2D()
-
-
Method Details
-
getFloat
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
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
Set location values from another lat/lon point.- Parameters:
llp-
-
distance
public double distance(double px, double py) -
distance
-
distanceSq
public double distanceSq(double px, double py) - Overrides:
distanceSqin classPoint2D
-
distanceSq
- 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
-
equals
Determines whether two LatLonPoints are equal.
-