courselog.gpsutils
Class ExporterToGPX

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

public class ExporterToGPX
extends java.lang.Object

Object to export a track into a GPX format. The object is associated to the TrackRecord or Vector of TrackRecords object to write.


Field Summary
protected  TrackRecord myTr
          Track record to convert to KML.
protected  ewe.util.Vector myVect
          Vector of records to convert to KML tracks.
static byte[] sXCData
          close CDATA
static byte[] sXCEle
          close Elevation
static byte[] sXCGPXHead
          End of GPX
static byte[] sXCName
          close Name
static byte[] sXCNum
          close Number
static byte[] sXCPoint
          close Point
static byte[] sXCSegment
          close Segment
static byte[] sXCSym
          close Symbol
static byte[] sXCTime
          close Time
static byte[] sXCTrack
          close Track
static byte[] sXI2Point
          Intermediate 2 of Track Point
static byte[] sXIPoint
          Intermediate of Track Point
static byte[] sXSCData
          Header of CDATA
static byte[] sXSEle
          Header of Elevation
static byte[] sXSGPXHead
          Header of GPX
static byte[] sXSHead
          Header of XML
static byte[] sXSName
          Header of Name
static byte[] sXSNum
          Header of Number
static byte[] sXSPoint
          Header of Track Point
static byte[] sXSSegment
          Header of Segment
static byte[] sXSSym
          Header of Symbol
static byte[] sXSTime
          Header of Time
static byte[] sXSTrack
          Header of Track
 
Constructor Summary
ExporterToGPX(TrackRecord track)
          Creates a new instance of ExporterToGPX.
ExporterToGPX(ewe.util.Vector vect)
          Creates a new instance of ExporterToGPX.
 
Method Summary
 void exportToFile(ewe.io.File fOut, int dataFlag)
          Export track(s) to a file.
 int formatAltitude(byte[] buf, double val)
          Format the altitude value in the buffer.
 int formatDate(byte[] buf, ewe.sys.Time tm)
          Format a date and time into the buffer buf.
 int formatIdxTrack(byte[] buf, int idx)
          Format an index into the buffer. used for point or track index.
 int formatLatOrLon(byte[] buf, double val)
          Format latitude or longitude value.
 int formatSpeed(byte[] buf, double val)
          Format the speed value in the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sXSHead

public static final byte[] sXSHead
Header of XML


sXSGPXHead

public static final byte[] sXSGPXHead
Header of GPX


sXCGPXHead

public static final byte[] sXCGPXHead
End of GPX


sXSTrack

public static final byte[] sXSTrack
Header of Track


sXCTrack

public static final byte[] sXCTrack
close Track


sXSName

public static final byte[] sXSName
Header of Name


sXCName

public static final byte[] sXCName
close Name


sXSCData

public static final byte[] sXSCData
Header of CDATA


sXCData

public static final byte[] sXCData
close CDATA


sXSNum

public static final byte[] sXSNum
Header of Number


sXCNum

public static final byte[] sXCNum
close Number


sXSSegment

public static final byte[] sXSSegment
Header of Segment


sXCSegment

public static final byte[] sXCSegment
close Segment


sXSPoint

public static final byte[] sXSPoint
Header of Track Point


sXIPoint

public static final byte[] sXIPoint
Intermediate of Track Point


sXI2Point

public static final byte[] sXI2Point
Intermediate 2 of Track Point


sXCPoint

public static final byte[] sXCPoint
close Point


sXSEle

public static final byte[] sXSEle
Header of Elevation


sXCEle

public static final byte[] sXCEle
close Elevation


sXSTime

public static final byte[] sXSTime
Header of Time


sXCTime

public static final byte[] sXCTime
close Time


sXSSym

public static final byte[] sXSSym
Header of Symbol


sXCSym

public static final byte[] sXCSym
close Symbol


myTr

protected TrackRecord myTr
Track record to convert to KML.


myVect

protected ewe.util.Vector myVect
Vector of records to convert to KML tracks.

Constructor Detail

ExporterToGPX

public ExporterToGPX(TrackRecord track)
Creates a new instance of ExporterToGPX. Initialises with a single track.

Parameters:
track - Track to convert.

ExporterToGPX

public ExporterToGPX(ewe.util.Vector vect)
Creates a new instance of ExporterToGPX. Initialise with a vector of TrackRecord elements.

Parameters:
vect - Tracks to convert.
Method Detail

exportToFile

public void exportToFile(ewe.io.File fOut,
                         int dataFlag)
Export track(s) to a file.
 Values are exported in international units :
 time = UTC
 alt = m
 

Parameters:
fOut - File to write to.
dataFlag - Identification of data to associate.

formatAltitude

public int formatAltitude(byte[] buf,
                          double val)
Format the altitude value in the buffer.

Parameters:
buf - Buffer where to write the formatted value, with 7 elements as a minimum.
val - Altitude value to put in the formatted buffer.
Returns:
Numer of characters formatted in the buffer.

formatDate

public int formatDate(byte[] buf,
                      ewe.sys.Time tm)
Format a date and time into the buffer buf. Notice that the first character in the buffer is a whitespace (sign of year value), so skip it if you don't want it. The format is :
yyyy-mm-ddThh:mi:ssZ

Parameters:
buf - Buffer where to write the formatted value, with 21 elements as a minimum.
tm - Time value to put in the formatted buffer.
Returns:
Numer of characters formatted in the buffer.

formatSpeed

public int formatSpeed(byte[] buf,
                       double val)
Format the speed value in the buffer.

Parameters:
buf - Buffer where to write the formatted value, with 6 elements as a minimum.
val - Speed value to put in the formatted buffer.
Returns:
Numer of characters formatted in the buffer.

formatLatOrLon

public int formatLatOrLon(byte[] buf,
                          double val)
Format latitude or longitude value.

Parameters:
buf - Buffer where to write the formatted value, with 11 elements as a minimum.
val - Lat(Long)itude value to put in the formatted buffer.
Returns:
Numer of characters formatted in the buffer.

formatIdxTrack

public int formatIdxTrack(byte[] buf,
                          int idx)
Format an index into the buffer. used for point or track index.

Parameters:
buf - Buffer where to write the formatted value, with 5 elements as a minimum.
idx - index value to put in the formatted buffer.
Returns:
Numer of characters formatted in the buffer.