KPkPass

location.cpp
1 /*
2  SPDX-FileCopyrightText: 2018 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "location.h"
8 
9 #include <QJsonObject>
10 
11 #include <cmath>
12 
13 using namespace KPkPass;
14 
15 namespace KPkPass {
16 class LocationPrivate {
17 public:
18  QJsonObject obj;
19 };
20 }
21 
22 Location::Location()
23  : d(new LocationPrivate)
24 {
25 }
26 
27 Location::Location(const QJsonObject &obj)
28  : d(new LocationPrivate)
29 {
30  d->obj = obj;
31 }
32 
33 Location::~Location() = default;
34 
35 double Location::altitude() const
36 {
37  return d->obj.value(QLatin1String("altitude")).toDouble(NAN);
38 }
39 
40 double Location::latitude() const
41 {
42  return d->obj.value(QLatin1String("latitude")).toDouble(NAN);
43 }
44 
45 double Location::longitude() const
46 {
47  return d->obj.value(QLatin1String("longitude")).toDouble(NAN);
48 }
49 
51 {
52  return d->obj.value(QLatin1String("relevantText")).toString();
53 }
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-2021 The KDE developers.
Generated on Sat Jan 16 2021 23:19:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.