Package com.aerisweather.aeris.maps
Class TrueNorthListener
- java.lang.Object
-
- com.aerisweather.aeris.maps.TrueNorthListener
-
- All Implemented Interfaces:
android.hardware.SensorEventListener
- Direct Known Subclasses:
BearingCompassListener
public class TrueNorthListener extends Object
Compass listener for determining the direction to true north.
-
-
Field Summary
Fields Modifier and Type Field Description protected Compass
compass
protected android.content.Context
context
protected int
currentAccuracy
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 TrueNorthListener(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)
protected double
smoothCompassReading(double azimuth, double oldAzimuth)
Handle smoothing of the compass angle to lower jitter
-
-
-
Field Detail
-
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
-
TrueNorthListener
public TrueNorthListener(Compass compass, android.content.Context context)
-
-
Method Detail
-
calcAzimuth
protected double calcAzimuth(android.location.Location myLocation)
Calculate the Azimuth.- Parameters:
myLocation
- Location object- Returns:
- double
-
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
-
-