Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.proj.coords
Class DMSLatLonPoint

    java.lang.Object
      com.bbn.openmap.proj.coords.DMSLatLonPoint

All Implemented Interfaces:
  java.lang.Cloneable

public class DMSLatLonPoint
extends java.lang.Object
implements java.lang.Cloneable

Encapsulates a latitude and longitude coordinate in degrees, minutes and seconds as well as the sign.

Original code contributed by Colin Mummery (colin_mummery@yahoo.com)

Field Summary
`int` | `lat_degrees` The number of degrees in the latitude.
`boolean` | `lat_isnegative` Indicates if the latitude is negative, the actual int values are always positive.
`int` | `lat_minutes` The number of minutes in the latitude.
`float` | `lat_seconds` The number of seconds in the latitude.
`int` | `lon_degrees` The number of degrees in the longitude.
`boolean` | `lon_isnegative` Indicates if the longitude is negative, the actual int values are always positive.
`int` | `lon_minutes` The number of minutes in the longitude.
`float` | `lon_seconds` The number of seconds in the longitude.

Constructor Summary
`DMSLatLonPoint()` Construct a default LatLonPoint with zero values.
`DMSLatLonPoint(boolean lat_isnegative, int lat_degrees, int lat_minutes, float lat_seconds, boolean lon_isnegative, int lon_degrees, int lon_minutes, float lon_seconds)` Construct a DMSLatLonPoint from raw int lat/lon.
`DMSLatLonPoint(LatLonPoint llp)` Constructs a new DMSLatLonPoint given a LatLonPoint instance

Method Summary
`java.lang.Object` | `clone()` Clone the DMSLatLonPoint.
`boolean` | `equals(java.lang.Object obj)` Determines whether two DMSLatLonPoints are exactly equal.
`float` | `getDecimalLatitude()` Returns the latitude as decimal degrees.
`float` | `getDecimalLongitude()` Returns the longitude as decimal degrees.
`LatLonPoint` | `getLatLonPoint()` Return a LatLonPoint from this DMSLatLonPoint.
`LatLonPoint` | `getLatLonPoint(LatLonPoint llp)` Return a LatLonPoint from this DMSLatLonPoint.
`int` | `hashCode()` Generate a hash value for the point.
`static float` | `normalize_value(float val)` Sets the minutes and seconds to something sane.
`static int` | `normalize_value(int val)` Sets the minutes and seconds to something sane.
`void` | `setDMSLatLon(DMSLatLonPoint llpt)` Set DMSLatLonPoint.
`java.lang.String` | `toString()` Returns a string representation of the object.

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

Field Detail

### lat_isnegative

    public boolean lat_isnegative

  Indicates if the latitude is negative, the actual int values are always positive.

### lat_degrees

    public int lat_degrees

  The number of degrees in the latitude.

### lat_minutes

    public int lat_minutes

  The number of minutes in the latitude.

### lat_seconds

    public float lat_seconds

  The number of seconds in the latitude.

### lon_isnegative

    public boolean lon_isnegative

  Indicates if the longitude is negative, the actual int values are always positive.

### lon_degrees

    public int lon_degrees

  The number of degrees in the longitude.

### lon_minutes

    public int lon_minutes

  The number of minutes in the longitude.

### lon_seconds

    public float lon_seconds

  The number of seconds in the longitude.

Constructor Detail

### DMSLatLonPoint

    public DMSLatLonPoint()

  Construct a default LatLonPoint with zero values.

### DMSLatLonPoint

    public DMSLatLonPoint(boolean lat_isnegative,
                          int lat_degrees,
                          int lat_minutes,
                          float lat_seconds,
                          boolean lon_isnegative,
                          int lon_degrees,
                          int lon_minutes,
                          float lon_seconds)

  Construct a DMSLatLonPoint from raw int lat/lon. All parameters are checked for their validity.

Parameters:
  `lat_isnegative` - boolean value indicating the sign of the latitude
  `lat_degrees` - integer number of degrees in latitude
  `lat_minutes` - integer number of minutes in latitude
  `lat_seconds` - float number of seconds in latitude
  `lon_isnegative` - boolean value indicating the sign of the longitude
  `lon_degrees` - integer number of degrees in longitude
  `lon_minutes` - integer number of minutes in longitude
  `lon_seconds` - float number of seconds in longitude

### DMSLatLonPoint

    public DMSLatLonPoint(LatLonPoint llp)

  Constructs a new DMSLatLonPoint given a LatLonPoint instance

Parameters:
  `llp` - A LatLonPoint instance

Method Detail

### getLatLonPoint

    public LatLonPoint getLatLonPoint()

  Return a LatLonPoint from this DMSLatLonPoint. The LatLonPoint is allocated here.

  Returns:
    LatLonPoint, full of decimal degrees.

### getLatLonPoint

    public LatLonPoint getLatLonPoint(LatLonPoint llp)

  Return a LatLonPoint from this DMSLatLonPoint. The LatLonPoint is allocated here if the llp is null. If it's not null, then the llp is loaded with the proper values.

  Parameters:
    `llp` - the LatLonPoint to load up.
  Returns:
    LatLonPoint, full of decimal degrees.

### getDecimalLatitude

    public float getDecimalLatitude()

  Returns the latitude as decimal degrees.

  Returns:
    A float value for the latitude

### getDecimalLongitude

    public float getDecimalLongitude()

  Returns the longitude as decimal degrees.

  Returns:
    A float value for the longitude

### toString

    public java.lang.String toString()

  Returns a string representation of the object.

  Returns:
    String representation

### setDMSLatLon

    public void setDMSLatLon(DMSLatLonPoint llpt)

  Set DMSLatLonPoint. Sets the current instance values to be the same as another DMSLatLonPoint instance.

  Parameters:
    `llpt` - DMSLatLonPoint

### clone

    public java.lang.Object clone()

  Clone the DMSLatLonPoint.

  Returns:
    clone

### equals

    public boolean equals(java.lang.Object obj)

  Determines whether two DMSLatLonPoints are exactly equal.

  Parameters:
    `obj` - Object
  Returns:
    boolean

### normalize_value

    public static final int normalize_value(int val)

  Sets the minutes and seconds to something sane.

  Parameters:
    `val` - an int value for the minutes or seconds
  Returns:
    int value normalized

### normalize_value

    public static final float normalize_value(float val)

  Sets the minutes and seconds to something sane.

  Parameters:
    `val` - an float value for the minutes or seconds
  Returns:
    float value normalized

### hashCode

    public int hashCode()

  Generate a hash value for the point. Hash by spreading the values across a 32 bit int, ignoring the sign allow 8 bits (max 255) for degrees, 7 bits (max 127) for (minutes + seconds) so the total is 30 bits.

  Returns:
    An int hash value representing the point.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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