projects
/
jspeed
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Couple of new fields added to text element. Small fix to web page.
[jspeed]
/
src
/
location.cpp
diff --git
a/src/location.cpp
b/src/location.cpp
index
d8ef14c
..
56071f5
100644
(file)
--- a/
src/location.cpp
+++ b/
src/location.cpp
@@
-21,8
+21,10
@@
namespace
{
namespace
{
- static const double KM_MULTIPLIER = 1.0;
- static const double MILE_MULTIPLIER = 0.621371192;
+ static double const KM_MULTIPLIER = 1.0;
+ static double const MILE_MULTIPLIER = 0.621371192;
+ static double const METER_MULTIPLIER = 1.0;
+ static double const FEET_MULTIPLIER = 3.2808399;
}
Location::Unit Location::unit_ = Location::KM;
}
Location::Unit Location::unit_ = Location::KM;
@@
-125,6
+127,16
@@
double Location::getUnitMultiplier()
return KM_MULTIPLIER;
}
return KM_MULTIPLIER;
}
+double Location::getMeterMultiplier()
+{
+ if(unit_ == MILE)
+ {
+ return FEET_MULTIPLIER;
+ }
+
+ return METER_MULTIPLIER;
+}
+
void Location::onChanged(LocationGPSDevice *device, gpointer data)
{
if(device && device->fix &&
void Location::onChanged(LocationGPSDevice *device, gpointer data)
{
if(device && device->fix &&
@@
-145,7
+157,7
@@
void Location::onChanged(LocationGPSDevice *device, gpointer data)
if(device->fix->fields & LOCATION_GPS_DEVICE_ALTITUDE_SET)
{
if(device->fix->fields & LOCATION_GPS_DEVICE_ALTITUDE_SET)
{
- fix.altitude = device->fix->altitude;
+ fix.altitude = device->fix->altitude * getMeterMultiplier();
fix.epv = device->fix->epv;
}
fix.epv = device->fix->epv;
}