|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlocation.generators.FakeGPSMonitor
This class reads the data comming from a simulated GPS system.
Nested Class Summary | |
private class |
FakeGPSMonitor.LocationTimer
This class is responsible for firing the location changed events at a periodic interval. |
Field Summary | |
(package private) Latitude |
currLat
|
(package private) Longitude |
currLong
|
static long |
DEFAULT_INTERVAL
The default interval between generating points is 1000ms. |
static double |
DEFAULT_LAT_STEP_SIZE
The default latitude step size in sexagesimal units. |
static Latitude |
DEFAULT_LATITUDE
The default latitude is (38 38.8935' N) |
static double |
DEFAULT_LONG_STEP_SIZE
The default longitude step size in sexagesimal units. |
static Longitude |
DEFAULT_LONGITUDE
The default longitude is (90 18.389986' W) |
(package private) Latitude |
defaultLat
|
(package private) Longitude |
defaultLong
|
private java.util.Vector |
gps_listeners
The GPSListeners that are waiting for GPSInfoEvents. |
(package private) GpsInfoEvent |
gpsinfo
The fake GPS Info sent to the user. |
(package private) FakeGPSgui |
gui
The GUI that allows the user to specifiy the direction of motion. |
(package private) long |
interval
How often in milliseconds the user wants to receive a LocationEvent |
(package private) double |
latStep
The step size of the latitude and longitude in sexigesimal units. |
(package private) java.util.Vector |
listeners
Holds the listeners. |
(package private) double |
longStep
The step size of the latitude and longitude in sexigesimal units. |
(package private) LocationEvent |
prevLE
The previous LocationEvent that was broadcasted |
(package private) java.util.Timer |
timer
The timer used to generate location events. |
Constructor Summary | |
FakeGPSMonitor()
Creates a FakeGPSMonitor with all the default settings. |
|
FakeGPSMonitor(boolean showGUI)
Creates a FakeGPSMonitor with all of the default settings except for the showGUI. |
|
FakeGPSMonitor(long updatePeriod)
Creates a FakeGPSMonitor starting at the default location with the specified update period. |
|
FakeGPSMonitor(long updatePeriod,
double latStep,
double longStep)
Creates a FakeGPSMonitor starting at a default location. |
|
FakeGPSMonitor(long updatePeriod,
Latitude defaultLat,
Longitude defaultLong)
Creates a FakeGPSMonitor with the starting location as specified by the parameter without reporting its location to a RoutSimulatorServer and default increment. |
|
FakeGPSMonitor(long interval,
Latitude defaultLat,
Longitude defaultLong,
double latStep,
double longStep,
boolean showGUI)
Creates a FakeGPSMonitor with the starting location as specified by the parameter. |
Method Summary | |
void |
addGpsInfoListener(GpsInfoListener gps)
Add a GpsInfo listener. |
void |
addLocationListener(LocationListener ll)
Add a Location listener. |
(package private) void |
broadcastInformation()
Send a new location information to the registered listeners. |
(package private) double |
calcSpeed(Location currLoc,
java.util.Date time)
Calculates the speed in meters per second the user is traveling. |
(package private) void |
decLat()
Decrements the latitude. |
(package private) void |
decLong()
Decrements the longitude. |
(package private) Latitude |
getDefaultLatitude()
Returns the default (starting) latitude. |
(package private) Longitude |
getDefaultLongitude()
Returns the default (starting) longitude. |
LocationEvent |
getLocation()
Returns the most previously current location |
(package private) void |
incLat()
Increments the latitude. |
(package private) void |
incLong()
Increments the longitude. |
void |
kill()
Stops this class from generating location events. |
void |
removeGpsInfoListener(GpsInfoListener gps)
Remove a GpsInfo listener. |
void |
removeLocationListener(LocationListener ll)
Remove a location listener. |
(package private) void |
reset()
Resets this FakeGPSMonitor to be at the default (starting) location. |
void |
setGPSInfo(GpsInfoEvent gpsinfo)
Sets the GpsInfoEvent to be broadcasted with the location event. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Latitude DEFAULT_LATITUDE
public static final Longitude DEFAULT_LONGITUDE
public static final double DEFAULT_LAT_STEP_SIZE
public static final double DEFAULT_LONG_STEP_SIZE
public static final long DEFAULT_INTERVAL
long interval
java.util.Timer timer
FakeGPSgui gui
java.util.Vector listeners
Latitude currLat
Latitude defaultLat
Longitude currLong
Longitude defaultLong
double latStep
double longStep
LocationEvent prevLE
private java.util.Vector gps_listeners
GpsInfoEvent gpsinfo
Constructor Detail |
public FakeGPSMonitor()
public FakeGPSMonitor(boolean showGUI)
public FakeGPSMonitor(long updatePeriod)
updatePeriod
- the period of updating in milliseconds.public FakeGPSMonitor(long updatePeriod, double latStep, double longStep)
updatePeriod
- the period of updating in millisecondslatStep
- the latitude step size in sexagesimal unitslongStep
- the longitude step size in sexagesimal unitspublic FakeGPSMonitor(long updatePeriod, Latitude defaultLat, Longitude defaultLong)
updatePeriod
- the period of updating.defaultLat
- the default Latitude.defaultLong
- the default Longitude.public FakeGPSMonitor(long interval, Latitude defaultLat, Longitude defaultLong, double latStep, double longStep, boolean showGUI)
interval
- the period of updatingdefaultLat
- the default LatitudedefaultLong
- the default LongitudelatStep
- the latitude step size in sexagesimal unitslongStep
- the longitude step size in sexagesimal unitsshowGUI
- determines whether the GUI that allows the user
to change the data to be displayed.Method Detail |
public void addLocationListener(LocationListener ll)
addLocationListener
in interface LocationGenerator
ll
- the new location listener.
public void removeLocationListener(LocationListener ll)
removeLocationListener
in interface LocationGenerator
ll
- the location listener to remove.
public void addGpsInfoListener(GpsInfoListener gps)
addGpsInfoListener
in interface LocationGenerator
gps
- the new GpsInfo listener.
public void removeGpsInfoListener(GpsInfoListener gps)
removeGpsInfoListener
in interface LocationGenerator
gps
- the GpsInfo listener to remove.
public void kill()
kill
in interface LocationGenerator
Latitude getDefaultLatitude()
Longitude getDefaultLongitude()
void reset()
void incLat()
void decLat()
void incLong()
void decLong()
double calcSpeed(Location currLoc, java.util.Date time)
public void setGPSInfo(GpsInfoEvent gpsinfo)
void broadcastInformation()
public LocationEvent getLocation()
getLocation
in interface LocationGenerator
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |