GPS
Class GPSDataBlock

java.lang.Object
  extended by PamguardMVC.PamObservable
      extended by PamguardMVC.PamDataBlock<GpsDataUnit>
          extended by GPS.GPSDataBlock
All Implemented Interfaces:
NMEAEmulator, PanelOverlayDraw

public class GPSDataBlock
extends PamDataBlock<GpsDataUnit>
implements NMEAEmulator

Add a bit of extra functionality to GPSDataBlock so that it can check new GPS data are 'reasonable' and flag bad ones.

Author:
Doug

Field Summary
private  java.util.ListIterator<GpsDataUnit> emulatorIterator
           
private  long emulatorTimeOffset
           
private  ProcessNmeaData nmeaProcess
           
private  EmulatedData readyGGAData
           
private  double reasonableResetTime
          Reasonable time to wait before believing anything
private  double reasonableSpeed
          Max reasonable speed in km per hour
private  int reasonableTries
          Max number of objects to look at before deciding it's OK anyway.
 
Fields inherited from class PamguardMVC.PamDataBlock
dataName, ITERATOR_END, MATCH_AFTER, MATCH_BEFORE, MATCH_EXACT, MIX_DONOTHING, MIX_INTODATABASE, MIX_OUTOFDATABASE, naturalLifetime, NOTIFY_NEW_DATA, NOTIFY_UPDATE_DATA, OFFLINE_DATA_CANCEL, OFFLINE_DATA_INTERRUPT, OFFLINE_DATA_WAIT, orderLock, pamDataUnits, parentProcess, POSITION_AFTER, POSITION_BEFORE, REFERENCE_ABSOLUTE, REFERENCE_CURRENT, REQUEST_DATA_LOADED, REQUEST_DATA_PARTIAL_LOAD, REQUEST_EXCEPTION, REQUEST_INTERRUPTED, REQUEST_NO_DATA, REQUEST_SAME_REQUEST, unitsAdded, unitsRemoved, unitsUpdated
 
Fields inherited from class PamguardMVC.PamObservable
masterClockSample, objectChanged, overlayDraw, pamObservers, pamProfiler
 
Constructor Summary
GPSDataBlock(ProcessNmeaData nmeaProcess)
           
 
Method Summary
 void addPamData(GpsDataUnit gpsDataUnit)
          Adds a new PamDataUnit to the PamDataBlock.
 EmulatedData getNextData()
           
 boolean isReasonable(GpsDataUnit gpsDataUnit)
          Check a GPS entry is reasonable - i.e.
 boolean prepareDataSource(long[] timeLimits, long timeOffset)
          Prepare the data to be read into the emulator.
 
Methods inherited from class PamguardMVC.PamDataBlock
addLocalisationContents, addObserver, addObserver, addOfflineDataMap, autoSetDataBlockMixMode, clearAll, clearDeletedList, createAnnotations, createAnnotations, dumpBlockContents, findAnnotation, findAnnotation, findByDatabaseIndex, findDataUnit, findDataUnit, getAbsoluteDataUnit, getAnnotations, getBinaryDataSource, getCanLog, getChannelMap, getClosestUnitMillis, getCurrentViewDataEnd, getCurrentViewDataStart, getDataGain, getDataName, getDataUnit, getFirstUnit, getFirstUnitAfter, getLastUnit, getListIterator, getListIterator, getListIteratorFromEnd, getListIteratorFromStart, getLocalisationContents, getLogging, getLoggingName, getLongDataName, getMixedDirection, getNaturalLifetime, getNaturalLifetimeMillis, getNextDataStart, getNumOfflineDataMaps, getOfflineData, getOfflineData, getOfflineDataMap, getOfflineDataMap, getOrderStatus, getParentProcess, getPreceedingUnit, getPreceedingUnit, getPreceedingUnit, getPreceedingUnit, getPrevDataEnd, getPrimaryDataMap, getRawSourceDataBlock, getRecycledUnit, getRecyclingStoreLength, getRemovedItems, getSampleRate, getSaveRequirements, getShouldLog, getSourceDataBlock, getSourceProcess, getUnitClass, getUnitIndex, getUnitsCount, getUnitsCountFromTime, isLinkGpsData, isRecycling, loadViewerData, masterClockUpdate, noteNewSettings, notifyModelChanged, orderOfflineData, orderOfflineData, remove, remove, removeOldUnitsS, removeOldUnitsT, saveViewerData, setBinaryDataSource, setChannelMap, setDataName, setLinkGpsData, setLocalisationContents, SetLogging, setMixedDirection, setNaturalLifetime, setNaturalLifetimeMillis, setRecycling, setRecyclingStoreLength, setSampleRate, setShouldLog, shouldNotify, toString, updatePamData
 
Methods inherited from class PamguardMVC.PamObservable
canDraw, clearchanged, countObservers, createKeyItem, deleteObserver, deleteObservers, drawDataUnit, findThreadedObserver, getCPUPercent, getCPUPercent, getHoverText, getLongestObserver, getPamObservers, getRequiredHistory, notifyObservers, notifyObservers, setChanged, setOverlayDraw, waitForThreadedObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nmeaProcess

private ProcessNmeaData nmeaProcess

reasonableSpeed

private double reasonableSpeed
Max reasonable speed in km per hour


reasonableResetTime

private double reasonableResetTime
Reasonable time to wait before believing anything


reasonableTries

private int reasonableTries
Max number of objects to look at before deciding it's OK anyway.


emulatorIterator

private java.util.ListIterator<GpsDataUnit> emulatorIterator

emulatorTimeOffset

private long emulatorTimeOffset

readyGGAData

private EmulatedData readyGGAData
Constructor Detail

GPSDataBlock

public GPSDataBlock(ProcessNmeaData nmeaProcess)
Method Detail

addPamData

public void addPamData(GpsDataUnit gpsDataUnit)
Description copied from class: PamDataBlock
Adds a new PamDataUnit to the PamDataBlock. When the data unit is added, PamObservers that have subscribed to the block will be notified.

Overrides:
addPamData in class PamDataBlock<GpsDataUnit>
Parameters:
gpsDataUnit - Reference to a PamDataUnit

isReasonable

public boolean isReasonable(GpsDataUnit gpsDataUnit)
Check a GPS entry is reasonable - i.e. doesn't jump a huge distance from the preceeding entry.

Parameters:
gpsDataUnit -
Returns:
true if reasonable.

getNextData

public EmulatedData getNextData()
Specified by:
getNextData in interface NMEAEmulator
Returns:
the next emulated data, or null if there are no more.

prepareDataSource

public boolean prepareDataSource(long[] timeLimits,
                                 long timeOffset)
Description copied from interface: NMEAEmulator
Prepare the data to be read into the emulator.

The task may be as simple as setting up an interator to go through the data already read into the datablock or it may involve setting up a new database query to get back to raw data.

Specified by:
prepareDataSource in interface NMEAEmulator
Parameters:
timeLimits - time limits for the emulation
timeOffset - time offset - between when the data were collected and the time they should be emulated at.
Returns:
true if OK