Global Positioning System Reference
In-Depth Information
A Node is a general type that can hold different pieces of content. The
org.w3c.dom.Document class represents an XML document and is made up
of DOM nodes.
The basic functionality can be found in 8
public boolean loadGPXfile( File gpxFile )
{
Document traceDOM = loadGPX2DOM( gpxFile );
:
parseDOM( traceDOM )
:
extractGPXtraces( trkNodes );
:
}
4.13
Play Back a GPStrace
After a GPX file is loaded into a GPStrace , the GPSunit replays the trace
with the first GPSinfo marking the beginning of the playback. The GPS
clock will not be set to the time stamps of the GPX trace implicitly. The
client of the GPSunit needs to set the clock to the environmental time ex-
plicitly (and usually only once in a lifetime).
The private method simulateMove developed earlier can be used to start
a motion with constant speed and constant direction. The simulation can
supply a getGPSinfo at any time. Replaying a GPS trace is simply a re-
peated call of this method|with precise timing.
To replay a trace as precisely as possible, a ReplayThread is created.
To replay a trace means looping through its elements and simulating the
move from one element to the next. The replay is started with the public
method 9
public void replayGPStrace( GPStrace trace )
{
:
new Thread(new ReplayThread(), mode.toString()).start();
}
which calculates speed and direction, executes a simulateMove and stops
the motion ( speed=0 ) at the end of the trace.
4.14
The GPS Package: roaf.gps
The GPS package now has classes and interfaces to deal with geographical
coordinates and universal time (see Figure 4.1).
Before progressing to
8 See gpsUnitDemo(): gpsDevice.loadGPXfile( new File( nameIn )).
9 See gpsUnitDemo(): gpsDevice.replayGPStrace( gpsTrace ).
 
Search WWH ::




Custom Search