|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object courselog.gpsutils.PositionTracer
public class PositionTracer
Traces the position obtained by a SerialGPSConnection into a logging file. Also provides calculations of the current duration, cumulative distance, average speed, average heading. About PositionTracer status : STATUS_OFF : The tracer is off, no recording. STATUS_RECORDING : The tracer is recording ReceiverEvents and generating trace. STATUS_HOLD : The tracer is on hold. If it restarts, a new Receiver may be activated, anyway, old records will be kept. Useful when the recorder is activated from time to time. STATUS_PAUSED : The tracer is not recording. Moves are not considered part of the trace. Useful when you are stopping your treck and want to make moves that are not interesting to record.
Field Summary | |
---|---|
protected byte[] |
buff
Static buffer where logged data is written (256 chars). |
java.lang.String |
fileLogName
Name of the logging file. |
ewe.io.FileOutputStream |
fLog
Logging file. |
protected boolean |
isNextLogForced
Flag to force next point to be logged, whatever the state. |
protected boolean |
isOutOfPause
Flag indicating that next update of trace should consider that it is out of pause mode. |
protected double |
lastDownwards
Last downwards value taken for reference. |
double |
lastReferenceAltitude
Previous reference altitude. |
TrackPoint |
lastSignificantPoint
Previous point, spaced at least by minDistance from current point. |
protected double |
lastUpwards
Last upwards value taken for reference. |
double |
minAltitudeDifference
Minimum altitude to count difference points. |
double |
minDistance
Minimum distance between logged points. |
TrackPoint |
myCurrent
Current point of the trace. |
SerialGPSConnection |
myGPS
Connected GPS receiver. |
int |
myStatus
PositionTracer status, see constants. |
TrackRecord |
myTrack
Record of the current. |
static int |
OPT_STATUSCHANGED
Option indicating that the receiver state has changed |
static int |
OPT_TRACECHANGED
Option indicating that the track has changed |
static int |
STATUS_HOLD
Status when PositionTracer is on hold (==2). |
static int |
STATUS_OFF
Status when PositionTracer is not active (==0). |
static int |
STATUS_PAUSED
Status when PositionTracer is paused (==3). |
static int |
STATUS_RECORDING
Status when PositionTracer is not recording (==1). |
protected ewe.util.Vector |
vDisplayer
Event Listener when state of the Tracer changes. |
Constructor Summary | |
---|---|
PositionTracer(SerialGPSConnection sGPS,
int newStatus,
java.lang.String logName)
Creates a new instance of PositionTracer with a logging file |
Method Summary | |
---|---|
void |
addDisplayer(XPositionDisplayer newDisp)
Add a position displayer to this tracer. |
int |
getGPSStatus()
The status of the GPS receiver. |
void |
initFromStateAndLog(int newStatus,
java.lang.String log)
Read initial attributes of this PositionTracer from a buffer content. |
void |
logAPoint(TrackPoint pt)
Writes a point in the logging file. |
void |
onEvent(ewe.ui.Event rEv)
Activated when a ReceiverEvent is generated by the GPS. |
void |
removeDisplayer(XPositionDisplayer newDisp)
Remove a position displayer to this tracer. |
void |
setLogFileName(java.lang.String newName)
Set the log file name. |
void |
setStatus(int newStatus)
Change the status of the tracer. |
boolean |
updateTrace(MeasuredPoint pt)
Called when a new event is received and tracer is not off, in order to update the tracer state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public SerialGPSConnection myGPS
protected ewe.util.Vector vDisplayer
public ewe.io.FileOutputStream fLog
protected byte[] buff
public static final int STATUS_OFF
public static final int STATUS_RECORDING
public static final int STATUS_HOLD
public static final int STATUS_PAUSED
public int myStatus
public static final int OPT_STATUSCHANGED
public static final int OPT_TRACECHANGED
public TrackRecord myTrack
public TrackPoint myCurrent
public TrackPoint lastSignificantPoint
public double lastReferenceAltitude
protected double lastUpwards
protected double lastDownwards
protected boolean isOutOfPause
protected boolean isNextLogForced
public double minDistance
public double minAltitudeDifference
public java.lang.String fileLogName
Constructor Detail |
---|
public PositionTracer(SerialGPSConnection sGPS, int newStatus, java.lang.String logName)
sGPS
- GPS receiver associated to this trace.newStatus
- The status in case this tracer is created after another one.logName
- Name of the file where the log should be placed. If null, no file is written.Method Detail |
---|
public void setLogFileName(java.lang.String newName)
newName
- New log file name.public void setStatus(int newStatus)
newStatus
- Should be one of STATUS_XXX values.public int getGPSStatus()
public void initFromStateAndLog(int newStatus, java.lang.String log)
Significant fields are : - Date - Time (UTC) - Latitude - Longitude - Altitude - Total distance - Total time - Total up - Total downA small discripancy in the usage of this hold mode : last reference altitude is the one from the last logged point, as, in continuous mode, it is the one from the last altitude used in reference.
newStatus
- New value of status for the tracer.log
- Buffer from which we read in values.public void onEvent(ewe.ui.Event rEv)
onEvent
in interface ewe.ui.EventListener
rEv
- Event from the GPS.public void addDisplayer(XPositionDisplayer newDisp)
newDisp
- New displayer to add.public void removeDisplayer(XPositionDisplayer newDisp)
newDisp
- Displayer to remove.public boolean updateTrace(MeasuredPoint pt)
pt
- New point to take into account.
public void logAPoint(TrackPoint pt)
pt
- Point to put in the log.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |