courselog.gpsutils
Class TrackRecord

java.lang.Object
  extended by courselog.gpsutils.TrackRecord

public class TrackRecord
extends java.lang.Object

A GPS track. Mainly used to write tracking records into a file, read back those log files into a vector and write them into GPX format. TODO : Read a GPX file?


Field Summary
static int OPTION_ENDTRACK
          Option to read file keeping only the end of the track.
static int OPTION_SEPARATETRACK
          Option to read file in a separate track.
static int OPTION_SINGLETRACK
          Option to read file in a single track.
 ewe.util.Vector vPoints
          GPS points serie.
 
Constructor Summary
TrackRecord()
          Creates a new instance of TrackRecord empty track.
 
Method Summary
static boolean isValidTrackLog(java.lang.String s)
          Check if a string can be interpreted as a TrackPoint log line.
 void makeOneTrack()
          Convert a set of Track points into a single track.
 ewe.util.Vector makeSplitTracks()
          Convert a TrackRecord consisting in non-consecutive points into set of tracks.
static TrackRecord readLogFile(ewe.io.File fLog, TrackRecord tr, int cutOption)
          Read a log file into a new TrackRecord object.
 void reCompute()
          Recompute tracks points in terms of UTM coordinates from Lat, Lon values.
 void reverse()
          Invert the direction of this TrackRecord.
 boolean writeLogFile(ewe.io.File fLog)
          Writes a TrackRecord object into a log file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_SINGLETRACK

public static final int OPTION_SINGLETRACK
Option to read file in a single track.

See Also:
Constant Field Values

OPTION_SEPARATETRACK

public static final int OPTION_SEPARATETRACK
Option to read file in a separate track.

See Also:
Constant Field Values

OPTION_ENDTRACK

public static final int OPTION_ENDTRACK
Option to read file keeping only the end of the track.

See Also:
Constant Field Values

vPoints

public ewe.util.Vector vPoints
GPS points serie.

Constructor Detail

TrackRecord

public TrackRecord()
Creates a new instance of TrackRecord empty track.

Method Detail

makeOneTrack

public void makeOneTrack()
Convert a set of Track points into a single track. This recomputes the time between points, the difference in altitudes and the difference in distance to generate the logged values.


reCompute

public void reCompute()
Recompute tracks points in terms of UTM coordinates from Lat, Lon values.


reverse

public void reverse()
Invert the direction of this TrackRecord. The vector is in reverse order.


makeSplitTracks

public ewe.util.Vector makeSplitTracks()
Convert a TrackRecord consisting in non-consecutive points into set of tracks. This takes as a reference the time between points and assumes that a new track should be generated each time the track point time is back to 0. Current TrackRecord object is unchanged.

Returns:
a vector of TrackRecord elements. null if there is only one track in the current track object.

readLogFile

public static TrackRecord readLogFile(ewe.io.File fLog,
                                      TrackRecord tr,
                                      int cutOption)
Read a log file into a new TrackRecord object. Returns null if a read error occured. The whole log file is read into the vector of this track, further post-processing s needed to cut the track into several tracks if the log contains several tracks or the re-compute the points values to generate a continuous track.

Parameters:
fLog - Log file to read.
tr - TrackRecord to fill in (previous points are erased) or null if a new object is to be allocated.
cutOption - flag specifying to make the track a single one, to leave split tracks or to keep only the end.
Returns:
new TrackRecord Object containing TrackPoint objects.
See Also:
TrackPoint.readFromLogLine(String)

isValidTrackLog

public static boolean isValidTrackLog(java.lang.String s)
Check if a string can be interpreted as a TrackPoint log line. The criteria is simply that 15 commas should be present.


writeLogFile

public boolean writeLogFile(ewe.io.File fLog)
Writes a TrackRecord object into a log file. Returns false if a write error occured.

Parameters:
fLog - Log file to write.
Returns:
true if write operation completed, false otherwise.
See Also:
TrackPoint.formatInBuffer(byte[])