courselog.gpsutils
Class GeoPoint

java.lang.Object
  extended by courselog.gpsutils.GeoPoint
All Implemented Interfaces:
ewe.util.Copyable
Direct Known Subclasses:
MapReferencePoint, MeasuredPoint

public class GeoPoint
extends java.lang.Object
implements ewe.util.Copyable

Base class for a location point on Earth.


Field Summary
 double altSeaLevel
          Altitude of the location to the Mean Sea Level (m).
static double dummyAng
          Dummy angle for initialisation.
static double dummyCoord
          Dummy value to put coordinates to recognise that it was not initialise
static double ER
          Earth radius in meters.
 double lat
          Latitude in degrees (positive North).
 double lon
          Longitude in degrees (Positive East).
 double myX
          X coordinate of this point (m).
 double myY
          Y coordinate of this point (m).
 double myZ
          Z coordinate of this point (m).
 double uTMEasting
          UTM projection easting distance (m).
 char uTMLatZone
          UTM projection latitude zone (char).
 int uTMLonZone
          UTM projection longitude index.
 double uTMNorthing
          UTM projection Northing distance (m).
 
Constructor Summary
GeoPoint()
          Creates a new empty instance of GeoPoint.
 
Method Summary
 void computeCartesian()
          Compute X,Y,Z coordinates of this point from long and lat.
 void computeLatLonAlt()
          Compute lat,long, alt coordinates of this point from its X,Y,Z.
 void computeLatLonToUTMRef()
          Convert this GeoPoint latitude and longitude values to a UTM reference.
 void computeUTMtoLatLng()
          Convert UTM reference (if initialised) to latitude and longitude.
 void coordinatesIn(GeoPoint orig, GeoDirection dNorth, GeoDirection dEast, double[] dest)
          Compute point coordinates in a given vector.
 void copyFrom(java.lang.Object param)
          Copy all elements of point param into this instance.
 java.lang.String ddmmssLat()
          Converts the latitude of this point into a String.
 java.lang.String ddmmssLon()
          Converts the longitude of this point into a String.
 GeoDirection directionTo(GeoPoint pTo, GeoDirection dest)
          Compute direction vector between 2 points.
 double distance(GeoPoint pointTo)
          Calculate the surface distance in metres from this GeoPoint to the given GeoPoint.
 java.lang.String formatAlt()
          Formats the altitude of this point.
 int formatInBuffer(byte[] buff)
          Formats this track point in a buffer so that it can be written to the log.
 java.lang.Object getCopy()
          Copy all elements of this point in a new instance.
 double getLat()
           
 double getLon()
           
static char getUTMLatitudeZoneLetter(double latitude)
          Work out the UTM latitude zone from the latitude.
 double headingTo(GeoPoint pt)
          Compute heading to another point pt in degrees.
 void initialise()
          Put default (unusable values in this object so that it will be ready for reuse.
 GeoPoint moveBy(boolean setAlt0, GeoDirection d1, double c1, GeoDirection d2, double c2, GeoPoint dest)
          Compute point by translating a first one along 2 vectors.
 boolean readFromLogLine(java.lang.String logLine)
          Fill in attributes of this point from a string generated by the PositionTracer log function.
 java.lang.String toLatLonString()
          Get a Lat/Lon String representation of this GeoPoint object.
 java.lang.String toString()
          Display lat,lon as a string.
 java.lang.String toUTMString()
          Convert this point UTM reference to a String representation for printing out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ER

public static double ER
Earth radius in meters.


dummyCoord

public static double dummyCoord
Dummy value to put coordinates to recognise that it was not initialise. =1E10, Somewhere in space!


dummyAng

public static double dummyAng
Dummy angle for initialisation. Equals 1E10, it should not happen. Use this value to tell the (lat,lon,alt) of the point is uninitialised.


altSeaLevel

public double altSeaLevel
Altitude of the location to the Mean Sea Level (m).


lat

public double lat
Latitude in degrees (positive North).


lon

public double lon
Longitude in degrees (Positive East).


myX

public double myX
X coordinate of this point (m).

See Also:
computeCartesian()

myY

public double myY
Y coordinate of this point (m).


myZ

public double myZ
Z coordinate of this point (m).


uTMEasting

public double uTMEasting
UTM projection easting distance (m).

See Also:
computeUTMtoLatLng()

uTMNorthing

public double uTMNorthing
UTM projection Northing distance (m).


uTMLatZone

public char uTMLatZone
UTM projection latitude zone (char).


uTMLonZone

public int uTMLonZone
UTM projection longitude index.

Constructor Detail

GeoPoint

public GeoPoint()
Creates a new empty instance of GeoPoint. The new point is initialised.

Method Detail

getLat

public double getLat()

getLon

public double getLon()

initialise

public void initialise()
Put default (unusable values in this object so that it will be ready for reuse.


getCopy

public java.lang.Object getCopy()
Copy all elements of this point in a new instance. The measured time is also copied in a new Time object.

Specified by:
getCopy in interface ewe.util.Copyable
Returns:
New GeoPoint with identical data
See Also:
Copyable.getCopy()

copyFrom

public void copyFrom(java.lang.Object param)
Copy all elements of point param into this instance.

Parameters:
param - Point to copy from.

distance

public double distance(GeoPoint pointTo)
Calculate the surface distance in metres from this GeoPoint to the given GeoPoint.

Parameters:
pointTo - Point towards the distance is computed.
Returns:
the surface distance in m
Since:
1.0

computeUTMtoLatLng

public void computeUTMtoLatLng()
Convert UTM reference (if initialised) to latitude and longitude.


getUTMLatitudeZoneLetter

public static char getUTMLatitudeZoneLetter(double latitude)
Work out the UTM latitude zone from the latitude.

Parameters:
latitude - the latitude to find the UTM latitude zone for
Returns:
the UTM latitude zone for the given latitude
Since:
1.0

computeLatLonToUTMRef

public void computeLatLonToUTMRef()
Convert this GeoPoint latitude and longitude values to a UTM reference.

Since:
1.0

computeLatLonAlt

public void computeLatLonAlt()
Compute lat,long, alt coordinates of this point from its X,Y,Z.

Since:
1.0

computeCartesian

public void computeCartesian()
Compute X,Y,Z coordinates of this point from long and lat.

Since:
1.0

headingTo

public double headingTo(GeoPoint pt)
Compute heading to another point pt in degrees. Value is between 0° and 360°.

Parameters:
pt - Point for which the direction is computed.
Returns:
Heading in degrees.

moveBy

public GeoPoint moveBy(boolean setAlt0,
                       GeoDirection d1,
                       double c1,
                       GeoDirection d2,
                       double c2,
                       GeoPoint dest)
Compute point by translating a first one along 2 vectors. This method is re-entrant : it can be applied to a point which is also the result of the operation: x=x.moveBy(2,3,x) is valid.


coordinatesIn

public void coordinatesIn(GeoPoint orig,
                          GeoDirection dNorth,
                          GeoDirection dEast,
                          double[] dest)
Compute point coordinates in a given vector. Puts results in table dest which must have 2 places.


directionTo

public GeoDirection directionTo(GeoPoint pTo,
                                GeoDirection dest)
Compute direction vector between 2 points.

Parameters:
pTo - point TO.
dest - GeoDirection reference to put result in. If null a new object is allocated.
Returns:
Computed direction. Should be dest or a new GeoPoint object.

toUTMString

public java.lang.String toUTMString()
Convert this point UTM reference to a String representation for printing out.

Returns:
a String representation of this GeoPoint
Since:
1.0

toLatLonString

public java.lang.String toLatLonString()
Get a Lat/Lon String representation of this GeoPoint object.

Returns:
a Lat/Lon String representation of this GeoPoint object.
Since:
1.0

ddmmssLat

public java.lang.String ddmmssLat()
Converts the latitude of this point into a String.

Returns:
Formatted latitude.
See Also:
Converters.ddmmss(double,int)

ddmmssLon

public java.lang.String ddmmssLon()
Converts the longitude of this point into a String.

Returns:
Fromatted longitude.
See Also:
Converters.ddmmss(double,int)

formatAlt

public java.lang.String formatAlt()
Formats the altitude of this point.

Returns:
Formatted altitude.
See Also:
Converters.formatAltitude(double)

toString

public java.lang.String toString()
Display lat,lon as a string.

Overrides:
toString in class java.lang.Object

formatInBuffer

public int formatInBuffer(byte[] buff)
Formats this track point in a buffer so that it can be written to the log. Values are formatted in order to be readable as csv values.

Parameters:
buff - buffer to write in.
Returns:
Length of the formatted values in the buffer.

readFromLogLine

public boolean readFromLogLine(java.lang.String logLine)
Fill in attributes of this point from a string generated by the PositionTracer log function.

Parameters:
logLine - Input string to interpret.
Returns:
true if the string looks correct, false otherwise.