1 /* SPDX-FileCopyrightText: 2020 Tobias Leupold <tobias.leupold@gmx.de>
2
3 SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-KDE-Accepted-GPL
4 */
5
6 // Local includes
7 #include "Coordinates.h"
8
Coordinates()9 Coordinates::Coordinates()
10 {
11 }
12
Coordinates(double lon,double lat,double alt,bool isSet)13 Coordinates::Coordinates(double lon, double lat, double alt, bool isSet)
14 : m_lon(lon),
15 m_lat(lat),
16 m_alt(alt),
17 m_isSet(isSet)
18 {
19 }
20
lon() const21 double Coordinates::lon() const
22 {
23 return m_lon;
24 }
25
lat() const26 double Coordinates::lat() const
27 {
28 return m_lat;
29 }
30
setAlt(double alt)31 void Coordinates::setAlt(double alt)
32 {
33 m_alt = alt;
34 }
35
alt() const36 double Coordinates::alt() const
37 {
38 return m_alt;
39 }
40
isSet() const41 bool Coordinates::isSet() const
42 {
43 return m_isSet;
44 }
45
operator ==(const Coordinates & other) const46 bool Coordinates::operator==(const Coordinates &other) const
47 {
48 return m_lon == other.lon()
49 && m_lat == other.lat()
50 && m_alt == other.alt()
51 && m_isSet == other.isSet();
52 }
53
operator !=(const Coordinates & other) const54 bool Coordinates::operator!=(const Coordinates &other) const
55 {
56 return m_lon != other.lon()
57 || m_lat != other.lat()
58 || m_alt != other.alt()
59 || m_isSet != other.isSet();
60 }
61
operator <<(QDebug debug,const Coordinates & coordinates)62 QDebug operator<<(QDebug debug, const Coordinates &coordinates)
63 {
64 QDebugStateSaver saver(debug);
65
66 if (! coordinates.isSet()) {
67 debug.nospace() << "Coordinates(not set)";
68 } else {
69 debug.nospace() << "Coordinates("
70 << "lon: " << coordinates.lon()
71 << ", lat: " << coordinates.lat()
72 << ", alt: " << coordinates.alt()
73 << ')';
74 }
75
76 return debug;
77 }
78