summaryrefslogtreecommitdiff
path: root/src/positioning
diff options
context:
space:
mode:
Diffstat (limited to 'src/positioning')
-rw-r--r--src/positioning/CMakeLists.txt66
-rw-r--r--src/positioning/configure.cmake28
-rw-r--r--src/positioning/configure.json48
-rw-r--r--src/positioning/doc/images/permissions.pngbin19306 -> 0 bytes
-rw-r--r--src/positioning/doc/qtpositioning.qdocconf56
-rw-r--r--src/positioning/doc/snippets/cpp/cpp.pro8
-rw-r--r--src/positioning/doc/snippets/cpp/cppqml.cpp118
-rw-r--r--src/positioning/doc/snippets/cpp/main.cpp55
-rw-r--r--src/positioning/doc/snippets/doc_src_qtpositioning.qml57
-rw-r--r--src/positioning/doc/snippets/snippets.pro2
-rw-r--r--src/positioning/doc/src/cpp-position.qdoc194
-rw-r--r--src/positioning/doc/src/cpp-qml-positioning.qdoc114
-rw-r--r--src/positioning/doc/src/external-resources.qdoc61
-rw-r--r--src/positioning/doc/src/plugins/geoclue2.qdoc86
-rw-r--r--src/positioning/doc/src/plugins/gypsy.qdoc115
-rw-r--r--src/positioning/doc/src/plugins/nmea.qdoc201
-rw-r--r--src/positioning/doc/src/qml-position.qdoc112
-rw-r--r--src/positioning/doc/src/qt6-changes.qdoc233
-rw-r--r--src/positioning/doc/src/qtpositioning-android.qdoc82
-rw-r--r--src/positioning/doc/src/qtpositioning-examples.qdoc38
-rw-r--r--src/positioning/doc/src/qtpositioning-plugins.qdoc114
-rw-r--r--src/positioning/doc/src/qtpositioning-qml.qdoc71
-rw-r--r--src/positioning/doc/src/qtpositioning.qdoc153
-rw-r--r--src/positioning/positioning.pro96
-rw-r--r--src/positioning/qclipperutils.cpp100
-rw-r--r--src/positioning/qclipperutils_p.h86
-rw-r--r--src/positioning/qdoublematrix4x4.cpp1112
-rw-r--r--src/positioning/qdoublematrix4x4_p.h946
-rw-r--r--src/positioning/qdoublevector2d.cpp121
-rw-r--r--src/positioning/qdoublevector2d_p.h262
-rw-r--r--src/positioning/qdoublevector3d.cpp144
-rw-r--r--src/positioning/qdoublevector3d_p.h302
-rw-r--r--src/positioning/qgeoaddress.cpp776
-rw-r--r--src/positioning/qgeoaddress.h123
-rw-r--r--src/positioning/qgeoaddress_p.h85
-rw-r--r--src/positioning/qgeoareamonitorinfo.cpp440
-rw-r--r--src/positioning/qgeoareamonitorinfo.h139
-rw-r--r--src/positioning/qgeoareamonitorsource.cpp432
-rw-r--r--src/positioning/qgeoareamonitorsource.h111
-rw-r--r--src/positioning/qgeocircle.cpp477
-rw-r--r--src/positioning/qgeocircle.h90
-rw-r--r--src/positioning/qgeocircle_p.h96
-rw-r--r--src/positioning/qgeocoordinate.cpp792
-rw-r--r--src/positioning/qgeocoordinate.h161
-rw-r--r--src/positioning/qgeocoordinate_p.h92
-rw-r--r--src/positioning/qgeocoordinateobject.cpp93
-rw-r--r--src/positioning/qgeocoordinateobject_p.h97
-rw-r--r--src/positioning/qgeolocation.cpp282
-rw-r--r--src/positioning/qgeolocation.h101
-rw-r--r--src/positioning/qgeolocation_p.h82
-rw-r--r--src/positioning/qgeopath.cpp774
-rw-r--r--src/positioning/qgeopath.h101
-rw-r--r--src/positioning/qgeopath_p.h260
-rw-r--r--src/positioning/qgeopolygon.cpp719
-rw-r--r--src/positioning/qgeopolygon.h100
-rw-r--r--src/positioning/qgeopolygon_p.h137
-rw-r--r--src/positioning/qgeopositioninfo.cpp445
-rw-r--r--src/positioning/qgeopositioninfo.h157
-rw-r--r--src/positioning/qgeopositioninfo_p.h78
-rw-r--r--src/positioning/qgeopositioninfosource.cpp634
-rw-r--r--src/positioning/qgeopositioninfosource.h129
-rw-r--r--src/positioning/qgeopositioninfosource_p.h96
-rw-r--r--src/positioning/qgeopositioninfosourcefactory.cpp90
-rw-r--r--src/positioning/qgeopositioninfosourcefactory.h66
-rw-r--r--src/positioning/qgeorectangle.cpp1031
-rw-r--r--src/positioning/qgeorectangle.h123
-rw-r--r--src/positioning/qgeorectangle_p.h89
-rw-r--r--src/positioning/qgeosatelliteinfo.cpp435
-rw-r--r--src/positioning/qgeosatelliteinfo.h154
-rw-r--r--src/positioning/qgeosatelliteinfo_p.h77
-rw-r--r--src/positioning/qgeosatelliteinfosource.cpp424
-rw-r--r--src/positioning/qgeosatelliteinfosource.h109
-rw-r--r--src/positioning/qgeosatelliteinfosource_p.h73
-rw-r--r--src/positioning/qgeoshape.cpp449
-rw-r--r--src/positioning/qgeoshape.h133
-rw-r--r--src/positioning/qgeoshape_p.h93
-rw-r--r--src/positioning/qlocationutils.cpp635
-rw-r--r--src/positioning/qlocationutils_p.h350
-rw-r--r--src/positioning/qnmeapositioninfosource.cpp962
-rw-r--r--src/positioning/qnmeapositioninfosource.h97
-rw-r--r--src/positioning/qnmeapositioninfosource_p.h188
-rw-r--r--src/positioning/qnmeasatelliteinfosource.cpp909
-rw-r--r--src/positioning/qnmeasatelliteinfosource.h104
-rw-r--r--src/positioning/qnmeasatelliteinfosource_p.h181
-rw-r--r--src/positioning/qpositioningglobal.h60
-rw-r--r--src/positioning/qpositioningglobal_p.h62
-rw-r--r--src/positioning/qwebmercator.cpp136
-rw-r--r--src/positioning/qwebmercator_p.h75
88 files changed, 0 insertions, 20385 deletions
diff --git a/src/positioning/CMakeLists.txt b/src/positioning/CMakeLists.txt
deleted file mode 100644
index 5e976735..00000000
--- a/src/positioning/CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-# Generated from positioning.pro.
-
-#####################################################################
-## Positioning Module:
-#####################################################################
-
-qt_internal_add_module(Positioning
- PLUGIN_TYPES position
- SOURCES
- qclipperutils.cpp qclipperutils_p.h
- qdoublematrix4x4.cpp qdoublematrix4x4_p.h
- qdoublevector2d.cpp qdoublevector2d_p.h
- qdoublevector3d.cpp qdoublevector3d_p.h
- qgeoaddress.cpp qgeoaddress.h qgeoaddress_p.h
- qgeoareamonitorinfo.cpp qgeoareamonitorinfo.h
- qgeoareamonitorsource.cpp qgeoareamonitorsource.h
- qgeocircle.cpp qgeocircle.h qgeocircle_p.h
- qgeocoordinate.cpp qgeocoordinate.h qgeocoordinate_p.h
- qgeocoordinateobject.cpp qgeocoordinateobject_p.h
- qgeolocation.cpp qgeolocation.h qgeolocation_p.h
- qgeopath.cpp qgeopath.h qgeopath_p.h
- qgeopolygon.cpp qgeopolygon.h qgeopolygon_p.h
- qgeopositioninfo.cpp qgeopositioninfo.h qgeopositioninfo_p.h
- qgeopositioninfosource.cpp qgeopositioninfosource.h qgeopositioninfosource_p.h
- qgeopositioninfosourcefactory.cpp qgeopositioninfosourcefactory.h
- qgeorectangle.cpp qgeorectangle.h qgeorectangle_p.h
- qgeosatelliteinfo.cpp qgeosatelliteinfo.h qgeosatelliteinfo_p.h
- qgeosatelliteinfosource.cpp qgeosatelliteinfosource.h qgeosatelliteinfosource_p.h
- qgeoshape.cpp qgeoshape.h qgeoshape_p.h
- qlocationutils.cpp qlocationutils_p.h
- qnmeapositioninfosource.cpp qnmeapositioninfosource.h qnmeapositioninfosource_p.h
- qnmeasatelliteinfosource.cpp qnmeasatelliteinfosource.h qnmeasatelliteinfosource_p.h
- qpositioningglobal.h qpositioningglobal_p.h
- qwebmercator.cpp qwebmercator_p.h
- INCLUDE_DIRECTORIES
- ../3rdparty/clip2tri
- ../3rdparty/clipper
- LIBRARIES
- Qt::CorePrivate
- Qt::Bundled_Clip2Tri
- PUBLIC_LIBRARIES
- Qt::Core
- PRIVATE_MODULE_INTERFACE
- Qt::CorePrivate
-)
-
-if(ANDROID)
- set_property(TARGET Positioning APPEND PROPERTY QT_ANDROID_BUNDLED_JAR_DEPENDENCIES
- jar/Qt${QtLocation_VERSION_MAJOR}AndroidPositioning.jar:org.qtproject.qt.android.positioning.QtPositioning # special case
- )
- set_property(TARGET Positioning APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES
- plugins/position/libplugins_position_qtposition_android.so
- )
- set_property(TARGET Positioning APPEND PROPERTY QT_ANDROID_PERMISSIONS
- android.permission.ACCESS_FINE_LOCATION
- )
-endif()
-
-#### Keys ignored in scope 1:.:.:positioning.pro:<TRUE>:
-# ANDROID_FEATURES = "android.hardware.location.gps"
-# MODULE_WINRT_CAPABILITIES_DEVICE = "location"
-# OTHER_FILES = "configure.json" "doc/src/*.qdoc" "doc/src/plugins/*.qdoc"
-qt_internal_add_docs(Positioning
- doc/qtpositioning.qdocconf
-)
-
diff --git a/src/positioning/configure.cmake b/src/positioning/configure.cmake
deleted file mode 100644
index 979c1432..00000000
--- a/src/positioning/configure.cmake
+++ /dev/null
@@ -1,28 +0,0 @@
-# begin special case
-
-#### Libraries
-
-qt_find_package(Gypsy PROVIDED_TARGETS Gypsy::Gypsy)
-qt_find_package(Gconf PROVIDED_TARGETS Gconf::Gconf)
-
-#### Tests
-
-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/winrt/CMakeLists.txt")
- qt_config_compile_test("winrt_geolocation"
- LABEL "WinRT geolocation"
- PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../config.tests/winrt")
-endif()
-
-#### Features
-
-qt_feature("gypsy" PUBLIC
- LABEL "Gypsy - A GPS Multiplexing Daemon"
- CONDITION Gypsy_FOUND AND Gconf_FOUND
-)
-
-qt_feature("winrt_geolocation" PRIVATE
- LABEL "WinRT geolocation API"
- CONDITION WIN32 AND TEST_winrt_geolocation
-)
-
-# end special case
diff --git a/src/positioning/configure.json b/src/positioning/configure.json
deleted file mode 100644
index 49e32be4..00000000
--- a/src/positioning/configure.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "module": "positioning",
- "testDir": "../../config.tests",
-
- "libraries": {
- "gypsy": {
- "label": "Gypsy",
- "test": "gypsy",
- "sources": [
- { "type": "pkgConfig", "args": "gypsy gconf-2.0" }
- ]
- }
- },
-
- "tests": {
- "winrt_geolocation": {
- "label": "WinRT Geolocation API",
- "type": "compile",
- "test": "winrt"
- }
- },
-
- "features": {
- "gypsy": {
- "label": "Gypsy GPS Daemon",
- "condition": "libs.gypsy",
- "output": [ "privateFeature" ]
- },
- "winrt_geolocation": {
- "label": "WinRT Geolocation API",
- "condition": "tests.winrt_geolocation",
- "output": [ "privateFeature" ]
- }
- },
-
- "report": [
- ],
-
- "summary": [
- {
- "section": "Qt Positioning",
- "entries": [
- "gypsy",
- "winrt_geolocation"
- ]
- }
- ]
-}
diff --git a/src/positioning/doc/images/permissions.png b/src/positioning/doc/images/permissions.png
deleted file mode 100644
index bd8c4850..00000000
--- a/src/positioning/doc/images/permissions.png
+++ /dev/null
Binary files differ
diff --git a/src/positioning/doc/qtpositioning.qdocconf b/src/positioning/doc/qtpositioning.qdocconf
deleted file mode 100644
index 67e5837a..00000000
--- a/src/positioning/doc/qtpositioning.qdocconf
+++ /dev/null
@@ -1,56 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-include($QT_INSTALL_DOCS/config/exampleurl-qtlocation.qdocconf)
-
-project = QtPositioning
-description = Qt Positioning Reference Documentation
-version = $QT_VERSION
-
-
-
-qhp.projects = QtPositioning
-
-qhp.QtPositioning.file = qtpositioning.qhp
-qhp.QtPositioning.namespace = org.qt-project.qtpositioning.$QT_VERSION_TAG
-qhp.QtPositioning.virtualFolder = qtpositioning
-qhp.QtPositioning.indexTitle = Qt Positioning
-qhp.QtPositioning.indexRoot =
-
-qhp.QtPositioning.filterAttributes = qtpositioning $QT_VERSION qtrefdoc
-qhp.QtPositioning.customFilters.Qt.name = QtPositioning $QT_VERSION
-qhp.QtPositioning.customFilters.Qt.filterAttributes = qtpositioning $QT_VERSION
-qhp.QtPositioning.subprojects = classes qml examples
-qhp.QtPositioning.subprojects.classes.title = C++ Classes
-qhp.QtPositioning.subprojects.classes.indexTitle = Qt Positioning C++ Classes
-qhp.QtPositioning.subprojects.classes.selectors = class fake:headerfile
-qhp.QtPositioning.subprojects.classes.sortPages = true
-qhp.QtPositioning.subprojects.qml.title = QML Types
-qhp.QtPositioning.subprojects.qml.indexTitle = Qt Positioning QML Types
-qhp.QtPositioning.subprojects.qml.selectors = qmlclass
-qhp.QtPositioning.subprojects.qml.sortPages = true
-qhp.QtPositioning.subprojects.examples.title = Qt Positioning Examples
-qhp.QtPositioning.subprojects.examples.indexTitle = Qt Positioning Examples
-qhp.QtPositioning.subprojects.examples.selectors = fake:example
-
-tagfile = ../../../doc/qtpositioning/qtpositioning.tags
-
-depends += qtcore qtdoc qtquick qtqml qtnetwork qtqmlxmllistmodel qmake qtcmake
-
-headerdirs += .. \
- ../../positioningquick
-
-sourcedirs += .. \
- ../../positioningquick
-
-examplesinstallpath = positioning
-
-exampledirs += ../../../examples/positioning \
- snippets/
-
-
-imagedirs += images
-
-navigation.landingpage = "Qt Positioning"
-navigation.cppclassespage = "Qt Positioning C++ Classes"
-navigation.qmltypespage = "Qt Positioning QML Types"
-
-manifestmeta.thumbnail.names += "QtPositioning/Log File*"
diff --git a/src/positioning/doc/snippets/cpp/cpp.pro b/src/positioning/doc/snippets/cpp/cpp.pro
deleted file mode 100644
index 47401e90..00000000
--- a/src/positioning/doc/snippets/cpp/cpp.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-TARGET = positioning_cppsnippet
-QT = core positioning
-
-SOURCES += \
- main.cpp \
- cppqml.cpp
-
diff --git a/src/positioning/doc/snippets/cpp/cppqml.cpp b/src/positioning/doc/snippets/cpp/cppqml.cpp
deleted file mode 100644
index c3d0139e..00000000
--- a/src/positioning/doc/snippets/cpp/cppqml.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QObject>
-#include <QtCore/QDebug>
-#include <QtCore/QVariant>
-#include <QtPositioning/QGeoAddress>
-#include <QtPositioning/QGeoLocation>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoAreaMonitorSource>
-
-void cppQmlInterface(QObject *qmlObject)
-{
- //! [Address get]
- QGeoAddress geoAddress = qmlObject->property("address").value<QGeoAddress>();
- //! [Address get]
-
- //! [Address set]
- qmlObject->setProperty("address", QVariant::fromValue(geoAddress));
- //! [Address set]
-
- //! [Location get]
- QGeoLocation geoLocation = qmlObject->property("location").value<QGeoLocation>();
- //! [Location get]
-
- //! [Location set]
- qmlObject->setProperty("location", QVariant::fromValue(geoLocation));
- //! [Location set]
-}
-
-class MyClass : public QObject
-{
- Q_OBJECT
-//! [BigBen]
-public:
- MyClass() : QObject()
- {
- QGeoAreaMonitorSource *monitor = QGeoAreaMonitorSource::createDefaultSource(this);
- if (monitor) {
- connect(monitor, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo)),
- this, SLOT(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo)));
- connect(monitor, SIGNAL(areaExited(QGeoAreaMonitorInfo,QGeoPositionInfo)),
- this, SLOT(areaExited(QGeoAreaMonitorInfo,QGeoPositionInfo)));
-
- QGeoAreaMonitorInfo bigBen("Big Ben");
- QGeoCoordinate position(51.50104, -0.124632);
- bigBen.setArea(QGeoCircle(position, 100));
-
- monitor->startMonitoring(bigBen);
-
- } else {
- qDebug() << "Could not create default area monitor";
- }
- }
-
-public Q_SLOTS:
- void areaEntered(const QGeoAreaMonitorInfo &mon, const QGeoPositionInfo &update)
- {
- Q_UNUSED(mon);
-
- qDebug() << "Now within 100 meters, current position is" << update.coordinate();
- }
-
- void areaExited(const QGeoAreaMonitorInfo &mon, const QGeoPositionInfo &update)
- {
- Q_UNUSED(mon);
-
- qDebug() << "No longer within 100 meters, current position is" << update.coordinate();
- }
-//! [BigBen]
-};
diff --git a/src/positioning/doc/snippets/cpp/main.cpp b/src/positioning/doc/snippets/cpp/main.cpp
deleted file mode 100644
index 285bf6af..00000000
--- a/src/positioning/doc/snippets/cpp/main.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-int main(int /*argc*/, char ** /*argv*/)
-{
- return 0;
-}
-
diff --git a/src/positioning/doc/snippets/doc_src_qtpositioning.qml b/src/positioning/doc/snippets/doc_src_qtpositioning.qml
deleted file mode 100644
index f6d15572..00000000
--- a/src/positioning/doc/snippets/doc_src_qtpositioning.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [import]
-import QtPositioning
-//! [import]
-
-Item {
-}
-
diff --git a/src/positioning/doc/snippets/snippets.pro b/src/positioning/doc/snippets/snippets.pro
deleted file mode 100644
index 451d1c36..00000000
--- a/src/positioning/doc/snippets/snippets.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += cpp
diff --git a/src/positioning/doc/src/cpp-position.qdoc b/src/positioning/doc/src/cpp-position.qdoc
deleted file mode 100644
index a380f105..00000000
--- a/src/positioning/doc/src/cpp-position.qdoc
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page location-positioning-cpp.html
-
-\title Positioning (C++)
-
-\brief The Location Positioning API enables location positioning by means of
-GPS or an NMEA data source.
-
-\section1 Positioning
-
-The Positioning component of the Qt Location API is about the geographical
-position, size, and address of some place. Positioning contains a
-\l QGeoCoordinate class, containing latitude, longitude and altitude in meters.
-\l QGeoLocation contains a \l QGeoCoordinate plus address and size information
-(a bounding box) so that positions can be more than mathematical points.
-Movement into or out of the defined bounding box areas can be monitored. The API
-also allows the developer to control the source of the positional information
-as well.
-
-Location data involves a precisely specified position on the Earth's
-surface \unicode {0x2014} as provided by a latitude-longitude coordinate
-\unicode {0x2014} along with associated data, such as:
-
- \list
- \li The date and time at which the position was reported
- \li The velocity of the device that reported the position
- \li The altitude of the reported position (height above sea level)
- \li The bearing of the device in degrees, relative to true north
- \endlist
-
-This data can be extracted through a variety of methods. One of the most
-well known methods of positioning is GPS (Global Positioning System), a
-publicly available system that uses radiowave signals received from
-Earth-orbiting satellites to calculate the precise position and time of
-the receiver. Another popular method is 'Cell Identifier Positioning', which uses
-the cell identifier of the cell site that is currently serving the receiving
-device to calculate its approximate location. These and other positioning
-methods can all be used with the Location API; the only requirement for a
-location data source within the API is that it provides a
-latitude-longitude coordinate with a date/time value, with the option of
-providing the other attributes listed above.
-
-
-Location data sources are created by subclassing \l QGeoPositionInfoSource and
-providing \l QGeoPositionInfo objects through the
-\l {QGeoPositionInfoSource::positionUpdated()} signal. Clients that require
-location data can connect to the
-\l{QGeoPositionInfoSource::positionUpdated()}{positionUpdated()} signal and
-call \l{QGeoPositionInfoSource::startUpdates()}{startUpdates()} or
-\l{QGeoPositionInfoSource::requestUpdate()}{requestUpdate()} to trigger the
-distribution of location data. The location data distribution can be stopped by
-calling the \l {QGeoPositionInfoSource::stopUpdates()}{stopUpdates()} function.
-
-A default position source may be available on some platforms. Call
-\l {QGeoPositionInfoSource::createDefaultSource()} to create an instance of the
-default position source. The method returns \c nullptr if no default source is
-available for the platform.
-
-If a problem occurs with access to the information source then an
-\l {QGeoPositionInfoSource::errorOccurred()}{errorOccurred()} signal is emitted.
-
-The \l QGeoAreaMonitorSource class enables client applications to be notified
-when the receiving device has moved into or out of a particular area, as
-specified by a coordinate and radius. If the platform provides built-in support
-for area monitoring, the \l {QGeoAreaMonitorSource::createDefaultSource()}
-method returns an instance of the default area monitor.
-
-Satellite information can also be distributed through the
-\l QGeoSatelliteInfoSource class. Call
-\l {QGeoSatelliteInfoSource::createDefaultSource()} to create an instance of the
-default satellite data source for the platform if one is available.
-Alternatively, clients can subclass it to provide a custom satellite data
-source.
-
-
-
-\section2 Requesting Location Data from Data Sources
-
-To receive data from a source, connect to its
-\l{QGeoPositionInfoSource::positionUpdated()}{positionUpdated()} signal,
-then call either \l{QGeoPositionInfoSource::startUpdates()}{startUpdates()}
-or \l{QGeoPositionInfoSource::requestUpdate()}{requestUpdate()} to begin.
-
-Here is an example of a client that receives data from the default location
-data source, as returned by \l {QGeoPositionInfoSource::createDefaultSource()}:
-
-\code
-class MyClass : public QObject
-{
- Q_OBJECT
-public:
- MyClass(QObject *parent = 0)
- : QObject(parent)
- {
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
- if (source) {
- connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
- source->startUpdates();
- }
- }
-
-private slots:
- void positionUpdated(const QGeoPositionInfo &info)
- {
- qDebug() << "Position updated:" << info;
- }
-};
-
-\endcode
-
-\section2 Controlling Aspects of Data Sources
-
-The \l {QGeoPositionInfoSource::setUpdateInterval()} method can be used to
-control the rate at which position updates are received. For example, if
-the client application only requires updates once every 30 seconds, it can
-call \c setUpdateInterval(30000). If no update interval is set, or
-\l {QGeoPositionInfoSource::}{setUpdateInterval()} is called with a value of 0,
-the source uses a default interval or some other internal logic to determine
-when updates should be provided.
-
-\l {QGeoPositionInfoSource::setPreferredPositioningMethods()} enables client
-applications to request that a certain type of positioning method be used.
-For example, if the application prefers to use only satellite positioning,
-which offers fairly precise outdoor positioning but can be a heavy user of
-power resources, it can call this method with the
-\l {QGeoPositionInfoSource::SatellitePositioningMethods} value. However, this
-method should only be used in specialized client applications; in most
-cases, the default positioning methods should not be changed, as a source
-may internally use a variety of positioning methods that can be useful to
-the application.
-
-\section2 NMEA Data
-
-\l {http://en.wikipedia.org/wiki/NMEA_0183}{NMEA} is a common text-based
-protocol for specifying navigational data. For convenience, the
-\l QNmeaPositionInfoSource is provided to enable client applications to read
-and distribute NMEA data in either real-time mode (for example, when
-streaming from a GPS device) or simulation mode (for example, when reading
-from a NMEA log file). In simulation mode, the source will emit updates
-according to the time stamp of each NMEA sentence to produce a "replay"
-of the recorded data.
-
-Generally, the capabilities provided by the default position source as
-returned by \l {QGeoPositionInfoSource::createDefaultSource()}, along with the
-\l QNmeaPositionInfoSource class, are sufficient for retrieving location
-data. However, in some cases developers may wish to write their own custom
-location data source.
-
-The \l {Log File Position Source (C++)} example demonstrates how to subclass
-\l QGeoPositionInfoSource to create a custom positioning source.
-
-
-\section1 Examples
-
-\section3 \b{Flickr Example}
-
-The \l{GeoFlickr QML}{Flickr Example} uses the current location to download thumbnail
-images from Flickr relevant to the current location.
-
-
-
-\section1 Positioning Classes
-
-\annotatedlist QtPositioning-positioning
-
-*/
diff --git a/src/positioning/doc/src/cpp-qml-positioning.qdoc b/src/positioning/doc/src/cpp-qml-positioning.qdoc
deleted file mode 100644
index f1044306..00000000
--- a/src/positioning/doc/src/cpp-qml-positioning.qdoc
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page positioning-cpp-qml.html
-\title Interfaces between C++ and QML Code in Qt Positioning
-
-\brief Describes the methods used to exchange position data between C++ and QML
-code.
-
-\section1 Overview
-
-Qt Positioning utilizes two methods to simplify exchange of position data
-between C++ and QML code.
-
-\target Cpp_value_integration_positioning
-\section1 Direct C++ Value Integration in QtPositioning
-
-Starting with Qt 5.5, it has become much easier to integrate non-QObject based
-data types into QML. This is achieved by adding \l Q_GADGET support to \l QtQml.
-The macro converts classes into a light-weight version of a \l QObject without
-the required \l QObject inheritance. At the same time, it retains the reflection
-capabilities of \l QMetaObject. As a result, they can be directly exposed to
-QML.
-
-A significant number of Position related data types were converted to
-\l {Q_GADGET}s. They retain their API and value type character but have become
-introspectable via \l QMetaObject.
-
-The \l QML_ANONYMOUS macro is used to expose these types to the QML environment.
-See the \l QQmlEngine documentation for more details and the full list of
-available macros.
-
-The classes, however, are not directly extended with this macro, because we do
-not want Qt Positioning to depend on \l QtQml. So a helper class is created for
-each of them, and the \l QML_FOREIGN macro is used:
-
-\code
-struct QGeoCoordinateForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoCoordinate)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-\endcode
-
-The above registration of Positioning types is automatically done once by the
-QtPositioning QML plugin.
-
-\section1 QVariant Based integration
-
-This section provides information on how to integrate QGeoAddress and
-QGeoLocation.
-
-\section2 Address - QGeoAddress
-
-The \l {QtPositioning::Address::address} {Address.address} property is used to
-provide an interface between C++ and QML code. First a pointer to an
-\l {QtPositioning::}{Address} object must be obtained from C++, then the
-\l {QObject::}{property()} and \l {QObject::}{setProperty()} functions must be
-used to get and set the \c address property.
-
-The following piece of code gets the \l QGeoAddress object from C++:
-
-\snippet cpp/cppqml.cpp Address get
-
-The following piece of code sets the address property of the QML object based
-on a \l QGeoAddress object from C++:
-
-\snippet cpp/cppqml.cpp Address set
-
-
-\section2 Location - QGeoLocation
-The \l {Location::location} {Location.location} property is used to provide an
-interface between C++ and QML code. First a pointer to a \l Location object
-must be obtained from C++, then the \l {QObject::}{property()} and
-\l {QObject::}{setProperty()} functions must be used to get and set the
-\c location property.
-
-The following piece of code gets the \l QGeoLocation object from C++:
-
-\snippet cpp/cppqml.cpp Location get
-
-The following piece of code sets the location property of the QML object based
-on a \l QGeoLocation object from C++:
-
-\snippet cpp/cppqml.cpp Location set
-
-*/
diff --git a/src/positioning/doc/src/external-resources.qdoc b/src/positioning/doc/src/external-resources.qdoc
deleted file mode 100644
index 948249d9..00000000
--- a/src/positioning/doc/src/external-resources.qdoc
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\externalpage https://developer.android.com/about/versions/oreo/background-location-limits
-\title Background Location Limits
-*/
-
-/*!
-\externalpage https://developer.android.com/guide/components/foreground-services
-\title Foreground Service
-*/
-
-/*!
-\externalpage https://developer.android.com/reference/android/Manifest.permission#ACCESS_BACKGROUND_LOCATION
-\title ACCESS_BACKGROUND_LOCATION
-*/
-
-/*!
-\externalpage https://developer.android.com/training/location/background
-\title Access Location in the Background
-*/
-
-/*!
-\externalpage https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home
-\title GeoClue service
-*/
-
-/*!
-\externalpage https://www.freedesktop.org/software/geoclue/docs/gdbus-org.freedesktop.GeoClue2.Client.html#gdbus-property-org-freedesktop-GeoClue2-Client.DesktopId
-\title GeoClue DesktopId property
-*/
-
-/*!
-\externalpage https://gypsy.freedesktop.org/wiki/
-\title Gypsy daemon
-*/
diff --git a/src/positioning/doc/src/plugins/geoclue2.qdoc b/src/positioning/doc/src/plugins/geoclue2.qdoc
deleted file mode 100644
index 13ba2d2d..00000000
--- a/src/positioning/doc/src/plugins/geoclue2.qdoc
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page position-plugin-geoclue2.html
-\title Qt Positioning GeoClue v2 plugin
-\ingroup QtPositioning-plugins
-
-\brief Uses the GeoClue v2 library to provide positioning updates
-
-\section1 Overview
-
-This plugin is an interface to the \l {GeoClue service}{GeoClue v2} library.
-It requires this library to be installed on the system to function.
-
-The plugin uses D-Bus to establish communication with the GeoClue v2 D-Bus
-service and to provide positioning information.
-
-The plugin can be used to receive only the positioning information.
-It \e {does not} provide satellite information.
-
-The plugin can be loaded by using the provider name \b geoclue2.
-
-\section1 Parameters
-
-The following table lists parameters that \e can be passed to the geoclue2
-plugin.
-
-\table
-\header
- \li Parameter
- \li Description
-\row
- \li desktopId
- \li The \l {GeoClue DesktopId property}{Desktop Id} property used by the
- D-Bus service. If the parameter is not specified, the application name
- provided by \l QCoreApplication::applicationName() is used.
-\endtable
-
-\section1 Usage example
-
-The following examples show how to create a \b geoclue2 PositionSource from
-C++ and QML.
-
-\section2 QML
-
-\code
-PositionSource {
- name: "geoclue2"
- PluginParameter { name: "desktopId"; value: "SomeIdentifierString" }
-}
-\endcode
-
-\section2 C++
-
-\code
-QVariantMap params;
-params["desktopId"] = "SomeIdentifierString";
-QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("geoclue2", params, this);
-\endcode
-
-*/
diff --git a/src/positioning/doc/src/plugins/gypsy.qdoc b/src/positioning/doc/src/plugins/gypsy.qdoc
deleted file mode 100644
index 9b59314a..00000000
--- a/src/positioning/doc/src/plugins/gypsy.qdoc
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page position-plugin-gypsy.html
-\title Qt Positioning Gypsy plugin
-\ingroup QtPositioning-plugins
-
-\brief Uses the Gypsy daemon to provide satellite information
-
-\section1 Overview
-
-The plugin is an interface to the \l {Gypsy daemon}. It requires the daemon
-to be installed and running on the system to function.
-
-The plugin uses D-Bus and GLib to connect to GPS device and provide satellite
-information.
-
-Currently the plugin \e {does not} provide positioning information.
-
-The plugin can be loaded using provider name \b gypsy.
-
-\section1 Parameters
-
-The following table lists parameters that \e can be passed to the gypsy
-plugin.
-
-\table
-\header
- \li Parameter
- \li Description
-\row
- \li deviceName
- \li The name of the device (or path to the device file) that will be used
- to provide satellite information. The typical values can be
- \c {/dev/ttyUSB0} or \c {/dev/ttyACM0}.
-\row
- \li gconfKey
- \li The key that will be used to extract device name from the GConf
- configuration system.
-\endtable
-
-The plugin supports two ways of specifying the device name:
-\list
- \li Specify the device name directly with the \e deviceName plugin
- parameter.
- \li Specify the configuration key using \e gconfKey plugin parameter and
- extract the device name from the GConf configuration system. This
- approach is useful when the device name is already specified for some
- other GConf-based application.
-\endlist
-
-By default, when none of the parameters is specified, the plugin will try to
-extract the device name from the GConf configuration system using the following
-hardcoded key:
-
-\badcode
-/apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice
-\endcode
-
-\section2 Using GConf to set parameters
-
-To specify a value for a key in the GConf configuration system, use
-\e {gconftool-2} as follows:
-
-\badcode
-gconftool-2 -t string -s /apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice /dev/ttyUSB0
-\endcode
-
-\section1 Usage example
-
-The following examples show how to create a \b gypsy satellite info source
-from C++.
-
-Specifying device name directly:
-
-\code
-QVariantMap parameters;
-parameters["deviceName"] = "/dev/ttyACM0";
-QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createSource("gypsy", parameters, this);
-\endcode
-
-Using GConf key:
-
-\code
-QVariantMap parameters;
-parameters["gconfKey"] = "/apps/myapp/mykey";
-QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createSource("gypsy", parameters, this);
-\endcode
-
-*/
diff --git a/src/positioning/doc/src/plugins/nmea.qdoc b/src/positioning/doc/src/plugins/nmea.qdoc
deleted file mode 100644
index 00a50f0e..00000000
--- a/src/positioning/doc/src/plugins/nmea.qdoc
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page position-plugin-nmea.html
-\title Qt Positioning NMEA plugin
-\ingroup QtPositioning-plugins
-
-\brief Reads the NMEA stream to provide position updates.
-
-\section1 Overview
-
-Included with Qt Positioning is a position plugin which parses NMEA sentences
-into position updates. This plugin can use serial port, socket or file as a
-source.
-
-This plugin can be loaded by using the provider name \b nmea.
-
-\section1 Parameters
-
-The following table lists parameters that \e can be passed to the nmea plugin.
-
-\table
-\header
- \li Parameter
- \li Description
-\row
- \li nmea.source
- \li The source that will be used to get NMEA data.
-\row
- \li nmea.satellite_info_simulation_interval
- \li The interval for reading satellite information data from the file in
- simulation mode.
-\endtable
-
-Different sources require different ways of providing the data. The following
-table lists different ways of providing \c {nmea.source} parameter for socket,
-serial port and file inputs.
-
-\table
-\header
- \li Scheme
- \li Example
- \li Description
-\row
- \li socket://hostname:port
- \li \c {socket://localhost:12345}
- \li Use \b {socket:} keyword to specify that you want to get the nmea data
- from the socket. A TCP socket will be created, which will try to connect
- to host \c hostname using port \c port. Upon successful connection
- a text NMEA stream is expected to be received from the server.
-\row
- \li {1, 3} serial:portname
- \li \c {serial:/dev/ttyUSB0}
- \li {1, 3} Use \b {serial:} keyword to specify that you want to get the nmea
- data from the serial port. The plugin will try to establish a connection
- to port \c portname with baudrate = 4800 Bd. Upon successful connection
- a text NMEA stream is expected to be received from the serial port.
- If you use \b {serial:} without any port name, the plugin will try to
- find one of the well known serial devices using vendor identifier. Note
- however that this is not a recommended way of using the serial port
- connection, as the list of well-known devices is small and most probably
- does not include your hardware.
-\row
- \li \c {serial:COM1}
-\row
- \li \c {serial:}
-\row
- \li filepath
- \li \c {/home/user/nmealog.txt}
- \li {1, 2} Use \b {file:///} or just full file path to specify a path to a
- local file.
-\row
- \li file:///filepath
- \li \c {file:///home/user/nmealog.txt}
-\row
- \li qrc:///filepath
- \li \c {qrc:///nmealog.txt}
- \li Use \b {qrc:///} prefix to specify a path to a file in the application
- resources.
-\endtable
-
-\note If \c {nmea.source} parameter is not specified, the plugin will try to
-locate one of the well-known serial devices (as if \c {nmea.source = serial:}
-was specified).
-
-\section1 Position source usage example
-
-The following examples show how to create a \b nmea PositionSource
-using different data sources.
-
-\section2 QML
-
-\code
-// text file
-PositionSource {
- name: "nmea"
- PluginParameter { name: "nmea.source"; value: "qrc:///nmealog.txt" }
-}
-
-// socket
-PositionSource {
- name: "nmea"
- PluginParameter { name: "nmea.source"; value: "socket://localhost:22222" }
-}
-
-// serial port
-PositionSource {
- name: "nmea"
- PluginParameter { name: "nmea.source"; value: "serial:/dev/ttyACM0" }
-}
-\endcode
-
-\section2 C++
-
-\code
-// text file
-QVariantMap params;
-params["nmea.source"] = "qrc:///nmealog.txt";
-QGeoPositionInfoSource *textPositionSource = QGeoPositionInfoSource::createSource("nmea", params, this);
-
-// socket
-params["nmea.source"] = "socket://localhost:22222";
-QGeoPositionInfoSource *socketPositionSource = QGeoPositionInfoSource::createSource("nmea", params, this);
-
-// serial port
-params["nmea.source"] = "serial:/dev/ttyACM0";
-QGeoPositionInfoSource *serialPositionSource = QGeoPositionInfoSource::createSource("nmea", params, this);
-\endcode
-
-\note Once a PositionSource is created, it can't be reconfigured to use other
-type of source data.
-
-\section1 Satellite information source usage example
-
-Apart from the position information, \b nmea plugin is also capable of providing
-satellite information. For now it does not have any QML object, but can be
-created directly from C++ code.
-
-\code
-// serial port
-QVariantMap parameters;
-parameters["nmea.source"] = "serial:/dev/ttyUSB0";
-QGeoSatelliteInfoSource *serialSource = QGeoSatelliteInfoSource::createSource("nmea", parameters, this);
-
-// socket
-parameters["nmea.source"] = "socket://localhost:22222";
-QGeoSatelliteInfoSource *socketSource = QGeoSatelliteInfoSource::createSource("nmea", parameters, this);
-\endcode
-
-If you want to use \l QGeoSatelliteInfoSource to read file with NMEA stream, you
-can also use additional parameter \c "nmea.satellite_info_simulation_interval".
-This parameter is used to specify the playback rate (in milliseconds) for the
-satellite info messages. The minimum allowed frequency is specified by
-\l {QGeoSatelliteInfoSource::}{minimumUpdateInterval()}. If you specify a
-smaller value, it will be ignored. If no value is specified, the default value
-is \c {qMax(100, minimumUpdateInterval())}.
-At runtime \l {QNmeaSatelliteInfoSource::setBackendProperty()} method can be
-used to update this parameter.
-
-\code
-// file
-QVariantMap parameters;
-parameters["nmea.source"] = "qrc:///nmealog.txt";
-parameters["nmea.satellite_info_simulation_interval"] = 1000;
-QGeoSatelliteInfoSource *fileSource = QGeoSatelliteInfoSource::createSource("nmea", parameters, this);
-\endcode
-
-This parameter is not applicable to position source because NMEA protocol
-already has timestamps in position messages. These timestamps are used to
-simulate the correct message rate while using \l QGeoPositionInfoSource with
-file as a data source.
-
-\note Once a \l QGeoSatelliteInfoSource is created, it can't be reconfigured to
-use other type of source data.
-
-*/
diff --git a/src/positioning/doc/src/qml-position.qdoc b/src/positioning/doc/src/qml-position.qdoc
deleted file mode 100644
index 27e55583..00000000
--- a/src/positioning/doc/src/qml-position.qdoc
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page location-positioning-qml.html
-
-\title Positioning (QML)
-
-\brief The Location Positioning API enables location positioning by means of
-GPS or an NMEA data source.
-
-\section1 Location Positioning
-
-Location data involves a precisely specified position on the Earth's
-surface \unicode {0x2014} as provided by a latitude-longitude coordinate
-\unicode {0x2014} along with associated data, such as:
-
- \list
- \li The date and time at which the position was reported
- \li The velocity of the device that reported the position
- \li The altitude of the reported position (height above sea level)
- \li The bearing of the device in degrees, relative to true north
- \endlist
-
-For more information see
-\l {http://en.wikipedia.org/wiki/Geographic_coordinate}{Geographic Coordinate}.
-
-This data can be extracted through a variety of methods. One of the most
-well known methods of positioning is GPS (Global Positioning System), a
-publicly available system that uses radiowave signals received from
-Earth-orbiting satellites to calculate the precise position and time of
-the receiver. Another popular method is 'Cell Identifier Positioning', which uses
-the cell identifier of the cell site that is currently serving the receiving
-device to calculate its approximate location. These and other positioning
-methods can all be used with the Location API; the only requirement for a
-location data source within the API is that it provides a
-latitude-longitude coordinate with a date/time value, with the option of
-providing the other attributes listed above.
-
-\section2 Coordinates
-
-The \l {coordinate} is a basic unit of geographical information. The
-\l {coordinate} type has attributes to hold the \c {latitude},
-\c longitude and \c altitude.
-
-\section2 Positions
-
-The three dimensional position of an object such as a mobile device can be specified by giving
-the latitude, longitude and altitude. That is the values held in the
-\l {coordinate} type. Additionally for computation of future
-positions we would like to know if the object is moving, what \l [QML] {Position::}{speed} it is
-doing and what is the \l {Position::timestamp}{timestamp} of the last position data. Position
-therefore includes values for the \l {Position::coordinate}{coordinate},
-\l {Position::speed}{speed} and a \l {Position::timestamp}{timestamp}. \l Position also takes
-responsibility for validation of sensible values for these properties. These are exposed as
-the \l {Position::latitudeValid}{latitudeValid}, \l {Position::longitudeValid}{longitudeValid},
-\l {Position::altitudeValid}{altitudeValid}, \l {Position::speedValid}{speedValid},
-\l {Position::horizontalAccuracyValid}{horizontalAccuracyValid}, and
-\l {Position::verticalAccuracyValid}{verticalAccuracyValid} properties.
-
-
-\section2 PositionSource Type
-
-We have a \l Position type, a \l {coordinate} type but where does the data come
-from? Also it is a good idea to be able to indicate alternative sources.
-Perhaps instead of directly picking up GPS satellites it might be desirable to
-do some testing using a datafile.
-
-The \l PositionSource type provides the developer with control, within the
-limits allowed by the platform, of the source of the geographical data.
-\l PositionSource supports multiple plugins, including an
-\l {Qt Positioning NMEA plugin}{NMEA} plugin.
-
-\l {http://en.wikipedia.org/wiki/NMEA}{NMEA} is a common text-based
-protocol for specifying navigational data. The \l PositionSource
-\l {Qt Positioning NMEA plugin}{NMEA} plugin supports multiple data sources,
-including raw file or TCP socket. The source will emit updates according to the
-time stamp of each NMEA sentence to produce a "replay" of the recorded data.
-
-See the \l {Qt Positioning NMEA plugin}{plugin description} for usage examples.
-
-
-\section2 GeoFlickr Example
-
-The \l{GeoFlickr (QML)}{GeoFlickr Example} uses the \l PositionSource to
-download thumbnail images from Flickr relevant to the current location.
-
-*/
diff --git a/src/positioning/doc/src/qt6-changes.qdoc b/src/positioning/doc/src/qt6-changes.qdoc
deleted file mode 100644
index ab53823b..00000000
--- a/src/positioning/doc/src/qt6-changes.qdoc
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qtpositioning-changes-qt6.html
- \title Changes to Qt Positioning
- \ingroup changes-qt-5-to-6
- \brief Migrate Qt Positioning to Qt 6.
-
- Qt 6 is a result of the conscious effort to make the framework more
- efficient and easy to use.
-
- We try to maintain binary and source compatibility for all the public
- APIs in each release. But some changes were inevitable in an effort to
- make Qt a better framework.
-
- In this topic we summarize those changes in Qt Positioning, and provide
- guidance to handle them.
-
- \section1 Breaking public API changes
-
- This section contains information about API changes that break source
- compatibility.
-
- \section2 Rename QGeoPolygon::path()
-
- The \c QGeoPolygon::path() and \c QGeoPolygon::setPath() methods are renamed
- to \l QGeoPolygon::perimeter() and \l QGeoPolygon::setPerimeter()
- respectively. On the QML side the \l QGeoPolygon::perimeter property can be
- used without any changes.
-
- \section2 Use \l QGeoShape for \l QGeoLocation bounding area
-
- The \l QGeoLocation class and its \l [QML] Location QML counterpart are
- updated to use \l QGeoShape instead of \l QGeoRectangle for a bounding area.
-
- \section3 C++
-
- The \c QGeoLocation::boundingBox() and \c QGeoLocation::setBoundingBox()
- are replaced by \l QGeoLocation::boundingShape() and
- \l QGeoLocation::setBoundingShape() respectively. A \l QGeoShape object
- is now used as an underlying data storage.
-
- \section3 QML
-
- The \c QGeoLocation::boundingBox property is replaced by
- \l QGeoLocation::boundingShape. This property is available since
- QtPositioning 6.2, so make sure to update the import version in the QML
- files.
-
- \code
- import QtPositioning 6.2
- \endcode
-
- \section2 Remove QGeoShape::extendShape()
-
- The \c QGeoShape::extendShape() method was deprecated in Qt 5.9 and finally
- removed in Qt 6. Use \l QGeoRectangle::extendRectangle() and
- \l QGeoCircle::extendCircle() if you need this functionality for these
- classes.
-
- \section2 Rename signal error to errorOccurred
-
- In Qt 5 multiple Qt Positioning classes had the \c error() signal, which was
- clashing with the \c error() method. In Qt 6 we renamed these signals to
- \c errorOccurred(). Specifically:
-
- \list
-
- \li \c QGeoAreaMonitorSource::error() is renamed to
- \l QGeoAreaMonitorSource::errorOccurred().
-
- \li \c QGeoPositionInfoSource::error() is renamed to
- \l QGeoPositionInfoSource::errorOccurred().
-
- \li \c QGeoSatelliteInfoSource::error() is renamed to
- \l QGeoSatelliteInfoSource::errorOccurred().
-
- \endlist
-
- \section2 Remove update timeout signals
-
- In Qt 5 \c {QGeoPositionInfoSource::updateTimeout()} and
- \c {QGeoSatelliteInfoSource::requestTimeout()} signals were used to notify
- about the cases when the current position or satellite information could
- not be retrieved within specified timeout. These signals were removed in
- Qt 6. The \c {errorOccurred()} signals with the new error types are
- used instead. Specifically:
-
- \list
-
- \li \l QGeoPositionInfoSource uses an \l {QGeoPositionInfoSource::}
- {errorOccurred()} signal with a new
- \l QGeoPositionInfoSource::UpdateTimeoutError error code.
-
- \li \l QGeoSatelliteInfoSource uses an \l {QGeoSatelliteInfoSource::}
- {errorOccurred()} signal with a new
- \l QGeoSatelliteInfoSource::UpdateTimeoutError error code.
-
- \endlist
-
- Same changes apply to \l [QML] PositionSource QML object. The
- \c {PositionSource::updateTimeout()} signal is removed.
- \l [QML] {PositionSource::sourceError} property with a
- \c {PositionSource.UpdateTimeoutError} is used instead.
-
- \section2 Redesign NMEA support
-
- In Qt 5 we had a \b serialnmea positioning plugin and a \c nmeaSource
- property in \l [QML] {PositionSource} object.
-
- The plugin provided access to NMEA streams via serial port, while the QML
- object was responsible for reading NMEA stream from TCP socket or local
- file.
-
- In Qt 6 we joined all these features in the plugin, which is now renamed to
- \b nmea. It is now capable of working with all three NMEA data sources:
- serial port, TCP socket and local file. See \l {Qt Positioning NMEA plugin}
- {plugin description} for more details.
-
- The \c nmeaSource property of \l [QML] {PositionSource} object is now
- removed.
-
- \section1 Other API changes
-
- This section contains API improvements that do not break source
- compatibility. However they might have an impact on the application logic,
- so it is still useful to know about them.
-
- \section2 Reset errors properly
-
- In Qt 5 the errors for \l QGeoAreaMonitorSource, \l QGeoPositionInfoSource
- and \l QGeoSatelliteInfoSource classes were never reset. This behavior is
- not logical, as calling \c {startUpdates()}, \c {startMonitoring()} or
- \c {requestUpdates()} on one of these classes or their subclasses
- effectively means starting a new work sessions, which means that we should
- not care about previous errors. Since Qt 6 we reset the error to \c NoError
- once one of the aforementioned methods is called.
-
- \section2 Add \l QGeoAddress::streetNumber
-
- The \l QGeoAddress class is extended with \l {QGeoAddress::}{streetNumber}
- property, which holds the information about street number, building name, or
- anything else that might be used to distinguish one address from another.
- Use \l {QGeoAddress::}{streetNumber()} and \l {QGeoAddress::}
- {setStreetNumber()} to access this property from C++ code.
-
- The \l QGeoAddress::street now holds only the street name.
-
- Same applies to \l [QML] {Address} QML counterpart. The \l [QML]
- {Address::street} property is now used only for street name, while the
- \l [QML] {Address::streetNumber} property is used for other important
- address details.
-
- \section2 Add timeout argument to \l [QML] {PositionSource::update()}
-
- The \c timeout is specified in milliseconds. If the \c timeout is zero
- (the default value), it defaults to a reasonable timeout period as
- appropriate for the source.
-
- \section2 Refactor \l QGeoSatelliteInfo, \l QGeoPositionInfo and \l QGeoAreaMonitorInfo classes
-
- These classes now use \l QExplicitlySharedDataPointer in their
- implementation. It means that the classes implement copy-on-write. It makes
- them cheap to copy, so that they can be passed by value.
-
- Another improvement is the addition of support for the efficient move
- operations.
-
- \section1 Changes in Qt Positioning plugin implementation
-
- This section provides information about the changes in plugin interface.
-
- In Qt 5 for we had two versions of plugin interface:
-
- \list
-
- \li \c QGeoPositionInfoSourceFactory which provided the basic features.
- \li \c QGeoPositionInfoSourceFactoryV2 which extended the base class with
- the possibility to provide custom parameters for the created objects.
-
- \endlist
-
- In Qt 6 we merged these two implementations into one, leaving only the
- \l QGeoPositionInfoSourceFactory class. Its methods now allow to pass
- custom parameters.
-
- \note The interface \e identifier is updated to reflect the major version
- update. Use \c {"org.qt-project.qt.position.sourcefactory/6.0"} in your
- Qt Positioning plugins.
-
- Here is an example of plugin class declaration:
-
- \code
- class MyPlugin : public QObject, public QGeoPositionInfoSourceFactory
- {
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/6.0"
- FILE "plugin.json")
- Q_INTERFACES(QGeoPositionInfoSourceFactory)
-
- public:
- QGeoPositionInfoSource *positionInfoSource(QObject *parent, const QVariantMap &parameters) override;
- QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent, const QVariantMap &parameters) override;
- QGeoAreaMonitorSource *areaMonitor(QObject *parent, const QVariantMap &parameters) override;
- };
- \endcode
-
-*/
diff --git a/src/positioning/doc/src/qtpositioning-android.qdoc b/src/positioning/doc/src/qtpositioning-android.qdoc
deleted file mode 100644
index 1857574e..00000000
--- a/src/positioning/doc/src/qtpositioning-android.qdoc
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtpositioning-android.html
-\inmodule QtPositioning
-\title Qt Positioning on Android
-\brief Notes on using Qt Positioning on Android
-
-\section1 Using Qt Positioning from Android Services
-
-Using Qt Positioning from a service requires several extra actions to be taken,
-depending on the Android version. The sections below give more details on
-these actions.
-
-\note Since Android 8 (API level 26), the OS limits how frequently an
-application can retrieve the user's current location while running in the
-background. The application will normally be able to receive location updates
-only a few times each hour. For more information, see
-\l {Background Location Limits}.
-
-\section2 Using Foreground Service
-
-Since Android 8 (API level 26), the background service can be killed by the
-Android OS when the application goes to the background. This normally happens
-after around a minute of running in the background. To keep the location service
-running, the service should be implemented as a \l {Foreground Service}. Such
-service shows a status bar notification, which cannot be dismissed until the
-service is stopped or removed from the foreground. This allows the user to be
-always aware of the important background activities.
-
-\note Since Android 9 (API level 28), foreground services require a special
-\c FOREGROUND_SERVICE permission. See the Android documentation for more
-details on implementing foreground services.
-
-\section2 Use Background Location Permission
-
-Since Android 10 (API level 29), the service \e must request the
-\l {ACCESS_BACKGROUND_LOCATION} permission. It should be added to the
-\c AndroidManifest.xml file as follows:
-
-\badcode
-<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
-\endcode
-
-\note Once the permission is added to \c {AndroidManifest.xml}, it is still
-required to explicitly allow the constant access to the location services
-for the application. To do it, one should navigate to \uicontrol Settings ->
-\uicontrol {Apps}, select a proper application, open its permissions, and
-specify the \uicontrol {Allow all the time} permission for Location
-(see the screenshot below).
-
-\image permissions.png
-
-Check \l {Access Location in the Background} Android documentation for more
-details.
-
-*/
diff --git a/src/positioning/doc/src/qtpositioning-examples.qdoc b/src/positioning/doc/src/qtpositioning-examples.qdoc
deleted file mode 100644
index fbcc9a40..00000000
--- a/src/positioning/doc/src/qtpositioning-examples.qdoc
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \group qtpositioning-examples
- \title Qt Positioning Examples
- \brief Examples for the Qt Positioning module
- \ingroup all-examples
- \ingroup qtpositioning
-
- The list of \l {Qt Positioning} examples demonstrating how to use
- Positioning API from C++ and QML.
-
-*/
diff --git a/src/positioning/doc/src/qtpositioning-plugins.qdoc b/src/positioning/doc/src/qtpositioning-plugins.qdoc
deleted file mode 100644
index c75896f4..00000000
--- a/src/positioning/doc/src/qtpositioning-plugins.qdoc
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\page qtpositioning-plugins.html
-\title Qt Positioning Plugins
-\brief Default Plugins and Implementing Qt Positioning plugins
-
-Qt Positioning provides the majority of its functionality through plugins.
-This document outlines how to develop a new position plugin.
-
-\section1 Default plugins
-Some plugins already ship with Qt. These are:
-
-\table
- \row
- \li \b android
- \li Wraps Android positioning subsystem. Available only on Android.
- \row
- \li \b corelocation
- \li Wraps iOS and macOS positioning subsystems. Available only on Apple platforms supporting corelocation.
- \row
- \li \b geoclue2
- \li A \l {Qt Positioning GeoClue v2 plugin}{GeoClue v2} backend that
- provides an interface to the GeoClue v2 D-Bus service.
- \row
- \li \b gypsy
- \li A \l {Qt Positioning Gypsy plugin}{Gypsy} backend that provides
- an interface to the Gypsy daemon.
- \row
- \li \b winrt
- \li Wraps WinRT positioning subsystem. Available only on WinRT and Windows10.
- \row
- \li \b nmea
- \li An \l {Qt Positioning NMEA plugin}{NMEA} backend that parses NMEA
- streams from a GPS receiver to provide position updates. This plugin can
- use serial port, socket or file as a source.
- \row
- \li \b positionpoll
- \li A backend providing only area monitoring functionalities via polling on position updates.
-\endtable
-
-
-\section1 Plugin Description
-
-Each plugin is described by a json file. The json describes the plugins capabilities and
-version. Below is an example of a json file used by the postionpoll plugin:
-
-\quotefile ../../../plugins/position/positionpoll/plugin.json
-
-The entries have the following meaning:
-
-\table
- \header
- \li Key
- \li Description
- \row
- \li Keys
- \li The unique name/key of the plugin. Each position plugin must have a unique name.
- \row
- \li Provider
- \li The provider name of the services. Multiple plugins may have the same name.
- In such cases the Version string will be used to further distinguish the plugins.
- \row
- \li Position
- \li Set to \c true if the plugin implements a \l QGeoPositionInfoSource.
- \row
- \li Satellite
- \li Set to \c true if the plugin implements a \l QGeoSatelliteInfoSource.
- \row
- \li Monitor
- \li Set to \c true if the plugin implements a \l QGeoAreaMonitorSource.
- \row
- \li Priority
- \li The plugin priority. If multiple plugins have the same provider name, the plugin
- with the higest priority will be used.
-\endtable
-
-\section1 Implementing Plugins
-
-A plugin implementer needs to subclass \l QGeoPositionInfoSourceFactory and override one or more of
-its functions. If a plugin does not support a specific feature the function should return 0 or
-utilize the default implementation.
-
-\list
- \li \l QGeoPositionInfoSourceFactory::areaMonitor()
- \li \l QGeoPositionInfoSourceFactory::positionInfoSource()
- \li \l QGeoPositionInfoSourceFactory::satelliteInfoSource()
-\endlist
-*/
diff --git a/src/positioning/doc/src/qtpositioning-qml.qdoc b/src/positioning/doc/src/qtpositioning-qml.qdoc
deleted file mode 100644
index 0c84484b..00000000
--- a/src/positioning/doc/src/qtpositioning-qml.qdoc
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \qmlmodule QtPositioning \QtVer
- \title Qt Positioning QML Types
- \ingroup qmlmodules
- \brief Provides QML types for position information.
-
- \section1 Overview
-
- The identifying string for this module is \e QtPositioning. To use the QML
- from this module, include the following import statement in the QML file:
-
- \qml \QtVer
- import QtPositioning \1
- \endqml
-
- \section2 Positioning QML Concepts
-
- Position information can come from a variety of sources including
- satellites, Wi-Fi, text files and so on. The position is described by the
- latitude, longitude, and the altitude in meters. For more information, see
- the Wikipedia page on
- \l {http://en.wikipedia.org/wiki/Geographic_coordinate}
- {Geographic Coordinates}.
-
- The QML position is stored in a \l {coordinate} which contains the
- latitude, longitude and altitude of the device. The \l {QtPositioning::}
- {Location} contains this \l {coordinate} and adds an address, and also has
- a bounding box which defines the recommended viewing region when displaying
- the location.
-
- Now that the device has a position, with regular updates the API can
- determine the speed and heading of the device. It can also define a
- box-shaped or circular region that triggers notifications when the device
- either leaves or enters that region.
-
- More detailed information on retrieving the current position can be found
- under \l {Positioning (QML)}{Location Positioning via QML}.
-
- \section1 Basic Types
-
- \annotatedlist qml-QtPositioning5-basictypes
-
- \section1 Alphabetical Listing of All QML Types
-*/
diff --git a/src/positioning/doc/src/qtpositioning.qdoc b/src/positioning/doc/src/qtpositioning.qdoc
deleted file mode 100644
index e4e7f8a4..00000000
--- a/src/positioning/doc/src/qtpositioning.qdoc
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \module QtPositioning
- \title Qt Positioning C++ Classes
- \ingroup modules
- \qtcmakepackage Positioning
- \qtvariable positioning
-
- \brief The Positioning module provides positioning information via QML and C++ interfaces.
-
- To load the Qt Positioning module, add the following statement to your .qml files
-
- \snippet doc_src_qtpositioning.qml import
-
- For C++ projects include the header appropriate for the current use case,
- for example applications using routes may use
-
- \code
- #include <QGeoCoordinate>
- \endcode
-
- \include module-use.qdocinc using qt module
-
- \badcode
- find_package(Qt6 COMPONENTS Positioning REQUIRED)
- target_link_libraries(mytarget PRIVATE Qt6::Positioning)
- \endcode
-
- \include module-use.qdocinc building with qmake
-
- \badcode
- QT += positioning
- \endcode
-
- See more in the \l{Qt Positioning}{Qt Positioning Overview}.
-
-*/
-
-
-
-/*!
-\page qtpositioning-index.html
-\title Qt Positioning
-\brief The Qt Positioning API provides positioning information via QML and C++ interfaces.
-\ingroup technology-apis
-
-The Qt Positioning API provides positioning information via QML and C++ interfaces.
-
-Currently the API is supported on \l {Qt for Android}{Android},
-\l {Qt for iOS}{iOS}, \l {Qt for macOS}{\macos}, \l {Qt for Linux/X11}{Linux},
-and \l {Qt for Windows}{Windows} (with GPS receivers exposed as a serial port
-providing NMEA sentences or using \c {Windows.Devices.Geolocation}).
-
-\section1 Overview
-
-The Qt Positioning API gives developers the ability to determine a position by
-using a variety of possible sources, including satellite, or wifi, or text file,
-and so on. That information can then be used to for example determine a position
-on a map. In addition satellite information can be retrieved and area based monitoring
-can be performed.
-
-\include module-use.qdocinc using qt module
-
-\badcode
-find_package(Qt6 COMPONENTS Positioning REQUIRED)
-target_link_libraries(mytarget PRIVATE Qt6::Positioning)
-\endcode
-
-See also the \l {Build with CMake} overview.
-
-\include module-use.qdocinc building with qmake
-
-\badcode
-QT += positioning
-\endcode
-
-\section2 Getting Started
-
-To load the Qt Positioning module, add the following statement to your .qml files
-
-\snippet doc_src_qtpositioning.qml import
-
-For C++ projects include the header appropriate for the current use case,
-for example applications using routes may use
-
-\code
-#include <QGeoCoordinate>
-\endcode
-
-\section1 Module Evolution
-
-\l {Changes to Qt Positioning} lists important changes in the module API and
-functionality that were done for the Qt 6 series of Qt.
-
-\section1 Licenses
-
-Qt Positioning is available under commercial licenses from \l{The Qt Company}.
-In addition, it is available under free software licenses. Since Qt 5.4,
-these free software licenses are
-\l{GNU Lesser General Public License, version 3}, or
-the \l{GNU General Public License, version 2}.
-See \l{Qt Licensing} for further details.
-
-\section1 Articles and Guides
-
-\list
- \li \l {Positioning (C++)} {Positioning introduction for C++}
- \li \l {Positioning (QML)} {Positioning introduction for QML}
- \li \l {Qt Positioning Plugins}
- \li \l {Interfaces between C++ and QML Code in Qt Positioning}
- \li \l {Qt Positioning on Android}
-\endlist
-
-\section1 Reference
-
-\list
- \li \l {Qt Positioning C++ Classes}
- \li \l {Qt Positioning QML Types}
-\endlist
-
-\section1 Examples
-
-\list
- \li \l {Qt Positioning Examples}
-\endlist
-
-*/
diff --git a/src/positioning/positioning.pro b/src/positioning/positioning.pro
deleted file mode 100644
index 64a6cc2e..00000000
--- a/src/positioning/positioning.pro
+++ /dev/null
@@ -1,96 +0,0 @@
-TARGET = QtPositioning
-QT = core-private
-CONFIG += simd optimize_full
-
-#INCLUDEPATH += ../3rdparty/poly2tri
-INCLUDEPATH += ../3rdparty/clipper
-INCLUDEPATH += ../3rdparty/clip2tri
-
-QMAKE_DOCS = $$PWD/doc/qtpositioning.qdocconf
-OTHER_FILES += configure.json doc/src/*.qdoc doc/src/plugins/*.qdoc # show .qdoc files in Qt Creator
-
-ANDROID_BUNDLED_JAR_DEPENDENCIES = \
- jar/Qt$${QT_MAJOR_VERSION}AndroidPositioning.jar:org.qtproject.qt.android.positioning.QtPositioning
-ANDROID_PERMISSIONS += \
- android.permission.ACCESS_FINE_LOCATION
-ANDROID_FEATURES += \
- android.hardware.location.gps
-ANDROID_LIB_DEPENDENCIES = \
- plugins/position/libplugins_position_qtposition_android.so
-MODULE_WINRT_CAPABILITIES_DEVICE += \
- location
-MODULE_PLUGIN_TYPES = \
- position
-
-PUBLIC_HEADERS += \
- qgeoaddress.h \
- qgeoareamonitorinfo.h \
- qgeoareamonitorsource.h \
- qgeoshape.h \
- qgeorectangle.h \
- qgeocircle.h \
- qgeocoordinate.h \
- qgeolocation.h \
- qgeopositioninfo.h \
- qgeopositioninfosource.h \
- qgeosatelliteinfo.h \
- qgeosatelliteinfosource.h \
- qnmeapositioninfosource.h \
- qgeopositioninfosourcefactory.h \
- qpositioningglobal.h \
- qgeopolygon.h \
- qgeopath.h \
-
-PRIVATE_HEADERS += \
- qgeoaddress_p.h \
- qgeoshape_p.h \
- qgeorectangle_p.h \
- qgeocircle_p.h \
- qgeolocation_p.h \
- qlocationutils_p.h \
- qnmeapositioninfosource_p.h \
- qgeocoordinate_p.h \
- qgeopositioninfosource_p.h \
- qdoublevector2d_p.h \
- qdoublevector3d_p.h \
- qwebmercator_p.h \
- qpositioningglobal_p.h \
- qdoublematrix4x4_p.h \
- qgeopath_p.h \
- qgeopolygon_p.h \
- qgeocoordinateobject_p.h \
- qgeopositioninfo_p.h \
- qgeosatelliteinfo_p.h \
- qgeosatelliteinfosource_p.h \
- qclipperutils_p.h
-
-SOURCES += \
- qgeoaddress.cpp \
- qgeoareamonitorsource.cpp \
- qgeoareamonitorinfo.cpp \
- qgeoshape.cpp \
- qgeorectangle.cpp \
- qgeocircle.cpp \
- qgeocoordinate.cpp \
- qgeolocation.cpp \
- qgeopositioninfo.cpp \
- qgeopositioninfosource.cpp \
- qgeosatelliteinfo.cpp \
- qgeosatelliteinfosource.cpp \
- qlocationutils.cpp \
- qnmeapositioninfosource.cpp \
- qgeopositioninfosourcefactory.cpp \
- qdoublevector2d.cpp \
- qdoublevector3d.cpp \
- qgeopath.cpp \
- qgeopolygon.cpp \
- qwebmercator.cpp \
- qdoublematrix4x4.cpp \
- qclipperutils.cpp \
- qgeocoordinateobject.cpp
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
-
-load(qt_module)
-
-LIBS_PRIVATE += -L$$MODULE_BASE_OUTDIR/lib -lqt_clip2tri$$qtPlatformTargetSuffix()
diff --git a/src/positioning/qclipperutils.cpp b/src/positioning/qclipperutils.cpp
deleted file mode 100644
index 2f69d984..00000000
--- a/src/positioning/qclipperutils.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qclipperutils_p.h"
-
-QT_BEGIN_NAMESPACE
-
-static const double kClipperScaleFactor = 281474976710656.0; // 48 bits of precision
-static const double kClipperScaleFactorInv = 1.0 / kClipperScaleFactor;
-
-double QClipperUtils::clipperScaleFactor()
-{
- return kClipperScaleFactor;
-}
-
-QDoubleVector2D QClipperUtils::toVector2D(const IntPoint &p)
-{
- return QDoubleVector2D(double(p.X) * kClipperScaleFactorInv, double(p.Y) * kClipperScaleFactorInv);
-}
-
-IntPoint QClipperUtils::toIntPoint(const QDoubleVector2D &p)
-{
- return IntPoint(cInt(p.x() * kClipperScaleFactor), cInt(p.y() * kClipperScaleFactor));
-}
-
-QList<QDoubleVector2D> QClipperUtils::pathToQList(const Path &path)
-{
- QList<QDoubleVector2D> res;
- res.reserve(int(path.size()));
- for (const IntPoint &ip: path)
- res.append(toVector2D(ip));
- return res;
-}
-
-QList<QList<QDoubleVector2D> > QClipperUtils::pathsToQList(const Paths &paths)
-{
- QList<QList<QDoubleVector2D> > res;
- res.reserve(int(paths.size()));
- for (const Path &p: paths) {
- res.append(pathToQList(p));
- }
- return res;
-}
-
-Path QClipperUtils::qListToPath(const QList<QDoubleVector2D> &list)
-{
- Path res;
- res.reserve(list.size());
- for (const QDoubleVector2D &p: list)
- res.push_back(toIntPoint(p));
- return res;
-}
-
-Paths QClipperUtils::qListToPaths(const QList<QList<QDoubleVector2D> > &lists)
-{
- Paths res;
- res.reserve(lists.size());
- for (const QList<QDoubleVector2D> &l: lists) {
- res.push_back(qListToPath(l));
- }
- return res;
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qclipperutils_p.h b/src/positioning/qclipperutils_p.h
deleted file mode 100644
index f05d9838..00000000
--- a/src/positioning/qclipperutils_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QCLIPPERUTILS_P_H
-#define QCLIPPERUTILS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-/*
- * This file is intended to be include only in source files of
- * QtPositioning/QtLocation. It is in QtPositioning to enable manipulation
- * of geo polygons
- */
-
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include <QtCore/QtGlobal>
-#include <QtCore/QList>
-#include <cmath>
-/* clip2tri triangulator includes */
-#include <clip2tri.h>
-#include <QtPositioning/private/qdoublevector2d_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONING_PRIVATE_EXPORT QClipperUtils
-{
-public:
- static double clipperScaleFactor();
-
- static QDoubleVector2D toVector2D(const IntPoint &p);
- static IntPoint toIntPoint(const QDoubleVector2D &p);
-
- static QList<QDoubleVector2D> pathToQList(const Path &path);
- static QList<QList<QDoubleVector2D> > pathsToQList(const Paths &paths);
-
- static Path qListToPath(const QList<QDoubleVector2D> &list);
- static Paths qListToPaths(const QList<QList<QDoubleVector2D> > &lists);
-};
-
-QT_END_NAMESPACE
-
-#endif // QCLIPPERUTILS_P_H
diff --git a/src/positioning/qdoublematrix4x4.cpp b/src/positioning/qdoublematrix4x4.cpp
deleted file mode 100644
index 0bc56460..00000000
--- a/src/positioning/qdoublematrix4x4.cpp
+++ /dev/null
@@ -1,1112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdoublematrix4x4_p.h"
-#include <QtCore/qmath.h>
-//#include <QtCore/qvariant.h>
-#include <QtCore/qdatastream.h>
-#include <cmath>
-
-QT_BEGIN_NAMESPACE
-
-static const double inv_dist_to_plane = 1.0 / 1024.0;
-
-QDoubleMatrix4x4::QDoubleMatrix4x4(const double *values)
-{
- for (int row = 0; row < 4; ++row)
- for (int col = 0; col < 4; ++col)
- m[col][row] = values[row * 4 + col];
- flagBits = General;
-}
-
-QDoubleMatrix4x4::QDoubleMatrix4x4(const double *values, int cols, int rows)
-{
- for (int col = 0; col < 4; ++col) {
- for (int row = 0; row < 4; ++row) {
- if (col < cols && row < rows)
- m[col][row] = values[col * rows + row];
- else if (col == row)
- m[col][row] = 1.0;
- else
- m[col][row] = 0.0;
- }
- }
- flagBits = General;
-}
-
-static inline double matrixDet2(const double m[4][4], int col0, int col1, int row0, int row1)
-{
- return m[col0][row0] * m[col1][row1] - m[col0][row1] * m[col1][row0];
-}
-
-static inline double matrixDet3
- (const double m[4][4], int col0, int col1, int col2,
- int row0, int row1, int row2)
-{
- return m[col0][row0] * matrixDet2(m, col1, col2, row1, row2)
- - m[col1][row0] * matrixDet2(m, col0, col2, row1, row2)
- + m[col2][row0] * matrixDet2(m, col0, col1, row1, row2);
-}
-
-static inline double matrixDet4(const double m[4][4])
-{
- double det;
- det = m[0][0] * matrixDet3(m, 1, 2, 3, 1, 2, 3);
- det -= m[1][0] * matrixDet3(m, 0, 2, 3, 1, 2, 3);
- det += m[2][0] * matrixDet3(m, 0, 1, 3, 1, 2, 3);
- det -= m[3][0] * matrixDet3(m, 0, 1, 2, 1, 2, 3);
- return det;
-}
-
-double QDoubleMatrix4x4::determinant() const
-{
- if ((flagBits & ~(Translation | Rotation2D | Rotation)) == Identity)
- return 1.0;
-
- if (flagBits < Rotation2D)
- return m[0][0] * m[1][1] * m[2][2]; // Translation | Scale
- if (flagBits < Perspective)
- return matrixDet3(m, 0, 1, 2, 0, 1, 2);
- return matrixDet4(m);
-}
-
-QDoubleMatrix4x4 QDoubleMatrix4x4::inverted(bool *invertible) const
-{
- // Handle some of the easy cases first.
- if (flagBits == Identity) {
- if (invertible)
- *invertible = true;
- return QDoubleMatrix4x4();
- } else if (flagBits == Translation) {
- QDoubleMatrix4x4 inv;
- inv.m[3][0] = -m[3][0];
- inv.m[3][1] = -m[3][1];
- inv.m[3][2] = -m[3][2];
- inv.flagBits = Translation;
- if (invertible)
- *invertible = true;
- return inv;
- } else if (flagBits < Rotation2D) {
- // Translation | Scale
- if (m[0][0] == 0 || m[1][1] == 0 || m[2][2] == 0) {
- if (invertible)
- *invertible = false;
- return QDoubleMatrix4x4();
- }
- QDoubleMatrix4x4 inv;
- inv.m[0][0] = 1.0 / m[0][0];
- inv.m[1][1] = 1.0 / m[1][1];
- inv.m[2][2] = 1.0 / m[2][2];
- inv.m[3][0] = -m[3][0] * inv.m[0][0];
- inv.m[3][1] = -m[3][1] * inv.m[1][1];
- inv.m[3][2] = -m[3][2] * inv.m[2][2];
- inv.flagBits = flagBits;
-
- if (invertible)
- *invertible = true;
- return inv;
- } else if ((flagBits & ~(Translation | Rotation2D | Rotation)) == Identity) {
- if (invertible)
- *invertible = true;
- return orthonormalInverse();
- } else if (flagBits < Perspective) {
- QDoubleMatrix4x4 inv(1); // The "1" says to not load the identity.
-
- double det = matrixDet3(m, 0, 1, 2, 0, 1, 2);
- if (det == 0.0) {
- if (invertible)
- *invertible = false;
- return QDoubleMatrix4x4();
- }
- det = 1.0 / det;
-
- inv.m[0][0] = matrixDet2(m, 1, 2, 1, 2) * det;
- inv.m[0][1] = -matrixDet2(m, 0, 2, 1, 2) * det;
- inv.m[0][2] = matrixDet2(m, 0, 1, 1, 2) * det;
- inv.m[0][3] = 0;
- inv.m[1][0] = -matrixDet2(m, 1, 2, 0, 2) * det;
- inv.m[1][1] = matrixDet2(m, 0, 2, 0, 2) * det;
- inv.m[1][2] = -matrixDet2(m, 0, 1, 0, 2) * det;
- inv.m[1][3] = 0;
- inv.m[2][0] = matrixDet2(m, 1, 2, 0, 1) * det;
- inv.m[2][1] = -matrixDet2(m, 0, 2, 0, 1) * det;
- inv.m[2][2] = matrixDet2(m, 0, 1, 0, 1) * det;
- inv.m[2][3] = 0;
- inv.m[3][0] = -inv.m[0][0] * m[3][0] - inv.m[1][0] * m[3][1] - inv.m[2][0] * m[3][2];
- inv.m[3][1] = -inv.m[0][1] * m[3][0] - inv.m[1][1] * m[3][1] - inv.m[2][1] * m[3][2];
- inv.m[3][2] = -inv.m[0][2] * m[3][0] - inv.m[1][2] * m[3][1] - inv.m[2][2] * m[3][2];
- inv.m[3][3] = 1;
- inv.flagBits = flagBits;
-
- if (invertible)
- *invertible = true;
- return inv;
- }
-
- QDoubleMatrix4x4 inv(1); // The "1" says to not load the identity.
-
- double det = matrixDet4(m);
- if (det == 0.0) {
- if (invertible)
- *invertible = false;
- return QDoubleMatrix4x4();
- }
- det = 1.0 / det;
-
- inv.m[0][0] = matrixDet3(m, 1, 2, 3, 1, 2, 3) * det;
- inv.m[0][1] = -matrixDet3(m, 0, 2, 3, 1, 2, 3) * det;
- inv.m[0][2] = matrixDet3(m, 0, 1, 3, 1, 2, 3) * det;
- inv.m[0][3] = -matrixDet3(m, 0, 1, 2, 1, 2, 3) * det;
- inv.m[1][0] = -matrixDet3(m, 1, 2, 3, 0, 2, 3) * det;
- inv.m[1][1] = matrixDet3(m, 0, 2, 3, 0, 2, 3) * det;
- inv.m[1][2] = -matrixDet3(m, 0, 1, 3, 0, 2, 3) * det;
- inv.m[1][3] = matrixDet3(m, 0, 1, 2, 0, 2, 3) * det;
- inv.m[2][0] = matrixDet3(m, 1, 2, 3, 0, 1, 3) * det;
- inv.m[2][1] = -matrixDet3(m, 0, 2, 3, 0, 1, 3) * det;
- inv.m[2][2] = matrixDet3(m, 0, 1, 3, 0, 1, 3) * det;
- inv.m[2][3] = -matrixDet3(m, 0, 1, 2, 0, 1, 3) * det;
- inv.m[3][0] = -matrixDet3(m, 1, 2, 3, 0, 1, 2) * det;
- inv.m[3][1] = matrixDet3(m, 0, 2, 3, 0, 1, 2) * det;
- inv.m[3][2] = -matrixDet3(m, 0, 1, 3, 0, 1, 2) * det;
- inv.m[3][3] = matrixDet3(m, 0, 1, 2, 0, 1, 2) * det;
- inv.flagBits = flagBits;
-
- if (invertible)
- *invertible = true;
- return inv;
-}
-
-QDoubleMatrix4x4 QDoubleMatrix4x4::transposed() const
-{
- QDoubleMatrix4x4 result(1); // The "1" says to not load the identity.
- for (int row = 0; row < 4; ++row) {
- for (int col = 0; col < 4; ++col) {
- result.m[col][row] = m[row][col];
- }
- }
- // When a translation is transposed, it becomes a perspective transformation.
- result.flagBits = (flagBits & Translation ? General : flagBits);
- return result;
-}
-
-QDoubleMatrix4x4& QDoubleMatrix4x4::operator/=(double divisor)
-{
- m[0][0] /= divisor;
- m[0][1] /= divisor;
- m[0][2] /= divisor;
- m[0][3] /= divisor;
- m[1][0] /= divisor;
- m[1][1] /= divisor;
- m[1][2] /= divisor;
- m[1][3] /= divisor;
- m[2][0] /= divisor;
- m[2][1] /= divisor;
- m[2][2] /= divisor;
- m[2][3] /= divisor;
- m[3][0] /= divisor;
- m[3][1] /= divisor;
- m[3][2] /= divisor;
- m[3][3] /= divisor;
- flagBits = General;
- return *this;
-}
-
-QDoubleMatrix4x4 operator/(const QDoubleMatrix4x4& matrix, double divisor)
-{
- QDoubleMatrix4x4 m(1); // The "1" says to not load the identity.
- m.m[0][0] = matrix.m[0][0] / divisor;
- m.m[0][1] = matrix.m[0][1] / divisor;
- m.m[0][2] = matrix.m[0][2] / divisor;
- m.m[0][3] = matrix.m[0][3] / divisor;
- m.m[1][0] = matrix.m[1][0] / divisor;
- m.m[1][1] = matrix.m[1][1] / divisor;
- m.m[1][2] = matrix.m[1][2] / divisor;
- m.m[1][3] = matrix.m[1][3] / divisor;
- m.m[2][0] = matrix.m[2][0] / divisor;
- m.m[2][1] = matrix.m[2][1] / divisor;
- m.m[2][2] = matrix.m[2][2] / divisor;
- m.m[2][3] = matrix.m[2][3] / divisor;
- m.m[3][0] = matrix.m[3][0] / divisor;
- m.m[3][1] = matrix.m[3][1] / divisor;
- m.m[3][2] = matrix.m[3][2] / divisor;
- m.m[3][3] = matrix.m[3][3] / divisor;
- m.flagBits = QDoubleMatrix4x4::General;
- return m;
-}
-
-void QDoubleMatrix4x4::scale(const QDoubleVector3D& vector)
-{
- double vx = vector.x();
- double vy = vector.y();
- double vz = vector.z();
- if (flagBits < Scale) {
- m[0][0] = vx;
- m[1][1] = vy;
- m[2][2] = vz;
- } else if (flagBits < Rotation2D) {
- m[0][0] *= vx;
- m[1][1] *= vy;
- m[2][2] *= vz;
- } else if (flagBits < Rotation) {
- m[0][0] *= vx;
- m[0][1] *= vx;
- m[1][0] *= vy;
- m[1][1] *= vy;
- m[2][2] *= vz;
- } else {
- m[0][0] *= vx;
- m[0][1] *= vx;
- m[0][2] *= vx;
- m[0][3] *= vx;
- m[1][0] *= vy;
- m[1][1] *= vy;
- m[1][2] *= vy;
- m[1][3] *= vy;
- m[2][0] *= vz;
- m[2][1] *= vz;
- m[2][2] *= vz;
- m[2][3] *= vz;
- }
- flagBits |= Scale;
-}
-
-void QDoubleMatrix4x4::scale(double x, double y)
-{
- if (flagBits < Scale) {
- m[0][0] = x;
- m[1][1] = y;
- } else if (flagBits < Rotation2D) {
- m[0][0] *= x;
- m[1][1] *= y;
- } else if (flagBits < Rotation) {
- m[0][0] *= x;
- m[0][1] *= x;
- m[1][0] *= y;
- m[1][1] *= y;
- } else {
- m[0][0] *= x;
- m[0][1] *= x;
- m[0][2] *= x;
- m[0][3] *= x;
- m[1][0] *= y;
- m[1][1] *= y;
- m[1][2] *= y;
- m[1][3] *= y;
- }
- flagBits |= Scale;
-}
-
-void QDoubleMatrix4x4::scale(double x, double y, double z)
-{
- if (flagBits < Scale) {
- m[0][0] = x;
- m[1][1] = y;
- m[2][2] = z;
- } else if (flagBits < Rotation2D) {
- m[0][0] *= x;
- m[1][1] *= y;
- m[2][2] *= z;
- } else if (flagBits < Rotation) {
- m[0][0] *= x;
- m[0][1] *= x;
- m[1][0] *= y;
- m[1][1] *= y;
- m[2][2] *= z;
- } else {
- m[0][0] *= x;
- m[0][1] *= x;
- m[0][2] *= x;
- m[0][3] *= x;
- m[1][0] *= y;
- m[1][1] *= y;
- m[1][2] *= y;
- m[1][3] *= y;
- m[2][0] *= z;
- m[2][1] *= z;
- m[2][2] *= z;
- m[2][3] *= z;
- }
- flagBits |= Scale;
-}
-
-void QDoubleMatrix4x4::scale(double factor)
-{
- if (flagBits < Scale) {
- m[0][0] = factor;
- m[1][1] = factor;
- m[2][2] = factor;
- } else if (flagBits < Rotation2D) {
- m[0][0] *= factor;
- m[1][1] *= factor;
- m[2][2] *= factor;
- } else if (flagBits < Rotation) {
- m[0][0] *= factor;
- m[0][1] *= factor;
- m[1][0] *= factor;
- m[1][1] *= factor;
- m[2][2] *= factor;
- } else {
- m[0][0] *= factor;
- m[0][1] *= factor;
- m[0][2] *= factor;
- m[0][3] *= factor;
- m[1][0] *= factor;
- m[1][1] *= factor;
- m[1][2] *= factor;
- m[1][3] *= factor;
- m[2][0] *= factor;
- m[2][1] *= factor;
- m[2][2] *= factor;
- m[2][3] *= factor;
- }
- flagBits |= Scale;
-}
-
-void QDoubleMatrix4x4::translate(const QDoubleVector3D& vector)
-{
- double vx = vector.x();
- double vy = vector.y();
- double vz = vector.z();
- if (flagBits == Identity) {
- m[3][0] = vx;
- m[3][1] = vy;
- m[3][2] = vz;
- } else if (flagBits == Translation) {
- m[3][0] += vx;
- m[3][1] += vy;
- m[3][2] += vz;
- } else if (flagBits == Scale) {
- m[3][0] = m[0][0] * vx;
- m[3][1] = m[1][1] * vy;
- m[3][2] = m[2][2] * vz;
- } else if (flagBits == (Translation | Scale)) {
- m[3][0] += m[0][0] * vx;
- m[3][1] += m[1][1] * vy;
- m[3][2] += m[2][2] * vz;
- } else if (flagBits < Rotation) {
- m[3][0] += m[0][0] * vx + m[1][0] * vy;
- m[3][1] += m[0][1] * vx + m[1][1] * vy;
- m[3][2] += m[2][2] * vz;
- } else {
- m[3][0] += m[0][0] * vx + m[1][0] * vy + m[2][0] * vz;
- m[3][1] += m[0][1] * vx + m[1][1] * vy + m[2][1] * vz;
- m[3][2] += m[0][2] * vx + m[1][2] * vy + m[2][2] * vz;
- m[3][3] += m[0][3] * vx + m[1][3] * vy + m[2][3] * vz;
- }
- flagBits |= Translation;
-}
-
-void QDoubleMatrix4x4::translate(double x, double y)
-{
- if (flagBits == Identity) {
- m[3][0] = x;
- m[3][1] = y;
- } else if (flagBits == Translation) {
- m[3][0] += x;
- m[3][1] += y;
- } else if (flagBits == Scale) {
- m[3][0] = m[0][0] * x;
- m[3][1] = m[1][1] * y;
- } else if (flagBits == (Translation | Scale)) {
- m[3][0] += m[0][0] * x;
- m[3][1] += m[1][1] * y;
- } else if (flagBits < Rotation) {
- m[3][0] += m[0][0] * x + m[1][0] * y;
- m[3][1] += m[0][1] * x + m[1][1] * y;
- } else {
- m[3][0] += m[0][0] * x + m[1][0] * y;
- m[3][1] += m[0][1] * x + m[1][1] * y;
- m[3][2] += m[0][2] * x + m[1][2] * y;
- m[3][3] += m[0][3] * x + m[1][3] * y;
- }
- flagBits |= Translation;
-}
-
-void QDoubleMatrix4x4::translate(double x, double y, double z)
-{
- if (flagBits == Identity) {
- m[3][0] = x;
- m[3][1] = y;
- m[3][2] = z;
- } else if (flagBits == Translation) {
- m[3][0] += x;
- m[3][1] += y;
- m[3][2] += z;
- } else if (flagBits == Scale) {
- m[3][0] = m[0][0] * x;
- m[3][1] = m[1][1] * y;
- m[3][2] = m[2][2] * z;
- } else if (flagBits == (Translation | Scale)) {
- m[3][0] += m[0][0] * x;
- m[3][1] += m[1][1] * y;
- m[3][2] += m[2][2] * z;
- } else if (flagBits < Rotation) {
- m[3][0] += m[0][0] * x + m[1][0] * y;
- m[3][1] += m[0][1] * x + m[1][1] * y;
- m[3][2] += m[2][2] * z;
- } else {
- m[3][0] += m[0][0] * x + m[1][0] * y + m[2][0] * z;
- m[3][1] += m[0][1] * x + m[1][1] * y + m[2][1] * z;
- m[3][2] += m[0][2] * x + m[1][2] * y + m[2][2] * z;
- m[3][3] += m[0][3] * x + m[1][3] * y + m[2][3] * z;
- }
- flagBits |= Translation;
-}
-
-void QDoubleMatrix4x4::rotate(double angle, const QDoubleVector3D& vector)
-{
- rotate(angle, vector.x(), vector.y(), vector.z());
-}
-
-void QDoubleMatrix4x4::rotate(double angle, double x, double y, double z)
-{
- if (angle == 0.0)
- return;
- double c, s;
- if (angle == 90.0 || angle == -270.0) {
- s = 1.0;
- c = 0.0;
- } else if (angle == -90.0 || angle == 270.0) {
- s = -1.0;
- c = 0.0;
- } else if (angle == 180.0 || angle == -180.0) {
- s = 0.0;
- c = -1.0;
- } else {
- double a = qDegreesToRadians(angle);
- c = std::cos(a);
- s = std::sin(a);
- }
- if (x == 0.0) {
- if (y == 0.0) {
- if (z != 0.0) {
- // Rotate around the Z axis.
- if (z < 0)
- s = -s;
- double tmp;
- m[0][0] = (tmp = m[0][0]) * c + m[1][0] * s;
- m[1][0] = m[1][0] * c - tmp * s;
- m[0][1] = (tmp = m[0][1]) * c + m[1][1] * s;
- m[1][1] = m[1][1] * c - tmp * s;
- m[0][2] = (tmp = m[0][2]) * c + m[1][2] * s;
- m[1][2] = m[1][2] * c - tmp * s;
- m[0][3] = (tmp = m[0][3]) * c + m[1][3] * s;
- m[1][3] = m[1][3] * c - tmp * s;
-
- flagBits |= Rotation2D;
- return;
- }
- } else if (z == 0.0) {
- // Rotate around the Y axis.
- if (y < 0)
- s = -s;
- double tmp;
- m[2][0] = (tmp = m[2][0]) * c + m[0][0] * s;
- m[0][0] = m[0][0] * c - tmp * s;
- m[2][1] = (tmp = m[2][1]) * c + m[0][1] * s;
- m[0][1] = m[0][1] * c - tmp * s;
- m[2][2] = (tmp = m[2][2]) * c + m[0][2] * s;
- m[0][2] = m[0][2] * c - tmp * s;
- m[2][3] = (tmp = m[2][3]) * c + m[0][3] * s;
- m[0][3] = m[0][3] * c - tmp * s;
-
- flagBits |= Rotation;
- return;
- }
- } else if (y == 0.0 && z == 0.0) {
- // Rotate around the X axis.
- if (x < 0)
- s = -s;
- double tmp;
- m[1][0] = (tmp = m[1][0]) * c + m[2][0] * s;
- m[2][0] = m[2][0] * c - tmp * s;
- m[1][1] = (tmp = m[1][1]) * c + m[2][1] * s;
- m[2][1] = m[2][1] * c - tmp * s;
- m[1][2] = (tmp = m[1][2]) * c + m[2][2] * s;
- m[2][2] = m[2][2] * c - tmp * s;
- m[1][3] = (tmp = m[1][3]) * c + m[2][3] * s;
- m[2][3] = m[2][3] * c - tmp * s;
-
- flagBits |= Rotation;
- return;
- }
-
- double len = double(x) * double(x) +
- double(y) * double(y) +
- double(z) * double(z);
- if (!qFuzzyCompare(len, 1.0) && !qFuzzyIsNull(len)) {
- len = std::sqrt(len);
- x = double(double(x) / len);
- y = double(double(y) / len);
- z = double(double(z) / len);
- }
- double ic = 1.0 - c;
- QDoubleMatrix4x4 rot(1); // The "1" says to not load the identity.
- rot.m[0][0] = x * x * ic + c;
- rot.m[1][0] = x * y * ic - z * s;
- rot.m[2][0] = x * z * ic + y * s;
- rot.m[3][0] = 0.0;
- rot.m[0][1] = y * x * ic + z * s;
- rot.m[1][1] = y * y * ic + c;
- rot.m[2][1] = y * z * ic - x * s;
- rot.m[3][1] = 0.0;
- rot.m[0][2] = x * z * ic - y * s;
- rot.m[1][2] = y * z * ic + x * s;
- rot.m[2][2] = z * z * ic + c;
- rot.m[3][2] = 0.0;
- rot.m[0][3] = 0.0;
- rot.m[1][3] = 0.0;
- rot.m[2][3] = 0.0;
- rot.m[3][3] = 1.0;
- rot.flagBits = Rotation;
- *this *= rot;
-}
-
-void QDoubleMatrix4x4::projectedRotate(double angle, double x, double y, double z)
-{
- // Used by QGraphicsRotation::applyTo() to perform a rotation
- // and projection back to 2D in a single step.
- if (angle == 0.0)
- return;
- double c, s;
- if (angle == 90.0 || angle == -270.0) {
- s = 1.0;
- c = 0.0;
- } else if (angle == -90.0 || angle == 270.0) {
- s = -1.0;
- c = 0.0;
- } else if (angle == 180.0 || angle == -180.0) {
- s = 0.0;
- c = -1.0;
- } else {
- double a = qDegreesToRadians(angle);
- c = std::cos(a);
- s = std::sin(a);
- }
- if (x == 0.0) {
- if (y == 0.0) {
- if (z != 0.0) {
- // Rotate around the Z axis.
- if (z < 0)
- s = -s;
- double tmp;
- m[0][0] = (tmp = m[0][0]) * c + m[1][0] * s;
- m[1][0] = m[1][0] * c - tmp * s;
- m[0][1] = (tmp = m[0][1]) * c + m[1][1] * s;
- m[1][1] = m[1][1] * c - tmp * s;
- m[0][2] = (tmp = m[0][2]) * c + m[1][2] * s;
- m[1][2] = m[1][2] * c - tmp * s;
- m[0][3] = (tmp = m[0][3]) * c + m[1][3] * s;
- m[1][3] = m[1][3] * c - tmp * s;
-
- flagBits |= Rotation2D;
- return;
- }
- } else if (z == 0.0) {
- // Rotate around the Y axis.
- if (y < 0)
- s = -s;
- m[0][0] = m[0][0] * c + m[3][0] * s * inv_dist_to_plane;
- m[0][1] = m[0][1] * c + m[3][1] * s * inv_dist_to_plane;
- m[0][2] = m[0][2] * c + m[3][2] * s * inv_dist_to_plane;
- m[0][3] = m[0][3] * c + m[3][3] * s * inv_dist_to_plane;
- flagBits = General;
- return;
- }
- } else if (y == 0.0 && z == 0.0) {
- // Rotate around the X axis.
- if (x < 0)
- s = -s;
- m[1][0] = m[1][0] * c - m[3][0] * s * inv_dist_to_plane;
- m[1][1] = m[1][1] * c - m[3][1] * s * inv_dist_to_plane;
- m[1][2] = m[1][2] * c - m[3][2] * s * inv_dist_to_plane;
- m[1][3] = m[1][3] * c - m[3][3] * s * inv_dist_to_plane;
- flagBits = General;
- return;
- }
- double len = double(x) * double(x) +
- double(y) * double(y) +
- double(z) * double(z);
- if (!qFuzzyCompare(len, 1.0) && !qFuzzyIsNull(len)) {
- len = std::sqrt(len);
- x = double(double(x) / len);
- y = double(double(y) / len);
- z = double(double(z) / len);
- }
- double ic = 1.0 - c;
- QDoubleMatrix4x4 rot(1); // The "1" says to not load the identity.
- rot.m[0][0] = x * x * ic + c;
- rot.m[1][0] = x * y * ic - z * s;
- rot.m[2][0] = 0.0;
- rot.m[3][0] = 0.0;
- rot.m[0][1] = y * x * ic + z * s;
- rot.m[1][1] = y * y * ic + c;
- rot.m[2][1] = 0.0;
- rot.m[3][1] = 0.0;
- rot.m[0][2] = 0.0;
- rot.m[1][2] = 0.0;
- rot.m[2][2] = 1.0;
- rot.m[3][2] = 0.0;
- rot.m[0][3] = (x * z * ic - y * s) * -inv_dist_to_plane;
- rot.m[1][3] = (y * z * ic + x * s) * -inv_dist_to_plane;
- rot.m[2][3] = 0.0;
- rot.m[3][3] = 1.0;
- rot.flagBits = General;
- *this *= rot;
-}
-
-void QDoubleMatrix4x4::ortho(const QRect& rect)
-{
- // Note: rect.right() and rect.bottom() subtract 1 in QRect,
- // which gives the location of a pixel within the rectangle,
- // instead of the extent of the rectangle. We want the extent.
- // QRectF expresses the extent properly.
- ortho(rect.x(), rect.x() + rect.width(), rect.y() + rect.height(), rect.y(), -1.0, 1.0);
-}
-
-void QDoubleMatrix4x4::ortho(const QRectF& rect)
-{
- ortho(rect.left(), rect.right(), rect.bottom(), rect.top(), -1.0, 1.0);
-}
-
-void QDoubleMatrix4x4::ortho(double left, double right, double bottom, double top, double nearPlane, double farPlane)
-{
- // Bail out if the projection volume is zero-sized.
- if (left == right || bottom == top || nearPlane == farPlane)
- return;
-
- // Construct the projection.
- double width = right - left;
- double invheight = top - bottom;
- double clip = farPlane - nearPlane;
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = 2.0 / width;
- m.m[1][0] = 0.0;
- m.m[2][0] = 0.0;
- m.m[3][0] = -(left + right) / width;
- m.m[0][1] = 0.0;
- m.m[1][1] = 2.0 / invheight;
- m.m[2][1] = 0.0;
- m.m[3][1] = -(top + bottom) / invheight;
- m.m[0][2] = 0.0;
- m.m[1][2] = 0.0;
- m.m[2][2] = -2.0 / clip;
- m.m[3][2] = -(nearPlane + farPlane) / clip;
- m.m[0][3] = 0.0;
- m.m[1][3] = 0.0;
- m.m[2][3] = 0.0;
- m.m[3][3] = 1.0;
- m.flagBits = Translation | Scale;
-
- // Apply the projection.
- *this *= m;
-}
-
-void QDoubleMatrix4x4::frustum(double left, double right, double bottom, double top, double nearPlane, double farPlane)
-{
- // Bail out if the projection volume is zero-sized.
- if (left == right || bottom == top || nearPlane == farPlane)
- return;
-
- // Construct the projection.
- QDoubleMatrix4x4 m(1);
- double width = right - left;
- double invheight = top - bottom;
- double clip = farPlane - nearPlane;
- m.m[0][0] = 2.0 * nearPlane / width;
- m.m[1][0] = 0.0;
- m.m[2][0] = (left + right) / width;
- m.m[3][0] = 0.0;
- m.m[0][1] = 0.0;
- m.m[1][1] = 2.0 * nearPlane / invheight;
- m.m[2][1] = (top + bottom) / invheight;
- m.m[3][1] = 0.0;
- m.m[0][2] = 0.0;
- m.m[1][2] = 0.0;
- m.m[2][2] = -(nearPlane + farPlane) / clip;
- m.m[3][2] = -2.0 * nearPlane * farPlane / clip;
- m.m[0][3] = 0.0;
- m.m[1][3] = 0.0;
- m.m[2][3] = -1.0;
- m.m[3][3] = 0.0;
- m.flagBits = General;
-
- // Apply the projection.
- *this *= m;
-}
-
-void QDoubleMatrix4x4::perspective(double verticalAngle, double aspectRatio, double nearPlane, double farPlane)
-{
- // Bail out if the projection volume is zero-sized.
- if (nearPlane == farPlane || aspectRatio == 0.0)
- return;
-
- // Construct the projection.
- QDoubleMatrix4x4 m(1);
- double radians = qDegreesToRadians(verticalAngle / 2.0);
- double sine = std::sin(radians);
- if (sine == 0.0)
- return;
- double cotan = std::cos(radians) / sine;
- double clip = farPlane - nearPlane;
- m.m[0][0] = cotan / aspectRatio;
- m.m[1][0] = 0.0;
- m.m[2][0] = 0.0;
- m.m[3][0] = 0.0;
- m.m[0][1] = 0.0;
- m.m[1][1] = cotan;
- m.m[2][1] = 0.0;
- m.m[3][1] = 0.0;
- m.m[0][2] = 0.0;
- m.m[1][2] = 0.0;
- m.m[2][2] = -(nearPlane + farPlane) / clip;
- m.m[3][2] = -(2.0 * nearPlane * farPlane) / clip;
- m.m[0][3] = 0.0;
- m.m[1][3] = 0.0;
- m.m[2][3] = -1.0;
- m.m[3][3] = 0.0;
- m.flagBits = General;
-
- // Apply the projection.
- *this *= m;
-}
-
-void QDoubleMatrix4x4::lookAt(const QDoubleVector3D& eye, const QDoubleVector3D& center, const QDoubleVector3D& up)
-{
- QDoubleVector3D forward = center - eye;
- if (qFuzzyIsNull(forward.x()) && qFuzzyIsNull(forward.y()) && qFuzzyIsNull(forward.z()))
- return;
-
- forward.normalize();
- QDoubleVector3D side = QDoubleVector3D::crossProduct(forward, up).normalized();
- QDoubleVector3D upVector = QDoubleVector3D::crossProduct(side, forward);
-
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = side.x();
- m.m[1][0] = side.y();
- m.m[2][0] = side.z();
- m.m[3][0] = 0.0;
- m.m[0][1] = upVector.x();
- m.m[1][1] = upVector.y();
- m.m[2][1] = upVector.z();
- m.m[3][1] = 0.0;
- m.m[0][2] = -forward.x();
- m.m[1][2] = -forward.y();
- m.m[2][2] = -forward.z();
- m.m[3][2] = 0.0;
- m.m[0][3] = 0.0;
- m.m[1][3] = 0.0;
- m.m[2][3] = 0.0;
- m.m[3][3] = 1.0;
- m.flagBits = Rotation;
-
- *this *= m;
- translate(-eye);
-}
-
-void QDoubleMatrix4x4::viewport(double left, double bottom, double width, double height, double nearPlane, double farPlane)
-{
- const double w2 = width / 2.0;
- const double h2 = height / 2.0;
-
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = w2;
- m.m[1][0] = 0.0;
- m.m[2][0] = 0.0;
- m.m[3][0] = left + w2;
- m.m[0][1] = 0.0;
- m.m[1][1] = h2;
- m.m[2][1] = 0.0;
- m.m[3][1] = bottom + h2;
- m.m[0][2] = 0.0;
- m.m[1][2] = 0.0;
- m.m[2][2] = (farPlane - nearPlane) / 2.0;
- m.m[3][2] = (nearPlane + farPlane) / 2.0;
- m.m[0][3] = 0.0;
- m.m[1][3] = 0.0;
- m.m[2][3] = 0.0;
- m.m[3][3] = 1.0;
- m.flagBits = General;
-
- *this *= m;
-}
-
-void QDoubleMatrix4x4::flipCoordinates()
-{
- // Multiplying the y and z coordinates with -1 does NOT flip between right-handed and
- // left-handed coordinate systems, it just rotates 180 degrees around the x axis, so
- // I'm deprecating this function.
- if (flagBits < Rotation2D) {
- // Translation | Scale
- m[1][1] = -m[1][1];
- m[2][2] = -m[2][2];
- } else {
- m[1][0] = -m[1][0];
- m[1][1] = -m[1][1];
- m[1][2] = -m[1][2];
- m[1][3] = -m[1][3];
- m[2][0] = -m[2][0];
- m[2][1] = -m[2][1];
- m[2][2] = -m[2][2];
- m[2][3] = -m[2][3];
- }
- flagBits |= Scale;
-}
-
-void QDoubleMatrix4x4::copyDataTo(double *values) const
-{
- for (int row = 0; row < 4; ++row)
- for (int col = 0; col < 4; ++col)
- values[row * 4 + col] = double(m[col][row]);
-}
-
-QRect QDoubleMatrix4x4::mapRect(const QRect& rect) const
-{
- if (flagBits < Scale) {
- // Translation
- return QRect(qRound(rect.x() + m[3][0]),
- qRound(rect.y() + m[3][1]),
- rect.width(), rect.height());
- } else if (flagBits < Rotation2D) {
- // Translation | Scale
- double x = rect.x() * m[0][0] + m[3][0];
- double y = rect.y() * m[1][1] + m[3][1];
- double w = rect.width() * m[0][0];
- double h = rect.height() * m[1][1];
- if (w < 0) {
- w = -w;
- x -= w;
- }
- if (h < 0) {
- h = -h;
- y -= h;
- }
- return QRect(qRound(x), qRound(y), qRound(w), qRound(h));
- }
-
- QPoint tl = map(rect.topLeft());
- QPoint tr = map(QPoint(rect.x() + rect.width(), rect.y()));
- QPoint bl = map(QPoint(rect.x(), rect.y() + rect.height()));
- QPoint br = map(QPoint(rect.x() + rect.width(),
- rect.y() + rect.height()));
-
- int xmin = qMin(qMin(tl.x(), tr.x()), qMin(bl.x(), br.x()));
- int xmax = qMax(qMax(tl.x(), tr.x()), qMax(bl.x(), br.x()));
- int ymin = qMin(qMin(tl.y(), tr.y()), qMin(bl.y(), br.y()));
- int ymax = qMax(qMax(tl.y(), tr.y()), qMax(bl.y(), br.y()));
-
- return QRect(xmin, ymin, xmax - xmin, ymax - ymin);
-}
-
-QRectF QDoubleMatrix4x4::mapRect(const QRectF& rect) const
-{
- if (flagBits < Scale) {
- // Translation
- return rect.translated(m[3][0], m[3][1]);
- } else if (flagBits < Rotation2D) {
- // Translation | Scale
- double x = rect.x() * m[0][0] + m[3][0];
- double y = rect.y() * m[1][1] + m[3][1];
- double w = rect.width() * m[0][0];
- double h = rect.height() * m[1][1];
- if (w < 0) {
- w = -w;
- x -= w;
- }
- if (h < 0) {
- h = -h;
- y -= h;
- }
- return QRectF(x, y, w, h);
- }
-
- QPointF tl = map(rect.topLeft()); QPointF tr = map(rect.topRight());
- QPointF bl = map(rect.bottomLeft()); QPointF br = map(rect.bottomRight());
-
- double xmin = qMin(qMin(tl.x(), tr.x()), qMin(bl.x(), br.x()));
- double xmax = qMax(qMax(tl.x(), tr.x()), qMax(bl.x(), br.x()));
- double ymin = qMin(qMin(tl.y(), tr.y()), qMin(bl.y(), br.y()));
- double ymax = qMax(qMax(tl.y(), tr.y()), qMax(bl.y(), br.y()));
-
- return QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax));
-}
-
-QDoubleMatrix4x4 QDoubleMatrix4x4::orthonormalInverse() const
-{
- QDoubleMatrix4x4 result(1); // The '1' says not to load identity
-
- result.m[0][0] = m[0][0];
- result.m[1][0] = m[0][1];
- result.m[2][0] = m[0][2];
-
- result.m[0][1] = m[1][0];
- result.m[1][1] = m[1][1];
- result.m[2][1] = m[1][2];
-
- result.m[0][2] = m[2][0];
- result.m[1][2] = m[2][1];
- result.m[2][2] = m[2][2];
-
- result.m[0][3] = 0.0;
- result.m[1][3] = 0.0;
- result.m[2][3] = 0.0;
-
- result.m[3][0] = -(result.m[0][0] * m[3][0] + result.m[1][0] * m[3][1] + result.m[2][0] * m[3][2]);
- result.m[3][1] = -(result.m[0][1] * m[3][0] + result.m[1][1] * m[3][1] + result.m[2][1] * m[3][2]);
- result.m[3][2] = -(result.m[0][2] * m[3][0] + result.m[1][2] * m[3][1] + result.m[2][2] * m[3][2]);
- result.m[3][3] = 1.0;
-
- result.flagBits = flagBits;
-
- return result;
-}
-
-void QDoubleMatrix4x4::optimize()
-{
- // If the last row is not (0, 0, 0, 1), the matrix is not a special type.
- flagBits = General;
- if (m[0][3] != 0 || m[1][3] != 0 || m[2][3] != 0 || m[3][3] != 1)
- return;
-
- flagBits &= ~Perspective;
-
- // If the last column is (0, 0, 0, 1), then there is no translation.
- if (m[3][0] == 0 && m[3][1] == 0 && m[3][2] == 0)
- flagBits &= ~Translation;
-
- // If the two first elements of row 3 and column 3 are 0, then any rotation must be about Z.
- if (!m[0][2] && !m[1][2] && !m[2][0] && !m[2][1]) {
- flagBits &= ~Rotation;
- // If the six non-diagonal elements in the top left 3x3 matrix are 0, there is no rotation.
- if (!m[0][1] && !m[1][0]) {
- flagBits &= ~Rotation2D;
- // Check for identity.
- if (m[0][0] == 1 && m[1][1] == 1 && m[2][2] == 1)
- flagBits &= ~Scale;
- } else {
- // If the columns are orthonormal and form a right-handed system, then there is no scale.
- double det = matrixDet2(m, 0, 1, 0, 1);
- double lenX = m[0][0] * m[0][0] + m[0][1] * m[0][1];
- double lenY = m[1][0] * m[1][0] + m[1][1] * m[1][1];
- double lenZ = m[2][2];
- if (qFuzzyCompare(det, 1.0) && qFuzzyCompare(lenX, 1.0)
- && qFuzzyCompare(lenY, 1.0) && qFuzzyCompare(lenZ, 1.0))
- {
- flagBits &= ~Scale;
- }
- }
- } else {
- // If the columns are orthonormal and form a right-handed system, then there is no scale.
- double det = matrixDet3(m, 0, 1, 2, 0, 1, 2);
- double lenX = m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2];
- double lenY = m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2];
- double lenZ = m[2][0] * m[2][0] + m[2][1] * m[2][1] + m[2][2] * m[2][2];
- if (qFuzzyCompare(det, 1.0) && qFuzzyCompare(lenX, 1.0)
- && qFuzzyCompare(lenY, 1.0) && qFuzzyCompare(lenZ, 1.0))
- {
- flagBits &= ~Scale;
- }
- }
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QDoubleMatrix4x4 &m)
-{
- QDebugStateSaver saver(dbg);
- // Create a string that represents the matrix type.
- QByteArray bits;
- if (m.flagBits == QDoubleMatrix4x4::Identity) {
- bits = "Identity";
- } else if (m.flagBits == QDoubleMatrix4x4::General) {
- bits = "General";
- } else {
- if ((m.flagBits & QDoubleMatrix4x4::Translation) != 0)
- bits += "Translation,";
- if ((m.flagBits & QDoubleMatrix4x4::Scale) != 0)
- bits += "Scale,";
- if ((m.flagBits & QDoubleMatrix4x4::Rotation2D) != 0)
- bits += "Rotation2D,";
- if ((m.flagBits & QDoubleMatrix4x4::Rotation) != 0)
- bits += "Rotation,";
- if ((m.flagBits & QDoubleMatrix4x4::Perspective) != 0)
- bits += "Perspective,";
- if (bits.size() > 0)
- bits = bits.left(bits.size() - 1);
- }
-
- // Output in row-major order because it is more human-readable.
- dbg.nospace() << "QDoubleMatrix4x4(type:" << bits.constData() << Qt::endl
- << qSetFieldWidth(10)
- << m(0, 0) << m(0, 1) << m(0, 2) << m(0, 3) << Qt::endl
- << m(1, 0) << m(1, 1) << m(1, 2) << m(1, 3) << Qt::endl
- << m(2, 0) << m(2, 1) << m(2, 2) << m(2, 3) << Qt::endl
- << m(3, 0) << m(3, 1) << m(3, 2) << m(3, 3) << Qt::endl
- << qSetFieldWidth(0) << ')';
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-QDataStream &operator<<(QDataStream &stream, const QDoubleMatrix4x4 &matrix)
-{
- for (int row = 0; row < 4; ++row)
- for (int col = 0; col < 4; ++col)
- stream << matrix(row, col);
- return stream;
-}
-
-QDataStream &operator>>(QDataStream &stream, QDoubleMatrix4x4 &matrix)
-{
- double x;
- for (int row = 0; row < 4; ++row) {
- for (int col = 0; col < 4; ++col) {
- stream >> x;
- matrix(row, col) = x;
- }
- }
- matrix.optimize();
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qdoublematrix4x4_p.h b/src/positioning/qdoublematrix4x4_p.h
deleted file mode 100644
index 1f9dcfa8..00000000
--- a/src/positioning/qdoublematrix4x4_p.h
+++ /dev/null
@@ -1,946 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDOUBLEMATRIX4X4_H
-#define QDOUBLEMATRIX4X4_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include <QtPositioning/private/qdoublevector3d_p.h>
-#include <QtCore/QDebug>
-#include <QtCore/qmetatype.h>
-#include <QtCore/QRectF>
-
-QT_BEGIN_NAMESPACE
-
-/*
- * This class is a copy/paste/replace of QMatrix4x4
- * No algorithm has been changed.
- * Some methods have been removed.
- */
-
-class Q_POSITIONING_PRIVATE_EXPORT QDoubleMatrix4x4
-{
-public:
- inline QDoubleMatrix4x4() { setToIdentity(); }
- explicit QDoubleMatrix4x4(Qt::Initialization) : flagBits(General) {}
- explicit QDoubleMatrix4x4(const double *values);
- inline QDoubleMatrix4x4(double m11, double m12, double m13, double m14,
- double m21, double m22, double m23, double m24,
- double m31, double m32, double m33, double m34,
- double m41, double m42, double m43, double m44);
-
- QDoubleMatrix4x4(const double *values, int cols, int rows);
-
- inline const double& operator()(int row, int column) const;
- inline double& operator()(int row, int column);
-
- inline bool isAffine() const;
-
- inline bool isIdentity() const;
- inline void setToIdentity();
-
- inline void fill(double value);
-
- double determinant() const;
- QDoubleMatrix4x4 inverted(bool *invertible = nullptr) const;
- QDoubleMatrix4x4 transposed() const;
-
- inline QDoubleMatrix4x4& operator+=(const QDoubleMatrix4x4& other);
- inline QDoubleMatrix4x4& operator-=(const QDoubleMatrix4x4& other);
- inline QDoubleMatrix4x4& operator*=(const QDoubleMatrix4x4& other);
- inline QDoubleMatrix4x4& operator*=(double factor);
- QDoubleMatrix4x4& operator/=(double divisor);
- inline bool operator==(const QDoubleMatrix4x4& other) const;
- inline bool operator!=(const QDoubleMatrix4x4& other) const;
-
- friend QDoubleMatrix4x4 operator+(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2);
- friend QDoubleMatrix4x4 operator-(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2);
- friend QDoubleMatrix4x4 operator*(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2);
-
- friend QDoubleVector3D operator*(const QDoubleMatrix4x4& matrix, const QDoubleVector3D& vector);
- friend QDoubleVector3D operator*(const QDoubleVector3D& vector, const QDoubleMatrix4x4& matrix);
-
- friend QPoint operator*(const QPoint& point, const QDoubleMatrix4x4& matrix);
- friend QPointF operator*(const QPointF& point, const QDoubleMatrix4x4& matrix);
- friend QDoubleMatrix4x4 operator-(const QDoubleMatrix4x4& matrix);
- friend QPoint operator*(const QDoubleMatrix4x4& matrix, const QPoint& point);
- friend QPointF operator*(const QDoubleMatrix4x4& matrix, const QPointF& point);
- friend QDoubleMatrix4x4 operator*(double factor, const QDoubleMatrix4x4& matrix);
- friend QDoubleMatrix4x4 operator*(const QDoubleMatrix4x4& matrix, double factor);
- friend Q_POSITIONING_PRIVATE_EXPORT QDoubleMatrix4x4 operator/(const QDoubleMatrix4x4& matrix, double divisor);
-
- friend inline bool qFuzzyCompare(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2);
-
-
- void scale(const QDoubleVector3D& vector);
- void translate(const QDoubleVector3D& vector);
- void rotate(double angle, const QDoubleVector3D& vector);
-
- void scale(double x, double y);
- void scale(double x, double y, double z);
- void scale(double factor);
- void translate(double x, double y);
- void translate(double x, double y, double z);
- void rotate(double angle, double x, double y, double z = 0.0f);
-
- void ortho(const QRect& rect);
- void ortho(const QRectF& rect);
- void ortho(double left, double right, double bottom, double top, double nearPlane, double farPlane);
- void frustum(double left, double right, double bottom, double top, double nearPlane, double farPlane);
- void perspective(double verticalAngle, double aspectRatio, double nearPlane, double farPlane);
-
- void lookAt(const QDoubleVector3D& eye, const QDoubleVector3D& center, const QDoubleVector3D& up);
-
- void viewport(const QRectF &rect);
- void viewport(double left, double bottom, double width, double height, double nearPlane = 0.0f, double farPlane = 1.0f);
- void flipCoordinates();
-
- void copyDataTo(double *values) const;
-
- QPoint map(const QPoint& point) const;
- QPointF map(const QPointF& point) const;
-
- QDoubleVector3D map(const QDoubleVector3D& point) const;
- QDoubleVector3D mapVector(const QDoubleVector3D& vector) const;
-
- QRect mapRect(const QRect& rect) const;
- QRectF mapRect(const QRectF& rect) const;
-
- inline double *data();
- inline const double *data() const { return *m; }
- inline const double *constData() const { return *m; }
-
- void optimize();
-
-#ifndef QT_NO_DEBUG_STREAM
- friend Q_POSITIONING_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QDoubleMatrix4x4 &m);
-#endif
-
-private:
- double m[4][4]; // Column-major order to match OpenGL.
- int flagBits; // Flag bits from the enum below.
-
- // When matrices are multiplied, the flag bits are or-ed together.
- enum {
- Identity = 0x0000, // Identity matrix
- Translation = 0x0001, // Contains a translation
- Scale = 0x0002, // Contains a scale
- Rotation2D = 0x0004, // Contains a rotation about the Z axis
- Rotation = 0x0008, // Contains an arbitrary rotation
- Perspective = 0x0010, // Last row is different from (0, 0, 0, 1)
- General = 0x001f // General matrix, unknown contents
- };
-
- // Construct without initializing identity matrix.
- explicit QDoubleMatrix4x4(int) { }
-
- QDoubleMatrix4x4 orthonormalInverse() const;
-
- void projectedRotate(double angle, double x, double y, double z);
-};
-
-Q_DECLARE_TYPEINFO(QDoubleMatrix4x4, Q_RELOCATABLE_TYPE);
-
-inline QDoubleMatrix4x4::QDoubleMatrix4x4
- (double m11, double m12, double m13, double m14,
- double m21, double m22, double m23, double m24,
- double m31, double m32, double m33, double m34,
- double m41, double m42, double m43, double m44)
-{
- m[0][0] = m11; m[0][1] = m21; m[0][2] = m31; m[0][3] = m41;
- m[1][0] = m12; m[1][1] = m22; m[1][2] = m32; m[1][3] = m42;
- m[2][0] = m13; m[2][1] = m23; m[2][2] = m33; m[2][3] = m43;
- m[3][0] = m14; m[3][1] = m24; m[3][2] = m34; m[3][3] = m44;
- flagBits = General;
-}
-
-inline const double& QDoubleMatrix4x4::operator()(int aRow, int aColumn) const
-{
- Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
- return m[aColumn][aRow];
-}
-
-inline double& QDoubleMatrix4x4::operator()(int aRow, int aColumn)
-{
- Q_ASSERT(aRow >= 0 && aRow < 4 && aColumn >= 0 && aColumn < 4);
- flagBits = General;
- return m[aColumn][aRow];
-}
-
-Q_POSITIONING_PRIVATE_EXPORT QDoubleMatrix4x4 operator/(const QDoubleMatrix4x4& matrix, double divisor);
-
-inline bool QDoubleMatrix4x4::isAffine() const
-{
- return m[0][3] == 0.0f && m[1][3] == 0.0f && m[2][3] == 0.0f && m[3][3] == 1.0f;
-}
-
-inline bool QDoubleMatrix4x4::isIdentity() const
-{
- if (flagBits == Identity)
- return true;
- if (m[0][0] != 1.0f || m[0][1] != 0.0f || m[0][2] != 0.0f)
- return false;
- if (m[0][3] != 0.0f || m[1][0] != 0.0f || m[1][1] != 1.0f)
- return false;
- if (m[1][2] != 0.0f || m[1][3] != 0.0f || m[2][0] != 0.0f)
- return false;
- if (m[2][1] != 0.0f || m[2][2] != 1.0f || m[2][3] != 0.0f)
- return false;
- if (m[3][0] != 0.0f || m[3][1] != 0.0f || m[3][2] != 0.0f)
- return false;
- return (m[3][3] == 1.0f);
-}
-
-inline void QDoubleMatrix4x4::setToIdentity()
-{
- m[0][0] = 1.0f;
- m[0][1] = 0.0f;
- m[0][2] = 0.0f;
- m[0][3] = 0.0f;
- m[1][0] = 0.0f;
- m[1][1] = 1.0f;
- m[1][2] = 0.0f;
- m[1][3] = 0.0f;
- m[2][0] = 0.0f;
- m[2][1] = 0.0f;
- m[2][2] = 1.0f;
- m[2][3] = 0.0f;
- m[3][0] = 0.0f;
- m[3][1] = 0.0f;
- m[3][2] = 0.0f;
- m[3][3] = 1.0f;
- flagBits = Identity;
-}
-
-inline void QDoubleMatrix4x4::fill(double value)
-{
- m[0][0] = value;
- m[0][1] = value;
- m[0][2] = value;
- m[0][3] = value;
- m[1][0] = value;
- m[1][1] = value;
- m[1][2] = value;
- m[1][3] = value;
- m[2][0] = value;
- m[2][1] = value;
- m[2][2] = value;
- m[2][3] = value;
- m[3][0] = value;
- m[3][1] = value;
- m[3][2] = value;
- m[3][3] = value;
- flagBits = General;
-}
-
-inline QDoubleMatrix4x4& QDoubleMatrix4x4::operator+=(const QDoubleMatrix4x4& other)
-{
- m[0][0] += other.m[0][0];
- m[0][1] += other.m[0][1];
- m[0][2] += other.m[0][2];
- m[0][3] += other.m[0][3];
- m[1][0] += other.m[1][0];
- m[1][1] += other.m[1][1];
- m[1][2] += other.m[1][2];
- m[1][3] += other.m[1][3];
- m[2][0] += other.m[2][0];
- m[2][1] += other.m[2][1];
- m[2][2] += other.m[2][2];
- m[2][3] += other.m[2][3];
- m[3][0] += other.m[3][0];
- m[3][1] += other.m[3][1];
- m[3][2] += other.m[3][2];
- m[3][3] += other.m[3][3];
- flagBits = General;
- return *this;
-}
-
-inline QDoubleMatrix4x4& QDoubleMatrix4x4::operator-=(const QDoubleMatrix4x4& other)
-{
- m[0][0] -= other.m[0][0];
- m[0][1] -= other.m[0][1];
- m[0][2] -= other.m[0][2];
- m[0][3] -= other.m[0][3];
- m[1][0] -= other.m[1][0];
- m[1][1] -= other.m[1][1];
- m[1][2] -= other.m[1][2];
- m[1][3] -= other.m[1][3];
- m[2][0] -= other.m[2][0];
- m[2][1] -= other.m[2][1];
- m[2][2] -= other.m[2][2];
- m[2][3] -= other.m[2][3];
- m[3][0] -= other.m[3][0];
- m[3][1] -= other.m[3][1];
- m[3][2] -= other.m[3][2];
- m[3][3] -= other.m[3][3];
- flagBits = General;
- return *this;
-}
-
-inline QDoubleMatrix4x4& QDoubleMatrix4x4::operator*=(const QDoubleMatrix4x4& other)
-{
- flagBits |= other.flagBits;
-
- if (flagBits < Rotation2D) {
- m[3][0] += m[0][0] * other.m[3][0];
- m[3][1] += m[1][1] * other.m[3][1];
- m[3][2] += m[2][2] * other.m[3][2];
-
- m[0][0] *= other.m[0][0];
- m[1][1] *= other.m[1][1];
- m[2][2] *= other.m[2][2];
- return *this;
- }
-
- double m0, m1, m2;
- m0 = m[0][0] * other.m[0][0]
- + m[1][0] * other.m[0][1]
- + m[2][0] * other.m[0][2]
- + m[3][0] * other.m[0][3];
- m1 = m[0][0] * other.m[1][0]
- + m[1][0] * other.m[1][1]
- + m[2][0] * other.m[1][2]
- + m[3][0] * other.m[1][3];
- m2 = m[0][0] * other.m[2][0]
- + m[1][0] * other.m[2][1]
- + m[2][0] * other.m[2][2]
- + m[3][0] * other.m[2][3];
- m[3][0] = m[0][0] * other.m[3][0]
- + m[1][0] * other.m[3][1]
- + m[2][0] * other.m[3][2]
- + m[3][0] * other.m[3][3];
- m[0][0] = m0;
- m[1][0] = m1;
- m[2][0] = m2;
-
- m0 = m[0][1] * other.m[0][0]
- + m[1][1] * other.m[0][1]
- + m[2][1] * other.m[0][2]
- + m[3][1] * other.m[0][3];
- m1 = m[0][1] * other.m[1][0]
- + m[1][1] * other.m[1][1]
- + m[2][1] * other.m[1][2]
- + m[3][1] * other.m[1][3];
- m2 = m[0][1] * other.m[2][0]
- + m[1][1] * other.m[2][1]
- + m[2][1] * other.m[2][2]
- + m[3][1] * other.m[2][3];
- m[3][1] = m[0][1] * other.m[3][0]
- + m[1][1] * other.m[3][1]
- + m[2][1] * other.m[3][2]
- + m[3][1] * other.m[3][3];
- m[0][1] = m0;
- m[1][1] = m1;
- m[2][1] = m2;
-
- m0 = m[0][2] * other.m[0][0]
- + m[1][2] * other.m[0][1]
- + m[2][2] * other.m[0][2]
- + m[3][2] * other.m[0][3];
- m1 = m[0][2] * other.m[1][0]
- + m[1][2] * other.m[1][1]
- + m[2][2] * other.m[1][2]
- + m[3][2] * other.m[1][3];
- m2 = m[0][2] * other.m[2][0]
- + m[1][2] * other.m[2][1]
- + m[2][2] * other.m[2][2]
- + m[3][2] * other.m[2][3];
- m[3][2] = m[0][2] * other.m[3][0]
- + m[1][2] * other.m[3][1]
- + m[2][2] * other.m[3][2]
- + m[3][2] * other.m[3][3];
- m[0][2] = m0;
- m[1][2] = m1;
- m[2][2] = m2;
-
- m0 = m[0][3] * other.m[0][0]
- + m[1][3] * other.m[0][1]
- + m[2][3] * other.m[0][2]
- + m[3][3] * other.m[0][3];
- m1 = m[0][3] * other.m[1][0]
- + m[1][3] * other.m[1][1]
- + m[2][3] * other.m[1][2]
- + m[3][3] * other.m[1][3];
- m2 = m[0][3] * other.m[2][0]
- + m[1][3] * other.m[2][1]
- + m[2][3] * other.m[2][2]
- + m[3][3] * other.m[2][3];
- m[3][3] = m[0][3] * other.m[3][0]
- + m[1][3] * other.m[3][1]
- + m[2][3] * other.m[3][2]
- + m[3][3] * other.m[3][3];
- m[0][3] = m0;
- m[1][3] = m1;
- m[2][3] = m2;
- return *this;
-}
-
-inline QDoubleMatrix4x4& QDoubleMatrix4x4::operator*=(double factor)
-{
- m[0][0] *= factor;
- m[0][1] *= factor;
- m[0][2] *= factor;
- m[0][3] *= factor;
- m[1][0] *= factor;
- m[1][1] *= factor;
- m[1][2] *= factor;
- m[1][3] *= factor;
- m[2][0] *= factor;
- m[2][1] *= factor;
- m[2][2] *= factor;
- m[2][3] *= factor;
- m[3][0] *= factor;
- m[3][1] *= factor;
- m[3][2] *= factor;
- m[3][3] *= factor;
- flagBits = General;
- return *this;
-}
-
-inline bool QDoubleMatrix4x4::operator==(const QDoubleMatrix4x4& other) const
-{
- return m[0][0] == other.m[0][0] &&
- m[0][1] == other.m[0][1] &&
- m[0][2] == other.m[0][2] &&
- m[0][3] == other.m[0][3] &&
- m[1][0] == other.m[1][0] &&
- m[1][1] == other.m[1][1] &&
- m[1][2] == other.m[1][2] &&
- m[1][3] == other.m[1][3] &&
- m[2][0] == other.m[2][0] &&
- m[2][1] == other.m[2][1] &&
- m[2][2] == other.m[2][2] &&
- m[2][3] == other.m[2][3] &&
- m[3][0] == other.m[3][0] &&
- m[3][1] == other.m[3][1] &&
- m[3][2] == other.m[3][2] &&
- m[3][3] == other.m[3][3];
-}
-
-inline bool QDoubleMatrix4x4::operator!=(const QDoubleMatrix4x4& other) const
-{
- return m[0][0] != other.m[0][0] ||
- m[0][1] != other.m[0][1] ||
- m[0][2] != other.m[0][2] ||
- m[0][3] != other.m[0][3] ||
- m[1][0] != other.m[1][0] ||
- m[1][1] != other.m[1][1] ||
- m[1][2] != other.m[1][2] ||
- m[1][3] != other.m[1][3] ||
- m[2][0] != other.m[2][0] ||
- m[2][1] != other.m[2][1] ||
- m[2][2] != other.m[2][2] ||
- m[2][3] != other.m[2][3] ||
- m[3][0] != other.m[3][0] ||
- m[3][1] != other.m[3][1] ||
- m[3][2] != other.m[3][2] ||
- m[3][3] != other.m[3][3];
-}
-
-inline QDoubleMatrix4x4 operator+(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2)
-{
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = m1.m[0][0] + m2.m[0][0];
- m.m[0][1] = m1.m[0][1] + m2.m[0][1];
- m.m[0][2] = m1.m[0][2] + m2.m[0][2];
- m.m[0][3] = m1.m[0][3] + m2.m[0][3];
- m.m[1][0] = m1.m[1][0] + m2.m[1][0];
- m.m[1][1] = m1.m[1][1] + m2.m[1][1];
- m.m[1][2] = m1.m[1][2] + m2.m[1][2];
- m.m[1][3] = m1.m[1][3] + m2.m[1][3];
- m.m[2][0] = m1.m[2][0] + m2.m[2][0];
- m.m[2][1] = m1.m[2][1] + m2.m[2][1];
- m.m[2][2] = m1.m[2][2] + m2.m[2][2];
- m.m[2][3] = m1.m[2][3] + m2.m[2][3];
- m.m[3][0] = m1.m[3][0] + m2.m[3][0];
- m.m[3][1] = m1.m[3][1] + m2.m[3][1];
- m.m[3][2] = m1.m[3][2] + m2.m[3][2];
- m.m[3][3] = m1.m[3][3] + m2.m[3][3];
- m.flagBits = QDoubleMatrix4x4::General;
- return m;
-}
-
-inline QDoubleMatrix4x4 operator-(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2)
-{
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = m1.m[0][0] - m2.m[0][0];
- m.m[0][1] = m1.m[0][1] - m2.m[0][1];
- m.m[0][2] = m1.m[0][2] - m2.m[0][2];
- m.m[0][3] = m1.m[0][3] - m2.m[0][3];
- m.m[1][0] = m1.m[1][0] - m2.m[1][0];
- m.m[1][1] = m1.m[1][1] - m2.m[1][1];
- m.m[1][2] = m1.m[1][2] - m2.m[1][2];
- m.m[1][3] = m1.m[1][3] - m2.m[1][3];
- m.m[2][0] = m1.m[2][0] - m2.m[2][0];
- m.m[2][1] = m1.m[2][1] - m2.m[2][1];
- m.m[2][2] = m1.m[2][2] - m2.m[2][2];
- m.m[2][3] = m1.m[2][3] - m2.m[2][3];
- m.m[3][0] = m1.m[3][0] - m2.m[3][0];
- m.m[3][1] = m1.m[3][1] - m2.m[3][1];
- m.m[3][2] = m1.m[3][2] - m2.m[3][2];
- m.m[3][3] = m1.m[3][3] - m2.m[3][3];
- m.flagBits = QDoubleMatrix4x4::General;
- return m;
-}
-
-inline QDoubleMatrix4x4 operator*(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2)
-{
- int flagBits = m1.flagBits | m2.flagBits;
- if (flagBits < QDoubleMatrix4x4::Rotation2D) {
- QDoubleMatrix4x4 m = m1;
- m.m[3][0] += m.m[0][0] * m2.m[3][0];
- m.m[3][1] += m.m[1][1] * m2.m[3][1];
- m.m[3][2] += m.m[2][2] * m2.m[3][2];
-
- m.m[0][0] *= m2.m[0][0];
- m.m[1][1] *= m2.m[1][1];
- m.m[2][2] *= m2.m[2][2];
- m.flagBits = flagBits;
- return m;
- }
-
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = m1.m[0][0] * m2.m[0][0]
- + m1.m[1][0] * m2.m[0][1]
- + m1.m[2][0] * m2.m[0][2]
- + m1.m[3][0] * m2.m[0][3];
- m.m[0][1] = m1.m[0][1] * m2.m[0][0]
- + m1.m[1][1] * m2.m[0][1]
- + m1.m[2][1] * m2.m[0][2]
- + m1.m[3][1] * m2.m[0][3];
- m.m[0][2] = m1.m[0][2] * m2.m[0][0]
- + m1.m[1][2] * m2.m[0][1]
- + m1.m[2][2] * m2.m[0][2]
- + m1.m[3][2] * m2.m[0][3];
- m.m[0][3] = m1.m[0][3] * m2.m[0][0]
- + m1.m[1][3] * m2.m[0][1]
- + m1.m[2][3] * m2.m[0][2]
- + m1.m[3][3] * m2.m[0][3];
-
- m.m[1][0] = m1.m[0][0] * m2.m[1][0]
- + m1.m[1][0] * m2.m[1][1]
- + m1.m[2][0] * m2.m[1][2]
- + m1.m[3][0] * m2.m[1][3];
- m.m[1][1] = m1.m[0][1] * m2.m[1][0]
- + m1.m[1][1] * m2.m[1][1]
- + m1.m[2][1] * m2.m[1][2]
- + m1.m[3][1] * m2.m[1][3];
- m.m[1][2] = m1.m[0][2] * m2.m[1][0]
- + m1.m[1][2] * m2.m[1][1]
- + m1.m[2][2] * m2.m[1][2]
- + m1.m[3][2] * m2.m[1][3];
- m.m[1][3] = m1.m[0][3] * m2.m[1][0]
- + m1.m[1][3] * m2.m[1][1]
- + m1.m[2][3] * m2.m[1][2]
- + m1.m[3][3] * m2.m[1][3];
-
- m.m[2][0] = m1.m[0][0] * m2.m[2][0]
- + m1.m[1][0] * m2.m[2][1]
- + m1.m[2][0] * m2.m[2][2]
- + m1.m[3][0] * m2.m[2][3];
- m.m[2][1] = m1.m[0][1] * m2.m[2][0]
- + m1.m[1][1] * m2.m[2][1]
- + m1.m[2][1] * m2.m[2][2]
- + m1.m[3][1] * m2.m[2][3];
- m.m[2][2] = m1.m[0][2] * m2.m[2][0]
- + m1.m[1][2] * m2.m[2][1]
- + m1.m[2][2] * m2.m[2][2]
- + m1.m[3][2] * m2.m[2][3];
- m.m[2][3] = m1.m[0][3] * m2.m[2][0]
- + m1.m[1][3] * m2.m[2][1]
- + m1.m[2][3] * m2.m[2][2]
- + m1.m[3][3] * m2.m[2][3];
-
- m.m[3][0] = m1.m[0][0] * m2.m[3][0]
- + m1.m[1][0] * m2.m[3][1]
- + m1.m[2][0] * m2.m[3][2]
- + m1.m[3][0] * m2.m[3][3];
- m.m[3][1] = m1.m[0][1] * m2.m[3][0]
- + m1.m[1][1] * m2.m[3][1]
- + m1.m[2][1] * m2.m[3][2]
- + m1.m[3][1] * m2.m[3][3];
- m.m[3][2] = m1.m[0][2] * m2.m[3][0]
- + m1.m[1][2] * m2.m[3][1]
- + m1.m[2][2] * m2.m[3][2]
- + m1.m[3][2] * m2.m[3][3];
- m.m[3][3] = m1.m[0][3] * m2.m[3][0]
- + m1.m[1][3] * m2.m[3][1]
- + m1.m[2][3] * m2.m[3][2]
- + m1.m[3][3] * m2.m[3][3];
- m.flagBits = flagBits;
- return m;
-}
-
-inline QDoubleVector3D operator*(const QDoubleVector3D& vector, const QDoubleMatrix4x4& matrix)
-{
- double x, y, z, w;
- x = vector.x() * matrix.m[0][0] +
- vector.y() * matrix.m[0][1] +
- vector.z() * matrix.m[0][2] +
- matrix.m[0][3];
- y = vector.x() * matrix.m[1][0] +
- vector.y() * matrix.m[1][1] +
- vector.z() * matrix.m[1][2] +
- matrix.m[1][3];
- z = vector.x() * matrix.m[2][0] +
- vector.y() * matrix.m[2][1] +
- vector.z() * matrix.m[2][2] +
- matrix.m[2][3];
- w = vector.x() * matrix.m[3][0] +
- vector.y() * matrix.m[3][1] +
- vector.z() * matrix.m[3][2] +
- matrix.m[3][3];
- if (w == 1.0f)
- return QDoubleVector3D(x, y, z);
- else
- return QDoubleVector3D(x / w, y / w, z / w);
-}
-
-inline QDoubleVector3D operator*(const QDoubleMatrix4x4& matrix, const QDoubleVector3D& vector)
-{
- double x, y, z, w;
- if (matrix.flagBits == QDoubleMatrix4x4::Identity) {
- return vector;
- } else if (matrix.flagBits < QDoubleMatrix4x4::Rotation2D) {
- // Translation | Scale
- return QDoubleVector3D(vector.x() * matrix.m[0][0] + matrix.m[3][0],
- vector.y() * matrix.m[1][1] + matrix.m[3][1],
- vector.z() * matrix.m[2][2] + matrix.m[3][2]);
- } else if (matrix.flagBits < QDoubleMatrix4x4::Rotation) {
- // Translation | Scale | Rotation2D
- return QDoubleVector3D(vector.x() * matrix.m[0][0] + vector.y() * matrix.m[1][0] + matrix.m[3][0],
- vector.x() * matrix.m[0][1] + vector.y() * matrix.m[1][1] + matrix.m[3][1],
- vector.z() * matrix.m[2][2] + matrix.m[3][2]);
- } else {
- x = vector.x() * matrix.m[0][0] +
- vector.y() * matrix.m[1][0] +
- vector.z() * matrix.m[2][0] +
- matrix.m[3][0];
- y = vector.x() * matrix.m[0][1] +
- vector.y() * matrix.m[1][1] +
- vector.z() * matrix.m[2][1] +
- matrix.m[3][1];
- z = vector.x() * matrix.m[0][2] +
- vector.y() * matrix.m[1][2] +
- vector.z() * matrix.m[2][2] +
- matrix.m[3][2];
- w = vector.x() * matrix.m[0][3] +
- vector.y() * matrix.m[1][3] +
- vector.z() * matrix.m[2][3] +
- matrix.m[3][3];
- if (w == 1.0f)
- return QDoubleVector3D(x, y, z);
- else
- return QDoubleVector3D(x / w, y / w, z / w);
- }
-}
-
-inline QPoint operator*(const QPoint& point, const QDoubleMatrix4x4& matrix)
-{
- double xin, yin;
- double x, y, w;
- xin = point.x();
- yin = point.y();
- x = xin * matrix.m[0][0] +
- yin * matrix.m[0][1] +
- matrix.m[0][3];
- y = xin * matrix.m[1][0] +
- yin * matrix.m[1][1] +
- matrix.m[1][3];
- w = xin * matrix.m[3][0] +
- yin * matrix.m[3][1] +
- matrix.m[3][3];
- if (w == 1.0f)
- return QPoint(qRound(x), qRound(y));
- else
- return QPoint(qRound(x / w), qRound(y / w));
-}
-
-inline QPointF operator*(const QPointF& point, const QDoubleMatrix4x4& matrix)
-{
- double xin, yin;
- double x, y, w;
- xin = point.x();
- yin = point.y();
- x = xin * matrix.m[0][0] +
- yin * matrix.m[0][1] +
- matrix.m[0][3];
- y = xin * matrix.m[1][0] +
- yin * matrix.m[1][1] +
- matrix.m[1][3];
- w = xin * matrix.m[3][0] +
- yin * matrix.m[3][1] +
- matrix.m[3][3];
- if (w == 1.0f) {
- return QPointF(double(x), double(y));
- } else {
- return QPointF(double(x / w), double(y / w));
- }
-}
-
-inline QPoint operator*(const QDoubleMatrix4x4& matrix, const QPoint& point)
-{
- double xin, yin;
- double x, y, w;
- xin = point.x();
- yin = point.y();
- if (matrix.flagBits == QDoubleMatrix4x4::Identity) {
- return point;
- } else if (matrix.flagBits < QDoubleMatrix4x4::Rotation2D) {
- // Translation | Scale
- return QPoint(qRound(xin * matrix.m[0][0] + matrix.m[3][0]),
- qRound(yin * matrix.m[1][1] + matrix.m[3][1]));
- } else if (matrix.flagBits < QDoubleMatrix4x4::Perspective) {
- return QPoint(qRound(xin * matrix.m[0][0] + yin * matrix.m[1][0] + matrix.m[3][0]),
- qRound(xin * matrix.m[0][1] + yin * matrix.m[1][1] + matrix.m[3][1]));
- } else {
- x = xin * matrix.m[0][0] +
- yin * matrix.m[1][0] +
- matrix.m[3][0];
- y = xin * matrix.m[0][1] +
- yin * matrix.m[1][1] +
- matrix.m[3][1];
- w = xin * matrix.m[0][3] +
- yin * matrix.m[1][3] +
- matrix.m[3][3];
- if (w == 1.0f)
- return QPoint(qRound(x), qRound(y));
- else
- return QPoint(qRound(x / w), qRound(y / w));
- }
-}
-
-inline QPointF operator*(const QDoubleMatrix4x4& matrix, const QPointF& point)
-{
- double xin, yin;
- double x, y, w;
- xin = point.x();
- yin = point.y();
- if (matrix.flagBits == QDoubleMatrix4x4::Identity) {
- return point;
- } else if (matrix.flagBits < QDoubleMatrix4x4::Rotation2D) {
- // Translation | Scale
- return QPointF(xin * matrix.m[0][0] + matrix.m[3][0],
- yin * matrix.m[1][1] + matrix.m[3][1]);
- } else if (matrix.flagBits < QDoubleMatrix4x4::Perspective) {
- return QPointF(xin * matrix.m[0][0] + yin * matrix.m[1][0] + matrix.m[3][0],
- xin * matrix.m[0][1] + yin * matrix.m[1][1] + matrix.m[3][1]);
- } else {
- x = xin * matrix.m[0][0] +
- yin * matrix.m[1][0] +
- matrix.m[3][0];
- y = xin * matrix.m[0][1] +
- yin * matrix.m[1][1] +
- matrix.m[3][1];
- w = xin * matrix.m[0][3] +
- yin * matrix.m[1][3] +
- matrix.m[3][3];
- if (w == 1.0f) {
- return QPointF(double(x), double(y));
- } else {
- return QPointF(double(x / w), double(y / w));
- }
- }
-}
-
-inline QDoubleMatrix4x4 operator-(const QDoubleMatrix4x4& matrix)
-{
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = -matrix.m[0][0];
- m.m[0][1] = -matrix.m[0][1];
- m.m[0][2] = -matrix.m[0][2];
- m.m[0][3] = -matrix.m[0][3];
- m.m[1][0] = -matrix.m[1][0];
- m.m[1][1] = -matrix.m[1][1];
- m.m[1][2] = -matrix.m[1][2];
- m.m[1][3] = -matrix.m[1][3];
- m.m[2][0] = -matrix.m[2][0];
- m.m[2][1] = -matrix.m[2][1];
- m.m[2][2] = -matrix.m[2][2];
- m.m[2][3] = -matrix.m[2][3];
- m.m[3][0] = -matrix.m[3][0];
- m.m[3][1] = -matrix.m[3][1];
- m.m[3][2] = -matrix.m[3][2];
- m.m[3][3] = -matrix.m[3][3];
- m.flagBits = QDoubleMatrix4x4::General;
- return m;
-}
-
-inline QDoubleMatrix4x4 operator*(double factor, const QDoubleMatrix4x4& matrix)
-{
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = matrix.m[0][0] * factor;
- m.m[0][1] = matrix.m[0][1] * factor;
- m.m[0][2] = matrix.m[0][2] * factor;
- m.m[0][3] = matrix.m[0][3] * factor;
- m.m[1][0] = matrix.m[1][0] * factor;
- m.m[1][1] = matrix.m[1][1] * factor;
- m.m[1][2] = matrix.m[1][2] * factor;
- m.m[1][3] = matrix.m[1][3] * factor;
- m.m[2][0] = matrix.m[2][0] * factor;
- m.m[2][1] = matrix.m[2][1] * factor;
- m.m[2][2] = matrix.m[2][2] * factor;
- m.m[2][3] = matrix.m[2][3] * factor;
- m.m[3][0] = matrix.m[3][0] * factor;
- m.m[3][1] = matrix.m[3][1] * factor;
- m.m[3][2] = matrix.m[3][2] * factor;
- m.m[3][3] = matrix.m[3][3] * factor;
- m.flagBits = QDoubleMatrix4x4::General;
- return m;
-}
-
-inline QDoubleMatrix4x4 operator*(const QDoubleMatrix4x4& matrix, double factor)
-{
- QDoubleMatrix4x4 m(1);
- m.m[0][0] = matrix.m[0][0] * factor;
- m.m[0][1] = matrix.m[0][1] * factor;
- m.m[0][2] = matrix.m[0][2] * factor;
- m.m[0][3] = matrix.m[0][3] * factor;
- m.m[1][0] = matrix.m[1][0] * factor;
- m.m[1][1] = matrix.m[1][1] * factor;
- m.m[1][2] = matrix.m[1][2] * factor;
- m.m[1][3] = matrix.m[1][3] * factor;
- m.m[2][0] = matrix.m[2][0] * factor;
- m.m[2][1] = matrix.m[2][1] * factor;
- m.m[2][2] = matrix.m[2][2] * factor;
- m.m[2][3] = matrix.m[2][3] * factor;
- m.m[3][0] = matrix.m[3][0] * factor;
- m.m[3][1] = matrix.m[3][1] * factor;
- m.m[3][2] = matrix.m[3][2] * factor;
- m.m[3][3] = matrix.m[3][3] * factor;
- m.flagBits = QDoubleMatrix4x4::General;
- return m;
-}
-
-inline bool qFuzzyCompare(const QDoubleMatrix4x4& m1, const QDoubleMatrix4x4& m2)
-{
- return qFuzzyCompare(m1.m[0][0], m2.m[0][0]) &&
- qFuzzyCompare(m1.m[0][1], m2.m[0][1]) &&
- qFuzzyCompare(m1.m[0][2], m2.m[0][2]) &&
- qFuzzyCompare(m1.m[0][3], m2.m[0][3]) &&
- qFuzzyCompare(m1.m[1][0], m2.m[1][0]) &&
- qFuzzyCompare(m1.m[1][1], m2.m[1][1]) &&
- qFuzzyCompare(m1.m[1][2], m2.m[1][2]) &&
- qFuzzyCompare(m1.m[1][3], m2.m[1][3]) &&
- qFuzzyCompare(m1.m[2][0], m2.m[2][0]) &&
- qFuzzyCompare(m1.m[2][1], m2.m[2][1]) &&
- qFuzzyCompare(m1.m[2][2], m2.m[2][2]) &&
- qFuzzyCompare(m1.m[2][3], m2.m[2][3]) &&
- qFuzzyCompare(m1.m[3][0], m2.m[3][0]) &&
- qFuzzyCompare(m1.m[3][1], m2.m[3][1]) &&
- qFuzzyCompare(m1.m[3][2], m2.m[3][2]) &&
- qFuzzyCompare(m1.m[3][3], m2.m[3][3]);
-}
-
-inline QPoint QDoubleMatrix4x4::map(const QPoint& point) const
-{
- return *this * point;
-}
-
-inline QPointF QDoubleMatrix4x4::map(const QPointF& point) const
-{
- return *this * point;
-}
-
-inline QDoubleVector3D QDoubleMatrix4x4::map(const QDoubleVector3D& point) const
-{
- return *this * point;
-}
-
-inline QDoubleVector3D QDoubleMatrix4x4::mapVector(const QDoubleVector3D& vector) const
-{
- if (flagBits < Scale) {
- // Translation
- return vector;
- } else if (flagBits < Rotation2D) {
- // Translation | Scale
- return QDoubleVector3D(vector.x() * m[0][0],
- vector.y() * m[1][1],
- vector.z() * m[2][2]);
- } else {
- return QDoubleVector3D(vector.x() * m[0][0] +
- vector.y() * m[1][0] +
- vector.z() * m[2][0],
- vector.x() * m[0][1] +
- vector.y() * m[1][1] +
- vector.z() * m[2][1],
- vector.x() * m[0][2] +
- vector.y() * m[1][2] +
- vector.z() * m[2][2]);
- }
-}
-
-inline double *QDoubleMatrix4x4::data()
-{
- // We have to assume that the caller will modify the matrix elements,
- // so we flip it over to "General" mode.
- flagBits = General;
- return *m;
-}
-
-inline void QDoubleMatrix4x4::viewport(const QRectF &rect)
-{
- viewport(rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_POSITIONING_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QDoubleMatrix4x4 &m);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDoubleMatrix4x4 &);
-Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDoubleMatrix4x4 &);
-#endif
-
-
-QT_END_NAMESPACE
-
-
-#endif // QDOUBLEMATRIX4X4_H
diff --git a/src/positioning/qdoublevector2d.cpp b/src/positioning/qdoublevector2d.cpp
deleted file mode 100644
index c18f2366..00000000
--- a/src/positioning/qdoublevector2d.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdoublevector2d_p.h"
-#include "qdoublevector3d_p.h"
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-QDoubleVector2D::QDoubleVector2D(const QDoubleVector3D &vector) :
- xp(vector.xp), yp(vector.yp)
-{
-}
-
-double QDoubleVector2D::length() const
-{
- return qSqrt(xp * xp + yp * yp);
-}
-
-QDoubleVector2D QDoubleVector2D::normalized() const
-{
- // Need some extra precision if the length is very small.
- double len = double(xp) * double(xp) +
- double(yp) * double(yp);
- if (qFuzzyIsNull(len - 1.0))
- return *this;
- else if (!qFuzzyIsNull(len))
- return *this / (double)qSqrt(len);
- else
- return QDoubleVector2D();
-}
-
-void QDoubleVector2D::normalize()
-{
- // Need some extra precision if the length is very small.
- double len = double(xp) * double(xp) +
- double(yp) * double(yp);
- if (qFuzzyIsNull(len - 1.0) || qFuzzyIsNull(len))
- return;
-
- len = qSqrt(len);
-
- xp /= len;
- yp /= len;
-}
-
-QDoubleVector3D QDoubleVector2D::toVector3D() const
-{
- return QDoubleVector3D(xp, yp, 0.0);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QDoubleVector2D &vector)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QDoubleVector2D(" << vector.x() << ", " << vector.y() << ')';
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-QDataStream &operator<<(QDataStream &stream, const QDoubleVector2D &vector)
-{
- stream << double(vector.x()) << double(vector.y());
- return stream;
-}
-
-QDataStream &operator>>(QDataStream &stream, QDoubleVector2D &vector)
-{
- double x, y;
- stream >> x;
- stream >> y;
- vector.setX(double(x));
- vector.setY(double(y));
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qdoublevector2d_p.h b/src/positioning/qdoublevector2d_p.h
deleted file mode 100644
index a692e190..00000000
--- a/src/positioning/qdoublevector2d_p.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDOUBLEVECTOR2D_P_H
-#define QDOUBLEVECTOR2D_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifdef QT_BUILD_LOCATION_LIB
-#include <QVector2D>
-#endif
-
-#include "qpositioningglobal_p.h"
-#include <QtCore/qmetatype.h>
-#include <QPointF>
-
-QT_BEGIN_NAMESPACE
-
-class QDoubleVector3D;
-
-class Q_POSITIONING_PRIVATE_EXPORT QDoubleVector2D
-{
-public:
- Q_DECL_CONSTEXPR inline QDoubleVector2D();
- Q_DECL_CONSTEXPR inline QDoubleVector2D(double xpos, double ypos);
- Q_DECL_CONSTEXPR explicit inline QDoubleVector2D(const QPointF &p);
- explicit QDoubleVector2D(const QDoubleVector3D &vector);
-
- Q_DECL_CONSTEXPR inline double manhattanLength() const;
- inline bool isNull() const;
- inline bool isFinite() const;
-
- Q_DECL_CONSTEXPR inline double x() const;
- Q_DECL_CONSTEXPR inline double y() const;
-
- inline void setX(double x);
- inline void setY(double y);
-
- double length() const;
- Q_DECL_CONSTEXPR inline double lengthSquared() const;
-
- QDoubleVector2D normalized() const;
- void normalize();
-
- inline QDoubleVector2D &operator+=(const QDoubleVector2D &vector);
- inline QDoubleVector2D &operator-=(const QDoubleVector2D &vector);
- inline QDoubleVector2D &operator*=(double factor);
- inline QDoubleVector2D &operator*=(const QDoubleVector2D &vector);
- inline QDoubleVector2D &operator/=(double divisor);
- inline QDoubleVector2D &operator/=(const QDoubleVector2D &vector);
-
- Q_DECL_CONSTEXPR static inline double dotProduct(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
- { return v1.xp * v2.xp + v1.yp * v2.yp; }
-
-
- friend Q_DECL_CONSTEXPR inline bool operator==(const QDoubleVector2D &v1, const QDoubleVector2D &v2);
- friend Q_DECL_CONSTEXPR inline bool operator!=(const QDoubleVector2D &v1, const QDoubleVector2D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator+(const QDoubleVector2D &v1, const QDoubleVector2D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator-(const QDoubleVector2D &v1, const QDoubleVector2D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator*(double factor, const QDoubleVector2D &vector);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator*(const QDoubleVector2D &vector, double factor);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator*(const QDoubleVector2D &v1, const QDoubleVector2D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator-(const QDoubleVector2D &vector);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector2D operator/(const QDoubleVector2D &vector, double divisor);
-
- friend Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QDoubleVector2D &v1, const QDoubleVector2D &v2);
-
- QDoubleVector3D toVector3D() const;
- Q_DECL_CONSTEXPR inline QPointF toPointF() const;
-
-private:
- double xp, yp;
-
- friend class QDoubleVector3D;
-};
-
-Q_DECLARE_TYPEINFO(QDoubleVector2D, Q_RELOCATABLE_TYPE);
-
-Q_DECL_CONSTEXPR inline QDoubleVector2D::QDoubleVector2D() : xp(0.0), yp(0.0) {}
-
-Q_DECL_CONSTEXPR inline QDoubleVector2D::QDoubleVector2D(double xpos, double ypos) : xp(xpos), yp(ypos) {}
-
-Q_DECL_CONSTEXPR inline QDoubleVector2D::QDoubleVector2D(const QPointF &p) : xp(p.x()), yp(p.y()) { }
-
-Q_DECL_CONSTEXPR inline double QDoubleVector2D::manhattanLength() const
-{
- return qAbs(x())+qAbs(y());
-}
-
-inline bool QDoubleVector2D::isNull() const
-{
- return qIsNull(xp) && qIsNull(yp);
-}
-
-inline bool QDoubleVector2D::isFinite() const
-{
- return qIsFinite(xp) && qIsFinite(yp);
-}
-
-Q_DECL_CONSTEXPR inline double QDoubleVector2D::x() const { return xp; }
-Q_DECL_CONSTEXPR inline double QDoubleVector2D::y() const { return yp; }
-
-inline void QDoubleVector2D::setX(double aX) { xp = aX; }
-inline void QDoubleVector2D::setY(double aY) { yp = aY; }
-
-Q_DECL_CONSTEXPR inline double QDoubleVector2D::lengthSquared() const
-{ return xp * xp + yp * yp; }
-
-inline QDoubleVector2D &QDoubleVector2D::operator+=(const QDoubleVector2D &vector)
-{
- xp += vector.xp;
- yp += vector.yp;
- return *this;
-}
-
-inline QDoubleVector2D &QDoubleVector2D::operator-=(const QDoubleVector2D &vector)
-{
- xp -= vector.xp;
- yp -= vector.yp;
- return *this;
-}
-
-inline QDoubleVector2D &QDoubleVector2D::operator*=(double factor)
-{
- xp *= factor;
- yp *= factor;
- return *this;
-}
-
-inline QDoubleVector2D &QDoubleVector2D::operator*=(const QDoubleVector2D &vector)
-{
- xp *= vector.xp;
- yp *= vector.yp;
- return *this;
-}
-
-inline QDoubleVector2D &QDoubleVector2D::operator/=(double divisor)
-{
- xp /= divisor;
- yp /= divisor;
- return *this;
-}
-
-inline QDoubleVector2D &QDoubleVector2D::operator/=(const QDoubleVector2D &vector)
-{
- xp /= vector.xp;
- yp /= vector.yp;
- return *this;
-}
-
-Q_DECL_CONSTEXPR inline bool operator==(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
-{
- return v1.xp == v2.xp && v1.yp == v2.yp;
-}
-
-Q_DECL_CONSTEXPR inline bool operator!=(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
-{
- return v1.xp != v2.xp || v1.yp != v2.yp;
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator+(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
-{
- return QDoubleVector2D(v1.xp + v2.xp, v1.yp + v2.yp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator-(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
-{
- return QDoubleVector2D(v1.xp - v2.xp, v1.yp - v2.yp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator*(double factor, const QDoubleVector2D &vector)
-{
- return QDoubleVector2D(vector.xp * factor, vector.yp * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator*(const QDoubleVector2D &vector, double factor)
-{
- return QDoubleVector2D(vector.xp * factor, vector.yp * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator*(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
-{
- return QDoubleVector2D(v1.xp * v2.xp, v1.yp * v2.yp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator-(const QDoubleVector2D &vector)
-{
- return QDoubleVector2D(-vector.xp, -vector.yp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector2D operator/(const QDoubleVector2D &vector, double divisor)
-{
- return QDoubleVector2D(vector.xp / divisor, vector.yp / divisor);
-}
-
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QDoubleVector2D &v1, const QDoubleVector2D &v2)
-{
- return qFuzzyCompare(v1.xp, v2.xp) && qFuzzyCompare(v1.yp, v2.yp);
-}
-
-Q_DECL_CONSTEXPR inline QPointF QDoubleVector2D::toPointF() const
-{
- return QPointF(qreal(xp), qreal(yp));
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_POSITIONING_EXPORT QDebug operator<<(QDebug dbg, const QDoubleVector2D &vector);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-Q_POSITIONING_EXPORT QDataStream &operator<<(QDataStream &, const QDoubleVector2D &);
-Q_POSITIONING_EXPORT QDataStream &operator>>(QDataStream &, QDoubleVector2D &);
-#endif
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qdoublevector3d.cpp b/src/positioning/qdoublevector3d.cpp
deleted file mode 100644
index b308084b..00000000
--- a/src/positioning/qdoublevector3d.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdoublevector3d_p.h"
-#include <QtCore/qdatastream.h>
-#include <QtCore/qmath.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-QDoubleVector3D QDoubleVector3D::normalized() const
-{
- // Need some extra precision if the length is very small.
- double len = double(xp) * double(xp) +
- double(yp) * double(yp) +
- double(zp) * double(zp);
- if (qFuzzyIsNull(len - 1.0))
- return *this;
- else if (!qFuzzyIsNull(len))
- return *this / (double)qSqrt(len);
- else
- return QDoubleVector3D();
-}
-
-void QDoubleVector3D::normalize()
-{
- // Need some extra precision if the length is very small.
- double len = double(xp) * double(xp) +
- double(yp) * double(yp) +
- double(zp) * double(zp);
- if (qFuzzyIsNull(len - 1.0) || qFuzzyIsNull(len))
- return;
-
- len = qSqrt(len);
-
- xp /= len;
- yp /= len;
- zp /= len;
-}
-
-QDoubleVector3D QDoubleVector3D::normal(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return crossProduct(v1, v2).normalized();
-}
-
-QDoubleVector3D QDoubleVector3D::normal
- (const QDoubleVector3D &v1, const QDoubleVector3D &v2, const QDoubleVector3D &v3)
-{
- return crossProduct((v2 - v1), (v3 - v1)).normalized();
-}
-
-double QDoubleVector3D::distanceToPlane
- (const QDoubleVector3D &plane1, const QDoubleVector3D &plane2, const QDoubleVector3D &plane3) const
-{
- QDoubleVector3D n = normal(plane2 - plane1, plane3 - plane1);
- return dotProduct(*this - plane1, n);
-}
-
-double QDoubleVector3D::distanceToLine
- (const QDoubleVector3D &point, const QDoubleVector3D &direction) const
-{
- if (direction.isNull())
- return (*this - point).length();
- QDoubleVector3D p = point + dotProduct(*this - point, direction) * direction;
- return (*this - p).length();
-}
-
-double QDoubleVector3D::length() const
-{
- return qSqrt(xp * xp + yp * yp + zp * zp);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QDoubleVector3D &vector)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QDoubleVector3D("
- << vector.x() << ", " << vector.y() << ", " << vector.z() << ')';
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-QDataStream &operator<<(QDataStream &stream, const QDoubleVector3D &vector)
-{
- stream << double(vector.x()) << double(vector.y())
- << double(vector.z());
- return stream;
-}
-
-QDataStream &operator>>(QDataStream &stream, QDoubleVector3D &vector)
-{
- double x, y, z;
- stream >> x;
- stream >> y;
- stream >> z;
- vector.setX(double(x));
- vector.setY(double(y));
- vector.setZ(double(z));
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qdoublevector3d_p.h b/src/positioning/qdoublevector3d_p.h
deleted file mode 100644
index 3b4503aa..00000000
--- a/src/positioning/qdoublevector3d_p.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDOUBLEVECTOR3D_P_H
-#define QDOUBLEVECTOR3D_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifdef QT_BUILD_LOCATION_LIB
-#include <QVector3D>
-#endif
-
-#include "qpositioningglobal_p.h"
-#include "qdoublevector2d_p.h"
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONING_PRIVATE_EXPORT QDoubleVector3D
-{
-public:
- Q_DECL_CONSTEXPR inline QDoubleVector3D();
- Q_DECL_CONSTEXPR inline QDoubleVector3D(double xpos, double ypos, double zpos);
- Q_DECL_CONSTEXPR inline QDoubleVector3D(const QDoubleVector2D &vector);
- Q_DECL_CONSTEXPR inline QDoubleVector3D(const QDoubleVector2D &vector, double zpos);
-
- inline bool isNull() const;
-
- Q_DECL_CONSTEXPR inline double x() const;
- Q_DECL_CONSTEXPR inline double y() const;
- Q_DECL_CONSTEXPR inline double z() const;
-
- inline void setX(double x);
- inline void setY(double y);
- inline void setZ(double z);
-
- inline double get(int i) const;
- inline void set(int i, double value);
-
- double length() const;
- Q_DECL_CONSTEXPR inline double lengthSquared() const;
-
- QDoubleVector3D normalized() const;
- void normalize();
-
- inline QDoubleVector3D &operator+=(const QDoubleVector3D &vector);
- inline QDoubleVector3D &operator-=(const QDoubleVector3D &vector);
- inline QDoubleVector3D &operator*=(double factor);
- inline QDoubleVector3D &operator*=(const QDoubleVector3D &vector);
- inline QDoubleVector3D &operator/=(double divisor);
-
- Q_DECL_CONSTEXPR static inline double dotProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
- { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; }
-
- Q_DECL_CONSTEXPR static inline QDoubleVector3D crossProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
- { return QDoubleVector3D(v1.yp * v2.zp - v1.zp * v2.yp,
- v1.zp * v2.xp - v1.xp * v2.zp,
- v1.xp * v2.yp - v1.yp * v2.xp); }
-
- static QDoubleVector3D normal(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
- static QDoubleVector3D normal
- (const QDoubleVector3D &v1, const QDoubleVector3D &v2, const QDoubleVector3D &v3);
-
- double distanceToPlane(const QDoubleVector3D &plane, const QDoubleVector3D &normal) const;
- double distanceToPlane(const QDoubleVector3D &plane1, const QDoubleVector3D &plane2, const QDoubleVector3D &plane3) const;
- double distanceToLine(const QDoubleVector3D &point, const QDoubleVector3D &direction) const;
-
- friend Q_DECL_CONSTEXPR inline bool operator==(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
- friend Q_DECL_CONSTEXPR inline bool operator!=(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator+(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator-(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator*(double factor, const QDoubleVector3D &vector);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator*(const QDoubleVector3D &vector, double factor);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator*(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator-(const QDoubleVector3D &vector);
- friend Q_DECL_CONSTEXPR inline const QDoubleVector3D operator/(const QDoubleVector3D &vector, double divisor);
-
- friend Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QDoubleVector3D &v1, const QDoubleVector3D &v2);
-
- Q_DECL_CONSTEXPR inline QDoubleVector2D toVector2D() const;
-
-private:
- double xp, yp, zp;
-
- friend class QDoubleVector2D;
-};
-
-Q_DECLARE_TYPEINFO(QDoubleVector3D, Q_RELOCATABLE_TYPE);
-
-Q_DECL_CONSTEXPR inline QDoubleVector3D::QDoubleVector3D() : xp(0.0), yp(0.0), zp(0.0) {}
-
-Q_DECL_CONSTEXPR inline QDoubleVector3D::QDoubleVector3D(double xpos, double ypos, double zpos) : xp(xpos), yp(ypos), zp(zpos) {}
-
-Q_DECL_CONSTEXPR inline QDoubleVector3D::QDoubleVector3D(const QDoubleVector2D &v)
- : xp(v.xp), yp(v.yp), zp(0.0) {}
-
-Q_DECL_CONSTEXPR inline QDoubleVector3D::QDoubleVector3D(const QDoubleVector2D &v, double zpos)
- : xp(v.xp), yp(v.yp), zp(zpos) {}
-
-inline bool QDoubleVector3D::isNull() const
-{
- return qIsNull(xp) && qIsNull(yp) && qIsNull(zp);
-}
-
-Q_DECL_CONSTEXPR inline double QDoubleVector3D::x() const { return xp; }
-Q_DECL_CONSTEXPR inline double QDoubleVector3D::y() const { return yp; }
-Q_DECL_CONSTEXPR inline double QDoubleVector3D::z() const { return zp; }
-
-Q_DECL_CONSTEXPR inline double QDoubleVector3D::lengthSquared() const
-{ return xp * xp + yp * yp + zp * zp; }
-
-
-inline void QDoubleVector3D::setX(double aX) { xp = aX; }
-inline void QDoubleVector3D::setY(double aY) { yp = aY; }
-inline void QDoubleVector3D::setZ(double aZ) { zp = aZ; }
-
-inline double QDoubleVector3D::get(int i) const
-{
- switch (i) {
- case 0:
- return xp;
- case 1:
- return yp;
- case 2:
- return zp;
- default:
- return 0.0;
- }
-}
-
-inline void QDoubleVector3D::set(int i, double value)
-{
- switch (i) {
- case 0:
- xp = value;
- break;
- case 1:
- yp = value;
- break;
- case 2:
- zp = value;
- break;
- default:
- break;
- }
-}
-
-inline QDoubleVector3D &QDoubleVector3D::operator+=(const QDoubleVector3D &vector)
-{
- xp += vector.xp;
- yp += vector.yp;
- zp += vector.zp;
- return *this;
-}
-
-inline QDoubleVector3D &QDoubleVector3D::operator-=(const QDoubleVector3D &vector)
-{
- xp -= vector.xp;
- yp -= vector.yp;
- zp -= vector.zp;
- return *this;
-}
-
-inline QDoubleVector3D &QDoubleVector3D::operator*=(double factor)
-{
- xp *= factor;
- yp *= factor;
- zp *= factor;
- return *this;
-}
-
-inline QDoubleVector3D &QDoubleVector3D::operator*=(const QDoubleVector3D &vector)
-{
- xp *= vector.xp;
- yp *= vector.yp;
- zp *= vector.zp;
- return *this;
-}
-
-inline QDoubleVector3D &QDoubleVector3D::operator/=(double divisor)
-{
- xp /= divisor;
- yp /= divisor;
- zp /= divisor;
- return *this;
-}
-
-Q_DECL_CONSTEXPR inline bool operator==(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp;
-}
-
-Q_DECL_CONSTEXPR inline bool operator!=(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp;
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator+(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return QDoubleVector3D(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator-(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return QDoubleVector3D(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator*(double factor, const QDoubleVector3D &vector)
-{
- return QDoubleVector3D(vector.xp * factor, vector.yp * factor, vector.zp * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator*(const QDoubleVector3D &vector, double factor)
-{
- return QDoubleVector3D(vector.xp * factor, vector.yp * factor, vector.zp * factor);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator*(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return QDoubleVector3D(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator-(const QDoubleVector3D &vector)
-{
- return QDoubleVector3D(-vector.xp, -vector.yp, -vector.zp);
-}
-
-Q_DECL_CONSTEXPR inline const QDoubleVector3D operator/(const QDoubleVector3D &vector, double divisor)
-{
- return QDoubleVector3D(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor);
-}
-
-Q_DECL_CONSTEXPR inline bool qFuzzyCompare(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
-{
- return qFuzzyCompare(v1.xp, v2.xp) &&
- qFuzzyCompare(v1.yp, v2.yp) &&
- qFuzzyCompare(v1.zp, v2.zp);
-}
-
-Q_DECL_CONSTEXPR inline QDoubleVector2D QDoubleVector3D::toVector2D() const
-{
- return QDoubleVector2D(xp, yp);
-}
-
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_POSITIONING_EXPORT QDebug operator<<(QDebug dbg, const QDoubleVector3D &vector);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-Q_POSITIONING_EXPORT QDataStream &operator<<(QDataStream &, const QDoubleVector3D &);
-Q_POSITIONING_EXPORT QDataStream &operator>>(QDataStream &, QDoubleVector3D &);
-#endif
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeoaddress.cpp b/src/positioning/qgeoaddress.cpp
deleted file mode 100644
index 9d00c769..00000000
--- a/src/positioning/qgeoaddress.cpp
+++ /dev/null
@@ -1,776 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeoaddress.h"
-#include "qgeoaddress_p.h"
-
-#include <QtCore/QStringList>
-
-#ifdef QGEOADDRESS_DEBUG
-#include <QDebug>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*
- Combines a list of address parts into a single line.
-
- The parts parameter contains both address elements such as city, state and so on
- as well as separators such as spaces and commas.
-
- It is expected that an element is always followed by a separator and the last
- sepator is usually a new line delimeter.
-
- For example: Springfield, 8900
- would have four parts
- ["Springfield", ", ", "8900", "<br>"]
-
- The addressLine takes care of putting in separators appropriately or leaving
- them out depending on whether the adjacent elements are present or not.
- For example if city were empty in the above scenario the returned string is "8900<br>"
- If the postal code was empty, returned string is "Springfield<br>"
- If both city and postal code were empty, the returned string is "".
-*/
-static QString addressLine(const QStringList &parts)
-{
- QString line;
- Q_ASSERT(parts.count() % 2 == 0);
-
- //iterate until just before the last pair
- QString penultimateSeparator;
- for (int i = 0; i < parts.count() - 2; i += 2) {
- if (!parts.at(i).isEmpty()) {
- line.append(parts.at(i) + parts.at(i + 1));
- penultimateSeparator = parts.at(i + 1);
- }
- }
-
- if (parts.at(parts.count() - 2).isEmpty()) {
- line.chop(penultimateSeparator.length());
-
- if (!line.isEmpty())
- line.append(parts.at(parts.count() - 1));
- } else {
- line.append(parts.at(parts.count() - 2));
- line.append(parts.at(parts.count() - 1));
- }
-
- return line;
-}
-
-/*
- Returns a single formatted string representing the \a address. Lines of the address
- are delimited by \a newLine. By default lines are delimited by <br/>. The \l
- {QGeoAddress::countryCode} {countryCode} of the \a address determines the format of
- the resultant string.
-*/
-static QString formattedAddress(const QGeoAddress &address,
- const QString &newLine = QLatin1String("<br/>"))
-{
- const QString Comma(QStringLiteral(", "));
- const QString Dash(QStringLiteral("-"));
- const QString Space(QStringLiteral(" "));
-
- QString text;
-
- // We have 2 main approaches here:
- // 1. street number goes after street name
- // 2. street number goes before street name
- // We need to take it into account while generating the formatted address.
- // Currently these pages were used to check the formats:
- // https://en.wikipedia.org/wiki/Address
- // https://www.grcdi.nl/gsb/world%20address%20formats.html
- // We do not take into account such address extensions as apartment number,
- // because this is not what you can usually get from map providers (like
- // openstreetmap).
-
- if (address.countryCode() == QLatin1String("ALB")
- || address.countryCode() == QLatin1String("MTQ")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Comma
- << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("AND")
- || address.countryCode() == QLatin1String("AUT")
- || address.countryCode() == QLatin1String("GLP")
- || address.countryCode() == QLatin1String("ITA")
- || address.countryCode() == QLatin1String("RUS")
- || address.countryCode() == QLatin1String("SMR")
- || address.countryCode() == QLatin1String("VAT")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space
- << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- }else if (address.countryCode() == QLatin1String("FRA")
- || address.countryCode() == QLatin1String("GUF")
- || address.countryCode() == QLatin1String("LUX")
- || address.countryCode() == QLatin1String("MCO")
- || address.countryCode() == QLatin1String("REU")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space
- << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
-
- } else if (address.countryCode() == QLatin1String("ARE")
- || address.countryCode() == QLatin1String("BHS")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Space
- << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("AUS")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << (address.district().isEmpty() ? address.city() : address.district())
- << Space << address.state() << Space << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("BHR")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Comma
- << address.city() << Comma << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("BRA")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Space
- << address.city() << Dash << address.state() << Space << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("BRN")
- || address.countryCode() == QLatin1String("JOR")
- || address.countryCode() == QLatin1String("LBN")
- || address.countryCode() == QLatin1String("NZL")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.district() << Space
- << address.city() << Space << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("CAN")
- || address.countryCode() == QLatin1String("USA")
- || address.countryCode() == QLatin1String("VIR")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.city() << Comma << address.state() << Space
- << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("CHN")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << Comma
- << address.city() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("CHL")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space
- << address.district() << Comma << address.city() << Comma
- << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("CYM")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.state() << Space
- << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("GBR")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.district() << Comma
- << address.city() << Comma << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("GIB")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("HKG")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.district() << newLine);
- text += addressLine(QStringList() << address.city() << newLine);
- } else if (address.countryCode() == QLatin1String("IND")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.city() << Space << address.postalCode() << Space
- << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("IDN")
- || address.countryCode() == QLatin1String("JEY")
- || address.countryCode() == QLatin1String("LVA")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.city() << Comma << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("IRL")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.district() << Comma << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("KWT")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Comma
- << address.district() << Comma << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("MLT")
- || address.countryCode() == QLatin1String("SGP")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.city() << Space << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("UKR")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.city() << Space << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("MEX")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space << address.city() << Comma
- << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("MYS")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space << address.city() << newLine);
- text += addressLine(QStringList() << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("OMN")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << newLine);
- text += addressLine(QStringList() << address.district() << Comma
- << address.postalCode() << Comma
- << address.city() << Comma
- << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("PRI")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Comma << address.city() << Comma
- << address.state() << Comma << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("QAT")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Space << address.city() << Comma
- << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("SAU")) {
- text += addressLine(QStringList() << address.streetNumber() << Space
- << address.street() << Space
- << address.district() << newLine);
- text += addressLine(QStringList() << address.city() << Space << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("TWN")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << Comma
- << address.district() << Comma
- << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("THA")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Comma << address.city() << Space
- << address.postalCode() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("TUR")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space << address.district() << Comma
- << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("VEN")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.city() << Space << address.postalCode() << Comma
- << address.state() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else if (address.countryCode() == QLatin1String("ZAF")) {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.district() << Comma << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- } else {
- text += addressLine(QStringList() << address.street() << Space
- << address.streetNumber() << newLine);
- text += addressLine(QStringList() << address.postalCode() << Space << address.city() << newLine);
- text += addressLine(QStringList() << address.country() << newLine);
- }
-
- text.chop(newLine.length());
- return text;
-}
-
-QGeoAddressPrivate::QGeoAddressPrivate()
- : QSharedData(),
- m_autoGeneratedText(false)
-{
-}
-
-QGeoAddressPrivate::QGeoAddressPrivate(const QGeoAddressPrivate &other)
- : QSharedData(other),
- sCountry(other.sCountry),
- sCountryCode(other.sCountryCode),
- sState(other.sState),
- sCounty(other.sCounty),
- sCity(other.sCity),
- sDistrict(other.sDistrict),
- sStreet(other.sStreet),
- sStreetNumber(other.sStreetNumber),
- sPostalCode(other.sPostalCode),
- sText(other.sText),
- m_autoGeneratedText(false)
-{
-}
-
-QGeoAddressPrivate::~QGeoAddressPrivate()
-{
-}
-
-/*!
- \class QGeoAddress
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \ingroup QtLocation-places-data
- \ingroup QtLocation-places
- \since 5.2
-
- \brief The QGeoAddress class represents an address of a \l QGeoLocation.
-
- The address' attributes are normalized to US feature names and can be mapped
- to the local feature levels (for example State matches "Bundesland" in Germany).
-
- The address contains a \l text() for displaying purposes and additional
- properties to access the components of an address:
-
- \list
- \li QGeoAddress::country()
- \li QGeoAddress::countryCode()
- \li QGeoAddress::state()
- \li QGeoAddress::city()
- \li QGeoAddress::district()
- \li QGeoAddress::street()
- \li QGeoAddress::postalCode()
- \endlist
-*/
-
-/*!
- Default constructor.
-*/
-QGeoAddress::QGeoAddress()
- : d(new QGeoAddressPrivate)
-{
-}
-
-/*!
- Constructs a copy of \a other.
-*/
-QGeoAddress::QGeoAddress(const QGeoAddress &other)
- : d(other.d)
-{
-}
-
-/*!
- \fn QGeoAddress::QGeoAddress(QGeoAddress &&other) noexcept
- \since 6.2
-
- Constructs a geo address object by moving from \a other.
-
- \note The moved-from QGeoAddress object can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- \fn QGeoAddress &QGeoAddress::operator=(QGeoAddress &other)
- \since 6.2
-
- Move-assigns the \a other to this address and returns a reference to this
- address.
-
- \note The moved-from QGeoAddress object can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- Destroys this address.
-*/
-QGeoAddress::~QGeoAddress()
-{
-}
-
-QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoAddressPrivate)
-
-/*!
- Assigns the given \a address to this address and
- returns a reference to this address.
-*/
-QGeoAddress &QGeoAddress::operator=(const QGeoAddress & address)
-{
- if (this == &address)
- return *this;
-
- d = address.d;
- return *this;
-}
-
-/*!
- \fn bool QGeoAddress::operator==(const QGeoAddress &lhs, const QGeoAddress &rhs)
-
- Returns \c true if \a lhs address is equal to \a rhs, otherwise returns
- \c false.
-*/
-
-/*!
- \fn bool QGeoAddress::operator!=(const QGeoAddress &lhs, const QGeoAddress &rhs)
-
- Returns \c true if \a lhs address is not equal to \a rhs, otherwise returns
- \c false.
-*/
-
-/*!
- Returns the address as a single formatted string. It is the recommended string
- to use to display the address to the user. It typically takes the format of
- an address as found on an envelope, but this is not always necessarily the case.
-
- The address text is either automatically generated or explicitly assigned.
- This can be determined by checking \l {QGeoAddress::isTextGenerated()} {isTextGenerated}.
-
- If an empty string is provided to setText(), then isTextGenerated() will be set
- to \c true and text() will return a string which is locally formatted according to
- countryCode() and based on the elements of the address such as street, city and so on.
- Because the text string is generated from the address elements, a sequence
- of calls such as text(), setStreet(), text() may return different strings for each
- invocation of text().
-
- If a non-empty string is provided to setText(), then isTextGenerated() will be
- set to \c false and text() will always return the explicitly assigned string.
- Calls to modify other elements such as setStreet(), setCity() and so on will not
- affect the resultant string from text().
-*/
-QString QGeoAddress::text() const
-{
- if (d->sText.isEmpty())
- return formattedAddress(*this);
- else
- return d->sText;
-}
-
-/*!
- If \a text is not empty, explicitly assigns \a text as the string to be returned by
- text(). isTextGenerated() will return false.
-
- If \a text is empty, indicates that text() should be automatically generated
- from the address elements. isTextGenerated() will return true.
-*/
-void QGeoAddress::setText(const QString &text)
-{
- d->sText = text;
-}
-
-/*!
- Returns the country name.
-*/
-QString QGeoAddress::country() const
-{
- return d->sCountry;
-}
-
-/*!
- Sets the \a country name.
-*/
-void QGeoAddress::setCountry(const QString &country)
-{
- d->sCountry = country;
-}
-
-/*!
- Returns the country code according to ISO 3166-1 alpha-3
-*/
-QString QGeoAddress::countryCode() const
-{
- return d->sCountryCode;
-}
-
-/*!
- Sets the \a countryCode according to ISO 3166-1 alpha-3
-*/
-void QGeoAddress::setCountryCode(const QString &countryCode)
-{
- d->sCountryCode = countryCode;
-}
-
-/*!
- Returns the state. The state is considered the first subdivision below country.
-*/
-QString QGeoAddress::state() const
-{
- return d->sState;
-}
-
-/*!
- Sets the \a state.
-*/
-void QGeoAddress::setState(const QString &state)
-{
- d->sState = state;
-}
-
-/*!
- Returns the county. The county is considered the second subdivision below country.
-*/
-QString QGeoAddress::county() const
-{
- return d->sCounty;
-}
-
-/*!
- Sets the \a county.
-*/
-void QGeoAddress::setCounty(const QString &county)
-{
- d->sCounty = county;
-}
-
-/*!
- Returns the city.
-*/
-QString QGeoAddress::city() const
-{
- return d->sCity;
-}
-
-/*!
- Sets the \a city.
-*/
-void QGeoAddress::setCity(const QString &city)
-{
- d->sCity = city;
-}
-
-/*!
- Returns the district. The district is considered the subdivison below city.
-*/
-QString QGeoAddress::district() const
-{
- return d->sDistrict;
-}
-
-/*!
- Sets the \a district.
-*/
-void QGeoAddress::setDistrict(const QString &district)
-{
- d->sDistrict = district;
-}
-
-/*!
- Returns the street name.
-
- \note Before Qt6 this could also contain things like a unit number,
- a building name, or anything else that might be used to distinguish
- one address from another. Use streetNumber() to obtain this data now.
-
- \sa streetNumber()
-*/
-QString QGeoAddress::street() const
-{
- return d->sStreet;
-}
-
-/*!
- Sets the street name to \a street.
-
- \note Before Qt6 this could also contain things like a unit number,
- a building name, or anything else that might be used to distinguish
- one address from another. Use setStreetNumber() to set this data now.
-
- \sa setStreetNumber()
-*/
-void QGeoAddress::setStreet(const QString &street)
-{
- d->sStreet = street;
-}
-
-/*!
- \since 6.2
- Returns the street number.
-
- This may also contain things like a unit number, a building name, or
- anything else that might be used to distinguish one address from another.
-
- \note Before Qt6 this information was returned by street() method.
-
- \sa street()
-*/
-QString QGeoAddress::streetNumber() const
-{
- return d->sStreetNumber;
-}
-
-/*!
- \since 6.2
- Sets the street number to \a streetNumber.
-
- This may also contain things like a unit number, a building name, or
- anything else that might be used to distinguish one address from another.
-
- \note Before Qt6 this information was set by setStreet() method.
-
- \sa setStreet()
-*/
-void QGeoAddress::setStreetNumber(const QString &streetNumber)
-{
- d->sStreetNumber = streetNumber;
-}
-
-/*!
- Returns the postal code.
-*/
-QString QGeoAddress::postalCode() const
-{
- return d->sPostalCode;
-}
-
-/*!
- Sets the \a postalCode.
-*/
-void QGeoAddress::setPostalCode(const QString &postalCode)
-{
- d->sPostalCode = postalCode;
-}
-
-/*!
- Returns whether this address is empty. An address is considered empty
- if \e all of its fields are empty.
-*/
-bool QGeoAddress::isEmpty() const
-{
- return d->sCountry.isEmpty() &&
- d->sCountryCode.isEmpty() &&
- d->sState.isEmpty() &&
- d->sCounty.isEmpty() &&
- d->sCity.isEmpty() &&
- d->sDistrict.isEmpty() &&
- d->sStreet.isEmpty() &&
- d->sStreetNumber.isEmpty() &&
- d->sPostalCode.isEmpty() &&
- d->sText.isEmpty();
-
-}
-
-/*!
- Clears all of the address' data fields.
-*/
-void QGeoAddress::clear()
-{
- d->sCountry.clear();
- d->sCountryCode.clear();
- d->sState.clear();
- d->sCounty.clear();
- d->sCity.clear();
- d->sDistrict.clear();
- d->sStreet.clear();
- d->sStreetNumber.clear();
- d->sPostalCode.clear();
- d->sText.clear();
-}
-
-/*!
- Returns true if QGeoAddress::text() is automatically generated from address elements,
- otherwise returns false if text() has been explicitly assigned.
-
- \sa text(), setText()
-*/
-bool QGeoAddress::isTextGenerated() const
-{
- return d->sText.isEmpty();
-}
-
-bool QGeoAddress::equals(const QGeoAddress &lhs, const QGeoAddress &rhs)
-{
-#ifdef QGEOADDRESS_DEBUG
- qDebug() << "country" << (lhs.d->sCountry == rhs.d->sCountry);
- qDebug() << "countryCode" << (lhs.d->sCountryCode == rhs.d->sCountryCode);
- qDebug() << "state:" << (lhs.d->sState == rhs.d->sState);
- qDebug() << "county:" << (lhs.d->sCounty == rhs.d->sCounty);
- qDebug() << "city:" << (lhs.d->sCity == rhs.d->sCity);
- qDebug() << "district:" << (lhs.d->sDistrict == rhs.d->sDistrict);
- qDebug() << "street:" << (lhs.d->sStreet == rhs.d->sStreet);
- qDebug() << "street number:" << (lhs.d->sStreetNumber == rhs.d->sStreetNumber);
- qDebug() << "postalCode:" << (lhs.d->sPostalCode == rhs.d->sPostalCode);
- qDebug() << "text:" << (lhs.text() == rhs.text());
-#endif
-
- return lhs.d->sCountry == rhs.d->sCountry &&
- lhs.d->sCountryCode == rhs.d->sCountryCode &&
- lhs.d->sState == rhs.d->sState &&
- lhs.d->sCounty == rhs.d->sCounty &&
- lhs.d->sCity == rhs.d->sCity &&
- lhs.d->sDistrict == rhs.d->sDistrict &&
- lhs.d->sStreet == rhs.d->sStreet &&
- lhs.d->sStreetNumber == rhs.d->sStreetNumber &&
- lhs.d->sPostalCode == rhs.d->sPostalCode &&
- lhs.text() == rhs.text();
-}
-
-/*!
- \relates QGeoAddress
-
- Returns the hash value for the \a address, using \a seed for the
- calculation.
-*/
-size_t qHash(const QGeoAddress &address, size_t seed) noexcept
-{
- size_t hash = qHashMulti(seed, address.country(), address.countryCode(), address.state(),
- address.county(), address.city(), address.district(),
- address.street(), address.streetNumber(), address.postalCode());
-
- // If the text is generated from all fields, there is no need to use the
- // resulting string in the hash. However, when the text is specified
- // explicitly, we need to use it as well.
- if (!address.isTextGenerated())
- hash = qHashMulti(seed, hash, address.text());
- return hash;
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeoaddress.h b/src/positioning/qgeoaddress.h
deleted file mode 100644
index 703a808d..00000000
--- a/src/positioning/qgeoaddress.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOADDRESS_H
-#define QGEOADDRESS_H
-
-#include <QtCore/QMetaType>
-#include <QtCore/QSharedDataPointer>
-#include <QtPositioning/qpositioningglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QString;
-class QGeoAddressPrivate;
-QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoAddressPrivate, Q_POSITIONING_EXPORT)
-
-class Q_POSITIONING_EXPORT QGeoAddress
-{
-public:
- QGeoAddress();
- QGeoAddress(const QGeoAddress &other);
- QGeoAddress(QGeoAddress &&other) noexcept = default;
- ~QGeoAddress();
-
- QGeoAddress &operator=(const QGeoAddress &other);
- QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoAddress)
-
- void swap(QGeoAddress &other) noexcept { d.swap(other.d); }
-
- friend bool operator==(const QGeoAddress &lhs, const QGeoAddress &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoAddress &lhs, const QGeoAddress &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- QString text() const;
- void setText(const QString &text);
-
- QString country() const;
- void setCountry(const QString &country);
-
- QString countryCode() const;
- void setCountryCode(const QString &countryCode);
-
- QString state() const;
- void setState(const QString &state);
-
- QString county() const;
- void setCounty(const QString &county);
-
- QString city() const;
- void setCity(const QString &city);
-
- QString district() const;
- void setDistrict(const QString &district);
-
- QString postalCode() const;
- void setPostalCode(const QString &postalCode);
-
- QString street() const;
- void setStreet(const QString &street);
-
- QString streetNumber() const;
- void setStreetNumber(const QString &streetNumber);
-
- bool isEmpty() const;
- void clear();
-
- bool isTextGenerated() const;
-
-private:
- static bool equals(const QGeoAddress &lhs, const QGeoAddress &rhs);
- QSharedDataPointer<QGeoAddressPrivate> d;
-};
-
-Q_POSITIONING_EXPORT size_t qHash(const QGeoAddress &address, size_t seed = 0) noexcept;
-
-Q_DECLARE_SHARED(QGeoAddress)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoAddress)
-
-#endif
diff --git a/src/positioning/qgeoaddress_p.h b/src/positioning/qgeoaddress_p.h
deleted file mode 100644
index c0e8820c..00000000
--- a/src/positioning/qgeoaddress_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCATION_GEOADDRESS_P_H
-#define QLOCATION_GEOADDRESS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QString>
-#include <QSharedData>
-
-QT_BEGIN_NAMESPACE
-
-// The fields for the class are based on the nominatim openstreetmap API:
-// https://nominatim.org/release-docs/latest/api/Output/#addressdetails
-// It might not reflect all the address levels, but can be used to provide a
-// more or less well-formed address.
-class QGeoAddressPrivate : public QSharedData
-{
-public:
- QGeoAddressPrivate();
- QGeoAddressPrivate(const QGeoAddressPrivate &other);
- ~QGeoAddressPrivate();
-
- QString sCountry; //!< country field
- QString sCountryCode; //!< country code field
- QString sState; //!< state field
- QString sCounty; //!< county field
- QString sCity; //!< city field
- QString sDistrict; //!< district field
- QString sStreet; //!< street name field
- QString sStreetNumber; //!< street number field
- QString sPostalCode; //!< postal code field
- QString sText;
- bool m_autoGeneratedText;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeoareamonitorinfo.cpp b/src/positioning/qgeoareamonitorinfo.cpp
deleted file mode 100644
index ae9548f0..00000000
--- a/src/positioning/qgeoareamonitorinfo.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGeoAreaMonitorInfo>
-#include <QDateTime>
-#include <QSharedData>
-#include <QUuid>
-#include <QDataStream>
-
-#ifndef QT_NO_DEBUG_STREAM
-#include <QDebug>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoAreaMonitorInfo
- \inmodule QtPositioning
- \since 5.2
- \ingroup QtPositioning-positioning
- \ingroup shared
-
- \brief The QGeoAreaMonitorInfo class describes the parameters of an area or region
- to be monitored for proximity.
-
- The purpose of area monitoring is to inform a user when he/she comes close to an area of
- interest. In general such an area is described by a \l QGeoCircle. The circle's center
- represents the place of interest and the area around it identifies the geographical region
- within which notifications are sent.
-
- A QGeoAreaMonitorInfo object is valid if it has a non-empty name and a valid \l area().
- Such objects must be registered with a \l QGeoAreaMonitorSource to start and stop the
- monitoring process. Note that extensive monitoring can be very resource consuming
- because the positioning engine must remain active and has to match the current position
- with each QGeoAreaMonitorInfo instance.
-
- To further reduce the burden on the system there are optional attributes which can
- set. Each monitored area can have an expiry date which automatically removes the
- to-be-monitored area from the monitoring source once the expiry date has been reached.
- Another option is to adjust the persistence of a monitored area. A QGeoAreaMonitorInfo
- that \l isPersistent() will remain active beyond
- the current applications lifetime. If an area is entered while the monitoring
- application is not running the application will be started. Note that this feature is
- not available on all platforms. Its availability can be checked via
- \l QGeoAreaMonitorSource::supportedAreaMonitorFeatures().
-
- \sa QGeoAreaMonitorSource
-
- */
-
-class QGeoAreaMonitorInfoPrivate : public QSharedData
-{
-public:
- QGeoAreaMonitorInfoPrivate() : QSharedData(), persistent(false) {}
- QGeoAreaMonitorInfoPrivate(const QGeoAreaMonitorInfoPrivate &other)
- : QSharedData(other)
- {
- uid = other.uid;
- name = other.name;
- shape = other.shape;
- persistent = other.persistent;
- notificationParameters = other.notificationParameters;
- expiry = other.expiry;
- }
- ~QGeoAreaMonitorInfoPrivate() {}
-
- QUuid uid;
- QString name;
- QGeoShape shape;
- bool persistent;
- QVariantMap notificationParameters;
- QDateTime expiry;
-};
-
-/*!
- Constructs a QGeoAreaMonitorInfo object with the specified \a name.
-
- \sa name()
- */
-QGeoAreaMonitorInfo::QGeoAreaMonitorInfo(const QString &name)
-{
- d = new QGeoAreaMonitorInfoPrivate;
- d->name = name;
- d->uid = QUuid::createUuid();
-}
-
-/*!
- Constructs a QGeoAreaMonitorInfo object as a copy of \a other.
- */
-QGeoAreaMonitorInfo::QGeoAreaMonitorInfo(const QGeoAreaMonitorInfo &other)
- : d(other.d)
-{
-}
-
-/*!
- \fn QGeoAreaMonitorInfo::QGeoAreaMonitorInfo(QGeoAreaMonitorInfo &&other) noexcept
- \since 6.2
-
- Constructs a QGeoAreaMonitorInfo object by moving from \a other.
-
- Note that a moved-from QGeoAreaMonitorInfo can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- Destructor
- */
-QGeoAreaMonitorInfo::~QGeoAreaMonitorInfo()
-{
-}
-
-QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QGeoAreaMonitorInfoPrivate)
-
-/*!
- Assigns \a other to this QGeoAreaMonitorInfo object and returns a reference
- to this QGeoAreaMonitorInfo object.
- */
-QGeoAreaMonitorInfo &QGeoAreaMonitorInfo::operator=(const QGeoAreaMonitorInfo &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- \fn QGeoAreaMonitorInfo &QGeoAreaMonitorInfo::operator=(QGeoAreaMonitorInfo &&other) noexcept
- \since 6.2
-
- Move-assigns \a other to this QGeoAreaMonitorInfo object and returns a
- reference to this QGeoAreaMonitorInfo object.
-
- Note that a moved-from QGeoAreaMonitorInfo can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- \fn bool QGeoAreaMonitorInfo::operator==(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs)
-
- Returns \c true if all of the \a lhs object's values are the same as those
- of \a rhs object. Otherwise returns \c false.
-*/
-
-/*!
- \fn bool QGeoAreaMonitorInfo::operator!=(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs)
-
- Returns \c true if any of the \a lhs object's values are not the same as
- those of \a rhs object. Otherwise returns \c false.
-*/
-
-/*!
- Returns the name of the QGeoAreaMonitorInfo object. The name should be used
- for user-visibility purposes.
- */
-QString QGeoAreaMonitorInfo::name() const
-{
- return d->name;
-}
-
-/*!
- Sets the user visibile \a name.
- */
-void QGeoAreaMonitorInfo::setName(const QString &name)
-{
- if (d->name != name) {
- d.detach();
- d->name = name;
- }
-}
-
-/*!
- Returns the identifier of the QGeoAreaMonitorInfo object.
- The identifier is automatically generated upon construction of a new
- QGeoAreaMonitorInfo object.
-*/
-
-QString QGeoAreaMonitorInfo::identifier() const
-{
- return d->uid.toString();
-}
-
-/*!
- Returns true, if the monitor is valid. A valid QGeoAreaMonitorInfo has a non-empty name()
- and the monitored area is not \l {QGeoShape::isEmpty()}{empty()}.
- Otherwise this function returns false.
- */
-bool QGeoAreaMonitorInfo::isValid() const
-{
- return (!d->name.isEmpty() && !d->shape.isEmpty());
-}
-
-/*!
- Returns the boundaries of the to-be-monitored area. This area must not be empty.
-
- \sa setArea()
- */
-QGeoShape QGeoAreaMonitorInfo::area() const
-{
- return d->shape;
-}
-
-/*!
- Sets the to-be-monitored area to \a newShape.
-
- \sa area()
- */
-void QGeoAreaMonitorInfo::setArea(const QGeoShape &newShape)
-{
- d.detach();
- d->shape = newShape;
-}
-
-/*!
- Returns the expiry date.
-
- After an active QGeoAreaMonitorInfo has expired the region is no longer monitored
- and the QGeoAreaMonitorInfo object is removed from the list of
- \l {QGeoAreaMonitorSource::activeMonitors()}{active monitors}.
-
- If the expiry \l QDateTime is invalid the QGeoAreaMonitorInfo object is treated as not having
- an expiry date. This implies an indefinite monitoring period if the object is persistent or
- until the current application closes if the object is non-persistent.
-
- \sa QGeoAreaMonitorSource::activeMonitors()
- */
-QDateTime QGeoAreaMonitorInfo::expiration() const
-{
- return d->expiry;
-}
-
-/*!
- Sets the expiry date and time to \a expiry.
- */
-void QGeoAreaMonitorInfo::setExpiration(const QDateTime &expiry)
-{
- d.detach();
- d->expiry = expiry;
-}
-
-/*!
- Returns true if the QGeoAreaMonitorInfo is persistent.
- The default value for this property is false.
-
- A non-persistent QGeoAreaMonitorInfo will be removed by the system once
- the application owning the monitor object stops. Persistent objects remain
- active and can be retrieved once the application restarts.
-
- If the system triggers an event associated to a persistent QGeoAreaMonitorInfo
- the relevant application will be re-started and the appropriate signal emitted.
-
- \sa setPersistent()
- */
-bool QGeoAreaMonitorInfo::isPersistent() const
-{
- return d->persistent;
-}
-
-/*!
- Sets the QGeoAreaMonitorInfo object's persistence to \a isPersistent.
-
- Note that setting this flag does not imply that \l QGeoAreaMonitorSource
- supports persistent monitoring.
- \l QGeoAreaMonitorSource::supportedAreaMonitorFeatures() can be used to
- check for this feature's availability.
-
- \sa isPersistent()
- */
-void QGeoAreaMonitorInfo::setPersistent(bool isPersistent)
-{
- d.detach();
- d->persistent = isPersistent;
-}
-
-
-/*!
- Returns the set of platform specific parameters used by this
- QGeoAreaMonitorInfo.
-
- \sa setNotificationParameters()
- */
-QVariantMap QGeoAreaMonitorInfo::notificationParameters() const
-{
- return d->notificationParameters;
-}
-
-/*!
- Sets the set of platform specific \a parameters used by QGeoAreaMonitorInfo.
-
- \sa notificationParameters()
- */
-void QGeoAreaMonitorInfo::setNotificationParameters(const QVariantMap &parameters)
-{
- d.detach();
- d->notificationParameters = parameters;
-}
-
-/*!
- \internal
-*/
-void QGeoAreaMonitorInfo::detach()
-{
- if (d)
- d.detach();
- else
- d = new QGeoAreaMonitorInfoPrivate;
-}
-
-bool QGeoAreaMonitorInfo::equals(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs)
-{
- return (lhs.d->name == rhs.d->name &&
- lhs.d->uid == rhs.d->uid &&
- lhs.d->shape == rhs.d->shape &&
- lhs.d->persistent == rhs.d->persistent &&
- lhs.d->expiry == rhs.d->expiry &&
- lhs.d->notificationParameters == rhs.d->notificationParameters);
-}
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \fn QDataStream &QGeoAreaMonitorInfo::operator<<(QDataStream &stream, const QGeoAreaMonitorInfo &monitor)
-
- Writes the given \a monitor to the specified \a stream.
-
- \sa {Serializing Qt Data Types}
-*/
-QDataStream &QGeoAreaMonitorInfo::dataStreamOut(QDataStream &ds, const QGeoAreaMonitorInfo &monitor)
-{
- ds << monitor.name() << monitor.d->uid << monitor.area()
- << monitor.isPersistent() << monitor.notificationParameters() << monitor.expiration();
- return ds;
-}
-
-/*!
- \fn QDataStream &QGeoAreaMonitorInfo::operator>>(QDataStream &stream, QGeoAreaMonitorInfo &monitor)
-
- Reads a area monitoring data from the specified \a stream into the given
- \a monitor.
-
- \sa {Serializing Qt Data Types}
-*/
-QDataStream &QGeoAreaMonitorInfo::dataStreamIn(QDataStream &ds, QGeoAreaMonitorInfo &monitor)
-{
- QString s;
- ds >> s;
- monitor = QGeoAreaMonitorInfo(s);
-
- QUuid id;
- ds >> id;
- monitor.d->uid = id;
-
- QGeoShape shape;
- ds >> shape;
- monitor.setArea(shape);
-
- bool persistent;
- ds >> persistent;
- monitor.setPersistent(persistent);
-
- QVariantMap map;
- ds >> map;
- monitor.setNotificationParameters(map);
-
- QDateTime dt;
- ds >> dt;
- monitor.setExpiration(dt);
-
- return ds;
-}
-
-#endif
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug QGeoAreaMonitorInfo::debugStreaming(QDebug dbg, const QGeoAreaMonitorInfo &monitor)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QGeoAreaMonitorInfo(\"" << qPrintable(monitor.name())
- << "\", " << monitor.area()
- << ", persistent: " << monitor.isPersistent()
- << ", expiry: " << monitor.expiration() << ")";
- return dbg;
-}
-
-#endif
-
-size_t qHash(const QGeoAreaMonitorInfo &key, size_t seed) noexcept
-{
- return qHashMulti(seed, key.d->uid);
-}
-
-namespace QTest
-{
-
-char *toString(const QGeoAreaMonitorInfo &info)
-{
- QString result;
- QDebug dbg(&result);
- dbg << info;
- return qstrdup(qPrintable(result));
-}
-
-} // namespace QTest
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeoareamonitorinfo.h b/src/positioning/qgeoareamonitorinfo.h
deleted file mode 100644
index def03b8b..00000000
--- a/src/positioning/qgeoareamonitorinfo.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOAREAMONITORINFO_H
-#define QGEOAREAMONITORINFO_H
-
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoShape>
-#include <QtCore/QExplicitlySharedDataPointer>
-#include <QtCore/QMetaType>
-#include <QtCore/QVariantMap>
-
-QT_BEGIN_NAMESPACE
-
-class QDataStream;
-class QGeoAreaMonitorInfo;
-
-Q_POSITIONING_EXPORT size_t qHash(const QGeoAreaMonitorInfo &key, size_t seed = 0) noexcept;
-namespace QTest
-{
-Q_POSITIONING_EXPORT char *toString(const QGeoAreaMonitorInfo &info);
-} // namespace QTest
-
-class QGeoAreaMonitorInfoPrivate;
-QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoAreaMonitorInfoPrivate, Q_POSITIONING_EXPORT)
-
-class Q_POSITIONING_EXPORT QGeoAreaMonitorInfo
-{
-public:
- explicit QGeoAreaMonitorInfo(const QString &name = QString());
- QGeoAreaMonitorInfo(const QGeoAreaMonitorInfo &other);
- QGeoAreaMonitorInfo(QGeoAreaMonitorInfo &&other) noexcept = default;
- ~QGeoAreaMonitorInfo();
-
- QGeoAreaMonitorInfo &operator=(const QGeoAreaMonitorInfo &other);
- QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoAreaMonitorInfo)
-
- void swap(QGeoAreaMonitorInfo &other) noexcept { d.swap(other.d); }
-
- friend bool operator==(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- QString name() const;
- void setName(const QString &name);
-
- QString identifier() const;
- bool isValid() const;
-
- QGeoShape area() const;
- void setArea(const QGeoShape &newShape);
-
- QDateTime expiration() const;
- void setExpiration(const QDateTime &expiry);
-
- bool isPersistent() const;
- void setPersistent(bool isPersistent);
-
- QVariantMap notificationParameters() const;
- void setNotificationParameters(const QVariantMap &parameters);
-
- void detach();
-
-private:
- static bool equals(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs);
- QExplicitlySharedDataPointer<QGeoAreaMonitorInfoPrivate> d;
- friend class QGeoAreaMonitorInfoPrivate;
-
-#ifndef QT_NO_DATASTREAM
- friend QDataStream &operator<<(QDataStream &ds, const QGeoAreaMonitorInfo &monitor)
- {
- return dataStreamOut(ds, monitor);
- }
- friend QDataStream &operator>>(QDataStream &ds, QGeoAreaMonitorInfo &monitor)
- {
- return dataStreamIn(ds, monitor);
- }
- static QDataStream &dataStreamOut(QDataStream &ds, const QGeoAreaMonitorInfo &monitor);
- static QDataStream &dataStreamIn(QDataStream &ds, QGeoAreaMonitorInfo &monitor);
-#endif
- friend Q_POSITIONING_EXPORT size_t qHash(const QGeoAreaMonitorInfo &key, size_t seed) noexcept;
- friend Q_POSITIONING_EXPORT char *QTest::toString(const QGeoAreaMonitorInfo& info);
-#ifndef QT_NO_DEBUG_STREAM
- friend QDebug operator<<(QDebug dbg, const QGeoAreaMonitorInfo &monitor)
- {
- return debugStreaming(dbg, monitor);
- }
- static QDebug debugStreaming(QDebug dbg, const QGeoAreaMonitorInfo &monitor);
-#endif
-};
-
-Q_DECLARE_SHARED(QGeoAreaMonitorInfo)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoAreaMonitorInfo)
-
-#endif // QGEOAREAMONITORINFO_H
diff --git a/src/positioning/qgeoareamonitorsource.cpp b/src/positioning/qgeoareamonitorsource.cpp
deleted file mode 100644
index 6df3dc73..00000000
--- a/src/positioning/qgeoareamonitorsource.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/private/qobject_p.h>
-#include <QGeoAreaMonitorSource>
-#include "qgeopositioninfosourcefactory.h"
-#include "qgeopositioninfosource_p.h"
-
-/*!
- \class QGeoAreaMonitorSource
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoAreaMonitorSource class enables the detection of proximity
- changes for a specified set of coordinates.
-
- A QGeoAreaMonitorSource emits signals when the current position is in
- range, or has moved out of range, of a specified area.
- Each area is specified by a \l QGeoAreaMonitorInfo object.
- For example:
-
- \snippet cpp/cppqml.cpp BigBen
-
- \c QGeoAreaMonitorSource follows a singleton pattern. Each instance of
- the class with the same \l sourceName() shares the same area monitoring backend.
- If a new \l QGeoAreaMonitorInfo object is added via \l startMonitoring()
- or \l requestUpdate() it can be retrieved by another instance of this class
- (provided that they are sourced from the same area monitor provider plug-in).
- The same singleton pattern applies to the \l QGeoPositionInfoSource instance
- used by this class. The following code snippet emphasizes the behavior:
-
- \code
- QGeoAreaMonitorSource *s1 = QGeoAreaMonitorSource::createSource("blah", this);
- QGeoAreaMonitorSource *s2 = QGeoAreaMonitorSource::createSource("blah", this);
- QVERIFY(s1->positionInfoSource() == s2->positionInfoSource);
- \endcode
-*/
-
-QT_BEGIN_NAMESPACE
-
-
-
-class QGeoAreaMonitorSourcePrivate : public QObjectPrivate
-{
-public:
- QGeoPositionInfoSource *source;
- QString providerName;
-};
-
-/*!
- \enum QGeoAreaMonitorSource::Error
- Defines the types of positioning methods.
-
- The Error enumeration represents the errors which can occur.
-
- \value AccessError The connection setup to the remote area monitoring backend failed because the
- application lacked the required privileges.
- \value InsufficientPositionInfo The area monitoring source could not retrieve a location fix or
- the accuracy of the fix is not high enough to provide an effective area monitoring.
- \value NoError No error has occurred.
- \value UnknownSourceError An unidentified error occurred.
-*/
-
-/*!
- \enum QGeoAreaMonitorSource::AreaMonitorFeature
- Defines the types of area monitoring capabilities.
-
- \value PersistentAreaMonitorFeature QGeoAreaMonitorInfo instances can be made persistent.
- A persistent monitor continues to be active even when the application managing the monitor is
- not running.
- \value AnyAreaMonitorFeature Matches all possible area monitoring features.
-*/
-
-/*!
- \fn virtual AreaMonitoringFeatures QGeoAreaMonitorSource::supportedAreaMonitorFeatures() const = 0;
-
- Returns the area monitoring features available to this source.
-*/
-
-/*!
- \fn virtual QGeoAreaMonitorSource::Error QGeoAreaMonitorSource::error() const
-
- Returns the type of error that last occurred.
-
- \note Since Qt6 the last error is always reset when calling
- startMonitoring() or requestUpdate().
-*/
-
-/*!
- Creates a monitor source with the given \a parent.
-*/
-QGeoAreaMonitorSource::QGeoAreaMonitorSource(QObject *parent)
- : QObject(*new QGeoAreaMonitorSourcePrivate, parent)
-{
- Q_D(QGeoAreaMonitorSource);
- d->source = nullptr;
-}
-
-/*!
- Destroys the monitor source.
-*/
-QGeoAreaMonitorSource::~QGeoAreaMonitorSource()
-{
-}
-
-/*!
- Creates and returns a monitor source with the given \a parent that
- monitors areas using resources on the underlying system.
-
- Returns \c nullptr if the system has no support for position monitoring.
-*/
-QGeoAreaMonitorSource *QGeoAreaMonitorSource::createDefaultSource(QObject *parent)
-{
- QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
- foreach (const QJsonObject &obj, plugins) {
- if (obj.value(QStringLiteral("Monitor")).isBool()
- && obj.value(QStringLiteral("Monitor")).toBool())
- {
- QGeoAreaMonitorSource *s = nullptr;
- auto factory = QGeoPositionInfoSourcePrivate::loadFactory(obj);
- if (factory)
- s = factory->areaMonitor(parent, QVariantMap());
- if (s)
- s->d_func()->providerName = obj.value(QStringLiteral("Provider")).toString();
- return s;
- }
- }
- return nullptr;
-}
-
-/*!
- Creates and returns a monitor source with the given \a parent,
- by loading the plugin named \a sourceName.
-
- Returns \c nullptr if the plugin cannot be found.
-*/
-QGeoAreaMonitorSource *QGeoAreaMonitorSource::createSource(const QString &sourceName, QObject *parent)
-{
- auto plugins = QGeoPositionInfoSourcePrivate::plugins();
- if (plugins.contains(sourceName)) {
- const auto metaData = plugins.value(sourceName);
- QGeoAreaMonitorSource *s = nullptr;
- auto factory = QGeoPositionInfoSourcePrivate::loadFactory(metaData);
- if (factory)
- s = factory->areaMonitor(parent, QVariantMap());
- if (s)
- s->d_func()->providerName = metaData.value(QStringLiteral("Provider")).toString();
- return s;
- }
-
- return nullptr;
-}
-
-/*!
- Returns a list of available monitor plugins, including the default system
- backend if one is available.
-*/
-QStringList QGeoAreaMonitorSource::availableSources()
-{
- QStringList plugins;
- const auto meta = QGeoPositionInfoSourcePrivate::plugins();
- for (auto it = meta.cbegin(), end = meta.cend(); it != end; ++it) {
- if (it.value().value(QStringLiteral("Monitor")).isBool()
- && it.value().value(QStringLiteral("Monitor")).toBool()) {
- plugins << it.key();
- }
- }
-
- return plugins;
-}
-
-/*!
- Returns the unique name of the area monitor source implementation in use.
-
- This is the same name that can be passed to createSource() in order to
- create a new instance of a particular area monitor source implementation.
-*/
-QString QGeoAreaMonitorSource::sourceName() const
-{
- Q_D(const QGeoAreaMonitorSource);
- return d->providerName;
-}
-
-/*!
- \since 6.2
-
- Sets the backend-specific property named \a name to \a value.
- Returns \c true on success, otherwise returns \c false.
- Backend-specific properties can be used to configure the area monitoring
- subsystem behavior at runtime.
-
- \sa backendProperty()
-*/
-bool QGeoAreaMonitorSource::setBackendProperty(const QString &name, const QVariant &value)
-{
- Q_UNUSED(name);
- Q_UNUSED(value);
- return false;
-}
-
-/*!
- \since 6.2
-
- Returns the value of the backend-specific property named \a name,
- if present. Otherwise the returned value will be invalid.
-
- \sa setBackendProperty()
-*/
-QVariant QGeoAreaMonitorSource::backendProperty(const QString &name) const
-{
- Q_UNUSED(name);
- return QVariant();
-}
-
-/*!
- Returns the current QGeoPositionInfoSource used by this QGeoAreaMonitorSource
- object. The function will return \l QGeoPositionInfoSource::createDefaultSource()
- if no other object has been set.
-
- The function returns \c nullptr if not even a default QGeoPositionInfoSource
- exists.
-
- Any usage of the returned \l QGeoPositionInfoSource instance should account
- for the fact that it may reside in a different thread.
-
- \sa QGeoPositionInfoSource, setPositionInfoSource()
-*/
-QGeoPositionInfoSource* QGeoAreaMonitorSource::positionInfoSource() const
-{
- Q_D(const QGeoAreaMonitorSource);
- return d->source;
-}
-
-/*!
- Sets the new \l QGeoPositionInfoSource to be used by this QGeoAreaMonitorSource object.
- The area monitoring backend becomes the new QObject parent for \a newSource.
- The previous \l QGeoPositionInfoSource object will be deleted. All QGeoAreaMonitorSource
- instances based on the same \l sourceName() share the same QGeoPositionInfoSource
- instance.
-
- This may be useful when it is desirable to manipulate the positioning system
- used by the area monitoring engine.
-
- Note that ownership must be taken care of by subclasses of QGeoAreaMonitorSource.
- Due to the singleton pattern behind this class \a newSource may be moved to a
- new thread.
-
- \sa positionInfoSource()
- */
-void QGeoAreaMonitorSource::setPositionInfoSource(QGeoPositionInfoSource *newSource)
-{
- Q_D(QGeoAreaMonitorSource);
- d->source = newSource;
-}
-
-
-/*!
- \fn virtual bool QGeoAreaMonitorSource::startMonitoring(const QGeoAreaMonitorInfo &monitor)
-
- Returns \c true if the monitoring of \a monitor could be successfully started; otherwise
- returns \c false. A reason for not being able to start monitoring could be the unavailability
- of an appropriate default position info source while no alternative QGeoPositionInfoSource
- has been set via \l setPositionInfoSource().
-
- If \a monitor is already active, the existing monitor object will be replaced by the new \a monitor reference.
- The identification of QGeoAreaMonitorInfo instances happens via \l QGeoAreaMonitorInfo::identifier().
- Therefore this function can also be used to update active monitors.
-
- If \a monitor has an expiry date that has been passed this function returns false. Calling
- this function for an already via \l requestUpdate() registered single shot monitor
- switches the monitor to a permanent monitoring mode.
-
- Requesting persistent monitoring on a QGeoAreaMonitorSource instance fails if the area monitoring
- backend doesn't support \l QGeoAreaMonitorSource::PersistentAreaMonitorFeature.
-
- \note Since Qt6 this method always resets the last error to
- \l {QGeoAreaMonitorSource::}{NoError} before starting monitoring.
-
- \sa stopMonitoring()
-*/
-
-/*!
- \fn virtual bool QGeoAreaMonitorSource::requestUpdate(const QGeoAreaMonitorInfo &monitor, const char *signal)
-
- Enables single shot area monitoring. Area monitoring for \a monitor will be performed
- until this QGeoAreaMonitorSource instance emits \a signal for the first time. Once
- the signal was emitted, \a monitor is automatically removed from the list of
- \l activeMonitors(). If \a monitor is invalid or has an expiry date that has
- been passed, this function returns \c false.
-
- \code
- QGeoAreaMonitor singleShotMonitor;
- QGeoAreaMonitorSource * source = QGeoAreaMonitorSource::createDefaultSource(this);
- //...
- bool ret = source->requestUpdate(singleShotMonitor,
- SIGNAL(areaExited(QGeoAreaMonitor,QGeoPositionInfo)));
- \endcode
-
- The above \c singleShotMonitor object will cease to send updates once the \l areaExited() signal
- was emitted for the first time. Until this point in time any other signal may be emitted
- zero or more times depending on the area context.
-
- It is not possible to simultanously request updates for more than one signal of the same monitor object.
- The last call to this function determines the signal upon which the updates cease to continue.
- At this stage only the \l areaEntered() and \l areaExited() signals can be used to
- terminate the monitoring process.
-
- Requesting persistent monitoring on a QGeoAreaMonitorSource instance fails if the area monitoring
- backend doesn't support \l QGeoAreaMonitorSource::PersistentAreaMonitorFeature.
-
- If \a monitor was already registered via \l startMonitoring() it is converted to a single
- shot behavior.
-
- \note Since Qt6 this method always resets the last error to
- \l {QGeoAreaMonitorSource::}{NoError} before starting monitoring.
-
- \sa startMonitoring(), stopMonitoring()
- */
-
-/*!
- \fn virtual bool QGeoAreaMonitorSource::stopMonitoring(const QGeoAreaMonitorInfo &monitor)
-
- Returns true if \a monitor was successfully removed from the list of \l activeMonitors();
- otherwise returns false. This behavior is independent on whether \a monitor was registered
- via \l startMonitoring() or \l requestUpdate().
-*/
-
-/*!
- \fn virtual QList<QGeoAreaMonitorInfo> QGeoAreaMonitorSource::activeMonitors() const
-
- Returns the list of all active monitors known to the QGeoAreaMonitorSource object.
-
- An active monitor was started via startMonitoring(). For every active
- monitor the source object will emit the required signals, such as
- areaEntered() or areaExited(). Multiple \l QGeoAreaMonitorSource instances
- within the same application share the same active monitor objects.
-
- Unless an active QGeoAreaMonitorInfo \l {QGeoAreaMonitorInfo::isPersistent()}{isPersistent()} an active QGeoAreaMonitorInfo
- will be stopped once the current application terminates.
-*/
-
-/*!
- \fn virtual QList<QGeoAreaMonitorInfo> QGeoAreaMonitorSource::activeMonitors(const QGeoShape &lookupArea) const
-
- Returns the list of all active monitors known to the QGeoAreaMonitorSource object whose
- center lies within \a lookupArea. If \a lookupArea is empty the returned list will be empty.
-
- An active monitor was started via startMonitoring(). For every active
- monitor the source object will emit the required signals, such as
- areaEntered() or areaExited(). Multiple \l QGeoAreaMonitorSource instances
- within the same application share the same active monitor objects.
-
- Unless an active QGeoAreaMonitorInfo \l {QGeoAreaMonitorInfo::isPersistent()}{isPersistent()} an active QGeoAreaMonitorInfo
- will be stopped once the current application terminates.
-
- \sa QGeoShape
-*/
-
-
-/*!
- \fn void QGeoAreaMonitorSource::monitorExpired(const QGeoAreaMonitorInfo &monitor)
-
- Emitted when \a monitor has expired. An expired area monitor is automatically
- removed from the list of \l activeMonitors().
-
- \sa activeMonitors()
-*/
-
-/*!
- \fn void QGeoAreaMonitorSource::areaEntered(const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update)
-
- Emitted when the current position has moved from a position outside of the active \a monitor
- to a position within the monitored area.
-
- The \a update holds the new position.
-*/
-
-/*!
- \fn void QGeoAreaMonitorSource::areaExited(const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update)
-
- Emitted when the current position has moved from a position within the active \a monitor
- to a position outside the monitored area.
-
- The \a update holds the new position.
-*/
-
-/*!
- \fn void QGeoAreaMonitorSource::errorOccurred(QGeoAreaMonitorSource::Error areaMonitoringError)
-
- This signal is emitted after an error occurred. The \a areaMonitoringError
- parameter describes the type of error that occurred.
-
-*/
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeoareamonitorsource.h b/src/positioning/qgeoareamonitorsource.h
deleted file mode 100644
index 803914b5..00000000
--- a/src/positioning/qgeoareamonitorsource.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QGEOAREAMONITORSOURCE_H
-#define QGEOAREAMONITORSOURCE_H
-
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoAreaMonitorInfo>
-#include <QtPositioning/QGeoPositionInfoSource>
-
-#include <QtCore/QObject>
-#include <QtCore/QStringList>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfo;
-class QGeoAreaMonitorSourcePrivate;
-class Q_POSITIONING_EXPORT QGeoAreaMonitorSource : public QObject
-{
- Q_OBJECT
-
-public:
- enum Error {
- AccessError = 0,
- InsufficientPositionInfo = 1,
- UnknownSourceError = 2,
- NoError = 3
- };
- Q_ENUMS(Error)
-
- enum AreaMonitorFeature {
- PersistentAreaMonitorFeature = 0x00000001,
- AnyAreaMonitorFeature = 0xffffffff
- };
- Q_DECLARE_FLAGS(AreaMonitorFeatures, AreaMonitorFeature)
-
- explicit QGeoAreaMonitorSource(QObject *parent);
- virtual ~QGeoAreaMonitorSource();
-
- static QGeoAreaMonitorSource *createDefaultSource(QObject *parent);
- static QGeoAreaMonitorSource *createSource(const QString& sourceName, QObject *parent);
- static QStringList availableSources();
-
- virtual void setPositionInfoSource(QGeoPositionInfoSource *source);
- virtual QGeoPositionInfoSource* positionInfoSource() const;
-
- QString sourceName() const;
-
- virtual Error error() const = 0;
- virtual AreaMonitorFeatures supportedAreaMonitorFeatures() const = 0;
-
- virtual bool startMonitoring(const QGeoAreaMonitorInfo &monitor) = 0;
- virtual bool stopMonitoring(const QGeoAreaMonitorInfo &monitor) = 0;
- virtual bool requestUpdate(const QGeoAreaMonitorInfo &monitor, const char *signal) = 0;
-
- virtual QList<QGeoAreaMonitorInfo> activeMonitors() const = 0;
- virtual QList<QGeoAreaMonitorInfo> activeMonitors(const QGeoShape &lookupArea) const = 0;
-
- virtual bool setBackendProperty(const QString &name, const QVariant &value);
- virtual QVariant backendProperty(const QString &name) const;
-
-Q_SIGNALS:
- void areaEntered(const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update);
- void areaExited(const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update);
- void monitorExpired(const QGeoAreaMonitorInfo &monitor);
- void errorOccurred(QGeoAreaMonitorSource::Error error);
-
-private:
- Q_DISABLE_COPY(QGeoAreaMonitorSource)
- Q_DECLARE_PRIVATE(QGeoAreaMonitorSource)
-};
-
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeocircle.cpp b/src/positioning/qgeocircle.cpp
deleted file mode 100644
index 094a7dcb..00000000
--- a/src/positioning/qgeocircle.cpp
+++ /dev/null
@@ -1,477 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeocircle.h"
-#include "qgeocircle_p.h"
-
-#include "qgeocoordinate.h"
-#include "qnumeric.h"
-#include "qlocationutils_p.h"
-
-#include "qdoublevector2d_p.h"
-#include "qdoublevector3d_p.h"
-#include <cmath>
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoCircle
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoCircle class defines a circular geographic area.
-
- The circle is defined in terms of a QGeoCoordinate which specifies the
- center of the circle and a qreal which specifies the radius of the circle
- in meters.
-
- The circle is considered invalid if the center coordinate is invalid
- or if the radius is less than zero.
-
- This class is a \l Q_GADGET since Qt 5.5. It can be
- \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
-*/
-
-/*!
- \property QGeoCircle::center
- \brief This property holds the center coordinate for the geo circle.
-
- The circle is considered invalid if this property contains an invalid
- coordinate.
-
- A default constructed QGeoCircle uses an invalid \l QGeoCoordinate
- as center.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoCircle::radius
- \brief This property holds the circle radius in meters.
-
- The circle is considered invalid if this property is negative.
-
- By default, the radius is initialized with \c -1.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-inline QGeoCirclePrivate *QGeoCircle::d_func()
-{
- return static_cast<QGeoCirclePrivate *>(d_ptr.data());
-}
-
-inline const QGeoCirclePrivate *QGeoCircle::d_func() const
-{
- return static_cast<const QGeoCirclePrivate *>(d_ptr.constData());
-}
-
-struct CircleVariantConversions
-{
- CircleVariantConversions()
- {
- QMetaType::registerConverter<QGeoShape, QGeoCircle>();
- QMetaType::registerConverter<QGeoCircle, QGeoShape>();
- }
-};
-
-Q_GLOBAL_STATIC(CircleVariantConversions, initCircleConversions)
-
-/*!
- Constructs a new, invalid geo circle.
-*/
-QGeoCircle::QGeoCircle()
-: QGeoShape(new QGeoCirclePrivate)
-{
- initCircleConversions();
-}
-
-/*!
- Constructs a new geo circle centered at \a center and with a radius of \a radius meters.
-*/
-QGeoCircle::QGeoCircle(const QGeoCoordinate &center, qreal radius)
-{
- initCircleConversions();
- d_ptr = new QGeoCirclePrivate(center, radius);
-}
-
-/*!
- Constructs a new geo circle from the contents of \a other.
-*/
-QGeoCircle::QGeoCircle(const QGeoCircle &other)
-: QGeoShape(other)
-{
- initCircleConversions();
-}
-
-/*!
- Constructs a new geo circle from the contents of \a other.
-*/
-QGeoCircle::QGeoCircle(const QGeoShape &other)
-: QGeoShape(other)
-{
- initCircleConversions();
- if (type() != QGeoShape::CircleType)
- d_ptr = new QGeoCirclePrivate;
-}
-
-/*!
- Destroys this geo circle.
-*/
-QGeoCircle::~QGeoCircle() {}
-
-/*!
- Assigns \a other to this geo circle and returns a reference to this geo circle.
-*/
-QGeoCircle &QGeoCircle::operator=(const QGeoCircle &other)
-{
- QGeoShape::operator=(other);
- return *this;
-}
-
-bool QGeoCirclePrivate::isValid() const
-{
- return m_center.isValid() && !qIsNaN(m_radius) && m_radius >= -1e-7;
-}
-
-bool QGeoCirclePrivate::isEmpty() const
-{
- return !isValid() || m_radius <= 1e-7;
-}
-
-/*!
- Sets the center coordinate of this geo circle to \a center.
-*/
-void QGeoCircle::setCenter(const QGeoCoordinate &center)
-{
- Q_D(QGeoCircle);
-
- d->setCenter(center);
-}
-
-/*!
- Returns the center coordinate of this geo circle. Equivalent to QGeoShape::center().
-*/
-QGeoCoordinate QGeoCircle::center() const
-{
- Q_D(const QGeoCircle);
-
- return d->center();
-}
-
-/*!
- Sets the radius in meters of this geo circle to \a radius.
-*/
-void QGeoCircle::setRadius(qreal radius)
-{
- Q_D(QGeoCircle);
-
- d->setRadius(radius);
-}
-
-/*!
- Returns the radius in meters of this geo circle.
-*/
-qreal QGeoCircle::radius() const
-{
- Q_D(const QGeoCircle);
-
- return d->m_radius;
-}
-
-bool QGeoCirclePrivate::contains(const QGeoCoordinate &coordinate) const
-{
- if (!isValid() || !coordinate.isValid())
- return false;
-
- // see QTBUG-41447 for details
- qreal distance = m_center.distanceTo(coordinate);
- if (qFuzzyCompare(distance, m_radius) || distance <= m_radius)
- return true;
-
- return false;
-}
-
-QGeoCoordinate QGeoCirclePrivate::center() const
-{
- return m_center;
-}
-
-QGeoRectangle QGeoCirclePrivate::boundingGeoRectangle() const
-{
- return m_bbox;
-}
-
-void QGeoCirclePrivate::updateBoundingBox()
-{
- if (isEmpty()) {
- if (m_center.isValid()) {
- m_bbox.setTopLeft(m_center);
- m_bbox.setBottomRight(m_center);
- }
- return;
- }
-
- bool crossNorth = crossNorthPole();
- bool crossSouth = crossSouthPole();
-
- if (crossNorth && crossSouth) {
- // Circle crossing both poles fills the whole map
- m_bbox = QGeoRectangle(QGeoCoordinate(90.0, -180.0), QGeoCoordinate(-90.0, 180.0));
- } else if (crossNorth) {
- // Circle crossing one pole fills the map in the longitudinal direction
- m_bbox = QGeoRectangle(QGeoCoordinate(90.0, -180.0), QGeoCoordinate(m_center.atDistanceAndAzimuth(m_radius, 180.0).latitude(), 180.0));
- } else if (crossSouth) {
- m_bbox = QGeoRectangle(QGeoCoordinate(m_center.atDistanceAndAzimuth(m_radius, 0.0).latitude(), -180.0), QGeoCoordinate(-90, 180.0));
- } else {
- // Regular circle not crossing anything
-
- // Calculate geo bounding box of the circle
- //
- // A circle tangential point with a meridian, together with pole and
- // the circle center create a spherical triangle.
- // Finding the tangential point with the spherical law of sines:
- //
- // * lon_delta_in_rad : delta between the circle center and a tangential
- // point (absolute value).
- // * r_in_rad : angular radius of the circle
- // * lat_in_rad : latitude of the circle center
- // * alpha_in_rad : angle between meridian and radius of the circle.
- // At the tangential point, sin(alpha_in_rad) == 1.
- // * lat_delta_in_rad - absolute delta of latitudes between the circle center and
- // any of the two points where the great circle going through the circle
- // center and the pole crosses the circle. In other words, the points
- // on the circle with azimuth 0 or 180.
- //
- // Using:
- // sin(lon_delta_in_rad)/sin(r_in_rad) = sin(alpha_in_rad)/sin(pi/2 - lat_in_rad)
-
- double r_in_rad = m_radius / QLocationUtils::earthMeanRadius(); // angular r
- double lat_delta_in_deg = QLocationUtils::degrees(r_in_rad);
- double lon_delta_in_deg = QLocationUtils::degrees(std::asin(
- std::sin(r_in_rad) /
- std::cos(QLocationUtils::radians(m_center.latitude()))
- ));
-
- QGeoCoordinate topLeft;
- topLeft.setLatitude(QLocationUtils::clipLat(m_center.latitude() + lat_delta_in_deg));
- topLeft.setLongitude(QLocationUtils::wrapLong(m_center.longitude() - lon_delta_in_deg));
- QGeoCoordinate bottomRight;
- bottomRight.setLatitude(QLocationUtils::clipLat(m_center.latitude() - lat_delta_in_deg));
- bottomRight.setLongitude(QLocationUtils::wrapLong(m_center.longitude() + lon_delta_in_deg));
-
- m_bbox = QGeoRectangle(topLeft, bottomRight);
- }
-}
-
-void QGeoCirclePrivate::setCenter(const QGeoCoordinate &c)
-{
- m_center = c;
- updateBoundingBox();
-}
-
-void QGeoCirclePrivate::setRadius(const qreal r)
-{
- m_radius = r;
- updateBoundingBox();
-}
-
-bool QGeoCirclePrivate::crossNorthPole() const
-{
- const QGeoCoordinate northPole(90.0, m_center.longitude());
- qreal distanceToPole = m_center.distanceTo(northPole);
- if (distanceToPole < m_radius)
- return true;
- return false;
-}
-
-bool QGeoCirclePrivate::crossSouthPole() const
-{
- const QGeoCoordinate southPole(-90.0, m_center.longitude());
- qreal distanceToPole = m_center.distanceTo(southPole);
- if (distanceToPole < m_radius)
- return true;
- return false;
-}
-
-/*
- Extends the circle to include \a coordinate.
-*/
-void QGeoCirclePrivate::extendCircle(const QGeoCoordinate &coordinate)
-{
- if (!isValid() || !coordinate.isValid() || contains(coordinate))
- return;
-
- setRadius(m_center.distanceTo(coordinate));
-}
-
-/*!
- Translates this geo circle by \a degreesLatitude northwards and \a degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-*/
-void QGeoCircle::translate(double degreesLatitude, double degreesLongitude)
-{
- // TODO handle dlat, dlon larger than 360 degrees
-
- Q_D(QGeoCircle);
-
- double lat = d->m_center.latitude();
- double lon = d->m_center.longitude();
-
- lat += degreesLatitude;
- lon += degreesLongitude;
- lon = QLocationUtils::wrapLong(lon);
-
- // TODO: remove this and simply clip latitude.
- if (lat > 90.0) {
- lat = 180.0 - lat;
- if (lon < 0.0)
- lon = 180.0;
- else
- lon -= 180;
- }
-
- if (lat < -90.0) {
- lat = 180.0 + lat;
- if (lon < 0.0)
- lon = 180.0;
- else
- lon -= 180;
- }
-
- d->setCenter(QGeoCoordinate(lat, lon));
-}
-
-/*!
- Returns a copy of this geo circle translated by \a degreesLatitude northwards and
- \a degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-
- \sa translate()
-*/
-QGeoCircle QGeoCircle::translated(double degreesLatitude, double degreesLongitude) const
-{
- QGeoCircle result(*this);
- result.translate(degreesLatitude, degreesLongitude);
- return result;
-}
-
-/*!
- Extends the geo circle to also cover the coordinate \a coordinate
-
- \since 5.9
-*/
-void QGeoCircle::extendCircle(const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoCircle);
- d->extendCircle(coordinate);
-}
-
-/*!
- Returns the geo circle properties as a string.
-
- \since 5.5
-*/
-
-QString QGeoCircle::toString() const
-{
- if (type() != QGeoShape::CircleType) {
- qWarning("Not a circle");
- return QStringLiteral("QGeoCircle(not a circle)");
- }
-
- return QStringLiteral("QGeoCircle({%1, %2}, %3)")
- .arg(center().latitude())
- .arg(center().longitude())
- .arg(radius());
-}
-
-/*******************************************************************************
-*******************************************************************************/
-
-QGeoCirclePrivate::QGeoCirclePrivate()
-: QGeoShapePrivate(QGeoShape::CircleType), m_radius(-1.0)
-{
-}
-
-QGeoCirclePrivate::QGeoCirclePrivate(const QGeoCoordinate &center, qreal radius)
-: QGeoShapePrivate(QGeoShape::CircleType), m_center(center), m_radius(radius)
-{
- updateBoundingBox();
-}
-
-QGeoCirclePrivate::QGeoCirclePrivate(const QGeoCirclePrivate &other)
-: QGeoShapePrivate(QGeoShape::CircleType), m_center(other.m_center),
- m_radius(other.m_radius), m_bbox(other.m_bbox)
-{
-}
-
-QGeoCirclePrivate::~QGeoCirclePrivate() {}
-
-QGeoShapePrivate *QGeoCirclePrivate::clone() const
-{
- return new QGeoCirclePrivate(*this);
-}
-
-bool QGeoCirclePrivate::operator==(const QGeoShapePrivate &other) const
-{
- if (!QGeoShapePrivate::operator==(other))
- return false;
-
- const QGeoCirclePrivate &otherCircle = static_cast<const QGeoCirclePrivate &>(other);
-
- return m_radius == otherCircle.m_radius && m_center == otherCircle.m_center;
-}
-
-size_t QGeoCirclePrivate::hash(size_t seed) const
-{
- return qHashMulti(seed, m_center, m_radius);
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeocircle.h b/src/positioning/qgeocircle.h
deleted file mode 100644
index e02ae4a9..00000000
--- a/src/positioning/qgeocircle.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOCIRCLE_H
-#define QGEOCIRCLE_H
-
-#include <QtPositioning/QGeoRectangle>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoCoordinate;
-class QGeoCirclePrivate;
-
-class Q_POSITIONING_EXPORT QGeoCircle : public QGeoShape
-{
- Q_GADGET
- Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter)
- Q_PROPERTY(qreal radius READ radius WRITE setRadius)
-
-public:
- QGeoCircle();
- QGeoCircle(const QGeoCoordinate &center, qreal radius = -1.0);
- QGeoCircle(const QGeoCircle &other);
- QGeoCircle(const QGeoShape &other);
-
- ~QGeoCircle();
-
- QGeoCircle &operator=(const QGeoCircle &other);
-
- void setCenter(const QGeoCoordinate &center);
- QGeoCoordinate center() const;
-
- void setRadius(qreal radius);
- qreal radius() const;
-
- Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
- Q_INVOKABLE QGeoCircle translated(double degreesLatitude, double degreesLongitude) const;
- Q_INVOKABLE void extendCircle(const QGeoCoordinate &coordinate);
-
- Q_INVOKABLE QString toString() const;
-
-private:
- inline QGeoCirclePrivate *d_func();
- inline const QGeoCirclePrivate *d_func() const;
-};
-
-Q_DECLARE_TYPEINFO(QGeoCircle, Q_RELOCATABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoCircle)
-
-#endif
-
diff --git a/src/positioning/qgeocircle_p.h b/src/positioning/qgeocircle_p.h
deleted file mode 100644
index 65f1d9d1..00000000
--- a/src/positioning/qgeocircle_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOCIRCLE_P_H
-#define QGEOCIRCLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qgeoshape_p.h"
-#include "qgeocoordinate.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGeoCirclePrivate : public QGeoShapePrivate
-{
-public:
- QGeoCirclePrivate();
- QGeoCirclePrivate(const QGeoCoordinate &center, qreal radius);
- QGeoCirclePrivate(const QGeoCirclePrivate &other);
- ~QGeoCirclePrivate();
-
- bool isValid() const override;
- bool isEmpty() const override;
- bool contains(const QGeoCoordinate &coordinate) const override;
-
- QGeoCoordinate center() const override;
-
- QGeoRectangle boundingGeoRectangle() const override;
-
- bool crossNorthPole() const;
- bool crossSouthPole() const;
- void updateBoundingBox();
- void setCenter(const QGeoCoordinate &c);
- void setRadius(const qreal r);
-
- void extendCircle(const QGeoCoordinate &coordinate);
-
- QGeoShapePrivate *clone() const override;
-
- bool operator==(const QGeoShapePrivate &other) const override;
-
- size_t hash(size_t seed) const override;
-
- QGeoCoordinate m_center;
- qreal m_radius;
- QGeoRectangle m_bbox;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeocoordinate.cpp b/src/positioning/qgeocoordinate.cpp
deleted file mode 100644
index 58c2ee15..00000000
--- a/src/positioning/qgeocoordinate.cpp
+++ /dev/null
@@ -1,792 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qgeocoordinate.h"
-#include "qgeocoordinate_p.h"
-#include "qlocationutils_p.h"
-
-#include <QDateTime>
-#include <QHash>
-#include <QDataStream>
-#include <QDebug>
-#include <QMetaType>
-#include <qnumeric.h>
-#include <qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-
-static const double qgeocoordinate_EARTH_MEAN_RADIUS = 6371.0072;
-
-
-QGeoCoordinatePrivate::QGeoCoordinatePrivate():
- lat(qQNaN()),
- lng(qQNaN()),
- alt(qQNaN())
-{}
-
-QGeoCoordinatePrivate::QGeoCoordinatePrivate(const QGeoCoordinatePrivate &other)
- : QSharedData(other),
- lat(other.lat),
- lng(other.lng),
- alt(other.alt)
-{}
-
-QGeoCoordinatePrivate::~QGeoCoordinatePrivate()
-{}
-
-
-QGeoMercatorCoordinatePrivate::QGeoMercatorCoordinatePrivate():
- QGeoCoordinatePrivate(),
- m_mercatorX(qQNaN()),
- m_mercatorY(qQNaN())
-{}
-
-QGeoMercatorCoordinatePrivate::QGeoMercatorCoordinatePrivate(const QGeoMercatorCoordinatePrivate &other)
- : QGeoCoordinatePrivate(other),
- m_mercatorX(other.m_mercatorX),
- m_mercatorY(other.m_mercatorY)
-{}
-
-QGeoMercatorCoordinatePrivate::~QGeoMercatorCoordinatePrivate()
-{}
-
-/*!
- \class QGeoCoordinate
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoCoordinate class defines a geographical position on the surface of the Earth.
-
- A QGeoCoordinate is defined by latitude, longitude, and optionally, altitude.
-
- Use type() to determine whether a coordinate is a 2D coordinate (has
- latitude and longitude only) or 3D coordinate (has latitude, longitude
- and altitude). Use distanceTo() and azimuthTo() to calculate the distance
- and bearing between coordinates.
-
- The coordinate values should be specified using the WGS84 datum. For more information
- on geographical terms see this article on \l {http://en.wikipedia.org/wiki/Geographic_coordinate_system}{coordinates} and
- another on \l {http://en.wikipedia.org/wiki/Geodetic_system}{geodetic systems}
- including WGS84.
-
- Azimuth in this context is equivalent to a compass bearing based on true north.
-
- This class is a \l Q_GADGET since Qt 5.5. It can be
- \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
-*/
-
-/*!
- \enum QGeoCoordinate::CoordinateType
- Defines the types of a coordinate.
-
- \value InvalidCoordinate An invalid coordinate. A coordinate is invalid if its latitude or longitude values are invalid.
- \value Coordinate2D A coordinate with valid latitude and longitude values.
- \value Coordinate3D A coordinate with valid latitude and longitude values, and also an altitude value.
-*/
-
-/*!
- \enum QGeoCoordinate::CoordinateFormat
- Defines the possible formatting options for toString().
-
- \value Degrees Returns a string representation of the coordinates in decimal degrees format.
- \value DegreesWithHemisphere Returns a string representation of the coordinates in decimal degrees format, using 'N', 'S', 'E' or 'W' to indicate the hemispheres of the coordinates.
- \value DegreesMinutes Returns a string representation of the coordinates in degrees-minutes format.
- \value DegreesMinutesWithHemisphere Returns a string representation of the coordinates in degrees-minutes format, using 'N', 'S', 'E' or 'W' to indicate the hemispheres of the coordinates.
- \value DegreesMinutesSeconds Returns a string representation of the coordinates in degrees-minutes-seconds format.
- \value DegreesMinutesSecondsWithHemisphere Returns a string representation of the coordinates in degrees-minutes-seconds format, using 'N', 'S', 'E' or 'W' to indicate the hemispheres of the coordinates.
-
- \sa toString()
-*/
-
-/*!
- \property QGeoCoordinate::latitude
- \brief This property holds the latitude in decimal degrees.
-
- The property is undefined (\l {qQNaN()}) if the latitude has not been set.
- A positive latitude indicates the Northern Hemisphere, and a negative
- latitude indicates the Southern Hemisphere. When setting the latitude the
- new value should be in the
- \l {http://en.wikipedia.org/wiki/World_Geodetic_System}{WGS84} datum format.
-
- To be valid, the latitude must be between -90 to 90 inclusive.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoCoordinate::longitude
- \brief This property holds the longitude in decimal degrees.
-
- The property is undefined (\l {qQNaN()}) if the longitude has not been set.
- A positive longitude indicates the Eastern Hemisphere, and a negative
- longitude indicates the Western Hemisphere. When setting the longitude the
- new value should be in the
- \l {http://en.wikipedia.org/wiki/World_Geodetic_System}{WGS84} datum format.
-
- To be valid, the longitude must be between -180 to 180 inclusive.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoCoordinate::altitude
- \brief This property holds the altitude in meters above sea level.
-
- The property is undefined (\l {qQNaN()}) if the altitude has not been set.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoCoordinate::isValid
- \brief This property holds the validity of this geo coordinate.
-
- The geo coordinate is valid if the \l [CPP]{longitude} and \l [CPP]{latitude}
- properties have been set to valid values.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- Constructs a coordinate. The coordinate will be invalid until
- setLatitude() and setLongitude() have been called.
-*/
-QGeoCoordinate::QGeoCoordinate()
- : d(new QGeoCoordinatePrivate)
-{
-}
-
-/*!
- Constructs a coordinate with the given \a latitude and \a longitude.
-
- If the latitude is not between -90 to 90 inclusive, or the longitude
- is not between -180 to 180 inclusive, none of the values are set and
- the type() will be QGeoCoordinate::InvalidCoordinate.
-
- \sa isValid()
-*/
-QGeoCoordinate::QGeoCoordinate(double latitude, double longitude)
- : d(new QGeoCoordinatePrivate)
-{
- if (QLocationUtils::isValidLat(latitude) && QLocationUtils::isValidLong(longitude)) {
- d->lat = latitude;
- d->lng = longitude;
- }
-}
-
-/*!
- Constructs a coordinate with the given \a latitude, \a longitude
- and \a altitude.
-
- If the latitude is not between -90 to 90 inclusive, or the longitude
- is not between -180 to 180 inclusive, none of the values are set and
- the type() will be QGeoCoordinate::InvalidCoordinate.
-
- Note that \a altitude specifies the meters above sea level.
-
- \sa isValid()
-*/
-QGeoCoordinate::QGeoCoordinate(double latitude, double longitude, double altitude)
- : d(new QGeoCoordinatePrivate)
-{
- if (QLocationUtils::isValidLat(latitude) && QLocationUtils::isValidLong(longitude)) {
- d->lat = latitude;
- d->lng = longitude;
- d->alt = altitude;
- }
-}
-
-/*!
- Constructs a coordinate from the contents of \a other.
-*/
-QGeoCoordinate::QGeoCoordinate(const QGeoCoordinate &other)
- : d(other.d)
-{}
-
-/*!
- \fn QGeoCoordinate::QGeoCoordinate(QGeoCoordinate &&other)
- \since 6.2
-
- Constructs a coordinate by moving from \a other.
-
- \note The moved-from QGeoCoordinate object can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- Assigns \a other to this coordinate and returns a reference to this coordinate.
-*/
-QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinate &other)
-{
- if (this == &other)
- return *this;
-
- d = other.d;
- return (*this);
-}
-
-/*!
- \fn QGeoCoordinate &QGeoCoordinate::operator=(QGeoCoordinate &&other)
- \since 6.2
-
- Move-assigns \a other to this coordinate and returns a reference to this
- coordinate.
-
- \note The moved-from QGeoCoordinate object can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- Destroys the coordinate object.
-*/
-QGeoCoordinate::~QGeoCoordinate()
-{
-}
-
-QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoCoordinatePrivate)
-
-/*!
- \fn bool QGeoCoordinate::operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
-
- Returns \c true if the latitude, longitude and altitude of the \a lhs
- coordinate are the same as those of the \a rhs coordinate. Otherwise
- returns \c false.
-
- The longitude will be ignored if the latitude is +/- 90 degrees.
-*/
-
-/*!
- \fn bool QGeoCoordinate::operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
-
- Returns \c true if latitude, longitude, or altitude of the \a lhs
- coordinate are not identical to those of the \a rhs coordinate. Otherwise
- returns \c false.
-*/
-
-/*!
- Returns \c true if the \l longitude and \l latitude are valid.
-*/
-bool QGeoCoordinate::isValid() const
-{
- CoordinateType t = type();
- return t == Coordinate2D || t == Coordinate3D;
-}
-
-/*!
- Returns the type of this coordinate.
-*/
-QGeoCoordinate::CoordinateType QGeoCoordinate::type() const
-{
- if (QLocationUtils::isValidLat(d->lat)
- && QLocationUtils::isValidLong(d->lng)) {
- if (qIsNaN(d->alt))
- return Coordinate2D;
- return Coordinate3D;
- }
- return InvalidCoordinate;
-}
-
-
-/*!
- Returns the latitude, in decimal degrees. The return value is undefined
- if the latitude has not been set.
-
- A positive latitude indicates the Northern Hemisphere, and a negative
- latitude indicates the Southern Hemisphere.
-
- \sa setLatitude(), type()
-*/
-double QGeoCoordinate::latitude() const
-{
- return d->lat;
-}
-
-/*!
- Sets the latitude (in decimal degrees) to \a latitude. The value should
- be in the WGS84 datum.
-
- To be valid, the latitude must be between -90 to 90 inclusive.
-
- \sa latitude()
-*/
-void QGeoCoordinate::setLatitude(double latitude)
-{
- d->lat = latitude;
-}
-
-/*!
- Returns the longitude, in decimal degrees. The return value is undefined
- if the longitude has not been set.
-
- A positive longitude indicates the Eastern Hemisphere, and a negative
- longitude indicates the Western Hemisphere.
-
- \sa setLongitude(), type()
-*/
-double QGeoCoordinate::longitude() const
-{
- return d->lng;
-}
-
-/*!
- Sets the longitude (in decimal degrees) to \a longitude. The value should
- be in the WGS84 datum.
-
- To be valid, the longitude must be between -180 to 180 inclusive.
-
- \sa longitude()
-*/
-void QGeoCoordinate::setLongitude(double longitude)
-{
- d->lng = longitude;
-}
-
-/*!
- Returns the altitude (meters above sea level).
-
- The return value is undefined if the altitude has not been set.
-
- \sa setAltitude(), type()
-*/
-double QGeoCoordinate::altitude() const
-{
- return d->alt;
-}
-
-/*!
- Sets the altitude (meters above sea level) to \a altitude.
-
- \sa altitude()
-*/
-void QGeoCoordinate::setAltitude(double altitude)
-{
- d->alt = altitude;
-}
-
-/*!
- Returns the distance (in meters) from this coordinate to the coordinate
- specified by \a other. Altitude is not used in the calculation.
-
- This calculation returns the great-circle distance between the two
- coordinates, with an assumption that the Earth is spherical for the
- purpose of this calculation.
-
- Returns 0 if the type of this coordinate or the type of \a other is
- QGeoCoordinate::InvalidCoordinate.
-*/
-qreal QGeoCoordinate::distanceTo(const QGeoCoordinate &other) const
-{
- if (type() == QGeoCoordinate::InvalidCoordinate
- || other.type() == QGeoCoordinate::InvalidCoordinate) {
- return 0;
- }
-
- // Haversine formula
- double dlat = qDegreesToRadians(other.d->lat - d->lat);
- double dlon = qDegreesToRadians(other.d->lng - d->lng);
- double haversine_dlat = sin(dlat / 2.0);
- haversine_dlat *= haversine_dlat;
- double haversine_dlon = sin(dlon / 2.0);
- haversine_dlon *= haversine_dlon;
- double y = haversine_dlat
- + cos(qDegreesToRadians(d->lat))
- * cos(qDegreesToRadians(other.d->lat))
- * haversine_dlon;
- double x = 2 * asin(sqrt(y));
- return qreal(x * qgeocoordinate_EARTH_MEAN_RADIUS * 1000);
-}
-
-/*!
- Returns the azimuth (or bearing) in degrees from this coordinate to the
- coordinate specified by \a other. Altitude is not used in the calculation.
-
- The bearing returned is the bearing from the origin to \a other along the
- great-circle between the two coordinates. There is an assumption that the
- Earth is spherical for the purpose of this calculation.
-
- Returns 0 if the type of this coordinate or the type of \a other is
- QGeoCoordinate::InvalidCoordinate.
-*/
-qreal QGeoCoordinate::azimuthTo(const QGeoCoordinate &other) const
-{
- if (type() == QGeoCoordinate::InvalidCoordinate
- || other.type() == QGeoCoordinate::InvalidCoordinate) {
- return 0;
- }
-
- double dlon = qDegreesToRadians(other.d->lng - d->lng);
- double lat1Rad = qDegreesToRadians(d->lat);
- double lat2Rad = qDegreesToRadians(other.d->lat);
-
- double y = sin(dlon) * cos(lat2Rad);
- double x = cos(lat1Rad) * sin(lat2Rad) - sin(lat1Rad) * cos(lat2Rad) * cos(dlon);
-
- double azimuth = qRadiansToDegrees(atan2(y, x)) + 360.0;
- double whole;
- double fraction = modf(azimuth, &whole);
- return qreal((int(whole + 360) % 360) + fraction);
-}
-
-void QGeoCoordinatePrivate::atDistanceAndAzimuth(const QGeoCoordinate &coord,
- qreal distance, qreal azimuth,
- double *lon, double *lat)
-{
- double latRad = qDegreesToRadians(coord.d->lat);
- double lonRad = qDegreesToRadians(coord.d->lng);
- double cosLatRad = cos(latRad);
- double sinLatRad = sin(latRad);
-
- double azimuthRad = qDegreesToRadians(azimuth);
-
- double ratio = (distance / (qgeocoordinate_EARTH_MEAN_RADIUS * 1000.0));
- double cosRatio = cos(ratio);
- double sinRatio = sin(ratio);
-
- double resultLatRad = asin(sinLatRad * cosRatio
- + cosLatRad * sinRatio * cos(azimuthRad));
- double resultLonRad = lonRad + atan2(sin(azimuthRad) * sinRatio * cosLatRad,
- cosRatio - sinLatRad * sin(resultLatRad));
-
- *lat = qRadiansToDegrees(resultLatRad);
- *lon = qRadiansToDegrees(resultLonRad);
-}
-
-/*!
- Returns the coordinate that is reached by traveling \a distance meters
- from the current coordinate at \a azimuth (or bearing) along a great-circle.
- There is an assumption that the Earth is spherical for the purpose of this
- calculation.
-
- The altitude will have \a distanceUp added to it.
-
- Returns an invalid coordinate if this coordinate is invalid.
-*/
-QGeoCoordinate QGeoCoordinate::atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp) const
-{
- if (!isValid())
- return QGeoCoordinate();
-
- double resultLon, resultLat;
- QGeoCoordinatePrivate::atDistanceAndAzimuth(*this, distance, azimuth,
- &resultLon, &resultLat);
- double resultAlt = d->alt + distanceUp;
- return QGeoCoordinate(resultLat, QLocationUtils::wrapLong(resultLon), resultAlt);
-}
-
-/*!
- Returns this coordinate as a string in the specified \a format.
-
- For example, if this coordinate has a latitude of -27.46758, a longitude
- of 153.027892 and an altitude of 28.1, these are the strings
- returned depending on \a format:
-
- \table
- \header
- \li \a format value
- \li Returned string
- \row
- \li \l Degrees
- \li -27.46758\unicode{0xB0}, 153.02789\unicode{0xB0}, 28.1m
- \row
- \li \l DegreesWithHemisphere
- \li 27.46758\unicode{0xB0} S, 153.02789\unicode{0xB0} E, 28.1m
- \row
- \li \l DegreesMinutes
- \li -27\unicode{0xB0} 28.054', 153\unicode{0xB0} 1.673', 28.1m
- \row
- \li \l DegreesMinutesWithHemisphere
- \li 27\unicode{0xB0} 28.054 S', 153\unicode{0xB0} 1.673' E, 28.1m
- \row
- \li \l DegreesMinutesSeconds
- \li -27\unicode{0xB0} 28' 3.2", 153\unicode{0xB0} 1' 40.4", 28.1m
- \row
- \li \l DegreesMinutesSecondsWithHemisphere
- \li 27\unicode{0xB0} 28' 3.2" S, 153\unicode{0xB0} 1' 40.4" E, 28.1m
- \endtable
-
- The altitude field is omitted if no altitude is set.
-
- If the coordinate is invalid, an empty string is returned.
-*/
-QString QGeoCoordinate::toString(CoordinateFormat format) const
-{
- if (type() == QGeoCoordinate::InvalidCoordinate)
- return QString();
-
- QString latStr;
- QString longStr;
-
- double absLat = qAbs(d->lat);
- double absLng = qAbs(d->lng);
- QChar symbol(0x00B0); // degrees symbol
-
- switch (format) {
- case Degrees:
- case DegreesWithHemisphere: {
- latStr = QString::number(absLat, 'f', 5) + symbol;
- longStr = QString::number(absLng, 'f', 5) + symbol;
- break;
- }
- case DegreesMinutes:
- case DegreesMinutesWithHemisphere: {
- double latMin = (absLat - int(absLat)) * 60;
- double lngMin = (absLng - int(absLng)) * 60;
-
- // We use QString::number(val, 'f', 3) to represent minutes.
- // It rounds up to the next integer in case the fraction > 0.9995.
- // Such behavior should be handled specifically when the rounded
- // value is 60, so that we overflow to degrees correctly.
- // If we overflow, the minutes should unconditionally be 0.0.
- if (latMin > 59.9995) {
- absLat++;
- latMin = 0.0f;
- }
- if (lngMin > 59.9995) {
- absLng++;
- lngMin = 0.0f;
- }
-
- latStr = QString::fromLatin1("%1%2 %3'")
- .arg(QString::number(int(absLat)))
- .arg(symbol)
- .arg(QString::number(latMin, 'f', 3));
- longStr = QString::fromLatin1("%1%2 %3'")
- .arg(QString::number(int(absLng)))
- .arg(symbol)
- .arg(QString::number(lngMin, 'f', 3));
- break;
- }
- case DegreesMinutesSeconds:
- case DegreesMinutesSecondsWithHemisphere: {
- double latMin = (absLat - int(absLat)) * 60;
- double lngMin = (absLng - int(absLng)) * 60;
- double latSec = (latMin - int(latMin)) * 60;
- double lngSec = (lngMin - int(lngMin)) * 60;
-
- // We use QString::number(val, 'f', 1) to represent seconds.
- // It rounds up to the next integer in case the fraction >= 0.95.
- // Such behavior should be handled specifically when the rounded
- // value is 60, so that we overflow to minutes correctly.
- // If we overflow, the seconds should unconditionally be 0.0.
- if (latSec >= 59.95) {
- latMin++;
- latSec = 0.0f;
- // We cast to int to represent minutes, so we can use qRound()
- // to determine if we need to overflow to full degrees.
- // If we overflow, the minutes will unconditionally be 0.0.
- if (qRound(latMin) >= 60) {
- absLat++;
- latMin = 0.0f;
- }
- }
- if (lngSec >= 59.95) {
- lngMin++;
- lngSec = 0.0f;
- if (qRound(lngMin) >= 60) {
- absLng++;
- lngMin = 0.0f;
- }
- }
-
- latStr = QString::fromLatin1("%1%2 %3' %4\"")
- .arg(QString::number(int(absLat)))
- .arg(symbol)
- .arg(QString::number(int(latMin)))
- .arg(QString::number(latSec, 'f', 1));
- longStr = QString::fromLatin1("%1%2 %3' %4\"")
- .arg(QString::number(int(absLng)))
- .arg(symbol)
- .arg(QString::number(int(lngMin)))
- .arg(QString::number(lngSec, 'f', 1));
- break;
- }
- }
-
- // now add the "-" to the start, or append the hemisphere char
- switch (format) {
- case Degrees:
- case DegreesMinutes:
- case DegreesMinutesSeconds: {
- if (d->lat < 0)
- latStr.insert(0, QStringLiteral("-"));
- if (d->lng < 0)
- longStr.insert(0, QStringLiteral("-"));
- break;
- }
- case DegreesWithHemisphere:
- case DegreesMinutesWithHemisphere:
- case DegreesMinutesSecondsWithHemisphere: {
- if (d->lat < 0)
- latStr.append(QString::fromLatin1(" S"));
- else if (d->lat > 0)
- latStr.append(QString::fromLatin1(" N"));
- if (d->lng < 0)
- longStr.append(QString::fromLatin1(" W"));
- else if (d->lng > 0)
- longStr.append(QString::fromLatin1(" E"));
- break;
- }
- }
-
- if (qIsNaN(d->alt))
- return QString::fromLatin1("%1, %2").arg(latStr, longStr);
- return QString::fromLatin1("%1, %2, %3m").arg(latStr, longStr, QString::number(d->alt));
-}
-
-bool QGeoCoordinate::equals(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
-{
- bool latEqual = (qIsNaN(lhs.d->lat) && qIsNaN(rhs.d->lat))
- || qFuzzyCompare(lhs.d->lat, rhs.d->lat);
- bool lngEqual = (qIsNaN(lhs.d->lng) && qIsNaN(rhs.d->lng))
- || qFuzzyCompare(lhs.d->lng, rhs.d->lng);
- bool altEqual = (qIsNaN(lhs.d->alt) && qIsNaN(rhs.d->alt))
- || qFuzzyCompare(lhs.d->alt, rhs.d->alt);
-
- if (!qIsNaN(lhs.d->lat) && ((lhs.d->lat == 90.0) || (lhs.d->lat == -90.0)))
- lngEqual = true;
-
- return (latEqual && lngEqual && altEqual);
-}
-
-QGeoCoordinate::QGeoCoordinate(QGeoCoordinatePrivate &dd):
- d(&dd)
-{
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug QGeoCoordinate::debugStreaming(QDebug dbg, const QGeoCoordinate &coord)
-{
- QDebugStateSaver saver(dbg);
- double lat = coord.latitude();
- double lng = coord.longitude();
-
- QTextStreamManipulator tsm = qSetRealNumberPrecision(11);
- dbg << tsm;
- dbg.nospace() << "QGeoCoordinate(";
- if (qIsNaN(lat))
- dbg << '?';
- else
- dbg << lat;
- dbg << ", ";
- if (qIsNaN(lng))
- dbg << '?';
- else
- dbg << lng;
- if (coord.type() == QGeoCoordinate::Coordinate3D) {
- dbg << ", ";
- dbg << coord.altitude();
- }
- dbg << ')';
- return dbg;
-}
-#endif
-
-#ifndef QT_NO_DATASTREAM
-/*!
- \fn QDataStream &QGeoCoordinate::operator<<(QDataStream &stream, const QGeoCoordinate &coordinate)
-
- Writes the given \a coordinate to the specified \a stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &QGeoCoordinate::dataStreamOut(QDataStream &stream, const QGeoCoordinate &coordinate)
-{
- stream << coordinate.latitude();
- stream << coordinate.longitude();
- stream << coordinate.altitude();
- return stream;
-}
-#endif
-
-#ifndef QT_NO_DATASTREAM
-/*!
- \fn QDataStream &QGeoCoordinate::operator>>(QDataStream &stream, QGeoCoordinate &coordinate)
-
- Reads a coordinate from the specified \a stream into the given
- \a coordinate.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &QGeoCoordinate::dataStreamIn(QDataStream &stream, QGeoCoordinate &coordinate)
-{
- double value;
- stream >> value;
- coordinate.setLatitude(value);
- stream >> value;
- coordinate.setLongitude(value);
- stream >> value;
- coordinate.setAltitude(value);
- return stream;
-}
-#endif
-
-/*! \fn size_t qHash(const QGeoCoordinate &coordinate, size_t seed = 0)
- \relates QHash
-
- Returns a hash value for \a coordinate, using \a seed to seed the calculation.
-*/
-size_t qHash(const QGeoCoordinate &coordinate, size_t seed)
-{
- QtPrivate::QHashCombine hash;
- // north and south pole are geographically equivalent (no matter the longitude)
- if (coordinate.latitude() != 90.0 && coordinate.latitude() != -90.0)
- seed = hash(seed, coordinate.longitude());
- seed = hash(seed, coordinate.latitude());
- seed = hash(seed, coordinate.altitude());
- return seed;
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeocoordinate.h b/src/positioning/qgeocoordinate.h
deleted file mode 100644
index 46a539a2..00000000
--- a/src/positioning/qgeocoordinate.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOCOORDINATE_H
-#define QGEOCOORDINATE_H
-
-#include <QtCore/QMetaType>
-#include <QtCore/QString>
-#include <QtCore/QSharedDataPointer>
-#include <QtCore/QDebug>
-#include <QtPositioning/qpositioningglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDebug;
-class QDataStream;
-
-class QGeoCoordinatePrivate;
-QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoCoordinatePrivate, Q_POSITIONING_EXPORT)
-
-class Q_POSITIONING_EXPORT QGeoCoordinate
-{
- Q_GADGET
- Q_ENUMS(CoordinateFormat)
-
- Q_PROPERTY(double latitude READ latitude WRITE setLatitude)
- Q_PROPERTY(double longitude READ longitude WRITE setLongitude)
- Q_PROPERTY(double altitude READ altitude WRITE setAltitude)
- Q_PROPERTY(bool isValid READ isValid)
-
-public:
-
- enum CoordinateType {
- InvalidCoordinate,
- Coordinate2D,
- Coordinate3D
- };
-
- enum CoordinateFormat {
- Degrees,
- DegreesWithHemisphere,
- DegreesMinutes,
- DegreesMinutesWithHemisphere,
- DegreesMinutesSeconds,
- DegreesMinutesSecondsWithHemisphere
- };
-
- QGeoCoordinate();
- QGeoCoordinate(double latitude, double longitude);
- QGeoCoordinate(double latitude, double longitude, double altitude);
- QGeoCoordinate(const QGeoCoordinate &other);
- QGeoCoordinate(QGeoCoordinate &&other) noexcept = default;
- ~QGeoCoordinate();
-
- QGeoCoordinate &operator=(const QGeoCoordinate &other);
- QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoCoordinate)
-
- void swap(QGeoCoordinate &other) noexcept { d.swap(other.d); }
-
- friend bool operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- bool isValid() const;
- CoordinateType type() const;
-
- void setLatitude(double latitude);
- double latitude() const;
-
- void setLongitude(double longitude);
- double longitude() const;
-
- void setAltitude(double altitude);
- double altitude() const;
-
- Q_INVOKABLE qreal distanceTo(const QGeoCoordinate &other) const;
- Q_INVOKABLE qreal azimuthTo(const QGeoCoordinate &other) const;
-
- Q_INVOKABLE QGeoCoordinate atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp = 0.0) const;
-
- Q_INVOKABLE QString toString(CoordinateFormat format = DegreesMinutesSecondsWithHemisphere) const;
-
-private:
- static bool equals(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs);
- QGeoCoordinate(QGeoCoordinatePrivate &dd);
- QSharedDataPointer<QGeoCoordinatePrivate> d;
- friend class QGeoCoordinatePrivate;
- friend class QQuickGeoCoordinateAnimation;
-#ifndef QT_NO_DEBUG_STREAM
- friend QDebug operator<<(QDebug dbg, const QGeoCoordinate &coord)
- {
- return debugStreaming(dbg, coord);
- }
- static QDebug debugStreaming(QDebug dbg, const QGeoCoordinate &coord);
-#endif
-#ifndef QT_NO_DATASTREAM
- friend QDataStream &operator<<(QDataStream &stream, const QGeoCoordinate &coordinate)
- {
- return dataStreamOut(stream, coordinate);
- }
- friend QDataStream &operator>>(QDataStream &stream, QGeoCoordinate &coordinate)
- {
- return dataStreamIn(stream, coordinate);
- }
- static QDataStream &dataStreamOut(QDataStream &stream, const QGeoCoordinate &coordinate);
- static QDataStream &dataStreamIn(QDataStream &stream, QGeoCoordinate &coordinate);
-#endif
-};
-
-Q_DECLARE_SHARED(QGeoCoordinate)
-
-
-Q_POSITIONING_EXPORT size_t qHash(const QGeoCoordinate &coordinate, size_t seed = 0);
-
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoCoordinate)
-
-#endif
diff --git a/src/positioning/qgeocoordinate_p.h b/src/positioning/qgeocoordinate_p.h
deleted file mode 100644
index e00cbfa0..00000000
--- a/src/positioning/qgeocoordinate_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOCOORDINATE_P_H
-#define QGEOCOORDINATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QSharedData>
-#include "qgeocoordinate.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGeoCoordinatePrivate : public QSharedData
-{
-public:
- QGeoCoordinatePrivate();
- QGeoCoordinatePrivate(const QGeoCoordinatePrivate &other);
- ~QGeoCoordinatePrivate();
-
- double lat;
- double lng;
- double alt;
-
- static void atDistanceAndAzimuth(const QGeoCoordinate &coord,
- qreal distance, qreal azimuth,
- double *lon, double *lat);
- static const QGeoCoordinatePrivate *get(const QGeoCoordinate *c) {
- return c->d.constData();
- }
-};
-
-class Q_POSITIONING_EXPORT QGeoMercatorCoordinatePrivate : public QGeoCoordinatePrivate
-{
-public:
- QGeoMercatorCoordinatePrivate();
- QGeoMercatorCoordinatePrivate(const QGeoMercatorCoordinatePrivate &other);
- ~QGeoMercatorCoordinatePrivate();
-
- double m_mercatorX;
- double m_mercatorY;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QGEOCOORDINATE_P_H
diff --git a/src/positioning/qgeocoordinateobject.cpp b/src/positioning/qgeocoordinateobject.cpp
deleted file mode 100644
index af79470e..00000000
--- a/src/positioning/qgeocoordinateobject.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeocoordinateobject_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*
-
- Note: This class only purpose is to enable conversion between QGeoCoordinate and QDeclarativeGeoWaypoint.
- Since QGeoCoordinate lives in the QtPositioning module, this class acts as a base for QDeclarativeGeoWaypoint,
- and contains the bare minimum to convert/compare to a QGeoCoordinate
-
-*/
-
-QGeoCoordinateObject::QGeoCoordinateObject(QObject *parent) : QObject(parent)
-{
-}
-
-QGeoCoordinateObject::QGeoCoordinateObject(const QGeoCoordinate &c, QObject *parent) : QObject(parent)
-{
- setCoordinate(c);
-}
-
-QGeoCoordinateObject::~QGeoCoordinateObject()
-{
-
-}
-
-bool QGeoCoordinateObject::operator==(const QGeoCoordinateObject &other) const
-{
- return m_coordinate.value() == other.m_coordinate.value();
-}
-
-bool QGeoCoordinateObject::operator==(const QGeoCoordinate &other) const
-{
- return m_coordinate.value() == other;
-}
-
-QGeoCoordinate QGeoCoordinateObject::coordinate() const
-{
- return m_coordinate;
-}
-
-void QGeoCoordinateObject::setCoordinate(const QGeoCoordinate &c)
-{
- m_coordinate = c; // The signal is emitted automatically if needed
-}
-
-QBindable<QGeoCoordinate> QGeoCoordinateObject::bindableCoordinate()
-{
- return QBindable<QGeoCoordinate>(&m_coordinate);
-}
-
-QT_END_NAMESPACE
-
-
diff --git a/src/positioning/qgeocoordinateobject_p.h b/src/positioning/qgeocoordinateobject_p.h
deleted file mode 100644
index 65d47fe5..00000000
--- a/src/positioning/qgeocoordinateobject_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOCOORDINATEOBJECT_P_H
-#define QGEOCOORDINATEOBJECT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include <QObject>
-#include <QGeoCoordinate>
-#include <QVariantMap>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONING_PRIVATE_EXPORT QGeoCoordinateObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY
- coordinateChanged BINDABLE bindableCoordinate)
-
-public:
- QGeoCoordinateObject(QObject *parent = 0);
- QGeoCoordinateObject(const QGeoCoordinate &c, QObject *parent = 0);
- virtual ~QGeoCoordinateObject();
-
- bool operator==(const QGeoCoordinate &other) const;
- bool operator==(const QGeoCoordinateObject &other) const;
- inline bool operator!=(const QGeoCoordinate &other) const {
- return !operator==(other);
- }
- inline bool operator!=(const QGeoCoordinateObject &other) const {
- return !operator==(other);
- }
-
- QGeoCoordinate coordinate() const;
- void setCoordinate(const QGeoCoordinate &c);
- QBindable<QGeoCoordinate> bindableCoordinate();
-
-Q_SIGNALS:
- void coordinateChanged();
-
-protected:
- Q_OBJECT_BINDABLE_PROPERTY(QGeoCoordinateObject, QGeoCoordinate, m_coordinate,
- &QGeoCoordinateObject::coordinateChanged)
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoCoordinateObject*)
-
-#endif // QGEOCOORDINATEOBJECT_P_H
diff --git a/src/positioning/qgeolocation.cpp b/src/positioning/qgeolocation.cpp
deleted file mode 100644
index a7c86f1f..00000000
--- a/src/positioning/qgeolocation.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeolocation.h"
-#include "qgeolocation_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QGeoLocationPrivate::QGeoLocationPrivate()
- : QSharedData()
-{
-}
-
-QGeoLocationPrivate::QGeoLocationPrivate(const QGeoLocationPrivate &other)
- : QSharedData()
-{
- this->address = other.address;
- this->coordinate = other.coordinate;
- this->viewport = other.viewport;
- this->extendedAttributes = other.extendedAttributes;
-}
-
-QGeoLocationPrivate::~QGeoLocationPrivate()
-{
-}
-
-bool QGeoLocationPrivate::operator==(const QGeoLocationPrivate &other) const
-{
- return (this->address == other.address
- && this->coordinate == other.coordinate
- && this->viewport == other.viewport
- && this->extendedAttributes == other.extendedAttributes);
-
-}
-
-bool QGeoLocationPrivate::isEmpty() const
-{
- return (address.isEmpty()
- && !coordinate.isValid()
- && viewport.isEmpty()
- && extendedAttributes.isEmpty());
-}
-
-/*!
- \class QGeoLocation
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \ingroup QtLocation-places
- \ingroup QtLocation-places-data
- \since 5.2
-
- \brief The QGeoLocation class represents basic information about a location.
-
- A QGeoLocation consists of a coordinate and corresponding address, along with an optional
- bounding shape, which is the recommended region to be displayed when viewing the location.
-*/
-
-/*!
- Constructs an new location object.
-*/
-QGeoLocation::QGeoLocation()
- : d(new QGeoLocationPrivate)
-{
-}
-
-/*!
- Constructs a copy of \a other
-*/
-QGeoLocation::QGeoLocation(const QGeoLocation &other)
- :d(other.d)
-{
-}
-
-/*!
- \fn QGeoLocation::QGeoLocation(QGeoLocation &&other)
- \since 6.2
-
- Constructs a geo location object by moving from \a other.
-
- \note The moved-from QGeoLocation object can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- Destroys the location object.
-*/
-QGeoLocation::~QGeoLocation()
-{
-}
-
-QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoLocationPrivate)
-
-/*!
- Assigns \a other to this location and returns a reference to this location.
-*/
-QGeoLocation &QGeoLocation::operator =(const QGeoLocation &other)
-{
- if (this == &other)
- return *this;
-
- d = other.d;
- return *this;
-}
-
-/*!
- \fn QGeoLocation &QGeoLocation::operator=(QGeoLocation &&other)
- \since 6.2
-
- Move-assings \a other to this location and returns a reference to this
- location.
-
- \note The moved-from QGeoLocation object can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- \fn bool QGeoLocation::operator==(const QGeoLocation &lhs, const QGeoLocation &rhs)
-
- Returns \c true if the \a lhs location is equal to \a rhs, otherwise
- returns \c false.
-*/
-
-/*!
- \fn bool QGeoLocation::operator!=(const QGeoLocation &lhs, const QGeoLocation &rhs)
-
- Returns \c true if the \a lhs location is not equal to \a rhs, otherwise
- returns \c false.
-*/
-
-/*!
- Returns the address of the location.
-*/
-QGeoAddress QGeoLocation::address() const
-{
- return d->address;
-}
-
-/*!
- Sets the \a address of the location.
-*/
-void QGeoLocation::setAddress(const QGeoAddress &address)
-{
- d->address = address;
-}
-
-/*!
- Returns the coordinate of the location.
-*/
-QGeoCoordinate QGeoLocation::coordinate() const
-{
- return d->coordinate;
-}
-
-/*!
- Sets the \a coordinate of the location.
-*/
-void QGeoLocation::setCoordinate(const QGeoCoordinate &coordinate)
-{
- d->coordinate = coordinate;
-}
-
-/*!
- \since 6.2
-
- Returns a bounding shape which represents the recommended region
- to display when viewing this location.
-
- For example, a building's location may have a region centered around the
- building, but the region is large enough to show it's immediate surrounding
- geographical context.
-
- \note This method was introduced in Qt6 instead of boundingBox() method.
- It returns a QGeoShape instead of a QGeoRectangle.
- Use \l QGeoShape::boundingGeoRectangle() to obtain a bounding QGeoRectangle
- for the shape.
-*/
-QGeoShape QGeoLocation::boundingShape() const
-{
- return d->viewport;
-}
-
-/*!
- \since 6.2
-
- Sets the \a boundingShape of the location.
-*/
-void QGeoLocation::setBoundingShape(const QGeoShape &boundingShape)
-{
- d->viewport = boundingShape;
-}
-
-/*!
- Returns the extended attributes associated to this location.
- Extended attributes are backend-dependent and can be location-dependent.
-
- \since 5.13
-*/
-QVariantMap QGeoLocation::extendedAttributes() const
-{
- return d->extendedAttributes;
-}
-
-/*!
- Sets the extended attributes of the location with the
- parameters specified in \a data.
-
- \since 5.13
-*/
-void QGeoLocation::setExtendedAttributes(const QVariantMap &data)
-{
- d->extendedAttributes = data;
-}
-
-/*!
- Returns \c true if the location coordinate is \l {QGeoCoordinate::isValid}
- {invalid}, and all the other location fields are empty. Otherwise returns
- \c false.
-*/
-bool QGeoLocation::isEmpty() const
-{
- return d->isEmpty();
-}
-
-bool QGeoLocation::equals(const QGeoLocation &lhs, const QGeoLocation &rhs)
-{
- return (*(lhs.d.constData()) == *(rhs.d.constData()));
-}
-
-/*!
- \relates QGeoLocation
-
- Returns the hash value for the \a location, using \a seed for the
- calculation.
-
- \note The hash does not take extended attributes into account. This means
- that two geo location objects that differ only in the extended attributes
- will provide similar hashes.
-*/
-size_t qHash(const QGeoLocation &location, size_t seed) noexcept
-{
- return qHashMulti(seed, location.coordinate(), location.boundingShape(), location.address());
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeolocation.h b/src/positioning/qgeolocation.h
deleted file mode 100644
index 3fe20986..00000000
--- a/src/positioning/qgeolocation.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOLOCATION_H
-#define QGEOLOCATION_H
-
-#include <QtCore/QSharedDataPointer>
-#include <QtCore/QMetaType>
-#include <QtPositioning/qpositioningglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoAddress;
-class QGeoCoordinate;
-class QGeoShape;
-class QGeoLocationPrivate;
-QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoLocationPrivate, Q_POSITIONING_EXPORT)
-
-class Q_POSITIONING_EXPORT QGeoLocation
-{
-public:
- QGeoLocation();
- QGeoLocation(const QGeoLocation &other);
- QGeoLocation(QGeoLocation &&other) noexcept = default;
- ~QGeoLocation();
-
- QGeoLocation &operator=(const QGeoLocation &other);
- QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoLocation)
-
- void swap(QGeoLocation &other) noexcept { d.swap(other.d); }
-
- friend bool operator==(const QGeoLocation &lhs, const QGeoLocation &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoLocation &lhs, const QGeoLocation &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- QGeoAddress address() const;
- void setAddress(const QGeoAddress &address);
- QGeoCoordinate coordinate() const;
- void setCoordinate(const QGeoCoordinate &position);
- QGeoShape boundingShape() const;
- void setBoundingShape(const QGeoShape &shape);
- QVariantMap extendedAttributes() const;
- void setExtendedAttributes(const QVariantMap &data);
-
- bool isEmpty() const;
-
-private:
- static bool equals(const QGeoLocation &lhs, const QGeoLocation &rhs);
- QSharedDataPointer<QGeoLocationPrivate> d;
-};
-
-Q_POSITIONING_EXPORT size_t qHash(const QGeoLocation &location, size_t seed = 0) noexcept;
-
-Q_DECLARE_SHARED(QGeoLocation)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoLocation)
-
-#endif
diff --git a/src/positioning/qgeolocation_p.h b/src/positioning/qgeolocation_p.h
deleted file mode 100644
index f402afe2..00000000
--- a/src/positioning/qgeolocation_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOLOCATION_P_H
-#define QGEOLOCATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QSharedData>
-#include <QtPositioning/QGeoAddress>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoShape>
-#include <QVariantMap>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoLocationPrivate : public QSharedData
-{
-public:
- QGeoLocationPrivate();
- QGeoLocationPrivate(const QGeoLocationPrivate &other);
-
- ~QGeoLocationPrivate();
-
- bool operator==(const QGeoLocationPrivate &other) const;
-
- bool isEmpty() const;
-
- QGeoAddress address;
- QGeoCoordinate coordinate;
- QGeoShape viewport;
- QVariantMap extendedAttributes;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp
deleted file mode 100644
index 4d6b1af2..00000000
--- a/src/positioning/qgeopath.cpp
+++ /dev/null
@@ -1,774 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeopath.h"
-#include "qgeopolygon.h"
-#include "qgeopath_p.h"
-
-#include "qgeocoordinate.h"
-#include "qnumeric.h"
-#include "qlocationutils_p.h"
-#include "qwebmercator_p.h"
-
-#include "qdoublevector2d_p.h"
-#include "qdoublevector3d_p.h"
-QT_BEGIN_NAMESPACE
-
-constexpr int kMaxInt = std::numeric_limits<int>::max();
-constexpr auto kWarningString = u"The path has more elements than fit into an int. "
- "This can cause errors while querying elements from QML";
-
-/*!
- \class QGeoPath
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.9
-
- \brief The QGeoPath class defines a geographic path.
-
- The path is defined by an ordered list of \l QGeoCoordinate objects.
-
- Each two adjacent elements in the path are intended to be connected
- together by the shortest line segment of constant bearing passing
- through both elements.
- This type of connection can cross the dateline in the longitudinal direction,
- but never crosses the poles.
-
- This is relevant for the calculation of the bounding box returned by
- \l QGeoShape::boundingGeoRectangle() for this shape, which will have the latitude of
- the top left corner set to the maximum latitude in the path point set.
- Similarly, the latitude of the bottom right corner will be the minimum latitude
- in the path point set.
-
- This class is a \l Q_GADGET.
- It can be \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
-
- A QGeoPath is both invalid and empty if it contains no coordinate.
-
- \note A default constructed QGeoPath is both invalid and empty as it does not contain any coordinates.
-*/
-
-/*!
- \property QGeoPath::path
- \brief This property holds the list of coordinates for the geo path.
-
- \note The coordinates cannot be processed in place. To change the value
- of this property, retrieve the complete list of coordinates, process them,
- and assign the new value to the property.
-*/
-
-inline QGeoPathPrivate *QGeoPath::d_func()
-{
- return static_cast<QGeoPathPrivate *>(d_ptr.data());
-}
-
-inline const QGeoPathPrivate *QGeoPath::d_func() const
-{
- return static_cast<const QGeoPathPrivate *>(d_ptr.constData());
-}
-
-struct PathVariantConversions
-{
- PathVariantConversions()
- {
- QMetaType::registerConverter<QGeoShape, QGeoPath>();
- QMetaType::registerConverter<QGeoPath, QGeoShape>();
- }
-};
-
-Q_GLOBAL_STATIC(PathVariantConversions, initPathConversions)
-
-/*!
- Constructs a new, empty geo path.
-*/
-QGeoPath::QGeoPath()
-: QGeoShape(new QGeoPathPrivate())
-{
- initPathConversions();
-}
-
-/*!
- Constructs a new geo path from a list of coordinates
- (\a path and \a width).
-*/
-QGeoPath::QGeoPath(const QList<QGeoCoordinate> &path, const qreal &width)
-: QGeoShape(new QGeoPathPrivate(path, width))
-{
- initPathConversions();
-}
-
-/*!
- Constructs a new geo path from the contents of \a other.
-*/
-QGeoPath::QGeoPath(const QGeoPath &other)
-: QGeoShape(other)
-{
- initPathConversions();
-}
-
-/*!
- Constructs a new geo path from the contents of \a other.
-*/
-QGeoPath::QGeoPath(const QGeoShape &other)
-: QGeoShape(other)
-{
- initPathConversions();
- if (type() != QGeoShape::PathType)
- d_ptr = new QGeoPathPrivate();
-}
-
-/*!
- Destroys this path.
-*/
-QGeoPath::~QGeoPath() {}
-
-/*!
- Assigns \a other to this geo path and returns a reference to this geo path.
-*/
-QGeoPath &QGeoPath::operator=(const QGeoPath &other)
-{
- QGeoShape::operator=(other);
- return *this;
-}
-
-/*!
- Sets all the elements of the \a path.
-*/
-void QGeoPath::setPath(const QList<QGeoCoordinate> &path)
-{
- Q_D(QGeoPath);
- return d->setPath(path);
-}
-
-/*!
- Returns all the elements of the path.
-*/
-const QList<QGeoCoordinate> &QGeoPath::path() const
-{
- Q_D(const QGeoPath);
- return d->path();
-}
-
-/*!
- Clears the path.
-
- \since 5.12
-*/
-void QGeoPath::clearPath()
-{
- Q_D(QGeoPath);
- d->clearPath();
-}
-
-/*!
- Sets all the elements of the path.
-
- \internal
-*/
-void QGeoPath::setVariantPath(const QVariantList &path)
-{
- Q_D(QGeoPath);
- QList<QGeoCoordinate> p;
- for (const auto &c: path) {
- if (c.canConvert<QGeoCoordinate>())
- p << c.value<QGeoCoordinate>();
- }
- d->setPath(p);
-}
-/*!
- Returns all the elements of the path.
-
- \internal
-*/
-QVariantList QGeoPath::variantPath() const
-{
- Q_D(const QGeoPath);
- QVariantList p;
- for (const auto &c: d->path())
- p << QVariant::fromValue(c);
- return p;
-}
-
-
-/*!
- \property QGeoPath::width
-
- \brief the width of the path in meters.
-*/
-void QGeoPath::setWidth(const qreal &width)
-{
- Q_D(QGeoPath);
- d->setWidth(width);
-}
-
-/*!
- Returns the width of the path, in meters. This information is used in the \l contains method.
- The default value is 0.
-*/
-qreal QGeoPath::width() const
-{
- Q_D(const QGeoPath);
- return d->width();
-}
-
-/*!
- Translates this geo path by \a degreesLatitude northwards and \a degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-*/
-void QGeoPath::translate(double degreesLatitude, double degreesLongitude)
-{
- Q_D(QGeoPath);
- d->translate(degreesLatitude, degreesLongitude);
-}
-
-/*!
- Returns a copy of this geo path translated by \a degreesLatitude northwards and
- \a degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-
- \sa translate()
-*/
-QGeoPath QGeoPath::translated(double degreesLatitude, double degreesLongitude) const
-{
- QGeoPath result(*this);
- result.translate(degreesLatitude, degreesLongitude);
- return result;
-}
-
-/*!
- Returns the length of the path, in meters, from the element \a indexFrom to the element \a indexTo.
- The length is intended to be the sum of the shortest distances for each pair of adjacent points.
-
- If \a indexTo is -1 (the default value), the length will be including the distance between last coordinate
- and the first (closed loop).
- To retrieve the length for the path, use 0 for \a indexFrom and \l QGeoPath::size() - 1 for \a indexTo.
-*/
-double QGeoPath::length(qsizetype indexFrom, qsizetype indexTo) const
-{
- Q_D(const QGeoPath);
- return d->length(indexFrom, indexTo);
-}
-
-/*!
- Returns the number of elements in the path.
-
- \since 5.10
-*/
-qsizetype QGeoPath::size() const
-{
- Q_D(const QGeoPath);
- const qsizetype result = d->size();
- if (result > kMaxInt)
- qWarning() << kWarningString;
- return result;
-}
-
-/*!
- Appends \a coordinate to the path.
-*/
-void QGeoPath::addCoordinate(const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPath);
- d->addCoordinate(coordinate);
- if (d->size() > kMaxInt)
- qWarning() << kWarningString;
-}
-
-/*!
- Inserts \a coordinate at the specified \a index.
-*/
-void QGeoPath::insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPath);
- d->insertCoordinate(index, coordinate);
-}
-
-/*!
- Replaces the path element at the specified \a index with \a coordinate.
-*/
-void QGeoPath::replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPath);
- d->replaceCoordinate(index, coordinate);
-}
-
-/*!
- Returns the coordinate at \a index .
-*/
-QGeoCoordinate QGeoPath::coordinateAt(qsizetype index) const
-{
- Q_D(const QGeoPath);
- return d->coordinateAt(index);
-}
-
-/*!
- Returns true if the path contains \a coordinate as one of the elements.
-*/
-bool QGeoPath::containsCoordinate(const QGeoCoordinate &coordinate) const
-{
- Q_D(const QGeoPath);
- return d->containsCoordinate(coordinate);
-}
-
-/*!
- Removes the last occurrence of \a coordinate from the path.
-*/
-void QGeoPath::removeCoordinate(const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPath);
- d->removeCoordinate(coordinate);
-}
-
-/*!
- Removes element at position \a index from the path.
-*/
-void QGeoPath::removeCoordinate(qsizetype index)
-{
- Q_D(QGeoPath);
- d->removeCoordinate(index);
-}
-
-/*!
- Returns the geo path properties as a string.
-*/
-QString QGeoPath::toString() const
-{
- if (type() != QGeoShape::PathType) {
- qWarning("Not a path");
- return QStringLiteral("QGeoPath(not a path)");
- }
-
- QString pathString;
- for (const auto &p : path())
- pathString += p.toString() + QLatin1Char(',');
-
- return QStringLiteral("QGeoPath([ %1 ])").arg(pathString);
-}
-
-/*******************************************************************************
- *
- * QGeoPathPrivate & friends
- *
-*******************************************************************************/
-
-QGeoPathPrivate::QGeoPathPrivate()
-: QGeoShapePrivate(QGeoShape::PathType)
-{
-
-}
-
-QGeoPathPrivate::QGeoPathPrivate(const QList<QGeoCoordinate> &path, const qreal width)
-: QGeoShapePrivate(QGeoShape::PathType)
-{
- setPath(path);
- setWidth(width);
-}
-
-QGeoPathPrivate::~QGeoPathPrivate()
-{
-
-}
-
-QGeoShapePrivate *QGeoPathPrivate::clone() const
-{
- return new QGeoPathPrivate(*this);
-}
-
-bool QGeoPathPrivate::isValid() const
-{
- return !isEmpty();
-}
-
-bool QGeoPathPrivate::isEmpty() const
-{
- return path().isEmpty(); // this should perhaps return geometric emptiness, less than 2 points for line, or empty polygon for polygons
-}
-
-QGeoCoordinate QGeoPathPrivate::center() const
-{
- return boundingGeoRectangle().center();
-}
-
-bool QGeoPathPrivate::operator==(const QGeoShapePrivate &other) const
-{
- if (!QGeoShapePrivate::operator==(other))
- return false;
-
- const QGeoPathPrivate &otherPath = static_cast<const QGeoPathPrivate &>(other);
- if (m_path.size() != otherPath.m_path.size())
- return false;
- return m_width == otherPath.m_width && m_path == otherPath.m_path;
-}
-
-const QList<QGeoCoordinate> &QGeoPathPrivate::path() const
-{
- return m_path;
-}
-
-bool QGeoPathPrivate::lineContains(const QGeoCoordinate &coordinate) const
-{
- // Unoptimized approach:
- // - consider each segment of the path
- // - project it into mercator space (rhumb lines are straight in mercator space)
- // - find closest point to coordinate
- // - unproject the closest point
- // - calculate coordinate to closest point distance with distanceTo()
- // - if not within lineRadius, advance
- //
- // To keep wrapping into the equation:
- // If the mercator x value of a coordinate of the line, or the coordinate parameter, is less
- // than mercator(m_bbox).x, add that to the conversion.
-
- if (m_bboxDirty)
- const_cast<QGeoPathPrivate &>(*this).computeBoundingBox();
-
- double lineRadius = qMax(width() * 0.5, 0.2); // minimum radius: 20cm
-
- if (!m_path.size())
- return false;
- else if (m_path.size() == 1)
- return (m_path[0].distanceTo(coordinate) <= lineRadius);
-
- QDoubleVector2D p = QWebMercator::coordToMercator(coordinate);
- if (p.x() < m_leftBoundWrapped)
- p.setX(p.x() + m_leftBoundWrapped); // unwrap X
-
- QDoubleVector2D a;
- QDoubleVector2D b;
- if (m_path.size()) {
- a = QWebMercator::coordToMercator(m_path[0]);
- if (a.x() < m_leftBoundWrapped)
- a.setX(a.x() + m_leftBoundWrapped); // unwrap X
- }
- for (qsizetype i = 1; i < m_path.size(); i++) {
- b = QWebMercator::coordToMercator(m_path[i]);
- if (b.x() < m_leftBoundWrapped)
- b.setX(b.x() + m_leftBoundWrapped); // unwrap X
- if (b == a)
- continue;
-
- double u = ((p.x() - a.x()) * (b.x() - a.x()) + (p.y() - a.y()) * (b.y() - a.y()) ) / (b - a).lengthSquared();
- QDoubleVector2D intersection(a.x() + u * (b.x() - a.x()) , a.y() + u * (b.y() - a.y()) );
-
- QDoubleVector2D candidate = ( (p-a).length() < (p-b).length() ) ? a : b;
-
- if (u > 0 && u < 1
- && (p-intersection).length() < (p-candidate).length() ) // And it falls in the segment
- candidate = intersection;
-
-
- if (candidate.x() > 1.0)
- candidate.setX(candidate.x() - m_leftBoundWrapped); // wrap X
-
- QGeoCoordinate closest = QWebMercator::mercatorToCoord(candidate);
-
- double distanceMeters = coordinate.distanceTo(closest);
- if (distanceMeters <= lineRadius)
- return true;
-
- // swap
- a = b;
- }
-
- // Last check if the coordinate is on the left of leftBoundMercator, but close enough to
- // m_path[0]
- return (m_path[0].distanceTo(coordinate) <= lineRadius);
-}
-
-bool QGeoPathPrivate::contains(const QGeoCoordinate &coordinate) const
-{
- return lineContains(coordinate);
-}
-
-qreal QGeoPathPrivate::width() const
-{
- return m_width;
-}
-
-void QGeoPathPrivate::setWidth(const qreal &width)
-{
- if (qIsNaN(width) || width < 0.0)
- return;
- m_width = width;
-}
-
-double QGeoPathPrivate::length(qsizetype indexFrom, qsizetype indexTo) const
-{
- if (path().isEmpty())
- return 0.0;
-
- bool wrap = indexTo == -1;
- if (indexTo < 0 || indexTo >= path().size())
- indexTo = path().size() - 1;
- double len = 0.0;
- // TODO: consider calculating the length of the actual rhumb line segments
- // instead of the shortest path from A to B.
- for (qsizetype i = indexFrom; i < indexTo; i++)
- len += m_path[i].distanceTo(m_path[i+1]);
- if (wrap)
- len += m_path.last().distanceTo(m_path.first());
- return len;
-}
-
-qsizetype QGeoPathPrivate::size() const
-{
- return m_path.size();
-}
-
-QGeoCoordinate QGeoPathPrivate::coordinateAt(qsizetype index) const
-{
- if (index < 0 || index >= m_path.size())
- return QGeoCoordinate();
-
- return m_path.at(index);
-}
-
-bool QGeoPathPrivate::containsCoordinate(const QGeoCoordinate &coordinate) const
-{
- return m_path.indexOf(coordinate) > -1;
-}
-
-void QGeoPathPrivate::translate(double degreesLatitude, double degreesLongitude)
-{
- // Need min/maxLati, so update bbox
- QList<double> m_deltaXs;
- double m_minX, m_maxX, m_minLati, m_maxLati;
- m_bboxDirty = false;
- computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
-
- if (degreesLatitude > 0.0)
- degreesLatitude = qMin(degreesLatitude, 90.0 - m_maxLati);
- else
- degreesLatitude = qMax(degreesLatitude, -90.0 - m_minLati);
- for (QGeoCoordinate &p: m_path) {
- p.setLatitude(p.latitude() + degreesLatitude);
- p.setLongitude(QLocationUtils::wrapLong(p.longitude() + degreesLongitude));
- }
- m_bbox.translate(degreesLatitude, degreesLongitude);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
-}
-
-QGeoRectangle QGeoPathPrivate::boundingGeoRectangle() const
-{
- if (m_bboxDirty)
- const_cast<QGeoPathPrivate &>(*this).computeBoundingBox();
- return m_bbox;
-}
-
-size_t QGeoPathPrivate::hash(size_t seed) const
-{
- const size_t res = qHashRange(m_path.cbegin(), m_path.cend(), seed);
- return qHashMulti(seed, res, m_width);
-}
-
-void QGeoPathPrivate::setPath(const QList<QGeoCoordinate> &path)
-{
- for (const QGeoCoordinate &c: path)
- if (!c.isValid())
- return;
- m_path = path;
- markDirty();
-}
-
-void QGeoPathPrivate::clearPath()
-{
- m_path.clear();
- markDirty();
-}
-
-void QGeoPathPrivate::addCoordinate(const QGeoCoordinate &coordinate)
-{
- if (!coordinate.isValid())
- return;
- m_path.append(coordinate);
- markDirty();
-}
-
-void QGeoPathPrivate::insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
-{
- if (index < 0 || index > m_path.size() || !coordinate.isValid())
- return;
- m_path.insert(index, coordinate);
- markDirty();
-}
-
-void QGeoPathPrivate::replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
-{
- if (index < 0 || index >= m_path.size() || !coordinate.isValid())
- return;
- m_path[index] = coordinate;
- markDirty();
-}
-
-void QGeoPathPrivate::removeCoordinate(const QGeoCoordinate &coordinate)
-{
- qsizetype index = m_path.lastIndexOf(coordinate);
- removeCoordinate(index);
-}
-
-void QGeoPathPrivate::removeCoordinate(qsizetype index)
-{
- if (index < 0 || index >= m_path.size())
- return;
- m_path.removeAt(index);
- markDirty();
-}
-
-void QGeoPathPrivate::markDirty()
-{
- m_bboxDirty = true;
-}
-
-void QGeoPathPrivate::computeBoundingBox()
-{
- QList<double> m_deltaXs;
- double m_minX, m_maxX, m_minLati, m_maxLati;
- m_bboxDirty = false;
- computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
-}
-
-QGeoPathPrivateEager::QGeoPathPrivateEager()
-: QGeoPathPrivate()
-{
- m_bboxDirty = false; // never dirty on the eager version
-}
-
-QGeoPathPrivateEager::QGeoPathPrivateEager(const QList<QGeoCoordinate> &path, const qreal width)
-: QGeoPathPrivate(path, width)
-{
- m_bboxDirty = false; // never dirty on the eager version
-}
-
-QGeoPathPrivateEager::~QGeoPathPrivateEager()
-{
-
-}
-
-QGeoShapePrivate *QGeoPathPrivateEager::clone() const
-{
- return new QGeoPathPrivateEager(*this);
-}
-
-void QGeoPathPrivateEager::markDirty()
-{
- computeBoundingBox();
-}
-
-void QGeoPathPrivateEager::translate(double degreesLatitude, double degreesLongitude)
-{
- if (degreesLatitude > 0.0)
- degreesLatitude = qMin(degreesLatitude, 90.0 - m_maxLati);
- else
- degreesLatitude = qMax(degreesLatitude, -90.0 - m_minLati);
- for (QGeoCoordinate &p: m_path) {
- p.setLatitude(p.latitude() + degreesLatitude);
- p.setLongitude(QLocationUtils::wrapLong(p.longitude() + degreesLongitude));
- }
- m_bbox.translate(degreesLatitude, degreesLongitude);
- m_minLati += degreesLatitude;
- m_maxLati += degreesLatitude;
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
-}
-
-void QGeoPathPrivateEager::addCoordinate(const QGeoCoordinate &coordinate)
-{
- if (!coordinate.isValid())
- return;
- m_path.append(coordinate);
- //m_clipperDirty = true; // clipper not used in polylines
- updateBoundingBox();
-}
-
-void QGeoPathPrivateEager::QGeoPathPrivateEager::computeBoundingBox()
-{
- computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
-}
-
-void QGeoPathPrivateEager::QGeoPathPrivateEager::updateBoundingBox()
-{
- updateBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
-}
-
-QGeoPathEager::QGeoPathEager() : QGeoPath()
-{
- initPathConversions();
- d_ptr = new QGeoPathPrivateEager;
-}
-
-QGeoPathEager::QGeoPathEager(const QList<QGeoCoordinate> &path, const qreal &width) : QGeoPath()
-{
- initPathConversions();
- d_ptr = new QGeoPathPrivateEager(path, width);
-}
-
-QGeoPathEager::QGeoPathEager(const QGeoPath &other) : QGeoPath()
-{
- initPathConversions();
- d_ptr = new QGeoPathPrivateEager;
- setPath(other.path());
- setWidth(other.width());
-}
-
-QGeoPathEager::QGeoPathEager(const QGeoShape &other) : QGeoPath()
-{
- initPathConversions();
- if (other.type() == QGeoShape::PathType)
- *this = QGeoPathEager(QGeoPath(other));
- else
- d_ptr = new QGeoPathPrivateEager;
-}
-
-QGeoPathEager::~QGeoPathEager() {}
-
-QT_END_NAMESPACE
-
-
-
-
-
-
-
-
diff --git a/src/positioning/qgeopath.h b/src/positioning/qgeopath.h
deleted file mode 100644
index 581b453c..00000000
--- a/src/positioning/qgeopath.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPATH_H
-#define QGEOPATH_H
-
-#include <QtPositioning/QGeoShape>
-#include <QtCore/QVariantList>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoCoordinate;
-class QGeoPathPrivate;
-
-class Q_POSITIONING_EXPORT QGeoPath : public QGeoShape
-{
- Q_GADGET
- Q_PROPERTY(QVariantList path READ variantPath WRITE setVariantPath)
- Q_PROPERTY(qreal width READ width WRITE setWidth)
-
-public:
- QGeoPath();
- QGeoPath(const QList<QGeoCoordinate> &path, const qreal &width = 0.0);
- QGeoPath(const QGeoPath &other);
- QGeoPath(const QGeoShape &other);
-
- ~QGeoPath();
-
- QGeoPath &operator=(const QGeoPath &other);
-
- void setPath(const QList<QGeoCoordinate> &path);
- const QList<QGeoCoordinate> &path() const;
- void clearPath();
- void setVariantPath(const QVariantList &path);
- QVariantList variantPath() const;
-
- void setWidth(const qreal &width);
- qreal width() const;
-
- Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
- Q_INVOKABLE QGeoPath translated(double degreesLatitude, double degreesLongitude) const;
- Q_INVOKABLE double length(qsizetype indexFrom = 0, qsizetype indexTo = -1) const;
- Q_INVOKABLE qsizetype size() const;
- Q_INVOKABLE void addCoordinate(const QGeoCoordinate &coordinate);
- Q_INVOKABLE void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate);
- Q_INVOKABLE void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate);
- Q_INVOKABLE QGeoCoordinate coordinateAt(qsizetype index) const;
- Q_INVOKABLE bool containsCoordinate(const QGeoCoordinate &coordinate) const;
- Q_INVOKABLE void removeCoordinate(const QGeoCoordinate &coordinate);
- Q_INVOKABLE void removeCoordinate(qsizetype index);
-
- Q_INVOKABLE QString toString() const;
-
-private:
- inline QGeoPathPrivate *d_func();
- inline const QGeoPathPrivate *d_func() const;
-};
-
-Q_DECLARE_TYPEINFO(QGeoPath, Q_RELOCATABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoPath)
-
-#endif // QGEOPATH_H
diff --git a/src/positioning/qgeopath_p.h b/src/positioning/qgeopath_p.h
deleted file mode 100644
index 64abb621..00000000
--- a/src/positioning/qgeopath_p.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPATH_P_H
-#define QGEOPATH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include "qgeoshape_p.h"
-#include "qgeocoordinate.h"
-#include "qlocationutils_p.h"
-#include <QtPositioning/qgeopath.h>
-#include <QtCore/QList>
-
-QT_BEGIN_NAMESPACE
-
-inline static void computeBBox(const QList<QGeoCoordinate> &m_path, QList<double> &m_deltaXs,
- double &m_minX, double &m_maxX, double &m_minLati, double &m_maxLati,
- QGeoRectangle &m_bbox)
-{
- if (m_path.isEmpty()) {
- m_deltaXs.clear();
- m_minX = qInf();
- m_maxX = -qInf();
- m_minLati = qInf();
- m_maxLati = -qInf();
- m_bbox = QGeoRectangle();
- return;
- }
-
- m_minLati = m_maxLati = m_path.at(0).latitude();
- qsizetype minId = 0;
- qsizetype maxId = 0;
- m_deltaXs.resize(m_path.size());
- m_deltaXs[0] = m_minX = m_maxX = 0.0;
-
- for (qsizetype i = 1; i < m_path.size(); i++) {
- const QGeoCoordinate &geoFrom = m_path.at(i-1);
- const QGeoCoordinate &geoTo = m_path.at(i);
- double longiFrom = geoFrom.longitude();
- double longiTo = geoTo.longitude();
- double deltaLongi = longiTo - longiFrom;
- if (qAbs(deltaLongi) > 180.0) {
- if (longiTo > 0.0)
- longiTo -= 360.0;
- else
- longiTo += 360.0;
- deltaLongi = longiTo - longiFrom;
- }
- m_deltaXs[i] = m_deltaXs[i-1] + deltaLongi;
- if (m_deltaXs[i] < m_minX) {
- m_minX = m_deltaXs[i];
- minId = i;
- }
- if (m_deltaXs[i] > m_maxX) {
- m_maxX = m_deltaXs[i];
- maxId = i;
- }
- if (geoTo.latitude() > m_maxLati)
- m_maxLati = geoTo.latitude();
- if (geoTo.latitude() < m_minLati)
- m_minLati = geoTo.latitude();
- }
-
- m_bbox = QGeoRectangle(QGeoCoordinate(m_maxLati, m_path.at(minId).longitude()),
- QGeoCoordinate(m_minLati, m_path.at(maxId).longitude()));
-}
-
-inline static void updateBBox(const QList<QGeoCoordinate> &m_path, QList<double> &m_deltaXs,
- double &m_minX, double &m_maxX, double &m_minLati, double &m_maxLati,
- QGeoRectangle &m_bbox)
-{
- if (m_path.isEmpty()) {
- m_deltaXs.clear();
- m_minX = qInf();
- m_maxX = -qInf();
- m_minLati = qInf();
- m_maxLati = -qInf();
- m_bbox = QGeoRectangle();
- return;
- } else if (m_path.size() == 1) { // was 0 now is 1
- m_deltaXs.resize(1);
- m_deltaXs[0] = m_minX = m_maxX = 0.0;
- m_minLati = m_maxLati = m_path.at(0).latitude();
- m_bbox = QGeoRectangle(QGeoCoordinate(m_maxLati, m_path.at(0).longitude()),
- QGeoCoordinate(m_minLati, m_path.at(0).longitude()));
- return;
- } else if ( m_path.size() != m_deltaXs.size() + 1 ) { // this case should not happen
- computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox); // something went wrong
- return;
- }
-
- const QGeoCoordinate &geoFrom = m_path.at(m_path.size()-2);
- const QGeoCoordinate &geoTo = m_path.last();
- double longiFrom = geoFrom.longitude();
- double longiTo = geoTo.longitude();
- double deltaLongi = longiTo - longiFrom;
- if (qAbs(deltaLongi) > 180.0) {
- if (longiTo > 0.0)
- longiTo -= 360.0;
- else
- longiTo += 360.0;
- deltaLongi = longiTo - longiFrom;
- }
-
- m_deltaXs.push_back(m_deltaXs.last() + deltaLongi);
- double currentMinLongi = m_bbox.topLeft().longitude();
- double currentMaxLongi = m_bbox.bottomRight().longitude();
- if (m_deltaXs.last() < m_minX) {
- m_minX = m_deltaXs.last();
- currentMinLongi = geoTo.longitude();
- }
- if (m_deltaXs.last() > m_maxX) {
- m_maxX = m_deltaXs.last();
- currentMaxLongi = geoTo.longitude();
- }
- if (geoTo.latitude() > m_maxLati)
- m_maxLati = geoTo.latitude();
- if (geoTo.latitude() < m_minLati)
- m_minLati = geoTo.latitude();
- m_bbox = QGeoRectangle(QGeoCoordinate(m_maxLati, currentMinLongi),
- QGeoCoordinate(m_minLati, currentMaxLongi));
-}
-
-// Lazy by default. Eager, within the module, used only in MapItems/MapObjectsQSG
-class Q_POSITIONING_PRIVATE_EXPORT QGeoPathPrivate : public QGeoShapePrivate
-{
-public:
- QGeoPathPrivate();
- QGeoPathPrivate(const QList<QGeoCoordinate> &path, const qreal width = 0.0);
- ~QGeoPathPrivate();
-
-// QGeoShape API
- virtual QGeoShapePrivate *clone() const override;
- virtual bool isValid() const override;
- virtual bool isEmpty() const override;
- virtual QGeoCoordinate center() const override;
- virtual bool operator==(const QGeoShapePrivate &other) const override;
- virtual bool contains(const QGeoCoordinate &coordinate) const override;
- virtual QGeoRectangle boundingGeoRectangle() const override;
- size_t hash(size_t seed) const override;
-
-// QGeoPathPrivate API
- virtual const QList<QGeoCoordinate> &path() const;
- virtual bool lineContains(const QGeoCoordinate &coordinate) const;
- virtual qreal width() const;
- virtual double length(qsizetype indexFrom, qsizetype indexTo) const;
- virtual qsizetype size() const;
- virtual QGeoCoordinate coordinateAt(qsizetype index) const;
- virtual bool containsCoordinate(const QGeoCoordinate &coordinate) const;
-
- virtual void setWidth(const qreal &width);
- virtual void translate(double degreesLatitude, double degreesLongitude);
- virtual void setPath(const QList<QGeoCoordinate> &path);
- virtual void clearPath();
- virtual void addCoordinate(const QGeoCoordinate &coordinate);
- virtual void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate);
- virtual void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate);
- virtual void removeCoordinate(const QGeoCoordinate &coordinate);
- virtual void removeCoordinate(qsizetype index);
- virtual void computeBoundingBox();
- virtual void markDirty();
-
-// data members
- QList<QGeoCoordinate> m_path;
- qreal m_width = 0;
- QGeoRectangle m_bbox; // cached
- double m_leftBoundWrapped; // cached
- bool m_bboxDirty = false;
-};
-
-class Q_POSITIONING_PRIVATE_EXPORT QGeoPathPrivateEager : public QGeoPathPrivate
-{
-public:
- QGeoPathPrivateEager();
- QGeoPathPrivateEager(const QList<QGeoCoordinate> &path, const qreal width = 0.0);
- ~QGeoPathPrivateEager();
-
-// QGeoShapePrivate API
- virtual QGeoShapePrivate *clone() const override;
- virtual void translate(double degreesLatitude, double degreesLongitude) override;
-
-// QGeoShapePrivate API
- virtual void markDirty() override;
- virtual void addCoordinate(const QGeoCoordinate &coordinate) override;
- virtual void computeBoundingBox() override;
-
-// *Eager API
- void updateBoundingBox();
-
-// data members
- QList<double> m_deltaXs; // longitude deltas from m_path[0]
- double m_minX = 0; // minimum value inside deltaXs
- double m_maxX = 0; // maximum value inside deltaXs
- double m_minLati = 0; // minimum latitude. paths do not wrap around through the poles
- double m_maxLati = 0; // minimum latitude. paths do not wrap around through the poles
-};
-
-// This is a mean of creating a QGeoPathPrivateEager and injecting it into QGeoPaths via operator=
-class Q_POSITIONING_PRIVATE_EXPORT QGeoPathEager : public QGeoPath
-{
- Q_GADGET
-public:
-
- QGeoPathEager();
- QGeoPathEager(const QList<QGeoCoordinate> &path, const qreal &width = 0.0);
- QGeoPathEager(const QGeoPath &other);
- QGeoPathEager(const QGeoShape &other);
- ~QGeoPathEager();
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPATH_P_H
diff --git a/src/positioning/qgeopolygon.cpp b/src/positioning/qgeopolygon.cpp
deleted file mode 100644
index fc8d50cd..00000000
--- a/src/positioning/qgeopolygon.cpp
+++ /dev/null
@@ -1,719 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeopolygon.h"
-#include "qgeopolygon_p.h"
-#include "qgeopath_p.h"
-#include "qgeocircle.h"
-
-#include "qgeocoordinate.h"
-#include "qnumeric.h"
-#include "qlocationutils_p.h"
-#include "qwebmercator_p.h"
-
-#include "qdoublevector2d_p.h"
-#include "qdoublevector3d_p.h"
-#include "qwebmercator_p.h"
-
-QT_BEGIN_NAMESPACE
-
-constexpr int kMaxInt = std::numeric_limits<int>::max();
-constexpr auto kTooManyHoles = u"The polygon has more holes than fit into an int. "
- "This can cause errors while querying holes from QML";
-constexpr auto kTooManyElements = u"The polygon has more elements than fit into an int. "
- "This can cause errors while querying elements from QML";
-
-/*!
- \class QGeoPolygon
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.10
-
- \brief The QGeoPolygon class defines a geographic polygon.
-
- The polygon is defined by an ordered list of \l QGeoCoordinate objects
- representing its perimeter.
-
- Each two adjacent elements in this list are intended to be connected
- together by the shortest line segment of constant bearing passing
- through both elements.
- This type of connection can cross the date line in the longitudinal direction,
- but never crosses the poles.
-
- This is relevant for the calculation of the bounding box returned by
- \l QGeoShape::boundingGeoRectangle() for this shape, which will have the latitude of
- the top left corner set to the maximum latitude in the path point set.
- Similarly, the latitude of the bottom right corner will be the minimum latitude
- in the path point set.
-
- This class is a \l Q_GADGET.
- It can be \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
-*/
-
-/*
- \property QGeoPolygon::path
- \brief This property holds the list of coordinates for the geo polygon.
-
- The polygon is both invalid and empty if it contains no coordinate.
-
- A default constructed QGeoPolygon is therefore invalid.
-*/
-
-inline QGeoPolygonPrivate *QGeoPolygon::d_func()
-{
- return static_cast<QGeoPolygonPrivate *>(d_ptr.data());
-}
-
-inline const QGeoPolygonPrivate *QGeoPolygon::d_func() const
-{
- return static_cast<const QGeoPolygonPrivate *>(d_ptr.constData());
-}
-
-struct PolygonVariantConversions
-{
- PolygonVariantConversions()
- {
- QMetaType::registerConverter<QGeoShape, QGeoPolygon>();
- QMetaType::registerConverter<QGeoPolygon, QGeoShape>();
- }
-};
-
-Q_GLOBAL_STATIC(PolygonVariantConversions, initPolygonConversions)
-
-/*!
- Constructs a new, empty geo polygon.
-*/
-QGeoPolygon::QGeoPolygon()
-: QGeoShape(new QGeoPolygonPrivate())
-{
- initPolygonConversions();
-}
-
-/*!
- Constructs a new geo polygon from the coordinates specified
- in \a path.
-*/
-QGeoPolygon::QGeoPolygon(const QList<QGeoCoordinate> &path)
-: QGeoShape(new QGeoPolygonPrivate(path))
-{
- initPolygonConversions();
-}
-
-/*!
- Constructs a new geo polygon from the contents of \a other.
-*/
-QGeoPolygon::QGeoPolygon(const QGeoPolygon &other)
-: QGeoShape(other)
-{
- initPolygonConversions();
-}
-
-static void calculatePeripheralPoints(QList<QGeoCoordinate> &path,
- const QGeoCircle &circle,
- int steps)
-{
- const QGeoCoordinate &center = circle.center();
- const qreal distance = circle.radius();
- // Calculate points based on great-circle distance
- // Calculation is the same as GeoCoordinate's atDistanceAndAzimuth function
- // but tweaked here for computing multiple points
-
- // pre-calculations
- steps = qMax(steps, 3);
- qreal centerLon = center.longitude();
- qreal latRad = QLocationUtils::radians(center.latitude());
- qreal lonRad = QLocationUtils::radians(centerLon);
- qreal cosLatRad = std::cos(latRad);
- qreal sinLatRad = std::sin(latRad);
- qreal ratio = (distance / QLocationUtils::earthMeanRadius());
- qreal cosRatio = std::cos(ratio);
- qreal sinRatio = std::sin(ratio);
- qreal sinLatRad_x_cosRatio = sinLatRad * cosRatio;
- qreal cosLatRad_x_sinRatio = cosLatRad * sinRatio;
- for (int i = 0; i < steps; ++i) {
- qreal azimuthRad = 2 * M_PI * i / steps;
- qreal resultLatRad = std::asin(sinLatRad_x_cosRatio
- + cosLatRad_x_sinRatio * std::cos(azimuthRad));
- qreal resultLonRad = lonRad + std::atan2(std::sin(azimuthRad) * cosLatRad_x_sinRatio,
- cosRatio - sinLatRad * std::sin(resultLatRad));
- qreal lat2 = QLocationUtils::degrees(resultLatRad);
- qreal lon2 = QLocationUtils::wrapLong(QLocationUtils::degrees(resultLonRad));
-
- path << QGeoCoordinate(lat2, lon2, center.altitude());
- }
-}
-
-/*!
- Constructs a new geo polygon from the contents of \a other.
-*/
-QGeoPolygon::QGeoPolygon(const QGeoShape &other)
-: QGeoShape(other)
-{
- initPolygonConversions();
- if (type() != QGeoShape::PolygonType) {
- QGeoPolygonPrivate *poly = new QGeoPolygonPrivate();
- if (type() == QGeoShape::CircleType) {
- const QGeoCircle &circle = static_cast<const QGeoCircle &>(other);
- QList<QGeoCoordinate> perimeter;
- calculatePeripheralPoints(perimeter, circle, 128);
- poly->setPath(perimeter);
- } else if (type() == QGeoShape::RectangleType) {
- const QGeoRectangle &rect = static_cast<const QGeoRectangle &>(other);
- QList<QGeoCoordinate> perimeter;
- perimeter << rect.topLeft() << rect.topRight()
- << rect.bottomRight() << rect.bottomLeft();
- poly->setPath(perimeter);
- }
- d_ptr = poly;
- }
-}
-
-/*!
- Destroys this polygon.
-*/
-QGeoPolygon::~QGeoPolygon() {}
-
-/*!
- Assigns \a other to this geo polygon and returns a reference to this geo polygon.
-*/
-QGeoPolygon &QGeoPolygon::operator=(const QGeoPolygon &other)
-{
- QGeoShape::operator=(other);
- return *this;
-}
-
-/*!
- Sets the perimeter of the polygon based on a list of coordinates \a path.
-
- \since QtPositioning 5.12
-*/
-void QGeoPolygon::setPerimeter(const QList<QGeoCoordinate> &path)
-{
- Q_D(QGeoPolygon);
- return d->setPath(path);
-}
-
-/*!
- Returns all the elements of the polygon's perimeter.
-
- \since QtPositioning 5.12
-*/
-const QList<QGeoCoordinate> &QGeoPolygon::perimeter() const
-{
- Q_D(const QGeoPolygon);
- return d->path();
-}
-
-/*!
- Translates this geo polygon by \a degreesLatitude northwards and \a degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-*/
-void QGeoPolygon::translate(double degreesLatitude, double degreesLongitude)
-{
- Q_D(QGeoPolygon);
- d->translate(degreesLatitude, degreesLongitude);
-}
-
-/*!
- Returns a copy of this geo polygon translated by \a degreesLatitude northwards and
- \a degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-
- \sa translate()
-*/
-QGeoPolygon QGeoPolygon::translated(double degreesLatitude, double degreesLongitude) const
-{
- QGeoPolygon result(*this);
- result.translate(degreesLatitude, degreesLongitude);
- return result;
-}
-
-/*!
- Returns the length of the polygon's perimeter, in meters, from the element \a indexFrom to the element \a indexTo.
- The length is intended to be the sum of the shortest distances for each pair of adjacent points.
-*/
-double QGeoPolygon::length(qsizetype indexFrom, qsizetype indexTo) const
-{
- Q_D(const QGeoPolygon);
- return d->length(indexFrom, indexTo);
-}
-
-/*!
- Returns the number of elements in the polygon.
-
- \since 5.10
-*/
-qsizetype QGeoPolygon::size() const
-{
- Q_D(const QGeoPolygon);
- const qsizetype result = d->size();
- if (result > kMaxInt)
- qWarning() << kTooManyElements;
- return result;
-}
-
-/*!
- Appends \a coordinate to the polygon.
-*/
-void QGeoPolygon::addCoordinate(const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPolygon);
- d->addCoordinate(coordinate);
- if (d->size() > kMaxInt)
- qWarning() << kTooManyElements;
-}
-
-/*!
- Inserts \a coordinate at the specified \a index.
-*/
-void QGeoPolygon::insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPolygon);
- d->insertCoordinate(index, coordinate);
-}
-
-/*!
- Replaces the path element at the specified \a index with \a coordinate.
-*/
-void QGeoPolygon::replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPolygon);
- d->replaceCoordinate(index, coordinate);
-}
-
-/*!
- Returns the coordinate at \a index .
-*/
-QGeoCoordinate QGeoPolygon::coordinateAt(qsizetype index) const
-{
- Q_D(const QGeoPolygon);
- return d->coordinateAt(index);
-}
-
-/*!
- Returns true if the polygon's perimeter contains \a coordinate as one of the elements.
-*/
-bool QGeoPolygon::containsCoordinate(const QGeoCoordinate &coordinate) const
-{
- Q_D(const QGeoPolygon);
- return d->containsCoordinate(coordinate);
-}
-
-/*!
- Removes the last occurrence of \a coordinate from the polygon.
-*/
-void QGeoPolygon::removeCoordinate(const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoPolygon);
- d->removeCoordinate(coordinate);
-}
-
-/*!
- Removes element at position \a index from the polygon.
-*/
-void QGeoPolygon::removeCoordinate(qsizetype index)
-{
- Q_D(QGeoPolygon);
- d->removeCoordinate(index);
-}
-
-/*!
- Returns the geo polygon properties as a string.
-*/
-QString QGeoPolygon::toString() const
-{
- if (type() != QGeoShape::PolygonType) {
- qWarning("Not a polygon");
- return QStringLiteral("QGeoPolygon(not a polygon)");
- }
-
- QString pathString;
- for (const auto &p : perimeter())
- pathString += p.toString() + QLatin1Char(',');
-
- return QStringLiteral("QGeoPolygon([ %1 ])").arg(pathString);
-}
-
-/*!
- Sets the \a holePath for a hole inside the polygon. The hole is a
- QVariant containing a QList<QGeoCoordinate>.
-
- \since 5.12
-*/
-void QGeoPolygon::addHole(const QVariant &holePath)
-{
- QList<QGeoCoordinate> qgcHolePath;
- if (holePath.canConvert<QVariantList>()) {
- const QVariantList qvlHolePath = holePath.toList();
- for (const QVariant &vertex : qvlHolePath) {
- if (vertex.canConvert<QGeoCoordinate>())
- qgcHolePath << vertex.value<QGeoCoordinate>();
- }
- }
- //ToDo: add QGeoShape support
- addHole(qgcHolePath);
-}
-
-/*!
- Overloaded method. Sets the \a holePath for a hole inside the polygon. The hole is a QList<QGeoCoordinate>.
-
- \since 5.12
-*/
-void QGeoPolygon::addHole(const QList<QGeoCoordinate> &holePath)
-{
- Q_D(QGeoPolygon);
- d->addHole(holePath);
- if (d->holesCount() > kMaxInt)
- qDebug() << kTooManyHoles;
-}
-
-/*!
- Returns a QVariant containing a QList<QGeoCoordinate>
- which represents the hole at \a index.
-
- \since 5.12
-*/
-const QVariantList QGeoPolygon::hole(qsizetype index) const
-{
- Q_D(const QGeoPolygon);
- QVariantList holeCoordinates;
- for (const QGeoCoordinate &coords: d->holePath(index))
- holeCoordinates << QVariant::fromValue(coords);
- return holeCoordinates;
-}
-
-/*!
- Returns a QList<QGeoCoordinate> which represents the hole at \a index.
-
- \since 5.12
-*/
-const QList<QGeoCoordinate> QGeoPolygon::holePath(qsizetype index) const
-{
- Q_D(const QGeoPolygon);
- return d->holePath(index);
-}
-
-/*!
- Removes element at position \a index from the list of holes.
-
- \since 5.12
-*/
-void QGeoPolygon::removeHole(qsizetype index)
-{
- Q_D(QGeoPolygon);
- return d->removeHole(index);
-}
-
-/*!
- Returns the number of holes.
-
- \since 5.12
-*/
-qsizetype QGeoPolygon::holesCount() const
-{
- Q_D(const QGeoPolygon);
- const qsizetype result = d->holesCount();
- if (result > kMaxInt)
- qWarning() << kTooManyHoles;
- return result;
-}
-
-/*******************************************************************************
- *
- * QGeoPathPrivate & friends
- *
-*******************************************************************************/
-
-QGeoPolygonPrivate::QGeoPolygonPrivate()
-: QGeoPathPrivate()
-{
- type = QGeoShape::PolygonType;
-}
-
-QGeoPolygonPrivate::QGeoPolygonPrivate(const QList<QGeoCoordinate> &path)
-: QGeoPathPrivate(path)
-{
- type = QGeoShape::PolygonType;
-}
-
-QGeoPolygonPrivate::~QGeoPolygonPrivate() {}
-
-QGeoShapePrivate *QGeoPolygonPrivate::clone() const
-{
- return new QGeoPolygonPrivate(*this);
-}
-
-bool QGeoPolygonPrivate::isValid() const
-{
- return path().size() > 2;
-}
-
-bool QGeoPolygonPrivate::contains(const QGeoCoordinate &coordinate) const
-{
- return polygonContains(coordinate);
-}
-
-inline static void translatePoly( QList<QGeoCoordinate> &m_path,
- QList<QList<QGeoCoordinate>> &m_holesList,
- QGeoRectangle &m_bbox,
- double degreesLatitude,
- double degreesLongitude,
- double m_maxLati,
- double m_minLati)
-{
- if (degreesLatitude > 0.0)
- degreesLatitude = qMin(degreesLatitude, 90.0 - m_maxLati);
- else
- degreesLatitude = qMax(degreesLatitude, -90.0 - m_minLati);
- for (QGeoCoordinate &p: m_path) {
- p.setLatitude(p.latitude() + degreesLatitude);
- p.setLongitude(QLocationUtils::wrapLong(p.longitude() + degreesLongitude));
- }
- if (!m_holesList.isEmpty()){
- for (QList<QGeoCoordinate> &hole: m_holesList){
- for (QGeoCoordinate &holeVertex: hole){
- holeVertex.setLatitude(holeVertex.latitude() + degreesLatitude);
- holeVertex.setLongitude(QLocationUtils::wrapLong(holeVertex.longitude() + degreesLongitude));
- }
- }
- }
- m_bbox.translate(degreesLatitude, degreesLongitude);
-}
-
-void QGeoPolygonPrivate::translate(double degreesLatitude, double degreesLongitude)
-{
- // Need min/maxLati, so update bbox
- QList<double> m_deltaXs;
- double m_minX, m_maxX, m_minLati, m_maxLati;
- m_bboxDirty = false; // Updated in translatePoly
- computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
- translatePoly(m_path, m_holesList, m_bbox, degreesLatitude, degreesLongitude, m_maxLati, m_minLati);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
- m_clipperDirty = true;
-}
-
-bool QGeoPolygonPrivate::operator==(const QGeoShapePrivate &other) const
-{
- if (!QGeoShapePrivate::operator==(other)) // checks type
- return false;
-
- const QGeoPolygonPrivate &otherPath = static_cast<const QGeoPolygonPrivate &>(other);
- if (m_path.size() != otherPath.m_path.size()
- || m_holesList.size() != otherPath.m_holesList.size())
- return false;
- return m_path == otherPath.m_path && m_holesList == otherPath.m_holesList;
-}
-
-size_t QGeoPolygonPrivate::hash(size_t seed) const
-{
- const size_t pointsHash = qHashRange(m_path.cbegin(), m_path.cend(), seed);
- const size_t holesHash = qHashRange(m_holesList.cbegin(), m_holesList.cend(), seed);
- return qHashMulti(seed, pointsHash, holesHash);
-}
-
-void QGeoPolygonPrivate::addHole(const QList<QGeoCoordinate> &holePath)
-{
- for (const QGeoCoordinate &holeVertex: holePath)
- if (!holeVertex.isValid())
- return;
-
- m_holesList << holePath;
- // ToDo: mark clipper dirty when hole caching gets added
-}
-
-const QList<QGeoCoordinate> QGeoPolygonPrivate::holePath(qsizetype index) const
-{
- return m_holesList.at(index);
-}
-
-void QGeoPolygonPrivate::removeHole(qsizetype index)
-{
- if (index < 0 || index >= m_holesList.size())
- return;
-
- m_holesList.removeAt(index);
- // ToDo: mark clipper dirty when hole caching gets added
-}
-
-qsizetype QGeoPolygonPrivate::holesCount() const
-{
- return m_holesList.size();
-}
-
-bool QGeoPolygonPrivate::polygonContains(const QGeoCoordinate &coordinate) const
-{
- if (m_clipperDirty)
- const_cast<QGeoPolygonPrivate *>(this)->updateClipperPath(); // this one updates bbox too if needed
-
- QDoubleVector2D coord = QWebMercator::coordToMercator(coordinate);
-
- if (coord.x() < m_leftBoundWrapped)
- coord.setX(coord.x() + 1.0);
-
-
- IntPoint intCoord = QClipperUtils::toIntPoint(coord);
- if (!c2t::clip2tri::pointInPolygon(intCoord, m_clipperPath))
- return false;
-
- // else iterates the holes List checking whether the point is contained inside the holes
- for (const QList<QGeoCoordinate> &holePath : qAsConst(m_holesList)) {
- // ToDo: cache these
- QGeoPolygon holePolygon;
- holePolygon.setPerimeter(holePath);
- if (holePolygon.contains(coordinate))
- return false;
- }
- return true;
-}
-
-void QGeoPolygonPrivate::markDirty()
-{
- m_bboxDirty = m_clipperDirty = true;
-}
-
-void QGeoPolygonPrivate::updateClipperPath()
-{
- if (m_bboxDirty)
- computeBoundingBox();
- m_clipperDirty = false;
-
- QList<QDoubleVector2D> preservedPath;
- for (const QGeoCoordinate &c : m_path) {
- QDoubleVector2D crd = QWebMercator::coordToMercator(c);
- if (crd.x() < m_leftBoundWrapped)
- crd.setX(crd.x() + 1.0);
- preservedPath << crd;
- }
- m_clipperPath = QClipperUtils::qListToPath(preservedPath);
-}
-
-QGeoPolygonPrivateEager::QGeoPolygonPrivateEager() : QGeoPolygonPrivate()
-{
- m_bboxDirty = false; // never dirty on the eager version
-}
-
-QGeoPolygonPrivateEager::QGeoPolygonPrivateEager(const QList<QGeoCoordinate> &path) : QGeoPolygonPrivate(path)
-{
- m_bboxDirty = false; // never dirty on the eager version
-}
-
-QGeoPolygonPrivateEager::~QGeoPolygonPrivateEager()
-{
-
-}
-
-QGeoShapePrivate *QGeoPolygonPrivateEager::clone() const
-{
- return new QGeoPolygonPrivate(*this);
-}
-
-void QGeoPolygonPrivateEager::translate(double degreesLatitude, double degreesLongitude)
-{
- translatePoly(m_path, m_holesList, m_bbox, degreesLatitude, degreesLongitude, m_maxLati, m_minLati);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
- m_clipperDirty = true;
-}
-
-void QGeoPolygonPrivateEager::markDirty()
-{
- m_clipperDirty = true;
- computeBoundingBox();
-}
-
-void QGeoPolygonPrivateEager::addCoordinate(const QGeoCoordinate &coordinate)
-{
- if (!coordinate.isValid())
- return;
- m_path.append(coordinate);
- m_clipperDirty = true;
- updateBoundingBox(); // do not markDirty as it uses computeBoundingBox instead
-}
-
-void QGeoPolygonPrivateEager::computeBoundingBox()
-{
- computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
- m_leftBoundWrapped = QWebMercator::coordToMercator(m_bbox.topLeft()).x();
-}
-
-void QGeoPolygonPrivateEager::updateBoundingBox()
-{
- updateBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
-}
-
-QGeoPolygonEager::QGeoPolygonEager() : QGeoPolygon()
-{
- initPolygonConversions();
- d_ptr = new QGeoPolygonPrivateEager;
-}
-
-QGeoPolygonEager::QGeoPolygonEager(const QList<QGeoCoordinate> &path) : QGeoPolygon()
-{
- initPolygonConversions();
- d_ptr = new QGeoPolygonPrivateEager(path);
-}
-
-QGeoPolygonEager::QGeoPolygonEager(const QGeoPolygon &other) : QGeoPolygon()
-{
- initPolygonConversions();
- // without being able to dynamic_cast the d_ptr, only way to be sure is to reconstruct a new QGeoPolygonPrivateEager
- d_ptr = new QGeoPolygonPrivateEager;
- setPerimeter(other.perimeter());
- for (qsizetype i = 0; i < other.holesCount(); i++)
- addHole(other.holePath(i));
-}
-
-QGeoPolygonEager::QGeoPolygonEager(const QGeoShape &other) : QGeoPolygon()
-{
- initPolygonConversions();
- if (other.type() == QGeoShape::PolygonType)
- *this = QGeoPolygonEager(QGeoPolygon(other));
- else
- d_ptr = new QGeoPolygonPrivateEager;
-}
-
-QGeoPolygonEager::~QGeoPolygonEager()
-{
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeopolygon.h b/src/positioning/qgeopolygon.h
deleted file mode 100644
index 1a24ea11..00000000
--- a/src/positioning/qgeopolygon.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOLYGON_H
-#define QGEOPOLYGON_H
-
-#include <QtPositioning/QGeoShape>
-#include <QtCore/QVariantList>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoCoordinate;
-class QGeoPolygonPrivate;
-
-class Q_POSITIONING_EXPORT QGeoPolygon : public QGeoShape
-{
- Q_GADGET
- Q_PROPERTY(QList<QGeoCoordinate> perimeter READ perimeter WRITE setPerimeter REVISION(5, 12))
-
-public:
- QGeoPolygon();
- QGeoPolygon(const QList<QGeoCoordinate> &path);
- QGeoPolygon(const QGeoPolygon &other);
- QGeoPolygon(const QGeoShape &other);
-
- ~QGeoPolygon();
-
- QGeoPolygon &operator=(const QGeoPolygon &other);
-
- void setPerimeter(const QList<QGeoCoordinate> &path);
- const QList<QGeoCoordinate> &perimeter() const;
-
- Q_INVOKABLE void addHole(const QVariant &holePath);
- void addHole(const QList<QGeoCoordinate> &holePath);
- Q_INVOKABLE const QVariantList hole(qsizetype index) const;
- const QList<QGeoCoordinate> holePath(qsizetype index) const;
- Q_INVOKABLE void removeHole(qsizetype index);
- Q_INVOKABLE qsizetype holesCount() const;
- Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
- Q_INVOKABLE QGeoPolygon translated(double degreesLatitude, double degreesLongitude) const;
- Q_INVOKABLE double length(qsizetype indexFrom = 0, qsizetype indexTo = -1) const;
- Q_INVOKABLE qsizetype size() const;
- Q_INVOKABLE void addCoordinate(const QGeoCoordinate &coordinate);
- Q_INVOKABLE void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate);
- Q_INVOKABLE void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate);
- Q_INVOKABLE QGeoCoordinate coordinateAt(qsizetype index) const;
- Q_INVOKABLE bool containsCoordinate(const QGeoCoordinate &coordinate) const;
- Q_INVOKABLE void removeCoordinate(const QGeoCoordinate &coordinate);
- Q_INVOKABLE void removeCoordinate(qsizetype index);
-
- Q_INVOKABLE QString toString() const;
-
-private:
- inline QGeoPolygonPrivate *d_func();
- inline const QGeoPolygonPrivate *d_func() const;
-};
-
-Q_DECLARE_TYPEINFO(QGeoPolygon, Q_RELOCATABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoPolygon)
-
-#endif // QGEOPOLYGON_H
diff --git a/src/positioning/qgeopolygon_p.h b/src/positioning/qgeopolygon_p.h
deleted file mode 100644
index 718f2ddd..00000000
--- a/src/positioning/qgeopolygon_p.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOLYGON_P_H
-#define QGEOPOLYGON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtPositioning/private/qgeopath_p.h>
-#include <QtPositioning/qgeopolygon.h>
-#include <QtPositioning/private/qclipperutils_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONING_PRIVATE_EXPORT QGeoPolygonPrivate : public QGeoPathPrivate
-{
-public:
- QGeoPolygonPrivate();
- QGeoPolygonPrivate(const QList<QGeoCoordinate> &path);
- ~QGeoPolygonPrivate();
-
-// QGeoShape API
- virtual QGeoShapePrivate *clone() const override;
- virtual bool isValid() const override;
- virtual bool contains(const QGeoCoordinate &coordinate) const override;
- virtual void translate(double degreesLatitude, double degreesLongitude) override;
- virtual bool operator==(const QGeoShapePrivate &other) const override;
- size_t hash(size_t seed) const override;
-
-// QGeoPath API
- virtual void markDirty() override;
-
-// QGeoPolygonPrivate API
- qsizetype holesCount() const;
- bool polygonContains(const QGeoCoordinate &coordinate) const;
- const QList<QGeoCoordinate> holePath(qsizetype index) const;
-
- virtual void addHole(const QList<QGeoCoordinate> &holePath);
- virtual void removeHole(qsizetype index);
- virtual void updateClipperPath();
-
-// data members
- bool m_clipperDirty = true;
- QList<QList<QGeoCoordinate>> m_holesList;
- QtClipperLib::Path m_clipperPath;
-};
-
-class Q_POSITIONING_PRIVATE_EXPORT QGeoPolygonPrivateEager : public QGeoPolygonPrivate
-{
-public:
- QGeoPolygonPrivateEager();
- QGeoPolygonPrivateEager(const QList<QGeoCoordinate> &path);
- ~QGeoPolygonPrivateEager();
-
-// QGeoShape API
- virtual QGeoShapePrivate *clone() const override;
- virtual void translate(double degreesLatitude, double degreesLongitude) override;
-
-// QGeoPath API
- virtual void markDirty() override;
- virtual void addCoordinate(const QGeoCoordinate &coordinate) override;
- virtual void computeBoundingBox() override;
-
-// QGeoPolygonPrivate API
-
-// *Eager API
- void updateBoundingBox();
-
-// data members
- QList<double> m_deltaXs; // longitude deltas from m_path[0]
- double m_minX = 0; // minimum value inside deltaXs
- double m_maxX = 0; // maximum value inside deltaXs
- double m_minLati = 0; // minimum latitude. paths do not wrap around through the poles
- double m_maxLati = 0; // minimum latitude. paths do not wrap around through the poles
-};
-
-// This is a mean of creating a QGeoPolygonPrivateEager and injecting it into QGeoPolygons via operator=
-class Q_POSITIONING_PRIVATE_EXPORT QGeoPolygonEager : public QGeoPolygon
-{
- Q_GADGET
-public:
-
- QGeoPolygonEager();
- QGeoPolygonEager(const QList<QGeoCoordinate> &path);
- QGeoPolygonEager(const QGeoPolygon &other);
- QGeoPolygonEager(const QGeoShape &other);
- ~QGeoPolygonEager();
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOLYGON_P_H
diff --git a/src/positioning/qgeopositioninfo.cpp b/src/positioning/qgeopositioninfo.cpp
deleted file mode 100644
index f641c0ad..00000000
--- a/src/positioning/qgeopositioninfo.cpp
+++ /dev/null
@@ -1,445 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qgeopositioninfo.h"
-#include "private/qgeopositioninfo_p.h"
-#include <QHash>
-#include <QDebug>
-#include <QDataStream>
-#include <QtCore/QtNumeric>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoPositionInfo
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \ingroup shared
- \since 5.2
-
- \brief The QGeoPositionInfo class contains information gathered on a global position, direction and velocity at a particular point in time.
-
- A QGeoPositionInfo contains, at a minimum, a geographical coordinate and
- a timestamp. It may also have heading and speed measurements as well as
- estimates of the accuracy of the provided data.
-
- \sa QGeoPositionInfoSource
-*/
-
-/*!
- \enum QGeoPositionInfo::Attribute
- Defines the attributes for positional information.
-
- \value Direction The bearing measured in degrees clockwise from true north to the direction of travel.
- \value GroundSpeed The ground speed, in meters/sec.
- \value VerticalSpeed The vertical speed, in meters/sec.
- \value MagneticVariation The angle between the horizontal component of the magnetic field and true north, in degrees. Also known as magnetic declination. A positive value indicates a clockwise direction from true north and a negative value indicates a counter-clockwise direction.
- \value HorizontalAccuracy The accuracy of the provided latitude-longitude value, in meters.
- \value VerticalAccuracy The accuracy of the provided altitude value, in meters.
-
- NMEA protocol also suggests another type of accuracy - PositionAccuracy,
- which is a 3D accuracy value. Qt does not provide a separate attribute for
- it. If you need this value, you can calculate it based on the following
- formula:
-
- \c {PositionAccuracy} \sup 2 \c {= HorizontalAccuracy} \sup 2 \c { +
- VerticalAccuracy} \sup 2
-*/
-
-/*!
- Creates an invalid QGeoPositionInfo object.
-
- \sa isValid()
-*/
-QGeoPositionInfo::QGeoPositionInfo()
- : d(new QGeoPositionInfoPrivate)
-{
-}
-
-/*!
- Creates a QGeoPositionInfo for the given \a coordinate and \a timestamp.
-*/
-QGeoPositionInfo::QGeoPositionInfo(const QGeoCoordinate &coordinate, const QDateTime &timestamp)
- : d(new QGeoPositionInfoPrivate)
-{
- d->timestamp = timestamp;
- d->coord = coordinate;
-}
-
-/*!
- Creates a QGeoPositionInfo with the values of \a other.
-*/
-QGeoPositionInfo::QGeoPositionInfo(const QGeoPositionInfo &other)
- : d(other.d)
-{
-}
-
-/*!
- \fn QGeoPositionInfo::QGeoPositionInfo(QGeoPositionInfo &&other) noexcept
- \since 6.2
-
- Creates a QGeoPositionInfo object by moving from \a other.
-
- Note that a moved-from QGeoPositionInfo can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-QGeoPositionInfo::QGeoPositionInfo(QGeoPositionInfoPrivate &dd) : d(&dd)
-{
-}
-
-/*!
- Destroys a QGeoPositionInfo object.
-*/
-QGeoPositionInfo::~QGeoPositionInfo()
-{
-}
-
-QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QGeoPositionInfoPrivate)
-
-/*!
- Assigns the values from \a other to this QGeoPositionInfo.
-*/
-QGeoPositionInfo &QGeoPositionInfo::operator=(const QGeoPositionInfo & other)
-{
- if (this == &other)
- return *this;
-
- d = other.d;
- return *this;
-}
-
-/*!
- \fn QGeoPositionInfo &QGeoPositionInfo::operator=(QGeoPositionInfo &&other) noexcept
- \since 6.2
-
- Move-assigns the values from \a other to this object.
-
- Note that a moved-from QGeoPositionInfo can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- \fn bool QGeoPositionInfo::operator==(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs)
-
- Returns \c true if all of the \a lhs object's values are the same as those
- of \a rhs. Otherwise returns \c false.
-*/
-
-/*!
- \fn bool QGeoPositionInfo::operator!=(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs)
-
- Returns \c true if any of the \a lhs object's values are not the same as
- those of \a rhs. Otherwise returns \c false.
-*/
-
-/*!
- Returns true if the timestamp() and coordinate() values are both valid.
-
- \sa QGeoCoordinate::isValid(), QDateTime::isValid()
-*/
-bool QGeoPositionInfo::isValid() const
-{
- return d->timestamp.isValid() && d->coord.isValid();
-}
-
-/*!
- Sets the date and time at which this position was reported to \a timestamp.
-
- The \a timestamp must be in UTC time.
-
- \sa timestamp()
-*/
-void QGeoPositionInfo::setTimestamp(const QDateTime &timestamp)
-{
- d.detach();
- d->timestamp = timestamp;
-}
-
-/*!
- Returns the date and time at which this position was reported, in UTC time.
-
- Returns an invalid QDateTime if no date/time value has been set.
-
- \sa setTimestamp()
-*/
-QDateTime QGeoPositionInfo::timestamp() const
-{
- return d->timestamp;
-}
-
-/*!
- Sets the coordinate for this position to \a coordinate.
-
- \sa coordinate()
-*/
-void QGeoPositionInfo::setCoordinate(const QGeoCoordinate &coordinate)
-{
- d.detach();
- d->coord = coordinate;
-}
-
-/*!
- Returns the coordinate for this position.
-
- Returns an invalid coordinate if no coordinate has been set.
-
- \sa setCoordinate()
-*/
-QGeoCoordinate QGeoPositionInfo::coordinate() const
-{
- return d->coord;
-}
-
-/*!
- Sets the value for \a attribute to \a value.
-
- \sa attribute()
-*/
-void QGeoPositionInfo::setAttribute(Attribute attribute, qreal value)
-{
- d.detach();
- d->doubleAttribs[attribute] = value;
-}
-
-/*!
- Returns the value of the specified \a attribute as a qreal value.
-
- Returns NaN if the value has not been set.
-
- The function hasAttribute() should be used to determine whether or
- not a value has been set for an attribute.
-
- \sa hasAttribute(), setAttribute()
-*/
-qreal QGeoPositionInfo::attribute(Attribute attribute) const
-{
- if (d->doubleAttribs.contains(attribute))
- return d->doubleAttribs[attribute];
- return qQNaN();
-}
-
-/*!
- Removes the specified \a attribute and its value.
-*/
-void QGeoPositionInfo::removeAttribute(Attribute attribute)
-{
- d.detach();
- d->doubleAttribs.remove(attribute);
-}
-
-/*!
- Returns true if the specified \a attribute is present for this
- QGeoPositionInfo object.
-*/
-bool QGeoPositionInfo::hasAttribute(Attribute attribute) const
-{
- return d->doubleAttribs.contains(attribute);
-}
-
-/*!
- \internal
-*/
-void QGeoPositionInfo::detach()
-{
- if (d)
- d.detach();
- else
- d = new QGeoPositionInfoPrivate;
-}
-
-bool QGeoPositionInfo::equals(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs)
-{
- return *lhs.d == *rhs.d;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug QGeoPositionInfo::debugStreaming(QDebug dbg, const QGeoPositionInfo &info)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QGeoPositionInfo(" << info.d->timestamp;
- dbg.nospace() << ", "; // timestamp force dbg.space() -> reverting here
- dbg << info.d->coord;
-
- QList<QGeoPositionInfo::Attribute> attribs = info.d->doubleAttribs.keys();
- std::stable_sort(attribs.begin(), attribs.end()); // Output a sorted list from an unsorted hash.
- for (int i = 0; i < attribs.count(); ++i) {
- dbg << ", ";
- switch (attribs[i]) {
- case QGeoPositionInfo::Direction:
- dbg << "Direction=";
- break;
- case QGeoPositionInfo::GroundSpeed:
- dbg << "GroundSpeed=";
- break;
- case QGeoPositionInfo::VerticalSpeed:
- dbg << "VerticalSpeed=";
- break;
- case QGeoPositionInfo::MagneticVariation:
- dbg << "MagneticVariation=";
- break;
- case QGeoPositionInfo::HorizontalAccuracy:
- dbg << "HorizontalAccuracy=";
- break;
- case QGeoPositionInfo::VerticalAccuracy:
- dbg << "VerticalAccuracy=";
- break;
- }
- dbg << info.d->doubleAttribs[attribs[i]];
- }
- dbg << ')';
- return dbg;
-}
-#endif
-
-
-#ifndef QT_NO_DATASTREAM
-/*!
- \fn QDataStream &QGeoPositionInfo::operator<<(QDataStream &stream, QGeoPositionInfo::Attribute attr)
-
- Writes the given \a attr enumeration to the specified \a stream.
-
- \sa {Serializing Qt Data Types}
-*/
-QDataStream &QGeoPositionInfo::dataStreamOut(QDataStream &stream, QGeoPositionInfo::Attribute attr)
-{
- return stream << int(attr);
-}
-
-/*!
- \fn QDataStream &QGeoPositionInfo::operator>>(QDataStream &stream, QGeoPositionInfo::Attribute &attr)
-
- Reads an attribute enumeration from the specified \a stream info the given \a attr.
-
- \sa {Serializing Qt Data Types}
-*/
-QDataStream &QGeoPositionInfo::dataStreamIn(QDataStream &stream, QGeoPositionInfo::Attribute &attr)
-{
- int a;
- stream >> a;
- attr = static_cast<QGeoPositionInfo::Attribute>(a);
- return stream;
-}
-
-/*!
- \fn QDataStream &QGeoPositionInfo::operator<<(QDataStream &stream, const QGeoPositionInfo &info)
-
- Writes the given \a info to the specified \a stream.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &QGeoPositionInfo::dataStreamOut(QDataStream &stream, const QGeoPositionInfo &info)
-{
- stream << info.d->timestamp;
- stream << info.d->coord;
- stream << info.d->doubleAttribs;
- return stream;
-}
-
-/*!
- \fn QDataStream &QGeoPositionInfo::operator>>(QDataStream &stream, QGeoPositionInfo &info)
-
- Reads a coordinate from the specified \a stream into the given
- \a info.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &QGeoPositionInfo::dataStreamIn(QDataStream &stream, QGeoPositionInfo &info)
-{
- stream >> info.d->timestamp;
- stream >> info.d->coord;
- stream >> info.d->doubleAttribs;
- return stream;
-}
-#endif
-
-QGeoPositionInfoPrivate::QGeoPositionInfoPrivate() : QSharedData()
-{
-}
-
-QGeoPositionInfoPrivate::QGeoPositionInfoPrivate(const QGeoPositionInfoPrivate &other)
- : QSharedData(other),
- timestamp(other.timestamp),
- coord(other.coord),
- doubleAttribs(other.doubleAttribs)
-{
-}
-
-QGeoPositionInfoPrivate::~QGeoPositionInfoPrivate()
-{
-
-}
-
-bool QGeoPositionInfoPrivate::operator==(const QGeoPositionInfoPrivate &other) const
-{
- return timestamp == other.timestamp
- && coord == other.coord
- && doubleAttribs == other.doubleAttribs;
-}
-
-QGeoPositionInfoPrivate *QGeoPositionInfoPrivate::get(const QGeoPositionInfo &info)
-{
- return info.d.data();
-}
-
-size_t qHash(const QGeoPositionInfo &key, size_t seed) noexcept
-{
- return qHashMulti(seed, key.d->coord);
-}
-
-namespace QTest
-{
-
-char *toString(const QGeoPositionInfo &info)
-{
- QString result;
- QDebug dbg(&result);
- dbg << info;
-
- return qstrdup(qPrintable(result));
-}
-
-} // namespace QTest
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeopositioninfo.h b/src/positioning/qgeopositioninfo.h
deleted file mode 100644
index 76f667b7..00000000
--- a/src/positioning/qgeopositioninfo.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QGEOPOSITIONINFO_H
-#define QGEOPOSITIONINFO_H
-
-#include <QtPositioning/QGeoCoordinate>
-#include <QtCore/QExplicitlySharedDataPointer>
-#include <QtCore/QMetaType>
-#include <QtCore/QDateTime>
-
-QT_BEGIN_NAMESPACE
-
-class QDebug;
-class QDataStream;
-
-class QGeoPositionInfo;
-Q_POSITIONING_EXPORT size_t qHash(const QGeoPositionInfo &key, size_t seed = 0) noexcept;
-namespace QTest
-{
-
-Q_POSITIONING_EXPORT char *toString(const QGeoPositionInfo &info);
-
-} // namespace QTest
-
-class QGeoPositionInfoPrivate;
-QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoPositionInfoPrivate, Q_POSITIONING_EXPORT)
-
-class Q_POSITIONING_EXPORT QGeoPositionInfo
-{
-public:
- enum Attribute {
- Direction,
- GroundSpeed,
- VerticalSpeed,
- MagneticVariation,
- HorizontalAccuracy,
- VerticalAccuracy
- };
-
- QGeoPositionInfo();
- QGeoPositionInfo(const QGeoCoordinate &coordinate, const QDateTime &updateTime);
- QGeoPositionInfo(const QGeoPositionInfo &other);
- QGeoPositionInfo(QGeoPositionInfo &&other) noexcept = default;
- QGeoPositionInfo(QGeoPositionInfoPrivate &dd);
- ~QGeoPositionInfo();
-
- QGeoPositionInfo &operator=(const QGeoPositionInfo &other);
- QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoPositionInfo)
-
- void swap(QGeoPositionInfo &other) noexcept { d.swap(other.d); }
-
- friend bool operator==(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- bool isValid() const;
-
- void setTimestamp(const QDateTime &timestamp);
- QDateTime timestamp() const;
-
- void setCoordinate(const QGeoCoordinate &coordinate);
- QGeoCoordinate coordinate() const;
-
- void setAttribute(Attribute attribute, qreal value);
- qreal attribute(Attribute attribute) const;
- void removeAttribute(Attribute attribute);
- bool hasAttribute(Attribute attribute) const;
-
- void detach();
-
-private:
- static bool equals(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs);
-#ifndef QT_NO_DEBUG_STREAM
- friend QDebug operator<<(QDebug dbg, const QGeoPositionInfo &info)
- {
- return debugStreaming(dbg, info);
- }
- static QDebug debugStreaming(QDebug dbg, const QGeoPositionInfo &info);
-#endif
-#ifndef QT_NO_DATASTREAM
- friend QDataStream &operator<<(QDataStream &stream, const QGeoPositionInfo &info)
- {
- return dataStreamOut(stream, info);
- }
- friend QDataStream &operator>>(QDataStream &stream, QGeoPositionInfo &info)
- {
- return dataStreamIn(stream, info);
- }
- static QDataStream &dataStreamOut(QDataStream &stream, const QGeoPositionInfo &info);
- static QDataStream &dataStreamIn(QDataStream &stream, QGeoPositionInfo &info);
-
- friend QDataStream &operator<<(QDataStream &stream, QGeoPositionInfo::Attribute attr)
- {
- return dataStreamOut(stream, attr);
- }
- friend QDataStream &operator>>(QDataStream &stream, QGeoPositionInfo::Attribute &attr)
- {
- return dataStreamIn(stream, attr);
- }
- static QDataStream &dataStreamOut(QDataStream &stream, QGeoPositionInfo::Attribute attr);
- static QDataStream &dataStreamIn(QDataStream &stream, QGeoPositionInfo::Attribute &attr);
-#endif
- QExplicitlySharedDataPointer<QGeoPositionInfoPrivate> d;
- friend class QGeoPositionInfoPrivate;
-
- friend Q_POSITIONING_EXPORT size_t qHash(const QGeoPositionInfo &key, size_t seed) noexcept;
- friend Q_POSITIONING_EXPORT char *QTest::toString(const QGeoPositionInfo &info);
-};
-
-Q_DECLARE_SHARED(QGeoPositionInfo)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoPositionInfo)
-
-#endif // QGEOPOSITIONINFO_H
diff --git a/src/positioning/qgeopositioninfo_p.h b/src/positioning/qgeopositioninfo_p.h
deleted file mode 100644
index e3d9f436..00000000
--- a/src/positioning/qgeopositioninfo_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QGEOPOSITIONINFO_P_H
-#define QGEOPOSITIONINFO_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include "qgeopositioninfo.h"
-#include <QHash>
-#include <QDateTime>
-#include <QtPositioning/qgeocoordinate.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoPrivate : public QSharedData
-{
-public:
- QGeoPositionInfoPrivate();
- QGeoPositionInfoPrivate(const QGeoPositionInfoPrivate &other);
- virtual ~QGeoPositionInfoPrivate();
- bool operator==(const QGeoPositionInfoPrivate &other) const;
-
- QDateTime timestamp;
- QGeoCoordinate coord;
- QHash<QGeoPositionInfo::Attribute, qreal> doubleAttribs;
-
- static QGeoPositionInfoPrivate *get(const QGeoPositionInfo &info);
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFO_P_H
diff --git a/src/positioning/qgeopositioninfosource.cpp b/src/positioning/qgeopositioninfosource.cpp
deleted file mode 100644
index e09be54e..00000000
--- a/src/positioning/qgeopositioninfosource.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qgeopositioninfosource.h>
-#include "qgeopositioninfosource_p.h"
-#include "qgeopositioninfosourcefactory.h"
-
-#include <QFile>
-#include <QPluginLoader>
-#include <QStringList>
-#include <QJsonObject>
-#include <QCryptographicHash>
-#include <QtCore/private/qfactoryloader_p.h>
-#include <QtCore/private/qthread_p.h>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- ("org.qt-project.qt.position.sourcefactory/6.0",
- QLatin1String("/position")))
-
-/*!
- \class QGeoPositionInfoSource
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoPositionInfoSource class is an abstract base class for the distribution of positional updates.
-
- The static function QGeoPositionInfoSource::createDefaultSource() creates a default
- position source that is appropriate for the platform, if one is available.
- Otherwise, QGeoPositionInfoSource will check for available plugins that
- implement the QGeoPositionInfoSourceFactory interface.
-
- Users of a QGeoPositionInfoSource subclass can request the current position using
- requestUpdate(), or start and stop regular position updates using
- startUpdates() and stopUpdates(). When an update is available,
- positionUpdated() is emitted. The last known position can be accessed with
- lastKnownPosition().
-
- If regular position updates are required, setUpdateInterval() can be used
- to specify how often these updates should be emitted. If no interval is
- specified, updates are simply provided whenever they are available.
- For example:
-
- \code
- // Emit updates every 10 seconds if available
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(0);
- if (source)
- source->setUpdateInterval(10000);
- \endcode
-
- To remove an update interval that was previously set, call
- setUpdateInterval() with a value of 0.
-
- \note The position source may have a minimum value requirement for
- update intervals, as returned by minimumUpdateInterval().
-
- \note To use this class from Android service, see
- \l {Qt Positioning on Android}.
-*/
-
-/*!
- \enum QGeoPositionInfoSource::PositioningMethod
- Defines the types of positioning methods.
-
- \value NoPositioningMethods None of the positioning methods.
- \value SatellitePositioningMethods Satellite-based positioning methods such as GPS or GLONASS.
- \value NonSatellitePositioningMethods Other positioning methods such as 3GPP cell identifier or WiFi based positioning.
- \value AllPositioningMethods Satellite-based positioning methods as soon as available. Otherwise non-satellite based methods.
-*/
-
-QGeoPositionInfoSourcePrivate::~QGeoPositionInfoSourcePrivate()
-{
-
-}
-
-QGeoPositionInfoSourceFactory *QGeoPositionInfoSourcePrivate::loadFactory(const QJsonObject &meta)
-{
- const int idx = static_cast<int>(meta.value(QStringLiteral("index")).toDouble());
- if (idx < 0)
- return nullptr;
- QObject *instance = loader()->instance(idx);
- if (!instance)
- return nullptr;
- return qobject_cast<QGeoPositionInfoSourceFactory *>(instance);
-}
-
-QMultiHash<QString, QJsonObject> QGeoPositionInfoSourcePrivate::plugins(bool reload)
-{
- static QMultiHash<QString, QJsonObject> plugins;
- static bool alreadyDiscovered = false;
-
- if (reload == true)
- alreadyDiscovered = false;
-
- if (!alreadyDiscovered) {
- loadPluginMetadata(plugins);
- alreadyDiscovered = true;
- }
- return plugins;
-}
-
-static bool pluginComparator(const QJsonObject &p1, const QJsonObject &p2)
-{
- const QString prio = QStringLiteral("Priority");
- if (p1.contains(prio) && !p2.contains(prio))
- return true;
- if (!p1.contains(prio) && p2.contains(prio))
- return false;
- if (p1.value(prio).isDouble() && !p2.value(prio).isDouble())
- return true;
- if (!p1.value(prio).isDouble() && p2.value(prio).isDouble())
- return false;
- return (p1.value(prio).toDouble() > p2.value(prio).toDouble());
-}
-
-QList<QJsonObject> QGeoPositionInfoSourcePrivate::pluginsSorted()
-{
- QList<QJsonObject> list = plugins().values();
- std::stable_sort(list.begin(), list.end(), pluginComparator);
- return list;
-}
-
-void QGeoPositionInfoSourcePrivate::loadPluginMetadata(QMultiHash<QString, QJsonObject> &plugins)
-{
- QFactoryLoader *l = loader();
- QList<QJsonObject> meta = l->metaData();
- for (int i = 0; i < meta.size(); ++i) {
- QJsonObject obj = meta.at(i).value(QStringLiteral("MetaData")).toObject();
- const QString testableKey = QStringLiteral("Testable");
- if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
- static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
- if (inTest)
- continue;
- }
- obj.insert(QStringLiteral("index"), i);
- plugins.insert(obj.value(QStringLiteral("Provider")).toString(), obj);
- }
-}
-
-/*!
- Creates a position source with the specified \a parent.
-*/
-
-QGeoPositionInfoSource::QGeoPositionInfoSource(QObject *parent)
- : QObject(*new QGeoPositionInfoSourcePrivate, parent)
-{
- qRegisterMetaType<QGeoPositionInfo>();
-}
-
-/*!
- Destroys the position source.
-*/
-QGeoPositionInfoSource::~QGeoPositionInfoSource()
-{
-}
-
-/*!
- \property QGeoPositionInfoSource::sourceName
- \brief This property holds the unique name of the position source
- implementation in use.
-
- This is the same name that can be passed to createSource() in order to
- create a new instance of a particular position source implementation.
-*/
-QString QGeoPositionInfoSource::sourceName() const
-{
- Q_D(const QGeoPositionInfoSource);
- return d->sourceName;
-}
-
-/*!
- Sets the backend-specific property named \a name to \a value.
- Returns \c true on success, \c false otherwise.
- Backend-specific properties can be used to configure the positioning subsystem behavior
- at runtime.
- Supported backend-specific properties are listed and described in
- \l {Qt Positioning plugins#Default plugins}.
-
- \sa backendProperty
- \since Qt 5.14
-*/
-bool QGeoPositionInfoSource::setBackendProperty(const QString &name, const QVariant &value)
-{
- Q_UNUSED(name)
- Q_UNUSED(value)
- return false;
-}
-
-/*!
- Returns the value of the backend-specific property named \a name, if present.
- Otherwise, the returned value will be invalid.
- Supported backend-specific properties are listed and described in
- \l {Qt Positioning plugins#Default plugins}.
-
- \sa setBackendProperty
- \since Qt 5.14
-*/
-QVariant QGeoPositionInfoSource::backendProperty(const QString &name) const
-{
- Q_UNUSED(name)
- return QVariant();
-}
-
-/*!
- \property QGeoPositionInfoSource::updateInterval
- \brief This property holds the requested interval in milliseconds between each update.
-
- If the update interval is not set (or is set to 0) the
- source will provide updates as often as necessary.
-
- If the update interval is set, the source will provide updates at an
- interval as close to the requested interval as possible. If the requested
- interval is less than the minimumUpdateInterval(),
- the minimum interval is used instead.
-
- Changes to the update interval will happen as soon as is practical, however the
- time the change takes may vary between implementations. Whether or not the elapsed
- time from the previous interval is counted as part of the new interval is also
- implementation dependent.
-
- The default value for this property is 0.
-
- \note Subclass implementations must call the base implementation of
- \c {setUpdateInterval()} so that \c {updateInterval()} returns the correct
- value.
-*/
-void QGeoPositionInfoSource::setUpdateInterval(int msec)
-{
- Q_D(QGeoPositionInfoSource);
- d->interval = msec;
-}
-
-int QGeoPositionInfoSource::updateInterval() const
-{
- Q_D(const QGeoPositionInfoSource);
- return d->interval.value();
-}
-
-QBindable<int> QGeoPositionInfoSource::bindableUpdateInterval()
-{
- Q_D(QGeoPositionInfoSource);
- return QBindable<int>(&d->interval);
-}
-
-/*!
- \property QGeoPositionInfoSource::preferredPositioningMethods
-
- \brief Sets the preferred positioning methods for this source.
-
- If new methods include a method that is not supported by the source, the
- unsupported method will be ignored.
-
- If new methods do not include a single method available/supported by the
- source, the preferred methods will be set to the set of methods which the
- source has available. If the source has no method availabe (e.g. because its
- Location service is turned off or it does not offer a Location service),
- the passed methods are accepted as they are.
-
- The default value for this property is \l {QGeoPositionInfoSource::}
- {NoPositioningMethods}.
-
- \note Subclass implementations must call the base implementation of
- \c {setPreferredPositioningMethods()} to ensure
- \c {preferredPositioningMethods()} returns the correct value.
-
- \sa supportedPositioningMethods()
-*/
-void QGeoPositionInfoSource::setPreferredPositioningMethods(PositioningMethods methods)
-{
- Q_D(QGeoPositionInfoSource);
- d->methods.removeBindingUnlessInWrapper();
- // The supported positioning methods can change during the calls to this
- // method, so we can't have a simple check like:
- // if (currentMethods == methods) return;
- // Instead we need to save the current value and compare it afterwards
- const auto prevMethods = d->methods.value();
-
- if (supportedPositioningMethods() != QGeoPositionInfoSource::NoPositioningMethods) {
- d->methods.setValueBypassingBindings(methods & supportedPositioningMethods());
- if (d->methods.value() == 0) {
- d->methods.setValueBypassingBindings(supportedPositioningMethods());
- }
- } else { // avoid that turned of Location service blocks any changes to d->methods
- d->methods.setValueBypassingBindings(methods);
- }
- if (prevMethods != d->methods.value())
- d->methods.notify();
-}
-
-QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSource::preferredPositioningMethods() const
-{
- Q_D(const QGeoPositionInfoSource);
- return d->methods.value();
-}
-
-QBindable<QGeoPositionInfoSource::PositioningMethods>
-QGeoPositionInfoSource::bindablePreferredPositioningMethods()
-{
- Q_D(QGeoPositionInfoSource);
- return QBindable<PositioningMethods>(&d->methods);
-}
-
-QGeoPositionInfoSource *QGeoPositionInfoSourcePrivate::createSourceReal(const QJsonObject &meta, const QVariantMap &parameters, QObject *parent)
-{
- QGeoPositionInfoSource *s = nullptr;
- auto factory = QGeoPositionInfoSourcePrivate::loadFactory(meta);
- if (factory)
- s = factory->positionInfoSource(parent, parameters);
- if (s)
- s->d_func()->sourceName = meta.value(QStringLiteral("Provider")).toString();
-
- return s;
-}
-
-/*!
- Creates and returns a position source with the given \a parent that
- reads from the system's default sources of location data, or the plugin
- with the highest available priority.
-
- Returns \c nullptr if the system has no default position source, no valid
- plugins could be found or the user does not have the permission to access
- the current position.
-*/
-QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *parent)
-{
- return createDefaultSource(QVariantMap(), parent);
-}
-
-/*!
- Creates and returns a position source with the given \a parent that
- reads from the system's default sources of location data, or the plugin
- with the highest available priority.
-
- Returns \c nullptr if the system has no default position source, no valid plugins
- could be found or the user does not have the permission to access the current position.
-
- This method passes \a parameters to the factory to configure the source.
-
- \since Qt 5.14
-*/
-QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(const QVariantMap &parameters, QObject *parent)
-{
- QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
- foreach (const QJsonObject &obj, plugins) {
- if (obj.value(QStringLiteral("Position")).isBool()
- && obj.value(QStringLiteral("Position")).toBool()) {
- QGeoPositionInfoSource *source = QGeoPositionInfoSourcePrivate::createSourceReal(obj, parameters, parent);
- if (source)
- return source;
- }
- }
- return nullptr;
-}
-
-/*!
- Creates and returns a position source with the given \a parent,
- by loading the plugin named \a sourceName.
-
- Returns \c nullptr if the plugin cannot be found.
-*/
-QGeoPositionInfoSource *QGeoPositionInfoSource::createSource(const QString &sourceName, QObject *parent)
-{
- return createSource(sourceName, QVariantMap(), parent);
-}
-
-/*!
- Creates and returns a position source with the given \a parent,
- by loading the plugin named \a sourceName.
-
- Returns \c nullptr if the plugin cannot be found.
-
- This method passes \a parameters to the factory to configure the source.
-
- \since Qt 5.14
-*/
-QGeoPositionInfoSource *QGeoPositionInfoSource::createSource(const QString &sourceName, const QVariantMap &parameters, QObject *parent)
-{
- auto plugins = QGeoPositionInfoSourcePrivate::plugins();
- if (plugins.contains(sourceName))
- return QGeoPositionInfoSourcePrivate::createSourceReal(plugins.value(sourceName), parameters, parent);
- return nullptr;
-}
-
-/*!
- Returns a list of available source plugins. This includes any default backend
- plugin for the current platform.
-*/
-QStringList QGeoPositionInfoSource::availableSources()
-{
- QStringList plugins;
- const auto meta = QGeoPositionInfoSourcePrivate::plugins();
- for (auto it = meta.cbegin(), end = meta.cend(); it != end; ++it) {
- if (it.value().value(QStringLiteral("Position")).isBool()
- && it.value().value(QStringLiteral("Position")).toBool()) {
- plugins << it.key();
- }
- }
-
- return plugins;
-}
-
-QGeoPositionInfoSource::QGeoPositionInfoSource(QGeoPositionInfoSourcePrivate &dd, QObject *parent)
- : QObject(dd, parent)
-{
- qRegisterMetaType<QGeoPositionInfo>();
- Q_D(QGeoPositionInfoSource);
- d->interval.setValueBypassingBindings(0);
- d->methods.setValueBypassingBindings(NoPositioningMethods);
-}
-
-/*!
- \fn QGeoPositionInfo QGeoPositionInfoSource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const = 0;
-
- Returns an update containing the last known position, or a null update
- if none is available.
-
- If \a fromSatellitePositioningMethodsOnly is true, this returns the last
- known position received from a satellite positioning method; if none
- is available, a null update is returned.
-*/
-
-/*!
- \fn virtual PositioningMethods QGeoPositionInfoSource::supportedPositioningMethods() const = 0;
-
- Returns the positioning methods available to this source. Availability is defined as being usable
- at the time of calling this function. Therefore user settings like turned off location service or
- limitations to Satellite-based position providers are reflected by this function. Runtime notifications
- when the status changes can be obtained via \l supportedPositioningMethodsChanged().
-
- Not all platforms distinguish the different positioning methods or communicate the current user
- configuration of the device. The following table provides an overview of the current platform situation:
-
- \table
- \header
- \li Platform
- \li Brief Description
- \row
- \li Android
- \li Individual provider status and general Location service state are known and communicated
- when location service is active.
- \row
- \li GeoClue
- \li Hardcoced to always return AllPositioningMethods.
- \row
- \li GeoClue2
- \li Individual providers are not distinguishable but disabled Location services reflected.
- \row
- \li iOS/tvOS
- \li Hardcoced to always return AllPositioningMethods.
- \row
- \li macOS
- \li Hardcoced to always return AllPositioningMethods.
- \row
- \li Windows (UWP)
- \li Individual providers are not distinguishable but disabled Location services reflected.
- \endtable
-
- \sa supportedPositioningMethodsChanged(), setPreferredPositioningMethods()
-*/
-
-
-/*!
- \property QGeoPositionInfoSource::minimumUpdateInterval
- \brief This property holds the minimum time (in milliseconds) required to retrieve a position update.
-
- This is the minimum value accepted by setUpdateInterval() and
- requestUpdate().
-*/
-
-
-/*!
- \fn virtual void QGeoPositionInfoSource::startUpdates() = 0;
-
- Starts emitting updates at regular intervals as specified by setUpdateInterval().
-
- If setUpdateInterval() has not been called, the source will emit updates
- as soon as they become available.
-
- An errorOccurred() signal with the \l {QGeoPositionInfoSource::}
- {UpdateTimeoutError} will be emitted if this QGeoPositionInfoSource subclass
- determines that it will not be able to provide regular updates. This could
- happen if a satellite fix is lost or if a hardware error is detected.
- Position updates will recommence if the data becomes available later on.
- The \l {QGeoPositionInfoSource::}{UpdateTimeoutError} error will not
- be emitted again until after the periodic updates resume.
-
- \note Since Qt6 this method always resets the last error to
- \l {QGeoPositionInfoSource::}{NoError} before starting the updates.
-
- \note To understand how to use this method from an Android service, see
- \l {Qt Positioning on Android}.
-
- On iOS, starting from version 8, Core Location framework requires additional
- entries in the application's Info.plist with keys NSLocationAlwaysUsageDescription or
- NSLocationWhenInUseUsageDescription and a string to be displayed in the authorization prompt.
- The key NSLocationWhenInUseUsageDescription is used when requesting permission
- to use location services while the app is in the foreground.
- The key NSLocationAlwaysUsageDescription is used when requesting permission
- to use location services whenever the app is running (both the foreground and the background).
- If both entries are defined, NSLocationWhenInUseUsageDescription has a priority in the
- foreground mode.
-*/
-
-/*!
- \fn virtual void QGeoPositionInfoSource::stopUpdates() = 0;
-
- Stops emitting updates at regular intervals.
-*/
-
-/*!
- \fn virtual void QGeoPositionInfoSource::requestUpdate(int timeout = 0);
-
- Attempts to get the current position and emit positionUpdated() with
- this information. If the current position cannot be found within the given \a timeout
- (in milliseconds) or if \a timeout is less than the value returned by
- minimumUpdateInterval(), an errorOccurred() signal with the
- \l {QGeoPositionInfoSource::}{UpdateTimeoutError} is emitted.
-
- If the timeout is zero, the timeout defaults to a reasonable timeout
- period as appropriate for the source.
-
- This does nothing if another update request is in progress. However
- it can be called even if startUpdates() has already been called and
- regular updates are in progress.
-
- If the source uses multiple positioning methods, it tries to get the
- current position from the most accurate positioning method within the
- given timeout.
-
- \note Since Qt6 this method always resets the last error to
- \l {QGeoPositionInfoSource::}{NoError} before requesting
- the position.
-
- \note To understand how to use this method from an Android service, see
- \l {Qt Positioning on Android}.
-*/
-
-/*!
- \fn virtual QGeoPositionInfoSource::Error QGeoPositionInfoSource::error() const;
-
- Returns the type of error that last occurred.
-
- \note Since Qt6 the last error is always reset when calling startUpdates()
- or requestUpdate().
-*/
-
-/*!
- \fn void QGeoPositionInfoSource::positionUpdated(const QGeoPositionInfo &update);
-
- If startUpdates() or requestUpdate() is called, this signal is emitted
- when an update becomes available.
-
- The \a update value holds the value of the new update.
-*/
-
-/*!
- \fn void QGeoPositionInfoSource::errorOccurred(QGeoPositionInfoSource::Error positioningError)
-
- This signal is emitted after an error occurred. The \a positioningError
- parameter describes the type of error that occurred.
-*/
-
-/*!
- \enum QGeoPositionInfoSource::Error
-
- The Error enumeration represents the errors which can occur.
-
- \value AccessError The connection setup to the remote positioning backend failed because the
- application lacked the required privileges.
- \value ClosedError The remote positioning backend closed the connection, which happens for example in case
- the user is switching location services to off. As soon as the location service is re-enabled
- regular updates will resume.
- \value NoError No error has occurred.
- \value UnknownSourceError An unidentified error occurred.
- \value [since 6.2] UpdateTimeoutError If requestUpdate() was called, this
- error indicates that the current position could not be retrieved within
- the specified timeout. If startUpdates() was called, this error
- indicates that this QGeoPositionInfoSource subclass determined that it
- will not be able to provide further regular updates. In the latter case
- the error would not be emitted again until after the regular updates
- resume.
- */
-
-/*!
- \fn void QGeoPositionInfoSource::supportedPositioningMethodsChanged()
-
- This signal is emitted when the supported positioning methods changed. The cause for a change could be
- a user turning Location services on/off or restricting Location services to certain types (e.g. GPS only).
- Note that changes to the supported positioning methods cannot be detected on all platforms.
- \l supportedPositioningMethods() provides an overview of the current platform support.
-
- \since Qt 5.12
-*/
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeopositioninfosource.h b/src/positioning/qgeopositioninfosource.h
deleted file mode 100644
index e03f6797..00000000
--- a/src/positioning/qgeopositioninfosource.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCE_H
-#define QGEOPOSITIONINFOSOURCE_H
-
-#include <QtPositioning/QGeoPositionInfo>
-
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoSourcePrivate;
-class Q_POSITIONING_EXPORT QGeoPositionInfoSource : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval BINDABLE
- bindableUpdateInterval)
- Q_PROPERTY(int minimumUpdateInterval READ minimumUpdateInterval)
- Q_PROPERTY(QString sourceName READ sourceName)
- Q_PROPERTY(PositioningMethods preferredPositioningMethods READ preferredPositioningMethods WRITE
- setPreferredPositioningMethods BINDABLE bindablePreferredPositioningMethods)
-
-public:
- enum Error {
- AccessError = 0,
- ClosedError = 1,
- UnknownSourceError = 2,
- NoError = 3,
- UpdateTimeoutError = 4
- };
- Q_ENUM(Error)
-
- enum PositioningMethod {
- NoPositioningMethods = 0x00000000,
- SatellitePositioningMethods = 0x000000ff,
- NonSatellitePositioningMethods = 0xffffff00,
- AllPositioningMethods = 0xffffffff
- };
- Q_DECLARE_FLAGS(PositioningMethods, PositioningMethod)
-
- explicit QGeoPositionInfoSource(QObject *parent);
- virtual ~QGeoPositionInfoSource();
-
- virtual void setUpdateInterval(int msec);
- int updateInterval() const;
- QBindable<int> bindableUpdateInterval();
-
- virtual void setPreferredPositioningMethods(PositioningMethods methods);
- PositioningMethods preferredPositioningMethods() const;
- QBindable<PositioningMethods> bindablePreferredPositioningMethods();
-
- virtual QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const = 0;
-
- virtual PositioningMethods supportedPositioningMethods() const = 0;
- virtual int minimumUpdateInterval() const = 0;
-
- QString sourceName() const;
-
- virtual bool setBackendProperty(const QString &name, const QVariant &value);
- virtual QVariant backendProperty(const QString &name) const;
-
- static QGeoPositionInfoSource *createDefaultSource(QObject *parent);
- static QGeoPositionInfoSource *createDefaultSource(const QVariantMap &parameters, QObject *parent);
- static QGeoPositionInfoSource *createSource(const QString &sourceName, QObject *parent);
- static QGeoPositionInfoSource *createSource(const QString &sourceName, const QVariantMap &parameters, QObject *parent);
- static QStringList availableSources();
- virtual Error error() const = 0;
-
-public Q_SLOTS:
- virtual void startUpdates() = 0;
- virtual void stopUpdates() = 0;
-
- virtual void requestUpdate(int timeout = 0) = 0;
-
-Q_SIGNALS:
- void positionUpdated(const QGeoPositionInfo &update);
- void errorOccurred(QGeoPositionInfoSource::Error);
- void supportedPositioningMethodsChanged();
-
-protected:
- explicit QGeoPositionInfoSource(QGeoPositionInfoSourcePrivate &dd, QObject *parent);
-
-private:
- Q_DISABLE_COPY(QGeoPositionInfoSource)
- Q_DECLARE_PRIVATE(QGeoPositionInfoSource)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoPositionInfoSource::PositioningMethods)
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeopositioninfosource_p.h b/src/positioning/qgeopositioninfosource_p.h
deleted file mode 100644
index 8021250b..00000000
--- a/src/positioning/qgeopositioninfosource_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCE_P_H
-#define QGEOPOSITIONINFOSOURCE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/private/qobject_p.h>
-#include <QtCore/private/qproperty_p.h>
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include "qgeopositioninfosource.h"
-#include "qgeopositioninfosourcefactory.h"
-#include <QJsonObject>
-#include <QString>
-#include <QMultiHash>
-#include <QList>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoSourcePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QGeoPositionInfoSource)
-public:
- virtual ~QGeoPositionInfoSourcePrivate();
-
- static QGeoPositionInfoSourceFactory *loadFactory(const QJsonObject &meta);
- static QGeoPositionInfoSource *createSourceReal(const QJsonObject &meta,
- const QVariantMap &parameters,
- QObject *parent);
-
- void setPositioningMethods(QGeoPositionInfoSource::PositioningMethods methods)
- {
- q_func()->setPreferredPositioningMethods(methods);
- }
-
- Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QGeoPositionInfoSourcePrivate, int, interval, 0)
- Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QGeoPositionInfoSourcePrivate,
- QGeoPositionInfoSource::PositioningMethods, methods,
- &QGeoPositionInfoSourcePrivate::setPositioningMethods,
- QGeoPositionInfoSource::NoPositioningMethods)
- QString sourceName;
-
- static QMultiHash<QString, QJsonObject> plugins(bool reload = false);
- static void loadPluginMetadata(QMultiHash<QString, QJsonObject> &list);
- static QList<QJsonObject> pluginsSorted();
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCE_P_H
diff --git a/src/positioning/qgeopositioninfosourcefactory.cpp b/src/positioning/qgeopositioninfosourcefactory.cpp
deleted file mode 100644
index 673ee60e..00000000
--- a/src/positioning/qgeopositioninfosourcefactory.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosourcefactory.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoPositionInfoSourceFactory
- \inmodule QtPositioning
- \since 5.2
-
- \brief The QGeoPositionInfoSourceFactory class is a factory class used
- as the plugin interface for external providers of positioning data.
-
- Each factory method takes a parameters argument, which allows to configure
- the created source.
-*/
-
-/*!
- \fn QGeoPositionInfoSource *QGeoPositionInfoSourceFactory::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-
- Returns a new QGeoPositionInfoSource associated with this plugin
- with parent \a parent, and using \a parameters as configuration parameters.
- Can also return 0, in which case the plugin loader will use the factory with
- the next highest priority.
-*/
-
-/*!
- \fn QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactory::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-
- Returns a new QGeoSatelliteInfoSource associated with this plugin
- with parent \a parent, and using \a parameters as configuration parameters.
- Can also return 0, in which case the plugin loader will use the factory with
- the next highest priority.
-*/
-
-/*!
- \fn QGeoAreaMonitorSource *QGeoPositionInfoSourceFactory::areaMonitor(QObject *parent, const QVariantMap &parameters);
-
- Returns a new QGeoAreaMonitorSource associated with this plugin with parent
- \a parent, and using \a parameters as configuration parameters.
- Can also return 0, in which case the plugin loader will use the factory with
- the next highest priority.
-*/
-
-/*!
- Destroys the position info source factory.
-*/
-QGeoPositionInfoSourceFactory::~QGeoPositionInfoSourceFactory()
-{}
-
-QT_END_NAMESPACE
-
diff --git a/src/positioning/qgeopositioninfosourcefactory.h b/src/positioning/qgeopositioninfosourcefactory.h
deleted file mode 100644
index dc98bc85..00000000
--- a/src/positioning/qgeopositioninfosourcefactory.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCEFACTORY_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_H
-
-#include <QtPositioning/QGeoPositionInfoSource>
-#include <QtPositioning/QGeoSatelliteInfoSource>
-#include <QtPositioning/QGeoAreaMonitorSource>
-#include <QtCore/QList>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONING_EXPORT QGeoPositionInfoSourceFactory
-{
-public:
- virtual ~QGeoPositionInfoSourceFactory();
-
- virtual QGeoPositionInfoSource *positionInfoSource(QObject *parent, const QVariantMap &parameters) = 0;
- virtual QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent, const QVariantMap &parameters) = 0;
- virtual QGeoAreaMonitorSource *areaMonitor(QObject *parent, const QVariantMap &parameters) = 0;
-};
-
-#define QT_POSITION_SOURCE_INTERFACE
-Q_DECLARE_INTERFACE(QGeoPositionInfoSourceFactory,
- "org.qt-project.qt.position.sourcefactory/6.0")
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCEFACTORY_H
diff --git a/src/positioning/qgeorectangle.cpp b/src/positioning/qgeorectangle.cpp
deleted file mode 100644
index b92ca17c..00000000
--- a/src/positioning/qgeorectangle.cpp
+++ /dev/null
@@ -1,1031 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeorectangle.h"
-#include "qgeorectangle_p.h"
-
-#include "qwebmercator_p.h"
-#include "qdoublevector2d_p.h"
-#include "qgeocoordinate.h"
-#include "qnumeric.h"
-#include "qlocationutils_p.h"
-#include <QList>
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoRectangle
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoRectangle class defines a rectangular geographic area.
-
- The rectangle is defined in terms of a QGeoCoordinate which specifies the
- top left coordinate of the rectangle and a QGeoCoordinate which specifies
- the bottom right coordinate of the rectangle.
-
- A geo rectangle is considered invalid if the top left or bottom right
- coordinates are invalid or if the top left coordinate is south of the
- bottom right coordinate.
-
- Geo rectangles can never cross the poles.
-
- Several methods behave as though the geo rectangle is defined in terms of a
- center coordinate, the width of the geo rectangle in degrees and the height
- of the geo rectangle in degrees.
-
- If the height or center of a geo rectangle is adjusted such that it would
- cross one of the poles the height is modified such that the geo rectangle
- touches but does not cross the pole and that the center coordinate is still
- in the center of the geo rectangle.
-
- This class is a \l Q_GADGET since Qt 5.5. It can be
- \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
-*/
-
-/*!
- \property QGeoRectangle::bottomLeft
- \brief This property holds the bottom left coorindate of this geo rectangle.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoRectangle::bottomRight
- \brief This property holds the bottom right coordinate of this geo rectangle.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoRectangle::topLeft
- \brief This property holds the top left coordinate of this geo rectangle.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoRectangle::topRight
- \brief This property holds the top right coordinate of this geo rectangle.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoRectangle::center
- \brief This property holds the center of this geo rectangle.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \sa QGeoShape::center
-
- \since 5.5
-*/
-
-/*!
- \property QGeoRectangle::width
- \brief This property holds the width of this geo rectangle in degrees.
-
- The property value is undefined if this geo rectangle is invalid.
-
- If the new width is less than 0.0 or if this geo rectangle is invalid, this
- function does nothing. To set up the values of an invalid
- geo rectangle based on the center, width, and height, you should use
- \l setCenter() first to make the geo rectangle valid.
-
- 360.0 is the width used only if the new width is equal or greater than 360.
- In such cases the leftmost longitude of the geo rectangle is set to -180.0
- degrees and the rightmost longitude of the geo rectangle is set to 180.0
- degrees.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoRectangle::height
- \brief This property holds the height of this geo rectangle in degrees.
-
- The property value is undefined if this geo rectangle is invalid.
-
- If the new height is less than 0.0 or if this geo rectangle is invalid,
- the property is not changed. To set up the values of an invalid
- geo rectangle based on the center, width, and height, you should use
- \l setCenter() first to make the geo rectangle valid.
-
- If the change in height would cause the geo rectangle to cross a pole,
- the height is adjusted such that the geo rectangle only touches the pole.
-
- This change is done such that the center coordinate is still at the
- center of the geo rectangle, which may result in a geo rectangle with
- a smaller height than expected.
-
- 180.0 is the height used only if the new height is greater or equal than 180.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-inline QGeoRectanglePrivate *QGeoRectangle::d_func()
-{
- return static_cast<QGeoRectanglePrivate *>(d_ptr.data());
-}
-
-inline const QGeoRectanglePrivate *QGeoRectangle::d_func() const
-{
- return static_cast<const QGeoRectanglePrivate *>(d_ptr.constData());
-}
-
-struct RectangleVariantConversions
-{
- RectangleVariantConversions()
- {
- QMetaType::registerConverter<QGeoRectangle, QGeoShape>();
- QMetaType::registerConverter<QGeoShape, QGeoRectangle>();
- }
-};
-
-
-Q_GLOBAL_STATIC(RectangleVariantConversions, initRectangleConversions)
-
-/*!
- Constructs a new, invalid geo rectangle.
-*/
-QGeoRectangle::QGeoRectangle()
-: QGeoShape(new QGeoRectanglePrivate)
-{
- initRectangleConversions();
-}
-
-/*!
- Constructs a new geo rectangle centered at \a center with a
- width in degrees of \a degreesWidth and a height in degrees of \a degreesHeight.
-
- If \a degreesHeight would take the geo rectangle beyond one of the poles,
- the height of the geo rectangle will be truncated such that the geo rectangle
- only extends up to the pole. The center of the geo rectangle will be
- unchanged, and the height will be adjusted such that the center point is at
- the center of the truncated geo rectangle.
-*/
-QGeoRectangle::QGeoRectangle(const QGeoCoordinate &center, double degreesWidth, double degreesHeight)
-{
- initRectangleConversions();
- d_ptr = new QGeoRectanglePrivate(center, center);
- setWidth(degreesWidth);
- setHeight(degreesHeight);
-}
-
-/*!
- Constructs a new geo rectangle with a top left coordinate \a topLeft and a bottom right
- coordinate \a bottomRight.
-*/
-QGeoRectangle::QGeoRectangle(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight)
-{
- initRectangleConversions();
- d_ptr = new QGeoRectanglePrivate(topLeft, bottomRight);
-}
-
-/*!
- Constructs a new geo rectangle, of minimum size, containing all of the \a coordinates.
-*/
-QGeoRectangle::QGeoRectangle(const QList<QGeoCoordinate> &coordinates)
-{
- initRectangleConversions();
- if (coordinates.isEmpty()) {
- d_ptr = new QGeoRectanglePrivate;
- } else {
- const QGeoCoordinate &startCoordinate = coordinates.first();
- d_ptr = new QGeoRectanglePrivate(startCoordinate, startCoordinate);
-
- foreach (const QGeoCoordinate &coordinate, coordinates) {
- d_func()->extendRectangle(coordinate);
- }
- }
-}
-
-/*!
- Constructs a geo rectangle from the contents of \a other.
-*/
-QGeoRectangle::QGeoRectangle(const QGeoRectangle &other)
-: QGeoShape(other)
-{
- initRectangleConversions();
-}
-
-/*!
- Constructs a geo rectangle from the contents of \a other.
-*/
-QGeoRectangle::QGeoRectangle(const QGeoShape &other)
-: QGeoShape(other)
-{
- initRectangleConversions();
- if (type() != QGeoShape::RectangleType)
- d_ptr = new QGeoRectanglePrivate;
-}
-
-/*!
- Destroys this geo rectangle.
-*/
-QGeoRectangle::~QGeoRectangle()
-{
-}
-
-/*!
- Assigns \a other to this geo rectangle and returns a reference to this geo rectangle.
-*/
-QGeoRectangle &QGeoRectangle::operator=(const QGeoRectangle &other)
-{
- QGeoShape::operator=(other);
- return *this;
-}
-
-bool QGeoRectanglePrivate::isValid() const
-{
- return topLeft.isValid() && bottomRight.isValid() &&
- topLeft.latitude() >= bottomRight.latitude();
-}
-
-bool QGeoRectanglePrivate::isEmpty() const
-{
- if (!isValid())
- return true;
-
- return topLeft.latitude() == bottomRight.latitude() ||
- topLeft.longitude() == bottomRight.longitude();
-}
-
-/*!
- Sets the top left coordinate of this geo rectangle to \a topLeft.
-*/
-void QGeoRectangle::setTopLeft(const QGeoCoordinate &topLeft)
-{
- Q_D(QGeoRectangle);
-
- d->topLeft = topLeft;
-}
-
-/*!
- Returns the top left coordinate of this geo rectangle.
-*/
-QGeoCoordinate QGeoRectangle::topLeft() const
-{
- Q_D(const QGeoRectangle);
-
- return d->topLeft;
-}
-
-/*!
- Sets the top right coordinate of this geo rectangle to \a topRight.
-*/
-void QGeoRectangle::setTopRight(const QGeoCoordinate &topRight)
-{
- Q_D(QGeoRectangle);
-
- d->topLeft.setLatitude(topRight.latitude());
- d->bottomRight.setLongitude(topRight.longitude());
-}
-
-/*!
- Returns the top right coordinate of this geo rectangle.
-*/
-QGeoCoordinate QGeoRectangle::topRight() const
-{
- // TODO remove?
- if (!isValid())
- return QGeoCoordinate();
-
- Q_D(const QGeoRectangle);
-
- return QGeoCoordinate(d->topLeft.latitude(), d->bottomRight.longitude());
-}
-
-/*!
- Sets the bottom left coordinate of this geo rectangle to \a bottomLeft.
-*/
-void QGeoRectangle::setBottomLeft(const QGeoCoordinate &bottomLeft)
-{
- Q_D(QGeoRectangle);
-
- d->bottomRight.setLatitude(bottomLeft.latitude());
- d->topLeft.setLongitude(bottomLeft.longitude());
-}
-
-/*!
- Returns the bottom left coordinate of this geo rectangle.
-*/
-QGeoCoordinate QGeoRectangle::bottomLeft() const
-{
- // TODO remove?
- if (!isValid())
- return QGeoCoordinate();
-
- Q_D(const QGeoRectangle);
-
- return QGeoCoordinate(d->bottomRight.latitude(), d->topLeft.longitude());
-}
-
-/*!
- Sets the bottom right coordinate of this geo rectangle to \a bottomRight.
-*/
-void QGeoRectangle::setBottomRight(const QGeoCoordinate &bottomRight)
-{
- Q_D(QGeoRectangle);
-
- d->bottomRight = bottomRight;
-}
-
-/*!
- Returns the bottom right coordinate of this geo rectangle.
-*/
-QGeoCoordinate QGeoRectangle::bottomRight() const
-{
- Q_D(const QGeoRectangle);
-
- return d->bottomRight;
-}
-
-/*!
- Sets the center of this geo rectangle to \a center.
-
- If this causes the geo rectangle to cross on of the poles the height of the
- geo rectangle will be truncated such that the geo rectangle only extends up
- to the pole. The center of the geo rectangle will be unchanged, and the
- height will be adjusted such that the center point is at the center of the
- truncated geo rectangle.
-
-*/
-void QGeoRectangle::setCenter(const QGeoCoordinate &center)
-{
- Q_D(QGeoRectangle);
-
- if (!isValid()) {
- d->topLeft = center;
- d->bottomRight = center;
- return;
- }
- double width = this->width();
- double height = this->height();
-
- double tlLat = center.latitude() + height / 2.0;
- double tlLon = center.longitude() - width / 2.0;
- double brLat = center.latitude() - height / 2.0;
- double brLon = center.longitude() + width / 2.0;
- tlLon = QLocationUtils::wrapLong(tlLon);
- brLon = QLocationUtils::wrapLong(brLon);
-
- if (tlLat > 90.0) {
- brLat = 2 * center.latitude() - 90.0;
- tlLat = 90.0;
- }
-
- if (tlLat < -90.0) {
- brLat = -90.0;
- tlLat = -90.0;
- }
-
- if (brLat > 90.0) {
- tlLat = 90.0;
- brLat = 90.0;
- }
-
- if (brLat < -90.0) {
- tlLat = 2 * center.latitude() + 90.0;
- brLat = -90.0;
- }
-
- if (width == 360.0) {
- tlLon = -180.0;
- brLon = 180.0;
- }
-
- d->topLeft = QGeoCoordinate(tlLat, tlLon);
- d->bottomRight = QGeoCoordinate(brLat, brLon);
-}
-
-/*!
- Returns the center of this geo rectangle. Equivalent to QGeoShape::center().
-*/
-QGeoCoordinate QGeoRectangle::center() const
-{
- Q_D(const QGeoRectangle);
-
- return d->center();
-}
-
-/*!
- Sets the width of this geo rectangle in degrees to \a degreesWidth.
-*/
-void QGeoRectangle::setWidth(double degreesWidth)
-{
- if (!isValid())
- return;
-
- if (degreesWidth < 0.0)
- return;
-
- Q_D(QGeoRectangle);
-
- if (degreesWidth >= 360.0) {
- d->topLeft.setLongitude(-180.0);
- d->bottomRight.setLongitude(180.0);
- return;
- }
-
- double tlLat = d->topLeft.latitude();
- double brLat = d->bottomRight.latitude();
-
- QGeoCoordinate c = center();
-
- double tlLon = c.longitude() - degreesWidth / 2.0;
- tlLon = QLocationUtils::wrapLong(tlLon);
-
- double brLon = c.longitude() + degreesWidth / 2.0;
- brLon = QLocationUtils::wrapLong(brLon);
-
- d->topLeft = QGeoCoordinate(tlLat, tlLon);
- d->bottomRight = QGeoCoordinate(brLat, brLon);
-}
-
-/*!
- Returns the width of this geo rectangle in degrees.
-
- The return value is undefined if this geo rectangle is invalid.
-*/
-double QGeoRectangle::width() const
-{
- if (!isValid())
- return qQNaN();
-
- Q_D(const QGeoRectangle);
-
- double result = d->bottomRight.longitude() - d->topLeft.longitude();
- if (result < 0.0)
- result += 360.0;
- if (result > 360.0)
- result -= 360.0;
-
- return result;
-}
-
-/*!
- Sets the height of this geo rectangle in degrees to \a degreesHeight.
-*/
-void QGeoRectangle::setHeight(double degreesHeight)
-{
- if (!isValid())
- return;
-
- if (degreesHeight < 0.0)
- return;
-
- if (degreesHeight >= 180.0) {
- degreesHeight = 180.0;
- }
-
- Q_D(QGeoRectangle);
-
- double tlLon = d->topLeft.longitude();
- double brLon = d->bottomRight.longitude();
-
- QGeoCoordinate c = center();
-
- double tlLat = c.latitude() + degreesHeight / 2.0;
- double brLat = c.latitude() - degreesHeight / 2.0;
-
- if (tlLat > 90.0) {
- brLat = 2* c.latitude() - 90.0;
- tlLat = 90.0;
- }
-
- if (tlLat < -90.0) {
- brLat = -90.0;
- tlLat = -90.0;
- }
-
- if (brLat > 90.0) {
- tlLat = 90.0;
- brLat = 90.0;
- }
-
- if (brLat < -90.0) {
- tlLat = 2 * c.latitude() + 90.0;
- brLat = -90.0;
- }
-
- d->topLeft = QGeoCoordinate(tlLat, tlLon);
- d->bottomRight = QGeoCoordinate(brLat, brLon);
-}
-
-/*!
- Returns the height of this geo rectangle in degrees.
-
- The return value is undefined if this geo rectangle is invalid.
-*/
-double QGeoRectangle::height() const
-{
- if (!isValid())
- return qQNaN();
-
- Q_D(const QGeoRectangle);
-
- return d->topLeft.latitude() - d->bottomRight.latitude();
-}
-
-bool QGeoRectanglePrivate::contains(const QGeoCoordinate &coordinate) const
-{
- if (!isValid() || !coordinate.isValid())
- return false;
-
- double left = topLeft.longitude();
- double right = bottomRight.longitude();
- double top = topLeft.latitude();
- double bottom = bottomRight.latitude();
-
- double lon = coordinate.longitude();
- double lat = coordinate.latitude();
-
- if (lat > top)
- return false;
- if (lat < bottom)
- return false;
-
- if ((lat == 90.0) && (top == 90.0))
- return true;
-
- if ((lat == -90.0) && (bottom == -90.0))
- return true;
-
- if (left <= right) {
- if ((lon < left) || (lon > right))
- return false;
- } else {
- if ((lon < left) && (lon > right))
- return false;
- }
-
- return true;
-}
-
-QGeoCoordinate QGeoRectanglePrivate::center() const
-{
- if (!isValid())
- return QGeoCoordinate();
-
- double cLat = (topLeft.latitude() + bottomRight.latitude()) / 2.0;
- double cLon = (bottomRight.longitude() + topLeft.longitude()) / 2.0;
-
- if (topLeft.longitude() > bottomRight.longitude())
- cLon = cLon - 180.0;
-
- cLon = QLocationUtils::wrapLong(cLon);
- return QGeoCoordinate(cLat, cLon);
-}
-
-QGeoRectangle QGeoRectanglePrivate::boundingGeoRectangle() const
-{
- return QGeoRectangle(topLeft, bottomRight);
-}
-
-/*!
- Returns whether the geo rectangle \a rectangle is contained within this
- geo rectangle.
-*/
-bool QGeoRectangle::contains(const QGeoRectangle &rectangle) const
-{
- Q_D(const QGeoRectangle);
-
- return (d->contains(rectangle.topLeft())
- && d->contains(rectangle.topRight())
- && d->contains(rectangle.bottomLeft())
- && d->contains(rectangle.bottomRight()));
-}
-
-/*!
- Returns whether the geo rectangle \a rectangle intersects this geo rectangle.
-
- If the top or bottom edges of both geo rectangles are at one of the poles
- the geo rectangles are considered to be intersecting, since the longitude
- is irrelevant when the edges are at the pole.
-*/
-bool QGeoRectangle::intersects(const QGeoRectangle &rectangle) const
-{
- Q_D(const QGeoRectangle);
-
- double left1 = d->topLeft.longitude();
- double right1 = d->bottomRight.longitude();
- double top1 = d->topLeft.latitude();
- double bottom1 = d->bottomRight.latitude();
-
- double left2 = rectangle.d_func()->topLeft.longitude();
- double right2 = rectangle.d_func()->bottomRight.longitude();
- double top2 = rectangle.d_func()->topLeft.latitude();
- double bottom2 = rectangle.d_func()->bottomRight.latitude();
-
- if (top1 < bottom2)
- return false;
-
- if (bottom1 > top2)
- return false;
-
- if ((top1 == 90.0) && (top1 == top2))
- return true;
-
- if ((bottom1 == -90.0) && (bottom1 == bottom2))
- return true;
-
- if (left1 < right1) {
- if (left2 < right2) {
- if ((left1 > right2) || (right1 < left2))
- return false;
- } else {
- if ((left1 > right2) && (right1 < left2))
- return false;
- }
- } else {
- if (left2 < right2) {
- if ((left2 > right1) && (right2 < left1))
- return false;
- } else {
- // if both wrap then they have to intersect
- }
- }
-
- return true;
-}
-
-/*!
- Translates this geo rectangle by \a degreesLatitude northwards and \a
- degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-
- If the translation would have caused the geo rectangle to cross a pole the
- geo rectangle will be translated until the top or bottom edge of the geo rectangle
- touches the pole but not further.
-*/
-void QGeoRectangle::translate(double degreesLatitude, double degreesLongitude)
-{
- // TODO handle dlat, dlon larger than 360 degrees
-
- Q_D(QGeoRectangle);
-
- double tlLat = d->topLeft.latitude();
- double tlLon = d->topLeft.longitude();
- double brLat = d->bottomRight.latitude();
- double brLon = d->bottomRight.longitude();
-
- if (degreesLatitude >= 0.0)
- degreesLatitude = qMin(degreesLatitude, 90.0 - tlLat);
- else
- degreesLatitude = qMax(degreesLatitude, -90.0 - brLat);
-
- if ( (tlLon != -180.0) || (brLon != 180.0) ) {
- tlLon = QLocationUtils::wrapLong(tlLon + degreesLongitude);
- brLon = QLocationUtils::wrapLong(brLon + degreesLongitude);
- }
-
- tlLat += degreesLatitude;
- brLat += degreesLatitude;
-
- d->topLeft = QGeoCoordinate(tlLat, tlLon);
- d->bottomRight = QGeoCoordinate(brLat, brLon);
-}
-
-/*!
- Returns a copy of this geo rectangle translated by \a degreesLatitude northwards and \a
- degreesLongitude eastwards.
-
- Negative values of \a degreesLatitude and \a degreesLongitude correspond to
- southward and westward translation respectively.
-
- \sa translate()
-*/
-QGeoRectangle QGeoRectangle::translated(double degreesLatitude, double degreesLongitude) const
-{
- QGeoRectangle result(*this);
- result.translate(degreesLatitude, degreesLongitude);
- return result;
-}
-
-/*!
- Extends the geo rectangle to also cover the coordinate \a coordinate
-
- \since 5.9
-*/
-void QGeoRectangle::extendRectangle(const QGeoCoordinate &coordinate)
-{
- Q_D(QGeoRectangle);
- d->extendRectangle(coordinate);
-}
-
-/*!
- Returns the smallest geo rectangle which contains both this geo rectangle and \a rectangle.
-
- If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the
- width is set to 360.0 degrees with the leftmost longitude set to -180.0 degrees and the
- rightmost longitude set to 180.0 degrees. This is done to ensure that the result is
- independent of the order of the operands.
-
-*/
-QGeoRectangle QGeoRectangle::united(const QGeoRectangle &rectangle) const
-{
- QGeoRectangle result(*this);
- if (rectangle.isValid())
- result |= rectangle;
- return result;
-}
-
-/*!
- Extends the rectangle in the smallest possible way to include \a coordinate in
- the shape.
-
- Both the rectangle and coordinate needs to be valid. If the rectangle already covers
- the coordinate noting happens.
-
-*/
-void QGeoRectanglePrivate::extendRectangle(const QGeoCoordinate &coordinate)
-{
- if (!isValid() || !coordinate.isValid() || contains(coordinate))
- return;
-
- double left = topLeft.longitude();
- double right = bottomRight.longitude();
- double top = topLeft.latitude();
- double bottom = bottomRight.latitude();
-
- double inputLat = coordinate.latitude();
- double inputLon = coordinate.longitude();
-
- top = qMax(top, inputLat);
- bottom = qMin(bottom, inputLat);
-
- bool wrap = left > right;
-
- if (wrap && inputLon > right && inputLon < left) {
- if (qAbs(left - inputLon) < qAbs(right - inputLon))
- left = inputLon;
- else
- right = inputLon;
- } else if (!wrap) {
- if (inputLon < left) {
- if (360 - (right - inputLon) < left - inputLon)
- right = inputLon;
- else
- left = inputLon;
- } else if (inputLon > right) {
- if (360 - (inputLon - left) < inputLon - right)
- left = inputLon;
- else
- right = inputLon;
- }
- }
- topLeft = QGeoCoordinate(top, left);
- bottomRight = QGeoCoordinate(bottom, right);
-}
-
-/*!
- \fn QGeoRectangle QGeoRectangle::operator|(const QGeoRectangle &rectangle) const
-
- Returns the smallest geo rectangle which contains both this geo rectangle and \a rectangle.
-
- If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the
- width is set to 360.0 degrees with the leftmost longitude set to -180.0 degrees and the
- rightmost longitude set to 180.0 degrees. This is done to ensure that the result is
- independent of the order of the operands.
-
-*/
-
-/*!
- Returns the smallest geo rectangle which contains both this geo rectangle and \a rectangle.
-
- If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the
- width is set to 360.0 degrees with the leftmost longitude set to -180.0 degrees and the
- rightmost longitude set to 180.0 degrees. This is done to ensure that the result is
- independent of the order of the operands.
-
-*/
-QGeoRectangle &QGeoRectangle::operator|=(const QGeoRectangle &rectangle)
-{
- // If non-intersecting goes for most narrow box
-
- Q_D(QGeoRectangle);
-
- double left1 = d->topLeft.longitude();
- double right1 = d->bottomRight.longitude();
- double top1 = d->topLeft.latitude();
- double bottom1 = d->bottomRight.latitude();
-
- double left2 = rectangle.d_func()->topLeft.longitude();
- double right2 = rectangle.d_func()->bottomRight.longitude();
- double top2 = rectangle.d_func()->topLeft.latitude();
- double bottom2 = rectangle.d_func()->bottomRight.latitude();
-
- double top = qMax(top1, top2);
- double bottom = qMin(bottom1, bottom2);
-
- double left = 0.0;
- double right = 0.0;
-
- bool wrap1 = (left1 > right1);
- bool wrap2 = (left2 > right2);
-
- if ((wrap1 && wrap2) || (!wrap1 && !wrap2)) {
-
- double w = qAbs((left1 + right1 - left2 - right2) / 2.0);
-
- if (w < 180.0) {
- left = qMin(left1, left2);
- right = qMax(right1, right2);
- } else if (w > 180.0) {
- left = qMax(left1, left2);
- right = qMin(right1, right2);
- } else {
- left = -180.0;
- right = 180.0;
- }
-
- } else {
- double wrapLeft = 0.0;
- double wrapRight = 0.0;
- double nonWrapLeft = 0.0;
- double nonWrapRight = 0.0;
-
- if (wrap1) {
- wrapLeft = left1;
- wrapRight = right1;
- nonWrapLeft = left2;
- nonWrapRight = right2;
- } else {
- wrapLeft = left2;
- wrapRight = right2;
- nonWrapLeft = left1;
- nonWrapRight = right1;
- }
-
- bool joinWrapLeft = (nonWrapRight >= wrapLeft);
- bool joinWrapRight = (nonWrapLeft <= wrapRight);
-
- if (wrapLeft <= nonWrapLeft) { // The wrapping rectangle contains the non-wrapping one entirely
- left = wrapLeft;
- right = wrapRight;
- } else {
- if (joinWrapLeft) {
- if (joinWrapRight) {
- left = -180.0;
- right = 180.0;
- } else {
- left = nonWrapLeft;
- right = wrapRight;
- }
- } else {
- if (joinWrapRight) {
- left = wrapLeft;
- right = nonWrapRight;
- } else {
- double wrapRightDistance = nonWrapLeft - wrapRight;
- double wrapLeftDistance = wrapLeft - nonWrapRight;
-
- if (wrapLeftDistance == wrapRightDistance) {
- left = -180.0;
- right = 180.0;
- } else if (wrapLeftDistance < wrapRightDistance) {
- left = nonWrapLeft;
- right = wrapRight;
- } else {
- left = wrapLeft;
- right = nonWrapRight;
- }
- }
- }
- }
- }
-
- if (((left1 == -180) && (right1 == 180.0))
- || ((left2 == -180) && (right2 == 180.0))) {
- left = -180;
- right = 180;
- }
-
- d->topLeft = QGeoCoordinate(top, left);
- d->bottomRight = QGeoCoordinate(bottom, right);
-
- return *this;
-}
-
-/*!
- Returns the geo rectangle properties as a string.
-
- \since 5.5
-*/
-QString QGeoRectangle::toString() const
-{
- if (type() != QGeoShape::RectangleType) {
- qWarning("Not a rectangle a %d\n", type());
- return QStringLiteral("QGeoRectangle(not a rectangle)");
- }
-
- return QStringLiteral("QGeoRectangle({%1, %2}, {%3, %4})")
- .arg(topLeft().latitude())
- .arg(topLeft().longitude())
- .arg(bottomRight().latitude())
- .arg(bottomRight().longitude());
-}
-
-/*******************************************************************************
-*******************************************************************************/
-
-QGeoRectanglePrivate::QGeoRectanglePrivate()
-: QGeoShapePrivate(QGeoShape::RectangleType)
-{
-}
-
-QGeoRectanglePrivate::QGeoRectanglePrivate(const QGeoCoordinate &topLeft,
- const QGeoCoordinate &bottomRight)
-: QGeoShapePrivate(QGeoShape::RectangleType), topLeft(topLeft), bottomRight(bottomRight)
-{
-}
-
-QGeoRectanglePrivate::QGeoRectanglePrivate(const QGeoRectanglePrivate &other)
-: QGeoShapePrivate(QGeoShape::RectangleType), topLeft(other.topLeft),
- bottomRight(other.bottomRight)
-{
-}
-
-QGeoRectanglePrivate::~QGeoRectanglePrivate() {}
-
-QGeoShapePrivate *QGeoRectanglePrivate::clone() const
-{
- return new QGeoRectanglePrivate(*this);
-}
-
-bool QGeoRectanglePrivate::operator==(const QGeoShapePrivate &other) const
-{
- if (!QGeoShapePrivate::operator==(other))
- return false;
-
- const QGeoRectanglePrivate &otherBox = static_cast<const QGeoRectanglePrivate &>(other);
-
- return topLeft == otherBox.topLeft && bottomRight == otherBox.bottomRight;
-}
-
-size_t QGeoRectanglePrivate::hash(size_t seed) const
-{
- return qHashMulti(seed, topLeft, bottomRight);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/positioning/qgeorectangle.h b/src/positioning/qgeorectangle.h
deleted file mode 100644
index e900ccd4..00000000
--- a/src/positioning/qgeorectangle.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEORECTANGLE_H
-#define QGEORECTANGLE_H
-
-#include <QtPositioning/QGeoShape>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoRectanglePrivate;
-
-class Q_POSITIONING_EXPORT QGeoRectangle : public QGeoShape
-{
- Q_GADGET
- Q_PROPERTY(QGeoCoordinate bottomLeft READ bottomLeft WRITE setBottomLeft)
- Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight)
- Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft)
- Q_PROPERTY(QGeoCoordinate topRight READ topRight WRITE setTopRight)
- Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter)
- Q_PROPERTY(double height READ height WRITE setHeight)
- Q_PROPERTY(double width READ width WRITE setWidth)
-
-public:
- QGeoRectangle();
- QGeoRectangle(const QGeoCoordinate &center, double degreesWidth, double degreesHeight);
- QGeoRectangle(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight);
- QGeoRectangle(const QList<QGeoCoordinate> &coordinates);
- QGeoRectangle(const QGeoRectangle &other);
- QGeoRectangle(const QGeoShape &other);
-
- ~QGeoRectangle();
-
- QGeoRectangle &operator=(const QGeoRectangle &other);
-
- void setTopLeft(const QGeoCoordinate &topLeft);
- QGeoCoordinate topLeft() const;
-
- void setTopRight(const QGeoCoordinate &topRight);
- QGeoCoordinate topRight() const;
-
- void setBottomLeft(const QGeoCoordinate &bottomLeft);
- QGeoCoordinate bottomLeft() const;
-
- void setBottomRight(const QGeoCoordinate &bottomRight);
- QGeoCoordinate bottomRight() const;
-
- void setCenter(const QGeoCoordinate &center);
- QGeoCoordinate center() const;
-
- void setWidth(double degreesWidth);
- double width() const;
-
- void setHeight(double degreesHeight);
- double height() const;
-
- using QGeoShape::contains;
- bool contains(const QGeoRectangle &rectangle) const;
- Q_INVOKABLE bool intersects(const QGeoRectangle &rectangle) const;
-
- Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
- Q_INVOKABLE QGeoRectangle translated(double degreesLatitude, double degreesLongitude) const;
- Q_INVOKABLE void extendRectangle(const QGeoCoordinate &coordinate);
-
- Q_INVOKABLE QGeoRectangle united(const QGeoRectangle &rectangle) const;
- QGeoRectangle operator|(const QGeoRectangle &rectangle) const;
- QGeoRectangle &operator|=(const QGeoRectangle &rectangle);
-
- Q_INVOKABLE QString toString() const;
-
-private:
- inline QGeoRectanglePrivate *d_func();
- inline const QGeoRectanglePrivate *d_func() const;
-};
-
-Q_DECLARE_TYPEINFO(QGeoRectangle, Q_RELOCATABLE_TYPE);
-
-inline QGeoRectangle QGeoRectangle::operator|(const QGeoRectangle &rectangle) const
-{
- return united(rectangle);
-}
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoRectangle)
-
-#endif
diff --git a/src/positioning/qgeorectangle_p.h b/src/positioning/qgeorectangle_p.h
deleted file mode 100644
index 79a267f5..00000000
--- a/src/positioning/qgeorectangle_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEORECTANGLE_P_H
-#define QGEORECTANGLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qgeoshape_p.h"
-#include "qgeocoordinate.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGeoRectanglePrivate : public QGeoShapePrivate
-{
-public:
- QGeoRectanglePrivate();
- QGeoRectanglePrivate(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight);
- QGeoRectanglePrivate(const QGeoRectanglePrivate &other);
- ~QGeoRectanglePrivate();
-
- bool isValid() const override;
- bool isEmpty() const override;
- bool contains(const QGeoCoordinate &coordinate) const override;
-
- QGeoCoordinate center() const override;
-
- QGeoRectangle boundingGeoRectangle() const override;
-
- void extendRectangle(const QGeoCoordinate &coordinate);
-
- QGeoShapePrivate *clone() const override;
-
- bool operator==(const QGeoShapePrivate &other) const override;
-
- size_t hash(size_t seed) const override;
-
- QGeoCoordinate topLeft;
- QGeoCoordinate bottomRight;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeosatelliteinfo.cpp b/src/positioning/qgeosatelliteinfo.cpp
deleted file mode 100644
index f9f242fe..00000000
--- a/src/positioning/qgeosatelliteinfo.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qgeosatelliteinfo.h"
-#include "private/qgeosatelliteinfo_p.h"
-
-#include <QHash>
-#include <QDebug>
-#include <QDataStream>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoSatelliteInfo
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \ingroup shared
- \since 5.2
-
- \brief The QGeoSatelliteInfo class contains basic information about a satellite.
-
- \sa QGeoSatelliteInfoSource
-*/
-
-/*!
- \enum QGeoSatelliteInfo::Attribute
- Defines the attributes for the satellite information.
- \value Elevation The elevation of the satellite, in degrees.
- \value Azimuth The azimuth to true north, in degrees.
-*/
-
-/*!
- \enum QGeoSatelliteInfo::SatelliteSystem
- Defines the GNSS system of the satellite.
- \value Undefined Not defined.
- \value GPS Global Positioning System (USA).
- \value GLONASS Global Positioning System (Russia).
- \value GALILEO Global navigation satellite system (EU).
- \value BEIDOU BeiDou navigation satellite system (China).
- \value QZSS Quasi-Zenith Satellite System (Japan).
- \value Multiple This type normally indicates that the information is
- received from a device that supports multiple satellite systems, and
- the satellite system is not explicitly specified. Depending on the
- data source, you might use other information to determine the actual
- system type. One example of the usage of this type is an NMEA $GNGSA
- message, which contains the IDs of the satellites being used, but
- does not explicitly mention their system types.
- \value CustomType The first type that can be used for user purposes. For
- example when reimplementing NMEA data parsing in
- \l QNmeaSatelliteInfoSource. User can add more types using
- \c {CustomType + 1}, \c {CustomType + 2} and so on.
-*/
-
-/*!
- Creates a satellite information object.
-*/
-QGeoSatelliteInfo::QGeoSatelliteInfo()
- : d(new QGeoSatelliteInfoPrivate)
-{
- d->signal = -1;
- d->satId = -1;
- d->system = QGeoSatelliteInfo::Undefined;
-}
-
-/*!
- Creates a satellite information object with the values of \a other.
-*/
-
-QGeoSatelliteInfo::QGeoSatelliteInfo(const QGeoSatelliteInfo &other)
- : d(other.d)
-{
-}
-
-QGeoSatelliteInfo::QGeoSatelliteInfo(QGeoSatelliteInfoPrivate &dd) : d(&dd)
-{
-}
-
-/*!
- \fn QGeoSatelliteInfo::QGeoSatelliteInfo(QGeoSatelliteInfo &&other) noexcept
- \since 6.2
-
- Creates a satellite information object by moving from \a other.
-
- Note that a moved-from QGeoSatelliteInfo can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- Destroys a satellite information object.
-*/
-QGeoSatelliteInfo::~QGeoSatelliteInfo()
-{
-}
-
-QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QGeoSatelliteInfoPrivate)
-
-/*!
- Assigns the values from \a other to this object.
-*/
-QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(const QGeoSatelliteInfo & other)
-{
- if (this == &other)
- return *this;
-
- d = other.d;
- return *this;
-}
-
-/*!
- \fn QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(QGeoSatelliteInfo &&other) noexcept
- \since 6.2
-
- Move-assigns the value from \a other to this object
-
- Note that a moved-from QGeoSatelliteInfo can only be destroyed or
- assigned to. The effect of calling other functions than the destructor
- or one of the assignment operators is undefined.
-*/
-
-/*!
- \fn bool QGeoSatelliteInfo::operator==(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
-
- Returns \c true if all the parameters of the \a lhs satellite are the same
- as those of \a rhs. Otherwise returns \c false.
-*/
-
-/*!
- \fn bool QGeoSatelliteInfo::operator!=(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
-
- Returns \c true if any of the parameters of the \a lhs satellite are not
- the same as those of \a rhs. Otherwise returns \c false.
-*/
-
-/*!
- Sets the Satellite System (GPS, GLONASS, ...) to \a system.
-*/
-void QGeoSatelliteInfo::setSatelliteSystem(SatelliteSystem system)
-{
- d.detach();
- d->system = system;
-}
-
-/*!
- Returns the Satellite System (GPS, GLONASS, ...)
-
- \note This value can be used together with \l satelliteIdentifier()
- to uniquely identify a satellite.
-
- \sa satelliteIdentifier()
-*/
-QGeoSatelliteInfo::SatelliteSystem QGeoSatelliteInfo::satelliteSystem() const
-{
- return d->system;
-}
-
-/*!
- Sets the satellite identifier number to \a satId.
-
- The satellite identifier number can be used to identify a satellite within
- the satellite system.
-
- The actual value may vary, depending on the platform and the selected
- backend.
-
- For example, if \e nmea plugin is used, the satellite identifier for GPS
- satellite system represents the PRN (Pseudo-random noise) number, and the
- satellite identifier for GLONASS satellite system represents the slot
- number.
-*/
-void QGeoSatelliteInfo::setSatelliteIdentifier(int satId)
-{
- d.detach();
- d->satId = satId;
-}
-
-/*!
- Returns the satellite identifier number.
-
- The satellite identifier number can be used to identify a satellite within
- the satellite system.
-
- The actual value may vary, depending on the platform and the selected
- backend.
-
- For example, if \e nmea plugin is used, the satellite identifier for GPS
- satellite system represents the PRN (Pseudo-random noise) number, and the
- satellite identifier for GLONASS satellite system represents the slot
- number.
-
- For NMEA-based backends the satellite identifier can be used to determine
- the satellite system type if it is not available from other sources.
- You can refer to \l {https://gpsd.gitlab.io/gpsd/NMEA.html#_satellite_ids}
- {satellite IDs list} to check the ID ranges for different satellite systems.
-
- \note Depending on the platform and the selected backend, the satellite
- identifier ranges for different satellite systems may intersect. To uniquely
- identify a satellite, a combination of satelliteIndetifier() and
- \l satelliteSystem() must be used.
-
- \sa satelliteSystem()
-*/
-int QGeoSatelliteInfo::satelliteIdentifier() const
-{
- return d->satId;
-}
-
-/*!
- Sets the signal strength to \a signalStrength, in decibels.
-*/
-void QGeoSatelliteInfo::setSignalStrength(int signalStrength)
-{
- d.detach();
- d->signal = signalStrength;
-}
-
-/*!
- Returns the signal strength, or -1 if the value has not been set.
-*/
-int QGeoSatelliteInfo::signalStrength() const
-{
- return d->signal;
-}
-
-/*!
- Sets the value for \a attribute to \a value.
-*/
-void QGeoSatelliteInfo::setAttribute(Attribute attribute, qreal value)
-{
- d.detach();
- d->doubleAttribs[int(attribute)] = value;
-}
-
-/*!
- Returns the value of the specified \a attribute as a qreal value.
-
- Returns -1 if the value has not been set.
-
- \sa hasAttribute(), setAttribute()
-*/
-qreal QGeoSatelliteInfo::attribute(Attribute attribute) const
-{
- if (d->doubleAttribs.contains(int(attribute)))
- return d->doubleAttribs[int(attribute)];
- return -1;
-}
-
-/*!
- Removes the specified \a attribute and its value.
-*/
-void QGeoSatelliteInfo::removeAttribute(Attribute attribute)
-{
- d.detach();
- d->doubleAttribs.remove(int(attribute));
-}
-
-/*!
- Returns true if the specified \a attribute is present in this update.
-*/
-bool QGeoSatelliteInfo::hasAttribute(Attribute attribute) const
-{
- return d->doubleAttribs.contains(int(attribute));
-}
-
-/*!
- \internal
-*/
-void QGeoSatelliteInfo::detach()
-{
- if (d)
- d.detach();
- else
- d = new QGeoSatelliteInfoPrivate;
-}
-
-bool QGeoSatelliteInfo::equals(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
-{
- return *lhs.d == *rhs.d;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug QGeoSatelliteInfo::debugStreaming(QDebug dbg, const QGeoSatelliteInfo &info)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QGeoSatelliteInfo(system=" << info.d->system;
- dbg << ", satId=" << info.d->satId;
- dbg << ", signal-strength=" << info.d->signal;
-
-
- QList<int> attribs = info.d->doubleAttribs.keys();
- for (int i = 0; i < attribs.count(); ++i) {
- dbg << ", ";
- switch (attribs[i]) {
- case QGeoSatelliteInfo::Elevation:
- dbg << "Elevation=";
- break;
- case QGeoSatelliteInfo::Azimuth:
- dbg << "Azimuth=";
- break;
- }
- dbg << info.d->doubleAttribs[attribs[i]];
- }
- dbg << ')';
- return dbg;
-}
-#endif // QT_NO_DEBUG_STREAM
-
-#ifndef QT_NO_DATASTREAM
-/*!
- \fn QDataStream &QGeoSatelliteInfo::operator<<(QDataStream &stream, const QGeoSatelliteInfo &info)
-
- Writes the given \a info to the specified \a stream.
-
- \sa {Serializing Qt Data Types}
-
-*/
-
-QDataStream &QGeoSatelliteInfo::dataStreamOut(QDataStream &stream, const QGeoSatelliteInfo &info)
-{
- stream << info.d->signal;
- stream << info.d->doubleAttribs;
- stream << info.d->satId;
- stream << int(info.d->system);
- return stream;
-}
-#endif // QT_NO_DATASTREAM
-
-#ifndef QT_NO_DATASTREAM
-/*!
- \fn QDataStream &QGeoSatelliteInfo::operator>>(QDataStream &stream, QGeoSatelliteInfo &info)
-
- Reads satellite information from the specified \a stream into the given
- \a info.
-
- \sa {Serializing Qt Data Types}
-*/
-
-QDataStream &QGeoSatelliteInfo::dataStreamIn(QDataStream &stream, QGeoSatelliteInfo &info)
-{
- int system;
- stream >> info.d->signal;
- stream >> info.d->doubleAttribs;
- stream >> info.d->satId;
- stream >> system;
- info.d->system = (QGeoSatelliteInfo::SatelliteSystem)system;
- return stream;
-}
-#endif // QT_NO_DATASTREAM
-
-QGeoSatelliteInfoPrivate::QGeoSatelliteInfoPrivate() : QSharedData()
-{
-
-}
-
-QGeoSatelliteInfoPrivate::QGeoSatelliteInfoPrivate(const QGeoSatelliteInfoPrivate &other)
- : QSharedData(other)
-{
- signal = other.signal;
- satId = other.satId;
- system = other.system;
- doubleAttribs = other.doubleAttribs;
-}
-
-QGeoSatelliteInfoPrivate::~QGeoSatelliteInfoPrivate() {}
-
-bool QGeoSatelliteInfoPrivate::operator==(const QGeoSatelliteInfoPrivate &other) const
-{
- return signal == other.signal
- && satId == other.satId
- && system == other.system
- && doubleAttribs == other.doubleAttribs;
-}
-
-QGeoSatelliteInfoPrivate *QGeoSatelliteInfoPrivate::get(const QGeoSatelliteInfo &info)
-{
- return info.d.data();
-}
-
-size_t qHash(const QGeoSatelliteInfo &key, size_t seed) noexcept
-{
- // Other properties and attributes might change
- return qHashMulti(seed, key.d->satId, key.d->system);
-}
-
-namespace QTest
-{
-
-char *toString(const QGeoSatelliteInfo &info)
-{
- QString result;
- QDebug dbg(&result);
- dbg << info;
-
- return qstrdup(qPrintable(result));
-}
-
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeosatelliteinfo.h b/src/positioning/qgeosatelliteinfo.h
deleted file mode 100644
index cb4c7b25..00000000
--- a/src/positioning/qgeosatelliteinfo.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QGEOSATELLITEINFO_H
-#define QGEOSATELLITEINFO_H
-
-#include <QtPositioning/qpositioningglobal.h>
-#include <QtCore/QSharedData>
-#include <QtCore/QMetaType>
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-class QDebug;
-class QDataStream;
-
-class QGeoSatelliteInfo;
-Q_POSITIONING_EXPORT size_t qHash(const QGeoSatelliteInfo &key, size_t seed = 0) noexcept;
-namespace QTest
-{
-
-Q_POSITIONING_EXPORT char *toString(const QGeoSatelliteInfo &info);
-
-} // namespace QTest
-
-class QGeoSatelliteInfoPrivate;
-QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoSatelliteInfoPrivate, Q_POSITIONING_EXPORT)
-
-class Q_POSITIONING_EXPORT QGeoSatelliteInfo
-{
-public:
- enum Attribute {
- Elevation,
- Azimuth
- };
-
- enum SatelliteSystem {
- Undefined = 0x00,
- GPS = 0x01,
- GLONASS = 0x02,
- GALILEO = 0x03,
- BEIDOU = 0x04,
- QZSS = 0x05,
- Multiple = 0xFF,
- CustomType = 0x100
- };
-
- QGeoSatelliteInfo();
- QGeoSatelliteInfo(const QGeoSatelliteInfo &other);
- QGeoSatelliteInfo(QGeoSatelliteInfoPrivate &dd);
- QGeoSatelliteInfo(QGeoSatelliteInfo &&other) noexcept = default;
- ~QGeoSatelliteInfo();
-
- QGeoSatelliteInfo &operator=(const QGeoSatelliteInfo &other);
- QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGeoSatelliteInfo)
-
- void swap(QGeoSatelliteInfo &other) noexcept { d.swap(other.d); }
-
- friend bool operator==(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- void setSatelliteSystem(SatelliteSystem system);
- SatelliteSystem satelliteSystem() const;
-
- void setSatelliteIdentifier(int satId);
- int satelliteIdentifier() const;
-
- void setSignalStrength(int signalStrength);
- int signalStrength() const;
-
- void setAttribute(Attribute attribute, qreal value);
- qreal attribute(Attribute attribute) const;
- void removeAttribute(Attribute attribute);
-
- bool hasAttribute(Attribute attribute) const;
-
- void detach();
-
-private:
- static bool equals(const QGeoSatelliteInfo &lhs, const QGeoSatelliteInfo &rhs);
-#ifndef QT_NO_DEBUG_STREAM
- friend QDebug operator<<(QDebug dbg, const QGeoSatelliteInfo &info)
- {
- return debugStreaming(dbg, info);
- }
- static QDebug debugStreaming(QDebug dbg, const QGeoSatelliteInfo &info);
-#endif
-#ifndef QT_NO_DATASTREAM
- friend QDataStream &operator<<(QDataStream &stream, const QGeoSatelliteInfo &info)
- {
- return dataStreamOut(stream, info);
- }
- friend QDataStream &operator>>(QDataStream &stream, QGeoSatelliteInfo &info)
- {
- return dataStreamIn(stream, info);
- }
- static QDataStream &dataStreamOut(QDataStream &stream, const QGeoSatelliteInfo &info);
- static QDataStream &dataStreamIn(QDataStream &stream, QGeoSatelliteInfo &info);
-#endif
- QExplicitlySharedDataPointer<QGeoSatelliteInfoPrivate> d;
- friend class QGeoSatelliteInfoPrivate;
-
- friend Q_POSITIONING_EXPORT size_t qHash(const QGeoSatelliteInfo &key, size_t seed) noexcept;
- friend Q_POSITIONING_EXPORT char *QTest::toString(const QGeoSatelliteInfo &info);
-};
-
-Q_DECLARE_SHARED(QGeoSatelliteInfo)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoSatelliteInfo)
-
-#endif
diff --git a/src/positioning/qgeosatelliteinfo_p.h b/src/positioning/qgeosatelliteinfo_p.h
deleted file mode 100644
index 98da1caa..00000000
--- a/src/positioning/qgeosatelliteinfo_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOSATELLITEINFO_P_H
-#define QGEOSATELLITEINFO_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include <QtPositioning/qgeosatelliteinfo.h>
-#include <QHash>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoSatelliteInfoPrivate : public QSharedData
-{
-public:
- QGeoSatelliteInfoPrivate();
- QGeoSatelliteInfoPrivate(const QGeoSatelliteInfoPrivate &other);
- virtual ~QGeoSatelliteInfoPrivate();
- bool operator==(const QGeoSatelliteInfoPrivate &other) const;
- static QGeoSatelliteInfoPrivate *get(const QGeoSatelliteInfo &info);
-
- int signal;
- int satId;
- QGeoSatelliteInfo::SatelliteSystem system;
- QHash<int, qreal> doubleAttribs;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOSATELLITEINFO_P_H
diff --git a/src/positioning/qgeosatelliteinfosource.cpp b/src/positioning/qgeosatelliteinfosource.cpp
deleted file mode 100644
index b109e839..00000000
--- a/src/positioning/qgeosatelliteinfosource.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qgeosatelliteinfosource.h>
-#include <qgeosatelliteinfosource_p.h>
-#include "qgeopositioninfosourcefactory.h"
-#include "qgeopositioninfosource_p.h"
-#include <QPluginLoader>
-#include <QStringList>
-#include <QCryptographicHash>
-#include <QtCore/private/qfactoryloader_p.h>
-#include <QFile>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGeoSatelliteInfoSource
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoSatelliteInfoSource class is an abstract base class for the distribution of satellite information updates.
-
- The static function QGeoSatelliteInfoSource::createDefaultSource() creates a default
- satellite data source that is appropriate for the platform, if one is
- available. Otherwise, available QGeoPositionInfoSourceFactory plugins will
- be checked for one that has a satellite data source available.
-
- Call startUpdates() and stopUpdates() to start and stop regular updates,
- or requestUpdate() to request a single update.
- When an update is available, satellitesInViewUpdated() and/or
- satellitesInUseUpdated() will be emitted.
-
- If regular satellite updates are required, setUpdateInterval() can be used
- to specify how often these updates should be emitted. If no interval is
- specified, updates are simply provided whenever they are available.
- For example:
-
- \code
- // Emit updates every 10 seconds if available
- QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(0);
- if (source)
- source->setUpdateInterval(10000);
- \endcode
-
- To remove an update interval that was previously set, call
- setUpdateInterval() with a value of 0.
-
- \note The satellite source may have a minimum value requirement for
- update intervals, as returned by minimumUpdateInterval().
-
- \note To use this class from Android service, see
- \l {Qt Positioning on Android}.
-*/
-
-/*!
- Creates a satellite source with the specified \a parent.
-*/
-
-QGeoSatelliteInfoSourcePrivate::~QGeoSatelliteInfoSourcePrivate()
-{
-
-}
-
-QGeoSatelliteInfoSource::QGeoSatelliteInfoSource(QObject *parent)
- : QObject(*new QGeoSatelliteInfoSourcePrivate, parent)
-{
-}
-
-QGeoSatelliteInfoSource::QGeoSatelliteInfoSource(QGeoSatelliteInfoSourcePrivate &dd, QObject *parent)
- : QObject(dd, parent)
-{
-
-}
-
-/*!
- Destroys the satellite source.
-*/
-QGeoSatelliteInfoSource::~QGeoSatelliteInfoSource()
-{
-}
-
-/*!
- Returns the unique name of the satellite source implementation in use.
-
- This is the same name that can be passed to createSource() in order to
- create a new instance of a particular satellite source implementation.
-*/
-QString QGeoSatelliteInfoSource::sourceName() const
-{
- Q_D(const QGeoSatelliteInfoSource);
- return d->providerName;
-}
-
-
-/*!
- \property QGeoSatelliteInfoSource::updateInterval
- \brief This property holds the requested interval in milliseconds between each update.
-
- If the update interval is not set (or is set to 0) the
- source will provide updates as often as necessary.
-
- If the update interval is set, the source will provide updates at an
- interval as close to the requested interval as possible. If the requested
- interval is less than the minimumUpdateInterval(),
- the minimum interval is used instead.
-
- Changes to the update interval will happen as soon as is practical, however the
- time the change takes may vary between implementations. Whether or not the elapsed
- time from the previous interval is counted as part of the new interval is also
- implementation dependent.
-
- The default value for this property is 0.
-
- \note Subclass implementations must call the base implementation of
- setUpdateInterval() so that updateInterval() returns the correct value.
-*/
-void QGeoSatelliteInfoSource::setUpdateInterval(int msec)
-{
- Q_D(QGeoSatelliteInfoSource);
- d->interval = msec;
-}
-
-int QGeoSatelliteInfoSource::updateInterval() const
-{
- Q_D(const QGeoSatelliteInfoSource);
- return d->interval.value();
-}
-
-QBindable<int> QGeoSatelliteInfoSource::bindableUpdateInterval()
-{
- Q_D(QGeoSatelliteInfoSource);
- return QBindable<int>(&d->interval);
-}
-
-/*!
- \since 6.2
- Sets the backend-specific property named \a name to \a value.
- Returns \c true on success, \c false otherwise.
- Backend-specific properties can be used to configure the satellite info
- subsystem behavior at runtime.
-
- \sa backendProperty
-*/
-bool QGeoSatelliteInfoSource::setBackendProperty(const QString &name, const QVariant &value)
-{
- Q_UNUSED(name)
- Q_UNUSED(value)
- return false;
-}
-
-/*!
- \since 6.2
- Returns the value of the backend-specific property named \a name,
- if present. Otherwise the returned value will be invalid.
-
- \sa setBackendProperty
-*/
-QVariant QGeoSatelliteInfoSource::backendProperty(const QString &name) const
-{
- Q_UNUSED(name)
- return QVariant();
-}
-
-QGeoSatelliteInfoSource *QGeoSatelliteInfoSourcePrivate::createSourceReal(const QJsonObject &meta, const QVariantMap &parameters, QObject *parent)
-{
- QGeoSatelliteInfoSource *s = nullptr;
- auto factory = QGeoPositionInfoSourcePrivate::loadFactory(meta);
- if (factory)
- s = factory->satelliteInfoSource(parent, parameters);
- if (s)
- s->d_func()->providerName = meta.value(QStringLiteral("Provider")).toString();
-
- return s;
-}
-
-/*!
- Creates and returns a source with the specified \a parent that reads
- from the system's default source of satellite update information, or the
- highest priority available plugin.
-
- Returns \c nullptr if the system has no default satellite source, no valid
- plugins could be found or the user does not have the permission to access
- the satellite data.
-*/
-QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
-{
- return createDefaultSource(QVariantMap(), parent);
-}
-
-/*!
- Creates and returns a source with the given \a parent,
- by loading the plugin named \a sourceName.
-
- Returns \c nullptr if the plugin cannot be found.
-*/
-QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &sourceName, QObject *parent)
-{
- return createSource(sourceName, QVariantMap(), parent);
-}
-
-/*!
- Creates and returns a satellite source with the given \a parent that
- reads from the system's default sources of satellite data, or the plugin
- with the highest available priority.
-
- Returns \c nullptr if the system has no default satellite source, no valid
- plugins could be found or the user does not have the permission to access
- the satellite information.
-
- This method passes \a parameters to the factory to configure the source.
-
- \since Qt 5.14
-*/
-QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(const QVariantMap &parameters, QObject *parent)
-{
- QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
- foreach (const QJsonObject &obj, plugins) {
- if (obj.value(QStringLiteral("Satellite")).isBool()
- && obj.value(QStringLiteral("Satellite")).toBool())
- {
- const QString testableKey = QStringLiteral("Testable");
- if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
- static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
- if (inTest)
- continue;
- }
- return QGeoSatelliteInfoSourcePrivate::createSourceReal(obj, parameters, parent);
- }
- }
-
- return nullptr;
-}
-
-/*!
- Creates and returns a satellite source with the given \a parent,
- by loading the plugin named \a sourceName.
-
- Returns \c nullptr if the plugin cannot be found.
-
- This method passes \a parameters to the factory to configure the source.
-
- \since Qt 5.14
-*/
-QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &sourceName, const QVariantMap &parameters, QObject *parent)
-{
- auto plugins = QGeoPositionInfoSourcePrivate::plugins();
- if (plugins.contains(sourceName))
- return QGeoSatelliteInfoSourcePrivate::createSourceReal(plugins.value(sourceName), parameters, parent);
- return nullptr;
-}
-
-/*!
- Returns a list of available source plugins, including the default system
- backend if one is available.
-*/
-QStringList QGeoSatelliteInfoSource::availableSources()
-{
- QStringList plugins;
- const auto meta = QGeoPositionInfoSourcePrivate::plugins();
- for (auto it = meta.cbegin(), end = meta.cend(); it != end; ++it) {
- if (it.value().value(QStringLiteral("Satellite")).isBool()
- && it.value().value(QStringLiteral("Satellite")).toBool()) {
- plugins << it.key();
- }
- }
-
- return plugins;
-}
-
-/*!
- \fn void QGeoSatelliteInfoSource::satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites);
-
- If startUpdates() or requestUpdate() is called, this signal is emitted
- when an update is available on the satellites that are
- currently in view.
-
- The \a satellites parameter holds the satellites currently in view.
-*/
-
-/*!
- \fn void QGeoSatelliteInfoSource::satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites);
-
- If startUpdates() or requestUpdate() is called, this signal is emitted
- when an update is available on the number of satellites that are
- currently in use.
-
- These are the satellites that are used to get a "fix" - that
- is, those used to determine the current position.
-
- The \a satellites parameter holds the satellites currently in use.
-*/
-
-/*!
- \property QGeoSatelliteInfoSource::minimumUpdateInterval
- \brief This property holds the minimum time (in milliseconds) required to retrieve a satellite update.
-
- This is the minimum value accepted by setUpdateInterval() and
- requestUpdate().
-*/
-
-
-/*!
- \fn virtual void QGeoSatelliteInfoSource::startUpdates() = 0;
-
- Starts emitting updates at regular intervals. The updates will be
- provided whenever new satellite information becomes available.
-
- If satellite information cannot be retrieved or some other
- form of timeout has occurred the satellitesInViewUpdated()
- and satellitesInUseUpdated() signals may be emitted with
- empty parameter lists.
-
- \note Since Qt6 this method always resets the last error to
- \l {QGeoSatelliteInfoSource::}{NoError} before starting
- the updates.
-
- \note To understand how to use this method from an Android service, see
- \l {Qt Positioning on Android}.
-
- \sa satellitesInViewUpdated(), satellitesInUseUpdated()
-*/
-
-/*!
- \fn virtual void QGeoSatelliteInfoSource::stopUpdates() = 0;
-
- Stops emitting updates at regular intervals.
-*/
-
-/*!
- \fn virtual void QGeoSatelliteInfoSource::requestUpdate(int timeout = 0);
-
- Attempts to get the current satellite information and emit
- satellitesInViewUpdated() and satellitesInUseUpdated() with this
- information. If the current satellite information cannot be found
- within the given \a timeout (in milliseconds) or if \a timeout is less than
- the value returned by minimumUpdateInterval(), an errorOccurred() signal
- with \l {QGeoSatelliteInfoSource::UpdateTimeoutError}
- {UpdateTimeoutError} is emitted.
-
- If the timeout is zero, the timeout defaults to a reasonable timeout
- period as appropriate for the source.
-
- This does nothing if another update request is in progress. However
- it can be called even if startUpdates() has already been called and
- regular updates are in progress.
-
- \note Since Qt6 this method always resets the last error to
- \l {QGeoSatelliteInfoSource::}{NoError} before requesting
- the satellite information.
-
- \note To understand how to use this method from an Android service, see
- \l {Qt Positioning on Android}.
-*/
-
-/*!
- \fn QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSource::error() const = 0
-
- Returns the last error that occurred.
-
- \note Since Qt6 the last error is always reset when calling startUpdates()
- or requestUpdate().
-*/
-
-/*!
- \fn void QGeoSatelliteInfoSource::errorOccurred(QGeoSatelliteInfoSource::Error satelliteError)
-
- This signal is emitted after an error occurred. The \a satelliteError
- parameter describes the type of error that occurred.
-*/
-
-/*!
- \enum QGeoSatelliteInfoSource::Error
-
- The Error enumeration represents the errors which can occur.
-
- \value AccessError The connection setup to the satellite backend failed because the
- application lacked the required privileges.
- \value ClosedError The satellite backend closed the connection, which happens for example in case
- the user is switching location services to off. This object becomes invalid and should be deleted.
- A new satellite source can be created by calling createDefaultSource() later on.
- \value NoError No error has occurred.
- \value UnknownSourceError An unidentified error occurred.
- \value UpdateTimeoutError The current satellite information could not be
- retrieved within the specified timeout.
- */
-
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qgeosatelliteinfosource.h b/src/positioning/qgeosatelliteinfosource.h
deleted file mode 100644
index 9d6603bb..00000000
--- a/src/positioning/qgeosatelliteinfosource.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QGEOSATELLITEINFOSOURCE_H
-#define QGEOSATELLITEINFOSOURCE_H
-
-#include <QtPositioning/QGeoSatelliteInfo>
-
-#include <QtCore/QObject>
-#include <QtCore/QList>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoSatelliteInfoSourcePrivate;
-class Q_POSITIONING_EXPORT QGeoSatelliteInfoSource : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval BINDABLE
- bindableUpdateInterval)
- Q_PROPERTY(int minimumUpdateInterval READ minimumUpdateInterval)
-
-public:
- enum Error {
- AccessError = 0,
- ClosedError = 1,
- NoError = 2,
- UnknownSourceError = -1,
- UpdateTimeoutError = 3,
- };
- Q_ENUM(Error)
-
- explicit QGeoSatelliteInfoSource(QObject *parent);
- virtual ~QGeoSatelliteInfoSource();
-
- static QGeoSatelliteInfoSource *createDefaultSource(QObject *parent);
- static QGeoSatelliteInfoSource *createSource(const QString &sourceName, QObject *parent);
- static QGeoSatelliteInfoSource *createDefaultSource(const QVariantMap &parameters, QObject *parent);
- static QGeoSatelliteInfoSource *createSource(const QString &sourceName, const QVariantMap &parameters, QObject *parent);
- static QStringList availableSources();
-
- QString sourceName() const;
-
- virtual void setUpdateInterval(int msec);
- int updateInterval() const;
- QBindable<int> bindableUpdateInterval();
-
- virtual int minimumUpdateInterval() const = 0;
- virtual Error error() const = 0;
-
- virtual bool setBackendProperty(const QString &name, const QVariant &value);
- virtual QVariant backendProperty(const QString &name) const;
-
-public Q_SLOTS:
- virtual void startUpdates() = 0;
- virtual void stopUpdates() = 0;
-
- virtual void requestUpdate(int timeout = 0) = 0;
-
-Q_SIGNALS:
- void satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites);
- void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites);
- void errorOccurred(QGeoSatelliteInfoSource::Error);
-
-protected:
- explicit QGeoSatelliteInfoSource(QGeoSatelliteInfoSourcePrivate &dd, QObject *parent);
-
-private:
- Q_DISABLE_COPY(QGeoSatelliteInfoSource)
- Q_DECLARE_PRIVATE(QGeoSatelliteInfoSource)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qgeosatelliteinfosource_p.h b/src/positioning/qgeosatelliteinfosource_p.h
deleted file mode 100644
index 48eb6be1..00000000
--- a/src/positioning/qgeosatelliteinfosource_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOSATELLITEINFOSOURCE_P_H
-#define QGEOSATELLITEINFOSOURCE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/private/qobject_p.h>
-#include <QtPositioning/private/qpositioningglobal_p.h>
-#include <QString>
-
-QT_BEGIN_NAMESPACE
-class QGeoSatelliteInfoSource;
-class QGeoSatelliteInfoSourcePrivate : public QObjectPrivate
-{
-public:
- virtual ~QGeoSatelliteInfoSourcePrivate();
- static QGeoSatelliteInfoSource *createSourceReal(const QJsonObject &meta,
- const QVariantMap &parameters,
- QObject *parent);
- Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QGeoSatelliteInfoSourcePrivate, int, interval, 0)
- QString providerName;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOSATELLITEINFOSOURCE_P_H
diff --git a/src/positioning/qgeoshape.cpp b/src/positioning/qgeoshape.cpp
deleted file mode 100644
index 7ab32b60..00000000
--- a/src/positioning/qgeoshape.cpp
+++ /dev/null
@@ -1,449 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeoshape.h"
-#include "qgeoshape_p.h"
-#include "qgeorectangle.h"
-#include "qgeocircle.h"
-#include "qgeopath.h"
-#include "qgeopolygon.h"
-
-
-#ifndef QT_NO_DEBUG_STREAM
-#include <QtCore/QDebug>
-#endif
-
-#ifndef QT_NO_DATASTREAM
-#include <QtCore/QDataStream>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QGeoShapePrivate::QGeoShapePrivate(QGeoShape::ShapeType type)
-: type(type)
-{
-}
-
-QGeoShapePrivate::~QGeoShapePrivate()
-{
-}
-
-bool QGeoShapePrivate::operator==(const QGeoShapePrivate &other) const
-{
- return type == other.type;
-}
-
-/*!
- \class QGeoShape
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QGeoShape class defines a geographic area.
-
- This class is the base class for classes which specify a geographic
- area.
-
- For the sake of consistency, subclasses should describe the specific
- details of the associated areas in terms of QGeoCoordinate instances
- and distances in meters.
-
- This class is a \l Q_GADGET since Qt 5.5. It can be
- \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
-*/
-
-/*!
- \enum QGeoShape::ShapeType
-
- Describes the type of the shape.
-
- \value UnknownType A shape of unknown type
- \value RectangleType A rectangular shape
- \value CircleType A circular shape
- \value PathType A path type
- \value PolygonType A polygon type
-*/
-
-/*!
- \property QGeoShape::type
- \brief This property holds the type of this geo shape.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoShape::isValid
- \brief This property holds the validity of the geo shape.
-
- A geo shape is considered to be invalid if some of the data that is required to
- unambiguously describe the geo shape has not been set or has been set to an
- unsuitable value depending on the subclass of this object. The default constructed
- objects of this type are invalid.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-
-/*!
- \property QGeoShape::isEmpty
- \brief This property defines whether this geo shape is empty.
-
- An empty geo shape is a region which has a geometrical area of 0.
-
- While this property is introduced in Qt 5.5, the related accessor functions
- exist since the first version of this class.
-
- \since 5.5
-*/
-inline QGeoShapePrivate *QGeoShape::d_func()
-{
- return static_cast<QGeoShapePrivate *>(d_ptr.data());
-}
-
-inline const QGeoShapePrivate *QGeoShape::d_func() const
-{
- return static_cast<const QGeoShapePrivate *>(d_ptr.constData());
-}
-
-/*!
- Constructs a new invalid geo shape of \l UnknownType.
-*/
-QGeoShape::QGeoShape()
-{
-}
-
-/*!
- Constructs a new geo shape which is a copy of \a other.
-*/
-QGeoShape::QGeoShape(const QGeoShape &other)
-: d_ptr(other.d_ptr)
-{
-}
-
-/*!
- \internal
-*/
-QGeoShape::QGeoShape(QGeoShapePrivate *d)
-: d_ptr(d)
-{
-}
-
-bool QGeoShape::equals(const QGeoShape &lhs, const QGeoShape &rhs)
-{
- if (lhs.d_func() == rhs.d_func())
- return true;
-
- if (!lhs.d_func() || !rhs.d_func())
- return false;
-
- return *lhs.d_func() == *rhs.d_func();
-}
-
-/*!
- Destroys this geo shape.
-*/
-QGeoShape::~QGeoShape()
-{
-}
-
-/*!
- Returns the type of this geo shape.
-*/
-QGeoShape::ShapeType QGeoShape::type() const
-{
- Q_D(const QGeoShape);
-
- if (d)
- return d->type;
- else
- return UnknownType;
-}
-
-/*!
- Returns whether this geo shape is valid.
-
-*/
-bool QGeoShape::isValid() const
-{
- Q_D(const QGeoShape);
-
- if (d)
- return d->isValid();
- else
- return false;
-}
-
-/*!
- Returns whether this geo shape is empty.
-
- An empty geo shape is a region which has a geometrical area of 0.
-*/
-bool QGeoShape::isEmpty() const
-{
- Q_D(const QGeoShape);
-
- if (d)
- return d->isEmpty();
- else
- return true;
-}
-
-/*!
- Returns whether the coordinate \a coordinate is contained within this geo shape.
-*/
-bool QGeoShape::contains(const QGeoCoordinate &coordinate) const
-{
- Q_D(const QGeoShape);
-
- if (d)
- return d->contains(coordinate);
- else
- return false;
-}
-
-/*!
- Returns a QGeoRectangle representing the geographical bounding rectangle of the
- geo shape, that defines the latitudinal/longitudinal bounds of the geo shape.
-
- \since 5.9
-*/
-QGeoRectangle QGeoShape::boundingGeoRectangle() const
-{
- Q_D(const QGeoShape);
-
- if (d)
- return d->boundingGeoRectangle();
- else
- return QGeoRectangle();
-}
-
-/*!
- Returns the coordinate located at the geometric center of the geo shape.
-
- \since 5.5
-*/
-QGeoCoordinate QGeoShape::center() const
-{
- Q_D(const QGeoShape);
-
- if (d)
- return d->center();
- else
- return QGeoCoordinate();
-}
-
-/*!
- \fn bool QGeoShape::operator==(const QGeoShape &lhs, const QGeoShape &rhs)
-
- Returns \c true if the \a lhs geo shape is equivalent to the \a rhs geo
- shape, otherwise returns \c false.
-*/
-
-/*!
- \fn bool QGeoShape::operator!=(const QGeoShape &lhs, const QGeoShape &rhs)
-
- Returns \c true if the \a lhs geo shape is not equivalent to the \a rhs geo
- shape, otherwise returns \c false.
-*/
-
-/*!
- Assigns \a other to this geo shape and returns a reference to this geo shape.
-*/
-QGeoShape &QGeoShape::operator=(const QGeoShape &other)
-{
- if (this == &other)
- return *this;
-
- d_ptr = other.d_ptr;
- return *this;
-}
-
-/*!
- Returns a string representation of this geo shape.
-
- \since 5.5
-*/
-QString QGeoShape::toString() const
-{
- return QStringLiteral("QGeoShape(%1)").arg(type());
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug QGeoShape::debugStreaming(QDebug dbg, const QGeoShape &shape)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QGeoShape(";
- switch (shape.type()) {
- case QGeoShape::UnknownType:
- dbg << "Unknown";
- break;
- case QGeoShape::RectangleType:
- dbg << "Rectangle";
- break;
- case QGeoShape::PathType:
- dbg << "Path";
- break;
- case QGeoShape::PolygonType:
- dbg << "Polygon";
- break;
- case QGeoShape::CircleType:
- dbg << "Circle";
- }
-
- dbg << ')';
-
- return dbg;
-}
-#endif
-
-#ifndef QT_NO_DATASTREAM
-QDataStream &QGeoShape::dataStreamOut(QDataStream &stream, const QGeoShape &shape)
-{
- stream << quint32(shape.type());
- switch (shape.type()) {
- case QGeoShape::UnknownType:
- break;
- case QGeoShape::RectangleType: {
- QGeoRectangle r = shape;
- stream << r.topLeft() << r.bottomRight();
- break;
- }
- case QGeoShape::CircleType: {
- QGeoCircle c = shape;
- stream << c.center() << c.radius();
- break;
- }
- case QGeoShape::PathType: {
- QGeoPath p = shape;
- stream << p.width();
- stream << p.path().size();
- for (const auto &c: p.path())
- stream << c;
- break;
- }
- case QGeoShape::PolygonType: {
- QGeoPolygon p = shape;
- stream << p.perimeter().size();
- for (const auto &c: p.perimeter())
- stream << c;
- break;
- }
- }
-
- return stream;
-}
-
-QDataStream &QGeoShape::dataStreamIn(QDataStream &stream, QGeoShape &shape)
-{
- quint32 type;
- stream >> type;
-
- switch (type) {
- case QGeoShape::UnknownType:
- shape = QGeoShape();
- break;
- case QGeoShape::RectangleType: {
- QGeoCoordinate tl;
- QGeoCoordinate br;
- stream >> tl >> br;
- shape = QGeoRectangle(tl, br);
- break;
- }
- case QGeoShape::CircleType: {
- QGeoCoordinate c;
- qreal r;
- stream >> c >> r;
- shape = QGeoCircle(c, r);
- break;
- }
- case QGeoShape::PathType: {
- QList<QGeoCoordinate> l;
- QGeoCoordinate c;
- qreal width;
- stream >> width;
- qsizetype sz;
- stream >> sz;
- for (qsizetype i = 0; i < sz; i++) {
- stream >> c;
- l.append(c);
- }
- shape = QGeoPath(l, width);
- break;
- }
- case QGeoShape::PolygonType: {
- QList<QGeoCoordinate> l;
- QGeoCoordinate c;
- qsizetype sz;
- stream >> sz;
- for (qsizetype i = 0; i < sz; i++) {
- stream >> c;
- l.append(c);
- }
- shape = QGeoPolygon(l);
- break;
- }
- }
-
- return stream;
-}
-#endif
-
-/*!
- \relates QGeoShape
-
- Returns the hash value for the \a shape, using \a seed for the
- calculation.
-*/
-size_t qHash(const QGeoShape &shape, size_t seed) noexcept
-{
- if (shape.d_ptr)
- return shape.d_ptr->hash(seed);
- else
- return qHashMulti(seed, shape.type());
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qgeoshape.cpp"
-
diff --git a/src/positioning/qgeoshape.h b/src/positioning/qgeoshape.h
deleted file mode 100644
index f2a9166c..00000000
--- a/src/positioning/qgeoshape.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOSHAPE_H
-#define QGEOSHAPE_H
-
-#include <QtCore/QSharedDataPointer>
-#include <QtPositioning/QGeoCoordinate>
-
-QT_BEGIN_NAMESPACE
-
-class QDebug;
-class QGeoShapePrivate;
-class QGeoRectangle;
-
-class Q_POSITIONING_EXPORT QGeoShape
-{
- Q_GADGET
- Q_PROPERTY(ShapeType type READ type)
- Q_PROPERTY(bool isValid READ isValid)
- Q_PROPERTY(bool isEmpty READ isEmpty)
- Q_PROPERTY(QGeoCoordinate center READ center)
- Q_ENUMS(ShapeType)
-
-public:
- QGeoShape();
- QGeoShape(const QGeoShape &other);
- ~QGeoShape();
-
- enum ShapeType {
- UnknownType,
- RectangleType,
- CircleType,
- PathType,
- PolygonType
- };
-
- ShapeType type() const;
-
- bool isValid() const;
- bool isEmpty() const;
- Q_INVOKABLE bool contains(const QGeoCoordinate &coordinate) const;
- Q_INVOKABLE QGeoRectangle boundingGeoRectangle() const;
- QGeoCoordinate center() const;
-
- friend bool operator==(const QGeoShape &lhs, const QGeoShape &rhs)
- {
- return equals(lhs, rhs);
- }
- friend bool operator!=(const QGeoShape &lhs, const QGeoShape &rhs)
- {
- return !equals(lhs, rhs);
- }
-
- QGeoShape &operator=(const QGeoShape &other);
-
- Q_INVOKABLE QString toString() const;
-protected:
- QGeoShape(QGeoShapePrivate *d);
-
- QSharedDataPointer<QGeoShapePrivate> d_ptr;
-
-private:
- static bool equals(const QGeoShape &lhs, const QGeoShape &rhs);
- inline QGeoShapePrivate *d_func();
- inline const QGeoShapePrivate *d_func() const;
-#ifndef QT_NO_DEBUG_STREAM
- friend QDebug operator<<(QDebug dbg, const QGeoShape &shape)
- {
- return debugStreaming(dbg, shape);
- }
- static QDebug debugStreaming(QDebug dbg, const QGeoShape &shape);
-#endif
-#ifndef QT_NO_DATASTREAM
- friend QDataStream &operator<<(QDataStream &stream, const QGeoShape &shape)
- {
- return dataStreamOut(stream, shape);
- }
- friend QDataStream &operator>>(QDataStream &stream, QGeoShape &shape)
- {
- return dataStreamIn(stream, shape);
- }
- static QDataStream &dataStreamOut(QDataStream &stream, const QGeoShape &shape);
- static QDataStream &dataStreamIn(QDataStream &stream, QGeoShape &shape);
-#endif
- friend Q_POSITIONING_EXPORT size_t qHash(const QGeoShape &key, size_t seed) noexcept;
-};
-
-Q_POSITIONING_EXPORT size_t qHash(const QGeoShape &shape, size_t seed = 0) noexcept;
-
-Q_DECLARE_TYPEINFO(QGeoShape, Q_RELOCATABLE_TYPE);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoShape)
-
-#endif
diff --git a/src/positioning/qgeoshape_p.h b/src/positioning/qgeoshape_p.h
deleted file mode 100644
index 94551c89..00000000
--- a/src/positioning/qgeoshape_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOSHAPE_P_H
-#define QGEOSHAPE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QSharedData>
-
-#include "qgeorectangle.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGeoShapePrivate : public QSharedData
-{
-public:
- explicit QGeoShapePrivate(QGeoShape::ShapeType type);
- virtual ~QGeoShapePrivate();
-
- virtual bool isValid() const = 0;
- virtual bool isEmpty() const = 0;
- virtual bool contains(const QGeoCoordinate &coordinate) const = 0;
-
- virtual QGeoCoordinate center() const = 0;
-
- virtual QGeoRectangle boundingGeoRectangle() const = 0;
-
- virtual QGeoShapePrivate *clone() const = 0;
-
- virtual bool operator==(const QGeoShapePrivate &other) const;
-
- virtual size_t hash(size_t seed) const = 0;
-
- QGeoShape::ShapeType type;
-};
-
-// don't use the copy constructor when detaching from a QSharedDataPointer, use virtual clone()
-// call instead.
-template <>
-Q_INLINE_TEMPLATE QGeoShapePrivate *QSharedDataPointer<QGeoShapePrivate>::clone()
-{
- return d->clone();
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qlocationutils.cpp b/src/positioning/qlocationutils.cpp
deleted file mode 100644
index 04f94c2e..00000000
--- a/src/positioning/qlocationutils.cpp
+++ /dev/null
@@ -1,635 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qlocationutils_p.h"
-#include "qgeopositioninfo.h"
-#include "qgeosatelliteinfo.h"
-
-#include <QTime>
-#include <QList>
-#include <QByteArray>
-#include <QDebug>
-
-#include <math.h>
-
-QT_BEGIN_NAMESPACE
-
-// converts e.g. 15306.0235 from NMEA sentence to 153.100392
-static double qlocationutils_nmeaDegreesToDecimal(double nmeaDegrees)
-{
- double deg;
- double min = 100.0 * modf(nmeaDegrees / 100.0, &deg);
- return deg + (min / 60.0);
-}
-
-static void qlocationutils_readGga(const char *data, int size, QGeoPositionInfo *info, double uere,
- bool *hasFix)
-{
- QByteArray sentence(data, size);
- QList<QByteArray> parts = sentence.split(',');
- QGeoCoordinate coord;
-
- if (hasFix && parts.count() > 6 && parts[6].count() > 0)
- *hasFix = parts[6].toInt() > 0;
-
- if (parts.count() > 1 && parts[1].count() > 0) {
- QTime time;
- if (QLocationUtils::getNmeaTime(parts[1], &time))
- info->setTimestamp(QDateTime(QDate(), time, Qt::UTC));
- }
-
- if (parts.count() > 5 && parts[3].count() == 1 && parts[5].count() == 1) {
- double lat;
- double lng;
- if (QLocationUtils::getNmeaLatLong(parts[2], parts[3][0], parts[4], parts[5][0], &lat, &lng)) {
- coord.setLatitude(lat);
- coord.setLongitude(lng);
- }
- }
-
- if (parts.count() > 8 && !parts[8].isEmpty()) {
- bool hasHdop = false;
- double hdop = parts[8].toDouble(&hasHdop);
- if (hasHdop)
- info->setAttribute(QGeoPositionInfo::HorizontalAccuracy, 2 * hdop * uere);
- }
-
- if (parts.count() > 9 && parts[9].count() > 0) {
- bool hasAlt = false;
- double alt = parts[9].toDouble(&hasAlt);
- if (hasAlt)
- coord.setAltitude(alt);
- }
-
- if (coord.type() != QGeoCoordinate::InvalidCoordinate)
- info->setCoordinate(coord);
-}
-
-static void qlocationutils_readGsa(const char *data, int size, QGeoPositionInfo *info, double uere,
- bool *hasFix)
-{
- QList<QByteArray> parts = QByteArray::fromRawData(data, size).split(',');
-
- if (hasFix && parts.count() > 2 && !parts[2].isEmpty())
- *hasFix = parts[2].toInt() > 0;
-
- if (parts.count() > 16 && !parts[16].isEmpty()) {
- bool hasHdop = false;
- double hdop = parts[16].toDouble(&hasHdop);
- if (hasHdop)
- info->setAttribute(QGeoPositionInfo::HorizontalAccuracy, 2 * hdop * uere);
- }
-
- if (parts.count() > 17 && !parts[17].isEmpty()) {
- bool hasVdop = false;
- double vdop = parts[17].toDouble(&hasVdop);
- if (hasVdop)
- info->setAttribute(QGeoPositionInfo::VerticalAccuracy, 2 * vdop * uere);
- }
-}
-
-static void qlocationutils_readGsa(const char *data,
- int size,
- QList<int> &pnrsInUse)
-{
- QList<QByteArray> parts = QByteArray::fromRawData(data, size).split(',');
- pnrsInUse.clear();
- if (parts.count() <= 2)
- return;
- bool ok;
- for (int i = 3; i <= qMin(14, parts.size()); ++i) {
- const QByteArray &pnrString = parts.at(i);
- if (pnrString.isEmpty())
- continue;
- int pnr = pnrString.toInt(&ok);
- if (ok)
- pnrsInUse.append(pnr);
- }
-}
-
-static void qlocationutils_readGll(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
-{
- QByteArray sentence(data, size);
- QList<QByteArray> parts = sentence.split(',');
- QGeoCoordinate coord;
-
- if (hasFix && parts.count() > 6 && parts[6].count() > 0)
- *hasFix = (parts[6][0] == 'A');
-
- if (parts.count() > 5 && parts[5].count() > 0) {
- QTime time;
- if (QLocationUtils::getNmeaTime(parts[5], &time))
- info->setTimestamp(QDateTime(QDate(), time, Qt::UTC));
- }
-
- if (parts.count() > 4 && parts[2].count() == 1 && parts[4].count() == 1) {
- double lat;
- double lng;
- if (QLocationUtils::getNmeaLatLong(parts[1], parts[2][0], parts[3], parts[4][0], &lat, &lng)) {
- coord.setLatitude(lat);
- coord.setLongitude(lng);
- }
- }
-
- if (coord.type() != QGeoCoordinate::InvalidCoordinate)
- info->setCoordinate(coord);
-}
-
-static void qlocationutils_readRmc(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
-{
- QByteArray sentence(data, size);
- QList<QByteArray> parts = sentence.split(',');
- QGeoCoordinate coord;
- QDate date;
- QTime time;
-
- if (hasFix && parts.count() > 2 && parts[2].count() > 0)
- *hasFix = (parts[2][0] == 'A');
-
- if (parts.count() > 9 && parts[9].count() == 6) {
- date = QDate::fromString(QString::fromLatin1(parts[9]), QStringLiteral("ddMMyy"));
- if (date.isValid())
- date = date.addYears(100); // otherwise starts from 1900
- else
- date = QDate();
- }
-
- if (parts.count() > 1 && parts[1].count() > 0)
- QLocationUtils::getNmeaTime(parts[1], &time);
-
- if (parts.count() > 6 && parts[4].count() == 1 && parts[6].count() == 1) {
- double lat;
- double lng;
- if (QLocationUtils::getNmeaLatLong(parts[3], parts[4][0], parts[5], parts[6][0], &lat, &lng)) {
- coord.setLatitude(lat);
- coord.setLongitude(lng);
- }
- }
-
- bool parsed = false;
- double value = 0.0;
- if (parts.count() > 7 && parts[7].count() > 0) {
- value = parts[7].toDouble(&parsed);
- if (parsed)
- info->setAttribute(QGeoPositionInfo::GroundSpeed, qreal(value * 1.852 / 3.6)); // knots -> m/s
- }
- if (parts.count() > 8 && parts[8].count() > 0) {
- value = parts[8].toDouble(&parsed);
- if (parsed)
- info->setAttribute(QGeoPositionInfo::Direction, qreal(value));
- }
- if (parts.count() > 11 && parts[11].count() == 1
- && (parts[11][0] == 'E' || parts[11][0] == 'W')) {
- value = parts[10].toDouble(&parsed);
- if (parsed) {
- if (parts[11][0] == 'W')
- value *= -1;
- info->setAttribute(QGeoPositionInfo::MagneticVariation, qreal(value));
- }
- }
-
- if (coord.type() != QGeoCoordinate::InvalidCoordinate)
- info->setCoordinate(coord);
-
- info->setTimestamp(QDateTime(date, time, Qt::UTC));
-}
-
-static void qlocationutils_readVtg(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
-{
- if (hasFix)
- *hasFix = false;
-
- QByteArray sentence(data, size);
- QList<QByteArray> parts = sentence.split(',');
-
- bool parsed = false;
- double value = 0.0;
- if (parts.count() > 1 && parts[1].count() > 0) {
- value = parts[1].toDouble(&parsed);
- if (parsed)
- info->setAttribute(QGeoPositionInfo::Direction, qreal(value));
- }
- if (parts.count() > 7 && parts[7].count() > 0) {
- value = parts[7].toDouble(&parsed);
- if (parsed)
- info->setAttribute(QGeoPositionInfo::GroundSpeed, qreal(value / 3.6)); // km/h -> m/s
- }
-}
-
-static void qlocationutils_readZda(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
-{
- if (hasFix)
- *hasFix = false;
-
- QByteArray sentence(data, size);
- QList<QByteArray> parts = sentence.split(',');
- QDate date;
- QTime time;
-
- if (parts.count() > 1 && parts[1].count() > 0)
- QLocationUtils::getNmeaTime(parts[1], &time);
-
- if (parts.count() > 4 && parts[2].count() > 0 && parts[3].count() > 0
- && parts[4].count() == 4) { // must be full 4-digit year
- int day = parts[2].toUInt();
- int month = parts[3].toUInt();
- int year = parts[4].toUInt();
- if (day > 0 && month > 0 && year > 0)
- date.setDate(year, month, day);
- }
-
- info->setTimestamp(QDateTime(date, time, Qt::UTC));
-}
-
-QLocationUtils::NmeaSentence QLocationUtils::getNmeaSentenceType(const char *data, int size)
-{
- if (size < 6 || data[0] != '$' || !hasValidNmeaChecksum(data, size))
- return NmeaSentenceInvalid;
-
- if (data[3] == 'G' && data[4] == 'G' && data[5] == 'A')
- return NmeaSentenceGGA;
-
- if (data[3] == 'G' && data[4] == 'S' && data[5] == 'A')
- return NmeaSentenceGSA;
-
- if (data[3] == 'G' && data[4] == 'S' && data[5] == 'V')
- return NmeaSentenceGSV;
-
- if (data[3] == 'G' && data[4] == 'L' && data[5] == 'L')
- return NmeaSentenceGLL;
-
- if (data[3] == 'R' && data[4] == 'M' && data[5] == 'C')
- return NmeaSentenceRMC;
-
- if (data[3] == 'V' && data[4] == 'T' && data[5] == 'G')
- return NmeaSentenceVTG;
-
- if (data[3] == 'Z' && data[4] == 'D' && data[5] == 'A')
- return NmeaSentenceZDA;
-
- return NmeaSentenceInvalid;
-}
-
-QGeoSatelliteInfo::SatelliteSystem QLocationUtils::getSatelliteSystem(const char *data, int size)
-{
- if (size < 6 || data[0] != '$' || !hasValidNmeaChecksum(data, size))
- return QGeoSatelliteInfo::Undefined;
-
- // GPS: GP
- if (data[1] == 'G' && data[2] == 'P')
- return QGeoSatelliteInfo::GPS;
-
- // GLONASS: GL
- if (data[1] == 'G' && data[2] == 'L')
- return QGeoSatelliteInfo::GLONASS;
-
- // GALILEO: GA
- if (data[1] == 'G' && data[2] == 'A')
- return QGeoSatelliteInfo::GALILEO;
-
- // BeiDou: BD or GB
- if ((data[1] == 'B' && data[2] == 'D') || (data[1] == 'G' && data[2] == 'B'))
- return QGeoSatelliteInfo::BEIDOU;
-
- // QZSS: GQ, PQ, QZ
- if ((data[1] == 'G' && data[2] == 'Q') || (data[1] == 'P' && data[2] == 'Q')
- || (data[1] == 'Q' && data[2] == 'Z')) {
- return QGeoSatelliteInfo::QZSS;
- }
-
- // Multiple: GN
- if (data[1] == 'G' && data[2] == 'N')
- return QGeoSatelliteInfo::Multiple;
-
- return QGeoSatelliteInfo::Undefined;
-}
-
-QGeoSatelliteInfo::SatelliteSystem QLocationUtils::getSatelliteSystemBySatelliteId(int satId)
-{
- if (satId >= 1 && satId <= 32)
- return QGeoSatelliteInfo::GPS;
-
- if (satId >= 65 && satId <= 96) // including future extensions
- return QGeoSatelliteInfo::GLONASS;
-
- if (satId >= 193 && satId <= 200) // including future extensions
- return QGeoSatelliteInfo::QZSS;
-
- if ((satId >= 201 && satId <= 235) || (satId >= 401 && satId <= 437))
- return QGeoSatelliteInfo::BEIDOU;
-
- if (satId >= 301 && satId <= 336)
- return QGeoSatelliteInfo::GALILEO;
-
- return QGeoSatelliteInfo::Undefined;
-}
-
-bool QLocationUtils::getPosInfoFromNmea(const char *data, int size, QGeoPositionInfo *info,
- double uere, bool *hasFix)
-{
- if (!info)
- return false;
-
- if (hasFix)
- *hasFix = false;
-
- NmeaSentence nmeaType = getNmeaSentenceType(data, size);
- if (nmeaType == NmeaSentenceInvalid)
- return false;
-
- // Adjust size so that * and following characters are not parsed by the following functions.
- for (int i = 0; i < size; ++i) {
- if (data[i] == '*') {
- size = i;
- break;
- }
- }
-
- switch (nmeaType) {
- case NmeaSentenceGGA:
- qlocationutils_readGga(data, size, info, uere, hasFix);
- return true;
- case NmeaSentenceGSA:
- qlocationutils_readGsa(data, size, info, uere, hasFix);
- return true;
- case NmeaSentenceGLL:
- qlocationutils_readGll(data, size, info, hasFix);
- return true;
- case NmeaSentenceRMC:
- qlocationutils_readRmc(data, size, info, hasFix);
- return true;
- case NmeaSentenceVTG:
- qlocationutils_readVtg(data, size, info, hasFix);
- return true;
- case NmeaSentenceZDA:
- qlocationutils_readZda(data, size, info, hasFix);
- return true;
- default:
- return false;
- }
-}
-
-QNmeaSatelliteInfoSource::SatelliteInfoParseStatus
-QLocationUtils::getSatInfoFromNmea(const char *data, int size, QList<QGeoSatelliteInfo> &infos, QGeoSatelliteInfo::SatelliteSystem &system)
-{
- if (!data || !size)
- return QNmeaSatelliteInfoSource::NotParsed;
-
- NmeaSentence nmeaType = getNmeaSentenceType(data, size);
- if (nmeaType != NmeaSentenceGSV)
- return QNmeaSatelliteInfoSource::NotParsed;
-
- // Standard forbids using $GN talker id for GSV messages, so the system
- // type here will be uniquely identified.
- system = getSatelliteSystem(data, size);
-
- // Adjust size so that * and following characters are not parsed by the
- // following code.
- for (int i = 0; i < size; ++i) {
- if (data[i] == '*') {
- size = i;
- break;
- }
- }
-
- QList<QByteArray> parts = QByteArray::fromRawData(data, size).split(',');
-
- if (parts.count() <= 3) {
- infos.clear();
- return QNmeaSatelliteInfoSource::FullyParsed; // Malformed sentence.
- }
- bool ok;
- const int totalSentences = parts.at(1).toInt(&ok);
- if (!ok) {
- infos.clear();
- return QNmeaSatelliteInfoSource::FullyParsed; // Malformed sentence.
- }
-
- const int sentence = parts.at(2).toInt(&ok);
- if (!ok) {
- infos.clear();
- return QNmeaSatelliteInfoSource::FullyParsed; // Malformed sentence.
- }
-
- const int totalSats = parts.at(3).toInt(&ok);
- if (!ok) {
- infos.clear();
- return QNmeaSatelliteInfoSource::FullyParsed; // Malformed sentence.
- }
-
- if (sentence == 1)
- infos.clear();
-
- const int numSatInSentence = qMin(sentence * 4, totalSats) - (sentence - 1) * 4;
-
- int field = 4;
- for (int i = 0; i < numSatInSentence; ++i) {
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(system);
- int prn = parts.at(field++).toInt(&ok);
- // Quote from: https://gpsd.gitlab.io/gpsd/NMEA.html#_satellite_ids
- // GLONASS satellite numbers come in two flavors. If a sentence has a GL
- // talker ID, expect the skyviews to be GLONASS-only and in the range
- // 1-32; you must add 64 to get a globally-unique NMEA ID. If the
- // sentence has a GN talker ID, the device emits a multi-constellation
- // skyview with GLONASS IDs already in the 65-96 range.
- //
- // However I don't observe such behavior with my device. So implementing
- // a safe scenario.
- if (ok && (system == QGeoSatelliteInfo::GLONASS)) {
- if (prn <= 64)
- prn += 64;
- }
- info.setSatelliteIdentifier((ok) ? prn : 0);
- const int elevation = parts.at(field++).toInt(&ok);
- info.setAttribute(QGeoSatelliteInfo::Elevation, (ok) ? elevation : 0);
- const int azimuth = parts.at(field++).toInt(&ok);
- info.setAttribute(QGeoSatelliteInfo::Azimuth, (ok) ? azimuth : 0);
- const int snr = parts.at(field++).toInt(&ok);
- info.setSignalStrength((ok) ? snr : -1);
- infos.append(info);
- }
-
- if (sentence == totalSentences)
- return QNmeaSatelliteInfoSource::FullyParsed;
-
- return QNmeaSatelliteInfoSource::PartiallyParsed;
-}
-
-QGeoSatelliteInfo::SatelliteSystem QLocationUtils::getSatInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse)
-{
- if (!data || !size)
- return QGeoSatelliteInfo::Undefined;
-
- NmeaSentence nmeaType = getNmeaSentenceType(data, size);
- if (nmeaType != NmeaSentenceGSA)
- return QGeoSatelliteInfo::Undefined;
-
- auto systemType = getSatelliteSystem(data, size);
- if (systemType == QGeoSatelliteInfo::Undefined)
- return systemType;
-
- // The documentation states that we do not modify pnrsInUse if we could not
- // parse the data
- pnrsInUse.clear();
-
- // Adjust size so that * and following characters are not parsed by the following functions.
- for (int i = 0; i < size; ++i) {
- if (data[i] == '*') {
- size = i;
- break;
- }
- }
- qlocationutils_readGsa(data, size, pnrsInUse);
-
- // Quote from: https://gpsd.gitlab.io/gpsd/NMEA.html#_satellite_ids
- // GLONASS satellite numbers come in two flavors. If a sentence has a GL
- // talker ID, expect the skyviews to be GLONASS-only and in the range 1-32;
- // you must add 64 to get a globally-unique NMEA ID. If the sentence has a
- // GN talker ID, the device emits a multi-constellation skyview with
- // GLONASS IDs already in the 65-96 range.
- //
- // However I don't observe such behavior with my device. So implementing a
- // safe scenario.
- if (systemType == QGeoSatelliteInfo::GLONASS) {
- std::for_each(pnrsInUse.begin(), pnrsInUse.end(), [](int &id) {
- if (id <= 64)
- id += 64;
- });
- }
-
- if ((systemType == QGeoSatelliteInfo::Multiple) && !pnrsInUse.isEmpty()) {
- // Standard claims that in case of multiple system types we will receive
- // several GSA messages, each containing data from only one satellite
- // system, so we can pick the first id to determine the system type.
- auto tempSystemType = getSatelliteSystemBySatelliteId(pnrsInUse.front());
- if (tempSystemType != QGeoSatelliteInfo::Undefined)
- systemType = tempSystemType;
- }
-
- return systemType;
-}
-
-bool QLocationUtils::hasValidNmeaChecksum(const char *data, int size)
-{
- int asteriskIndex = -1;
- for (int i = 0; i < size; ++i) {
- if (data[i] == '*') {
- asteriskIndex = i;
- break;
- }
- }
-
- const int CSUM_LEN = 2;
- if (asteriskIndex < 0 || asteriskIndex + CSUM_LEN >= size)
- return false;
-
- // XOR byte value of all characters between '$' and '*'
- int result = 0;
- for (int i = 1; i < asteriskIndex; ++i)
- result ^= data[i];
- /*
- char calc[CSUM_LEN + 1];
- ::snprintf(calc, CSUM_LEN + 1, "%02x", result);
- return ::strncmp(calc, &data[asteriskIndex+1], 2) == 0;
- */
-
- QByteArray checkSumBytes(&data[asteriskIndex + 1], 2);
- bool ok = false;
- int checksum = checkSumBytes.toInt(&ok,16);
- return ok && checksum == result;
-}
-
-bool QLocationUtils::getNmeaTime(const QByteArray &bytes, QTime *time)
-{
- int dotIndex = bytes.indexOf('.');
- QTime tempTime;
-
- if (dotIndex < 0) {
- tempTime = QTime::fromString(QString::fromLatin1(bytes.constData()),
- QStringLiteral("hhmmss"));
- } else {
- tempTime = QTime::fromString(QString::fromLatin1(bytes.mid(0, dotIndex)),
- QStringLiteral("hhmmss"));
- bool hasMsecs = false;
- int midLen = qMin(3, bytes.size() - dotIndex - 1);
- int msecs = bytes.mid(dotIndex + 1, midLen).toUInt(&hasMsecs);
- if (hasMsecs)
- tempTime = tempTime.addMSecs(msecs*(midLen == 3 ? 1 : midLen == 2 ? 10 : 100));
- }
-
- if (tempTime.isValid()) {
- *time = tempTime;
- return true;
- }
- return false;
-}
-
-bool QLocationUtils::getNmeaLatLong(const QByteArray &latString, char latDirection, const QByteArray &lngString, char lngDirection, double *lat, double *lng)
-{
- if ((latDirection != 'N' && latDirection != 'S')
- || (lngDirection != 'E' && lngDirection != 'W')) {
- return false;
- }
-
- bool hasLat = false;
- bool hasLong = false;
- double tempLat = latString.toDouble(&hasLat);
- double tempLng = lngString.toDouble(&hasLong);
- if (hasLat && hasLong) {
- tempLat = qlocationutils_nmeaDegreesToDecimal(tempLat);
- if (latDirection == 'S')
- tempLat *= -1;
- tempLng = qlocationutils_nmeaDegreesToDecimal(tempLng);
- if (lngDirection == 'W')
- tempLng *= -1;
-
- if (isValidLat(tempLat) && isValidLong(tempLng)) {
- *lat = tempLat;
- *lng = tempLng;
- return true;
- }
- }
- return false;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/positioning/qlocationutils_p.h b/src/positioning/qlocationutils_p.h
deleted file mode 100644
index 0db855a5..00000000
--- a/src/positioning/qlocationutils_p.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QLOCATIONUTILS_P_H
-#define QLOCATIONUTILS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QtGlobal>
-#include <math.h> // needed for non-std:: versions of functions
-#include <qmath.h>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include <QtPositioning/private/qpositioningglobal_p.h>
-
-static const double offsetEpsilon = 1e-12; // = 0.000000000001
-static const double leftOffset = -180.0 + offsetEpsilon;
-static const double rightOffset = 180.0 - offsetEpsilon;
-
-QT_BEGIN_NAMESPACE
-class QTime;
-class QByteArray;
-
-class QGeoPositionInfo;
-class QGeoSatelliteInfo;
-class Q_POSITIONING_PRIVATE_EXPORT QLocationUtils
-{
-public:
- enum CardinalDirection {
- CardinalN,
- CardinalE,
- CardinalS,
- CardinalW,
- CardinalNE,
- CardinalSE,
- CardinalSW,
- CardinalNW,
- CardinalNNE,
- CardinalENE,
- CardinalESE,
- CardinalSSE,
- CardinalSSW,
- CardinalWSW,
- CardinalWNW,
- CardinalNNW
- };
-
- enum NmeaSentence {
- NmeaSentenceInvalid,
- NmeaSentenceGGA, // Fix information
- NmeaSentenceGSA, // Overall Satellite data, such as HDOP and VDOP
- NmeaSentenceGLL, // Lat/Lon data
- NmeaSentenceRMC, // Recommended minimum data for gps
- NmeaSentenceVTG, // Vector track an Speed over the Ground
- NmeaSentenceZDA, // Date and Time
- NmeaSentenceGSV // Per-Satellite Info
- };
-
- inline static bool isValidLat(double lat) {
- return lat >= -90.0 && lat <= 90.0;
- }
- inline static bool isValidLong(double lng) {
- return lng >= -180.0 && lng <= 180.0;
- }
-
- inline static double clipLat(double lat, double clipValue = 90.0) {
- if (lat > clipValue)
- lat = clipValue;
- else if (lat < -clipValue)
- lat = -clipValue;
- return lat;
- }
-
- inline static double wrapLong(double lng) {
- if (lng > 180.0)
- lng -= 360.0;
- else if (lng < -180.0)
- lng += 360.0;
- return lng;
- }
-
- inline static CardinalDirection azimuthToCardinalDirection4(double azimuth)
- {
- azimuth = fmod(azimuth, 360.0);
- if (azimuth < 45.0 || azimuth > 315.0 )
- return CardinalN;
- else if (azimuth < 135.0)
- return CardinalE;
- else if (azimuth < 225.0)
- return CardinalS;
- else
- return CardinalW;
- }
-
- inline static CardinalDirection azimuthToCardinalDirection8(double azimuth)
- {
- azimuth = fmod(azimuth, 360.0);
- if (azimuth < 22.5 || azimuth > 337.5 )
- return CardinalN;
- else if (azimuth < 67.5)
- return CardinalNE;
- else if (azimuth < 112.5)
- return CardinalE;
- else if (azimuth < 157.5)
- return CardinalSE;
- else if (azimuth < 202.5)
- return CardinalS;
-
- else if (azimuth < 247.5)
- return CardinalSW;
- else if (azimuth < 292.5)
- return CardinalW;
- else
- return CardinalNW;
- }
-
- inline static CardinalDirection azimuthToCardinalDirection16(double azimuth)
- {
- azimuth = fmod(azimuth, 360.0);
- if (azimuth < 11.5 || azimuth > 348.75 )
- return CardinalN;
- else if (azimuth < 33.75)
- return CardinalNNE;
- else if (azimuth < 56.25)
- return CardinalNE;
- else if (azimuth < 78.75)
- return CardinalENE;
- else if (azimuth < 101.25)
- return CardinalE;
- else if (azimuth < 123.75)
- return CardinalESE;
- else if (azimuth < 146.25)
- return CardinalSE;
- else if (azimuth < 168.75)
- return CardinalSSE;
- else if (azimuth < 191.25)
- return CardinalS;
-
- else if (azimuth < 213.75)
- return CardinalSSW;
- else if (azimuth < 236.25)
- return CardinalSW;
- else if (azimuth < 258.75)
- return CardinalWSW;
- else if (azimuth < 281.25)
- return CardinalW;
- else if (azimuth < 303.75)
- return CardinalWNW;
- else if (azimuth < 326.25)
- return CardinalNW;
- else
- return CardinalNNW;
- }
-
- // For values exceeding +- 720.0
- inline static double wrapLongExt(double lng) {
- double remainder = fmod(lng + 180.0, 360.0);
- return fmod(remainder + 360.0, 360.0) - 180.0;
- }
-
- // Mirrors the azimuth against the X axis. Azimuth assumed to be in [0,360[
- inline static double mirrorAzimuthX(double azimuth) {
- if (azimuth <= 90.0)
- return 180.0 - azimuth;
- else
- return 180.0 + (360.0 - azimuth);
- }
-
- // Mirrors the azimuth against the Y axis. Azimuth assumed to be in [0,360[
- inline static double mirrorAzimuthY(double azimuth) {
- if (azimuth == 0.0)
- return 0.0;
- return 360.0 - azimuth;
- }
-
- inline static double radians(double degrees)
- {
- return qDegreesToRadians(degrees);
- }
-
- inline static double degrees(double radians)
- {
- return qRadiansToDegrees(radians);
- }
-
- inline static double earthMeanRadius()
- {
- return 6371007.2;
- }
-
- inline static double earthMeanCircumference()
- {
- return earthMeanRadius() * 2.0 * M_PI;
- }
-
- inline static double mercatorMaxLatitude()
- {
- return 85.05113;
- }
-
- inline static QGeoCoordinate antipodalPoint(const QGeoCoordinate &p)
- {
- return QGeoCoordinate(-p.latitude(), wrapLong(p.longitude() + 180.0));
- }
-
- // Leftmost longitude before wrapping kicks in
- inline static double mapLeftLongitude(double centerLongitude)
- {
- return wrapLong(centerLongitude + leftOffset);
- }
-
- // Rightmost longitude before wrapping kicks in
- inline static double mapRightLongitude(double centerLongitude)
- {
- return wrapLong(centerLongitude - leftOffset);
- }
-
- inline static void split_double(double input, float *hipart, float *lopart)
- {
- *hipart = (float) input;
- double delta = input - ((double) *hipart);
- *lopart = (float) delta;
- }
-
- static qreal metersPerPixel(qreal zoomLevel, const QGeoCoordinate &coordinate)
- {
- const qreal metersPerTile = earthMeanCircumference() * std::cos(radians(coordinate.latitude())) / std::pow(2, zoomLevel);
- return metersPerTile / 256.0;
- }
-
- /*
- returns the NMEA sentence type.
- */
- static NmeaSentence getNmeaSentenceType(const char *data, int size);
-
- /*
- Returns the satellite system type based on the message type.
- See https://gpsd.gitlab.io/gpsd/NMEA.html#_talker_ids for reference
- */
- static QGeoSatelliteInfo::SatelliteSystem getSatelliteSystem(const char *data, int size);
-
- /*
- Returns the satellite system type based on the satellite id.
- See https://gpsd.gitlab.io/gpsd/NMEA.html#_satellite_ids for reference
- */
- static QGeoSatelliteInfo::SatelliteSystem getSatelliteSystemBySatelliteId(int satId);
-
- /*
- Creates a QGeoPositionInfo from a GGA, GLL, RMC, VTG or ZDA sentence.
-
- Note:
- - GGA and GLL sentences have time but not date so the update's
- QDateTime object will have an invalid date.
- - RMC reports date with a two-digit year so in this case the year
- is assumed to be after the year 2000.
- */
- static bool getPosInfoFromNmea(const char *data,
- int size,
- QGeoPositionInfo *info, double uere,
- bool *hasFix = nullptr);
-
- /*
- Retruns a list of QGeoSatelliteInfo in the view.
-
- Note: this function has to be called repeatedly until it returns
- QNmeaSatelliteInfoSource::FullyParsed.
- Reason being that GSV sentences can be split into multiple samples, so
- getting the full data requires parsing multiple sentences.
- */
- static QNmeaSatelliteInfoSource::SatelliteInfoParseStatus
- getSatInfoFromNmea(const char *data, int size, QList<QGeoSatelliteInfo> &infos, QGeoSatelliteInfo::SatelliteSystem &system);
-
- /*
- Parses GSA for satellites in use.
-
- Returns satellite system type or QGeoSatelliteInfo::Undefined if parsing
- failed
- */
- static QGeoSatelliteInfo::SatelliteSystem getSatInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse);
-
- /*
- Returns true if the given NMEA sentence has a valid checksum.
- */
- static bool hasValidNmeaChecksum(const char *data, int size);
-
- /*
- Returns time from a string in hhmmss or hhmmss.z+ format.
- */
- static bool getNmeaTime(const QByteArray &bytes, QTime *time);
-
- /*
- Accepts for example ("2734.7964", 'S', "15306.0124", 'E') and returns the
- lat-long values. Fails if lat or long fail isValidLat() or isValidLong().
- */
- static bool getNmeaLatLong(const QByteArray &latString,
- char latDirection,
- const QByteArray &lngString,
- char lngDirection,
- double *lat,
- double *lon);
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qnmeapositioninfosource.cpp b/src/positioning/qnmeapositioninfosource.cpp
deleted file mode 100644
index 91f72241..00000000
--- a/src/positioning/qnmeapositioninfosource.cpp
+++ /dev/null
@@ -1,962 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Jolla Ltd.
-** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qnmeapositioninfosource_p.h"
-#include "qgeopositioninfo_p.h"
-#include "qlocationutils_p.h"
-
-#include <QIODevice>
-#include <QBasicTimer>
-#include <QTimerEvent>
-#include <QTimer>
-#include <array>
-#include <QDebug>
-#include <QtCore/QtNumeric>
-
-
-QT_BEGIN_NAMESPACE
-
-#define USE_NMEA_PIMPL 0
-
-#if USE_NMEA_PIMPL
-class QGeoPositionInfoPrivateNmea : public QGeoPositionInfoPrivate
-{
-public:
- virtual ~QGeoPositionInfoPrivateNmea();
-
- QList<QByteArray> nmeaSentences;
-};
-
-
-QGeoPositionInfoPrivateNmea::~QGeoPositionInfoPrivateNmea()
-{
-
-}
-#else
-typedef QGeoPositionInfoPrivate QGeoPositionInfoPrivateNmea;
-#endif
-
-static bool propagateCoordinate(QGeoPositionInfo &dst, const QGeoPositionInfo &src, bool force = true)
-{
- bool updated = false;
- QGeoCoordinate c = dst.coordinate();
- const QGeoCoordinate & srcCoordinate = src.coordinate();
- if (qIsFinite(src.coordinate().latitude())
- && (!qIsFinite(dst.coordinate().latitude()) || force)) {
- updated |= (c.latitude() != srcCoordinate.latitude());
- c.setLatitude(src.coordinate().latitude());
- }
- if (qIsFinite(src.coordinate().longitude())
- && (!qIsFinite(dst.coordinate().longitude()) || force)) {
- updated |= (c.longitude() != srcCoordinate.longitude());
- c.setLongitude(src.coordinate().longitude());
- }
- if (qIsFinite(src.coordinate().altitude())
- && (!qIsFinite(dst.coordinate().altitude()) || force)) {
- updated |= (c.altitude() != srcCoordinate.altitude());
- c.setAltitude(src.coordinate().altitude());
- }
- dst.setCoordinate(c);
- return updated;
-}
-
-static bool propagateDate(QGeoPositionInfo &dst, const QGeoPositionInfo &src)
-{
- if (!dst.timestamp().date().isValid() && src.timestamp().isValid()) { // time was supposed to be set/the same already. Date can be overwritten.
- dst.setTimestamp(src.timestamp());
- return true;
- }
- return false;
-}
-
-static bool propagateAttributes(QGeoPositionInfo &dst, const QGeoPositionInfo &src, bool force = true)
-{
- bool updated = false;
- static Q_DECL_CONSTEXPR std::array<QGeoPositionInfo::Attribute, 6> attrs {
- { QGeoPositionInfo::GroundSpeed
- ,QGeoPositionInfo::HorizontalAccuracy
- ,QGeoPositionInfo::VerticalAccuracy
- ,QGeoPositionInfo::Direction
- ,QGeoPositionInfo::VerticalSpeed
- ,QGeoPositionInfo::MagneticVariation} };
- for (const auto a: attrs) {
- if (src.hasAttribute(a) && (!dst.hasAttribute(a) || force)) {
- updated |= (dst.attribute(a) != src.attribute(a));
- dst.setAttribute(a, src.attribute(a));
- }
- }
-
- return updated;
-}
-
-// returns false if src does not contain any additional or different data than dst,
-// true otherwise.
-static bool mergePositions(QGeoPositionInfo &dst, const QGeoPositionInfo &src, QByteArray nmeaSentence)
-{
- bool updated = false;
-
- updated |= propagateCoordinate(dst, src);
- updated |= propagateDate(dst, src);
- updated |= propagateAttributes(dst, src);
-
-#if USE_NMEA_PIMPL
- QGeoPositionInfoPrivateNmea *dstPimpl = static_cast<QGeoPositionInfoPrivateNmea *>(QGeoPositionInfoPrivate::get(dst));
- dstPimpl->nmeaSentences.append(nmeaSentence);
-#else
- Q_UNUSED(nmeaSentence);
-#endif
- return updated;
-}
-
-static qint64 msecsTo(const QDateTime &from, const QDateTime &to)
-{
- if (!from.time().isValid() || !to.time().isValid())
- return 0;
-
- if (!from.date().isValid() || !to.date().isValid()) // use only time
- return from.time().msecsTo(to.time());
-
- return from.msecsTo(to);
-}
-
-QNmeaRealTimeReader::QNmeaRealTimeReader(QNmeaPositionInfoSourcePrivate *sourcePrivate)
- : QNmeaReader(sourcePrivate), m_update(*new QGeoPositionInfoPrivateNmea)
-{
- // An env var controlling the number of milliseconds to use to withold
- // an update and wait for additional data to combine.
- // The update will be pushed earlier than this if a newer update will be received.
- // The update will be withold longer than this amount of time if additional
- // valid data will keep arriving within this time frame.
- QByteArray pushDelay = qgetenv("QT_NMEA_PUSH_DELAY");
- if (!pushDelay.isEmpty())
- m_pushDelay = qBound(-1, QString::fromLatin1(pushDelay).toInt(), 1000);
- else
- m_pushDelay = 20;
-
- if (m_pushDelay >= 0) {
- m_timer.setSingleShot(true);
- m_timer.setInterval(m_pushDelay);
- m_timer.connect(&m_timer, &QTimer::timeout, [this]() {
- this->notifyNewUpdate();
- });
- }
-}
-
-void QNmeaRealTimeReader::readAvailableData()
-{
- while (m_proxy->m_device->canReadLine()) {
- const QTime infoTime = m_update.timestamp().time(); // if update has been set, time must be valid.
- const QDate infoDate = m_update.timestamp().date(); // this one might not be valid, as some sentences do not contain it
-
- QGeoPositionInfoPrivateNmea *pimpl = new QGeoPositionInfoPrivateNmea;
- QGeoPositionInfo pos(*pimpl);
-
- char buf[1024];
- qint64 size = m_proxy->m_device->readLine(buf, sizeof(buf));
- const bool oldFix = m_hasFix;
- bool hasFix;
- const bool parsed = m_proxy->parsePosInfoFromNmeaData(buf, size, &pos, &hasFix);
-
- if (!parsed) {
- // got garbage, don't stop the timer
- continue;
- }
-
- m_hasFix |= hasFix;
- m_updateParsed = true;
-
- // Date may or may not be valid, as some packets do not have date.
- // If date isn't valid, match is performed on time only.
- // Hence, make sure that packet blocks are generated with
- // the sentences containing the full timestamp (e.g., GPRMC) *first* !
- if (infoTime.isValid()) {
- if (pos.timestamp().time().isValid()) {
- const bool newerTime = infoTime < pos.timestamp().time();
- const bool newerDate = (infoDate.isValid() // if time is valid but one date or both are not,
- && pos.timestamp().date().isValid()
- && infoDate < pos.timestamp().date());
- if (newerTime || newerDate) {
- // Effectively read data for different update, that is also newer,
- // so flush retained update, and copy the new pos into m_update
- const QDate updateDate = m_update.timestamp().date();
- const QDate lastPushedDate = m_lastPushedTS.date();
- const bool newerTimestampSinceLastPushed = m_update.timestamp() > m_lastPushedTS;
- const bool invalidDate = !(updateDate.isValid() && lastPushedDate.isValid());
- const bool newerTimeSinceLastPushed = m_update.timestamp().time() > m_lastPushedTS.time();
- if ( newerTimestampSinceLastPushed || (invalidDate && newerTimeSinceLastPushed)) {
- m_proxy->notifyNewUpdate(&m_update, oldFix);
- m_lastPushedTS = m_update.timestamp();
- }
- m_timer.stop();
- // next update data
- propagateAttributes(pos, m_update, false);
- m_update = pos;
- m_hasFix = hasFix;
- } else {
- if (infoTime == pos.timestamp().time())
- // timestamps match -- merge into m_update
- if (mergePositions(m_update, pos, QByteArray(buf, size))) {
- // Reset the timer only if new info has been received.
- // Else the source might be keep repeating outdated info until
- // new info become available.
- m_timer.stop();
- }
- // else discard out of order outdated info.
- }
- } else {
- // no timestamp available in parsed update-- merge into m_update
- if (mergePositions(m_update, pos, QByteArray(buf, size)))
- m_timer.stop();
- }
- } else {
- // there was no info with valid TS. Overwrite with whatever is parsed.
-#if USE_NMEA_PIMPL
- pimpl->nmeaSentences.append(QByteArray(buf, size));
-#endif
- propagateAttributes(pos, m_update);
- m_update = pos;
- m_timer.stop();
- }
- }
-
- if (m_updateParsed) {
- if (m_pushDelay < 0)
- notifyNewUpdate();
- else
- m_timer.start();
- }
-}
-
-void QNmeaRealTimeReader::notifyNewUpdate()
-{
- const bool newerTime = m_update.timestamp().time() > m_lastPushedTS.time();
- const bool newerDate = (m_update.timestamp().date().isValid()
- && m_lastPushedTS.date().isValid()
- && m_update.timestamp().date() > m_lastPushedTS.date());
- if (newerTime || newerDate) {
- m_proxy->notifyNewUpdate(&m_update, m_hasFix);
- m_lastPushedTS = m_update.timestamp();
- }
- m_timer.stop();
-}
-
-
-//============================================================
-
-QNmeaSimulatedReader::QNmeaSimulatedReader(QNmeaPositionInfoSourcePrivate *sourcePrivate)
- : QNmeaReader(sourcePrivate),
- m_currTimerId(-1),
- m_hasValidDateTime(false)
-{
-}
-
-QNmeaSimulatedReader::~QNmeaSimulatedReader()
-{
- if (m_currTimerId > 0)
- killTimer(m_currTimerId);
-}
-
-void QNmeaSimulatedReader::readAvailableData()
-{
- if (m_currTimerId > 0) // we are already reading
- return;
-
- if (!m_hasValidDateTime) { // first update
- Q_ASSERT(m_proxy->m_device && (m_proxy->m_device->openMode() & QIODevice::ReadOnly));
-
- if (!setFirstDateTime()) {
- //m_proxy->notifyReachedEndOfFile();
- qWarning("QNmeaPositionInfoSource: cannot find NMEA sentence with valid date & time");
- return;
- }
-
- m_hasValidDateTime = true;
- simulatePendingUpdate();
-
- } else {
- // previously read to EOF, but now new data has arrived
- processNextSentence();
- }
-}
-
-static int processSentence(QGeoPositionInfo &info,
- QByteArray &m_nextLine,
- QNmeaPositionInfoSourcePrivate *m_proxy,
- QQueue<QPendingGeoPositionInfo> &m_pendingUpdates,
- bool &hasFix)
-{
- int timeToNextUpdate = -1;
- QDateTime prevTs;
- if (m_pendingUpdates.size() > 0)
- prevTs = m_pendingUpdates.head().info.timestamp();
-
- // find the next update with a valid time (as long as the time is valid,
- // we can calculate when the update should be emitted)
- while (m_nextLine.size() || (m_proxy->m_device && m_proxy->m_device->bytesAvailable() > 0)) {
- char static_buf[1024];
- char *buf = static_buf;
- QByteArray nextLine;
- qint64 size = 0;
- if (m_nextLine.size()) {
- // Read something in the previous call, but TS was later.
- size = m_nextLine.size();
- nextLine = m_nextLine;
- m_nextLine.clear();
- buf = nextLine.data();
- } else {
- size = m_proxy->m_device->readLine(buf, sizeof(static_buf));
- }
-
- if (size <= 0)
- continue;
-
- const QTime infoTime = info.timestamp().time(); // if info has been set, time must be valid.
- const QDate infoDate = info.timestamp().date(); // this one might not be valid, as some sentences do not contain it
-
- /*
- Packets containing time information are GGA, RMC, ZDA, GLL:
-
- GGA : GPS fix data - only time
- GLL : geographic latitude and longitude - only time
- RMC : recommended minimum FPOS/transit data - date and time
- ZDA : only timestamp - date and time
-
- QLocationUtils is currently also capable of parsing VTG and GSA sentences:
-
- VTG: containing Track made good and ground speed
- GSA: overall satellite data, w. accuracies (ends up into PositionInfo)
-
- Since these sentences contain no timestamp, their content will be merged with the content
- from any prior sentence that had timestamp info, if any is available.
- */
-
- QGeoPositionInfoPrivateNmea *pimpl = new QGeoPositionInfoPrivateNmea;
- QGeoPositionInfo pos(*pimpl);
- if (m_proxy->parsePosInfoFromNmeaData(buf, size, &pos, &hasFix)) {
- // Date may or may not be valid, as some packets do not have date.
- // If date isn't valid, match is performed on time only.
- // Hence, make sure that packet blocks are generated with
- // the sentences containing the full timestamp (e.g., GPRMC) *first* !
- if (infoTime.isValid()) {
- if (pos.timestamp().time().isValid()) {
- const bool newerTime = infoTime < pos.timestamp().time();
- const bool newerDate = (infoDate.isValid() // if time is valid but one date or both are not,
- && pos.timestamp().date().isValid()
- && infoDate < pos.timestamp().date());
- if (newerTime || newerDate) {
- // Effectively read data for different update, that is also newer, so copy buf into m_nextLine
- m_nextLine = QByteArray(buf, size);
- break;
- } else {
- if (infoTime == pos.timestamp().time())
- // timestamps match -- merge into info
- mergePositions(info, pos, QByteArray(buf, size));
- // else discard out of order outdated info.
- }
- } else {
- // no timestamp available -- merge into info
- mergePositions(info, pos, QByteArray(buf, size));
- }
- } else {
- // there was no info with valid TS. Overwrite with whatever is parsed.
-#if USE_NMEA_PIMPL
- pimpl->nmeaSentences.append(QByteArray(buf, size));
-#endif
- info = pos;
- }
-
- if (prevTs.time().isValid()) {
- timeToNextUpdate = msecsTo(prevTs, info.timestamp());
- if (timeToNextUpdate < 0) // Somehow parsing expired packets, reset info
- info = QGeoPositionInfo(*new QGeoPositionInfoPrivateNmea);
- }
- }
- }
-
- return timeToNextUpdate;
-}
-
-bool QNmeaSimulatedReader::setFirstDateTime()
-{
- // find the first update with valid date and time
- QGeoPositionInfo info(*new QGeoPositionInfoPrivateNmea);
- bool hasFix = false;
- processSentence(info, m_nextLine, m_proxy, m_pendingUpdates, hasFix);
-
- if (info.timestamp().time().isValid()) { // NMEA may have sentences with only time and no date. These would generate invalid positions
- QPendingGeoPositionInfo pending;
- pending.info = info;
- pending.hasFix = hasFix;
- m_pendingUpdates.enqueue(pending);
- return true;
- }
- return false;
-}
-
-void QNmeaSimulatedReader::simulatePendingUpdate()
-{
- if (m_pendingUpdates.size() > 0) {
- // will be dequeued in processNextSentence()
- QPendingGeoPositionInfo &pending = m_pendingUpdates.head();
- m_proxy->notifyNewUpdate(&pending.info, pending.hasFix);
- }
-
- processNextSentence();
-}
-
-void QNmeaSimulatedReader::timerEvent(QTimerEvent *event)
-{
- killTimer(event->timerId());
- m_currTimerId = -1;
- simulatePendingUpdate();
-}
-
-void QNmeaSimulatedReader::processNextSentence()
-{
- QGeoPositionInfo info(*new QGeoPositionInfoPrivateNmea);
- bool hasFix = false;
-
- int timeToNextUpdate = processSentence(info, m_nextLine, m_proxy, m_pendingUpdates, hasFix);
- if (timeToNextUpdate < 0)
- return;
-
- m_pendingUpdates.dequeue();
-
- QPendingGeoPositionInfo pending;
- pending.info = info;
- pending.hasFix = hasFix;
- m_pendingUpdates.enqueue(pending);
- m_currTimerId = startTimer(timeToNextUpdate);
-}
-
-
-//============================================================
-
-
-QNmeaPositionInfoSourcePrivate::QNmeaPositionInfoSourcePrivate(QNmeaPositionInfoSource *parent, QNmeaPositionInfoSource::UpdateMode updateMode)
- : QObject(parent),
- m_updateMode(updateMode),
- m_device(0),
- m_invokedStart(false),
- m_positionError(QGeoPositionInfoSource::UnknownSourceError),
- m_userEquivalentRangeError(qQNaN()),
- m_source(parent),
- m_nmeaReader(0),
- m_updateTimer(0),
- m_requestTimer(0),
- m_horizontalAccuracy(qQNaN()),
- m_verticalAccuracy(qQNaN()),
- m_noUpdateLastInterval(false),
- m_updateTimeoutSent(false),
- m_connectedReadyRead(false)
-{
-}
-
-QNmeaPositionInfoSourcePrivate::~QNmeaPositionInfoSourcePrivate()
-{
- delete m_nmeaReader;
- delete m_updateTimer;
-}
-
-bool QNmeaPositionInfoSourcePrivate::openSourceDevice()
-{
- if (!m_device) {
- qWarning("QNmeaPositionInfoSource: no QIODevice data source, call setDevice() first");
- return false;
- }
-
- if (!m_device->isOpen() && !m_device->open(QIODevice::ReadOnly)) {
- qWarning("QNmeaPositionInfoSource: cannot open QIODevice data source");
- return false;
- }
-
- connect(m_device, SIGNAL(aboutToClose()), SLOT(sourceDataClosed()));
- connect(m_device, SIGNAL(readChannelFinished()), SLOT(sourceDataClosed()));
- connect(m_device, SIGNAL(destroyed()), SLOT(sourceDataClosed()));
-
- return true;
-}
-
-void QNmeaPositionInfoSourcePrivate::sourceDataClosed()
-{
- if (m_nmeaReader && m_device && m_device->bytesAvailable())
- m_nmeaReader->readAvailableData();
-}
-
-void QNmeaPositionInfoSourcePrivate::readyRead()
-{
- if (m_nmeaReader)
- m_nmeaReader->readAvailableData();
-}
-
-bool QNmeaPositionInfoSourcePrivate::initialize()
-{
- if (m_nmeaReader)
- return true;
-
- if (!openSourceDevice())
- return false;
-
- if (m_updateMode == QNmeaPositionInfoSource::RealTimeMode)
- m_nmeaReader = new QNmeaRealTimeReader(this);
- else
- m_nmeaReader = new QNmeaSimulatedReader(this);
-
- return true;
-}
-
-void QNmeaPositionInfoSourcePrivate::prepareSourceDevice()
-{
- // some data may already be available
- if (m_updateMode == QNmeaPositionInfoSource::SimulationMode) {
- if (m_nmeaReader && m_device->bytesAvailable())
- m_nmeaReader->readAvailableData();
- }
-
- if (!m_connectedReadyRead) {
- connect(m_device, SIGNAL(readyRead()), SLOT(readyRead()));
- m_connectedReadyRead = true;
- }
-}
-
-bool QNmeaPositionInfoSourcePrivate::parsePosInfoFromNmeaData(const char *data, int size,
- QGeoPositionInfo *posInfo, bool *hasFix)
-{
- return m_source->parsePosInfoFromNmeaData(data, size, posInfo, hasFix);
-}
-
-void QNmeaPositionInfoSourcePrivate::startUpdates()
-{
- if (m_invokedStart)
- return;
-
- m_positionError = QGeoPositionInfoSource::NoError;
-
- m_invokedStart = true;
- m_pendingUpdate = QGeoPositionInfo();
- m_noUpdateLastInterval = false;
-
- bool initialized = initialize();
- if (!initialized) {
- m_source->setError(QGeoPositionInfoSource::AccessError);
- return;
- }
-
- if (m_updateMode == QNmeaPositionInfoSource::RealTimeMode) {
- // skip over any buffered data - we only want the newest data.
- // Don't do this in requestUpdate. In that case bufferedData is good to have/use.
- if (m_device->bytesAvailable()) {
- if (m_device->isSequential())
- m_device->readAll();
- else
- m_device->seek(m_device->bytesAvailable());
- }
- }
-
- if (m_updateTimer)
- m_updateTimer->stop();
-
- if (m_source->updateInterval() > 0) {
- if (!m_updateTimer)
- m_updateTimer = new QBasicTimer;
- m_updateTimer->start(m_source->updateInterval(), this);
- }
-
- if (initialized)
- prepareSourceDevice();
-}
-
-void QNmeaPositionInfoSourcePrivate::stopUpdates()
-{
- m_invokedStart = false;
- if (m_updateTimer)
- m_updateTimer->stop();
- m_pendingUpdate = QGeoPositionInfo();
- m_noUpdateLastInterval = false;
-}
-
-void QNmeaPositionInfoSourcePrivate::requestUpdate(int msec)
-{
- if (m_requestTimer && m_requestTimer->isActive())
- return;
-
- m_positionError = QGeoPositionInfoSource::NoError;
-
- if (msec <= 0 || msec < m_source->minimumUpdateInterval()) {
- m_source->setError(QGeoPositionInfoSource::UpdateTimeoutError);
- return;
- }
-
- if (!m_requestTimer) {
- m_requestTimer = new QTimer(this);
- connect(m_requestTimer, SIGNAL(timeout()), SLOT(updateRequestTimeout()));
- }
-
- bool initialized = initialize();
- if (!initialized) {
- m_source->setError(QGeoPositionInfoSource::UpdateTimeoutError);
- return;
- }
-
- m_requestTimer->start(msec);
- prepareSourceDevice();
-}
-
-void QNmeaPositionInfoSourcePrivate::updateRequestTimeout()
-{
- m_requestTimer->stop();
- m_source->setError(QGeoPositionInfoSource::UpdateTimeoutError);
-}
-
-void QNmeaPositionInfoSourcePrivate::notifyNewUpdate(QGeoPositionInfo *update, bool hasFix)
-{
- // include <QDebug> before uncommenting
- //qDebug() << "QNmeaPositionInfoSourcePrivate::notifyNewUpdate()" << update->timestamp() << hasFix << m_invokedStart << (m_requestTimer && m_requestTimer->isActive());
-
- QDate date = update->timestamp().date();
- if (date.isValid()) {
- m_currentDate = date;
- } else {
- // some sentence have time but no date
- QTime time = update->timestamp().time();
- if (time.isValid() && m_currentDate.isValid())
- update->setTimestamp(QDateTime(m_currentDate, time, Qt::UTC));
- }
-
- // Some attributes are sent in separate NMEA sentences. Save and restore the accuracy
- // measurements.
- if (update->hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- m_horizontalAccuracy = update->attribute(QGeoPositionInfo::HorizontalAccuracy);
- else if (!qIsNaN(m_horizontalAccuracy))
- update->setAttribute(QGeoPositionInfo::HorizontalAccuracy, m_horizontalAccuracy);
-
- if (update->hasAttribute(QGeoPositionInfo::VerticalAccuracy))
- m_verticalAccuracy = update->attribute(QGeoPositionInfo::VerticalAccuracy);
- else if (!qIsNaN(m_verticalAccuracy))
- update->setAttribute(QGeoPositionInfo::VerticalAccuracy, m_verticalAccuracy);
-
- if (hasFix && update->isValid()) {
- if (m_requestTimer && m_requestTimer->isActive()) { // User called requestUpdate()
- m_requestTimer->stop();
- emitUpdated(*update);
- } else if (m_invokedStart) { // user called startUpdates()
- if (m_updateTimer && m_updateTimer->isActive()) { // update interval > 0
- // for periodic updates, only want the most recent update
- m_pendingUpdate = *update; // Set what to send in timerEvent()
- if (m_noUpdateLastInterval) {
- // if the update was invalid when timerEvent was last called, a valid update
- // should be sent ASAP
- emitPendingUpdate();
- m_noUpdateLastInterval = false;
- }
- } else { // update interval <= 0
- emitUpdated(*update);
- }
- }
- m_lastUpdate = *update; // Set in any case, if update is valid. Used in lastKnownPosition().
- }
-}
-
-void QNmeaPositionInfoSourcePrivate::timerEvent(QTimerEvent *)
-{
- emitPendingUpdate();
-}
-
-void QNmeaPositionInfoSourcePrivate::emitPendingUpdate()
-{
- if (m_pendingUpdate.isValid()) {
- m_updateTimeoutSent = false;
- m_noUpdateLastInterval = false;
- emitUpdated(m_pendingUpdate);
- m_pendingUpdate = QGeoPositionInfo();
- } else { // invalid update
- if (m_noUpdateLastInterval && !m_updateTimeoutSent) {
- m_updateTimeoutSent = true;
- m_pendingUpdate = QGeoPositionInfo(); // Invalid already, but clear just in case.
- m_source->setError(QGeoPositionInfoSource::UpdateTimeoutError);
- }
- m_noUpdateLastInterval = true;
- }
-}
-
-void QNmeaPositionInfoSourcePrivate::emitUpdated(const QGeoPositionInfo &update)
-{
- // check for duplication already done in QNmeaRealTimeReader::notifyNewUpdate
- // and QNmeaRealTimeReader::readAvailableData
- m_lastUpdate = update;
- emit m_source->positionUpdated(update);
-}
-
-//=========================================================
-
-/*!
- \class QNmeaPositionInfoSource
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 5.2
-
- \brief The QNmeaPositionInfoSource class provides positional information using a NMEA data source.
-
- NMEA is a commonly used protocol for the specification of one's global
- position at a certain point in time. The QNmeaPositionInfoSource class reads NMEA
- data and uses it to provide positional data in the form of
- QGeoPositionInfo objects.
-
- A QNmeaPositionInfoSource instance operates in either \l {RealTimeMode} or
- \l {SimulationMode}. These modes allow NMEA data to be read from either a
- live source of positional data, or replayed for simulation purposes from
- previously recorded NMEA data.
-
- The source of NMEA data is set with setDevice().
-
- Use startUpdates() to start receiving regular position updates and stopUpdates() to stop these
- updates. If you only require updates occasionally, you can call requestUpdate() to request a
- single update.
-
- In both cases the position information is received via the positionUpdated() signal and the
- last known position can be accessed with lastKnownPosition().
-
- QNmeaPositionInfoSource supports reporting the accuracy of the horizontal and vertical position.
- To enable position accuracy reporting an estimate of the User Equivalent Range Error associated
- with the NMEA source must be set with setUserEquivalentRangeError().
-*/
-
-
-/*!
- \enum QNmeaPositionInfoSource::UpdateMode
- Defines the available update modes.
-
- \value RealTimeMode Positional data is read and distributed from the data source as it becomes available. Use this mode if you are using a live source of positional data (for example, a GPS hardware device).
- \value SimulationMode The data and time information in the NMEA source data is used to provide positional updates at the rate at which the data was originally recorded. Use this mode if the data source contains previously recorded NMEA data and you want to replay the data for simulation purposes.
-*/
-
-
-/*!
- Constructs a QNmeaPositionInfoSource instance with the given \a parent
- and \a updateMode.
-*/
-QNmeaPositionInfoSource::QNmeaPositionInfoSource(UpdateMode updateMode, QObject *parent)
- : QGeoPositionInfoSource(parent),
- d(new QNmeaPositionInfoSourcePrivate(this, updateMode))
-{
-}
-
-/*!
- Destroys the position source.
-*/
-QNmeaPositionInfoSource::~QNmeaPositionInfoSource()
-{
- delete d;
-}
-
-/*!
- Sets the User Equivalent Range Error (UERE) to \a uere. The UERE is used in calculating an
- estimate of the accuracy of the position information reported by the position info source. The
- UERE should be set to a value appropriate for the GPS device which generated the NMEA stream.
-
- The true UERE value is calculated from multiple error sources including errors introduced by
- the satellites and signal propogation delays through the atmosphere as well as errors
- introduced by the receiving GPS equipment. For details on GPS accuracy see
- \l {https://web.archive.org/web/20161212144906if_/http://edu-observatory.org/gps/gps_accuracy.html} {Sam J. Wormley, GPS Errors & Estimating Your Reveiver's Accuracy}.
-
- A typical value for UERE is approximately 5.1.
-
- \since 5.3
-
- \sa userEquivalentRangeError()
-*/
-void QNmeaPositionInfoSource::setUserEquivalentRangeError(double uere)
-{
- d->m_userEquivalentRangeError = uere;
-}
-
-/*!
- Returns the current User Equivalent Range Error (UERE). The UERE is used in calculating an
- estimate of the accuracy of the position information reported by the position info source. The
- default value is NaN which means no accuracy information will be provided.
-
- \since 5.3
-
- \sa setUserEquivalentRangeError()
-*/
-double QNmeaPositionInfoSource::userEquivalentRangeError() const
-{
- return d->m_userEquivalentRangeError;
-}
-
-/*!
- Parses an NMEA sentence string into a QGeoPositionInfo.
-
- The default implementation will parse standard NMEA sentences.
- This method should be reimplemented in a subclass whenever the need to deal with non-standard
- NMEA sentences arises.
-
- The parser reads \a size bytes from \a data and uses that information to setup \a posInfo and
- \a hasFix. If \a hasFix is set to false then \a posInfo may contain only the time or the date
- and the time.
-
- Returns true if the sentence was successfully parsed, otherwise returns false and should not
- modifiy \a posInfo or \a hasFix.
-*/
-bool QNmeaPositionInfoSource::parsePosInfoFromNmeaData(const char *data, int size,
- QGeoPositionInfo *posInfo, bool *hasFix)
-{
- return QLocationUtils::getPosInfoFromNmea(data, size, posInfo, d->m_userEquivalentRangeError,
- hasFix);
-}
-
-/*!
- Returns the update mode.
-*/
-QNmeaPositionInfoSource::UpdateMode QNmeaPositionInfoSource::updateMode() const
-{
- return d->m_updateMode;
-}
-
-/*!
- Sets the NMEA data source to \a device. If the device is not open, it
- will be opened in QIODevice::ReadOnly mode.
-
- The source device can only be set once and must be set before calling
- startUpdates() or requestUpdate().
-
- \b {Note:} The \a device must emit QIODevice::readyRead() for the
- source to be notified when data is available for reading.
- QNmeaPositionInfoSource does not assume the ownership of the device,
- and hence does not deallocate it upon destruction.
-*/
-void QNmeaPositionInfoSource::setDevice(QIODevice *device)
-{
- if (device != d->m_device) {
- if (!d->m_device)
- d->m_device = device;
- else
- qWarning("QNmeaPositionInfoSource: source device has already been set");
- }
-}
-
-/*!
- Returns the NMEA data source.
-*/
-QIODevice *QNmeaPositionInfoSource::device() const
-{
- return d->m_device;
-}
-
-/*!
- \reimp
-*/
-void QNmeaPositionInfoSource::setUpdateInterval(int msec)
-{
- int interval = msec;
- if (interval != 0)
- interval = qMax(msec, minimumUpdateInterval());
- QGeoPositionInfoSource::setUpdateInterval(interval);
- if (d->m_invokedStart) {
- d->stopUpdates();
- d->startUpdates();
- }
-}
-
-/*!
- \reimp
-*/
-void QNmeaPositionInfoSource::startUpdates()
-{
- d->startUpdates();
-}
-
-/*!
- \reimp
-*/
-void QNmeaPositionInfoSource::stopUpdates()
-{
- d->stopUpdates();
-}
-
-/*!
- \reimp
-*/
-void QNmeaPositionInfoSource::requestUpdate(int msec)
-{
- d->requestUpdate(msec == 0 ? 60000 * 5 : msec); // 5min default timeout
-}
-
-/*!
- \reimp
-*/
-QGeoPositionInfo QNmeaPositionInfoSource::lastKnownPosition(bool) const
-{
- // the bool value does not matter since we only use satellite positioning
- return d->m_lastUpdate;
-}
-
-/*!
- \reimp
-*/
-QGeoPositionInfoSource::PositioningMethods QNmeaPositionInfoSource::supportedPositioningMethods() const
-{
- return SatellitePositioningMethods;
-}
-
-/*!
- \reimp
-*/
-int QNmeaPositionInfoSource::minimumUpdateInterval() const
-{
- return 2; // Some chips are capable of over 100 updates per seconds.
-}
-
-/*!
- \reimp
-*/
-QGeoPositionInfoSource::Error QNmeaPositionInfoSource::error() const
-{
- return d->m_positionError;
-}
-
-void QNmeaPositionInfoSource::setError(QGeoPositionInfoSource::Error positionError)
-{
- d->m_positionError = positionError;
- if (d->m_positionError != QGeoPositionInfoSource::NoError)
- emit QGeoPositionInfoSource::errorOccurred(positionError);
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qnmeapositioninfosource.h b/src/positioning/qnmeapositioninfosource.h
deleted file mode 100644
index 79a52361..00000000
--- a/src/positioning/qnmeapositioninfosource.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QNMEAPOSITIONINFOSOURCE_H
-#define QNMEAPOSITIONINFOSOURCE_H
-
-#include <QtPositioning/QGeoPositionInfoSource>
-
-QT_BEGIN_NAMESPACE
-
-class QIODevice;
-
-class QNmeaPositionInfoSourcePrivate;
-class Q_POSITIONING_EXPORT QNmeaPositionInfoSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- enum UpdateMode {
- RealTimeMode = 1,
- SimulationMode
- };
-
- explicit QNmeaPositionInfoSource(UpdateMode updateMode, QObject *parent = nullptr);
- ~QNmeaPositionInfoSource();
-
- void setUserEquivalentRangeError(double uere);
- double userEquivalentRangeError() const;
-
- UpdateMode updateMode() const;
-
- void setDevice(QIODevice *source);
- QIODevice *device() const;
-
- void setUpdateInterval(int msec) override;
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
- PositioningMethods supportedPositioningMethods() const override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-
-public Q_SLOTS:
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 0) override;
-
-protected:
- virtual bool parsePosInfoFromNmeaData(const char *data,
- int size,
- QGeoPositionInfo *posInfo,
- bool *hasFix);
- void setError(QGeoPositionInfoSource::Error positionError);
-
-private:
- Q_DISABLE_COPY(QNmeaPositionInfoSource)
- friend class QNmeaPositionInfoSourcePrivate;
- QNmeaPositionInfoSourcePrivate *d;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qnmeapositioninfosource_p.h b/src/positioning/qnmeapositioninfosource_p.h
deleted file mode 100644
index 9874f3fd..00000000
--- a/src/positioning/qnmeapositioninfosource_p.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QNMEAPOSITIONINFOSOURCE_P_H
-#define QNMEAPOSITIONINFOSOURCE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qnmeapositioninfosource.h"
-#include "qgeopositioninfo.h"
-
-#include <QObject>
-#include <QQueue>
-#include <QPointer>
-#include <QtCore/qtimer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QBasicTimer;
-class QTimerEvent;
-class QTimer;
-
-class QNmeaReader;
-struct QPendingGeoPositionInfo
-{
- QGeoPositionInfo info;
- bool hasFix;
-};
-
-
-class QNmeaPositionInfoSourcePrivate : public QObject
-{
- Q_OBJECT
-public:
- QNmeaPositionInfoSourcePrivate(QNmeaPositionInfoSource *parent, QNmeaPositionInfoSource::UpdateMode updateMode);
- ~QNmeaPositionInfoSourcePrivate();
-
- void startUpdates();
- void stopUpdates();
- void requestUpdate(int msec);
-
- bool parsePosInfoFromNmeaData(const char *data,
- int size,
- QGeoPositionInfo *posInfo,
- bool *hasFix);
-
- void notifyNewUpdate(QGeoPositionInfo *update, bool fixStatus);
-
- QNmeaPositionInfoSource::UpdateMode m_updateMode;
- QPointer<QIODevice> m_device;
- QGeoPositionInfo m_lastUpdate;
- bool m_invokedStart;
- QGeoPositionInfoSource::Error m_positionError;
- double m_userEquivalentRangeError;
-
-public Q_SLOTS:
- void readyRead();
-
-protected:
- void timerEvent(QTimerEvent *event) override;
-
-private Q_SLOTS:
- void emitPendingUpdate();
- void sourceDataClosed();
- void updateRequestTimeout();
-
-private:
- bool openSourceDevice();
- bool initialize();
- void prepareSourceDevice();
- void emitUpdated(const QGeoPositionInfo &update);
-
- QNmeaPositionInfoSource *m_source;
- QNmeaReader *m_nmeaReader;
- QGeoPositionInfo m_pendingUpdate;
- QDate m_currentDate;
- QBasicTimer *m_updateTimer; // the timer used in startUpdates()
- QTimer *m_requestTimer; // the timer used in requestUpdate()
- qreal m_horizontalAccuracy;
- qreal m_verticalAccuracy;
- bool m_noUpdateLastInterval;
- bool m_updateTimeoutSent;
- bool m_connectedReadyRead;
-};
-
-
-class QNmeaReader
-{
-public:
- explicit QNmeaReader(QNmeaPositionInfoSourcePrivate *sourcePrivate)
- : m_proxy(sourcePrivate) {}
- virtual ~QNmeaReader() {}
-
- virtual void readAvailableData() = 0;
-
-protected:
- QNmeaPositionInfoSourcePrivate *m_proxy;
-};
-
-
-class QNmeaRealTimeReader : public QNmeaReader
-{
-public:
- explicit QNmeaRealTimeReader(QNmeaPositionInfoSourcePrivate *sourcePrivate);
- void readAvailableData() override;
- void notifyNewUpdate();
-
- // Data members
- QGeoPositionInfo m_update;
- QDateTime m_lastPushedTS;
- bool m_updateParsed = false;
- bool m_hasFix = false;
- QTimer m_timer;
- int m_pushDelay = -1;
-};
-
-
-class QNmeaSimulatedReader : public QObject, public QNmeaReader
-{
- Q_OBJECT
-public:
- explicit QNmeaSimulatedReader(QNmeaPositionInfoSourcePrivate *sourcePrivate);
- ~QNmeaSimulatedReader();
- void readAvailableData() override;
-
-protected:
- void timerEvent(QTimerEvent *event) override;
-
-private Q_SLOTS:
- void simulatePendingUpdate();
-
-private:
- bool setFirstDateTime();
- void processNextSentence();
-
- QQueue<QPendingGeoPositionInfo> m_pendingUpdates;
- QByteArray m_nextLine;
- int m_currTimerId;
- bool m_hasValidDateTime;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qnmeasatelliteinfosource.cpp b/src/positioning/qnmeasatelliteinfosource.cpp
deleted file mode 100644
index a27ac2b0..00000000
--- a/src/positioning/qnmeasatelliteinfosource.cpp
+++ /dev/null
@@ -1,909 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnmeasatelliteinfosource.h"
-#include "private/qnmeasatelliteinfosource_p.h"
-#include <QtPositioning/private/qgeosatelliteinfo_p.h>
-#include <QtPositioning/private/qgeosatelliteinfosource_p.h>
-#include <QtPositioning/private/qlocationutils_p.h>
-
-#include <QIODevice>
-#include <QBasicTimer>
-#include <QTimerEvent>
-#include <QTimer>
-#include <array>
-#include <QDebug>
-#include <QtCore/QtNumeric>
-
-QT_BEGIN_NAMESPACE
-
-#if USE_NMEA_PIMPL
-class QGeoSatelliteInfoPrivateNmea : public QGeoSatelliteInfoPrivate
-{
-public:
- QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteInfoPrivate &other);
- QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteInfoPrivateNmea &other);
- virtual ~QGeoSatelliteInfoPrivateNmea();
-
- QList<QByteArray> nmeaSentences;
-};
-
-QGeoSatelliteInfoPrivateNmea::QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteInfoPrivate &other)
- : QGeoSatelliteInfoPrivate(other)
-{
-}
-
-QGeoSatelliteInfoPrivateNmea::QGeoSatelliteInfoPrivateNmea(const QGeoSatelliteInfoPrivateNmea &other)
- : QGeoSatelliteInfoPrivate(other)
-{
- nmeaSentences = other.nmeaSentences;
-}
-
-QGeoSatelliteInfoPrivateNmea::~QGeoSatelliteInfoPrivateNmea() {}
-#else
-typedef QGeoSatelliteInfoPrivate QGeoSatelliteInfoPrivateNmea;
-#endif
-
-QNmeaSatelliteInfoSourcePrivate::QNmeaSatelliteInfoSourcePrivate(QNmeaSatelliteInfoSource *parent, QNmeaSatelliteInfoSource::UpdateMode updateMode)
- : m_source(parent),
- m_updateMode(updateMode)
-{
-}
-
-void QNmeaSatelliteInfoSourcePrivate::notifyNewUpdate()
-{
- if (m_pendingUpdate.isValid() && m_pendingUpdate.isFresh()) {
- if (m_requestTimer && m_requestTimer->isActive()) { // User called requestUpdate()
- m_requestTimer->stop();
- emitUpdated(m_pendingUpdate, true);
- } else if (m_invokedStart) { // user called startUpdates()
- if (m_updateTimer && m_updateTimer->isActive()) { // update interval > 0
- // for periodic updates, only want the most recent update
- if (m_noUpdateLastInterval) {
- // if the update was invalid when timerEvent was last called, a valid update
- // should be sent ASAP
- emitPendingUpdate(); // m_noUpdateLastInterval handled in there.
- }
- } else { // update interval <= 0, send anything new ASAP
- m_noUpdateLastInterval = !emitUpdated(m_pendingUpdate, false);
- }
- }
- }
-}
-
-void QNmeaSatelliteInfoSourcePrivate::processNmeaData(QNmeaSatelliteInfoUpdate &updateInfo)
-{
- char buf[1024];
- qint64 size = m_device->readLine(buf, sizeof(buf));
- QList<int> satInUse;
- const auto satSystemType = m_source->parseSatellitesInUseFromNmea(buf, size, satInUse);
- if (satSystemType != QGeoSatelliteInfo::Undefined) {
- const bool res = updateInfo.setSatellitesInUse(satSystemType, satInUse);
-#if USE_NMEA_PIMPL
- if (res) {
- updateInfo.gsa = QByteArray(buf, size);
- auto &info = updateInfo.m_satellites[satSystemType];
- if (info.satellitesInUse.size()) {
- for (auto &s : info.satellitesInUse) {
- static_cast<QGeoSatelliteInfoPrivateNmea *>(QGeoSatelliteInfoPrivate::get(s))
- ->nmeaSentences.append(updateInfo.gsa);
- }
- for (auto &s : info.satellitesInView) {
- static_cast<QGeoSatelliteInfoPrivateNmea *>(QGeoSatelliteInfoPrivate::get(s))
- ->nmeaSentences.append(updateInfo.gsa);
- }
- }
- }
-#else
- Q_UNUSED(res)
-#endif // USE_NMEA_PIMPL
- } else {
- // Here we have the assumption that multiple parts of GSV sentence
- // come one after another. At least this is how it should be.
- auto systemType = QGeoSatelliteInfo::Undefined;
- const auto parserStatus = m_source->parseSatelliteInfoFromNmea(
- buf, size, updateInfo.m_satellitesInViewParsed, systemType);
- if (parserStatus == QNmeaSatelliteInfoSource::PartiallyParsed) {
- updateInfo.m_satellites[systemType].updatingGSV = true;
-#if USE_NMEA_PIMPL
- updateInfo.gsv.append(QByteArray(buf, size));
-#endif
- } else if (parserStatus == QNmeaSatelliteInfoSource::FullyParsed) {
-#if USE_NMEA_PIMPL
- updateInfo.gsv.append(QByteArray(buf, size));
- for (int i = 0; i < updateInfo.m_satellitesInViewParsed.size(); i++) {
- const QGeoSatelliteInfo &s = updateInfo.m_satellitesInViewParsed.at(i);
- QGeoSatelliteInfoPrivateNmea *pimpl =
- new QGeoSatelliteInfoPrivateNmea(*QGeoSatelliteInfoPrivate::get(s));
- pimpl->nmeaSentences.append(updateInfo.gsa);
- pimpl->nmeaSentences.append(updateInfo.gsv);
- updateInfo.m_satellitesInViewParsed.replace(i, QGeoSatelliteInfo(*pimpl));
- }
- updateInfo.gsv.clear();
-#endif
- updateInfo.setSatellitesInView(systemType, updateInfo.m_satellitesInViewParsed);
- }
- }
-}
-
-QNmeaSatelliteInfoSourcePrivate::~QNmeaSatelliteInfoSourcePrivate()
-{
- delete m_updateTimer;
-}
-
-void QNmeaSatelliteInfoSourcePrivate::startUpdates()
-{
- if (m_invokedStart)
- return;
-
- m_satelliteError = QGeoSatelliteInfoSource::NoError;
-
- m_invokedStart = true;
- m_pendingUpdate.clear();
- m_noUpdateLastInterval = false;
-
- bool initialized = initialize();
- if (!initialized)
- return;
-
- if (m_updateMode == QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode) {
- // skip over any buffered data - we only want the newest data.
- // Don't do this in requestUpdate. In that case bufferedData is good to have/use.
- if (m_device->bytesAvailable()) {
- if (m_device->isSequential())
- m_device->readAll();
- else
- m_device->seek(m_device->bytesAvailable());
- }
- }
-
- if (m_updateTimer)
- m_updateTimer->stop();
-
- if (m_source->updateInterval() > 0) {
- if (!m_updateTimer)
- m_updateTimer = new QBasicTimer;
- m_updateTimer->start(m_source->updateInterval(), this);
- }
-
- if (initialized)
- prepareSourceDevice();
-}
-
-void QNmeaSatelliteInfoSourcePrivate::stopUpdates()
-{
- m_invokedStart = false;
- if (m_updateTimer)
- m_updateTimer->stop();
- m_pendingUpdate.clear();
- m_noUpdateLastInterval = false;
-}
-
-void QNmeaSatelliteInfoSourcePrivate::requestUpdate(int msec)
-{
- if (m_requestTimer && m_requestTimer->isActive())
- return;
-
- m_satelliteError = QGeoSatelliteInfoSource::NoError;
-
- if (msec <= 0 || msec < m_source->minimumUpdateInterval()) {
- m_source->setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
- return;
- }
-
- if (!m_requestTimer) {
- m_requestTimer = new QTimer(this);
- connect(m_requestTimer, SIGNAL(timeout()), SLOT(updateRequestTimeout()));
- }
-
- bool initialized = initialize();
- if (!initialized) {
- m_source->setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
- return;
- }
-
- m_requestTimer->start(msec);
- prepareSourceDevice();
-}
-
-void QNmeaSatelliteInfoSourcePrivate::readyRead()
-{
- if (m_nmeaReader)
- m_nmeaReader->readAvailableData();
-}
-
-void QNmeaSatelliteInfoSourcePrivate::emitPendingUpdate()
-{
- if (m_pendingUpdate.isValid() && m_pendingUpdate.isFresh()) {
- m_updateTimeoutSent = false;
- m_noUpdateLastInterval = false;
- if (!emitUpdated(m_pendingUpdate, false))
- m_noUpdateLastInterval = true;
- // m_pendingUpdate.clear(); // Do not clear, it will be incrementally updated
- } else { // invalid or not fresh update
- if (m_noUpdateLastInterval && !m_updateTimeoutSent) {
- m_updateTimeoutSent = true;
- m_source->setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
- }
- m_noUpdateLastInterval = true;
- }
-}
-
-void QNmeaSatelliteInfoSourcePrivate::sourceDataClosed()
-{
- if (m_nmeaReader && m_device && m_device->bytesAvailable())
- m_nmeaReader->readAvailableData();
-}
-
-void QNmeaSatelliteInfoSourcePrivate::updateRequestTimeout()
-{
- m_requestTimer->stop();
- m_source->setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
-}
-
-bool QNmeaSatelliteInfoSourcePrivate::openSourceDevice()
-{
- if (!m_device) {
- qWarning("QNmeaSatelliteInfoSource: no QIODevice data source, call setDevice() first");
- return false;
- }
-
- if (!m_device->isOpen() && !m_device->open(QIODevice::ReadOnly)) {
- qWarning("QNmeaSatelliteInfoSource: cannot open QIODevice data source");
- return false;
- }
-
- connect(m_device, SIGNAL(aboutToClose()), SLOT(sourceDataClosed()));
- connect(m_device, SIGNAL(readChannelFinished()), SLOT(sourceDataClosed()));
- connect(m_device, SIGNAL(destroyed()), SLOT(sourceDataClosed()));
-
- return true;
-}
-
-bool QNmeaSatelliteInfoSourcePrivate::initialize()
-{
- if (m_nmeaReader)
- return true;
-
- if (!openSourceDevice())
- return false;
-
- if (m_updateMode == QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode)
- m_nmeaReader.reset(new QNmeaSatelliteRealTimeReader(this));
- else
- m_nmeaReader.reset(new QNmeaSatelliteSimulationReader(this));
-
- return true;
-}
-
-void QNmeaSatelliteInfoSourcePrivate::prepareSourceDevice()
-{
- // some data may already be available
- if (m_updateMode == QNmeaSatelliteInfoSource::UpdateMode::SimulationMode) {
- if (m_nmeaReader && m_device->bytesAvailable())
- m_nmeaReader->readAvailableData();
- }
-
- if (!m_connectedReadyRead) {
- connect(m_device, SIGNAL(readyRead()), SLOT(readyRead()));
- m_connectedReadyRead = true;
- }
-}
-
-bool QNmeaSatelliteInfoSourcePrivate::emitUpdated(QNmeaSatelliteInfoUpdate &update,
- bool fromRequestUpdate)
-{
- bool emitted = false;
- if (!update.isFresh())
- return emitted;
-
- update.consume();
- bool inUseUpdated = false;
- bool inViewUpdated = false;
- if (!fromRequestUpdate) {
- // we need to send update if information from at least one satellite
- // systems has changed
- for (auto it = update.m_satellites.cbegin(); it != update.m_satellites.cend(); ++it) {
- inUseUpdated |=
- it->satellitesInUse != m_lastUpdate.m_satellites[it.key()].satellitesInUse;
- inViewUpdated |=
- it->satellitesInView != m_lastUpdate.m_satellites[it.key()].satellitesInView;
- }
- } else {
- // if we come here from requestUpdate(), we need to emit, even if the data
- // didn't really change
- inUseUpdated = true;
- inViewUpdated = true;
- }
-
- m_lastUpdate = update;
- if (update.m_validInUse && inUseUpdated) {
- emit m_source->satellitesInUseUpdated(update.allSatellitesInUse());
- emitted = true;
- }
- if (update.m_validInView && inViewUpdated) {
- emit m_source->satellitesInViewUpdated(update.allSatellitesInView());
- emitted = true;
- }
- return emitted;
-}
-
-void QNmeaSatelliteInfoSourcePrivate::timerEvent(QTimerEvent * /*event*/)
-{
- emitPendingUpdate();
-}
-
-/*!
- \class QNmeaSatelliteInfoSource
- \inmodule QtPositioning
- \ingroup QtPositioning-positioning
- \since 6.2
-
- \brief The \l QNmeaSatelliteInfoSource class provides satellite information
- using an NMEA data source.
-
- NMEA is a commonly used protocol for the specification of one's global
- position at a certain point in time. The \l QNmeaSatelliteInfoSource class
- reads NMEA data and uses it to provide information about satellites in view
- and satellites in use in form of lists of \l QGeoSatelliteInfo objects.
-
- A \l QNmeaSatelliteInfoSource instance operates in either \l {RealTimeMode}
- or \l {SimulationMode}. These modes allow NMEA data to be read from either a
- live source of data, or replayed for simulation purposes from previously
- recorded NMEA data.
-
- The source of NMEA data is set via \l setDevice().
-
- Use \l startUpdates() to start receiving regular satellite information
- updates and \l stopUpdates() to stop these updates. If you only require
- updates occasionally, you can call \l requestUpdate() to request a single
- update of both satellites in view and satellites in use.
-
- The information about satellites in view is received via the
- \l satellitesInViewUpdated() signal.
-
- The information about satellites in use is received via the
- \l satellitesInUseUpdated() signal.
-*/
-
-/*!
- \enum QNmeaSatelliteInfoSource::UpdateMode
- Defines the available update modes.
-
- \value RealTimeMode Satellite information is read and distributed from the
- data source as it becomes available. Use this mode if you are using
- a live source of NMEA data (for example a GPS hardware device).
- \value SimulationMode Satellite information is read and distributed from the
- data source at the given rate. The rate is determined by the
- \l {QNmeaSatelliteInfoSource::}{SimulationUpdateInterval} parameter.
- Use this mode if the data source contains previously recorded NMEA
- data and you want to replay the data for simulation purposes.
-*/
-
-/*!
- \variable QNmeaSatelliteInfoSource::SimulationUpdateInterval
- \brief The backend property name for data read rate in the
- \l SimulationMode. The value for this property is the integer number
- representing the amount of milliseconds between the subsequent reads.
- Use this parameter in the \l {QNmeaSatelliteInfoSource::}
- {setBackendProperty()} and \l {QNmeaSatelliteInfoSource::}{backendProperty()}
- methods.
-
- \note This property is different from the interval that can be set via
- \l {setUpdateInterval()}. The value set via \l {setUpdateInterval()}
- denotes an interval for the user notification, while this parameter
- specifies the internal frequency of reading the data from source file. It
- means that one can have multiple (or none) reads during the
- \l {updateInterval()} period.
-*/
-QString QNmeaSatelliteInfoSource::SimulationUpdateInterval =
- QStringLiteral("nmea.satellite_info_simulation_interval");
-
-/*!
- Constructs a \l QNmeaSatelliteInfoSource instance with the given \a parent
- and \a mode.
-*/
-QNmeaSatelliteInfoSource::QNmeaSatelliteInfoSource(UpdateMode mode, QObject *parent)
- : QGeoSatelliteInfoSource(parent),
- d(new QNmeaSatelliteInfoSourcePrivate(this, mode))
-{
-}
-
-/*!
- Destroys the satellite information source.
-*/
-QNmeaSatelliteInfoSource::~QNmeaSatelliteInfoSource()
-{
- delete d;
-}
-
-/*!
- Returns the update mode.
-*/
-QNmeaSatelliteInfoSource::UpdateMode QNmeaSatelliteInfoSource::updateMode() const
-{
- return d->m_updateMode;
-}
-
-/*!
- Sets the NMEA data source to \a device. If the device is not open, it
- will be opened in QIODevice::ReadOnly mode.
-
- The source device can only be set once and must be set before calling
- \l startUpdates() or \l requestUpdate().
-
- \note The \a device must emit \l {QIODevice::readyRead()} for the
- source to be notified when data is available for reading.
- \l QNmeaSatelliteInfoSource does not assume the ownership of the device,
- and hence does not deallocate it upon destruction.
-*/
-void QNmeaSatelliteInfoSource::setDevice(QIODevice *device)
-{
- if (device != d->m_device) {
- if (!d->m_device)
- d->m_device = device;
- else
- qWarning("QNmeaSatelliteInfoSource: source device has already been set");
- }
-}
-
-/*!
- Returns the NMEA data source.
-*/
-QIODevice *QNmeaSatelliteInfoSource::device() const
-{
- return d->m_device;
-}
-
-/*!
- \reimp
-*/
-void QNmeaSatelliteInfoSource::setUpdateInterval(int msec)
-{
- int interval = msec;
- if (interval != 0)
- interval = qMax(msec, minimumUpdateInterval());
- QGeoSatelliteInfoSource::setUpdateInterval(interval);
- if (d->m_invokedStart) {
- d->stopUpdates();
- d->startUpdates();
- }
-}
-
-/*!
- \reimp
-*/
-int QNmeaSatelliteInfoSource::minimumUpdateInterval() const
-{
- return 2; // Some chips are capable of over 100 updates per seconds.
-}
-
-/*!
- \reimp
-*/
-QGeoSatelliteInfoSource::Error QNmeaSatelliteInfoSource::error() const
-{
- return d->m_satelliteError;
-}
-
-/*!
- \reimp
-*/
-bool QNmeaSatelliteInfoSource::setBackendProperty(const QString &name, const QVariant &value)
-{
- if (name == SimulationUpdateInterval && d->m_updateMode == UpdateMode::SimulationMode) {
- bool ok = false;
- const int interval = value.toInt(&ok);
- if (ok) {
- auto *reader = dynamic_cast<QNmeaSatelliteSimulationReader *>(d->m_nmeaReader.get());
- if (reader) {
- reader->setUpdateInterval(interval);
- } else {
- // d->m_nmeaReader will use it in constructor
- d->m_simulationUpdateInterval = interval;
- }
- return true;
- }
- }
- return false;
-}
-
-/*!
- \reimp
-*/
-QVariant QNmeaSatelliteInfoSource::backendProperty(const QString &name) const
-{
- if (name == SimulationUpdateInterval && d->m_updateMode == UpdateMode::SimulationMode) {
- auto *reader = dynamic_cast<QNmeaSatelliteSimulationReader *>(d->m_nmeaReader.get());
- if (reader)
- return reader->updateInterval();
- else
- return d->m_simulationUpdateInterval;
- }
- return QVariant();
-}
-
-/*!
- \reimp
-*/
-void QNmeaSatelliteInfoSource::startUpdates()
-{
- d->startUpdates();
-}
-
-/*!
- \reimp
-*/
-void QNmeaSatelliteInfoSource::stopUpdates()
-{
- d->stopUpdates();
-}
-
-/*!
- \reimp
-*/
-void QNmeaSatelliteInfoSource::requestUpdate(int msec)
-{
- d->requestUpdate(msec == 0 ? 60000 * 5 : msec); // 5min default timeout
-}
-
-/*!
- Parses an NMEA sentence string to extract the IDs of satelites in use.
-
- The default implementation will parse standard NMEA $GPGSA sentences.
- This method should be reimplemented in a subclass whenever the need to deal
- with non-standard NMEA sentences arises.
-
- The parser reads \a size bytes from \a data and uses that information to
- fill \a pnrsInUse list.
-
- Returns system type if the sentence was successfully parsed, otherwise
- returns \l QGeoSatelliteInfo::Undefined and should not modifiy \a pnrsInUse.
-*/
-QGeoSatelliteInfo::SatelliteSystem
-QNmeaSatelliteInfoSource::parseSatellitesInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse)
-{
- return QLocationUtils::getSatInUseFromNmea(data, size, pnrsInUse);
-}
-
-/*!
- \enum QNmeaSatelliteInfoSource::SatelliteInfoParseStatus
- Defines the parse status of satellite information. The satellite information
- can be split into multiple sentences, and we need to parse all of them.
- \value NotParsed The data does not contain information about satellites.
- \value PartiallyParsed A valid satellite information is received and parsed,
- but it's not complete, so we need to wait for another NMEA sentence.
- \value FullyParsed Satellite information was fully collected and parsed.
-*/
-
-/*!
- Parses an NMEA sentence string to extract the information about satellites
- in view.
-
- The default implementation will parse standard NMEA $GPGSV sentences.
- This method should be reimplemented in a subclass whenever the need to deal
- with non-standard NMEA sentences arises.
-
- The parser reads \a size bytes from \a data and uses that information to
- fill \a infos list.
-
- Returns \l SatelliteInfoParseStatus with parse result.
- Modifies \a infos list in case \l {QNmeaSatelliteInfoSource::}
- {PartiallyParsed} or \l {QNmeaSatelliteInfoSource::}{FullyParsed} is
- returned.
- Also sets the \a system to correct satellite system type. This is required
- to determine the system type in case there are no satellites in view.
-*/
-QNmeaSatelliteInfoSource::SatelliteInfoParseStatus
-QNmeaSatelliteInfoSource::parseSatelliteInfoFromNmea(const char *data, int size,
- QList<QGeoSatelliteInfo> &infos,
- QGeoSatelliteInfo::SatelliteSystem &system)
-{
- return static_cast<SatelliteInfoParseStatus>(
- QLocationUtils::getSatInfoFromNmea(data, size, infos, system));
-}
-
-void QNmeaSatelliteInfoSource::setError(QGeoSatelliteInfoSource::Error satelliteError)
-{
- d->m_satelliteError = satelliteError;
- if (d->m_satelliteError != QGeoSatelliteInfoSource::NoError)
- emit QGeoSatelliteInfoSource::errorOccurred(satelliteError);
-}
-
-QList<QGeoSatelliteInfo> QNmeaSatelliteInfoUpdate::allSatellitesInUse() const
-{
- QList<QGeoSatelliteInfo> result;
- for (const auto &s : m_satellites)
- result.append(s.satellitesInUse);
- return result;
-}
-
-QList<QGeoSatelliteInfo> QNmeaSatelliteInfoUpdate::allSatellitesInView() const
-{
- QList<QGeoSatelliteInfo> result;
- for (const auto &s : m_satellites)
- result.append(s.satellitesInView);
- return result;
-}
-
-void QNmeaSatelliteInfoUpdate::setSatellitesInView(QGeoSatelliteInfo::SatelliteSystem system,
- const QList<QGeoSatelliteInfo> &inView)
-{
- auto &info = m_satellites[system];
- info.updatingGSV = false;
-
- info.satellitesInView = inView;
- info.validInView = true;
-
- if (!info.satellitesInUseReceived) {
- // Normally a GSA message should come after a GSV message. If this flag
- // is not set, we have received 2 consecutive GSV messages for this
- // system without a GSA in between.
- // This means that we could actually receive a $GNGSA empty message for
- // this specific type. As it had no ids and GN talker id, we could not
- // determine system type. This most probably means that we have no
- // satellites in use for this system type.
- // Clear satellites in use, if any.
- info.satellitesInUse.clear();
- info.inUseIds.clear();
- info.validInUse = true;
- }
- info.satellitesInUseReceived = false;
-
- if (info.satellitesInView.isEmpty()) {
- // If we received an empty list of satellites in view, then the list of
- // satellites in use will also be empty, so we would not be able to
- // match it with correct system type in case of $GNGSA message. Clear
- // the list in advance.
- info.satellitesInUse.clear();
- info.inUseIds.clear();
- info.validInUse = true;
- } else if (!info.inUseIds.isEmpty()) {
- // We have some satellites in use cached. Check if we have received the
- // proper GSV for them.
- info.satellitesInUse.clear();
- info.validInUse = false;
- bool corrupt = false;
- for (const auto id : info.inUseIds) {
- bool found = false;
- for (const auto &s : info.satellitesInView) {
- if (s.satelliteIdentifier() == id) {
- info.satellitesInUse.append(s);
- found = true;
- break;
- }
- }
- if (!found) {
- // The previoulsy received GSA is incorrect or not related to
- // this GSV
- info.satellitesInUse.clear();
- corrupt = true;
- break;
- }
- }
- info.validInUse = !corrupt;
- info.inUseIds.clear();
- }
-
- m_validInUse = calculateValidInUse();
- m_validInView = calculateValidInView();
- m_fresh = true;
-}
-
-bool QNmeaSatelliteInfoUpdate::setSatellitesInUse(QGeoSatelliteInfo::SatelliteSystem system,
- const QList<int> &inUse)
-{
- if (system == QGeoSatelliteInfo::Undefined || system == QGeoSatelliteInfo::Multiple)
- return false; // No way to determine satellite system
-
- SatelliteInfo &info = m_satellites[system];
- info.satellitesInUse.clear();
-
- info.satellitesInUseReceived = true;
- info.inUseIds = inUse;
-
- if (info.updatingGSV) {
- info.validInView = false;
- m_validInView = false;
- return false;
- }
-
- for (const auto id : inUse) {
- bool found = false;
- for (const auto &s : info.satellitesInView) {
- if (s.satelliteIdentifier() == id) {
- info.satellitesInUse.append(s);
- found = true;
- break;
- }
- }
- if (!found) {
- // satellites in use are not in view -> related GSV is not yet received
- info.satellitesInView.clear();
- info.validInView = false;
- m_validInView = false;
- return false;
- }
- }
-
- info.inUseIds.clear(); // make sure we remove all obsolete cache
-
- info.validInUse = true;
- m_fresh = true;
- m_validInUse = calculateValidInUse();
-
- return true;
-}
-
-void QNmeaSatelliteInfoUpdate::consume()
-{
- m_fresh = false;
-}
-
-bool QNmeaSatelliteInfoUpdate::isFresh() const
-{
- return m_fresh;
-}
-
-void QNmeaSatelliteInfoUpdate::clear()
-{
- m_satellites.clear();
- m_satellitesInViewParsed.clear();
- m_validInView = false;
- m_validInUse = false;
- m_fresh = false;
-#if USE_NMEA_PIMPL
- gsa.clear();
- gsv.clear();
-#endif
-}
-
-bool QNmeaSatelliteInfoUpdate::isValid() const
-{
- // GSV without GSA is valid. GSA with outdated but still matching GSV also valid.
- return m_validInView || m_validInUse;
-}
-
-bool QNmeaSatelliteInfoUpdate::calculateValidInUse() const
-{
- for (const auto &s : m_satellites) {
- if (!s.validInUse)
- return false;
- }
- return true;
-}
-
-bool QNmeaSatelliteInfoUpdate::calculateValidInView() const
-{
- for (const auto &s : m_satellites) {
- if (!s.validInView)
- return false;
- }
- return true;
-}
-
-QNmeaSatelliteReader::QNmeaSatelliteReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
- : m_proxy(sourcePrivate)
-{
-}
-
-QNmeaSatelliteReader::~QNmeaSatelliteReader()
-{
-}
-
-QNmeaSatelliteRealTimeReader::QNmeaSatelliteRealTimeReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
- : QNmeaSatelliteReader(sourcePrivate)
-{
-}
-
-void QNmeaSatelliteRealTimeReader::readAvailableData()
-{
- while (m_proxy->m_device->canReadLine())
- m_proxy->processNmeaData(m_proxy->m_pendingUpdate);
- m_proxy->notifyNewUpdate();
-}
-
-QNmeaSatelliteSimulationReader::QNmeaSatelliteSimulationReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate)
- : QNmeaSatelliteReader(sourcePrivate)
-{
- m_timer.reset(new QTimer);
- QObject::connect(m_timer.get(), &QTimer::timeout, [this]() {
- readAvailableData();
- });
- m_updateInterval =
- qMax(m_proxy->m_simulationUpdateInterval, m_proxy->m_source->minimumUpdateInterval());
-}
-
-void QNmeaSatelliteSimulationReader::readAvailableData()
-{
- if (!m_timer->isActive()) {
- // At the very first start we just start a timer to simulate a short
- // delay for overlapping requestUpdate() calls.
- // See TestQGeoSatelliteInfoSource::requestUpdate_overlappingCalls and
- // TestQGeoSatelliteInfoSource::requestUpdate_overlappingCallsWithTimeout
- m_timer->start(m_updateInterval);
- } else {
- // Here we try to get both satellites in view and satellites in use.
- // We behave like that because according to the QGeoSatelliteInfoSource
- // tests each call to requestUpdate() should return both satellites in
- // view and satellites in use. Same is expected on each interval for
- // startUpdates().
- // However user-provided NMEA logs might not contain some of the
- // messages, so we will try not to get stuck here infinitely.
- int numSatInUseMsgs = 0;
- int numSatInViewMsgs = 0;
- while (!numSatInUseMsgs || !numSatInViewMsgs) {
- m_proxy->processNmeaData(m_proxy->m_pendingUpdate);
- if (m_proxy->m_pendingUpdate.m_validInUse)
- numSatInUseMsgs++;
- if (m_proxy->m_pendingUpdate.m_validInView)
- numSatInViewMsgs++;
- // if we got the second message for one of them, but still didn't
- // receive any for the other - break.
- // We use 2 in the comparison, because, as soon as the m_validIn*
- // flag is set, it will stay true until we receive invalid message.
- if (numSatInUseMsgs > 2 || numSatInViewMsgs > 2) {
- const QString msgType = (numSatInUseMsgs > numSatInViewMsgs)
- ? QStringLiteral("GSA")
- : QStringLiteral("GSV");
- qWarning() << "nmea simulation reader: possibly incorrect message order. Got too "
- "many consecutive"
- << msgType << "messages";
- break;
- }
- }
- m_proxy->notifyNewUpdate();
- }
-}
-
-void QNmeaSatelliteSimulationReader::setUpdateInterval(int msec)
-{
- // restart the timer with new interval
- m_updateInterval = qMax(msec, m_proxy->m_source->minimumUpdateInterval());
- if (m_timer->isActive())
- m_timer->start(m_updateInterval);
-}
-
-int QNmeaSatelliteSimulationReader::updateInterval() const
-{
- return m_updateInterval;
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qnmeasatelliteinfosource.h b/src/positioning/qnmeasatelliteinfosource.h
deleted file mode 100644
index 538edfee..00000000
--- a/src/positioning/qnmeasatelliteinfosource.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QNMEASATELLITEINFOSOURCE_H
-#define QNMEASATELLITEINFOSOURCE_H
-
-#include <QtPositioning/QGeoSatelliteInfoSource>
-
-QT_BEGIN_NAMESPACE
-
-class QIODevice;
-
-class QNmeaSatelliteInfoSourcePrivate;
-class Q_POSITIONING_EXPORT QNmeaSatelliteInfoSource : public QGeoSatelliteInfoSource
-{
- Q_OBJECT
-public:
- enum class UpdateMode {
- RealTimeMode = 1,
- SimulationMode
- };
-
- static QString SimulationUpdateInterval;
-
- explicit QNmeaSatelliteInfoSource(UpdateMode mode, QObject *parent = nullptr);
- ~QNmeaSatelliteInfoSource() override;
-
- UpdateMode updateMode() const;
-
- void setDevice(QIODevice *source);
- QIODevice *device() const;
-
- void setUpdateInterval(int msec) override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
- bool setBackendProperty(const QString &name, const QVariant &value) override;
- QVariant backendProperty(const QString &name) const override;
-
-public Q_SLOTS:
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 0) override;
-
-protected:
- virtual QGeoSatelliteInfo::SatelliteSystem
- parseSatellitesInUseFromNmea(const char *data, int size, QList<int> &pnrsInUse);
- enum SatelliteInfoParseStatus {
- NotParsed = 0,
- PartiallyParsed,
- FullyParsed
- };
- virtual SatelliteInfoParseStatus parseSatelliteInfoFromNmea(const char *data, int size,
- QList<QGeoSatelliteInfo> &infos,
- QGeoSatelliteInfo::SatelliteSystem &system);
-
- QNmeaSatelliteInfoSourcePrivate *d;
- void setError(QGeoSatelliteInfoSource::Error satelliteError);
-
- friend class QNmeaSatelliteInfoSourcePrivate;
- Q_DISABLE_COPY(QNmeaSatelliteInfoSource)
-
- // for using the SatelliteInfoParseStatus enum
- friend class QLocationUtils;
-};
-
-QT_END_NAMESPACE
-
-#endif // QNMEASATELLITEINFOSOURCE_H
diff --git a/src/positioning/qnmeasatelliteinfosource_p.h b/src/positioning/qnmeasatelliteinfosource_p.h
deleted file mode 100644
index 4234d121..00000000
--- a/src/positioning/qnmeasatelliteinfosource_p.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNMESATELLITEINFOSOURCE_P_H
-#define QNMESATELLITEINFOSOURCE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qnmeasatelliteinfosource.h"
-#include <QtPositioning/qgeosatelliteinfo.h>
-
-#include <QObject>
-#include <QQueue>
-#include <QPointer>
-#include <QMap>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qtimer.h>
-
-QT_BEGIN_NAMESPACE
-
-#define USE_NMEA_PIMPL 1
-
-struct SatelliteInfo
-{
- QList<QGeoSatelliteInfo> satellitesInView;
- QList<QGeoSatelliteInfo> satellitesInUse;
- QList<int> inUseIds; // temp buffer for GSA received before GSV
- bool satellitesInUseReceived = false;
- bool updatingGSV = false;
- bool validInView = false;
- bool validInUse = false;
-};
-
-struct QNmeaSatelliteInfoUpdate
-{
- QMap<QGeoSatelliteInfo::SatelliteSystem, SatelliteInfo> m_satellites;
- QList<QGeoSatelliteInfo> m_satellitesInViewParsed;
- bool m_validInView = false; // global state for all satellite systems
- bool m_validInUse = false; // global state for all satellite systems
- bool m_fresh = false;
-#if USE_NMEA_PIMPL
- QByteArray gsa;
- QList<QByteArray> gsv;
-#endif
- QList<QGeoSatelliteInfo> allSatellitesInUse() const;
- QList<QGeoSatelliteInfo> allSatellitesInView() const;
- void setSatellitesInView(QGeoSatelliteInfo::SatelliteSystem system,
- const QList<QGeoSatelliteInfo> &inView);
- bool setSatellitesInUse(QGeoSatelliteInfo::SatelliteSystem system, const QList<int> &inUse);
- void consume();
- bool isFresh() const;
- void clear();
- bool isValid() const;
- bool calculateValidInUse() const;
- bool calculateValidInView() const;
-};
-
-class QNmeaSatelliteReader;
-class QNmeaSatelliteInfoSourcePrivate : public QObject
-{
- Q_OBJECT
-public:
- QNmeaSatelliteInfoSourcePrivate(QNmeaSatelliteInfoSource *parent, QNmeaSatelliteInfoSource::UpdateMode updateMode);
- ~QNmeaSatelliteInfoSourcePrivate();
-
- void startUpdates();
- void stopUpdates();
- void requestUpdate(int msec);
- void notifyNewUpdate();
- void processNmeaData(QNmeaSatelliteInfoUpdate &updateInfo);
-
-public slots:
- void readyRead();
- void emitPendingUpdate();
- void sourceDataClosed();
- void updateRequestTimeout();
-
-public:
- QNmeaSatelliteInfoSource *m_source = nullptr;
- QGeoSatelliteInfoSource::Error m_satelliteError = QGeoSatelliteInfoSource::NoError;
- QPointer<QIODevice> m_device;
- QNmeaSatelliteInfoUpdate m_pendingUpdate;
- QNmeaSatelliteInfoUpdate m_lastUpdate;
- bool m_invokedStart = false;
- bool m_noUpdateLastInterval = false;
- bool m_updateTimeoutSent = false;
- bool m_connectedReadyRead = false;
- QBasicTimer *m_updateTimer = nullptr; // the timer used in startUpdates()
- QTimer *m_requestTimer = nullptr; // the timer used in requestUpdate()
- QScopedPointer<QNmeaSatelliteReader> m_nmeaReader;
- QNmeaSatelliteInfoSource::UpdateMode m_updateMode;
- int m_simulationUpdateInterval = 100;
-
-protected:
- bool openSourceDevice();
- bool initialize();
- void prepareSourceDevice();
- bool emitUpdated(QNmeaSatelliteInfoUpdate &update, bool fromRequestUpdate);
- void timerEvent(QTimerEvent *event) override;
-};
-
-class QNmeaSatelliteReader
-{
-public:
- QNmeaSatelliteReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate);
- virtual ~QNmeaSatelliteReader();
-
- virtual void readAvailableData() = 0;
-
-protected:
- QNmeaSatelliteInfoSourcePrivate *m_proxy;
-};
-
-class QNmeaSatelliteRealTimeReader : public QNmeaSatelliteReader
-{
-public:
- QNmeaSatelliteRealTimeReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate);
- void readAvailableData() override;
-};
-
-class QNmeaSatelliteSimulationReader : public QNmeaSatelliteReader
-{
-public:
- QNmeaSatelliteSimulationReader(QNmeaSatelliteInfoSourcePrivate *sourcePrivate);
- void readAvailableData() override;
- void setUpdateInterval(int msec);
- int updateInterval() const;
-
-private:
- QScopedPointer<QTimer> m_timer;
- int m_updateInterval;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/positioning/qpositioningglobal.h b/src/positioning/qpositioningglobal.h
deleted file mode 100644
index ea4de299..00000000
--- a/src/positioning/qpositioningglobal.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QPOSITIONINGGLOBAL_H
-#define QPOSITIONINGGLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_POSITIONING_LIB)
-# define Q_POSITIONING_EXPORT Q_DECL_EXPORT
-# else
-# define Q_POSITIONING_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_POSITIONING_EXPORT
-#endif
-
-
-QT_END_NAMESPACE
-
-#endif // QPOSITIONINGGLOBAL_H
-
diff --git a/src/positioning/qpositioningglobal_p.h b/src/positioning/qpositioningglobal_p.h
deleted file mode 100644
index 747e450e..00000000
--- a/src/positioning/qpositioningglobal_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QPOSITIONINGGLOBAL_P_H
-#define QPOSITIONINGGLOBAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qpositioningglobal.h"
-
-QT_BEGIN_NAMESPACE
-
-#define Q_POSITIONING_PRIVATE_EXPORT Q_POSITIONING_EXPORT
-
-QT_END_NAMESPACE
-
-#endif // QPOSITIONINGGLOBAL_P_H
-
diff --git a/src/positioning/qwebmercator.cpp b/src/positioning/qwebmercator.cpp
deleted file mode 100644
index 55b2e600..00000000
--- a/src/positioning/qwebmercator.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwebmercator_p.h"
-
-#include "qgeocoordinate.h"
-
-#include <qnumeric.h>
-#include <qmath.h>
-
-#include "qdoublevector2d_p.h"
-#include "qdoublevector3d_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QDoubleVector2D QWebMercator::coordToMercator(const QGeoCoordinate &coord)
-{
- const double pi = M_PI;
-
- double lon = coord.longitude() / 360.0 + 0.5;
-
- double lat = coord.latitude();
- lat = 0.5 - (std::log(std::tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0;
- lat = qBound(0.0, lat, 1.0);
-
- return QDoubleVector2D(lon, lat);
-}
-
-double QWebMercator::realmod(const double a, const double b)
-{
- quint64 div = static_cast<quint64>(a / b);
- return a - static_cast<double>(div) * b;
-}
-
-QGeoCoordinate QWebMercator::mercatorToCoord(const QDoubleVector2D &mercator)
-{
- const double pi = M_PI;
-
- double fx = mercator.x();
- double fy = mercator.y();
-
- if (fy < 0.0)
- fy = 0.0;
- else if (fy > 1.0)
- fy = 1.0;
-
- double lat;
-
- if (fy == 0.0)
- lat = 90.0;
- else if (fy == 1.0)
- lat = -90.0;
- else
- lat = (180.0 / pi) * (2.0 * std::atan(std::exp(pi * (1.0 - 2.0 * fy))) - (pi / 2.0));
-
- double lng;
- if (fx >= 0) {
- lng = realmod(fx, 1.0);
- } else {
- lng = realmod(1.0 - realmod(-1.0 * fx, 1.0), 1.0);
- }
-
- lng = lng * 360.0 - 180.0;
-
- return QGeoCoordinate(lat, lng, 0.0);
-}
-
-QGeoCoordinate QWebMercator::coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
-{
- QDoubleVector2D s = QWebMercator::coordToMercator(from);
- QDoubleVector2D e = QWebMercator::coordToMercator(to);
-
- double x;
-
- if (0.5 < qAbs(e.x() - s.x())) {
- // handle dateline crossing
- double ex = e.x();
- double sx = s.x();
- if (ex < sx)
- sx -= 1.0;
- else if (sx < ex)
- ex -= 1.0;
-
- x = (1.0 - progress) * sx + progress * ex;
-
- if (!qFuzzyIsNull(x) && (x < 0.0))
- x += 1.0;
-
- } else {
- x = (1.0 - progress) * s.x() + progress * e.x();
- }
-
- double y = (1.0 - progress) * s.y() + progress * e.y();
-
- QGeoCoordinate result = QWebMercator::mercatorToCoord(QDoubleVector2D(x, y));
- result.setAltitude((1.0 - progress) * from.altitude() + progress * to.altitude());
-
- return result;
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioning/qwebmercator_p.h b/src/positioning/qwebmercator_p.h
deleted file mode 100644
index 109f0730..00000000
--- a/src/positioning/qwebmercator_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWEBMERCATOR_P_H
-#define QWEBMERCATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-#include <QtCore/qvariant.h>
-#include "qpositioningglobal_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGeoCoordinate;
-class QDoubleVector2D;
-
-class Q_POSITIONING_PRIVATE_EXPORT QWebMercator
-{
-public:
- static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord);
- static QGeoCoordinate mercatorToCoord(const QDoubleVector2D &mercator);
- static QGeoCoordinate coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress);
-
-private:
- static double realmod(const double a, const double b);
-};
-
-QT_END_NAMESPACE
-
-#endif // QWEBMERCATOR_P_H