Skip to content
Newer
Older
100644 57 lines (45 sloc) 1.63 KB
418ce8a @gnuvince initial commit
authored
1 /*
2 * geoposition.h
3 * Copyright (C) 2011 Nicolas Martin, Université de Montréal
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef GEOPOSITION_H
20 #define GEOPOSITION_H
21
22 #include <QMetaType>
23 #include <QVariant>
24
25 class GeoPosition
26 {
27 public:
28 GeoPosition() { }
29 GeoPosition(qreal lat, qreal lon);
30
31 QString toString() const {
32 return QObject::trUtf8("(%1,%2)").arg(lat,0,'g',5).arg(lon,0,'g',5);
33 }
34 bool isValid() const { return true; }
35
36 qreal getLat() const { return lat; }
37 void setLat(qreal lat) { this->lat = lat; }
38
39 qreal getLon() const { return lon; }
40 void setLon(qreal lon) { this->lon = lon; }
41
527e4ab @gnuvince Added distance calculation and disabled next button
authored
42 qreal distanceFrom(GeoPosition *other);
43
418ce8a @gnuvince initial commit
authored
44 private:
45 qreal lat, lon;
46
47 private:
48 friend QDataStream& operator<<(QDataStream& ds, const GeoPosition &pos);
49 friend QDataStream& operator>>(QDataStream& ds, GeoPosition &pos);
50 };
51
52 QDataStream& operator<<(QDataStream& ds, const GeoPosition &pos);
53 QDataStream& operator>>(QDataStream& ds, GeoPosition &pos);
54
55 Q_DECLARE_METATYPE(GeoPosition)
56 #endif // GEOPOSITION_H
Something went wrong with that request. Please try again.