| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2016 Jolla Ltd. | 
| 4 | ** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 
| 5 | ** Copyright (C) 2016 The Qt Company Ltd. | 
| 6 | ** Contact: https://www.qt.io/licensing/ | 
| 7 | ** | 
| 8 | ** This file is part of the QtPositioning module of the Qt Toolkit. | 
| 9 | ** | 
| 10 | ** $QT_BEGIN_LICENSE:LGPL$ | 
| 11 | ** Commercial License Usage | 
| 12 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 13 | ** accordance with the commercial license agreement provided with the | 
| 14 | ** Software or, alternatively, in accordance with the terms contained in | 
| 15 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 16 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 17 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 18 | ** | 
| 19 | ** GNU Lesser General Public License Usage | 
| 20 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
| 21 | ** General Public License version 3 as published by the Free Software | 
| 22 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | 
| 23 | ** packaging of this file. Please review the following information to | 
| 24 | ** ensure the GNU Lesser General Public License version 3 requirements | 
| 25 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | 
| 26 | ** | 
| 27 | ** GNU General Public License Usage | 
| 28 | ** Alternatively, this file may be used under the terms of the GNU | 
| 29 | ** General Public License version 2.0 or (at your option) the GNU General | 
| 30 | ** Public license version 3 or any later version approved by the KDE Free | 
| 31 | ** Qt Foundation. The licenses are as published by the Free Software | 
| 32 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | 
| 33 | ** included in the packaging of this file. Please review the following | 
| 34 | ** information to ensure the GNU General Public License requirements will | 
| 35 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | 
| 36 | ** https://www.gnu.org/licenses/gpl-3.0.html. | 
| 37 | ** | 
| 38 | ** $QT_END_LICENSE$ | 
| 39 | ** | 
| 40 | ***************************************************************************/ | 
| 41 |  | 
| 42 | #ifndef QDECLARATIVEPOSITION_H | 
| 43 | #define QDECLARATIVEPOSITION_H | 
| 44 |  | 
| 45 | // | 
| 46 | //  W A R N I N G | 
| 47 | //  ------------- | 
| 48 | // | 
| 49 | // This file is not part of the Qt API.  It exists purely as an | 
| 50 | // implementation detail.  This header file may change from version to | 
| 51 | // version without notice, or even be removed. | 
| 52 | // | 
| 53 | // We mean it. | 
| 54 | // | 
| 55 |  | 
| 56 | #include <QtPositioningQuick/private/qpositioningquickglobal_p.h> | 
| 57 | #include <QtPositioning/QGeoPositionInfo> | 
| 58 | #include <QtCore/QObject> | 
| 59 | #include <QtCore/QDateTime> | 
| 60 | #include <QtQml/qqml.h> | 
| 61 |  | 
| 62 | QT_BEGIN_NAMESPACE | 
| 63 |  | 
| 64 | class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePosition : public QObject | 
| 65 | { | 
| 66 |     Q_OBJECT | 
| 67 |  | 
| 68 |     Q_PROPERTY(bool latitudeValid READ isLatitudeValid NOTIFY latitudeValidChanged) | 
| 69 |     Q_PROPERTY(bool longitudeValid READ isLongitudeValid NOTIFY longitudeValidChanged) | 
| 70 |     Q_PROPERTY(bool altitudeValid READ isAltitudeValid NOTIFY altitudeValidChanged) | 
| 71 |     Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged) | 
| 72 |     Q_PROPERTY(QDateTime timestamp READ timestamp NOTIFY timestampChanged) | 
| 73 |     Q_PROPERTY(double speed READ speed NOTIFY speedChanged) | 
| 74 |     Q_PROPERTY(bool speedValid READ isSpeedValid NOTIFY speedValidChanged) | 
| 75 |     Q_PROPERTY(qreal horizontalAccuracy READ horizontalAccuracy WRITE setHorizontalAccuracy NOTIFY horizontalAccuracyChanged) | 
| 76 |     Q_PROPERTY(qreal verticalAccuracy READ verticalAccuracy WRITE setVerticalAccuracy NOTIFY verticalAccuracyChanged) | 
| 77 |     Q_PROPERTY(bool horizontalAccuracyValid READ isHorizontalAccuracyValid NOTIFY horizontalAccuracyValidChanged) | 
| 78 |     Q_PROPERTY(bool verticalAccuracyValid READ isVerticalAccuracyValid NOTIFY verticalAccuracyValidChanged) | 
| 79 |  | 
| 80 |     Q_PROPERTY(bool directionValid READ isDirectionValid NOTIFY directionValidChanged REVISION 1) | 
| 81 |     Q_PROPERTY(double direction READ direction NOTIFY directionChanged REVISION 1) | 
| 82 |     Q_PROPERTY(bool verticalSpeedValid READ isVerticalSpeedValid NOTIFY verticalSpeedValidChanged REVISION 1) | 
| 83 |     Q_PROPERTY(double verticalSpeed READ verticalSpeed NOTIFY verticalSpeedChanged REVISION 1) | 
| 84 |  | 
| 85 |     Q_PROPERTY(double magneticVariation READ magneticVariation NOTIFY magneticVariationChanged REVISION 2) | 
| 86 |     Q_PROPERTY(bool magneticVariationValid READ isMagneticVariationValid NOTIFY magneticVariationChanged REVISION 2) | 
| 87 |  | 
| 88 | public: | 
| 89 |     explicit QDeclarativePosition(QObject *parent = 0); | 
| 90 |     ~QDeclarativePosition(); | 
| 91 |  | 
| 92 |     bool isLatitudeValid() const; | 
| 93 |     bool isLongitudeValid() const; | 
| 94 |     bool isAltitudeValid() const; | 
| 95 |     QDateTime timestamp() const; | 
| 96 |     double speed() const; | 
| 97 |     bool isSpeedValid() const; | 
| 98 |     QGeoCoordinate coordinate(); | 
| 99 |     bool isHorizontalAccuracyValid() const; | 
| 100 |     qreal horizontalAccuracy() const; | 
| 101 |     void setHorizontalAccuracy(qreal horizontalAccuracy); | 
| 102 |     bool isVerticalAccuracyValid() const; | 
| 103 |     qreal verticalAccuracy() const; | 
| 104 |     void setVerticalAccuracy(qreal verticalAccuracy); | 
| 105 |  | 
| 106 |     bool isDirectionValid() const; | 
| 107 |     double direction() const; | 
| 108 |     void setDirection(double direction); | 
| 109 |  | 
| 110 |     bool isVerticalSpeedValid() const; | 
| 111 |     double verticalSpeed() const; | 
| 112 |     void setVerticalSpeed(double speed); | 
| 113 |  | 
| 114 |     bool isMagneticVariationValid() const; | 
| 115 |     double magneticVariation() const; | 
| 116 |  | 
| 117 |     void setPosition(const QGeoPositionInfo &info); | 
| 118 |     const QGeoPositionInfo &position() const; | 
| 119 |  | 
| 120 | Q_SIGNALS: | 
| 121 |     void latitudeValidChanged(); | 
| 122 |     void longitudeValidChanged(); | 
| 123 |     void altitudeValidChanged(); | 
| 124 |     void timestampChanged(); | 
| 125 |     void speedChanged(); | 
| 126 |     void speedValidChanged(); | 
| 127 |     void coordinateChanged(); | 
| 128 |     void horizontalAccuracyChanged(); | 
| 129 |     void horizontalAccuracyValidChanged(); | 
| 130 |     void verticalAccuracyChanged(); | 
| 131 |     void verticalAccuracyValidChanged(); | 
| 132 |  | 
| 133 |     Q_REVISION(1) void directionValidChanged(); | 
| 134 |     Q_REVISION(1) void directionChanged(); | 
| 135 |     Q_REVISION(1) void verticalSpeedValidChanged(); | 
| 136 |     Q_REVISION(1) void verticalSpeedChanged(); | 
| 137 |  | 
| 138 |     Q_REVISION(2) void magneticVariationChanged(); | 
| 139 |     Q_REVISION(2) void magneticVariationValidChanged(); | 
| 140 |  | 
| 141 | private: | 
| 142 |     QGeoPositionInfo m_info; | 
| 143 | }; | 
| 144 |  | 
| 145 | QT_END_NAMESPACE | 
| 146 |  | 
| 147 | QML_DECLARE_TYPE(QDeclarativePosition) | 
| 148 |  | 
| 149 | #endif | 
| 150 |  |