com.partnersoft.v3x.geometry.projections
Class CircularCoord

java.lang.Object
  extended by com.partnersoft.v3x.geometry.projections.CircularCoord
All Implemented Interfaces:
java.io.Serializable

public class CircularCoord
extends java.lang.Object
implements java.io.Serializable

High-precision representation of a circular coordinate such as latitude or longitude.

Degrees are represented as signed shorts; coordinates in the western or southern hemisphere are negative while those in the eastern or northern hemisphere are positive.

Minutes and seconds are represented as unsigned bytes, and fractions of a second by a single unsigned int.

This should provide a ridiculous amount of precision in only 8 bytes, the size of a double - something like a precision of a hundred millionth of a foot, in case someone really cares.

See Also:
Serialized Form

Constructor Summary
CircularCoord(int degrees, double decMinutes)
           
CircularCoord(int degrees, int minutes, double decSeconds)
           
CircularCoord(int degrees, int minutes, int seconds, int fracts)
           
 
Method Summary
 java.lang.Object clone()
           
 CircularCoord copy()
           
 CircularCoord distanceFrom(CircularCoord nother)
           
static short fixDegrees(int degrees)
          Fixes degrees to correct range of -180 to +180.
static byte fixMinutes(int minutes)
          Fixes minutes to correct range of 0 to 59.
static byte fixSeconds(int seconds)
          Just for symmetry's sake
 double getDecimalDegrees()
           
 double getDecimalMinutes()
           
 double getDecimalSeconds()
           
 short getDegrees()
           
 int getFracts()
           
 byte getMinutes()
           
 byte getSeconds()
           
static long packCoord(CircularCoord coord)
          Packs a coordinate into 8 bytes (represented as a long).
 void setDegrees(short argDegrees)
           
 void setFracts(int argFracts)
           
 void setMinutes(byte argMinutes)
           
 void setSeconds(byte argSeconds)
           
 java.lang.String toString()
           
static CircularCoord unpackCoord(long packed)
          Unpacks coordinates from 8-byte long representation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CircularCoord

public CircularCoord(int degrees,
                     int minutes,
                     int seconds,
                     int fracts)

CircularCoord

public CircularCoord(int degrees,
                     double decMinutes)

CircularCoord

public CircularCoord(int degrees,
                     int minutes,
                     double decSeconds)
Method Detail

packCoord

public static long packCoord(CircularCoord coord)
Packs a coordinate into 8 bytes (represented as a long).


unpackCoord

public static CircularCoord unpackCoord(long packed)
Unpacks coordinates from 8-byte long representation.


fixDegrees

public static short fixDegrees(int degrees)
Fixes degrees to correct range of -180 to +180.


fixMinutes

public static byte fixMinutes(int minutes)
Fixes minutes to correct range of 0 to 59.


fixSeconds

public static byte fixSeconds(int seconds)
Just for symmetry's sake


distanceFrom

public CircularCoord distanceFrom(CircularCoord nother)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

copy

public CircularCoord copy()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getDecimalDegrees

public final double getDecimalDegrees()

getDecimalMinutes

public final double getDecimalMinutes()

getDecimalSeconds

public final double getDecimalSeconds()

getDegrees

public short getDegrees()

setDegrees

public void setDegrees(short argDegrees)

getMinutes

public byte getMinutes()

setMinutes

public void setMinutes(byte argMinutes)

getSeconds

public byte getSeconds()

setSeconds

public void setSeconds(byte argSeconds)

getFracts

public int getFracts()

setFracts

public void setFracts(int argFracts)