## com.bbn.openmap
Class LatLonPoint

    java.lang.Object
      com.bbn.openmap.LatLonPoint

All Implemented Interfaces:
  java.lang.Cloneable, java.io.Serializable

public class LatLonPoint
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Encapsulates latitude and longitude coordinates in decimal degrees. Normalizes the internal representation of latitude and longitude.

Normalized Latitude:
−90° <= φ <= 90°

Normalized Longitude:
−180° ≤ λ ≤ 180°

See Also:
  Serialized Form

Field Summary
`static float` `DATELINE`
`static float` `EQUIVALENT_TOLERANCE`
`protected float` `lat_`
`protected float` `lon_`
`static float` `LON_RANGE`
`static float` `NORTH_POLE`
`float` `radlat_` Used by the projection code for read-only quick access.
`float` `radlon_` Used by the projection code for read-only quick access.
`static float` `SOUTH_POLE`

Constructor Summary
`LatLonPoint()` Construct a default LatLonPoint.
`LatLonPoint(double lat, double lon)` Construct a LatLonPoint from raw double lat/lon.
`LatLonPoint(float lat, float lon)` Construct a LatLonPoint from raw float lat/lon in decimal degrees.
`LatLonPoint(float lat, float lon, boolean isRadian)` Construct a LatLonPoint from raw float lat/lon in radians.
`LatLonPoint(LatLonPoint pt)` Copy construct a LatLonPoint.

Method Summary
`float` `azimuth(LatLonPoint toPoint)` Find the azimuth to another point, based on the sphercal earth model.
`java.lang.Object` `clone()` Clone the LatLonPoint.
`float` `distance(LatLonPoint toPoint)` Find the distance to another LatLonPoint, based on a earth spherical model.
`boolean` `equals(java.lang.Object obj)` Determines whether two LatLonPoints are equal.
`float` `getLatitude()` Get normalized latitude.
`float` `getLongitude()` Get wrapped longitude.
`LatLonPoint` `getPoint(float dist, float az)` Find a LatLonPoint a distance and direction away from this point, based on the sphercal earth model.
`int` `hashCode()` Hash the lat/lon value.
`static boolean` `isInvalidLatitude(float lat)` Check if latitude is bogus.
`static boolean` `isInvalidLongitude(float lon)` Check if longitude is bogus.
`static float` `normalize_latitude(float lat)` Sets latitude to something sane.
`void` `read(java.io.DataInputStream s)` Read object.
`void` `read(java.io.DataInputStream s, boolean inRadians)` Read object.
`void` `setLatitude(float lat)` Set latitude.
`void` `setLatLon(float lat, float lon)` Set latitude and longitude.
`void` `setLatLon(float lat, float lon, boolean isRadian)` Set latitude and longitude.
`void` `setLatLon(LatLonPoint llpt)` Set LatLonPoint.
`void` `setLongitude(float lon)` Set longitude.
`java.lang.String` `toString()` Returns a string representation of the object.
`static float` `wrap_longitude(float lon)` Sets longitude to something sane.
`void` `write(java.io.DataOutputStream s)` Write object.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### NORTH_POLE

    public static final float NORTH_POLE

See Also:
  Constant Field Values

### SOUTH_POLE

    public static final float SOUTH_POLE

See Also:
  Constant Field Values

### DATELINE

    public static final float DATELINE

See Also:
  Constant Field Values

### LON_RANGE

    public static final float LON_RANGE

See Also:
  Constant Field Values

### lat_

    protected float lat_

### lon_

    protected float lon_

### EQUIVALENT_TOLERANCE

    public static final float EQUIVALENT_TOLERANCE

See Also:
  Constant Field Values

### radlat_

    public transient float radlat_

  Used by the projection code for read-only quick access. This is meant for quick backdoor access by the projection library. Modify at your own risk!

  See Also:
    `lat_`

### radlon_

    public transient float radlon_

  Used by the projection code for read-only quick access. This is meant for quick backdoor access by the projection library. Modify at your own risk!

  See Also:
    `lon_`

Constructor Detail

### LatLonPoint

    public LatLonPoint()

  Construct a default LatLonPoint.

### LatLonPoint

    public LatLonPoint(float lat,
                       float lon)

  Construct a LatLonPoint from raw float lat/lon in decimal degrees.

Parameters:
  `lat` - latitude in decimal degrees
  `lon` - longitude in decimal degrees

### LatLonPoint

    public LatLonPoint(float lat,
                       float lon,
                       boolean isRadian)

  Construct a LatLonPoint from raw float lat/lon in radians.

Parameters:
  `lat` - latitude in radians
  `lon` - longitude in radians
  `isRadian` - placeholder indicates radians

### LatLonPoint

    public LatLonPoint(LatLonPoint pt)

  Copy construct a LatLonPoint.

Parameters:
  `pt` - LatLonPoint

### LatLonPoint

    public LatLonPoint(double lat,
                       double lon)

  Construct a LatLonPoint from raw double lat/lon.

Parameters:
  `lat` - latitude in decimal degrees
  `lon` - longitude in decimal degrees

Method Detail

### toString

    public java.lang.String toString()

  Returns a string representation of the object.

  Returns:
    String representation

### clone

    public java.lang.Object clone()

  Clone the LatLonPoint.

  Returns:
    clone

### setLatitude

    public void setLatitude(float lat)

  Set latitude.

  Parameters:
    `lat` - latitude in decimal degrees

### setLongitude

    public void setLongitude(float lon)

  Set longitude.

  Parameters:
    `lon` - longitude in decimal degrees

### setLatLon

    public void setLatLon(float lat,
                          float lon)

  Set latitude and longitude.

  Parameters:
    `lat` - latitude in decimal degrees
    `lon` - longitude in decimal degrees

### setLatLon

    public void setLatLon(float lat,
                          float lon,
                          boolean isRadian)

  Set latitude and longitude.

  Parameters:
    `lat` - latitude in radians
    `lon` - longitude in radians
    `isRadian` - placeholder indicates radians

### setLatLon

    public void setLatLon(LatLonPoint llpt)

  Set LatLonPoint.

  Parameters:
    `llpt` - LatLonPoint

### getLatitude

    public float getLatitude()

  Get normalized latitude.

  Returns:
    float latitude in decimal degrees (−90° ≤ φ ≤ 90°)

### getLongitude

    public float getLongitude()

  Get wrapped longitude.

  Returns:
    float longitude in decimal degrees (−180° ≤ λ ≤ 180°)

### equals

    public boolean equals(java.lang.Object obj)

  Determines whether two LatLonPoints are equal.

  Parameters:
    `obj` - Object
  Returns:
    Whether the two points are equal up to a tolerance of 10 -5 degrees in latitude and longitude.

### hashCode

    public int hashCode()

  Hash the lat/lon value.

  Returns:
    int hash value

### write

    public void write(java.io.DataOutputStream s)
               throws java.io.IOException

  Write object.

  Parameters:
    `s` - DataOutputStream
  Throws:
    `java.io.IOException`

### read

    public void read(java.io.DataInputStream s)
              throws java.io.IOException

  Read object. Assumes that the floats read off the stream will be in decimal degrees. Latitude read off the stream first, then longitude.

  Parameters:
    `s` - DataInputStream
  Throws:
    `java.io.IOException`

### read

    public void read(java.io.DataInputStream s,
                     boolean inRadians)
              throws java.io.IOException

  Read object. Latitude read off the stream first, then longitude.

  Parameters:
    `s` - DataInputStream
    `inRadians` - if true, the floats read off stream will be considered to be radians. Otherwise, they will be considered to be decimal degrees.
  Throws:
    `java.io.IOException`

### normalize_latitude

    public static final float normalize_latitude(float lat)

  Sets latitude to something sane.

  Parameters:
    `lat` - latitude in decimal degrees
  Returns:
    float normalized latitude in decimal degrees (−90° ≤ φ ≤ 90°)

### wrap_longitude

    public static final float wrap_longitude(float lon)

  Sets longitude to something sane.

  Parameters:
    `lon` - longitude in decimal degrees
  Returns:
    float wrapped longitude in decimal degrees (−180° ≤ λ ≤ 180°)

### isInvalidLatitude

    public static boolean isInvalidLatitude(float 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(float 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

### getPoint

    public LatLonPoint getPoint(float dist,
                                float az)

  Find a LatLonPoint a distance and direction away from this point, based on the sphercal earth model.

  Parameters:
    `dist` - distance, in radians.
    `az` - radians of azimuth (direction) east of north (-PI <= Az < PI)
  Returns:
    LatLonPoint result

### distance

    public float distance(LatLonPoint toPoint)

  Find the distance to another LatLonPoint, based on a earth spherical model.

  Parameters:
    `toPoint` - LatLonPoint
  Returns:
    distance, in radians. You can use an com.bbn.openmap.proj.Length to convert the radians to other units.

### azimuth

    public float azimuth(LatLonPoint toPoint)

  Find the azimuth to another point, based on the sphercal earth model.

  Parameters:
    `toPoint` - LatLonPoint
  Returns:
    the azimuth `Az' east of north from this point bearing toward the one provided as an argument.(-PI <= Az <= PI).

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details