KPkPass

location.cpp
1 /*
2  Copyright (C) 2018 Volker Krause <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This program is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 #include "location.h"
19 
20 #include <QJsonObject>
21 
22 #include <cmath>
23 
24 using namespace KPkPass;
25 
26 namespace KPkPass {
27 class LocationPrivate {
28 public:
29  QJsonObject obj;
30 };
31 }
32 
33 Location::Location()
34  : d(new LocationPrivate)
35 {
36 }
37 
38 Location::Location(const QJsonObject &obj)
39  : d(new LocationPrivate)
40 {
41  d->obj = obj;
42 }
43 
44 Location::~Location() = default;
45 
46 double Location::altitude() const
47 {
48  return d->obj.value(QLatin1String("altitude")).toDouble(NAN);
49 }
50 
51 double Location::latitude() const
52 {
53  return d->obj.value(QLatin1String("latitude")).toDouble(NAN);
54 }
55 
56 double Location::longitude() const
57 {
58  return d->obj.value(QLatin1String("longitude")).toDouble(NAN);
59 }
60 
62 {
63  return d->obj.value(QLatin1String("relevantText")).toString();
64 }
QString relevantText() const
Text to display when location is reached.
double longitude() const
Longitude in degree.
double latitude() const
Latitude in degree.
double altitude() const
Altitude in meters, NaN if not set.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 1 2020 23:07:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.