com.c5corp.c5gps.filters
Class CsvWayPointListFilter

java.lang.Object
  extended by com.c5corp.c5gps.filters.CsvWayPointListFilter
All Implemented Interfaces:
GpsDataFilter

public class CsvWayPointListFilter
extends java.lang.Object
implements GpsDataFilter

The CsvWayPointListFilter functions both as an input and output filter to read and write standard GPS waypoint .csv files. Importantly, this filter really does filter any data input from a track log file. It is a little bit fascist, in fact, forcibly:

  1. converting any vertical units to those configured for the installed C5UTM database (C5 Landscape database) for both input, processing, and output (only dealing with feet and meters)
  2. Rounding the easting, northing and elevation data to integers.
  3. Rejecting any data if it does not match the configured datum for the installed database
  4. Uses the zoneOffset data in the waypoint file to convert all time into UTC (GMT).

The data is massaged in this maner because this class is intended to support i/o for a C5 Landscape Database (C5UTM) installation, thus units and datum are validated. For example, all altitude data from the file will automatically converted to the vertial elevation units configured in the database application. (See com.c5corp.c5utm.C5UTMconfs for more info). The readFile() method of this class will abort on datum mismatches. The writeFile() method of this class will refuse to output any WayPoints that do not conform.

Since:
2.0
Author:
Brett Stalbaum Copyright 2002-2006 see LICENSE.txt and UCSD_LICENSE.txt
See Also:
C5UTMconfs, writeFile(GpsDataFileType), readFile()

Constructor Summary
CsvWayPointListFilter(java.io.File file)
          Constructor creates a CsvWayPointLogFilter .
 
Method Summary
 WayPointList readFile()
          Reads in a GPS track log file in standard .csv format
 void setFile(java.io.File file)
          Sets the file for this filter to filter
 java.lang.String toString(GpsDataFileType dataOb)
          implements toString(GpsDataFileType dataOb), returning a String representation of the data object filtered by this type.
 void writeFile(GpsDataFileType dataOb)
          The use of this method is fairly straight forward.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvWayPointListFilter

public CsvWayPointListFilter(java.io.File file)
Constructor creates a CsvWayPointLogFilter . The file should point to a text .csv tracklog file of the type exported from the gps2win utility.

Parameters:
file - a File object representing the .csv wapoint file
Method Detail

setFile

public void setFile(java.io.File file)
Sets the file for this filter to filter

Specified by:
setFile in interface GpsDataFilter
Parameters:
file - the output file to which data should be sent
See Also:
GpsDataFilter.writeFile(GpsDataFileType)

readFile

public WayPointList readFile()
Reads in a GPS track log file in standard .csv format

Specified by:
readFile in interface GpsDataFilter
Returns:
a GpsDataFileType representing the data read from the file

writeFile

public void writeFile(GpsDataFileType dataOb)
The use of this method is fairly straight forward. The only hitch is that whatever WayPoint is the first one found in the Enumeration will be used to determine the version, datum and zone offset. If subsequent records do not match, they will simply be ignored.

Specified by:
writeFile in interface GpsDataFilter
Parameters:
dataOb - the object containing the data to write to the file
See Also:
GpsDataFilter.setFile(File)

toString

public java.lang.String toString(GpsDataFileType dataOb)
implements toString(GpsDataFileType dataOb), returning a String representation of the data object filtered by this type.

Specified by:
toString in interface GpsDataFilter
Parameters:
dataOb - the dataOb to Stringify
Returns:
a String representation of the data in dataOb