-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classLocation.Companion
-
Field Summary
Fields Modifier and Type Field Description private Longidprivate Stringproviderprivate Longtimeprivate Doublelatitudeprivate Doublelongitudeprivate BooleanhasAltitudeprivate Doublealtitudeprivate Floatspeedprivate final FloatspeedOptimalprivate Floatbearingprivate Floataccuracyprivate IntegersensorHeartRateprivate IntegersensorCadenceprivate FloatsensorSpeedprivate FloatsensorPowerprivate IntegersensorStridesprivate FloatsensorTemperatureprivate final Storablecopyprivate final ByteArrayasBytes
-
Method Summary
Modifier and Type Method Description final LonggetId()Location unique ID. final UnitsetId(Long id)Location unique ID. final StringgetProvider()Provider for location source. final UnitsetProvider(String provider)Provider for location source. final LonggetTime()UTC time of this location (in ms). final UnitsetTime(Long time)UTC time of this location (in ms). final DoublegetLatitude()Latitude of location in WGS coordinates. final UnitsetLatitude(Double latitude)final DoublegetLongitude()Longitude of location in WGS coordinates. final UnitsetLongitude(Double longitude)final BooleangetHasAltitude()Flag if altitude is set. final UnitsetHasAltitude(Boolean hasAltitude)Flag if altitude is set. final DoublegetAltitude()final UnitsetAltitude(Double altitude)final FloatgetSpeed()final UnitsetSpeed(Float speed)final FloatgetSpeedOptimal()final FloatgetBearing()final UnitsetBearing(Float bearing)final FloatgetAccuracy()final UnitsetAccuracy(Float accuracy)final IntegergetSensorHeartRate()final UnitsetSensorHeartRate(Integer sensorHeartRate)final IntegergetSensorCadence()final UnitsetSensorCadence(Integer sensorCadence)final FloatgetSensorSpeed()final UnitsetSensorSpeed(Float sensorSpeed)final FloatgetSensorPower()final UnitsetSensorPower(Float sensorPower)final IntegergetSensorStrides()final UnitsetSensorStrides(Integer sensorStrides)final FloatgetSensorTemperature()final UnitsetSensorTemperature(Float sensorTemperature)final StorablegetCopy()final ByteArraygetAsBytes()final UnitremoveAltitude()Clears the altitude of this fix. final Unitset(Location loc)Sets the contents of the location to the values from the given location. final BooleanhasSpeed()Check if location contains speed information received from GPS hardware. final UnitremoveSpeed()Clears the speed of this location. final BooleanhasSpeedOptimal()Check if any speed (GPS or from sensors) is stored. final BooleanhasBearing()Check if the location is able to report bearing information. final UnitremoveBearing()Clears the bearing of this fix. final BooleanhasAccuracy()Returns true if the provider is able to report accuracy information, false otherwise. final UnitremoveAccuracy()Clears the accuracy of this fix. final BooleanhasSensorHeartRate()Returns true if the provider is able to report Heart rate information, false otherwise. final UnitremoveSensorHeartRate()Clears the accuracy of this fix. final BooleanhasSensorCadence()Returns true if the provider is able to report cadence information, false otherwise. final UnitremoveSensorCadence()Clears the cadence of this fix. final BooleanhasSensorSpeed()Check if the speed received from connected sensor exists. final UnitremoveSensorSpeed()Clears the sensor based speed. final BooleanhasSensorPower()Returns true if the provider is able to report power value, false otherwise. final UnitremoveSensorPower()Clears the power of this fix. final BooleanhasSensorStrides()Returns true if the provider is able to report strides value, false otherwise. final UnitremoveSensorStrides()Clears the num of strides. final BooleanhasSensorTemperature()Returns true if the provider is able to report temperature value, false otherwise. final UnitremoveSensorTemperature()Clears the temperature value. final UnitremoveSensorAll()Clear all attached sensors values. StringtoString()final FloatdistanceTo(Location dest)Returns the approximate distance in meters between this location and the given location. final FloatbearingTo(Location dest)Returns the approximate initial bearing in degrees East of true North when traveling along the shortest path between this location and the given location. final FloatArraydistanceAndBearingTo(Location dest)Compute bearing and distance values at once -
-
Method Detail
-
getProvider
final String getProvider()
Provider for location source.
-
setProvider
final Unit setProvider(String provider)
Provider for location source.
-
getLatitude
final Double getLatitude()
Latitude of location in WGS coordinates.
-
setLatitude
final Unit setLatitude(Double latitude)
-
getLongitude
final Double getLongitude()
Longitude of location in WGS coordinates.
-
setLongitude
final Unit setLongitude(Double longitude)
-
getHasAltitude
final Boolean getHasAltitude()
Flag if altitude is set.
-
setHasAltitude
final Unit setHasAltitude(Boolean hasAltitude)
Flag if altitude is set.
-
getAltitude
final Double getAltitude()
-
setAltitude
final Unit setAltitude(Double altitude)
-
getSpeedOptimal
final Float getSpeedOptimal()
-
getBearing
final Float getBearing()
-
setBearing
final Unit setBearing(Float bearing)
-
getAccuracy
final Float getAccuracy()
-
setAccuracy
final Unit setAccuracy(Float accuracy)
-
getSensorHeartRate
final Integer getSensorHeartRate()
-
setSensorHeartRate
final Unit setSensorHeartRate(Integer sensorHeartRate)
-
getSensorCadence
final Integer getSensorCadence()
-
setSensorCadence
final Unit setSensorCadence(Integer sensorCadence)
-
getSensorSpeed
final Float getSensorSpeed()
-
setSensorSpeed
final Unit setSensorSpeed(Float sensorSpeed)
-
getSensorPower
final Float getSensorPower()
-
setSensorPower
final Unit setSensorPower(Float sensorPower)
-
getSensorStrides
final Integer getSensorStrides()
-
setSensorStrides
final Unit setSensorStrides(Integer sensorStrides)
-
getSensorTemperature
final Float getSensorTemperature()
-
setSensorTemperature
final Unit setSensorTemperature(Float sensorTemperature)
-
getAsBytes
final ByteArray getAsBytes()
-
removeAltitude
final Unit removeAltitude()
Clears the altitude of this fix. Following this call, hasAltitude() will return false.
-
set
final Unit set(Location loc)
Sets the contents of the location to the values from the given location.
- Parameters:
loc- source location object
-
hasSpeed
final Boolean hasSpeed()
Check if location contains speed information received from GPS hardware.
-
removeSpeed
final Unit removeSpeed()
Clears the speed of this location. Following this call, hasSpeed will return false.
-
hasSpeedOptimal
final Boolean hasSpeedOptimal()
Check if any speed (GPS or from sensors) is stored.
-
hasBearing
final Boolean hasBearing()
Check if the location is able to report bearing information.
-
removeBearing
final Unit removeBearing()
Clears the bearing of this fix. Following this call, hasBearing() will return false.
-
hasAccuracy
final Boolean hasAccuracy()
Returns true if the provider is able to report accuracy information, false otherwise. The default implementation returns false.
-
removeAccuracy
final Unit removeAccuracy()
Clears the accuracy of this fix. Following this call, hasAccuracy() will return false.
-
hasSensorHeartRate
final Boolean hasSensorHeartRate()
Returns true if the provider is able to report Heart rate information, false otherwise. The default implementation returns false.
-
removeSensorHeartRate
final Unit removeSensorHeartRate()
Clears the accuracy of this fix. Following this call, hasSensorHeartRate() will return false.
-
hasSensorCadence
final Boolean hasSensorCadence()
Returns true if the provider is able to report cadence information, false otherwise. The default implementation returns false.
-
removeSensorCadence
final Unit removeSensorCadence()
Clears the cadence of this fix. Following this call, hasCadence() will return false.
-
hasSensorSpeed
final Boolean hasSensorSpeed()
Check if the speed received from connected sensor exists.
-
removeSensorSpeed
final Unit removeSensorSpeed()
Clears the sensor based speed. After this, hasSensorSpeed will return 'false'.
-
hasSensorPower
final Boolean hasSensorPower()
Returns true if the provider is able to report power value, false otherwise. The default implementation returns false.
-
removeSensorPower
final Unit removeSensorPower()
Clears the power of this fix. Following this call, hasSensorPower() will return false.
-
hasSensorStrides
final Boolean hasSensorStrides()
Returns true if the provider is able to report strides value, false otherwise. The default implementation returns false.
-
removeSensorStrides
final Unit removeSensorStrides()
Clears the num of strides. Following this call, hasSensorStrides() will return false.
-
hasSensorTemperature
final Boolean hasSensorTemperature()
Returns true if the provider is able to report temperature value, false otherwise. The default implementation returns false.
-
removeSensorTemperature
final Unit removeSensorTemperature()
Clears the temperature value. Following this call, hasSensorTemperature() will return false.
-
removeSensorAll
final Unit removeSensorAll()
Clear all attached sensors values.
-
distanceTo
final Float distanceTo(Location dest)
Returns the approximate distance in meters between this location and the given location. Distance is defined using the WGS84 ellipsoid.
- Parameters:
dest- the destination location
-
bearingTo
final Float bearingTo(Location dest)
Returns the approximate initial bearing in degrees East of true North when traveling along the shortest path between this location and the given location. The shortest path is defined using the WGS84 ellipsoid. Locations that are (nearly) antipodal may produce meaningless results.
- Parameters:
dest- the destination location
-
distanceAndBearingTo
final FloatArray distanceAndBearingTo(Location dest)
Compute bearing and distance values at once
- Parameters:
dest- the destination location
-
-
-
-