1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#pragma once
#include "../base/base.hpp"
#include "../routing/turns.hpp"
#include "../std/string.hpp"
namespace location
{
/// @note Do not change values of this constants.
enum TLocationError
{
ENoError = 0,
ENotSupported,
EDenied,
EGPSIsOff
};
enum TLocationSource
{
EAppleNative,
EWindowsNative,
EAndroidNative,
EGoogle,
ETizen,
EPredictor
};
/// Our structure ALWAYS has valid lat, lon and horizontal accuracy.
/// We filter out location events without lat/lon/acc in native code as we don't need them.
class GpsInfo
{
public:
GpsInfo()
: m_horizontalAccuracy(100.0), // use as a default accuracy
m_altitude(0.0), m_verticalAccuracy(-1.0), m_bearing(-1.0), m_speed(-1.0)
{
}
TLocationSource m_source;
double m_timestamp; //!< seconds from 1st Jan 1970
double m_latitude; //!< degrees
double m_longitude; //!< degrees
double m_horizontalAccuracy; //!< metres
double m_altitude; //!< metres
double m_verticalAccuracy; //!< metres
double m_bearing; //!< positive degrees from the true North
double m_speed; //!< metres per second
//bool HasAltitude() const { return m_verticalAccuracy >= 0.0; }
bool HasBearing() const { return m_bearing >= 0.0; }
bool HasSpeed() const { return m_speed >= 0.0; }
};
class CompassInfo
{
public:
//double m_timestamp; //!< seconds from 1st Jan 1970
//double m_magneticHeading; //!< positive radians from the magnetic North
//double m_trueHeading; //!< positive radians from the true North
//double m_accuracy; //!< offset from the magnetic to the true North in radians
double m_bearing; //!< positive radians from the true North
};
static inline bool IsLatValid(double lat)
{
return lat != 0. && lat < 90. && lat > -90.;
}
static inline bool IsLonValid(double lon)
{
return lon != 0. && lon < 180. && lon > -180.;
}
class FollowingInfo
{
public:
/// @name Formatted covered distance with measurement units suffix.
//@{
string m_distToTarget;
string m_targetUnitsSuffix;
//@}
/// @name Formated distance to next turn with measurement unit suffix
//@{
string m_distToTurn;
string m_turnUnitsSuffix;
routing::turns::TurnDirection m_turn;
uint32_t m_exitNum;
//@}
int m_time;
bool IsValid() const { return !m_distToTarget.empty(); }
};
} // namespace location
|