File indexing completed on 2024-04-28 15:39:05
0001 // SPDX-FileCopyrightText: 2020 Tobias Leupold <tl at stonemx dot de> 0002 // 0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 // Local includes 0006 #include "Coordinates.h" 0007 0008 Coordinates::Coordinates() 0009 { 0010 } 0011 0012 Coordinates::Coordinates(double lon, double lat, double alt, bool isSet) 0013 : m_lon(lon), 0014 m_lat(lat), 0015 m_alt(alt), 0016 m_isSet(isSet) 0017 { 0018 } 0019 0020 double Coordinates::lon() const 0021 { 0022 return m_lon; 0023 } 0024 0025 double Coordinates::lat() const 0026 { 0027 return m_lat; 0028 } 0029 0030 void Coordinates::setAlt(double alt) 0031 { 0032 m_alt = alt; 0033 } 0034 0035 double Coordinates::alt() const 0036 { 0037 return m_alt; 0038 } 0039 0040 bool Coordinates::isSet() const 0041 { 0042 return m_isSet; 0043 } 0044 0045 bool Coordinates::operator==(const Coordinates &other) const 0046 { 0047 return m_lon == other.lon() 0048 && m_lat == other.lat() 0049 && m_alt == other.alt() 0050 && m_isSet == other.isSet(); 0051 } 0052 0053 bool Coordinates::operator!=(const Coordinates &other) const 0054 { 0055 return m_lon != other.lon() 0056 || m_lat != other.lat() 0057 || m_alt != other.alt() 0058 || m_isSet != other.isSet(); 0059 } 0060 0061 QDebug operator<<(QDebug debug, const Coordinates &coordinates) 0062 { 0063 QDebugStateSaver saver(debug); 0064 0065 if (! coordinates.isSet()) { 0066 debug.nospace() << "Coordinates(not set)"; 0067 } else { 0068 debug.nospace() << "Coordinates(" 0069 << "lon: " << coordinates.lon() 0070 << ", lat: " << coordinates.lat() 0071 << ", alt: " << coordinates.alt() 0072 << ')'; 0073 } 0074 0075 return debug; 0076 }