File indexing completed on 2024-05-12 05:22:24

0001 /*
0002     SPDX-FileCopyrightText: 2012 Jan Grulich <grulja@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "location.h"
0008 
0009 using namespace KGAPI2;
0010 
0011 class Q_DECL_HIDDEN Location::Private
0012 {
0013 public:
0014     Private();
0015     Private(const Private &other);
0016 
0017     qulonglong timestamp = 0;
0018     qint32 accuracy = -1;
0019     qint32 speed = -1;
0020     qint32 heading = -1;
0021     qint32 altitude = 0;
0022     qint32 altitudeAccuracy = -1;
0023 };
0024 
0025 Location::Private::Private()
0026 {
0027 }
0028 
0029 Location::Private::Private(const Private &other)
0030     : timestamp(other.timestamp)
0031     , accuracy(other.accuracy)
0032     , speed(other.speed)
0033     , heading(other.heading)
0034     , altitude(other.altitude)
0035     , altitudeAccuracy(other.altitudeAccuracy)
0036 {
0037 }
0038 
0039 Location::Location()
0040     : Object()
0041     , KContacts::Geo()
0042     , d(new Private)
0043 {
0044 }
0045 
0046 Location::Location(const Location &other)
0047     : Object(other)
0048     , KContacts::Geo(other)
0049     , d(new Private(*(other.d)))
0050 {
0051 }
0052 
0053 Location::Location(float latitude, float longitude)
0054     : Object()
0055     , Geo(latitude, longitude)
0056     , d(new Private)
0057 {
0058 }
0059 
0060 Location::~Location()
0061 {
0062     delete d;
0063 }
0064 
0065 qulonglong Location::timestamp() const
0066 {
0067     return d->timestamp;
0068 }
0069 
0070 qint32 Location::accuracy() const
0071 {
0072     return d->accuracy;
0073 }
0074 
0075 qint32 Location::speed() const
0076 {
0077     return d->speed;
0078 }
0079 
0080 qint32 Location::heading() const
0081 {
0082     return d->heading;
0083 }
0084 
0085 qint32 Location::altitude() const
0086 {
0087     return d->altitude;
0088 }
0089 
0090 qint32 Location::altitudeAccuracy() const
0091 {
0092     return d->altitudeAccuracy;
0093 }
0094 
0095 void Location::setTimestamp(qulonglong timestamp)
0096 {
0097     d->timestamp = timestamp;
0098 }
0099 
0100 void Location::setAccuracy(qint32 accuracy)
0101 {
0102     d->accuracy = accuracy;
0103 }
0104 
0105 void Location::setSpeed(qint32 speed)
0106 {
0107     d->speed = speed;
0108 }
0109 
0110 void Location::setHeading(qint32 heading)
0111 {
0112     d->heading = heading;
0113 }
0114 
0115 void Location::setAltitude(qint32 altitude)
0116 {
0117     d->altitude = altitude;
0118 }
0119 
0120 void Location::setAltitudeAccuracy(qint32 altitudeAccuracy)
0121 {
0122     d->altitudeAccuracy = altitudeAccuracy;
0123 }