|
@@ -10,42 +10,123 @@ using namespace std;
|
10
|
10
|
const double EARTH_RADIUS = 6372.8;
|
11
|
11
|
const double TWOPI = 2 * acos(-1);
|
12
|
12
|
|
|
13
|
+///
|
|
14
|
+/// \brief deg2rad
|
|
15
|
+/// \~English
|
|
16
|
+/// \param deg angle in degrees
|
|
17
|
+/// \return angle in radians
|
|
18
|
+/// \~Spanish
|
|
19
|
+/// \param deg ángulo en grados
|
|
20
|
+/// \return angle ángulo en radianes
|
|
21
|
+///
|
13
|
22
|
inline double deg2rad(double deg) {
|
14
|
23
|
return deg/360.0 * TWOPI;
|
15
|
24
|
}
|
16
|
25
|
|
17
|
26
|
|
18
|
|
-class GISPOI
|
19
|
|
-{
|
|
27
|
+///
|
|
28
|
+/// \brief This class is for representing GIS points of interests.
|
|
29
|
+///
|
|
30
|
+
|
|
31
|
+class GISPOI {
|
20
|
32
|
private:
|
21
|
33
|
QString name;
|
22
|
34
|
double lat, lon;
|
23
|
35
|
|
24
|
36
|
public:
|
|
37
|
+
|
|
38
|
+ /// \fn GISPOI()
|
|
39
|
+ /// \~English
|
|
40
|
+ /// \brief default constructor
|
|
41
|
+ /// \~Spanish
|
|
42
|
+ /// \brief constructor por defecto
|
|
43
|
+ ///
|
25
|
44
|
GISPOI();
|
26
|
|
- GISPOI(QString s, double latitude, double longitude)
|
|
45
|
+
|
|
46
|
+ /// \fn GISPOI(const QString &s, double latitude, double longitude)
|
|
47
|
+ /// \~English
|
|
48
|
+ /// \brief constructor that sets all the data members.
|
|
49
|
+ /// \~Spanish
|
|
50
|
+ /// \brief constructor que asigna valores a los miembros de data.
|
|
51
|
+ ///
|
|
52
|
+ GISPOI(const QString &s, double latitude, double longitude)
|
27
|
53
|
{name = s; lat = latitude; lon = longitude;}
|
28
|
54
|
|
29
|
|
- double getLat() const {return lat;}
|
30
|
|
- double getLon() const {return lon;}
|
|
55
|
+
|
|
56
|
+ /// \fn double getLat()
|
|
57
|
+ /// \~English
|
|
58
|
+ /// \brief getter for the latitude
|
|
59
|
+ /// \return the latitude value
|
|
60
|
+ /// \~Spanish
|
|
61
|
+ /// \brief "getter" para el valor de latitud
|
|
62
|
+ /// \return el valor de la latitud
|
|
63
|
+ ///
|
|
64
|
+ double getLat() const {return lat;}
|
|
65
|
+
|
|
66
|
+ /// \fn double getLon()
|
|
67
|
+ /// \~English
|
|
68
|
+ /// \brief getter for the longitude
|
|
69
|
+ /// \return the longitude value
|
|
70
|
+ /// \~Spanish
|
|
71
|
+ /// \brief "getter" para el valor de longitud
|
|
72
|
+ /// \return el valor de la longitud
|
|
73
|
+ ///
|
|
74
|
+ double getLon() const {return lon;}
|
|
75
|
+
|
|
76
|
+ /// \fn QString getName()
|
|
77
|
+ /// \~English
|
|
78
|
+ /// \brief getter for the name
|
|
79
|
+ /// \return a copy of the name
|
|
80
|
+ /// \~Spanish
|
|
81
|
+ /// \brief "getter" para el nombre
|
|
82
|
+ /// \return una copia del nombre
|
|
83
|
+ ///
|
31
|
84
|
QString getName() const {return name;}
|
32
|
85
|
|
|
86
|
+ /// \fn setAll(const QString &s, double latitude, double longitude)
|
|
87
|
+ /// \~English
|
|
88
|
+ /// \brief setter for all data members
|
|
89
|
+ /// \~Spanish
|
|
90
|
+ /// \brief "setter" para todos los miembros de datos
|
|
91
|
+ ///
|
33
|
92
|
void setAll(QString s, double latitude, double longitude)
|
34
|
93
|
{name = s; lat = latitude; lon = longitude;}
|
|
94
|
+
|
|
95
|
+ /// \fn setAll(const string &s, double latitude, double longitude)
|
|
96
|
+ /// \~English
|
|
97
|
+ /// \brief setter for all data members
|
|
98
|
+ /// \~Spanish
|
|
99
|
+ /// \brief "setter" para todos los miembros de datos
|
|
100
|
+ ///
|
35
|
101
|
void setAll(string s, double latitude, double longitude)
|
36
|
102
|
{name = QString::fromStdString(s); lat = latitude; lon = longitude;}
|
37
|
103
|
|
|
104
|
+
|
|
105
|
+ /// \fn print()
|
|
106
|
+ /// \~English
|
|
107
|
+ /// \brief a utility function to print the data members
|
|
108
|
+ /// \~Spanish
|
|
109
|
+ /// \brief imprime los valores de los miembros de datos
|
|
110
|
+ ///
|
38
|
111
|
void print() {
|
39
|
112
|
qDebug() << name << " " << lat << " "
|
40
|
113
|
<< lon << endl;
|
41
|
114
|
}
|
42
|
115
|
|
43
|
|
- double odDistance(const GISPOI &B) const;
|
44
|
|
-// Function odDistance(A,B)
|
45
|
|
-// Given two objects A and B of type GISPOI, uses their longitudes and
|
46
|
|
-// latitudes to compute and return their orthodromic distance in kilometers.
|
47
|
116
|
|
48
|
|
-
|
|
117
|
+ /// \fn print()
|
|
118
|
+ /// \~English
|
|
119
|
+ /// \brief Given two objects A and B of class GISPOI, uses their
|
|
120
|
+ /// longitudes and latitudes to compute and return their orthodromic
|
|
121
|
+ /// distance in kilometers.
|
|
122
|
+ /// \returns orthodromic distance in kilometers
|
|
123
|
+ /// \~Spanish
|
|
124
|
+ /// \brief Dados dos objetos A y B de clase GISPOI, usa sus
|
|
125
|
+ /// longitudes and latitudes para determinar y devolver distancia
|
|
126
|
+ /// ortodrómica en kilómetros.
|
|
127
|
+ /// \returns distancia ortodrómica en kilómetros
|
|
128
|
+ ///
|
|
129
|
+ double odDistance(const GISPOI &B) const;
|
49
|
130
|
|
50
|
131
|
};
|
51
|
132
|
|