Package com.aerisweather.aeris.maps
Class BearingCompassListener
- java.lang.Object
-
- com.aerisweather.aeris.maps.TrueNorthListener
-
- com.aerisweather.aeris.maps.BearingCompassListener
-
- All Implemented Interfaces:
android.hardware.SensorEventListener
public class BearingCompassListener extends TrueNorthListener
Listener for simple bearing compass.
-
-
Field Summary
Fields Modifier and Type Field Description protected Compass
compass
protected android.content.Context
context
protected int
currentAccuracy
protected android.location.Location
destLocation
protected long
lastUpdate
protected float[]
matrixI
protected float[]
matrixR
protected float[]
matrixValues
protected double
oldAzimuth
protected boolean
performSmoothing
protected double
SmoothFactorCompass
protected double
SmoothThresholdCompass
protected static int
TIMING_RESTRICTION
protected float[]
valuesAccelerometer
protected float[]
valuesMagneticField
-
Constructor Summary
Constructors Constructor Description BearingCompassListener(Compass compass, android.content.Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
calcAzimuth(android.location.Location myLocation)
Calculate the Azimuth.void
onAccuracyChanged(android.hardware.Sensor sensor, int arg1)
void
onSensorChanged(android.hardware.SensorEvent event)
void
setDestLocation(android.location.Location loc)
Sets the destination location we are pointing tooprotected double
smoothCompassReading(double azimuth, double oldAzimuth)
Handle smoothing of the compass angle to lower jitter
-
-
-
Field Detail
-
destLocation
protected android.location.Location destLocation
-
TIMING_RESTRICTION
protected static final int TIMING_RESTRICTION
- See Also:
- Constant Field Values
-
compass
protected final Compass compass
-
valuesAccelerometer
protected float[] valuesAccelerometer
-
valuesMagneticField
protected float[] valuesMagneticField
-
matrixR
protected final float[] matrixR
-
matrixI
protected final float[] matrixI
-
matrixValues
protected final float[] matrixValues
-
lastUpdate
protected long lastUpdate
-
currentAccuracy
protected int currentAccuracy
-
context
protected final android.content.Context context
-
performSmoothing
protected final boolean performSmoothing
- See Also:
- Constant Field Values
-
SmoothFactorCompass
protected final double SmoothFactorCompass
- See Also:
- Constant Field Values
-
SmoothThresholdCompass
protected final double SmoothThresholdCompass
- See Also:
- Constant Field Values
-
oldAzimuth
protected double oldAzimuth
-
-
Constructor Detail
-
BearingCompassListener
public BearingCompassListener(Compass compass, android.content.Context context)
-
-
Method Detail
-
calcAzimuth
protected double calcAzimuth(android.location.Location myLocation)
Calculate the Azimuth.- Overrides:
calcAzimuth
in classTrueNorthListener
- Parameters:
myLocation
- Location object- Returns:
- double
-
setDestLocation
public void setDestLocation(android.location.Location loc)
Sets the destination location we are pointing too- Parameters:
loc
- Destination location object
-
onAccuracyChanged
public void onAccuracyChanged(android.hardware.Sensor sensor, int arg1)
- Specified by:
onAccuracyChanged
in interfaceandroid.hardware.SensorEventListener
-
onSensorChanged
public void onSensorChanged(android.hardware.SensorEvent event)
- Specified by:
onSensorChanged
in interfaceandroid.hardware.SensorEventListener
-
smoothCompassReading
protected double smoothCompassReading(double azimuth, double oldAzimuth)
Handle smoothing of the compass angle to lower jitter- Parameters:
azimuth
- new compass bearingoldAzimuth
- previous compass bearing- Returns:
- double
-
-