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:
  • Field Details

  • Constructor Details

    • LatLonPoint2D

      protected LatLonPoint2D()
  • Method Details

    • 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 latitude
      lon - 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 - latitude
      lon - 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 -
    • distance

      public double distance(double px, double py)
      Overrides:
      distance in class Point2D
    • distance

      public double distance(Point2D pt)
      Overrides:
      distance in class Point2D
    • distanceSq

      public double distanceSq(double px, double py)
      Overrides:
      distanceSq in class Point2D
    • distanceSq

      public double distanceSq(Point2D pt)
      Overrides:
      distanceSq in class Point2D
    • 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 normalize
      center - 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)
    • equals

      public boolean equals(Object obj)
      Determines whether two LatLonPoints are equal.
      Overrides:
      equals in class Point2D
      Parameters:
      obj - Object
      Returns:
      Whether the two points are equal up to a tolerance of 10 -9 degrees in latitude and longitude.