summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-10-21 17:27:08 +0200
committerIvan Solovev <ivan.solovev@qt.io>2021-11-02 09:46:33 +0200
commit6db775f6d9d72cf8ee9d66333b8424e74be1e352 (patch)
tree0a293756b61619a91970d9368a0449b7bf922728
parent5a1f44c3d41febca8480c077bd4c34e5a3332cdc (diff)
Remove QtPositioning module from qtlocation.git6.2.46.2.36.2.26.2
Turns out that our CI does not support repos without any tests. This is treated like an error and leads to integration failure. This patch fixes it by disabling tests in coin/module_config.yaml. This config should be fixed when QtLocation tests are enabled Task-number: QTBUG-97084 Change-Id: Ib06e865fe2836806bbbee34345f06b471dd48660 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 23f32792ad53e23bbafbff6d7667f0bb0f69fc53)
-rw-r--r--.gitignore24
-rw-r--r--CMakeLists.txt8
-rw-r--r--cmake/FindGconf.cmake14
-rw-r--r--cmake/FindGypsy.cmake14
-rw-r--r--coin/module_config.yaml3
-rw-r--r--conanfile.py78
-rw-r--r--config.tests/gypsy/CMakeLists.txt23
-rw-r--r--config.tests/gypsy/gypsy.pro2
-rw-r--r--config.tests/gypsy/main.cpp44
-rw-r--r--config.tests/winrt/CMakeLists.txt29
-rw-r--r--config.tests/winrt/main.cpp47
-rw-r--r--config.tests/winrt/winrt.pro5
-rw-r--r--configure.json1
-rw-r--r--dependencies.yaml6
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--examples/examples.pro6
-rw-r--r--examples/positioning/CMakeLists.txt14
-rw-r--r--examples/positioning/geoflickr/CMakeLists.txt83
-rw-r--r--examples/positioning/geoflickr/doc/images/qml-flickr-1.jpgbin66794 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/doc/src/geoflickr.qdoc88
-rw-r--r--examples/positioning/geoflickr/flickr-90.qml61
-rw-r--r--examples/positioning/geoflickr/flickr.qml147
-rw-r--r--examples/positioning/geoflickr/flickr.qrc30
-rw-r--r--examples/positioning/geoflickr/flickrcommon/Progress.qml82
-rw-r--r--examples/positioning/geoflickr/flickrcommon/RestModel.qml74
-rw-r--r--examples/positioning/geoflickr/flickrcommon/ScrollBar.qml90
-rw-r--r--examples/positioning/geoflickr/flickrcommon/Slider.qml86
-rw-r--r--examples/positioning/geoflickr/flickrmobile/Button.qml88
-rw-r--r--examples/positioning/geoflickr/flickrmobile/GeoTab.qml182
-rw-r--r--examples/positioning/geoflickr/flickrmobile/GridDelegate.qml124
-rw-r--r--examples/positioning/geoflickr/flickrmobile/ImageDetails.qml166
-rw-r--r--examples/positioning/geoflickr/flickrmobile/ListDelegate.qml76
-rw-r--r--examples/positioning/geoflickr/flickrmobile/TitleBar.qml87
-rw-r--r--examples/positioning/geoflickr/flickrmobile/ToolBar.qml74
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/gloss.pngbin889 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/lineedit.pngbin1307 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/lineedit.sci5
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/moon.pngbin2366 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/quit.pngbin1785 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/star.pngbin259 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/stripes.pngbin159 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/sun.pngbin8110 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/titlebar.pngbin1327 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/titlebar.sci5
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/toolbutton.pngbin2550 -> 0 bytes
-rw-r--r--examples/positioning/geoflickr/flickrmobile/images/toolbutton.sci5
-rw-r--r--examples/positioning/geoflickr/flickrmobile/nmealog.txt1403
-rw-r--r--examples/positioning/geoflickr/geoflickr.pro15
-rw-r--r--examples/positioning/geoflickr/geoflickr.qmlproject16
-rw-r--r--examples/positioning/geoflickr/qmllocationflickr.cpp68
-rw-r--r--examples/positioning/logfilepositionsource/CMakeLists.txt54
-rw-r--r--examples/positioning/logfilepositionsource/clientapplication.cpp72
-rw-r--r--examples/positioning/logfilepositionsource/clientapplication.h74
-rw-r--r--examples/positioning/logfilepositionsource/doc/src/logfilepositionsource.qdoc94
-rw-r--r--examples/positioning/logfilepositionsource/logfile.qrc5
-rw-r--r--examples/positioning/logfilepositionsource/logfilepositionsource.cpp136
-rw-r--r--examples/positioning/logfilepositionsource/logfilepositionsource.h88
-rw-r--r--examples/positioning/logfilepositionsource/logfilepositionsource.pro16
-rw-r--r--examples/positioning/logfilepositionsource/main.cpp62
-rw-r--r--examples/positioning/logfilepositionsource/simplelog.txt156
-rw-r--r--examples/positioning/positioning.pro9
-rw-r--r--examples/positioning/satelliteinfo/CMakeLists.txt49
-rw-r--r--examples/positioning/satelliteinfo/doc/images/example-satelliteinfo.pngbin27371 -> 0 bytes
-rw-r--r--examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc134
-rw-r--r--examples/positioning/satelliteinfo/main.cpp71
-rw-r--r--examples/positioning/satelliteinfo/satelliteinfo.pro26
-rw-r--r--examples/positioning/satelliteinfo/satelliteinfo.qml316
-rw-r--r--examples/positioning/satelliteinfo/satelliteinfo.qrc5
-rw-r--r--examples/positioning/satelliteinfo/satellitemodel.cpp324
-rw-r--r--examples/positioning/satelliteinfo/satellitemodel.h140
-rw-r--r--examples/positioning/weatherinfo/CMakeLists.txt74
-rw-r--r--examples/positioning/weatherinfo/appmodel.cpp514
-rw-r--r--examples/positioning/weatherinfo/appmodel.h190
-rw-r--r--examples/positioning/weatherinfo/components/BigForecastIcon.qml92
-rw-r--r--examples/positioning/weatherinfo/components/ForecastIcon.qml99
-rw-r--r--examples/positioning/weatherinfo/components/WeatherIcon.qml64
-rw-r--r--examples/positioning/weatherinfo/doc/images/example-weatherinfo.pngbin70264 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc164
-rw-r--r--examples/positioning/weatherinfo/icons/README.txt5
-rw-r--r--examples/positioning/weatherinfo/icons/qt_attribution.json28
-rw-r--r--examples/positioning/weatherinfo/icons/weather-few-clouds.pngbin79488 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-fog.pngbin43896 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-haze.pngbin130030 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-icy.pngbin49362 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-overcast.pngbin60290 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-showers-scattered.pngbin76000 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-showers.pngbin76340 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-sleet.pngbin87168 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-snow.pngbin70939 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-storm.pngbin93207 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-sunny-very-few-clouds.pngbin65731 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-sunny.pngbin59084 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/icons/weather-thundershower.pngbin105643 -> 0 bytes
-rw-r--r--examples/positioning/weatherinfo/main.cpp74
-rw-r--r--examples/positioning/weatherinfo/openweathermapbackend.cpp265
-rw-r--r--examples/positioning/weatherinfo/openweathermapbackend.h85
-rw-r--r--examples/positioning/weatherinfo/providerbackend.cpp53
-rw-r--r--examples/positioning/weatherinfo/providerbackend.h90
-rw-r--r--examples/positioning/weatherinfo/weatherapibackend.cpp266
-rw-r--r--examples/positioning/weatherinfo/weatherapibackend.h80
-rw-r--r--examples/positioning/weatherinfo/weatherinfo.pro31
-rw-r--r--examples/positioning/weatherinfo/weatherinfo.qml208
-rw-r--r--examples/positioning/weatherinfo/weatherinfo.qrc21
-rw-r--r--qtlocation.pro2
-rw-r--r--src/3rdparty/clip2tri/CMakeLists.txt31
-rw-r--r--src/3rdparty/clip2tri/LICENSE21
-rw-r--r--src/3rdparty/clip2tri/clip2tri.cpp406
-rw-r--r--src/3rdparty/clip2tri/clip2tri.h102
-rw-r--r--src/3rdparty/clip2tri/clip2tri.pro22
-rw-r--r--src/3rdparty/clip2tri/qt_attribution.json13
-rw-r--r--src/3rdparty/clipper/CMakeLists.txt25
-rw-r--r--src/3rdparty/clipper/LICENSE48
-rw-r--r--src/3rdparty/clipper/clipper.cpp4629
-rw-r--r--src/3rdparty/clipper/clipper.h404
-rw-r--r--src/3rdparty/clipper/clipper.pro16
-rw-r--r--src/3rdparty/clipper/qt_attribution.json13
-rw-r--r--src/3rdparty/poly2tri/AUTHORS8
-rw-r--r--src/3rdparty/poly2tri/CMakeLists.txt30
-rw-r--r--src/3rdparty/poly2tri/LICENSE27
-rw-r--r--src/3rdparty/poly2tri/common/shapes.cpp363
-rw-r--r--src/3rdparty/poly2tri/common/shapes.h325
-rw-r--r--src/3rdparty/poly2tri/common/utils.h127
-rw-r--r--src/3rdparty/poly2tri/poly2tri.h39
-rw-r--r--src/3rdparty/poly2tri/poly2tri.pro27
-rw-r--r--src/3rdparty/poly2tri/qt_attribution.json13
-rw-r--r--src/3rdparty/poly2tri/sweep/advancing_front.cpp109
-rw-r--r--src/3rdparty/poly2tri/sweep/advancing_front.h118
-rw-r--r--src/3rdparty/poly2tri/sweep/cdt.cpp72
-rw-r--r--src/3rdparty/poly2tri/sweep/cdt.h105
-rw-r--r--src/3rdparty/poly2tri/sweep/sweep.cpp814
-rw-r--r--src/3rdparty/poly2tri/sweep/sweep.h285
-rw-r--r--src/3rdparty/poly2tri/sweep/sweep_context.cpp216
-rw-r--r--src/3rdparty/poly2tri/sweep/sweep_context.h186
-rw-r--r--src/CMakeLists.txt10
-rw-r--r--src/plugins/CMakeLists.txt8
-rw-r--r--src/plugins/plugins.pro1
-rw-r--r--src/plugins/position/CMakeLists.txt21
-rw-r--r--src/plugins/position/android/CMakeLists.txt4
-rw-r--r--src/plugins/position/android/android.pro2
-rw-r--r--src/plugins/position/android/jar/AndroidManifest.xml6
-rw-r--r--src/plugins/position/android/jar/CMakeLists.txt17
-rw-r--r--src/plugins/position/android/jar/jar.pro16
-rw-r--r--src/plugins/position/android/jar/src/org/qtproject/qt/android/positioning/QtPositioning.java658
-rw-r--r--src/plugins/position/android/src/CMakeLists.txt23
-rw-r--r--src/plugins/position/android/src/jnipositioning.cpp741
-rw-r--r--src/plugins/position/android/src/jnipositioning.h64
-rw-r--r--src/plugins/position/android/src/plugin.json9
-rw-r--r--src/plugins/position/android/src/positionfactory_android.cpp63
-rw-r--r--src/plugins/position/android/src/positionfactory_android.h58
-rw-r--r--src/plugins/position/android/src/qgeopositioninfosource_android.cpp296
-rw-r--r--src/plugins/position/android/src/qgeopositioninfosource_android_p.h102
-rw-r--r--src/plugins/position/android/src/qgeosatelliteinfosource_android.cpp223
-rw-r--r--src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h98
-rw-r--r--src/plugins/position/android/src/src.pro21
-rw-r--r--src/plugins/position/corelocation/CMakeLists.txt36
-rw-r--r--src/plugins/position/corelocation/corelocation.pro24
-rw-r--r--src/plugins/position/corelocation/plugin.json9
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosource_cl.mm336
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h106
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.h58
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.mm61
-rw-r--r--src/plugins/position/geoclue2/CMakeLists.txt31
-rw-r--r--src/plugins/position/geoclue2/geoclue2.pro30
-rw-r--r--src/plugins/position/geoclue2/geocluetypes.cpp62
-rw-r--r--src/plugins/position/geoclue2/geocluetypes.h63
-rw-r--r--src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Client.xml122
-rw-r--r--src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Location.xml96
-rw-r--r--src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Manager.xml60
-rw-r--r--src/plugins/position/geoclue2/plugin.json9
-rw-r--r--src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp458
-rw-r--r--src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2_p.h100
-rw-r--r--src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.cpp69
-rw-r--r--src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.h68
-rw-r--r--src/plugins/position/gypsy/CMakeLists.txt24
-rw-r--r--src/plugins/position/gypsy/gypsy.pro20
-rw-r--r--src/plugins/position/gypsy/plugin.json9
-rw-r--r--src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp66
-rw-r--r--src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h59
-rw-r--r--src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp442
-rw-r--r--src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h143
-rw-r--r--src/plugins/position/nmea/CMakeLists.txt22
-rw-r--r--src/plugins/position/nmea/nmea.pro16
-rw-r--r--src/plugins/position/nmea/plugin.json9
-rw-r--r--src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.cpp505
-rw-r--r--src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.h63
-rw-r--r--src/plugins/position/nmea/qiopipe.cpp207
-rw-r--r--src/plugins/position/nmea/qiopipe_p.h114
-rw-r--r--src/plugins/position/position.pro13
-rw-r--r--src/plugins/position/positionpoll/CMakeLists.txt20
-rw-r--r--src/plugins/position/positionpoll/plugin.json9
-rw-r--r--src/plugins/position/positionpoll/positionpoll.pro18
-rw-r--r--src/plugins/position/positionpoll/positionpollfactory.cpp65
-rw-r--r--src/plugins/position/positionpoll/positionpollfactory.h58
-rw-r--r--src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp508
-rw-r--r--src/plugins/position/positionpoll/qgeoareamonitor_polling.h100
-rw-r--r--src/plugins/position/winrt/CMakeLists.txt29
-rw-r--r--src/plugins/position/winrt/plugin.json9
-rw-r--r--src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp675
-rw-r--r--src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h124
-rw-r--r--src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp70
-rw-r--r--src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h59
-rw-r--r--src/plugins/position/winrt/winrt.pro16
-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
-rw-r--r--src/positioningquick/CMakeLists.txt46
-rw-r--r--src/positioningquick/locationsingleton.cpp387
-rw-r--r--src/positioningquick/locationsingleton_p.h110
-rw-r--r--src/positioningquick/positioningplugin.cpp555
-rw-r--r--src/positioningquick/positioningquick.pro10
-rw-r--r--src/positioningquick/qdeclarativegeoaddress.cpp380
-rw-r--r--src/positioningquick/qdeclarativegeoaddress_p.h129
-rw-r--r--src/positioningquick/qdeclarativegeolocation.cpp244
-rw-r--r--src/positioningquick/qdeclarativegeolocation_p.h114
-rw-r--r--src/positioningquick/qdeclarativepluginparameter.cpp145
-rw-r--r--src/positioningquick/qdeclarativepluginparameter_p.h96
-rw-r--r--src/positioningquick/qdeclarativeposition.cpp621
-rw-r--r--src/positioningquick/qdeclarativeposition_p.h204
-rw-r--r--src/positioningquick/qdeclarativepositionsource.cpp913
-rw-r--r--src/positioningquick/qdeclarativepositionsource_p.h222
-rw-r--r--src/positioningquick/qpositioningquickglobal.h69
-rw-r--r--src/positioningquick/qpositioningquickglobal_p.h63
-rw-r--r--src/positioningquick/qpositioningquickmodule_p.h151
-rw-r--r--src/positioningquick/qquickgeocoordinateanimation.cpp297
-rw-r--r--src/positioningquick/qquickgeocoordinateanimation_p.h104
-rw-r--r--src/positioningquick/qquickgeocoordinateanimation_p_p.h82
-rw-r--r--sync.profile4
-rw-r--r--tests/applications/positioning_backend/CMakeLists.txt28
-rw-r--r--tests/applications/positioning_backend/logwidget.cpp46
-rw-r--r--tests/applications/positioning_backend/logwidget.h47
-rw-r--r--tests/applications/positioning_backend/main.cpp54
-rw-r--r--tests/applications/positioning_backend/positioning_backend.pro16
-rw-r--r--tests/applications/positioning_backend/widget.cpp188
-rw-r--r--tests/applications/positioning_backend/widget.h70
-rw-r--r--tests/applications/positioning_backend/widget.ui334
-rw-r--r--tests/auto/CMakeLists.txt30
-rw-r--r--tests/auto/auto.pro26
-rw-r--r--tests/auto/declarative_geolocation/CMakeLists.txt16
-rw-r--r--tests/auto/declarative_geolocation/main.cpp48
-rw-r--r--tests/auto/declarative_geolocation/tst_declarativegeolocation.qml161
-rw-r--r--tests/auto/declarative_positioning_core/BLACKLIST6
-rw-r--r--tests/auto/declarative_positioning_core/CMakeLists.txt35
-rw-r--r--tests/auto/declarative_positioning_core/declarative_positioning_core.pro14
-rw-r--r--tests/auto/declarative_positioning_core/factory.cpp50
-rw-r--r--tests/auto/declarative_positioning_core/factory.h55
-rw-r--r--tests/auto/declarative_positioning_core/main.cpp49
-rw-r--r--tests/auto/declarative_positioning_core/tst_address.qml95
-rw-r--r--tests/auto/declarative_positioning_core/tst_coordinate.qml404
-rw-r--r--tests/auto/declarative_positioning_core/tst_geoshape.qml300
-rw-r--r--tests/auto/declarative_positioning_core/tst_position.qml52
-rw-r--r--tests/auto/declarative_positioning_core/tst_positionsource.qml445
-rw-r--r--tests/auto/doublevectors/CMakeLists.txt16
-rw-r--r--tests/auto/doublevectors/doublevectors.pro7
-rw-r--r--tests/auto/doublevectors/tst_doublevectors.cpp293
-rw-r--r--tests/auto/dummypositionplugin/CMakeLists.txt21
-rw-r--r--tests/auto/dummypositionplugin/dummypositionplugin.pro12
-rw-r--r--tests/auto/dummypositionplugin/plugin.cpp155
-rw-r--r--tests/auto/dummypositionplugin/plugin.json9
-rw-r--r--tests/auto/positionplugin/CMakeLists.txt21
-rw-r--r--tests/auto/positionplugin/plugin.cpp248
-rw-r--r--tests/auto/positionplugin/plugin.json9
-rw-r--r--tests/auto/positionplugin/positionplugin.pro12
-rw-r--r--tests/auto/positionplugintest/CMakeLists.txt16
-rw-r--r--tests/auto/positionplugintest/positionplugintest.pro9
-rw-r--r--tests/auto/positionplugintest/tst_positionplugin.cpp109
-rw-r--r--tests/auto/qdeclarativegeolocation/CMakeLists.txt9
-rw-r--r--tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp181
-rw-r--r--tests/auto/qdeclarativeposition/CMakeLists.txt8
-rw-r--r--tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp225
-rw-r--r--tests/auto/qdeclarativepositionsource/CMakeLists.txt9
-rw-r--r--tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp533
-rw-r--r--tests/auto/qgeoaddress/CMakeLists.txt16
-rw-r--r--tests/auto/qgeoaddress/qgeoaddress.pro7
-rw-r--r--tests/auto/qgeoaddress/tst_qgeoaddress.cpp647
-rw-r--r--tests/auto/qgeoareamonitor/CMakeLists.txt19
-rw-r--r--tests/auto/qgeoareamonitor/logfilepositionsource.cpp132
-rw-r--r--tests/auto/qgeoareamonitor/logfilepositionsource.h81
-rw-r--r--tests/auto/qgeoareamonitor/positionconsumerthread.cpp73
-rw-r--r--tests/auto/qgeoareamonitor/positionconsumerthread.h74
-rw-r--r--tests/auto/qgeoareamonitor/qgeoareamonitor.pro14
-rw-r--r--tests/auto/qgeoareamonitor/simplelog.txt87
-rw-r--r--tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp977
-rw-r--r--tests/auto/qgeocircle/CMakeLists.txt16
-rw-r--r--tests/auto/qgeocircle/qgeocircle.pro8
-rw-r--r--tests/auto/qgeocircle/tst_qgeocircle.cpp473
-rw-r--r--tests/auto/qgeocoordinate/CMakeLists.txt14
-rw-r--r--tests/auto/qgeocoordinate/qgeocoordinate.pro8
-rw-r--r--tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp1000
-rw-r--r--tests/auto/qgeocoordinateobject/CMakeLists.txt8
-rw-r--r--tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp99
-rw-r--r--tests/auto/qgeolocation/CMakeLists.txt14
-rw-r--r--tests/auto/qgeolocation/qgeolocation.pro9
-rw-r--r--tests/auto/qgeolocation/tst_qgeolocation.cpp412
-rw-r--r--tests/auto/qgeolocation/tst_qgeolocation.h90
-rw-r--r--tests/auto/qgeopath/CMakeLists.txt16
-rw-r--r--tests/auto/qgeopath/qgeopath.pro8
-rw-r--r--tests/auto/qgeopath/tst_qgeopath.cpp392
-rw-r--r--tests/auto/qgeopolygon/CMakeLists.txt16
-rw-r--r--tests/auto/qgeopolygon/qgeopolygon.pro8
-rw-r--r--tests/auto/qgeopolygon/tst_qgeopolygon.cpp382
-rw-r--r--tests/auto/qgeopositioninfo/CMakeLists.txt16
-rw-r--r--tests/auto/qgeopositioninfo/qgeopositioninfo.pro7
-rw-r--r--tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp420
-rw-r--r--tests/auto/qgeopositioninfosource/CMakeLists.txt20
-rw-r--r--tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro15
-rw-r--r--tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp807
-rw-r--r--tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h129
-rw-r--r--tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp37
-rw-r--r--tests/auto/qgeorectangle/CMakeLists.txt16
-rw-r--r--tests/auto/qgeorectangle/qgeorectangle.pro8
-rw-r--r--tests/auto/qgeorectangle/tst_qgeorectangle.cpp2414
-rw-r--r--tests/auto/qgeosatelliteinfo/CMakeLists.txt16
-rw-r--r--tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro7
-rw-r--r--tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp438
-rw-r--r--tests/auto/qgeosatelliteinfosource/CMakeLists.txt22
-rw-r--r--tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro12
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp766
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h117
-rw-r--r--tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp37
-rw-r--r--tests/auto/qgeoshape/CMakeLists.txt14
-rw-r--r--tests/auto/qgeoshape/qgeoshape.pro5
-rw-r--r--tests/auto/qgeoshape/tst_qgeoshape.cpp243
-rw-r--r--tests/auto/qnmeapositioninfosource/CMakeLists.txt7
-rw-r--r--tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt23
-rw-r--r--tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro17
-rw-r--r--tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp149
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro8
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt26
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro19
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp44
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt27
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro22
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp77
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt26
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro19
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp43
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt32
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro22
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp64
-rw-r--r--tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp605
-rw-r--r--tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h182
-rw-r--r--tests/auto/qnmeasatelliteinfosource/CMakeLists.txt4
-rw-r--r--tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt16
-rw-r--r--tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp171
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt18
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp93
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt18
-rw-r--r--tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp95
-rw-r--r--tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt14
-rw-r--r--tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp556
-rw-r--r--tests/auto/qquickgeocoordinateanimation/CMakeLists.txt9
-rw-r--r--tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp53
-rw-r--r--tests/auto/utils/qlocationtestutils.cpp114
-rw-r--r--tests/auto/utils/qlocationtestutils_p.h175
-rw-r--r--tests/auto/utils/qnmeaproxyfactory.cpp130
-rw-r--r--tests/auto/utils/qnmeaproxyfactory.h96
-rw-r--r--tests/benchmarks/CMakeLists.txt7
-rw-r--r--tests/benchmarks/README81
-rw-r--r--tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt12
-rw-r--r--tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp255
-rw-r--r--tests/benchmarks/qgeopositioninfo/CMakeLists.txt12
-rw-r--r--tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp253
-rw-r--r--tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt12
-rw-r--r--tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp248
449 files changed, 16 insertions, 68223 deletions
diff --git a/.gitignore b/.gitignore
index 7ff374ed..e5ced6d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,36 +47,12 @@ qdbusxml2cpp_wrapper.sh
qdoc_wrapper.sh
qhelpgenerator_wrapper.sh
target_wrapper.sh
-QtPositioning.version*
QtLocation.version*
-src/positioning/doc/snippets/cpp/positioning_cppsnippet
src/location/doc/snippets/cpp/cppsnippet
src/location/doc/snippets/places/placescppsnippet
examples/location/places_list/places_list
examples/location/places_map/places_map
examples/location/planespotter/planespotter
-examples/positioning/geoflickr/geoflickr
-examples/positioning/logfilepositionsource/logfilepositionsource
-examples/positioning/satelliteinfo/satelliteinfo
-examples/positioning/weatherinfo/weatherinfo
-
-config.tests/geoclue/geoclue
-config.tests/gypsy/gypsy
-
-# don't track qdbusxml2cpp generated files for geoclue plugin
-# they are no different than moc files
-geoclue_interface.cpp
-geoclue_interface.h
-master_interface.cpp
-master_interface.h
-masterclient_interface.cpp
-masterclient_interface.h
-position_interface.cpp
-position_interface.h
-satellite_interface.cpp
-satellite_interface.h
-velocity_interface.cpp
-velocity_interface.h
# Test generated files
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 198e7be2..60a37ba6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,11 +14,15 @@ project(QtLocation
set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) # special case
-find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Quick Qml Gui Widgets Network Test DBus SerialPort QuickTest) # special case
-# add simulator later. Probably smth else from QtLocation dependencies
if(WASM)
message(NOTICE "Skipping the build as the condition \"NOT WASM\" is not met.")
return()
endif()
+
+# Need to search for positioning only after we make sure that it's not WASM.
+# Otherwise we'll get an "QtPositioning not found" error in WASM build.
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Positioning) # special case
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Quick Qml Gui Widgets Network Test QuickTest PositioningQuick) # special case
+
qt_build_repo()
diff --git a/cmake/FindGconf.cmake b/cmake/FindGconf.cmake
deleted file mode 100644
index d2db910a..00000000
--- a/cmake/FindGconf.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-find_package(PkgConfig QUIET)
-if (PkgConfig_FOUND)
- pkg_check_modules(Gconf gconf-2.0 IMPORTED_TARGET)
-
- if (TARGET PkgConfig::Gconf)
- mark_as_advanced(Gconf_LIBRARIES Gconf_INCLUDE_DIRS)
- if (NOT TARGET Gconf::Gconf)
- add_library(Gconf::Gconf INTERFACE IMPORTED)
- target_link_libraries(Gconf::Gconf INTERFACE PkgConfig::Gconf)
- endif()
- else()
- set(Gconf_FOUND 0)
- endif()
-endif()
diff --git a/cmake/FindGypsy.cmake b/cmake/FindGypsy.cmake
deleted file mode 100644
index 3639568e..00000000
--- a/cmake/FindGypsy.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-find_package(PkgConfig QUIET)
-if (PkgConfig_FOUND)
- pkg_check_modules(Gypsy gypsy IMPORTED_TARGET)
-
- if (TARGET PkgConfig::Gypsy)
- mark_as_advanced(Gypsy_LIBRARIES Gypsy_INCLUDE_DIRS)
- if (NOT TARGET Gypsy::Gypsy)
- add_library(Gypsy::Gypsy INTERFACE IMPORTED)
- target_link_libraries(Gypsy::Gypsy INTERFACE PkgConfig::Gypsy)
- endif()
- else()
- set(Gypsy_FOUND 0)
- endif()
-endif()
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
index 16d158c6..6c1ee3f7 100644
--- a/coin/module_config.yaml
+++ b/coin/module_config.yaml
@@ -8,5 +8,4 @@ instructions:
Build:
- !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml"
- Test:
- - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml"
+ Test: []
diff --git a/conanfile.py b/conanfile.py
deleted file mode 100644
index 569fd5e4..00000000
--- a/conanfile.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2021 The Qt Company Ltd.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is part of the release tools of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:GPL-EXCEPT$
-## 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 General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU
-## General Public License version 3 as published by the Free Software
-## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-## 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-3.0.html.
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from conans import ConanFile
-import re
-from pathlib import Path
-from typing import List, Dict, Any
-
-
-def _parse_qt_version_by_key(key: str) -> str:
- with open(Path(__file__).parent.resolve() / ".cmake.conf") as f:
- m = re.search(fr'{key} .*"(.*)"', f.read())
- return m.group(1) if m else ""
-
-
-def _get_qt_minor_version() -> str:
- return ".".join(_parse_qt_version_by_key("QT_REPO_MODULE_VERSION").split(".")[:2])
-
-
-class QtLocation(ConanFile):
- name = "qtlocation"
- license = "LGPL-3.0, GPL-2.0+, Commercial Qt License Agreement"
- author = "The Qt Company <https://www.qt.io/contact-us>"
- url = "https://code.qt.io/cgit/qt/qtlocation.git"
- description = "Qt Positioning support."
- topics = "qt", "qt6", "positioning"
- settings = "os", "compiler", "arch", "build_type"
- # for referencing the version number and prerelease tag and dependencies info
- exports = ".cmake.conf", "dependencies.yaml"
- exports_sources = "*", "!conan*.*"
- python_requires = f"qt-conan-common/{_get_qt_minor_version()}@qt/everywhere"
- python_requires_extend = "qt-conan-common.QtLeafModule"
-
- def get_qt_leaf_module_options(self) -> Dict[str, Any]:
- """Implements abstractmethod from qt-conan-common.QtLeafModule"""
- return {"force_nmea_plugin": ["yes", "no", None]}
-
- def get_qt_leaf_module_default_options(self) -> Dict[str, Any]:
- """Implements abstractmethod from qt-conan-common.QtLeafModule"""
- return {"force_nmea_plugin": "yes"}
-
- def override_qt_requirements(self) -> List[str]:
- """Implements abstractmethod from qt-conan-common.QtLeafModule"""
- requirements = ["qtbase", "qtdeclarative"]
- if self.options.force_nmea_plugin:
- requirements.append("qtserialport")
- return requirements
-
- def is_qt_module_feature(self, option_name: str) -> bool:
- """Implements abstractmethod from qt-conan-common.QtLeafModule"""
- if option_name == "force_nmea_plugin":
- return False
- return True
diff --git a/config.tests/gypsy/CMakeLists.txt b/config.tests/gypsy/CMakeLists.txt
deleted file mode 100644
index f9a873a5..00000000
--- a/config.tests/gypsy/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated from gypsy.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(config_test_gypsy LANGUAGES C CXX)
-
-foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
- find_package(${p})
-endforeach()
-
-if(QT_CONFIG_COMPILE_TEST_LIBRARIES)
- link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES})
-endif()
-if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS)
- foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS})
- if(TARGET ${lib})
- link_libraries(${lib})
- endif()
- endforeach()
-endif()
-
-add_executable(${PROJECT_NAME}
- main.cpp
-)
diff --git a/config.tests/gypsy/gypsy.pro b/config.tests/gypsy/gypsy.pro
deleted file mode 100644
index 93d56eb1..00000000
--- a/config.tests/gypsy/gypsy.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = app
-SOURCES += main.cpp
diff --git a/config.tests/gypsy/main.cpp b/config.tests/gypsy/main.cpp
deleted file mode 100644
index 2b8d3cab..00000000
--- a/config.tests/gypsy/main.cpp
+++ /dev/null
@@ -1,44 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <gypsy/gypsy-satellite.h>
-#include <gypsy/gypsy-control.h>
-#include <gypsy/gypsy-device.h>
-#include <gconf/gconf-client.h>
-
-int main()
-{
- GypsyControl *control = gypsy_control_get_default();
- GypsyDevice *device = gypsy_device_new("test");
- GypsySatellite *satellite = gypsy_satellite_new("test");
-
- GConfClient *client = gconf_client_get_default();
- g_object_unref(client);
-
- return 0;
-}
diff --git a/config.tests/winrt/CMakeLists.txt b/config.tests/winrt/CMakeLists.txt
deleted file mode 100644
index ab7567b1..00000000
--- a/config.tests/winrt/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated from winrt.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(config_test_winrt LANGUAGES C CXX)
-
-foreach(p ${QT_CONFIG_COMPILE_TEST_PACKAGES})
- find_package(${p})
-endforeach()
-
-if(QT_CONFIG_COMPILE_TEST_LIBRARIES)
- link_libraries(${QT_CONFIG_COMPILE_TEST_LIBRARIES})
-endif()
-if(QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS)
- foreach(lib ${QT_CONFIG_COMPILE_TEST_LIBRARY_TARGETS})
- if(TARGET ${lib})
- link_libraries(${lib})
- endif()
- endforeach()
-endif()
-
-add_executable(${PROJECT_NAME}
- main.cpp
-)
-
-if(MSVC)
- target_link_libraries(${PROJECT_NAME} PRIVATE
- runtimeobject.lib
- )
-endif()
diff --git a/config.tests/winrt/main.cpp b/config.tests/winrt/main.cpp
deleted file mode 100644
index ff1eb810..00000000
--- a/config.tests/winrt/main.cpp
+++ /dev/null
@@ -1,47 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <functional>
-#include <windows.system.h>
-#include <windows.devices.geolocation.h>
-#include <windows.foundation.h>
-#include <wrl.h>
-
-using namespace Microsoft::WRL::Wrappers;
-using namespace ABI::Windows::Devices::Geolocation;
-using namespace ABI::Windows::Foundation;
-
-typedef IAsyncOperationCompletedHandler<GeolocationAccessStatus> AccessHandler;
-
-int main(int, char**)
-{
- IGeolocator *locator;
- RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Devices_Geolocation_Geolocator).Get(),
- reinterpret_cast<IInspectable**>(&locator));
- return 0;
-}
diff --git a/config.tests/winrt/winrt.pro b/config.tests/winrt/winrt.pro
deleted file mode 100644
index 06c2249e..00000000
--- a/config.tests/winrt/winrt.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES += main.cpp
-msvc {
- LIBS += runtimeobject.lib
- CONFIG += console
-}
diff --git a/configure.json b/configure.json
index 379d8b4a..8a0f579b 100644
--- a/configure.json
+++ b/configure.json
@@ -1,6 +1,5 @@
{
"subconfigs": [
- "src/positioning",
"src/location"
]
}
diff --git a/dependencies.yaml b/dependencies.yaml
index 1676adae..bfeb577c 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -2,9 +2,9 @@ dependencies:
../qtbase:
ref: 2ab88d9ffbe271e717ffcf877fa1d72b23469a52
required: true
+ ../qtpositioning:
+ ref: a403d3302bae2db926ad53e065e2819679d01661
+ required: true
../qtdeclarative:
ref: c18e2fdc817e1cdb8e39675b8fca3f45e21b0577
required: false
- ../qtserialport:
- ref: 381860a10eaea18c5e3f6228cc48f8566e60fe6f
- required: false
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 04b5b3f5..a87e6e14 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -2,9 +2,6 @@
qt_examples_build_begin()
-if(TARGET Qt::Positioning)
- add_subdirectory(positioning)
-endif()
# TODO: Enable location examples later!
# if(TARGET Qt::Location AND TARGET Qt::Positioning)
# add_subdirectory(location)
diff --git a/examples/examples.pro b/examples/examples.pro
index da770da2..10d97e1b 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,7 +1,3 @@
TEMPLATE = subdirs
-qtHaveModule(positioning) {
- SUBDIRS += positioning
-
- qtHaveModule(location): SUBDIRS += location
-}
+qtHaveModule(location): SUBDIRS += location
diff --git a/examples/positioning/CMakeLists.txt b/examples/positioning/CMakeLists.txt
deleted file mode 100644
index 414fc99a..00000000
--- a/examples/positioning/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from positioning.pro.
-
-if(TARGET Qt::Widgets)
- add_subdirectory(logfilepositionsource)
-endif()
-if(TARGET Qt::Quick)
- add_subdirectory(satelliteinfo)
-endif()
-if(TARGET Qt::Quick)
- add_subdirectory(geoflickr)
-endif()
-if(TARGET Qt::Network AND TARGET Qt::Quick)
- add_subdirectory(weatherinfo)
-endif()
diff --git a/examples/positioning/geoflickr/CMakeLists.txt b/examples/positioning/geoflickr/CMakeLists.txt
deleted file mode 100644
index a871b827..00000000
--- a/examples/positioning/geoflickr/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-# Generated from geoflickr.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(geoflickr LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/positioning/geoflickr")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Positioning)
-
-qt_add_executable(geoflickr
- qmllocationflickr.cpp
-)
-set_target_properties(geoflickr PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(geoflickr PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Positioning
- Qt::Qml
- Qt::Quick
-)
-
-
-# Resources:
-set(flickr_resource_files
- "flickr-90.qml"
- "flickr.qml"
- "flickrcommon/Progress.qml"
- "flickrcommon/RestModel.qml"
- "flickrcommon/ScrollBar.qml"
- "flickrcommon/Slider.qml"
- "flickrmobile/Button.qml"
- "flickrmobile/GeoTab.qml"
- "flickrmobile/GridDelegate.qml"
- "flickrmobile/ImageDetails.qml"
- "flickrmobile/ListDelegate.qml"
- "flickrmobile/TitleBar.qml"
- "flickrmobile/ToolBar.qml"
- "flickrmobile/images/gloss.png"
- "flickrmobile/images/lineedit.png"
- "flickrmobile/images/lineedit.sci"
- "flickrmobile/images/moon.png"
- "flickrmobile/images/quit.png"
- "flickrmobile/images/star.png"
- "flickrmobile/images/stripes.png"
- "flickrmobile/images/sun.png"
- "flickrmobile/images/titlebar.png"
- "flickrmobile/images/titlebar.sci"
- "flickrmobile/images/toolbutton.png"
- "flickrmobile/images/toolbutton.sci"
- "flickrmobile/nmealog.txt"
-)
-
-qt6_add_resources(geoflickr "flickr"
- PREFIX
- "/"
- FILES
- ${flickr_resource_files}
-)
-
-install(TARGETS geoflickr
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/positioning/geoflickr/doc/images/qml-flickr-1.jpg b/examples/positioning/geoflickr/doc/images/qml-flickr-1.jpg
deleted file mode 100644
index 42514ff0..00000000
--- a/examples/positioning/geoflickr/doc/images/qml-flickr-1.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/doc/src/geoflickr.qdoc b/examples/positioning/geoflickr/doc/src/geoflickr.qdoc
deleted file mode 100644
index 86ec61f4..00000000
--- a/examples/positioning/geoflickr/doc/src/geoflickr.qdoc
+++ /dev/null
@@ -1,88 +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$
-**
-****************************************************************************/
-
-/*!
- \example geoflickr
- \title GeoFlickr (QML)
- \ingroup qtpositioning-examples
-
- \brief The GeoFlickr example shows how to use the user's current
- position to fetch local content from a web service.
-
- This is a small example, illustrating one of the very core parts
- of the \l{Qt Positioning} API: the ability to retrieve and use the
- user's current geographic position.
-
- Key QML types shown in this example:
- \list
- \li \l {QtPositioning::PositionSource} {PositionSource}
- \li \l [QML] {XmlListModel}
- \endlist
-
- \image qml-flickr-1.jpg
-
- \include examples-run.qdocinc
-
- \section1 Retrieving the Current Position
-
- Retrieving the user's current position is achieved using the
- \l PositionSource type. In this example, we instantiate the
- \l PositionSource as part of the \c GeoTab component (the floating "window"
- describing current position and status).
-
- \snippet geoflickr/flickrmobile/GeoTab.qml possrc
-
- When the "Locate and update" button is pressed, we first interrogate
- the \l PositionSource to check if it has an available backend for
- positioning data. If it does not, we fall back to using a pre-recorded
- NMEA log for demonstration. We then instruct the \l PositionSource to
- request a location \l {QtPositioning::PositionSource::}{update}.
-
- \snippet geoflickr/flickrmobile/GeoTab.qml locatebutton-top
- \snippet geoflickr/flickrmobile/GeoTab.qml locatebutton-clicked
-
- To share the new position data with the rest of the application, we
- use properties that we have created on the \c GeoTab component:
-
- \snippet geoflickr/flickrmobile/GeoTab.qml props
-
- \section1 Using the Current Position
-
- The longitude and latitude values retrieved here are eventually set
- in the properties on the \c RestModel component. The \c RestModel is an
- \l [QML] {XmlListModel}, which retrieves XML data from a URL and creates a
- data model by parsing it.
-
- In this case, it retrieves data from the Flickr REST API online,
- based on our current position
-
- \snippet geoflickr/flickrcommon/RestModel.qml restmodel
-
- This model data is then shown in a variety of \l {Qt Quick} views to
- produce the example application.
-
-*/
diff --git a/examples/positioning/geoflickr/flickr-90.qml b/examples/positioning/geoflickr/flickr-90.qml
deleted file mode 100644
index e3352747..00000000
--- a/examples/positioning/geoflickr/flickr-90.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- width: 480; height: 320
-
- Loader {
- y: 320; rotation: -90
- transformOrigin: Item.TopLeft
- source: "flickr.qml"
- }
-}
diff --git a/examples/positioning/geoflickr/flickr.qml b/examples/positioning/geoflickr/flickr.qml
deleted file mode 100644
index 8c975e38..00000000
--- a/examples/positioning/geoflickr/flickr.qml
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-import QtQml.XmlListModel
-import "flickrcommon" as Common
-import "flickrmobile" as Mobile
-
-Item {
- id: screen; width: 320; height: 480
- property bool inListView : false
-
- Rectangle {
- id: background
- anchors.fill: parent; color: "#343434";
-
- Image { source: "flickrmobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
-
- Common.RestModel {
- id: restModel
- coordinate: geoTab.coordinate
- }
-
- Item {
- id: views
- x: 2; width: parent.width - 4
- anchors.top: titleBar.bottom; anchors.bottom: toolBar.top
-
- Text {
- text: qsTr("Network error")
- font.pixelSize: 48
- fontSizeMode: Text.HorizontalFit
- anchors.centerIn: parent
- width: parent.width * 0.9
- visible: restModel.status === XmlListModel.Error
-
- }
-
- Mobile.GridDelegate { id: gridDelegate }
- GridView {
- x: (width/4-79)/2; y: x
- id: photoGridView; model: restModel; delegate: gridDelegate; cacheBuffer: 100
- cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height - 1; z: 6
- }
- Mobile.ListDelegate { id: listDelegate }
- ListView {
- id: photoListView; model: restModel; delegate: listDelegate; z: 6
- width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100;
- }
- states: State {
- name: "ListView"; when: screen.inListView == true
- PropertyChanges { target: photoListView; x: 0 }
- PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) }
- }
-
- transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
- }
- }
- Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height; z:1 }
- Mobile.TitleBar { id: titleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 }
- Mobile.GeoTab {
- id: geoTab;
- x: 15; y:50;
- }
- Mobile.ToolBar {
- id: toolBar; z: 5
- height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
- button1Label: "Update"; button2Label: "View mode"
- onButton1Clicked: restModel.reload()
- onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true
- }
- Connections {
- target: imageDetails
- function onClosed() {
- if (background.state == "DetailedView") {
- background.state = '';
- imageDetails.photoUrl = "";
- }
- }
- }
-
- states: State {
- name: "DetailedView"
- PropertyChanges { target: views; x: -parent.width }
- PropertyChanges { target: geoTab; x: -parent.width }
- PropertyChanges { target: toolBar; button1Label: "More..." }
- PropertyChanges {
- target: toolBar
- onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state=''
- }
- PropertyChanges { target: toolBar; button2Label: "Back" }
- PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() }
- }
-
- transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
- }
- }
-}
diff --git a/examples/positioning/geoflickr/flickr.qrc b/examples/positioning/geoflickr/flickr.qrc
deleted file mode 100644
index 1019f7d8..00000000
--- a/examples/positioning/geoflickr/flickr.qrc
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/">
- <file>flickr.qml</file>
- <file>flickr-90.qml</file>
- <file>flickrcommon/Progress.qml</file>
- <file>flickrcommon/RestModel.qml</file>
- <file>flickrcommon/ScrollBar.qml</file>
- <file>flickrcommon/Slider.qml</file>
- <file>flickrmobile/Button.qml</file>
- <file>flickrmobile/GeoTab.qml</file>
- <file>flickrmobile/GridDelegate.qml</file>
- <file>flickrmobile/ImageDetails.qml</file>
- <file>flickrmobile/ListDelegate.qml</file>
- <file>flickrmobile/nmealog.txt</file>
- <file>flickrmobile/TitleBar.qml</file>
- <file>flickrmobile/ToolBar.qml</file>
- <file>flickrmobile/images/gloss.png</file>
- <file>flickrmobile/images/lineedit.png</file>
- <file>flickrmobile/images/lineedit.sci</file>
- <file>flickrmobile/images/moon.png</file>
- <file>flickrmobile/images/quit.png</file>
- <file>flickrmobile/images/star.png</file>
- <file>flickrmobile/images/stripes.png</file>
- <file>flickrmobile/images/sun.png</file>
- <file>flickrmobile/images/titlebar.png</file>
- <file>flickrmobile/images/titlebar.sci</file>
- <file>flickrmobile/images/toolbutton.png</file>
- <file>flickrmobile/images/toolbutton.sci</file>
- </qresource>
-</RCC>
diff --git a/examples/positioning/geoflickr/flickrcommon/Progress.qml b/examples/positioning/geoflickr/flickrcommon/Progress.qml
deleted file mode 100644
index 36faffbc..00000000
--- a/examples/positioning/geoflickr/flickrcommon/Progress.qml
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- property real progress: 0
-
- Rectangle {
- anchors.fill: parent; smooth: true
- border.color: "white"; border.width: 0; radius: height/2 - 2
- gradient: Gradient {
- GradientStop { position: 0; color: "#66343434" }
- GradientStop { position: 1.0; color: "#66000000" }
- }
- }
-
- Rectangle {
- y: 2; height: parent.height-4;
- x: 2; width: Math.max(parent.width * progress - 4, 0);
- opacity: width < 1 ? 0 : 1; smooth: true
- gradient: Gradient {
- GradientStop { position: 0; color: "lightsteelblue" }
- GradientStop { position: 1.0; color: "steelblue" }
- }
- radius: height/2 - 2
- }
-
- Text {
- text: Math.round(progress * 100) + "%"
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- color: "white"; font.bold: true
- }
-}
diff --git a/examples/positioning/geoflickr/flickrcommon/RestModel.qml b/examples/positioning/geoflickr/flickrcommon/RestModel.qml
deleted file mode 100644
index 56cd4e84..00000000
--- a/examples/positioning/geoflickr/flickrcommon/RestModel.qml
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQml.XmlListModel
-
-//! [restmodel]
-XmlListModel {
- property var coordinate
-
- source: "https://api.flickr.com/services/rest/?" +
- "min_taken_date=2000-01-01+0:00:00&" +
- "extras=date_taken&" +
- "method=flickr.photos.search&" +
- "per_page=30&" +
- "sort=date-taken-desc&" +
- "api_key=e36784df8a03fea04c22ed93318b291c&" +
- "lat=" + coordinate.latitude + "&lon=" + coordinate.longitude;
- query: "/rsp/photos/photo"
-
- XmlListModelRole { name: "title"; elementName: ""; attributeName: "title" }
- XmlListModelRole { name: "datetaken"; elementName: ""; attributeName: "datetaken" }
- XmlListModelRole { name: "farm"; elementName: ""; attributeName: "farm" }
- XmlListModelRole { name: "server"; elementName: ""; attributeName: "server" }
- XmlListModelRole { name: "id"; elementName: ""; attributeName: "id" }
- XmlListModelRole { name: "secret"; elementName: ""; attributeName: "secret" }
-}
-//! [restmodel]
diff --git a/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml b/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml
deleted file mode 100644
index 4c6c21c9..00000000
--- a/examples/positioning/geoflickr/flickrcommon/ScrollBar.qml
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: container
-
- property var flickableArea
-
- Rectangle {
- radius: 5
- color: "black"
- opacity: 0.3
- border.color: "white"
- border.width: 2
- x: 0
- y: flickableArea.visibleArea.yPosition * container.height
- width: parent.width
- height: flickableArea.visibleArea.heightRatio * container.height
- }
- states: [
- State {
- name: "show"
- when: flickableArea.movingVertically
- PropertyChanges {
- target: container
- opacity: 1
- }
- }
- ]
- transitions: [
- Transition {
- from: "*"
- to: "*"
- NumberAnimation {
- target: container
- properties: "opacity"
- duration: 400
- }
- }
- ]
-}
diff --git a/examples/positioning/geoflickr/flickrcommon/Slider.qml b/examples/positioning/geoflickr/flickrcommon/Slider.qml
deleted file mode 100644
index f323ab22..00000000
--- a/examples/positioning/geoflickr/flickrcommon/Slider.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: slider; width: 400; height: 16
-
- // value is read/write.
- property real value
- onValueChanged: { handle.x = 2 + (value - minimum) * slider.xMax / (maximum - minimum); }
- property real maximum: 1
- property real minimum: 1
- property int xMax: slider.width - handle.width - 4
-
- Rectangle {
- anchors.fill: parent
- border.color: "white"; border.width: 0; radius: 8
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#66343434" }
- GradientStop { position: 1.0; color: "#66000000" }
- }
- }
-
- Rectangle {
- id: handle; smooth: true
- x: slider.width / 2 - handle.width / 2; y: 2; width: 30; height: slider.height-4; radius: 6
- gradient: Gradient {
- GradientStop { position: 0.0; color: "lightgray" }
- GradientStop { position: 1.0; color: "gray" }
- }
-
- MouseArea {
- anchors.fill: parent; drag.target: parent
- drag.axis: Drag.XAxis; drag.minimumX: 2; drag.maximumX: slider.xMax+2
- onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; }
- }
- }
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/Button.qml b/examples/positioning/geoflickr/flickrmobile/Button.qml
deleted file mode 100644
index 5f2fcba2..00000000
--- a/examples/positioning/geoflickr/flickrmobile/Button.qml
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: container
-
- signal clicked
-
- property string text
-
- BorderImage {
- id: buttonImage
- source: "images/toolbutton.sci"
- width: container.width; height: container.height
- }
- BorderImage {
- id: pressed
- opacity: 0
- source: "images/toolbutton.sci"
- width: container.width; height: container.height
- }
- MouseArea {
- id: mouseRegion
- anchors.fill: buttonImage
- onClicked: { container.clicked(); }
- }
- Text {
- color: "white"
- anchors.centerIn: buttonImage; font.bold: true
- text: container.text; style: Text.Raised; styleColor: "black"
- }
- states: [
- State {
- name: "Pressed"
- when: mouseRegion.pressed == true
- PropertyChanges { target: pressed; opacity: 1 }
- }
- ]
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml
deleted file mode 100644
index 4a9a4aba..00000000
--- a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-import QtPositioning
-
-Rectangle {
- id: container
- property int maxX: parent.width; property int maxY: parent.height
-//! [props]
- property var coordinate
-//! [props]
-
- Binding {
- target: container
- property: "coordinate"
- value: positionSource.position.coordinate
- }
-
- width: 300; height: 130
- color: "blue"
- opacity: 0.7
- border.color: "black"
- border.width: 1
- radius: 5
- gradient: Gradient {
- GradientStop {position: 0.0; color: "grey"}
- GradientStop {position: 1.0; color: "black"}
- }
- MouseArea {
- anchors.fill: parent
- drag.target: parent
- drag.axis: Drag.XandYAxis
- drag.minimumX: -(parent.width * (2/3)); drag.maximumX: parent.maxX - (parent.width/3)
- drag.minimumY: -(parent.height/2); drag.maximumY: parent.maxY - (parent.height/2)
- }
-//! [locatebutton-top]
- Button {
- id: locateButton
- text: "Locate & update"
-//! [locatebutton-top]
- anchors {left: parent.left; leftMargin: 5}
- y: 3; height: 32; width: parent.width - 10
-//! [locatebutton-clicked]
- onClicked: {
- if (positionSource.supportedPositioningMethods ===
- PositionSource.NoPositioningMethods) {
- positionSource.nmeaSource = "nmealog.txt";
- sourceText.text = "(filesource): " + printableMethod(positionSource.supportedPositioningMethods);
- }
- positionSource.update();
- }
- }
-//! [locatebutton-clicked]
-//! [possrc]
- PositionSource {
- id: positionSource
- onPositionChanged: { planet.source = "images/sun.png"; }
-
- onSourceErrorChanged: {
- if (sourceError == PositionSource.UpdateTimeoutError) {
- activityText.fadeOut = true
- return
- }
-
- if (sourceError == PositionSource.NoError)
- return
-
- console.log("Source error: " + sourceError)
- activityText.fadeOut = true
- stop()
- }
- }
-//! [possrc]
- function printableMethod(method) {
- if (method === PositionSource.SatellitePositioningMethods)
- return "Satellite";
- else if (method === PositionSource.NoPositioningMethods)
- return "Not available"
- else if (method === PositionSource.NonSatellitePositioningMethods)
- return "Non-satellite"
- else if (method === PositionSource.AllPositioningMethods)
- return "Multiple"
- return "source error";
- }
-
- Grid {
- id: locationGrid
- columns: 2
- anchors {left: parent.left; leftMargin: 5; top: locateButton.bottom; topMargin: 5}
- spacing: 5
- Text {color: "white"; font.bold: true
- text: "Lat:"; style: Text.Raised; styleColor: "black"
- }
- Text {id: latitudeValue; color: "white"; font.bold: true
- text: positionSource.position.coordinate.latitude; style: Text.Raised; styleColor: "black";
- }
- Text {color: "white"; font.bold: true
- text: "Lon:"; style: Text.Raised; styleColor: "black"
- }
- Text {id: longitudeValue; color: "white"; font.bold: true
- text: positionSource.position.coordinate.longitude; style: Text.Raised; styleColor: "black"
- }
- }
- Image {
- id: planet
- anchors {top: locationGrid.bottom; left: parent.left; leftMargin: locationGrid.anchors.leftMargin}
- source: "images/moon.png"
- width: 30; height: 30
- }
- Text {id: sourceText; color: "white"; font.bold: true;
- anchors {left: planet.right; leftMargin: 5; verticalCenter: planet.verticalCenter}
- text: "Source: " + printableMethod(positionSource.supportedPositioningMethods); style: Text.Raised; styleColor: "black";
- }
-
- Text {
- id: activityText; color: "white"; font.bold: true;
- anchors { top: planet.bottom; horizontalCenter: parent.horizontalCenter }
- property bool fadeOut: false
-
- text: {
- if (fadeOut)
- return qsTr("Timeout occurred!");
- else if (positionSource.active)
- return qsTr("Retrieving update...")
- else
- return ""
- }
-
- Timer {
- id: fadeoutTimer; repeat: false; interval: 3000; running: activityText.fadeOut
- onTriggered: { activityText.fadeOut = false; }
- }
- }
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml b/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml
deleted file mode 100644
index 6d1e39c8..00000000
--- a/examples/positioning/geoflickr/flickrmobile/GridDelegate.qml
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
- import QtQuick.Window 2.0
-
- Component {
- id: photoDelegate
- Item {
- id: wrapper; width: 79; height: 79
-
- function photoClicked() {
- imageDetails.photoTitle = title;
- imageDetails.photoDate = datetaken;
- imageDetails.photoUrl = "http://farm" + farm + ".static.flickr.com/" + server + "/" + id + "_" + secret + ".jpg";
- console.log(imageDetails.photoUrl);
- scaleMe.state = "Details";
- }
-
- Item {
- anchors.centerIn: parent
- scale: 0.0
- Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} }
- id: scaleMe
-
- Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true }
- Rectangle {
- id: whiteRect; width: 76; height: 76; anchors.centerIn: parent; color: "#dddddd"; smooth: true
- Image { id: thumb;
- // source: imagePath;
- source: imageDetails.photoUrl = "http://farm" + farm + ".static.flickr.com/" + server + "/" + id + "_" + secret + "_t.jpg"
- width: parent.width; height: parent.height
- x: 1; y: 1; smooth: true}
- Image { source: "images/gloss.png" }
- }
-
- Connections {
- target: toolBar
- function onButton2Clicked() {
- if (scaleMe.state == 'Details' ) scaleMe.state = 'Show'
- }
- }
-
- states: [
- State {
- name: "Show"; when: thumb.status == Image.Ready
- PropertyChanges { target: scaleMe; scale: Math.round(Screen.pixelDensity / 4) }
- },
- State {
- name: "Details"
- PropertyChanges { target: scaleMe; scale: Math.round(Screen.pixelDensity / 4)}
- ParentChange { target: wrapper; parent: imageDetails.frontContainer }
- PropertyChanges { target: wrapper; x: 20; y: 60; z: 1000 }
- PropertyChanges { target: background; state: "DetailedView" }
- }
- ]
- transitions: [
- Transition {
- from: "Show"; to: "Details"
- ParentAnimation {
- NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
- }
- },
- Transition {
- from: "Details"; to: "Show"
- SequentialAnimation {
- ParentAnimation {
- NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
- }
- PropertyAction { targets: wrapper; properties: "z" }
- }
- }
- ]
- }
- MouseArea { anchors.fill: wrapper; onClicked: { photoClicked() } }
- }
- }
diff --git a/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml b/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml
deleted file mode 100644
index 10c0dad9..00000000
--- a/examples/positioning/geoflickr/flickrmobile/ImageDetails.qml
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-import "../flickrcommon" as Common
-
-Flipable {
- id: container
-
- property var frontContainer: containerFront
- property string photoTitle: ""
- property string photoDate
- property string photoUrl
- property real prevScale: 1.0
-
- signal closed
-
- transform: Rotation {
- id: itemRotation
- origin.x: container.width / 2;
- axis.y: 1; axis.z: 0
- }
-
- front: Item {
- id: containerFront; anchors.fill: container
-
- Rectangle {
- anchors.fill: parent
- color: "black"; opacity: 0.4
- }
-
- Column {
- spacing: 10
- anchors {
- left: parent.left; leftMargin: 20
- right: parent.right; rightMargin: 20
- top: parent.top; topMargin: 180
- }
- Text { font.bold: true; color: "white"; elide: Text.ElideRight; text: container.photoTitle }
- Text { color: "white"; elide: Text.ElideRight; text: "<b>Published:</b> " + container.photoDate }
- }
- }
-
- back: Item {
- anchors.fill: container
-
- Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 }
-
- Common.Progress {
- anchors.centerIn: parent; width: 200; height: 18
- progress: bigImage.progress; visible: bigImage.status != Image.Ready
- }
-
- Flickable {
- id: flickable; anchors.fill: parent; clip: true
- contentWidth: imageContainer.width; contentHeight: imageContainer.height
-
- Item {
- id: imageContainer
- width: Math.max(bigImage.width * bigImage.scale, flickable.width);
- height: Math.max(bigImage.height * bigImage.scale, flickable.height);
-
- Image {
- id: bigImage; // source: container.photoUrl
- source: container.photoUrl
- scale: slider.value
- anchors.centerIn: parent; smooth: !flickable.movingVertically
- onStatusChanged : {
- // Default scale shows the entire image.
- if (status == Image.Ready && width != 0) {
- slider.minimum = Math.min(flickable.width / width, flickable.height / height);
- prevScale = Math.min(slider.minimum, 1);
- slider.value = prevScale;
- }
- }
- }
- }
- }
-
- Text {
- text: "Image Unavailable"
- visible: bigImage.status == Image.Error
- anchors.centerIn: parent; color: "white"; font.bold: true
- }
-
- Common.Slider {
- id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum }
- anchors {
- bottom: parent.bottom; bottomMargin: 65
- left: parent.left; leftMargin: 25
- right: parent.right; rightMargin: 25
- }
- onValueChanged: {
- if (bigImage.width * value > flickable.width) {
- var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale;
- flickable.contentX = xoff - flickable.width/2;
- }
- if (bigImage.height * value > flickable.height) {
- var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale;
- flickable.contentY = yoff - flickable.height/2;
- }
- prevScale = value;
- }
- }
- }
-
- states: State {
- name: "Back"
- PropertyChanges { target: itemRotation; angle: 180 }
- }
-
- transitions: Transition {
- SequentialAnimation {
- PropertyAction { target: bigImage; property: "smooth"; value: false }
- NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 }
- PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically }
- }
- }
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/ListDelegate.qml b/examples/positioning/geoflickr/flickrmobile/ListDelegate.qml
deleted file mode 100644
index f83f345c..00000000
--- a/examples/positioning/geoflickr/flickrmobile/ListDelegate.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
- Component {
- Item {
- id: wrapper; width: wrapper.ListView.view.width; height: 86
- Item {
- id: moveMe
- Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
- Rectangle {
- x: 6; y: 4; width: 76; height: 76; color: "white"; smooth: true
-
- Image {
- //source: imagePath;
- source: "http://farm" + farm + ".static.flickr.com/" + server + "/" + id + "_" + secret + "_t.jpg"
- width: parent.width; height: parent.height
- x: 0; y: 0 }
-
- Image { source: "images/gloss.png" }
- }
- Column {
- x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2
- Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
- Text { text: datetaken; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
- }
- }
- }
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/TitleBar.qml b/examples/positioning/geoflickr/flickrmobile/TitleBar.qml
deleted file mode 100644
index 883042ae..00000000
--- a/examples/positioning/geoflickr/flickrmobile/TitleBar.qml
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: titleBar
- BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
-
- Item {
- id: container
- width: (parent.width * 2) - 55 ; height: parent.height
-
- Image {
- id: quitButton
- anchors.left: parent.left//; anchors.leftMargin: 0
- anchors.verticalCenter: parent.verticalCenter
- source: "images/quit.png"
- MouseArea {
- anchors.fill: parent
- onClicked: Qt.quit()
- }
- }
-
- Text {
- id: categoryText
- anchors {
- left: quitButton.right; leftMargin: 10; rightMargin: 10
- verticalCenter: parent.verticalCenter
- }
- elide: Text.ElideLeft
- text: "GeoFlickr (QML)"
- font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black"
- }
- }
-
- transitions: Transition {
- NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
- }
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/ToolBar.qml b/examples/positioning/geoflickr/flickrmobile/ToolBar.qml
deleted file mode 100644
index cb0a0fd7..00000000
--- a/examples/positioning/geoflickr/flickrmobile/ToolBar.qml
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: toolbar
-
- property alias button1Label: button1.text
- property alias button2Label: button2.text
- signal button1Clicked
- signal button2Clicked
-
- BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
-
- Button {
- id: button1
- anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32
- onClicked: toolbar.button1Clicked()
- }
-
- Button {
- id: button2
- anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32
- onClicked: toolbar.button2Clicked()
- }
-}
diff --git a/examples/positioning/geoflickr/flickrmobile/images/gloss.png b/examples/positioning/geoflickr/flickrmobile/images/gloss.png
deleted file mode 100644
index dff2bd34..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/gloss.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/lineedit.png b/examples/positioning/geoflickr/flickrmobile/images/lineedit.png
deleted file mode 100644
index a6afb512..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/lineedit.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/lineedit.sci b/examples/positioning/geoflickr/flickrmobile/images/lineedit.sci
deleted file mode 100644
index 054bff78..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/lineedit.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 10
-border.top: 10
-border.bottom: 10
-border.right: 10
-source: lineedit.png
diff --git a/examples/positioning/geoflickr/flickrmobile/images/moon.png b/examples/positioning/geoflickr/flickrmobile/images/moon.png
deleted file mode 100644
index 1583ac83..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/moon.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/quit.png b/examples/positioning/geoflickr/flickrmobile/images/quit.png
deleted file mode 100644
index aef73853..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/quit.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/star.png b/examples/positioning/geoflickr/flickrmobile/images/star.png
deleted file mode 100644
index bdcd3690..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/star.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/stripes.png b/examples/positioning/geoflickr/flickrmobile/images/stripes.png
deleted file mode 100644
index 75d2bf6c..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/stripes.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/sun.png b/examples/positioning/geoflickr/flickrmobile/images/sun.png
deleted file mode 100644
index c5fd36ed..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/sun.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/titlebar.png b/examples/positioning/geoflickr/flickrmobile/images/titlebar.png
deleted file mode 100644
index aa35c9e1..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/titlebar.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/titlebar.sci b/examples/positioning/geoflickr/flickrmobile/images/titlebar.sci
deleted file mode 100644
index 0418d94c..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/titlebar.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 10
-border.top: 12
-border.bottom: 12
-border.right: 10
-source: titlebar.png
diff --git a/examples/positioning/geoflickr/flickrmobile/images/toolbutton.png b/examples/positioning/geoflickr/flickrmobile/images/toolbutton.png
deleted file mode 100644
index 11310013..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/toolbutton.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/geoflickr/flickrmobile/images/toolbutton.sci b/examples/positioning/geoflickr/flickrmobile/images/toolbutton.sci
deleted file mode 100644
index 9e4f9653..00000000
--- a/examples/positioning/geoflickr/flickrmobile/images/toolbutton.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 15
-border.top: 4
-border.bottom: 4
-border.right: 15
-source: toolbutton.png
diff --git a/examples/positioning/geoflickr/flickrmobile/nmealog.txt b/examples/positioning/geoflickr/flickrmobile/nmealog.txt
deleted file mode 100644
index 8c8286dd..00000000
--- a/examples/positioning/geoflickr/flickrmobile/nmealog.txt
+++ /dev/null
@@ -1,1403 +0,0 @@
-$GPGGA,222437.000,2734.33926,S,15305.44310,E,1,07,1.3,50.6,M,39.2,M,,*72
-$GPGLL,2734.33926,S,15305.44310,E,222437.000,A,A*49
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222437.000,13.3,7.4,6.6,85.1,6.0,6.8,13.7*56
-$GPGSV,3,1,10,16,49,115,42,25,39,269,36,23,58,176,29,20,72,335,35*75
-$GPGSV,3,2,10,19,02,028,,04,06,241,22,13,30,223,30,27,19,284,35*78
-$GPGSV,3,3,10,11,06,337,30,03,13,055,25*7C
-$GPRMC,222437.000,A,2734.33926,S,15305.44310,E,33.9,157.8,030308,11.2,W,A*0F
-$GPVTG,157.8,T,169.0,M,33.9,N,62.9,K,A*22
-$GPGGA,222438.000,2734.34821,S,15305.44697,E,1,07,1.2,50.8,M,39.2,M,,*79
-$GPGLL,2734.34821,S,15305.44697,E,222438.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222438.000,12.4,6.4,9.3,16.2,6.1,8.3,16.4*5F
-$GPGSV,3,1,10,16,49,115,41,25,39,269,36,23,58,176,28,20,72,335,36*74
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,28,27,19,284,35*73
-$GPGSV,3,3,10,11,06,337,28,03,13,055,25*75
-$GPRMC,222438.000,A,2734.34821,S,15305.44697,E,33.8,158.3,030308,11.2,W,A*0E
-$GPVTG,158.3,T,169.5,M,33.8,N,62.5,K,A*2E
-$GPGGA,222439.000,2734.35696,S,15305.45072,E,1,06,1.7,51.2,M,39.2,M,,*78
-$GPGLL,2734.35696,S,15305.45072,E,222439.000,A,A*43
-$GPGSA,A,3,16,25,23,20,13,27,,,,,,,3.3,1.7,2.8*3A
-$GPGST,222439.000,10.3,9.1,12.2,44.6,9.8,9.9,25.2*62
-$GPGSV,3,1,10,16,49,115,34,25,39,269,36,23,58,175,29,20,72,335,35*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,27,27,19,284,32*7B
-$GPGSV,3,3,10,11,06,337,28,03,14,055,25*72
-$GPRMC,222439.000,A,2734.35696,S,15305.45072,E,33.2,158.7,030308,11.2,W,A*0E
-$GPVTG,158.7,T,169.9,M,33.2,N,61.5,K,A*2F
-$GPGGA,222440.000,2734.36580,S,15305.45446,E,1,07,1.3,52.0,M,39.2,M,,*76
-$GPGLL,2734.36580,S,15305.45446,E,222440.000,A,A*49
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222440.000,13.0,8.0,13.4,6.2,7.4,12.2,20.9*64
-$GPGSV,3,1,10,16,49,115,40,25,39,269,38,23,58,175,31,20,72,335,34*72
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,26,27,19,284,30*78
-$GPGSV,3,3,10,11,06,337,26,03,14,055,25*7C
-$GPRMC,222440.000,A,2734.36580,S,15305.45446,E,33.7,159.1,030308,11.2,W,A*06
-$GPVTG,159.1,T,170.3,M,33.7,N,62.4,K,A*2D
-$GPGGA,222441.000,2734.37483,S,15305.45825,E,1,07,1.3,52.7,M,39.2,M,,*7A
-$GPGLL,2734.37483,S,15305.45825,E,222441.000,A,A*42
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222441.000,14.0,7.6,14.1,17.6,7.7,12.5,21.0*51
-$GPGSV,3,1,10,16,49,115,41,25,39,269,39,23,58,175,29,20,72,335,35*7A
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,24,27,19,284,30*7A
-$GPGSV,3,3,10,11,06,337,28,03,14,055,25*72
-$GPRMC,222441.000,A,2734.37483,S,15305.45825,E,34.6,159.4,030308,11.2,W,A*0E
-$GPVTG,159.4,T,170.6,M,34.6,N,64.1,K,A*28
-$GPGGA,222442.000,2734.38407,S,15305.46216,E,1,06,1.3,53.3,M,39.2,M,,*77
-$GPGLL,2734.38407,S,15305.46216,E,222442.000,A,A*4B
-$GPGSA,A,3,16,25,20,13,27,11,,,,,,,2.3,1.3,1.9*3C
-$GPGST,222442.000,16.6,7.0,14.4,14.6,7.0,12.8,21.6*5A
-$GPGSV,3,1,10,16,49,115,40,25,39,269,38,23,58,175,22,20,72,335,35*71
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,25,27,19,284,29*73
-$GPGSV,3,3,10,11,06,337,27,03,14,055,25*7D
-$GPRMC,222442.000,A,2734.38407,S,15305.46216,E,35.5,159.3,030308,11.2,W,A*02
-$GPVTG,159.3,T,170.5,M,35.5,N,65.8,K,A*26
-$GPGGA,222443.000,2734.39347,S,15305.46609,E,1,05,1.8,53.8,M,39.2,M,,*7D
-$GPGLL,2734.39347,S,15305.46609,E,222443.000,A,A*42
-$GPGSA,A,3,16,25,20,27,11,,,,,,,,2.8,1.8,2.1*35
-$GPGST,222443.000,11.3,6.5,14.6,14.5,6.6,13.0,18.4*5A
-$GPGSV,3,1,10,16,49,115,40,25,39,269,38,23,58,175,22,20,72,335,36*72
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,26,27,19,284,31*79
-$GPGSV,3,3,10,11,06,337,28,03,14,055,25*72
-$GPRMC,222443.000,A,2734.39347,S,15305.46609,E,36.2,159.4,030308,11.2,W,A*08
-$GPVTG,159.4,T,170.6,M,36.2,N,67.0,K,A*2C
-$GPGGA,222444.000,2734.40297,S,15305.47000,E,1,06,1.3,54.1,M,39.2,M,,*70
-$GPGLL,2734.40297,S,15305.47000,E,222444.000,A,A*49
-$GPGSA,A,3,16,25,20,13,27,11,,,,,,,2.3,1.3,1.9*3C
-$GPGST,222444.000,17.6,6.3,12.7,14.4,6.3,11.4,16.2*55
-$GPGSV,3,1,10,16,49,115,38,25,39,269,38,23,58,175,22,20,72,335,35*7E
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,25,27,19,284,29*73
-$GPGSV,3,3,10,11,06,337,25,03,14,055,23*79
-$GPRMC,222444.000,A,2734.40297,S,15305.47000,E,36.5,159.5,030308,11.2,W,A*05
-$GPVTG,159.5,T,170.8,M,36.5,N,67.5,K,A*21
-$GPGGA,222445.000,2734.41247,S,15305.47390,E,1,07,1.3,54.2,M,39.2,M,,*75
-$GPGLL,2734.41247,S,15305.47390,E,222445.000,A,A*4E
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222445.000,16.0,7.0,14.4,10.4,6.7,13.0,20.7*52
-$GPGSV,3,1,10,16,49,115,36,25,39,269,36,23,58,175,22,20,72,335,34*7F
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,30,223,26,27,19,284,31*79
-$GPGSV,3,3,10,11,06,337,26,03,14,055,23*7A
-$GPRMC,222445.000,A,2734.41247,S,15305.47390,E,36.6,159.7,030308,11.2,W,A*03
-$GPVTG,159.7,T,170.9,M,36.6,N,67.8,K,A*2C
-$GPGGA,222446.000,2734.42201,S,15305.47790,E,1,07,1.3,54.4,M,39.2,M,,*75
-$GPGLL,2734.42201,S,15305.47790,E,222446.000,A,A*48
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222446.000,13.0,7.4,12.3,6.6,6.9,11.2,17.9*60
-$GPGSV,3,1,10,16,49,115,36,25,39,269,37,23,58,175,27,20,72,335,35*7A
-$GPGSV,3,2,10,19,02,028,,04,06,241,23,13,30,223,30,27,19,284,32*7E
-$GPGSV,3,3,10,11,06,337,27,03,14,055,23*7B
-$GPRMC,222446.000,A,2734.42201,S,15305.47790,E,36.6,159.3,030308,11.2,W,A*01
-$GPVTG,159.3,T,170.5,M,36.6,N,67.7,K,A*2B
-$GPGGA,222447.000,2734.43157,S,15305.48195,E,1,07,1.3,54.3,M,39.2,M,,*7E
-$GPGLL,2734.43157,S,15305.48195,E,222447.000,A,A*44
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222447.000,10.7,6.7,10.5,6.6,6.2,9.6,15.5*5B
-$GPGSV,3,1,11,16,49,115,32,25,39,269,37,23,58,175,28,20,72,335,33*76
-$GPGSV,3,2,11,19,02,028,,04,06,241,23,13,30,223,30,27,19,284,32*7F
-$GPGSV,3,3,11,11,06,337,29,01,,,19,03,14,055,23*7D
-$GPRMC,222447.000,A,2734.43157,S,15305.48195,E,36.7,159.1,030308,11.2,W,A*0E
-$GPVTG,159.1,T,170.3,M,36.7,N,67.9,K,A*20
-$GPGGA,222448.000,2734.44111,S,15305.48610,E,1,08,1.1,54.1,M,39.2,M,,*71
-$GPGLL,2734.44111,S,15305.48610,E,222448.000,A,A*44
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222448.000,20.4,10.5,8.8,52.5,8.7,9.1,15.2*6C
-$GPGSV,3,1,11,16,49,115,27,25,39,269,38,23,58,175,26,20,72,335,31*71
-$GPGSV,3,2,11,19,02,028,,04,06,241,23,13,30,223,37,27,19,284,27*7C
-$GPGSV,3,3,11,11,06,337,27,01,,,19,03,14,055,23*73
-$GPRMC,222448.000,A,2734.44111,S,15305.48610,E,36.8,158.7,030308,11.2,W,A*06
-$GPVTG,158.7,T,169.9,M,36.8,N,68.2,K,A*2E
-$GPGGA,222449.000,2734.45068,S,15305.49044,E,1,08,1.1,53.6,M,39.2,M,,*78
-$GPGLL,2734.45068,S,15305.49044,E,222449.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222449.000,17.1,8.8,10.2,14.2,8.2,9.3,17.4*6D
-$GPGSV,3,1,11,16,49,115,28,25,39,269,37,23,58,175,25,20,72,335,28*7A
-$GPGSV,3,2,11,19,02,028,,04,06,241,23,13,30,223,37,27,19,284,32*78
-$GPGSV,3,3,11,11,06,337,27,01,,,19,03,14,055,24*74
-$GPRMC,222449.000,A,2734.45068,S,15305.49044,E,37.2,157.8,030308,11.2,W,A*04
-$GPVTG,157.8,T,169.0,M,37.2,N,68.9,K,A*27
-$GPGGA,222450.000,2734.46041,S,15305.49485,E,1,08,1.1,53.3,M,39.2,M,,*74
-$GPGLL,2734.46041,S,15305.49485,E,222450.000,A,A*44
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222450.000,17.4,8.9,12.7,10.1,11.5,8.2,16.5*5E
-$GPGSV,3,1,11,16,49,115,25,25,39,269,36,23,58,175,30,20,72,336,28*71
-$GPGSV,3,2,11,19,02,028,,04,06,241,21,13,30,223,38,27,19,284,34*73
-$GPGSV,3,3,11,11,06,337,27,01,,,19,03,14,055,22*72
-$GPRMC,222450.000,A,2734.46041,S,15305.49485,E,37.7,157.9,030308,11.2,W,A*09
-$GPVTG,157.9,T,169.1,M,37.7,N,69.8,K,A*22
-$GPGGA,222451.000,2734.47033,S,15305.49924,E,1,08,1.1,53.1,M,39.2,M,,*75
-$GPGLL,2734.47033,S,15305.49924,E,222451.000,A,A*47
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222451.000,14.1,8.0,10.5,14.3,9.5,7.5,15.0*61
-$GPGSV,3,1,11,16,49,115,27,25,39,269,38,23,58,175,28,20,72,336,25*79
-$GPGSV,3,2,11,19,02,028,,04,06,241,21,13,30,223,38,27,19,284,34*73
-$GPGSV,3,3,11,11,06,337,24,01,,,19,03,14,055,25*76
-$GPRMC,222451.000,A,2734.47033,S,15305.49924,E,38.1,158.1,030308,11.2,W,A*04
-$GPVTG,158.1,T,169.3,M,38.1,N,70.5,K,A*2B
-$GPGGA,222452.000,2734.48022,S,15305.50375,E,1,08,1.1,52.5,M,39.2,M,,*7A
-$GPGLL,2734.48022,S,15305.50375,E,222452.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222452.000,24.1,13.9,9.7,80.6,12.7,9.0,21.0*54
-$GPGSV,3,1,11,16,49,115,29,25,39,269,38,23,58,175,27,20,72,336,30*7C
-$GPGSV,3,2,11,19,02,028,,04,06,241,21,13,30,223,35,27,19,284,34*7E
-$GPGSV,3,3,11,11,06,337,22,01,,,19,03,14,055,24*71
-$GPRMC,222452.000,A,2734.48022,S,15305.50375,E,38.3,157.9,030308,11.2,W,A*0B
-$GPVTG,157.9,T,169.1,M,38.3,N,70.9,K,A*20
-$GPGGA,222453.000,2734.49019,S,15305.50802,E,1,06,1.7,52.1,M,39.2,M,,*75
-$GPGLL,2734.49019,S,15305.50802,E,222453.000,A,A*4E
-$GPGSA,A,3,16,25,23,20,13,27,,,,,,,3.3,1.7,2.8*3A
-$GPGST,222453.000,10.4,15.4,9.3,66.3,13.4,9.6,24.6*52
-$GPGSV,3,1,11,16,49,115,31,25,39,269,36,23,58,175,28,20,71,336,25*73
-$GPGSV,3,2,11,19,02,028,,04,06,241,21,13,30,223,33,27,19,284,31*7D
-$GPGSV,3,3,11,11,06,337,22,01,,,19,03,14,055,24*71
-$GPRMC,222453.000,A,2734.49019,S,15305.50802,E,38.3,159.1,030308,11.2,W,A*0E
-$GPVTG,159.1,T,170.3,M,38.3,N,70.9,K,A*2C
-$GPGGA,222454.000,2734.50008,S,15305.51221,E,1,07,1.3,52.1,M,39.2,M,,*75
-$GPGLL,2734.50008,S,15305.51221,E,222454.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222454.000,12.5,11.7,8.3,70.6,10.4,8.0,19.0*5E
-$GPGSV,3,1,11,16,49,115,30,25,39,269,36,23,58,175,26,20,71,336,28*71
-$GPGSV,3,2,11,19,02,028,,04,06,241,21,13,30,223,32,27,19,284,30*7D
-$GPGSV,3,3,11,11,06,337,24,01,,,18,03,14,055,24*76
-$GPRMC,222454.000,A,2734.50008,S,15305.51221,E,38.1,159.4,030308,11.2,W,A*0C
-$GPVTG,159.4,T,170.6,M,38.1,N,70.5,K,A*22
-$GPGGA,222455.000,2734.50992,S,15305.51642,E,1,07,1.3,52.2,M,39.2,M,,*7C
-$GPGLL,2734.50992,S,15305.51642,E,222455.000,A,A*41
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222455.000,11.5,10.8,9.3,83.5,9.9,8.6,23.3*65
-$GPGSV,3,1,11,16,49,115,33,25,39,269,36,23,58,175,32,20,71,336,31*7F
-$GPGSV,3,2,11,19,02,028,,04,06,241,21,13,30,223,29,27,19,284,29*7F
-$GPGSV,3,3,11,11,06,337,28,01,,,18,03,14,055,24*7A
-$GPRMC,222455.000,A,2734.50992,S,15305.51642,E,37.8,159.0,030308,11.2,W,A*04
-$GPVTG,159.0,T,170.2,M,37.8,N,70.0,K,A*21
-$GPGGA,222456.000,2734.51963,S,15305.52059,E,1,07,1.3,52.5,M,39.2,M,,*78
-$GPGLL,2734.51963,S,15305.52059,E,222456.000,A,A*42
-$GPGSA,A,3,16,25,23,20,13,27,11,,,,,,2.3,1.3,1.9*3D
-$GPGST,222456.000,11.3,9.0,13.1,11.0,8.4,11.9,20.9*55
-$GPGSV,3,1,11,16,49,115,31,25,39,269,37,23,58,175,27,20,71,336,33*7A
-$GPGSV,3,2,11,19,02,028,,04,06,241,19,13,30,223,29,27,19,284,32*7E
-$GPGSV,3,3,11,11,06,337,30,01,,,18,03,14,055,24*73
-$GPRMC,222456.000,A,2734.51963,S,15305.52059,E,37.3,158.8,030308,11.2,W,A*05
-$GPVTG,158.8,T,170.0,M,37.3,N,69.1,K,A*28
-$GPGGA,222457.000,2734.52908,S,15305.52467,E,1,06,1.3,53.2,M,39.2,M,,*79
-$GPGLL,2734.52908,S,15305.52467,E,222457.000,A,A*44
-$GPGSA,A,3,16,25,20,13,27,11,,,,,,,2.3,1.3,1.9*3C
-$GPGST,222457.000,20.4,7.8,12.0,8.1,7.3,10.9,17.9*63
-$GPGSV,3,1,11,16,49,115,37,25,39,269,37,23,58,175,24,20,71,336,35*79
-$GPGSV,3,2,11,19,02,028,,04,06,241,19,13,30,223,29,27,19,284,32*7E
-$GPGSV,3,3,11,11,06,337,28,01,,,18,03,14,055,23*7D
-$GPRMC,222457.000,A,2734.52908,S,15305.52467,E,36.2,158.7,030308,11.2,W,A*0C
-$GPVTG,158.7,T,169.9,M,36.2,N,67.1,K,A*28
-$GPGGA,222458.000,2734.53845,S,15305.52866,E,1,06,1.6,54.2,M,39.2,M,,*70
-$GPGLL,2734.53845,S,15305.52866,E,222458.000,A,A*4F
-$GPGSA,A,3,16,25,23,20,27,11,,,,,,,2.6,1.6,2.1*34
-$GPGST,222458.000,16.7,7.3,13.9,11.0,7.0,12.5,17.9*5D
-$GPGSV,3,1,11,16,49,115,36,25,39,269,37,23,58,175,24,20,71,336,35*78
-$GPGSV,3,2,11,19,02,028,19,04,06,241,19,13,30,223,26,27,19,284,31*7A
-$GPGSV,3,3,11,11,06,337,23,01,,,18,03,14,055,23*76
-$GPRMC,222458.000,A,2734.53845,S,15305.52866,E,35.9,159.1,030308,11.2,W,A*08
-$GPVTG,159.1,T,170.3,M,35.9,N,66.5,K,A*20
-$GPGGA,222459.000,2734.54772,S,15305.53309,E,1,08,1.1,55.6,M,39.2,M,,*72
-$GPGLL,2734.54772,S,15305.53309,E,222459.000,A,A*41
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222459.000,17.5,6.5,9.3,15.5,6.1,8.3,15.2*5C
-$GPGSV,3,1,11,16,49,115,38,25,39,268,36,23,58,175,35,20,71,336,35*76
-$GPGSV,3,2,11,19,02,028,19,04,06,241,19,13,30,223,33,27,19,284,34*7B
-$GPGSV,3,3,11,11,06,337,29,01,,,18,03,14,055,22*7D
-$GPRMC,222459.000,A,2734.54772,S,15305.53309,E,35.9,156.8,030308,11.2,W,A*00
-$GPVTG,156.8,T,168.0,M,35.9,N,66.4,K,A*2D
-$GPGGA,222500.000,2734.55655,S,15305.53845,E,1,08,1.1,56.1,M,39.2,M,,*7D
-$GPGLL,2734.55655,S,15305.53845,E,222500.000,A,A*4A
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222500.000,14.5,9.8,7.9,83.3,7.3,9.0,14.3*5C
-$GPGSV,3,1,11,16,49,115,36,25,39,268,31,23,58,175,39,20,71,336,33*75
-$GPGSV,3,2,11,19,02,028,21,04,06,241,19,13,30,223,30,27,19,284,29*7F
-$GPGSV,3,3,11,11,06,337,25,01,,,18,03,14,055,28*7B
-$GPRMC,222500.000,A,2734.55655,S,15305.53845,E,35.9,151.6,030308,11.2,W,A*02
-$GPVTG,151.6,T,162.8,M,35.9,N,66.5,K,A*27
-$GPGGA,222501.000,2734.56495,S,15305.54489,E,1,08,1.1,57.0,M,39.2,M,,*7A
-$GPGLL,2734.56495,S,15305.54489,E,222501.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222501.000,14.3,8.0,10.9,27.0,8.0,9.5,15.6*64
-$GPGSV,3,1,11,16,49,115,41,25,39,268,31,23,58,175,36,20,71,336,31*78
-$GPGSV,3,2,11,19,02,028,21,04,06,241,19,13,30,223,27,27,19,284,29*79
-$GPGSV,3,3,11,11,06,337,22,01,,,18,03,14,055,31*74
-$GPRMC,222501.000,A,2734.56495,S,15305.54489,E,36.5,145.7,030308,11.2,W,A*0E
-$GPVTG,145.7,T,156.9,M,36.5,N,67.5,K,A*2B
-$GPGGA,222502.000,2734.57337,S,15305.55181,E,1,06,1.5,57.9,M,39.2,M,,*78
-$GPGLL,2734.57337,S,15305.55181,E,222502.000,A,A*4C
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222502.000,14.5,7.0,11.9,20.7,7.1,10.5,15.0*5F
-$GPGSV,3,1,11,16,49,115,43,25,39,268,35,23,58,175,37,20,71,336,34*7A
-$GPGSV,3,2,11,19,02,028,21,04,06,241,19,13,30,223,23,27,19,284,33*76
-$GPGSV,3,3,11,11,06,337,22,01,,,18,03,14,055,34*71
-$GPRMC,222502.000,A,2734.57337,S,15305.55181,E,37.4,143.8,030308,11.2,W,A*06
-$GPVTG,143.8,T,155.0,M,37.4,N,69.3,K,A*20
-$GPGGA,222503.000,2734.58184,S,15305.55887,E,1,08,1.1,58.5,M,39.2,M,,*7A
-$GPGLL,2734.58184,S,15305.55887,E,222503.000,A,A*47
-$GPGSA,A,3,16,25,23,20,13,27,11,03,,,,,2.0,1.1,1.6*30
-$GPGST,222503.000,13.4,6.4,14.1,0.3,5.9,12.9,21.5*60
-$GPGSV,3,1,11,16,49,115,43,25,39,268,35,23,58,175,38,20,71,336,35*74
-$GPGSV,3,2,11,19,02,028,19,04,06,241,19,13,30,223,23,27,19,284,32*7C
-$GPGSV,3,3,11,11,06,337,26,01,,,17,03,14,055,34*7A
-$GPRMC,222503.000,A,2734.58184,S,15305.55887,E,37.8,143.4,030308,11.2,W,A*0D
-$GPVTG,143.4,T,154.6,M,37.8,N,70.0,K,A*2C
-$GPGGA,222504.000,2734.59032,S,15305.56580,E,1,07,1.2,58.9,M,39.2,M,,*79
-$GPGLL,2734.59032,S,15305.56580,E,222504.000,A,A*44
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222504.000,24.6,6.2,13.3,3.6,5.7,12.2,20.2*67
-$GPGSV,3,1,11,16,49,115,43,25,39,268,35,23,58,175,39,20,71,336,35*75
-$GPGSV,3,2,11,19,02,028,19,04,06,241,19,13,30,223,22,27,19,284,31*7E
-$GPGSV,3,3,11,11,06,337,25,01,,,17,03,14,055,30*7D
-$GPRMC,222504.000,A,2734.59032,S,15305.56580,E,37.6,143.6,030308,11.2,W,A*02
-$GPVTG,143.6,T,154.8,M,37.6,N,69.7,K,A*21
-$GPGGA,222505.000,2734.59874,S,15305.57271,E,1,06,1.5,59.4,M,39.2,M,,*70
-$GPGLL,2734.59874,S,15305.57271,E,222505.000,A,A*47
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222505.000,17.4,5.5,11.8,3.4,5.0,10.8,17.3*61
-$GPGSV,3,1,11,16,49,115,44,25,39,268,35,23,58,175,39,20,71,336,36*71
-$GPGSV,3,2,11,19,02,028,21,04,06,241,19,13,30,223,24,27,19,284,31*73
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,29*72
-$GPRMC,222505.000,A,2734.59874,S,15305.57271,E,37.3,143.7,030308,11.2,W,A*05
-$GPVTG,143.7,T,154.9,M,37.3,N,69.1,K,A*22
-$GPGGA,222506.000,2734.60703,S,15305.57943,E,1,07,1.2,60.1,M,39.2,M,,*75
-$GPGLL,2734.60703,S,15305.57943,E,222506.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222506.000,16.1,6.2,11.7,15.3,6.1,10.4,17.4*54
-$GPGSV,3,1,11,16,49,115,43,25,39,268,34,23,58,175,37,20,71,336,36*79
-$GPGSV,3,2,11,19,02,028,21,04,06,241,,13,30,223,24,27,19,284,31*7B
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,28*73
-$GPRMC,222506.000,A,2734.60703,S,15305.57943,E,36.5,143.9,030308,11.2,W,A*00
-$GPVTG,143.9,T,155.1,M,36.5,N,67.6,K,A*2B
-$GPGGA,222507.000,2734.61507,S,15305.58593,E,1,07,1.2,60.9,M,39.2,M,,*75
-$GPGLL,2734.61507,S,15305.58593,E,222507.000,A,A*43
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222507.000,14.0,6.8,11.8,10.9,6.4,10.7,18.5*54
-$GPGSV,3,1,11,16,49,115,43,25,39,268,34,23,58,175,37,20,71,336,34*7B
-$GPGSV,3,2,11,19,02,028,21,04,06,241,,13,30,223,29,27,19,284,34*73
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,29*72
-$GPRMC,222507.000,A,2734.61507,S,15305.58593,E,35.4,143.9,030308,11.2,W,A*0A
-$GPVTG,143.9,T,155.1,M,35.4,N,65.5,K,A*28
-$GPGGA,222508.000,2734.62275,S,15305.59221,E,1,06,1.7,61.8,M,39.2,M,,*70
-$GPGLL,2734.62275,S,15305.59221,E,222508.000,A,A*42
-$GPGSA,A,3,16,25,23,20,13,27,,,,,,,3.3,1.7,2.8*3A
-$GPGST,222508.000,12.5,9.3,16.3,19.5,9.4,14.4,27.5*51
-$GPGSV,3,1,11,16,49,115,43,25,39,268,33,23,58,175,38,20,71,336,31*76
-$GPGSV,3,2,11,19,02,028,21,04,06,241,,13,30,223,30,27,19,284,35*7A
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,28*73
-$GPRMC,222508.000,A,2734.62275,S,15305.59221,E,33.9,143.9,030308,11.2,W,A*00
-$GPVTG,143.9,T,155.1,M,33.9,N,62.9,K,A*28
-$GPGGA,222509.000,2734.63006,S,15305.59817,E,1,06,1.7,62.7,M,39.2,M,,*75
-$GPGLL,2734.63006,S,15305.59817,E,222509.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,13,27,,,,,,,3.3,1.7,2.8*3A
-$GPGST,222509.000,10.4,8.1,14.2,21.9,8.4,12.3,23.7*52
-$GPGSV,3,1,11,16,49,115,44,25,39,268,32,23,58,175,37,20,71,336,29*76
-$GPGSV,3,2,11,19,02,028,21,04,06,241,,13,30,223,28,27,19,284,35*73
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,30*7A
-$GPRMC,222509.000,A,2734.63006,S,15305.59817,E,32.2,143.9,030308,11.2,W,A*03
-$GPVTG,143.9,T,155.1,M,32.2,N,59.7,K,A*24
-$GPGGA,222510.000,2734.63706,S,15305.60376,E,1,06,1.7,63.5,M,39.2,M,,*7F
-$GPGLL,2734.63706,S,15305.60376,E,222510.000,A,A*42
-$GPGSA,A,3,16,25,23,20,13,27,,,,,,,3.3,1.7,2.8*3A
-$GPGST,222510.000,12.4,8.3,12.9,28.0,8.7,11.0,21.6*57
-$GPGSV,3,1,11,16,48,115,43,25,39,268,32,23,58,175,37,20,71,336,29*70
-$GPGSV,3,2,11,19,02,028,20,04,06,241,,13,30,223,31,27,19,284,35*7A
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,25*7E
-$GPRMC,222510.000,A,2734.63706,S,15305.60376,E,30.6,144.3,030308,11.2,W,A*01
-$GPVTG,144.3,T,155.5,M,30.6,N,56.7,K,A*24
-$GPGGA,222511.000,2734.64376,S,15305.60904,E,1,07,1.2,64.4,M,39.2,M,,*77
-$GPGLL,2734.64376,S,15305.60904,E,222511.000,A,A*48
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222511.000,14.6,5.7,10.5,2.7,5.2,9.6,15.0*5C
-$GPGSV,3,1,11,16,48,115,44,25,39,268,32,23,58,175,37,20,71,336,28*76
-$GPGSV,3,2,11,19,02,028,20,04,06,241,23,13,30,223,29,27,19,284,36*71
-$GPGSV,3,3,11,11,06,337,,01,,,17,03,14,055,29*72
-$GPRMC,222511.000,A,2734.64376,S,15305.60904,E,29.1,144.2,030308,11.2,W,A*05
-$GPVTG,144.2,T,155.4,M,29.1,N,53.9,K,A*20
-$GPGGA,222512.000,2734.64992,S,15305.61405,E,1,07,1.2,65.4,M,39.2,M,,*78
-$GPGLL,2734.64992,S,15305.61405,E,222512.000,A,A*46
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222512.000,13.4,17.0,5.7,85.6,5.3,15.5,23.6*5A
-$GPGSV,3,1,11,16,48,115,45,25,39,268,33,23,58,175,38,20,71,336,28*79
-$GPGSV,3,2,11,19,02,028,20,04,06,241,23,13,30,223,26,27,19,284,33*7B
-$GPGSV,3,3,11,11,06,337,24,01,,,17,03,14,055,27*7A
-$GPRMC,222512.000,A,2734.64992,S,15305.61405,E,27.2,143.6,030308,11.2,W,A*05
-$GPVTG,143.6,T,154.8,M,27.2,N,50.5,K,A*2C
-$GPGGA,222513.000,2734.65572,S,15305.61884,E,1,07,1.2,66.2,M,39.2,M,,*7A
-$GPGLL,2734.65572,S,15305.61884,E,222513.000,A,A*41
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222513.000,12.3,7.0,14.8,2.4,6.5,13.5,21.4*6D
-$GPGSV,3,1,10,16,48,115,44,25,39,268,35,23,58,175,38,20,71,336,28*7F
-$GPGSV,3,2,10,19,02,028,20,04,06,241,23,13,30,223,23,27,19,284,33*7F
-$GPGSV,3,3,10,11,06,337,24,03,14,055,28*73
-$GPRMC,222513.000,A,2734.65572,S,15305.61884,E,25.8,143.6,030308,11.2,W,A*0A
-$GPVTG,143.6,T,154.8,M,25.8,N,47.9,K,A*2E
-$GPGGA,222514.000,2734.66155,S,15305.62364,E,1,06,1.5,67.0,M,39.2,M,,*7C
-$GPGLL,2734.66155,S,15305.62364,E,222514.000,A,A*42
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222514.000,25.5,6.1,14.4,3.1,5.6,13.2,19.2*6A
-$GPGSV,3,1,10,16,48,115,44,25,39,268,33,23,58,175,38,20,71,336,26*77
-$GPGSV,3,2,10,19,02,028,18,04,06,241,23,13,30,223,23,27,19,284,34*73
-$GPGSV,3,3,10,11,06,337,28,03,14,055,29*7E
-$GPRMC,222514.000,A,2734.66155,S,15305.62364,E,25.9,143.6,030308,11.2,W,A*08
-$GPVTG,143.6,T,154.8,M,25.9,N,48.0,K,A*29
-$GPGGA,222515.000,2734.66761,S,15305.62860,E,1,06,1.5,67.5,M,39.2,M,,*76
-$GPGLL,2734.66761,S,15305.62860,E,222515.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222515.000,20.1,5.5,13.0,3.0,5.1,11.8,17.4*68
-$GPGSV,3,1,10,16,48,115,44,25,39,268,32,23,58,175,38,20,71,336,26*76
-$GPGSV,3,2,10,19,02,028,18,04,06,241,23,13,30,223,24,27,19,284,34*74
-$GPGSV,3,3,10,11,06,337,28,03,14,055,24*73
-$GPRMC,222515.000,A,2734.66761,S,15305.62860,E,26.9,143.7,030308,11.2,W,A*05
-$GPVTG,143.7,T,154.9,M,26.9,N,49.8,K,A*23
-$GPGGA,222516.000,2734.67384,S,15305.63376,E,1,06,1.5,68.2,M,39.2,M,,*7E
-$GPGLL,2734.67384,S,15305.63376,E,222516.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222516.000,16.4,5.8,11.5,4.5,5.3,10.5,17.3*6A
-$GPGSV,3,1,10,16,48,115,44,25,39,268,32,23,58,175,38,20,71,336,30*71
-$GPGSV,3,2,10,19,02,028,18,04,06,241,23,13,30,223,24,27,19,284,33*73
-$GPGSV,3,3,10,11,06,337,28,03,14,055,28*7F
-$GPRMC,222516.000,A,2734.67384,S,15305.63376,E,27.7,143.8,030308,11.2,W,A*05
-$GPVTG,143.8,T,155.0,M,27.7,N,51.4,K,A*2E
-$GPGGA,222517.000,2734.68035,S,15305.63901,E,1,06,1.5,68.8,M,39.2,M,,*79
-$GPGLL,2734.68035,S,15305.63901,E,222517.000,A,A*40
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222517.000,19.1,6.2,12.1,7.2,5.8,11.0,15.3*66
-$GPGSV,3,1,10,16,48,115,44,25,39,268,34,23,58,175,38,20,71,336,32*75
-$GPGSV,3,2,10,19,02,028,20,04,06,241,23,13,30,223,24,27,19,284,34*7F
-$GPGSV,3,3,10,11,06,337,24,03,14,055,29*72
-$GPRMC,222517.000,A,2734.68035,S,15305.63901,E,28.6,144.1,030308,11.2,W,A*08
-$GPVTG,144.1,T,155.3,M,28.6,N,53.0,K,A*2B
-$GPGGA,222518.000,2734.68718,S,15305.64446,E,1,07,1.4,69.1,M,39.2,M,,*7F
-$GPGLL,2734.68718,S,15305.64446,E,222518.000,A,A*4E
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222518.000,13.8,5.5,10.6,5.8,5.1,9.6,13.4*54
-$GPGSV,3,1,10,16,48,115,43,25,39,268,33,23,58,175,37,20,71,336,35*7D
-$GPGSV,3,2,10,19,02,028,20,04,06,241,18,13,30,223,24,27,19,284,33*70
-$GPGSV,3,3,10,11,06,337,22,03,14,055,33*7F
-$GPRMC,222518.000,A,2734.68718,S,15305.64446,E,29.9,144.4,030308,11.2,W,A*0D
-$GPVTG,144.4,T,155.6,M,29.9,N,55.3,K,A*20
-$GPGGA,222519.000,2734.69424,S,15305.65010,E,1,07,1.4,69.5,M,39.2,M,,*71
-$GPGLL,2734.69424,S,15305.65010,E,222519.000,A,A*44
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222519.000,14.0,13.4,5.0,89.4,4.6,12.3,18.8*58
-$GPGSV,3,1,10,16,48,115,44,25,39,268,34,23,58,175,37,20,71,336,37*7F
-$GPGSV,3,2,10,19,02,028,20,04,06,241,18,13,30,223,23,27,19,284,31*75
-$GPGSV,3,3,10,11,06,337,26,03,14,055,35*7D
-$GPRMC,222519.000,A,2734.69424,S,15305.65010,E,31.0,144.4,030308,11.2,W,A*07
-$GPVTG,144.4,T,155.6,M,31.0,N,57.5,K,A*24
-$GPGGA,222520.000,2734.70163,S,15305.65604,E,1,07,1.4,69.6,M,39.2,M,,*75
-$GPGLL,2734.70163,S,15305.65604,E,222520.000,A,A*43
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222520.000,9.8,11.6,4.7,89.0,4.3,10.6,15.9*6A
-$GPGSV,3,1,10,16,48,115,44,25,39,268,35,23,58,175,39,20,71,336,36*71
-$GPGSV,3,2,10,19,02,028,20,04,06,241,19,13,30,223,23,27,19,284,31*74
-$GPGSV,3,3,10,11,06,337,31,03,14,055,37*79
-$GPRMC,222520.000,A,2734.70163,S,15305.65604,E,32.5,144.1,030308,11.2,W,A*03
-$GPVTG,144.1,T,155.3,M,32.5,N,60.2,K,A*21
-$GPGGA,222521.000,2734.70923,S,15305.66218,E,1,07,1.4,69.5,M,39.2,M,,*71
-$GPGLL,2734.70923,S,15305.66218,E,222521.000,A,A*44
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222521.000,11.1,6.2,10.8,9.6,5.8,9.8,16.8*53
-$GPGSV,3,1,10,16,48,115,44,25,39,268,36,23,58,175,40,20,71,336,38*72
-$GPGSV,3,2,10,19,02,028,20,04,06,241,19,13,30,223,23,27,19,284,26*72
-$GPGSV,3,3,10,11,06,338,31,03,14,055,37*76
-$GPRMC,222521.000,A,2734.70923,S,15305.66218,E,33.5,144.0,030308,11.2,W,A*04
-$GPVTG,144.0,T,155.3,M,33.5,N,62.0,K,A*21
-$GPGGA,222522.000,2734.71700,S,15305.66845,E,1,06,1.5,69.1,M,39.2,M,,*7A
-$GPGLL,2734.71700,S,15305.66845,E,222522.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222522.000,15.0,5.7,9.9,5.5,5.2,9.0,15.4*68
-$GPGSV,3,1,10,16,48,115,43,25,39,268,36,23,58,175,40,20,71,336,37*7A
-$GPGSV,3,2,10,19,02,028,20,04,06,241,24,13,30,223,23,27,19,284,26*7C
-$GPGSV,3,3,10,11,06,338,25,03,14,055,37*73
-$GPRMC,222522.000,A,2734.71700,S,15305.66845,E,34.2,144.1,030308,11.2,W,A*0A
-$GPVTG,144.1,T,155.3,M,34.2,N,63.4,K,A*25
-$GPGGA,222523.000,2734.72487,S,15305.67483,E,1,07,1.4,68.6,M,39.2,M,,*75
-$GPGLL,2734.72487,S,15305.67483,E,222523.000,A,A*42
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222523.000,13.8,5.2,10.1,3.9,4.8,9.2,13.8*5B
-$GPGSV,3,1,10,16,48,115,44,25,39,268,37,23,58,175,41,20,71,336,35*7F
-$GPGSV,3,2,10,19,02,028,20,04,06,241,24,13,30,223,23,27,19,284,26*7C
-$GPGSV,3,3,10,11,06,338,23,03,14,055,31*73
-$GPRMC,222523.000,A,2734.72487,S,15305.67483,E,34.7,144.2,030308,11.2,W,A*05
-$GPVTG,144.2,T,155.4,M,34.7,N,64.3,K,A*24
-$GPGGA,222524.000,2734.73280,S,15305.68126,E,1,07,1.4,68.1,M,39.2,M,,*70
-$GPGLL,2734.73280,S,15305.68126,E,222524.000,A,A*40
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222524.000,10.5,4.9,9.4,3.5,4.5,8.6,12.8*60
-$GPGSV,3,1,10,16,48,115,44,25,39,268,37,23,58,175,41,20,71,336,35*7F
-$GPGSV,3,2,10,19,02,028,20,04,06,241,22,13,30,223,23,27,19,284,26*7A
-$GPGSV,3,3,10,11,06,338,25,03,14,055,29*7C
-$GPRMC,222524.000,A,2734.73280,S,15305.68126,E,35.0,144.2,030308,11.2,W,A*01
-$GPVTG,144.2,T,155.4,M,35.0,N,64.9,K,A*28
-$GPGGA,222525.000,2734.74083,S,15305.68778,E,1,07,1.4,67.7,M,39.2,M,,*73
-$GPGLL,2734.74083,S,15305.68778,E,222525.000,A,A*4A
-$GPGSA,A,3,16,25,23,20,27,11,03,,,,,,2.4,1.4,1.9*3C
-$GPGST,222525.000,10.3,5.2,13.4,3.6,4.8,12.3,20.4*6B
-$GPGSV,3,1,10,16,48,115,43,25,39,268,38,23,58,175,40,20,71,336,36*75
-$GPGSV,3,2,10,19,02,028,20,04,06,241,22,13,30,223,23,27,19,284,23*7F
-$GPGSV,3,3,10,11,06,338,27,03,14,055,36*70
-$GPRMC,222525.000,A,2734.74083,S,15305.68778,E,35.6,144.2,030308,11.2,W,A*0D
-$GPVTG,144.2,T,155.4,M,35.6,N,65.9,K,A*2F
-$GPGGA,222526.000,2734.74894,S,15305.69428,E,1,06,1.5,67.2,M,39.2,M,,*7C
-$GPGLL,2734.74894,S,15305.69428,E,222526.000,A,A*40
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222526.000,8.0,5.7,12.0,2.6,5.2,10.9,17.4*54
-$GPGSV,3,1,10,16,48,115,43,25,39,268,37,23,58,175,40,20,71,336,35*79
-$GPGSV,3,2,10,19,02,028,20,04,06,241,22,13,30,223,23,27,19,284,24*78
-$GPGSV,3,3,10,11,06,338,27,03,14,055,39*7F
-$GPRMC,222526.000,A,2734.74894,S,15305.69428,E,35.8,144.5,030308,11.2,W,A*0E
-$GPVTG,144.5,T,155.7,M,35.8,N,66.3,K,A*2C
-$GPGGA,222527.000,2734.75707,S,15305.70075,E,1,05,1.7,66.8,M,39.2,M,,*77
-$GPGLL,2734.75707,S,15305.70075,E,222527.000,A,A*41
-$GPGSA,A,3,16,25,23,20,03,,,,,,,,2.9,1.7,2.4*39
-$GPGST,222527.000,13.9,6.3,10.9,6.3,5.9,10.0,18.2*60
-$GPGSV,3,1,10,16,48,115,44,25,39,268,38,23,58,175,40,20,71,336,33*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,30,223,23,27,19,284,26*7F
-$GPGSV,3,3,10,11,06,338,,03,14,055,36*75
-$GPRMC,222527.000,A,2734.75707,S,15305.70075,E,35.8,144.6,030308,11.2,W,A*0C
-$GPVTG,144.6,T,155.8,M,35.8,N,66.2,K,A*21
-$GPGGA,222528.000,2734.76518,S,15305.70724,E,1,06,1.5,66.1,M,39.2,M,,*7C
-$GPGLL,2734.76518,S,15305.70724,E,222528.000,A,A*42
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222528.000,11.3,5.6,10.1,4.5,5.2,9.2,16.1*51
-$GPGSV,3,1,10,16,48,115,43,25,39,268,39,23,58,175,39,20,71,336,28*75
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,30,223,23,27,19,284,26*7F
-$GPGSV,3,3,10,11,06,338,,03,14,055,36*75
-$GPRMC,222528.000,A,2734.76518,S,15305.70724,E,35.7,144.4,030308,11.2,W,A*02
-$GPVTG,144.4,T,155.6,M,35.7,N,66.2,K,A*22
-$GPGGA,222529.000,2734.77313,S,15305.71385,E,1,06,1.5,66.1,M,39.2,M,,*7F
-$GPGLL,2734.77313,S,15305.71385,E,222529.000,A,A*41
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222529.000,10.9,5.6,12.5,5.4,5.2,11.4,20.9*6F
-$GPGSV,3,1,10,16,48,115,41,25,39,268,40,23,58,175,36,20,71,336,28*76
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,30,223,23,27,19,284,24*7D
-$GPGSV,3,3,10,11,06,338,27,03,14,055,30*76
-$GPRMC,222529.000,A,2734.77313,S,15305.71385,E,35.6,143.5,030308,11.2,W,A*06
-$GPVTG,143.5,T,154.7,M,35.6,N,65.8,K,A*2C
-$GPGGA,222530.000,2734.78106,S,15305.72042,E,1,06,1.5,66.0,M,39.2,M,,*74
-$GPGLL,2734.78106,S,15305.72042,E,222530.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222530.000,9.4,5.4,18.9,2.4,4.9,17.3,30.6*54
-$GPGSV,3,1,10,16,48,115,40,25,39,268,40,23,58,175,36,20,71,336,28*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,30,223,23,27,19,284,26*7F
-$GPGSV,3,3,10,11,06,338,27,03,14,055,29*7E
-$GPRMC,222530.000,A,2734.78106,S,15305.72042,E,35.5,143.7,030308,11.2,W,A*0D
-$GPVTG,143.7,T,155.0,M,35.5,N,65.8,K,A*2B
-$GPGGA,222531.000,2734.78918,S,15305.72691,E,1,05,4.4,66.0,M,39.2,M,,*7D
-$GPGLL,2734.78918,S,15305.72691,E,222531.000,A,A*45
-$GPGSA,A,3,16,25,23,27,11,,,,,,,,9.3,4.4,8.2*36
-$GPGST,222531.000,9.1,8.5,53.9,3.2,8.2,49.2,81.3*56
-$GPGSV,3,1,10,16,48,115,40,25,39,268,39,23,58,175,37,20,71,336,28*78
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,31,223,23,27,19,284,25*7D
-$GPGSV,3,3,10,11,06,338,24,03,14,055,22*76
-$GPRMC,222531.000,A,2734.78918,S,15305.72691,E,35.9,144.5,030308,11.2,W,A*0A
-$GPVTG,144.5,T,155.7,M,35.9,N,66.4,K,A*2A
-$GPGGA,222532.000,2734.79737,S,15305.73347,E,1,06,1.5,66.0,M,39.2,M,,*74
-$GPGLL,2734.79737,S,15305.73347,E,222532.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,27,03,,,,,,,2.5,1.5,2.0*36
-$GPGST,222532.000,11.0,6.8,38.7,1.2,6.3,35.3,58.4*69
-$GPGSV,3,1,10,16,48,115,40,25,39,268,39,23,58,175,36,20,71,336,28*79
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,31,223,24,27,19,284,23*7C
-$GPGSV,3,3,10,11,06,338,24,03,14,055,30*75
-$GPRMC,222532.000,A,2734.79737,S,15305.73347,E,36.1,144.5,030308,11.2,W,A*0F
-$GPVTG,144.5,T,155.7,M,36.1,N,66.9,K,A*2C
-$GPGGA,222533.000,2734.80571,S,15305.74004,E,1,06,4.1,66.1,M,39.2,M,,*70
-$GPGLL,2734.80571,S,15305.74004,E,222533.000,A,A*4F
-$GPGSA,A,3,16,25,23,27,11,03,,,,,,,8.3,4.1,7.3*3F
-$GPGST,222533.000,9.4,6.1,45.5,0.4,5.6,41.6,69.5*50
-$GPGSV,3,1,10,16,48,115,40,25,39,268,39,23,58,175,37,20,71,336,28*78
-$GPGSV,3,2,10,19,02,028,,04,06,241,23,13,31,223,24,27,19,284,25*7C
-$GPGSV,3,3,10,11,06,338,22,03,14,055,25*77
-$GPRMC,222533.000,A,2734.80571,S,15305.74004,E,36.6,145.0,030308,11.2,W,A*08
-$GPVTG,145.0,T,156.2,M,36.6,N,67.7,K,A*26
-$GPGGA,222534.000,2734.81441,S,15305.74656,E,1,06,1.8,65.2,M,39.2,M,,*79
-$GPGLL,2734.81441,S,15305.74656,E,222534.000,A,A*4A
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.5,1.8,3.1*3A
-$GPGST,222534.000,20.2,5.8,45.7,1.7,5.4,41.7,71.3*6C
-$GPGSV,3,1,10,16,48,115,40,25,39,268,38,23,58,175,37,20,71,336,28*79
-$GPGSV,3,2,10,19,02,028,,04,06,241,23,13,31,223,25,27,19,284,25*7D
-$GPGSV,3,3,10,11,06,338,22,03,14,055,31*72
-$GPRMC,222534.000,A,2734.81441,S,15305.74656,E,37.6,146.2,030308,11.2,W,A*0D
-$GPVTG,146.2,T,157.5,M,37.6,N,69.7,K,A*2E
-$GPGGA,222535.000,2734.82349,S,15305.75307,E,1,05,1.9,63.5,M,39.2,M,,*77
-$GPGLL,2734.82349,S,15305.75307,E,222535.000,A,A*47
-$GPGSA,A,3,16,25,23,13,03,,,,,,,,3.6,1.9,3.1*3D
-$GPGST,222535.000,27.6,7.0,40.6,3.1,6.7,37.1,68.4*6C
-$GPGSV,3,1,10,16,48,115,40,25,39,268,36,23,58,175,37,20,71,336,28*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,31,223,25,27,19,284,23*78
-$GPGSV,3,3,10,11,06,338,22,03,14,055,26*74
-$GPRMC,222535.000,A,2734.82349,S,15305.75307,E,38.7,147.3,030308,11.2,W,A*0E
-$GPVTG,147.3,T,158.6,M,38.7,N,71.7,K,A*25
-$GPGGA,222536.000,2734.83215,S,15305.75969,E,1,05,1.7,63.5,M,39.2,M,,*71
-$GPGLL,2734.83215,S,15305.75969,E,222536.000,A,A*4F
-$GPGSA,A,3,16,25,23,20,03,,,,,,,,2.9,1.7,2.4*39
-$GPGST,222536.000,7.9,6.3,97.2,3.9,8.3,88.7,161.0*62
-$GPGSV,3,1,10,16,48,115,40,25,39,268,37,23,58,175,36,20,71,336,28*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,20,13,31,223,25,27,19,284,23*78
-$GPGSV,3,3,10,11,06,338,22,03,14,055,26*74
-$GPRMC,222536.000,A,2734.83215,S,15305.75969,E,37.6,145.6,030308,11.2,W,A*0F
-$GPVTG,145.6,T,156.8,M,37.6,N,69.7,K,A*25
-$GPGGA,222537.000,2734.84076,S,15305.76655,E,1,05,1.7,63.5,M,39.2,M,,*73
-$GPGLL,2734.84076,S,15305.76655,E,222537.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,03,,,,,,,,2.9,1.7,2.4*39
-$GPGST,222537.000,16.0,7.8,110.8,2.1,8.0,101.2,209.1*57
-$GPGSV,3,1,10,16,48,115,39,25,39,268,36,23,58,175,34,20,71,336,28*7A
-$GPGSV,3,2,10,19,02,028,,04,06,241,22,13,31,223,25,27,19,284,23*7A
-$GPGSV,3,3,10,11,06,338,22,03,14,055,25*77
-$GPRMC,222537.000,A,2734.84076,S,15305.76655,E,37.9,144.6,030308,11.2,W,A*03
-$GPVTG,144.6,T,155.8,M,37.9,N,70.3,K,A*24
-$GPGGA,222538.000,2734.84945,S,15305.77356,E,1,05,1.9,63.5,M,39.2,M,,*7C
-$GPGLL,2734.84945,S,15305.77356,E,222538.000,A,A*4C
-$GPGSA,A,3,16,25,23,13,03,,,,,,,,3.6,1.9,3.1*3D
-$GPGST,222538.000,13.1,8.0,61.7,1.6,7.5,56.4,113.0*51
-$GPGSV,3,1,10,16,48,115,40,25,39,268,37,23,58,175,32,20,71,336,*79
-$GPGSV,3,2,10,19,02,028,,04,06,241,22,13,31,223,25,27,19,284,23*7A
-$GPGSV,3,3,10,11,06,338,22,03,14,055,28*7A
-$GPRMC,222538.000,A,2734.84945,S,15305.77356,E,38.4,144.2,030308,11.2,W,A*04
-$GPVTG,144.2,T,155.4,M,38.4,N,71.1,K,A*2D
-$GPGGA,222539.000,2734.85792,S,15305.78022,E,1,05,1.9,63.5,M,39.2,M,,*77
-$GPGLL,2734.85792,S,15305.78022,E,222539.000,A,A*47
-$GPGSA,A,3,16,25,23,13,03,,,,,,,,3.6,1.9,3.1*3D
-$GPGST,222539.000,6.4,7.5,72.7,1.5,7.1,66.5,137.2*68
-$GPGSV,3,1,10,16,48,115,40,25,39,268,38,23,58,175,32,20,71,336,*76
-$GPGSV,3,2,10,19,02,028,,04,06,241,22,13,31,223,25,27,19,284,23*7A
-$GPGSV,3,3,10,11,06,338,22,03,14,055,28*7A
-$GPRMC,222539.000,A,2734.85792,S,15305.78022,E,37.1,144.9,030308,11.2,W,A*0E
-$GPVTG,144.9,T,156.1,M,37.1,N,68.7,K,A*24
-$GPGGA,222540.000,2734.86604,S,15305.78646,E,1,05,4.4,63.5,M,39.2,M,,*78
-$GPGLL,2734.86604,S,15305.78646,E,222540.000,A,A*40
-$GPGSA,A,3,16,25,23,27,11,,,,,,,,9.3,4.4,8.2*36
-$GPGST,222540.000,13.6,8.3,67.7,1.8,7.8,61.9,111.1*55
-$GPGSV,3,1,10,16,48,115,40,25,39,268,38,23,58,175,32,20,71,336,*76
-$GPGSV,3,2,10,19,02,028,,04,06,241,26,13,31,223,22,27,19,284,22*78
-$GPGSV,3,3,10,11,06,338,20,03,14,055,28*78
-$GPRMC,222540.000,A,2734.86604,S,15305.78646,E,35.3,145.6,030308,11.2,W,A*07
-$GPVTG,145.6,T,156.8,M,35.3,N,65.4,K,A*2D
-$GPGGA,222541.000,2734.87421,S,15305.79222,E,1,06,1.8,63.5,M,39.2,M,,*70
-$GPGLL,2734.87421,S,15305.79222,E,222541.000,A,A*42
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.5,1.8,3.1*3A
-$GPGST,222541.000,11.7,33.3,8.1,87.4,7.5,30.4,54.6*51
-$GPGSV,3,1,10,16,48,115,39,25,39,268,33,23,58,175,36,20,71,336,*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,26,13,31,223,22,27,19,284,22*78
-$GPGSV,3,3,10,11,06,338,20,03,14,055,26*76
-$GPRMC,222541.000,A,2734.87421,S,15305.79222,E,34.6,147.7,030308,11.2,W,A*02
-$GPVTG,147.7,T,158.9,M,34.6,N,64.1,K,A*21
-$GPGGA,222542.000,2734.88135,S,15305.79765,E,1,06,1.8,63.5,M,39.2,M,,*7A
-$GPGLL,2734.88135,S,15305.79765,E,222542.000,A,A*48
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.5,1.8,3.1*3A
-$GPGST,222542.000,23.5,7.9,53.0,0.2,7.2,48.5,78.4*6F
-$GPGSV,3,1,10,16,48,115,40,25,39,268,36,23,58,175,35,20,71,336,*7F
-$GPGSV,3,2,10,19,02,028,,04,06,241,27,13,31,223,23,27,19,284,25*7F
-$GPGSV,3,3,10,11,06,338,20,03,14,055,26*76
-$GPRMC,222542.000,A,2734.88135,S,15305.79765,E,31.0,145.8,030308,11.2,W,A*06
-$GPVTG,145.8,T,157.0,M,31.0,N,57.4,K,A*2C
-$GPGGA,222543.000,2734.88798,S,15305.80287,E,1,07,1.2,63.0,M,39.2,M,,*7B
-$GPGLL,2734.88798,S,15305.80287,E,222543.000,A,A*47
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222543.000,18.8,6.7,28.4,0.5,6.1,26.0,41.8*62
-$GPGSV,3,1,10,16,48,115,40,25,39,268,39,23,58,175,35,20,71,336,21*73
-$GPGSV,3,2,10,19,02,028,,04,06,241,37,13,31,223,22,27,19,284,24*7E
-$GPGSV,3,3,10,11,06,338,20,03,14,055,32*73
-$GPRMC,222543.000,A,2734.88798,S,15305.80287,E,29.0,144.8,030308,11.2,W,A*01
-$GPVTG,144.8,T,156.0,M,29.0,N,53.8,K,A*2D
-$GPGGA,222544.000,2734.89328,S,15305.80767,E,1,06,1.8,62.9,M,39.2,M,,*7A
-$GPGLL,2734.89328,S,15305.80767,E,222544.000,A,A*45
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.5,1.8,3.1*3A
-$GPGST,222544.000,14.9,35.2,5.8,89.5,5.4,32.2,52.6*52
-$GPGSV,3,1,10,16,48,115,43,25,39,268,40,23,58,175,25,20,71,336,21*7F
-$GPGSV,3,2,10,19,02,028,,04,06,241,28,13,31,223,30,27,19,284,29*7E
-$GPGSV,3,3,10,11,06,338,20,03,14,055,33*72
-$GPRMC,222544.000,A,2734.89328,S,15305.80767,E,24.5,140.9,030308,11.2,W,A*0E
-$GPVTG,140.9,T,152.1,M,24.5,N,45.3,K,A*29
-$GPGGA,222545.000,2734.89633,S,15305.81084,E,1,05,1.9,62.9,M,39.2,M,,*7D
-$GPGLL,2734.89633,S,15305.81084,E,222545.000,A,A*40
-$GPGSA,A,3,16,25,23,13,03,,,,,,,,3.6,1.9,3.1*3D
-$GPGST,222545.000,19.5,6.0,33.0,1.0,5.5,30.2,52.4*69
-$GPGSV,3,1,10,16,48,115,41,25,39,268,34,23,58,175,29,20,71,336,30*72
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,31,223,29,27,19,284,30*73
-$GPGSV,3,3,10,11,06,338,20,03,14,055,30*71
-$GPRMC,222545.000,A,2734.89633,S,15305.81084,E,14.6,136.6,030308,11.2,W,A*05
-$GPVTG,136.6,T,147.8,M,14.6,N,27.0,K,A*2D
-$GPGGA,222546.000,2734.89236,S,15305.81130,E,1,06,1.3,62.6,M,39.2,M,,*77
-$GPGLL,2734.89236,S,15305.81130,E,222546.000,A,A*4C
-$GPGSA,A,3,16,25,23,20,13,03,,,,,,,2.3,1.3,1.9*3B
-$GPGST,222546.000,11.5,5.6,15.6,0.9,5.2,14.3,26.4*6E
-$GPGSV,3,1,10,16,48,115,35,25,39,268,40,23,58,175,41,20,71,336,38*74
-$GPGSV,3,2,10,19,02,028,,04,06,241,26,13,31,223,33,27,19,284,26*7C
-$GPGSV,3,3,10,11,06,338,20,03,14,055,28*78
-$GPRMC,222546.000,A,2734.89236,S,15305.81130,E,16.9,2.1,030308,11.2,W,A*05
-$GPVTG,2.1,T,13.3,M,16.9,N,31.2,K,A*1F
-$GPGGA,222547.000,2734.89429,S,15305.81239,E,1,05,2.3,62.5,M,39.2,M,,*77
-$GPGLL,2734.89429,S,15305.81239,E,222547.000,A,A*4F
-$GPGSA,A,3,16,23,13,27,03,,,,,,,,4.6,2.3,3.9*39
-$GPGST,222547.000,11.4,38.3,9.7,69.8,14.7,33.0,49.2*6B
-$GPGSV,3,1,10,16,48,115,32,25,39,268,37,23,58,175,42,20,71,336,37*7F
-$GPGSV,3,2,10,19,02,028,,04,06,241,26,13,31,223,36,27,19,284,29*76
-$GPGSV,3,3,10,11,06,338,20,03,14,055,34*75
-$GPRMC,222547.000,A,2734.89429,S,15305.81239,E,8.4,154.5,030308,11.2,W,A*32
-$GPVTG,154.5,T,165.7,M,8.4,N,15.6,K,A*1D
-$GPGGA,222548.000,2734.89474,S,15305.81253,E,1,07,1.2,62.0,M,39.2,M,,*79
-$GPGLL,2734.89474,S,15305.81253,E,222548.000,A,A*44
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222548.000,11.0,12.3,7.9,86.0,7.3,11.3,20.6*5F
-$GPGSV,3,1,10,16,48,115,34,25,39,268,36,23,58,175,42,20,71,336,38*77
-$GPGSV,3,2,10,19,02,028,,04,06,241,25,13,31,223,36,27,19,284,29*75
-$GPGSV,3,3,10,11,06,338,20,03,14,055,33*72
-$GPRMC,222548.000,A,2734.89474,S,15305.81253,E,0.3,353.0,030308,11.2,W,A*36
-$GPVTG,353.0,T,4.3,M,0.3,N,0.5,K,A*27
-$GPGGA,222549.000,2734.89490,S,15305.81265,E,1,04,2.0,61.8,M,39.2,M,,*7E
-$GPGLL,2734.89490,S,15305.81265,E,222549.000,A,A*4A
-$GPGSA,A,3,25,23,13,03,,,,,,,,,3.9,2.0,3.3*3D
-$GPGST,222549.000,17.0,16.1,8.8,81.3,8.3,14.6,29.3*57
-$GPGSV,3,1,11,16,48,115,33,25,39,268,37,23,58,175,42,20,71,336,36*7E
-$GPGSV,3,2,11,19,02,028,,04,06,241,25,13,31,223,35,27,19,284,30*7F
-$GPGSV,3,3,11,11,06,338,20,01,,,21,03,14,055,33*71
-$GPRMC,222549.000,A,2734.89490,S,15305.81265,E,0.2,330.7,030308,11.2,W,A*3B
-$GPVTG,330.7,T,341.9,M,0.2,N,0.3,K,A*2A
-$GPGGA,222550.000,2734.89526,S,15305.81278,E,1,04,2.6,61.7,M,39.2,M,,*7F
-$GPGLL,2734.89526,S,15305.81278,E,222550.000,A,A*42
-$GPGSA,A,3,16,25,23,13,,,,,,,,,6.1,2.6,5.6*31
-$GPGST,222550.000,13.4,12.4,27.3,43.1,18.9,19.8,52.9*5A
-$GPGSV,3,1,11,16,48,115,30,25,39,268,38,23,58,175,42,20,71,336,37*73
-$GPGSV,3,2,11,19,02,028,,04,06,241,25,13,31,223,36,27,19,284,31*7D
-$GPGSV,3,3,11,11,06,338,,01,,,21,03,14,055,32*72
-$GPRMC,222550.000,A,2734.89526,S,15305.81278,E,0.1,350.7,030308,11.2,W,A*36
-$GPVTG,350.7,T,1.9,M,0.1,N,0.2,K,A*29
-$GPGGA,222551.000,2734.89528,S,15305.81279,E,1,05,2.3,61.7,M,39.2,M,,*75
-$GPGLL,2734.89528,S,15305.81279,E,222551.000,A,A*4C
-$GPGSA,A,3,16,23,13,27,03,,,,,,,,4.6,2.3,3.9*39
-$GPGST,222551.000,13.7,31.0,11.1,60.5,16.5,25.2,39.3*5F
-$GPGSV,3,1,11,16,48,115,30,25,39,268,39,23,58,175,41,20,71,336,35*73
-$GPGSV,3,2,11,19,02,028,,04,06,241,23,13,31,223,36,27,19,284,31*7B
-$GPGSV,3,3,11,11,06,338,,01,,,20,03,14,055,30*71
-$GPRMC,222551.000,A,2734.89528,S,15305.81279,E,0.1,345.0,030308,11.2,W,A*3B
-$GPVTG,345.0,T,356.2,M,0.1,N,0.2,K,A*20
-$GPGGA,222552.000,2734.89550,S,15305.81288,E,1,05,2.1,61.7,M,39.2,M,,*75
-$GPGLL,2734.89550,S,15305.81288,E,222552.000,A,A*4E
-$GPGSA,A,3,16,25,23,13,27,,,,,,,,4.7,2.1,4.2*32
-$GPGST,222552.000,11.7,11.5,20.8,20.0,11.8,18.2,39.1*55
-$GPGSV,3,1,11,16,48,115,31,25,39,268,40,23,58,175,42,20,71,336,35*7F
-$GPGSV,3,2,11,19,02,028,,04,06,241,23,13,31,223,38,27,19,284,31*75
-$GPGSV,3,3,11,11,06,338,,01,,,20,03,14,055,30*71
-$GPRMC,222552.000,A,2734.89550,S,15305.81288,E,0.1,11.2,030308,11.2,W,A*09
-$GPVTG,11.2,T,22.5,M,0.1,N,0.2,K,A*27
-$GPGGA,222553.000,2734.89573,S,15305.81294,E,1,05,2.1,61.5,M,39.2,M,,*7A
-$GPGLL,2734.89573,S,15305.81294,E,222553.000,A,A*43
-$GPGSA,A,3,16,25,23,13,27,,,,,,,,4.7,2.1,4.2*32
-$GPGST,222553.000,9.8,10.3,17.6,19.1,10.4,15.6,33.7*6C
-$GPGSV,3,1,10,16,48,115,29,25,39,268,38,23,58,175,41,20,71,336,37*79
-$GPGSV,3,2,10,19,02,028,,04,06,241,23,13,31,223,39,27,19,284,30*74
-$GPGSV,3,3,10,11,06,338,,03,14,055,29*7B
-$GPRMC,222553.000,A,2734.89573,S,15305.81294,E,0.1,351.8,030308,11.2,W,A*39
-$GPVTG,351.8,T,3.0,M,0.1,N,0.2,K,A*2C
-$GPGGA,222554.000,2734.89591,S,15305.81298,E,1,04,2.6,61.4,M,39.2,M,,*7A
-$GPGLL,2734.89591,S,15305.81298,E,222554.000,A,A*44
-$GPGSA,A,3,16,25,23,13,,,,,,,,,6.1,2.6,5.6*31
-$GPGST,222554.000,16.9,10.4,17.8,12.8,10.0,16.1,37.3*5F
-$GPGSV,3,1,10,16,48,115,32,25,39,268,38,23,58,175,41,20,71,336,36*72
-$GPGSV,3,2,10,19,02,028,,04,06,241,23,13,31,223,38,27,19,284,31*74
-$GPGSV,3,3,10,11,06,338,,03,14,055,26*74
-$GPRMC,222554.000,A,2734.89591,S,15305.81298,E,0.1,334.9,030308,11.2,W,A*3C
-$GPVTG,334.9,T,346.1,M,0.1,N,0.2,K,A*2D
-$GPGGA,222555.000,2734.89607,S,15305.81301,E,1,04,2.6,61.2,M,39.2,M,,*70
-$GPGLL,2734.89607,S,15305.81301,E,222555.000,A,A*48
-$GPGSA,A,3,16,25,23,13,,,,,,,,,6.1,2.6,5.6*31
-$GPGST,222555.000,14.4,11.9,23.3,40.8,16.2,17.6,44.5*56
-$GPGSV,3,1,11,16,48,115,32,25,39,268,37,23,58,175,40,20,71,336,38*73
-$GPGSV,3,2,11,19,02,028,,04,06,241,23,13,31,223,37,27,19,284,30*7B
-$GPGSV,3,3,11,11,06,338,,01,,,20,03,14,055,25*75
-$GPRMC,222555.000,A,2734.89607,S,15305.81301,E,0.1,6.2,030308,11.2,W,A*39
-$GPVTG,6.2,T,17.4,M,0.1,N,0.2,K,A*16
-$GPGGA,222556.000,2734.89612,S,15305.81301,E,1,04,2.6,61.1,M,39.2,M,,*74
-$GPGLL,2734.89612,S,15305.81301,E,222556.000,A,A*4F
-$GPGSA,A,3,16,25,23,13,,,,,,,,,6.1,2.6,5.6*31
-$GPGST,222556.000,12.4,15.8,24.1,4.1,14.5,22.0,39.9*69
-$GPGSV,3,1,11,16,48,115,33,25,39,268,38,23,58,174,41,20,71,336,38*7D
-$GPGSV,3,2,11,19,02,028,,04,06,242,23,13,31,223,38,27,19,284,32*75
-$GPGSV,3,3,11,11,06,338,,01,,,20,03,14,055,28*78
-$GPRMC,222556.000,A,2734.89612,S,15305.81301,E,0.1,21.8,030308,11.2,W,A*01
-$GPVTG,21.8,T,33.0,M,0.1,N,0.2,K,A*2B
-$GPGGA,222557.000,2734.89635,S,15305.81337,E,1,05,2.1,61.0,M,39.2,M,,*72
-$GPGLL,2734.89635,S,15305.81337,E,222557.000,A,A*4E
-$GPGSA,A,3,16,25,23,13,27,,,,,,,,4.7,2.1,4.2*32
-$GPGST,222557.000,10.3,13.0,15.0,5.2,11.9,13.7,32.7*6B
-$GPGSV,3,1,10,16,48,115,33,25,39,268,38,23,58,174,41,20,71,336,36*72
-$GPGSV,3,2,10,19,02,028,,04,06,242,23,13,31,223,39,27,19,284,28*7E
-$GPGSV,3,3,10,11,06,338,,03,14,055,31*72
-$GPRMC,222557.000,A,2734.89635,S,15305.81337,E,1.2,96.1,030308,11.2,W,A*07
-$GPVTG,96.1,T,107.3,M,1.2,N,2.2,K,A*1B
-$GPGGA,222558.000,2734.89638,S,15305.81517,E,1,06,1.8,60.6,M,39.2,M,,*7A
-$GPGLL,2734.89638,S,15305.81517,E,222558.000,A,A*48
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.5,1.8,3.1*3A
-$GPGST,222558.000,18.6,12.9,7.5,72.4,7.5,11.4,21.9*57
-$GPGSV,3,1,10,16,48,115,39,25,39,268,38,23,58,174,37,20,71,336,26*78
-$GPGSV,3,2,10,19,02,028,,04,06,242,23,13,31,223,34,27,19,284,29*72
-$GPGSV,3,3,10,11,06,338,,03,14,055,30*73
-$GPRMC,222558.000,A,2734.89638,S,15305.81517,E,5.6,82.0,030308,11.2,W,A*05
-$GPVTG,82.0,T,93.2,M,5.6,N,10.3,K,A*10
-$GPGGA,222559.000,2734.89631,S,15305.81911,E,1,05,2.2,60.5,M,39.2,M,,*71
-$GPGLL,2734.89631,S,15305.81911,E,222559.000,A,A*4A
-$GPGSA,A,3,16,25,23,20,27,,,,,,,,3.6,2.2,2.9*3A
-$GPGST,222559.000,17.0,15.1,33.1,15.1,15.5,29.4,59.0*59
-$GPGSV,3,1,10,16,48,115,34,25,39,268,35,23,58,174,30,20,71,336,29*70
-$GPGSV,3,2,10,19,02,028,,04,06,242,23,13,31,223,35,27,19,284,28*72
-$GPGSV,3,3,10,11,06,338,,03,14,055,27*75
-$GPRMC,222559.000,A,2734.89631,S,15305.81911,E,12.5,87.6,030308,11.2,W,A*31
-$GPVTG,87.6,T,98.8,M,12.5,N,23.2,K,A*26
-$GPGGA,222600.000,2734.89436,S,15305.82359,E,1,06,1.8,61.2,M,39.2,M,,*72
-$GPGLL,2734.89436,S,15305.82359,E,222600.000,A,A*45
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.5,1.8,3.1*3A
-$GPGST,222600.000,14.4,14.9,6.9,79.1,6.7,13.4,28.4*57
-$GPGSV,3,1,10,16,48,115,37,25,39,268,36,23,58,174,29,20,71,336,33*73
-$GPGSV,3,2,10,19,02,028,,04,06,242,23,13,31,223,39,27,19,284,28*7E
-$GPGSV,3,3,10,11,06,338,,03,14,055,28*7A
-$GPRMC,222600.000,A,2734.89436,S,15305.82359,E,15.9,62.5,030308,11.2,W,A*3D
-$GPVTG,62.5,T,73.7,M,15.9,N,29.5,K,A*22
-$GPGGA,222601.000,2734.89190,S,15305.82850,E,1,06,1.8,60.5,M,39.2,M,,*7E
-$GPGLL,2734.89190,S,15305.82850,E,222601.000,A,A*4F
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.6,1.8,3.1*39
-$GPGST,222601.000,11.5,13.4,6.1,78.5,6.0,12.0,24.9*56
-$GPGSV,3,1,10,16,48,115,40,25,39,268,27,23,58,174,35,20,71,336,28*74
-$GPGSV,3,2,10,19,02,028,,04,06,242,,13,31,223,39,27,19,284,27*70
-$GPGSV,3,3,10,11,06,338,,03,14,055,23*71
-$GPRMC,222601.000,A,2734.89190,S,15305.82850,E,18.0,58.9,030308,11.2,W,A*36
-$GPVTG,58.9,T,70.1,M,18.0,N,33.4,K,A*2C
-$GPGGA,222602.000,2734.88904,S,15305.83361,E,1,05,1.6,60.0,M,39.2,M,,*79
-$GPGLL,2734.88904,S,15305.83361,E,222602.000,A,A*40
-$GPGSA,A,3,16,23,20,13,03,,,,,,,,2.5,1.6,1.9*3F
-$GPGST,222602.000,11.3,17.1,6.5,54.9,10.2,13.2,18.6*62
-$GPGSV,3,1,10,16,48,115,27,25,39,268,29,23,58,174,33,20,71,336,33*77
-$GPGSV,3,2,10,19,02,028,,04,06,242,,13,31,223,35,27,19,284,32*78
-$GPGSV,3,3,10,11,06,338,,03,14,055,24*76
-$GPRMC,222602.000,A,2734.88904,S,15305.83361,E,19.8,55.1,030308,11.2,W,A*35
-$GPVTG,55.1,T,66.3,M,19.8,N,36.7,K,A*23
-$GPGGA,222603.000,2734.88556,S,15305.83944,E,1,04,3.8,58.8,M,39.2,M,,*70
-$GPGLL,2734.88556,S,15305.83944,E,222603.000,A,A*47
-$GPGSA,A,3,25,23,20,27,,,,,,,,,6.5,3.8,5.2*3C
-$GPGST,222603.000,12.6,48.6,15.6,66.9,41.3,21.9,62.5*59
-$GPGSV,3,1,10,16,48,115,23,25,39,268,29,23,58,174,31,20,71,337,37*74
-$GPGSV,3,2,10,19,02,028,,04,06,242,,13,31,223,34,27,19,284,26*7C
-$GPGSV,3,3,10,11,06,338,,03,14,055,28*7A
-$GPRMC,222603.000,A,2734.88556,S,15305.83944,E,22.7,54.4,030308,11.2,W,A*31
-$GPVTG,54.4,T,65.6,M,22.7,N,42.1,K,A*23
-$GPGGA,222604.000,2734.88238,S,15305.84546,E,1,04,4.4,57.8,M,39.2,M,,*75
-$GPGLL,2734.88238,S,15305.84546,E,222604.000,A,A*46
-$GPGSA,A,3,25,20,13,27,,,,,,,,,7.2,4.4,5.7*37
-$GPGST,222604.000,10.4,46.8,10.9,81.3,42.4,11.8,57.5*57
-$GPGSV,3,1,10,16,48,115,27,25,39,268,32,23,58,174,32,20,71,337,37*79
-$GPGSV,3,2,10,19,02,028,,04,06,242,,13,31,223,34,27,19,284,34*7F
-$GPGSV,3,3,10,11,06,338,,03,14,055,29*7B
-$GPRMC,222604.000,A,2734.88238,S,15305.84546,E,23.3,54.5,030308,11.2,W,A*34
-$GPVTG,54.5,T,65.7,M,23.3,N,43.2,K,A*24
-$GPGGA,222605.000,2734.87917,S,15305.85182,E,1,04,4.4,56.6,M,39.2,M,,*7F
-$GPGLL,2734.87917,S,15305.85182,E,222605.000,A,A*43
-$GPGSA,A,3,25,20,13,27,,,,,,,,,7.2,4.4,5.7*37
-$GPGST,222605.000,14.3,40.3,10.1,81.5,36.5,10.7,49.8*58
-$GPGSV,3,1,10,16,48,115,24,25,39,268,32,23,58,174,33,20,71,337,37*7B
-$GPGSV,3,2,10,19,02,028,,04,06,242,20,13,31,223,35,27,19,284,32*7A
-$GPGSV,3,3,10,11,06,338,,03,14,055,26*74
-$GPRMC,222605.000,A,2734.87917,S,15305.85182,E,24.5,55.0,030308,11.2,W,A*34
-$GPVTG,55.0,T,66.2,M,24.5,N,45.3,K,A*20
-$GPGGA,222606.000,2734.87588,S,15305.85846,E,1,05,3.6,55.8,M,39.2,M,,*7E
-$GPGLL,2734.87588,S,15305.85846,E,222606.000,A,A*4B
-$GPGSA,A,3,25,23,20,13,27,,,,,,,,6.3,3.6,5.2*36
-$GPGST,222606.000,11.7,30.4,8.7,77.7,27.2,9.8,40.6*59
-$GPGSV,3,1,10,16,48,115,24,25,39,268,31,23,58,174,32,20,71,337,34*7A
-$GPGSV,3,2,10,19,02,029,,04,06,242,20,13,31,223,35,27,19,284,34*7D
-$GPGSV,3,3,10,11,06,338,,03,14,055,24*76
-$GPRMC,222606.000,A,2734.87588,S,15305.85846,E,25.3,55.9,030308,11.2,W,A*32
-$GPVTG,55.9,T,67.1,M,25.3,N,46.9,K,A*25
-$GPGGA,222607.000,2734.87218,S,15305.86543,E,1,06,1.8,55.5,M,39.2,M,,*78
-$GPGLL,2734.87218,S,15305.86543,E,222607.000,A,A*4F
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.6,1.8,3.1*39
-$GPGST,222607.000,11.2,13.8,8.5,86.1,7.8,12.6,27.3*52
-$GPGSV,3,1,10,16,48,115,29,25,39,268,26,23,58,174,34,20,71,337,32*71
-$GPGSV,3,2,10,19,02,029,,04,06,242,27,13,31,223,36,27,19,284,30*7D
-$GPGSV,3,3,10,11,06,338,,03,14,055,24*76
-$GPRMC,222607.000,A,2734.87218,S,15305.86543,E,26.0,57.6,030308,11.2,W,A*3B
-$GPVTG,57.6,T,68.8,M,26.0,N,48.1,K,A*28
-$GPGGA,222608.000,2734.86867,S,15305.87251,E,1,06,1.8,55.1,M,39.2,M,,*75
-$GPGLL,2734.86867,S,15305.87251,E,222608.000,A,A*46
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.6,1.8,3.1*39
-$GPGST,222608.000,15.1,15.8,7.1,68.8,8.0,13.6,36.7*5C
-$GPGSV,3,1,10,16,48,115,39,25,39,268,28,23,58,174,35,20,71,337,30*7D
-$GPGSV,3,2,10,19,02,029,,04,06,242,27,13,31,223,40,27,19,284,28*75
-$GPGSV,3,3,10,11,06,338,,03,14,055,28*7A
-$GPRMC,222608.000,A,2734.86867,S,15305.87251,E,25.9,60.7,030308,11.2,W,A*3D
-$GPVTG,60.7,T,71.9,M,25.9,N,47.9,K,A*29
-$GPGGA,222609.000,2734.86555,S,15305.87973,E,1,06,1.8,54.7,M,39.2,M,,*74
-$GPGLL,2734.86555,S,15305.87973,E,222609.000,A,A*40
-$GPGSA,A,3,16,25,23,13,27,03,,,,,,,3.6,1.8,3.1*39
-$GPGST,222609.000,10.9,10.9,5.1,85.4,4.7,10.0,22.0*55
-$GPGSV,3,1,10,16,48,116,34,25,39,268,39,23,58,174,29,20,71,337,33*7D
-$GPGSV,3,2,10,19,02,029,,04,06,242,24,13,31,223,42,27,19,284,23*7F
-$GPGSV,3,3,10,11,06,338,,03,14,055,26*74
-$GPRMC,222609.000,A,2734.86555,S,15305.87973,E,25.7,64.3,030308,11.2,W,A*35
-$GPVTG,64.3,T,75.6,M,25.7,N,47.5,K,A*20
-$GPGGA,222610.000,2734.86253,S,15305.88695,E,1,05,1.9,54.1,M,39.2,M,,*71
-$GPGLL,2734.86253,S,15305.88695,E,222610.000,A,A*41
-$GPGSA,A,3,16,25,23,13,03,,,,,,,,3.7,1.9,3.1*3C
-$GPGST,222610.000,11.1,14.6,7.4,64.7,8.3,12.4,28.7*57
-$GPGSV,3,1,10,16,48,116,29,25,39,268,42,23,58,174,28,20,71,337,32*7D
-$GPGSV,3,2,10,19,02,029,,04,06,242,24,13,31,223,42,27,19,284,23*7F
-$GPGSV,3,3,10,11,06,338,,03,14,055,24*76
-$GPRMC,222610.000,A,2734.86253,S,15305.88695,E,25.3,65.0,030308,11.2,W,A*32
-$GPVTG,65.0,T,76.3,M,25.3,N,46.8,K,A*2C
-$GPGGA,222611.000,2734.85924,S,15305.89387,E,1,05,2.2,53.4,M,39.2,M,,*75
-$GPGLL,2734.85924,S,15305.89387,E,222611.000,A,A*4F
-$GPGSA,A,3,16,25,23,20,13,,,,,,,,5.3,2.2,4.8*39
-$GPGST,222611.000,17.7,8.4,21.7,17.4,9.4,19.0,57.8*57
-$GPGSV,3,1,10,16,48,116,39,25,39,268,32,23,58,174,35,20,71,337,26*72
-$GPGSV,3,2,10,19,02,029,,04,06,242,31,13,31,223,39,27,19,284,24*70
-$GPGSV,3,3,10,11,06,338,,03,14,055,26*74
-$GPRMC,222611.000,A,2734.85924,S,15305.89387,E,24.9,61.4,030308,11.2,W,A*37
-$GPVTG,61.4,T,72.6,M,24.9,N,46.1,K,A*2F
-$GPGGA,222612.000,2734.85516,S,15305.90007,E,1,07,1.2,53.3,M,39.2,M,,*7E
-$GPGLL,2734.85516,S,15305.90007,E,222612.000,A,A*42
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222612.000,15.5,16.3,8.2,77.8,8.0,14.7,27.8*50
-$GPGSV,3,1,10,16,48,116,29,25,39,268,29,23,58,174,30,20,71,337,34*7F
-$GPGSV,3,2,10,19,02,029,,04,06,242,27,13,31,223,35,27,19,284,28*77
-$GPGSV,3,3,10,11,06,338,,03,14,055,25*77
-$GPRMC,222612.000,A,2734.85516,S,15305.90007,E,24.5,53.1,030308,11.2,W,A*32
-$GPVTG,53.1,T,64.3,M,24.5,N,45.4,K,A*23
-$GPGGA,222613.000,2734.85043,S,15305.90565,E,1,05,1.9,53.2,M,39.2,M,,*73
-$GPGLL,2734.85043,S,15305.90565,E,222613.000,A,A*47
-$GPGSA,A,3,16,25,20,13,27,,,,,,,,3.7,1.9,3.2*3A
-$GPGST,222613.000,21.1,11.0,20.9,21.8,11.7,18.1,48.5*55
-$GPGSV,3,1,10,16,48,116,30,25,39,268,32,23,58,174,24,20,71,337,36*7A
-$GPGSV,3,2,10,19,02,029,,04,06,242,22,13,31,223,35,27,19,284,29*73
-$GPGSV,3,3,10,11,06,338,,03,14,055,29*7B
-$GPRMC,222613.000,A,2734.85043,S,15305.90565,E,24.9,45.4,030308,11.2,W,A*39
-$GPVTG,45.4,T,56.6,M,24.9,N,46.1,K,A*2F
-$GPGGA,222614.000,2734.84523,S,15305.91064,E,1,05,1.9,53.2,M,39.2,M,,*73
-$GPGLL,2734.84523,S,15305.91064,E,222614.000,A,A*47
-$GPGSA,A,3,16,25,20,13,27,,,,,,,,3.7,1.9,3.2*3A
-$GPGST,222614.000,18.8,16.8,28.3,28.1,18.2,24.0,43.4*54
-$GPGSV,3,1,10,16,48,116,27,25,39,268,30,23,58,174,32,20,71,337,35*7A
-$GPGSV,3,2,10,19,02,029,,04,06,242,28,13,31,223,26,27,19,284,32*71
-$GPGSV,3,3,10,11,06,338,,03,14,055,30*73
-$GPRMC,222614.000,A,2734.84523,S,15305.91064,E,24.7,40.2,030308,11.2,W,A*34
-$GPVTG,40.2,T,51.4,M,24.7,N,45.7,K,A*22
-$GPGGA,222615.000,2734.84002,S,15305.91547,E,1,07,1.2,53.0,M,39.2,M,,*7B
-$GPGLL,2734.84002,S,15305.91547,E,222615.000,A,A*44
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222615.000,19.7,18.9,7.9,71.0,8.8,16.5,18.9*52
-$GPGSV,3,1,10,16,48,116,25,25,39,268,26,23,58,174,35,20,71,337,34*79
-$GPGSV,3,2,10,19,02,029,,04,06,242,24,13,31,223,25,27,19,284,30*7C
-$GPGSV,3,3,10,11,06,338,,03,14,055,29*7B
-$GPRMC,222615.000,A,2734.84002,S,15305.91547,E,24.1,38.7,030308,11.2,W,A*3B
-$GPVTG,38.7,T,49.9,M,24.1,N,44.7,K,A*2B
-$GPGGA,222616.000,2734.83488,S,15305.92024,E,1,07,1.2,53.1,M,39.2,M,,*7B
-$GPGLL,2734.83488,S,15305.92024,E,222616.000,A,A*45
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222616.000,18.1,15.8,11.2,70.8,10.8,14.1,19.9*51
-$GPGSV,3,1,10,16,48,116,27,25,39,268,29,23,58,174,34,20,71,337,30*71
-$GPGSV,3,2,10,19,02,029,,04,06,242,27,13,31,223,24,27,19,284,28*77
-$GPGSV,3,3,10,11,06,338,,03,14,055,32*71
-$GPRMC,222616.000,A,2734.83488,S,15305.92024,E,24.0,39.3,030308,11.2,W,A*3E
-$GPVTG,39.3,T,50.5,M,24.0,N,44.5,K,A*29
-$GPGGA,222617.000,2734.82955,S,15305.92505,E,1,07,1.2,53.2,M,39.2,M,,*73
-$GPGLL,2734.82955,S,15305.92505,E,222617.000,A,A*4E
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222617.000,14.7,13.3,9.2,70.7,8.9,11.8,16.8*5B
-$GPGSV,3,1,10,16,48,116,23,25,39,268,30,23,58,174,35,20,71,337,33*7F
-$GPGSV,3,2,10,19,02,029,,04,06,242,25,13,31,223,25,27,19,284,26*7A
-$GPGSV,3,3,10,11,06,338,,03,14,055,32*71
-$GPRMC,222617.000,A,2734.82955,S,15305.92505,E,24.7,38.8,030308,11.2,W,A*38
-$GPVTG,38.8,T,50.0,M,24.7,N,45.7,K,A*22
-$GPGGA,222618.000,2734.82405,S,15305.92991,E,1,07,1.2,53.5,M,39.2,M,,*72
-$GPGLL,2734.82405,S,15305.92991,E,222618.000,A,A*48
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222618.000,13.7,14.7,7.8,77.2,7.6,13.2,24.3*54
-$GPGSV,3,1,10,16,48,116,27,25,39,268,30,23,58,174,36,20,71,337,32*79
-$GPGSV,3,2,10,19,02,029,,04,06,242,31,13,31,223,25,27,19,283,23*7D
-$GPGSV,3,3,10,11,06,338,,03,14,056,32*72
-$GPRMC,222618.000,A,2734.82405,S,15305.92991,E,25.3,38.3,030308,11.2,W,A*30
-$GPVTG,38.3,T,49.5,M,25.3,N,46.8,K,A*2D
-$GPGGA,222619.000,2734.81867,S,15305.93485,E,1,07,1.2,53.8,M,39.2,M,,*7C
-$GPGLL,2734.81867,S,15305.93485,E,222619.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,13,27,03,,,,,,2.1,1.2,1.7*33
-$GPGST,222619.000,20.5,18.3,9.9,85.5,9.1,16.7,27.9*5A
-$GPGSV,3,1,10,16,48,116,27,25,39,268,30,23,58,174,35,20,71,337,33*7B
-$GPGSV,3,2,10,19,02,029,,04,06,242,29,13,31,223,23,27,19,283,23*72
-$GPGSV,3,3,10,11,06,338,,03,14,056,32*72
-$GPRMC,222619.000,A,2734.81867,S,15305.93485,E,25.3,39.2,030308,11.2,W,A*33
-$GPVTG,39.2,T,50.4,M,25.3,N,46.8,K,A*24
-$GPGGA,222620.000,2734.81344,S,15305.93979,E,1,05,1.6,53.8,M,39.2,M,,*74
-$GPGLL,2734.81344,S,15305.93979,E,222620.000,A,A*45
-$GPGSA,A,3,16,23,20,13,03,,,,,,,,2.5,1.6,1.9*3F
-$GPGST,222620.000,18.2,14.7,21.1,9.8,19.1,13.7,29.8*64
-$GPGSV,3,1,10,16,48,116,26,25,39,268,30,23,58,174,33,20,71,337,34*7B
-$GPGSV,3,2,10,19,02,029,,04,06,242,24,13,31,223,25,27,19,283,29*73
-$GPGSV,3,3,10,11,06,338,,03,14,056,33*73
-$GPRMC,222620.000,A,2734.81344,S,15305.93979,E,24.7,39.5,030308,11.2,W,A*3F
-$GPVTG,39.5,T,50.7,M,24.7,N,45.8,K,A*26
-$GPGGA,222621.000,2734.80838,S,15305.94469,E,1,06,1.3,53.5,M,39.2,M,,*74
-$GPGLL,2734.80838,S,15305.94469,E,222621.000,A,A*4E
-$GPGSA,A,3,16,25,23,20,13,03,,,,,,,2.3,1.3,1.9*3B
-$GPGST,222621.000,14.6,11.8,13.4,39.2,11.7,11.4,21.8*5D
-$GPGSV,3,1,10,16,48,116,25,25,39,268,31,23,58,174,33,20,71,337,37*7A
-$GPGSV,3,2,10,19,03,029,,04,06,242,24,13,31,223,24,27,19,283,36*7D
-$GPGSV,3,3,10,11,06,338,,03,14,056,32*72
-$GPRMC,222621.000,A,2734.80838,S,15305.94469,E,24.1,40.1,030308,11.2,W,A*38
-$GPVTG,40.1,T,51.3,M,24.1,N,44.7,K,A*21
-$GPGGA,222622.000,2734.80354,S,15305.94956,E,1,06,1.7,53.3,M,39.2,M,,*75
-$GPGLL,2734.80354,S,15305.94956,E,222622.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,13,27,,,,,,,3.3,1.7,2.9*3B
-$GPGST,222622.000,13.2,10.2,17.1,41.6,12.5,13.2,30.8*59
-$GPGSV,3,1,10,16,48,116,26,25,39,268,31,23,58,174,26,20,71,337,39*73
-$GPGSV,3,2,10,19,03,029,,04,06,242,24,13,31,223,28,27,19,283,36*71
-$GPGSV,3,3,10,11,06,338,,03,14,056,35*75
-$GPRMC,222622.000,A,2734.80354,S,15305.94956,E,23.6,41.3,030308,11.2,W,A*38
-$GPVTG,41.3,T,52.5,M,23.6,N,43.7,K,A*20
-$GPGGA,222623.000,2734.79878,S,15305.95470,E,1,05,1.9,52.8,M,39.2,M,,*78
-$GPGLL,2734.79878,S,15305.95470,E,222623.000,A,A*47
-$GPGSA,A,3,16,25,20,13,27,,,,,,,,3.7,1.9,3.2*3A
-$GPGST,222623.000,14.7,24.8,16.6,50.3,19.9,18.6,39.3*5E
-$GPGSV,3,1,11,16,48,116,24,25,39,268,32,23,58,174,24,20,71,337,38*70
-$GPGSV,3,2,11,19,03,029,,04,06,242,24,13,31,223,32,27,19,283,34*79
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,34*7D
-$GPRMC,222623.000,A,2734.79878,S,15305.95470,E,24.0,43.4,030308,11.2,W,A*36
-$GPVTG,43.4,T,54.6,M,24.0,N,44.4,K,A*25
-$GPGGA,222624.000,2734.79400,S,15305.96019,E,1,05,1.9,52.3,M,39.2,M,,*7F
-$GPGLL,2734.79400,S,15305.96019,E,222624.000,A,A*4B
-$GPGSA,A,3,16,25,20,27,03,,,,,,,,2.7,1.9,2.0*39
-$GPGST,222624.000,12.3,24.0,7.9,80.2,8.0,21.7,15.3*5C
-$GPGSV,3,1,11,16,48,116,23,25,39,268,32,23,58,174,26,20,71,337,37*7A
-$GPGSV,3,2,11,19,03,029,,04,06,242,24,13,31,223,35,27,19,283,25*7E
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,31*78
-$GPRMC,222624.000,A,2734.79400,S,15305.96019,E,24.7,45.3,030308,11.2,W,A*3C
-$GPVTG,45.3,T,56.6,M,24.7,N,45.7,K,A*23
-$GPGGA,222625.000,2734.78953,S,15305.96595,E,1,05,1.9,51.8,M,39.2,M,,*7D
-$GPGLL,2734.78953,S,15305.96595,E,222625.000,A,A*41
-$GPGSA,A,3,16,25,20,13,27,,,,,,,,3.7,1.9,3.2*3A
-$GPGST,222625.000,24.0,12.2,19.9,37.5,14.2,16.0,36.1*57
-$GPGSV,3,1,11,16,48,116,30,25,39,268,32,23,58,174,23,20,71,337,37*7D
-$GPGSV,3,2,11,19,03,029,,04,06,242,25,13,31,223,36,27,19,283,25*7C
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,24*7C
-$GPRMC,222625.000,A,2734.78953,S,15305.96595,E,24.8,47.9,030308,11.2,W,A*31
-$GPVTG,47.9,T,59.1,M,24.8,N,46.0,K,A*28
-$GPGGA,222626.000,2734.78516,S,15305.97172,E,1,05,2.5,51.1,M,39.2,M,,*79
-$GPGLL,2734.78516,S,15305.97172,E,222626.000,A,A*43
-$GPGSA,A,3,16,25,20,04,13,,,,,,,,4.2,2.5,3.3*37
-$GPGST,222626.000,20.2,12.6,23.1,19.8,13.0,20.2,38.4*5F
-$GPGSV,3,1,11,16,48,116,31,25,39,268,32,23,58,174,25,20,71,337,38*75
-$GPGSV,3,2,11,19,03,029,,04,06,242,25,13,31,223,36,27,19,283,23*7A
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,24*7C
-$GPRMC,222626.000,A,2734.78516,S,15305.97172,E,24.7,48.3,030308,11.2,W,A*39
-$GPVTG,48.3,T,59.5,M,24.7,N,45.7,K,A*22
-$GPGGA,222627.000,2734.78079,S,15305.97737,E,1,04,2.5,50.5,M,39.2,M,,*77
-$GPGLL,2734.78079,S,15305.97737,E,222627.000,A,A*49
-$GPGSA,A,3,16,23,20,13,,,,,,,,,5.8,2.5,5.2*39
-$GPGST,222627.000,16.3,12.4,42.2,11.3,13.5,37.9,90.0*51
-$GPGSV,3,1,11,16,48,116,28,25,39,268,32,23,58,174,25,20,71,337,37*72
-$GPGSV,3,2,11,19,03,029,,04,06,242,29,13,31,223,37,27,19,283,30*75
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,24*7C
-$GPRMC,222627.000,A,2734.78079,S,15305.97737,E,24.3,48.1,030308,11.2,W,A*35
-$GPVTG,48.1,T,59.3,M,24.3,N,45.1,K,A*24
-$GPGGA,222628.000,2734.77637,S,15305.98293,E,1,07,1.3,50.2,M,39.2,M,,*7E
-$GPGLL,2734.77637,S,15305.98293,E,222628.000,A,A*41
-$GPGSA,A,3,16,25,23,04,13,27,03,,,,,,2.2,1.3,1.8*38
-$GPGST,222628.000,13.2,14.5,8.8,76.9,8.4,13.0,22.0*5F
-$GPGSV,3,1,11,16,48,116,30,25,39,268,32,23,58,174,27,20,71,337,37*79
-$GPGSV,3,2,11,19,03,029,,04,06,242,32,13,31,223,37,27,19,283,28*76
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,25*7D
-$GPRMC,222628.000,A,2734.77637,S,15305.98293,E,23.9,48.5,030308,11.2,W,A*34
-$GPVTG,48.5,T,59.7,M,23.9,N,44.3,K,A*2A
-$GPGGA,222629.000,2734.77226,S,15305.98850,E,1,08,1.1,49.5,M,39.2,M,,*7C
-$GPGLL,2734.77226,S,15305.98850,E,222629.000,A,A*41
-$GPGSA,A,3,16,25,23,20,04,13,27,03,,,,,1.7,1.1,1.3*35
-$GPGST,222629.000,11.0,9.5,7.3,89.6,6.7,8.6,14.3*5E
-$GPGSV,3,1,11,16,48,116,31,25,39,268,32,23,58,174,25,20,71,337,36*7B
-$GPGSV,3,2,11,19,03,029,,04,06,242,30,13,31,223,37,27,19,283,28*74
-$GPGSV,3,3,11,11,06,338,,01,,,18,03,14,056,27*7F
-$GPRMC,222629.000,A,2734.77226,S,15305.98850,E,23.5,49.4,030308,11.2,W,A*38
-$GPVTG,49.4,T,60.6,M,23.5,N,43.5,K,A*2C
-$GPGGA,222630.000,2734.76859,S,15305.99361,E,1,04,3.5,49.4,M,39.2,M,,*74
-$GPGLL,2734.76859,S,15305.99361,E,222630.000,A,A*42
-$GPGSA,A,3,16,25,20,27,,,,,,,,,4.9,3.5,3.4*39
-$GPGST,222630.000,13.4,7.9,50.0,19.9,17.0,43.1,69.5*66
-$GPGSV,3,1,11,16,48,116,31,25,39,268,30,23,58,174,22,20,71,337,36*7E
-$GPGSV,3,2,11,19,03,029,,04,06,242,32,13,31,223,35,27,19,283,24*78
-$GPGSV,3,3,11,11,06,338,18,01,,,18,03,14,056,29*78
-$GPRMC,222630.000,A,2734.76859,S,15305.99361,E,21.1,50.3,030308,11.2,W,A*32
-$GPVTG,50.3,T,61.5,M,21.1,N,39.1,K,A*2E
-$GPGGA,222631.000,2734.76498,S,15305.99809,E,1,08,1.1,48.2,M,39.2,M,,*7C
-$GPGLL,2734.76498,S,15305.99809,E,222631.000,A,A*47
-$GPGSA,A,3,16,25,23,20,04,13,27,03,,,,,1.7,1.1,1.3*35
-$GPGST,222631.000,18.4,10.8,5.8,77.6,5.6,9.7,13.2*63
-$GPGSV,3,1,11,16,48,116,32,25,39,268,31,23,58,174,22,20,71,337,35*7F
-$GPGSV,3,2,11,19,03,029,,04,06,242,30,13,31,223,36,27,19,283,25*78
-$GPGSV,3,3,11,11,06,338,18,01,,,18,03,14,056,33*73
-$GPRMC,222631.000,A,2734.76498,S,15305.99809,E,19.4,47.4,030308,11.2,W,A*38
-$GPVTG,47.4,T,58.6,M,19.4,N,35.9,K,A*2C
-$GPGGA,222632.000,2734.76359,S,15306.00162,E,1,08,1.1,49.6,M,39.2,M,,*77
-$GPGLL,2734.76359,S,15306.00162,E,222632.000,A,A*49
-$GPGSA,A,3,16,25,23,20,04,13,27,03,,,,,1.7,1.1,1.3*35
-$GPGST,222632.000,18.1,14.9,6.7,53.4,9.5,11.5,16.1*5A
-$GPGSV,3,1,11,16,48,116,30,25,39,268,31,23,58,174,31,20,71,337,31*7B
-$GPGSV,3,2,11,19,03,029,,04,06,242,22,13,31,223,37,27,19,283,29*76
-$GPGSV,3,3,11,11,06,338,24,01,,,18,03,14,056,25*7B
-$GPRMC,222632.000,A,2734.76359,S,15306.00162,E,12.4,65.5,030308,11.2,W,A*3C
-$GPVTG,65.5,T,76.7,M,12.4,N,22.9,K,A*2D
-$GPGGA,222633.000,2734.76254,S,15306.00553,E,1,08,1.1,49.0,M,39.2,M,,*7A
-$GPGLL,2734.76254,S,15306.00553,E,222633.000,A,A*42
-$GPGSA,A,3,16,25,23,20,04,13,27,03,,,,,1.7,1.1,1.3*35
-$GPGST,222633.000,13.9,12.3,5.8,55.3,7.8,9.7,13.7*62
-$GPGSV,3,1,10,16,48,116,35,25,39,268,35,23,58,174,30,20,71,337,35*7E
-$GPGSV,3,2,10,19,03,029,,04,06,242,26,13,31,223,39,27,19,283,26*72
-$GPGSV,3,3,10,11,06,338,24,03,14,056,30*76
-$GPRMC,222633.000,A,2734.76254,S,15306.00553,E,12.9,72.5,030308,11.2,W,A*3C
-$GPVTG,72.5,T,83.7,M,12.9,N,23.9,K,A*2D
-$GPGGA,222634.000,2734.76305,S,15306.00850,E,1,08,1.1,48.4,M,39.2,M,,*73
-$GPGLL,2734.76305,S,15306.00850,E,222634.000,A,A*4E
-$GPGSA,A,3,16,25,23,20,04,13,27,03,,,,,1.7,1.1,1.3*35
-$GPGST,222634.000,11.3,10.3,5.3,58.0,6.5,8.4,12.0*62
-$GPGSV,3,1,10,16,48,116,33,25,39,268,38,23,58,174,30,20,71,337,30*70
-$GPGSV,3,2,10,19,03,029,,04,06,242,29,13,31,223,34,27,19,283,30*77
-$GPGSV,3,3,10,11,06,338,23,03,14,056,25*75
-$GPRMC,222634.000,A,2734.76305,S,15306.00850,E,9.4,99.3,030308,11.2,W,A*04
-$GPVTG,99.3,T,110.5,M,9.4,N,17.3,K,A*2D
-$GPGGA,222635.000,2734.76418,S,15306.01089,E,1,08,1.1,47.9,M,39.2,M,,*76
-$GPGLL,2734.76418,S,15306.01089,E,222635.000,A,A*49
-$GPGSA,A,3,16,25,23,20,04,13,27,03,,,,,1.7,1.1,1.3*35
-$GPGST,222635.000,13.4,9.3,7.7,66.3,7.3,8.3,14.0*50
-$GPGSV,3,1,10,16,48,116,36,25,39,268,31,23,58,174,37,20,71,337,36*7D
-$GPGSV,3,2,10,19,03,029,,04,06,242,31,13,31,223,34,27,19,283,31*7F
-$GPGSV,3,3,10,11,06,338,23,03,14,056,23*73
-$GPRMC,222635.000,A,2734.76418,S,15306.01089,E,8.3,116.7,030308,11.2,W,A*37
-$GPVTG,116.7,T,127.9,M,8.3,N,15.4,K,A*14
-$GPGGA,222636.000,2734.76577,S,15306.01258,E,1,07,1.7,47.9,M,39.2,M,,*7A
-$GPGLL,2734.76577,S,15306.01258,E,222636.000,A,A*4C
-$GPGSA,A,3,16,25,23,20,04,13,27,,,,,,2.8,1.7,2.3*3F
-$GPGST,222636.000,10.6,11.9,8.1,45.4,9.3,9.3,18.8*65
-$GPGSV,3,1,10,16,48,116,41,25,39,268,35,23,58,174,40,20,71,337,33*7C
-$GPGSV,3,2,10,19,03,029,,04,06,242,32,13,31,223,28,27,19,283,34*74
-$GPGSV,3,3,10,11,06,338,25,03,14,056,23*75
-$GPRMC,222636.000,A,2734.76577,S,15306.01258,E,7.6,135.7,030308,11.2,W,A*39
-$GPVTG,135.7,T,146.9,M,7.6,N,14.1,K,A*1C
-$GPGGA,222637.000,2734.76759,S,15306.01422,E,1,07,1.7,47.8,M,39.2,M,,*7F
-$GPGLL,2734.76759,S,15306.01422,E,222637.000,A,A*48
-$GPGSA,A,3,16,25,23,20,04,13,27,,,,,,2.8,1.7,2.3*3F
-$GPGST,222637.000,8.9,7.2,10.9,44.4,8.4,8.5,17.1*59
-$GPGSV,3,1,10,16,48,116,44,25,39,268,36,23,58,174,33,20,71,337,33*7E
-$GPGSV,3,2,10,19,03,029,,04,06,242,24,13,31,223,29,27,19,283,36*70
-$GPGSV,3,3,10,11,06,338,25,03,14,056,23*75
-$GPRMC,222637.000,A,2734.76759,S,15306.01422,E,8.0,140.6,030308,11.2,W,A*37
-$GPVTG,140.6,T,151.8,M,8.0,N,14.8,K,A*18
-$GPGGA,222638.000,2734.76957,S,15306.01592,E,1,06,2.0,47.6,M,39.2,M,,*71
-$GPGLL,2734.76957,S,15306.01592,E,222638.000,A,A*4D
-$GPGSA,A,3,16,25,23,20,04,13,,,,,,,3.2,2.0,2.6*30
-$GPGST,222638.000,10.4,8.9,16.3,14.1,8.7,14.6,19.9*51
-$GPGSV,3,1,10,16,48,116,38,25,39,268,30,23,58,174,29,20,71,337,29*73
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,29*7B
-$GPGSV,3,3,10,11,06,338,21,03,14,056,23*71
-$GPRMC,222638.000,A,2734.76957,S,15306.01592,E,8.8,142.8,030308,11.2,W,A*36
-$GPVTG,142.8,T,154.0,M,8.8,N,16.2,K,A*19
-$GPGGA,222639.000,2734.77109,S,15306.01748,E,1,07,1.7,47.8,M,39.2,M,,*7C
-$GPGLL,2734.77109,S,15306.01748,E,222639.000,A,A*4B
-$GPGSA,A,3,16,25,23,20,04,13,27,,,,,,2.8,1.7,2.3*3F
-$GPGST,222639.000,9.5,9.6,14.7,43.8,11.3,11.5,19.8*51
-$GPGSV,3,1,10,16,48,116,37,25,39,268,32,23,58,174,37,20,71,337,29*71
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,27*75
-$GPGSV,3,3,10,11,06,338,21,03,14,056,23*71
-$GPRMC,222639.000,A,2734.77109,S,15306.01748,E,7.1,137.2,030308,11.2,W,A*3E
-$GPVTG,137.2,T,148.4,M,7.1,N,13.1,K,A*18
-$GPGGA,222640.000,2734.77216,S,15306.02018,E,1,04,2.6,47.8,M,39.2,M,,*7F
-$GPGLL,2734.77216,S,15306.02018,E,222640.000,A,A*49
-$GPGSA,A,3,16,25,23,13,,,,,,,,,6.2,2.6,5.6*32
-$GPGST,222640.000,20.0,11.7,22.3,7.0,10.9,20.3,46.8*65
-$GPGSV,3,1,10,16,48,116,32,25,39,268,29,23,58,174,24,20,71,337,25*70
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,25*77
-$GPGSV,3,3,10,11,06,338,21,03,14,056,23*71
-$GPRMC,222640.000,A,2734.77216,S,15306.02018,E,9.4,114.2,030308,11.2,W,A*36
-$GPVTG,114.2,T,125.4,M,9.4,N,17.4,K,A*18
-$GPGGA,222641.000,2734.77543,S,15306.02149,E,1,04,2.6,47.7,M,39.2,M,,*73
-$GPGLL,2734.77543,S,15306.02149,E,222641.000,A,A*4A
-$GPGSA,A,3,16,25,23,13,,,,,,,,,6.2,2.6,5.6*32
-$GPGST,222641.000,18.3,40.3,13.2,79.5,13.7,36.3,59.1*5E
-$GPGSV,3,1,10,16,48,116,34,25,39,268,23,23,58,174,26,20,71,337,27*7C
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*71
-$GPGSV,3,3,10,11,06,338,21,03,14,056,23*71
-$GPRMC,222641.000,A,2734.77543,S,15306.02149,E,12.5,160.9,030308,11.2,W,A*06
-$GPVTG,160.9,T,172.1,M,12.5,N,23.1,K,A*2E
-$GPGGA,222642.000,2734.77709,S,15306.02300,E,1,04,2.6,47.7,M,39.2,M,,*73
-$GPGLL,2734.77709,S,15306.02300,E,222642.000,A,A*4A
-$GPGSA,A,3,16,20,04,13,,,,,,,,,4.3,2.6,3.4*35
-$GPGST,222642.000,15.8,14.5,71.8,20.7,26.3,61.6,97.2*58
-$GPGSV,3,1,10,16,48,116,41,25,40,268,23,23,58,174,27,20,71,337,34*73
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*71
-$GPGSV,3,3,10,11,06,338,21,03,14,056,23*71
-$GPRMC,222642.000,A,2734.77709,S,15306.02300,E,7.5,140.7,030308,11.2,W,A*3E
-$GPVTG,140.7,T,151.9,M,7.5,N,13.9,K,A*14
-$GPGGA,222643.000,2734.77831,S,15306.02427,E,1,04,2.6,47.5,M,39.2,M,,*76
-$GPGLL,2734.77831,S,15306.02427,E,222643.000,A,A*4D
-$GPGSA,A,3,16,20,04,13,,,,,,,,,4.3,2.6,3.4*35
-$GPGST,222643.000,12.9,15.5,112.8,21.4,39.9,96.1,154.3*5C
-$GPGSV,3,1,10,16,48,116,41,25,40,268,23,23,58,174,26,20,71,337,35*73
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*71
-$GPGSV,3,3,10,11,06,338,21,03,14,056,23*71
-$GPRMC,222643.000,A,2734.77831,S,15306.02427,E,5.6,136.2,030308,11.2,W,A*3C
-$GPVTG,136.2,T,147.4,M,5.6,N,10.4,K,A*15
-$GPGGA,222644.000,2734.77900,S,15306.02522,E,1,04,2.5,47.4,M,39.2,M,,*74
-$GPGLL,2734.77900,S,15306.02522,E,222644.000,A,A*4D
-$GPGSA,A,3,16,23,20,13,,,,,,,,,5.8,2.5,5.2*39
-$GPGST,222644.000,11.9,32.3,39.9,23.1,35.5,30.7,165.7*69
-$GPGSV,3,1,10,16,48,116,38,25,40,268,23,23,58,174,25,20,71,337,37*7C
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*71
-$GPGSV,3,3,10,11,06,338,21,03,14,056,26*74
-$GPRMC,222644.000,A,2734.77900,S,15306.02522,E,3.7,127.8,030308,11.2,W,A*31
-$GPVTG,127.8,T,139.0,M,3.7,N,6.9,K,A*2F
-$GPGGA,222645.000,2734.77991,S,15306.02594,E,1,04,3.4,47.4,M,39.2,M,,*70
-$GPGLL,2734.77991,S,15306.02594,E,222645.000,A,A*49
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.4,5.0*30
-$GPGST,222645.000,15.3,40.1,15.0,66.6,34.1,19.2,69.1*50
-$GPGSV,3,1,10,16,48,116,33,25,40,268,23,23,58,174,23,20,71,337,35*73
-$GPGSV,3,2,10,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*71
-$GPGSV,3,3,10,11,06,338,21,03,14,056,30*73
-$GPRMC,222645.000,A,2734.77991,S,15306.02594,E,3.9,145.4,030308,11.2,W,A*33
-$GPVTG,145.4,T,156.6,M,3.9,N,7.2,K,A*2C
-$GPGGA,222646.000,2734.78074,S,15306.02652,E,1,04,3.4,47.4,M,39.2,M,,*77
-$GPGLL,2734.78074,S,15306.02652,E,222646.000,A,A*4E
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.4,5.0*30
-$GPGST,222646.000,14.8,53.5,15.6,78.9,48.1,16.9,76.9*50
-$GPGSV,3,1,11,16,48,116,32,25,40,268,23,23,58,174,26,20,71,337,32*71
-$GPGSV,3,2,11,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*70
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,34*4D
-$GPRMC,222646.000,A,2734.78074,S,15306.02652,E,3.5,149.5,030308,11.2,W,A*35
-$GPVTG,149.5,T,160.7,M,3.5,N,6.6,K,A*2C
-$GPGGA,222647.000,2734.78140,S,15306.02704,E,1,04,3.4,47.3,M,39.2,M,,*75
-$GPGLL,2734.78140,S,15306.02704,E,222647.000,A,A*4B
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.4,5.0*30
-$GPGST,222647.000,11.7,42.4,13.1,77.7,38.0,14.3,60.9*53
-$GPGSV,3,1,11,16,48,116,37,25,40,268,23,23,58,174,31,20,71,337,36*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*70
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,34*4D
-$GPRMC,222647.000,A,2734.78140,S,15306.02704,E,2.8,145.4,030308,11.2,W,A*31
-$GPVTG,145.4,T,156.6,M,2.8,N,5.1,K,A*2D
-$GPGGA,222648.000,2734.78183,S,15306.02753,E,1,04,3.5,47.2,M,39.2,M,,*77
-$GPGLL,2734.78183,S,15306.02753,E,222648.000,A,A*49
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222648.000,11.3,35.2,16.9,76.3,31.5,16.9,53.8*53
-$GPGSV,3,1,11,16,48,116,35,25,40,267,23,23,58,174,37,20,71,337,35*7E
-$GPGSV,3,2,11,19,03,029,,04,06,242,28,13,31,223,31,27,19,283,23*70
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,35*4C
-$GPRMC,222648.000,A,2734.78183,S,15306.02753,E,2.1,135.8,030308,11.2,W,A*31
-$GPVTG,135.8,T,147.1,M,2.1,N,3.9,K,A*26
-$GPGGA,222649.000,2734.78197,S,15306.02773,E,1,04,3.5,46.8,M,39.2,M,,*7A
-$GPGLL,2734.78197,S,15306.02773,E,222649.000,A,A*4F
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222649.000,13.9,60.8,14.8,84.0,55.3,14.7,79.7*52
-$GPGSV,3,1,11,16,48,116,31,25,40,267,23,23,58,174,36,20,71,337,31*7F
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,19,283,23*78
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,29*41
-$GPRMC,222649.000,A,2734.78197,S,15306.02773,E,0.6,148.6,030308,11.2,W,A*36
-$GPVTG,148.6,T,159.8,M,0.6,N,1.2,K,A*28
-$GPGGA,222650.000,2734.78195,S,15306.02785,E,1,04,3.5,46.4,M,39.2,M,,*75
-$GPGLL,2734.78195,S,15306.02785,E,222650.000,A,A*4C
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222650.000,11.4,48.0,12.9,83.3,43.6,12.8,63.8*5B
-$GPGSV,3,1,11,16,48,116,30,25,40,267,23,23,58,174,33,20,71,337,30*7A
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,19,283,23*78
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,26*4E
-$GPRMC,222650.000,A,2734.78195,S,15306.02785,E,0.2,6.4,030308,11.2,W,A*38
-$GPVTG,6.4,T,17.6,M,0.2,N,0.3,K,A*10
-$GPGGA,222651.000,2734.78191,S,15306.02798,E,1,04,3.5,45.9,M,39.2,M,,*72
-$GPGLL,2734.78191,S,15306.02798,E,222651.000,A,A*45
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222651.000,9.8,40.0,12.0,82.4,36.3,11.9,53.8*6E
-$GPGSV,3,1,11,16,48,116,28,25,40,267,,23,58,174,35,20,71,337,26*73
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,19,283,*79
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,28*40
-$GPRMC,222651.000,A,2734.78191,S,15306.02798,E,0.1,352.6,030308,11.2,W,A*32
-$GPVTG,352.6,T,3.8,M,0.1,N,0.3,K,A*28
-$GPGGA,222652.000,2734.78198,S,15306.02797,E,1,04,3.5,45.9,M,39.2,M,,*77
-$GPGLL,2734.78198,S,15306.02797,E,222652.000,A,A*40
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222652.000,21.7,41.2,15.0,83.8,37.5,14.2,91.6*58
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,174,23,20,71,337,26*78
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,19,283,*79
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,24*4C
-$GPRMC,222652.000,A,2734.78198,S,15306.02797,E,0.2,263.5,030308,11.2,W,A*34
-$GPVTG,263.5,T,274.7,M,0.2,N,0.3,K,A*26
-$GPGGA,222653.000,2734.78226,S,15306.02793,E,1,04,3.5,45.9,M,39.2,M,,*74
-$GPGLL,2734.78226,S,15306.02793,E,222653.000,A,A*43
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222653.000,18.8,36.4,20.7,81.4,33.0,19.3,78.6*5F
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,174,25,20,71,337,25*7D
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,24*4C
-$GPRMC,222653.000,A,2734.78226,S,15306.02793,E,0.8,188.1,030308,11.2,W,A*3F
-$GPVTG,188.1,T,199.3,M,0.8,N,1.5,K,A*2D
-$GPGGA,222654.000,2734.78231,S,15306.02789,E,1,04,3.5,45.9,M,39.2,M,,*7E
-$GPGLL,2734.78231,S,15306.02789,E,222654.000,A,A*49
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222654.000,14.4,23.3,16.5,69.8,20.7,16.0,57.9*5D
-$GPGSV,3,1,11,16,48,116,34,25,40,267,,23,58,174,34,20,71,337,31*79
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,31*48
-$GPRMC,222654.000,A,2734.78231,S,15306.02789,E,0.1,145.6,030308,11.2,W,A*3A
-$GPVTG,145.6,T,156.8,M,0.1,N,0.2,K,A*2C
-$GPGGA,222655.000,2734.78251,S,15306.02806,E,1,04,3.5,45.8,M,39.2,M,,*70
-$GPGLL,2734.78251,S,15306.02806,E,222655.000,A,A*46
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222655.000,12.0,28.1,14.0,78.7,25.3,13.6,52.5*54
-$GPGSV,3,1,11,16,48,116,40,25,40,267,,23,58,174,38,20,71,337,35*72
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,36*4F
-$GPRMC,222655.000,A,2734.78251,S,15306.02806,E,0.7,135.5,030308,11.2,W,A*37
-$GPVTG,135.5,T,146.8,M,0.7,N,1.2,K,A*2E
-$GPGGA,222656.000,2734.78273,S,15306.02823,E,1,04,3.5,45.7,M,39.2,M,,*7B
-$GPGLL,2734.78273,S,15306.02823,E,222656.000,A,A*42
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222656.000,9.9,24.8,12.2,76.6,22.2,12.0,44.0*69
-$GPGSV,3,1,11,16,48,116,38,25,40,267,,23,58,174,36,20,71,337,30*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,35*4C
-$GPRMC,222656.000,A,2734.78273,S,15306.02823,E,0.5,135.5,030308,11.2,W,A*31
-$GPVTG,135.5,T,146.7,M,0.5,N,1.0,K,A*21
-$GPGGA,222657.000,2734.78312,S,15306.02858,E,1,04,3.5,45.5,M,39.2,M,,*72
-$GPGLL,2734.78312,S,15306.02858,E,222657.000,A,A*49
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222657.000,8.4,22.4,10.9,74.9,19.9,11.0,38.1*60
-$GPGSV,3,1,11,16,48,116,37,25,40,267,,23,58,174,36,20,71,337,30*79
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,21,08,00,298,,03,14,056,34*4D
-$GPRMC,222657.000,A,2734.78312,S,15306.02858,E,1.3,137.6,030308,11.2,W,A*3C
-$GPVTG,137.6,T,148.8,M,1.3,N,2.4,K,A*21
-$GPGGA,222658.000,2734.78370,S,15306.02910,E,1,04,3.5,45.4,M,39.2,M,,*75
-$GPGLL,2734.78370,S,15306.02910,E,222658.000,A,A*4F
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222658.000,11.5,25.4,19.7,45.8,20.9,20.7,46.1*53
-$GPGSV,3,1,11,16,48,116,34,25,40,267,18,23,58,174,36,20,71,337,32*71
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,32*48
-$GPRMC,222658.000,A,2734.78370,S,15306.02910,E,2.7,141.8,030308,11.2,W,A*32
-$GPVTG,141.8,T,153.0,M,2.7,N,5.0,K,A*28
-$GPGGA,222659.000,2734.78463,S,15306.02956,E,1,04,3.5,45.4,M,39.2,M,,*73
-$GPGLL,2734.78463,S,15306.02956,E,222659.000,A,A*49
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222659.000,10.9,34.8,17.8,79.2,31.4,17.1,52.2*5E
-$GPGSV,3,1,11,16,48,116,32,25,40,267,18,23,58,174,37,20,71,337,32*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,26*4D
-$GPRMC,222659.000,A,2734.78463,S,15306.02956,E,3.6,157.2,030308,11.2,W,A*39
-$GPVTG,157.2,T,168.4,M,3.6,N,6.7,K,A*2D
-$GPGGA,222700.000,2734.78553,S,15306.02974,E,1,04,3.5,45.3,M,39.2,M,,*7B
-$GPGLL,2734.78553,S,15306.02974,E,222700.000,A,A*46
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222700.000,13.4,30.5,15.4,80.9,27.6,14.6,58.2*5C
-$GPGSV,3,1,11,16,48,116,38,25,40,267,18,23,58,174,42,20,71,337,34*78
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,30*4A
-$GPRMC,222700.000,A,2734.78553,S,15306.02974,E,3.1,171.1,030308,11.2,W,A*36
-$GPVTG,171.1,T,182.3,M,3.1,N,5.7,K,A*2D
-$GPGGA,222701.000,2734.78678,S,15306.02887,E,1,05,1.6,45.4,M,39.2,M,,*7A
-$GPGLL,2734.78678,S,15306.02887,E,222701.000,A,A*40
-$GPGSA,A,3,16,23,20,13,03,,,,,,,,2.5,1.6,1.9*3F
-$GPGST,222701.000,18.6,22.3,33.4,25.2,29.0,22.6,46.2*53
-$GPGSV,3,1,11,16,48,116,30,25,40,267,18,23,58,174,33,20,71,337,27*74
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,20,27,20,283,*71
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,27*4C
-$GPRMC,222701.000,A,2734.78678,S,15306.02887,E,5.1,212.6,030308,11.2,W,A*37
-$GPVTG,212.6,T,223.8,M,5.1,N,9.5,K,A*27
-$GPGGA,222702.000,2734.78726,S,15306.02769,E,1,04,3.5,45.3,M,39.2,M,,*7B
-$GPGLL,2734.78726,S,15306.02769,E,222702.000,A,A*46
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.0*31
-$GPGST,222702.000,14.7,49.5,20.8,84.3,45.1,19.5,72.8*5F
-$GPGSV,3,1,11,16,48,116,36,25,40,267,18,23,58,174,40,20,71,337,31*71
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,20,27,20,283,*71
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,28*43
-$GPRMC,222702.000,A,2734.78726,S,15306.02769,E,4.2,246.4,030308,11.2,W,A*30
-$GPVTG,246.4,T,257.6,M,4.2,N,7.7,K,A*27
-$GPGGA,222703.000,2734.78745,S,15306.02617,E,1,05,1.6,45.3,M,39.2,M,,*77
-$GPGLL,2734.78745,S,15306.02617,E,222703.000,A,A*4A
-$GPGSA,A,3,16,23,20,13,03,,,,,,,,2.5,1.6,1.9*3F
-$GPGST,222703.000,12.3,16.0,23.0,21.5,20.3,15.6,33.1*53
-$GPGSV,3,1,11,16,48,116,31,25,40,267,18,23,58,174,29,20,70,337,23*7B
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,22,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,27*4C
-$GPRMC,222703.000,A,2734.78745,S,15306.02617,E,4.9,265.5,030308,11.2,W,A*37
-$GPVTG,265.5,T,276.7,M,4.9,N,9.1,K,A*26
-$GPGGA,222704.000,2734.78730,S,15306.02555,E,1,04,3.5,45.3,M,39.2,M,,*77
-$GPGLL,2734.78730,S,15306.02555,E,222704.000,A,A*4A
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.1*30
-$GPGST,222704.000,9.5,34.0,22.1,80.5,30.8,20.6,55.7*69
-$GPGSV,3,1,11,16,48,116,31,25,40,267,18,23,58,174,29,20,70,337,23*7B
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,22,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,31*4B
-$GPRMC,222704.000,A,2734.78730,S,15306.02555,E,2.1,286.5,030308,11.2,W,A*34
-$GPVTG,286.5,T,297.7,M,2.1,N,3.9,K,A*28
-$GPGGA,222705.000,2734.78698,S,15306.02452,E,1,04,3.5,45.3,M,39.2,M,,*73
-$GPGLL,2734.78698,S,15306.02452,E,222705.000,A,A*4E
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.1*30
-$GPGST,222705.000,93.8,65.1,31.9,84.0,59.3,29.7,94.1*5F
-$GPGSV,3,1,11,16,48,116,29,25,40,267,18,23,58,174,29,20,70,337,23*72
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,22,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,30*4A
-$GPRMC,222705.000,A,2734.78698,S,15306.02452,E,3.6,290.3,030308,11.2,W,A*37
-$GPVTG,290.3,T,301.5,M,3.6,N,6.8,K,A*27
-$GPGGA,222706.000,2734.78686,S,15306.02339,E,1,04,3.5,45.3,M,39.2,M,,*75
-$GPGLL,2734.78686,S,15306.02339,E,222706.000,A,A*48
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.1*30
-$GPGST,222706.000,114.3,62.0,48.3,70.3,55.4,45.7,116.3*5B
-$GPGSV,3,1,11,16,48,116,24,25,40,267,18,23,58,174,29,20,70,337,23*7F
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,22,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222706.000,A,2734.78686,S,15306.02339,E,3.4,277.7,030308,11.2,W,A*3E
-$GPVTG,277.7,T,288.9,M,3.4,N,6.3,K,A*2F
-$GPGGA,222707.000,2734.78679,S,15306.02251,E,1,04,3.5,45.3,M,39.2,M,,*7B
-$GPGLL,2734.78679,S,15306.02251,E,222707.000,A,A*46
-$GPGSA,A,3,16,23,20,03,,,,,,,,,6.1,3.5,5.1*30
-$GPGST,222707.000,128.0,90.0,67.0,53.0,75.4,69.6,158.6*55
-$GPGSV,3,1,11,16,48,116,24,25,40,267,18,23,58,174,29,20,70,337,23*7F
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,223,22,27,20,283,*73
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222707.000,A,2734.78679,S,15306.02251,E,,,030308,,,A*79
-$GPVTG,,T,,M,,N,,K,N*2C
-$GPGGA,222708.000,2734.78673,S,15306.02181,E,1,05,1.6,45.3,M,39.2,M,,*70
-$GPGLL,2734.78673,S,15306.02181,E,222708.000,A,A*4D
-$GPGSA,A,3,16,23,20,13,03,,,,,,,,2.5,1.6,1.9*3F
-$GPGST,222708.000,66.8,93.0,70.5,62.6,69.3,81.1,141.7*6F
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,174,29,20,70,337,23*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,222,22,27,20,283,*72
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222708.000,A,2734.78673,S,15306.02181,E,,,030308,,,A*72
-$GPVTG,,T,,M,,N,,K,N*2C
-$GPGGA,222709.000,2734.78668,S,15306.02124,E,1,05,1.6,45.3,M,39.2,M,,*74
-$GPGLL,2734.78668,S,15306.02124,E,222709.000,A,A*49
-$GPGSA,A,2,16,23,20,13,03,,,,,,,,1.8,1.6,0.9*31
-$GPGST,222709.000,89.5,61.2,117.7,37.9,91.7,79.5,4.3*54
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,174,29,20,70,337,23*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,222,22,27,20,283,*72
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222709.000,A,2734.78668,S,15306.02124,E,,,030308,,,A*76
-$GPVTG,,T,,M,,N,,K,N*2C
-$GPGGA,222710.000,2734.78664,S,15306.02080,E,1,05,1.6,45.3,M,39.2,M,,*7F
-$GPGLL,2734.78664,S,15306.02080,E,222710.000,A,A*42
-$GPGSA,A,2,16,23,20,13,03,,,,,,,,1.8,1.6,0.9*31
-$GPGST,222710.000,117.0,82.3,157.6,39.0,121.7,107.9,3.9*62
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,174,29,20,70,337,23*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,222,22,27,20,283,*72
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222710.000,A,2734.78664,S,15306.02080,E,,,030308,,,A*7D
-$GPVTG,,T,,M,,N,,K,N*2C
-$GPGGA,222711.000,2734.78660,S,15306.02044,E,1,05,1.6,45.3,M,39.2,M,,*72
-$GPGLL,2734.78660,S,15306.02044,E,222711.000,A,A*4F
-$GPGSA,A,2,16,23,20,13,03,,,,,,,,1.8,1.6,0.9*31
-$GPGST,222711.000,128.0,107.6,205.2,40.2,156.7,142.6,3.5*58
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,174,29,20,70,337,23*76
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,222,22,27,20,283,*72
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222711.000,A,2734.78660,S,15306.02044,E,,,030308,,,A*70
-$GPVTG,,T,,M,,N,,K,N*2C
-$GPGGA,222712.000,2734.78658,S,15306.02015,E,1,05,1.6,45.3,M,39.2,M,,*7E
-$GPGLL,2734.78658,S,15306.02015,E,222712.000,A,A*43
-$GPGSA,A,2,16,23,20,13,03,,,,,,,,1.8,1.6,0.9*31
-$GPGST,222712.000,128.0,137.2,261.1,41.4,197.4,183.9,3.2*51
-$GPGSV,3,1,11,16,48,116,24,25,40,267,,23,58,173,29,20,70,337,23*71
-$GPGSV,3,2,11,19,03,029,,04,06,242,,13,31,222,22,27,20,283,*72
-$GPGSV,3,3,11,11,06,338,,08,00,298,,03,14,056,24*4F
-$GPRMC,222712.000,A,2734.78658,S,15306.02015,E,,,030308,,,A*7C \ No newline at end of file
diff --git a/examples/positioning/geoflickr/geoflickr.pro b/examples/positioning/geoflickr/geoflickr.pro
deleted file mode 100644
index 0bbfecd8..00000000
--- a/examples/positioning/geoflickr/geoflickr.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TEMPLATE = app
-TARGET = geoflickr
-
-QT += qml quick network positioning xmlpatterns
-SOURCES += qmllocationflickr.cpp
-
-RESOURCES += \
- flickr.qrc
-
-OTHER_FILES += flickr.qml \
- flickrcommon/* \
- flickrmobile/*
-
-target.path = $$[QT_INSTALL_EXAMPLES]/positioning/geoflickr
-INSTALLS += target
diff --git a/examples/positioning/geoflickr/geoflickr.qmlproject b/examples/positioning/geoflickr/geoflickr.qmlproject
deleted file mode 100644
index d4909f86..00000000
--- a/examples/positioning/geoflickr/geoflickr.qmlproject
+++ /dev/null
@@ -1,16 +0,0 @@
-import QmlProject 1.0
-
-Project {
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
- /* List of plugin directories passed to QML runtime */
- // importPaths: [ " ../exampleplugin " ]
-}
diff --git a/examples/positioning/geoflickr/qmllocationflickr.cpp b/examples/positioning/geoflickr/qmllocationflickr.cpp
deleted file mode 100644
index 61176cb1..00000000
--- a/examples/positioning/geoflickr/qmllocationflickr.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 <QGuiApplication>
-#include <QtQuick/QQuickView>
-#include <QtQml/QQmlEngine>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication application(argc, argv);
- const QString mainQmlApp = QStringLiteral("qrc:///flickr.qml");
- QQuickView view;
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QQuickView::SizeRootObjectToView);
- // Qt.quit() called in embedded .qml by default only emits
- // quit() signal, so do this (optionally use Qt.exit()).
- QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
- view.setGeometry(QRect(100, 100, 360, 640));
- view.show();
- return application.exec();
-}
diff --git a/examples/positioning/logfilepositionsource/CMakeLists.txt b/examples/positioning/logfilepositionsource/CMakeLists.txt
deleted file mode 100644
index b9064aea..00000000
--- a/examples/positioning/logfilepositionsource/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated from logfilepositionsource.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(logfilepositionsource LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/positioning/logfilepositionsource")
-
-find_package(Qt6 COMPONENTS Positioning)
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(logfilepositionsource
- clientapplication.cpp clientapplication.h
- logfilepositionsource.cpp logfilepositionsource.h
- main.cpp
-)
-set_target_properties(logfilepositionsource PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(logfilepositionsource PRIVATE
- Qt::Core
- Qt::Positioning
- Qt::Widgets
-)
-
-
-# Resources:
-set(logfile_resource_files
- "simplelog.txt"
-)
-
-qt6_add_resources(logfilepositionsource "logfile"
- PREFIX
- "/"
- FILES
- ${logfile_resource_files}
-)
-
-install(TARGETS logfilepositionsource
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/positioning/logfilepositionsource/clientapplication.cpp b/examples/positioning/logfilepositionsource/clientapplication.cpp
deleted file mode 100644
index 1dca07af..00000000
--- a/examples/positioning/logfilepositionsource/clientapplication.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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>
-#include <QTextEdit>
-
-#include "logfilepositionsource.h"
-#include "clientapplication.h"
-
-ClientApplication::ClientApplication(QWidget *parent)
- : QMainWindow(parent)
-{
- textEdit = new QTextEdit;
- setCentralWidget(textEdit);
-
- LogFilePositionSource *source = new LogFilePositionSource(this);
- connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
-
- source->startUpdates();
-}
-
-void ClientApplication::positionUpdated(const QGeoPositionInfo &info)
-{
- textEdit->append(QString("Position updated: Date/time = %1, Coordinate = %2").arg(info.timestamp().toString()).arg(info.coordinate().toString()));
-}
diff --git a/examples/positioning/logfilepositionsource/clientapplication.h b/examples/positioning/logfilepositionsource/clientapplication.h
deleted file mode 100644
index 4ffd5486..00000000
--- a/examples/positioning/logfilepositionsource/clientapplication.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-#ifndef CLIENTAPPLICATION_H
-#define CLIENTAPPLICATION_H
-
-#include <QMainWindow>
-
-QT_BEGIN_NAMESPACE
-class QGeoPositionInfo;
-class QTextEdit;
-QT_END_NAMESPACE
-
-class ClientApplication : public QMainWindow
-{
- Q_OBJECT
-public:
- ClientApplication(QWidget *parent = 0);
-
-private slots:
- void positionUpdated(const QGeoPositionInfo &info);
-
-private:
- QTextEdit *textEdit;
-};
-
-
-#endif
diff --git a/examples/positioning/logfilepositionsource/doc/src/logfilepositionsource.qdoc b/examples/positioning/logfilepositionsource/doc/src/logfilepositionsource.qdoc
deleted file mode 100644
index 53eb274a..00000000
--- a/examples/positioning/logfilepositionsource/doc/src/logfilepositionsource.qdoc
+++ /dev/null
@@ -1,94 +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$
-**
-****************************************************************************/
-
-/*!
-\example logfilepositionsource
-\title Log File Position Source (C++)
-\ingroup qtpositioning-examples
-
-\brief Logfile Position Source shows how to create and work with a custom
- position source. It can be useful for simulating GPS data, or when the
- data is received in some custom format.
-
-\include examples-run.qdocinc
-
-\section1 Creating custom Position Source
-
-In this example, the data is read from a text file, \e simplelog.txt. The file
-specifies position data using a simple text format: it contains one position
-update per line, where each line contains a date/time, a latitude and a
-longitude, separated by spaces. The date/time is in ISO 8601 format and the
-latitude and longitude are in degrees decimal format.
-Here is an excerpt from \e simplelog.txt:
-
-\code
-2009-08-24T22:25:01 -27.576082 153.092415
-2009-08-24T22:25:02 -27.576223 153.092530
-2009-08-24T22:25:03 -27.576364 153.092648
-\endcode
-
-We create a custom \c LogFilePositionSource class, which derives from
-\l QGeoPositionInfoSource. It reads position data from the file and distributes
-it via the \l {QGeoPositionInfoSource::}{positionUpdated()} signal.
-
-The resulting time and position information is then displayed on the screen as
-simple text in date/time and latitude/longitude format.
-
-Here is the definition of the \c LogFilePositionSource class:
-
-\quotefromfile logfilepositionsource/logfilepositionsource.h
-\skipto class LogFilePositionSource
-\printuntil };
-
-The main methods overrided by the subclass are:
-
-\list
- \li \l{QGeoPositionInfoSource::startUpdates()}{startUpdates()}: called by client applications
- to start regular position updates.
- \li \l{QGeoPositionInfoSource::stopUpdates()}{stopUpdates()}: called by client applications to
- stop regular position updates.
- \li \l{QGeoPositionInfoSource::requestUpdate()}{requestUpdate()}: called by client applications
- to request a single update, with a specified timeout.
-\endlist
-
-When a position update is available, the subclass emits the
-\l{QGeoPositionInfoSource::positionUpdated()}{positionUpdated()} signal.
-
-Here are the key methods in the class implementation:
-
-\quotefromfile logfilepositionsource/logfilepositionsource.cpp
-\skipto LogFilePositionSource::LogFilePositionSource
-\printuntil /^\}/
-\skipto LogFilePositionSource::startUpdates
-\printuntil /^\}/
-\skipto LogFilePositionSource::stopUpdates
-\printuntil /^\}/
-\skipto LogFilePositionSource::requestUpdate
-\printuntil /^\}/
-\printuntil LogFilePositionSource::readNextPosition
-\printuntil /^\}/
-*/
diff --git a/examples/positioning/logfilepositionsource/logfile.qrc b/examples/positioning/logfilepositionsource/logfile.qrc
deleted file mode 100644
index 61213949..00000000
--- a/examples/positioning/logfilepositionsource/logfile.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>simplelog.txt</file>
- </qresource>
-</RCC>
diff --git a/examples/positioning/logfilepositionsource/logfilepositionsource.cpp b/examples/positioning/logfilepositionsource/logfilepositionsource.cpp
deleted file mode 100644
index 31bb0cc3..00000000
--- a/examples/positioning/logfilepositionsource/logfilepositionsource.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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>
-
-#include "logfilepositionsource.h"
-
-LogFilePositionSource::LogFilePositionSource(QObject *parent)
- : QGeoPositionInfoSource(parent),
- logFile(new QFile(this)),
- timer(new QTimer(this))
-{
- connect(timer, SIGNAL(timeout()), this, SLOT(readNextPosition()));
-
- logFile->setFileName(":/simplelog.txt");
- if (!logFile->open(QIODevice::ReadOnly))
- qWarning() << "Error: cannot open source file" << logFile->fileName();
-}
-
-QGeoPositionInfo LogFilePositionSource::lastKnownPosition(bool /*fromSatellitePositioningMethodsOnly*/) const
-{
- return lastPosition;
-}
-
-LogFilePositionSource::PositioningMethods LogFilePositionSource::supportedPositioningMethods() const
-{
- return AllPositioningMethods;
-}
-
-int LogFilePositionSource::minimumUpdateInterval() const
-{
- return 500;
-}
-
-void LogFilePositionSource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
- int interval = updateInterval();
- if (interval < minimumUpdateInterval())
- interval = minimumUpdateInterval();
-
- timer->start(interval);
-}
-
-void LogFilePositionSource::stopUpdates()
-{
- timer->stop();
-}
-
-void LogFilePositionSource::requestUpdate(int /*timeout*/)
-{
- // For simplicity, ignore timeout - assume that if data is not available
- // now, no data will be added to the file later
- lastError = QGeoPositionInfoSource::NoError;
- if (logFile->canReadLine()) {
- readNextPosition();
- } else {
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(lastError);
- }
-}
-
-void LogFilePositionSource::readNextPosition()
-{
- QByteArray line = logFile->readLine().trimmed();
- if (!line.isEmpty()) {
- QList<QByteArray> data = line.split(' ');
- double latitude;
- double longitude;
- bool hasLatitude = false;
- bool hasLongitude = false;
- QDateTime timestamp = QDateTime::fromString(QString(data.value(0)), Qt::ISODate);
- latitude = data.value(1).toDouble(&hasLatitude);
- longitude = data.value(2).toDouble(&hasLongitude);
-
- if (hasLatitude && hasLongitude && timestamp.isValid()) {
- QGeoCoordinate coordinate(latitude, longitude);
- QGeoPositionInfo info(coordinate, timestamp);
- if (info.isValid()) {
- lastPosition = info;
- emit positionUpdated(info);
- }
- }
- }
-}
-
-QGeoPositionInfoSource::Error LogFilePositionSource::error() const
-{
- return lastError;
-}
diff --git a/examples/positioning/logfilepositionsource/logfilepositionsource.h b/examples/positioning/logfilepositionsource/logfilepositionsource.h
deleted file mode 100644
index aca72ab2..00000000
--- a/examples/positioning/logfilepositionsource/logfilepositionsource.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-#ifndef LOGFILEPOSITIONSOURCE_H
-#define LOGFILEPOSITIONSOURCE_H
-
-#include <QtPositioning/qgeopositioninfosource.h>
-
-QT_BEGIN_NAMESPACE
-class QFile;
-class QTimer;
-QT_END_NAMESPACE
-
-class LogFilePositionSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- LogFilePositionSource(QObject *parent = 0);
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
-
- PositioningMethods supportedPositioningMethods() const override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-public slots:
- virtual void startUpdates() override;
- virtual void stopUpdates() override;
-
- virtual void requestUpdate(int timeout = 5000) override;
-
-private slots:
- void readNextPosition();
-
-private:
- QFile *logFile;
- QTimer *timer;
- QGeoPositionInfo lastPosition;
- Error lastError = QGeoPositionInfoSource::NoError;
-};
-
-#endif
diff --git a/examples/positioning/logfilepositionsource/logfilepositionsource.pro b/examples/positioning/logfilepositionsource/logfilepositionsource.pro
deleted file mode 100644
index cb9e30ae..00000000
--- a/examples/positioning/logfilepositionsource/logfilepositionsource.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TEMPLATE = app
-TARGET = logfilepositionsource
-QT = positioning core widgets
-
-
-HEADERS = logfilepositionsource.h \
- clientapplication.h
-SOURCES = logfilepositionsource.cpp \
- clientapplication.cpp \
- main.cpp
-
-RESOURCES += \
- logfile.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/positioning/logfilepositionsource
-INSTALLS += target
diff --git a/examples/positioning/logfilepositionsource/main.cpp b/examples/positioning/logfilepositionsource/main.cpp
deleted file mode 100644
index dcc05a1a..00000000
--- a/examples/positioning/logfilepositionsource/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 <QApplication>
-
-#include "clientapplication.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- ClientApplication client;
- client.show();
-
- return app.exec();
-}
diff --git a/examples/positioning/logfilepositionsource/simplelog.txt b/examples/positioning/logfilepositionsource/simplelog.txt
deleted file mode 100644
index d016b2a8..00000000
--- a/examples/positioning/logfilepositionsource/simplelog.txt
+++ /dev/null
@@ -1,156 +0,0 @@
-2009-08-24T22:24:37 -27.572321 153.090718
-2009-08-24T22:24:38 -27.572470 153.090783
-2009-08-24T22:24:39 -27.572616 153.090845
-2009-08-24T22:24:40 -27.572763 153.090908
-2009-08-24T22:24:41 -27.572914 153.090971
-2009-08-24T22:24:42 -27.573068 153.091036
-2009-08-24T22:24:43 -27.573224 153.091102
-2009-08-24T22:24:44 -27.573383 153.091167
-2009-08-24T22:24:45 -27.573541 153.091232
-2009-08-24T22:24:46 -27.573700 153.091298
-2009-08-24T22:24:47 -27.573860 153.091366
-2009-08-24T22:24:48 -27.574019 153.091435
-2009-08-24T22:24:49 -27.574178 153.091507
-2009-08-24T22:24:50 -27.574340 153.091581
-2009-08-24T22:24:51 -27.574506 153.091654
-2009-08-24T22:24:52 -27.574670 153.091729
-2009-08-24T22:24:53 -27.574836 153.091800
-2009-08-24T22:24:54 -27.575001 153.091870
-2009-08-24T22:24:55 -27.575165 153.091940
-2009-08-24T22:24:56 -27.575327 153.092010
-2009-08-24T22:24:57 -27.575485 153.092078
-2009-08-24T22:24:58 -27.575641 153.092144
-2009-08-24T22:24:59 -27.575795 153.092218
-2009-08-24T22:25:00 -27.575942 153.092308
-2009-08-24T22:25:01 -27.576082 153.092415
-2009-08-24T22:25:02 -27.576223 153.092530
-2009-08-24T22:25:03 -27.576364 153.092648
-2009-08-24T22:25:04 -27.576505 153.092763
-2009-08-24T22:25:05 -27.576646 153.092879
-2009-08-24T22:25:06 -27.576784 153.092990
-2009-08-24T22:25:07 -27.576918 153.093099
-2009-08-24T22:25:08 -27.577046 153.093204
-2009-08-24T22:25:09 -27.577168 153.093303
-2009-08-24T22:25:10 -27.577284 153.093396
-2009-08-24T22:25:11 -27.577396 153.093484
-2009-08-24T22:25:12 -27.577499 153.093568
-2009-08-24T22:25:13 -27.577595 153.093647
-2009-08-24T22:25:14 -27.577692 153.093727
-2009-08-24T22:25:15 -27.577793 153.093810
-2009-08-24T22:25:16 -27.577897 153.093896
-2009-08-24T22:25:17 -27.578006 153.093984
-2009-08-24T22:25:18 -27.578120 153.094074
-2009-08-24T22:25:19 -27.578237 153.094168
-2009-08-24T22:25:20 -27.578360 153.094267
-2009-08-24T22:25:21 -27.578487 153.094370
-2009-08-24T22:25:22 -27.578617 153.094474
-2009-08-24T22:25:23 -27.578748 153.094581
-2009-08-24T22:25:24 -27.578880 153.094688
-2009-08-24T22:25:25 -27.579014 153.094796
-2009-08-24T22:25:26 -27.579149 153.094905
-2009-08-24T22:25:27 -27.579285 153.095012
-2009-08-24T22:25:28 -27.579420 153.095121
-2009-08-24T22:25:29 -27.579552 153.095231
-2009-08-24T22:25:30 -27.579684 153.095340
-2009-08-24T22:25:31 -27.579820 153.095449
-2009-08-24T22:25:32 -27.579956 153.095558
-2009-08-24T22:25:33 -27.580095 153.095667
-2009-08-24T22:25:34 -27.580240 153.095776
-2009-08-24T22:25:35 -27.580392 153.095885
-2009-08-24T22:25:36 -27.580536 153.095995
-2009-08-24T22:25:37 -27.580679 153.096109
-2009-08-24T22:25:38 -27.580824 153.096226
-2009-08-24T22:25:39 -27.580965 153.096337
-2009-08-24T22:25:40 -27.581101 153.096441
-2009-08-24T22:25:41 -27.581237 153.096537
-2009-08-24T22:25:42 -27.581356 153.096628
-2009-08-24T22:25:43 -27.581466 153.096714
-2009-08-24T22:25:44 -27.581555 153.096795
-2009-08-24T22:25:45 -27.581606 153.096847
-2009-08-24T22:25:46 -27.581539 153.096855
-2009-08-24T22:25:47 -27.581572 153.096873
-2009-08-24T22:25:48 -27.581579 153.096875
-2009-08-24T22:25:49 -27.581582 153.096878
-2009-08-24T22:25:50 -27.581588 153.096880
-2009-08-24T22:25:51 -27.581588 153.096880
-2009-08-24T22:25:52 -27.581592 153.096881
-2009-08-24T22:25:53 -27.581596 153.096882
-2009-08-24T22:25:54 -27.581599 153.096883
-2009-08-24T22:25:55 -27.581601 153.096883
-2009-08-24T22:25:56 -27.581602 153.096883
-2009-08-24T22:25:57 -27.581606 153.096890
-2009-08-24T22:25:58 -27.581606 153.096919
-2009-08-24T22:25:59 -27.581605 153.096985
-2009-08-24T22:26:00 -27.581573 153.097060
-2009-08-24T22:26:01 -27.581532 153.097142
-2009-08-24T22:26:02 -27.581484 153.097227
-2009-08-24T22:26:03 -27.581426 153.097324
-2009-08-24T22:26:04 -27.581373 153.097424
-2009-08-24T22:26:05 -27.581320 153.097530
-2009-08-24T22:26:06 -27.581265 153.097641
-2009-08-24T22:26:07 -27.581203 153.097757
-2009-08-24T22:26:08 -27.581144 153.097875
-2009-08-24T22:26:09 -27.581093 153.097995
-2009-08-24T22:26:10 -27.581042 153.098116
-2009-08-24T22:26:11 -27.580987 153.098231
-2009-08-24T22:26:12 -27.580919 153.098334
-2009-08-24T22:26:13 -27.580841 153.098428
-2009-08-24T22:26:14 -27.580754 153.098511
-2009-08-24T22:26:15 -27.580667 153.098591
-2009-08-24T22:26:16 -27.580581 153.098671
-2009-08-24T22:26:17 -27.580492 153.098751
-2009-08-24T22:26:18 -27.580401 153.098832
-2009-08-24T22:26:19 -27.580311 153.098914
-2009-08-24T22:26:20 -27.580224 153.098996
-2009-08-24T22:26:21 -27.580140 153.099078
-2009-08-24T22:26:22 -27.580059 153.099159
-2009-08-24T22:26:23 -27.579980 153.099245
-2009-08-24T22:26:24 -27.579900 153.099336
-2009-08-24T22:26:25 -27.579826 153.099433
-2009-08-24T22:26:26 -27.579753 153.099529
-2009-08-24T22:26:27 -27.579680 153.099623
-2009-08-24T22:26:28 -27.579606 153.099716
-2009-08-24T22:26:29 -27.579538 153.099808
-2009-08-24T22:26:30 -27.579477 153.099893
-2009-08-24T22:26:31 -27.579416 153.099968
-2009-08-24T22:26:32 -27.579393 153.100027
-2009-08-24T22:26:33 -27.579376 153.100092
-2009-08-24T22:26:34 -27.579384 153.100142
-2009-08-24T22:26:35 -27.579403 153.100181
-2009-08-24T22:26:36 -27.579429 153.100210
-2009-08-24T22:26:37 -27.579460 153.100237
-2009-08-24T22:26:38 -27.579493 153.100265
-2009-08-24T22:26:39 -27.579518 153.100291
-2009-08-24T22:26:40 -27.579536 153.100336
-2009-08-24T22:26:41 -27.579591 153.100358
-2009-08-24T22:26:42 -27.579618 153.100383
-2009-08-24T22:26:43 -27.579639 153.100404
-2009-08-24T22:26:44 -27.579650 153.100420
-2009-08-24T22:26:45 -27.579665 153.100432
-2009-08-24T22:26:46 -27.579679 153.100442
-2009-08-24T22:26:47 -27.579690 153.100451
-2009-08-24T22:26:48 -27.579697 153.100459
-2009-08-24T22:26:49 -27.579700 153.100462
-2009-08-24T22:26:50 -27.579699 153.100464
-2009-08-24T22:26:51 -27.579699 153.100466
-2009-08-24T22:26:52 -27.579700 153.100466
-2009-08-24T22:26:53 -27.579704 153.100466
-2009-08-24T22:26:54 -27.579705 153.100465
-2009-08-24T22:26:55 -27.579708 153.100468
-2009-08-24T22:26:56 -27.579712 153.100471
-2009-08-24T22:26:57 -27.579719 153.100476
-2009-08-24T22:26:58 -27.579728 153.100485
-2009-08-24T22:26:59 -27.579744 153.100493
-2009-08-24T22:27:00 -27.579759 153.100496
-2009-08-24T22:27:01 -27.579780 153.100481
-2009-08-24T22:27:02 -27.579788 153.100462
-2009-08-24T22:27:03 -27.579791 153.100436
-2009-08-24T22:27:04 -27.579788 153.100426
-2009-08-24T22:27:05 -27.579783 153.100409
-2009-08-24T22:27:06 -27.579781 153.100390
-2009-08-24T22:27:07 -27.579780 153.100375
-2009-08-24T22:27:08 -27.579779 153.100364
-2009-08-24T22:27:09 -27.579778 153.100354
-2009-08-24T22:27:10 -27.579777 153.100347
-2009-08-24T22:27:11 -27.579777 153.100341
-2009-08-24T22:27:12 -27.579776 153.100336
diff --git a/examples/positioning/positioning.pro b/examples/positioning/positioning.pro
deleted file mode 100644
index 50c328b3..00000000
--- a/examples/positioning/positioning.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = subdirs
-
-qtHaveModule(widgets): SUBDIRS += logfilepositionsource
-qtHaveModule(quick) {
- SUBDIRS += satelliteinfo
-
- qtHaveModule(xmlpatterns): SUBDIRS += geoflickr
- qtHaveModule(network): SUBDIRS += weatherinfo
-}
diff --git a/examples/positioning/satelliteinfo/CMakeLists.txt b/examples/positioning/satelliteinfo/CMakeLists.txt
deleted file mode 100644
index dd90a6e1..00000000
--- a/examples/positioning/satelliteinfo/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-# Generated from satelliteinfo.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(satelliteinfo LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/positioning/satelliteinfo")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Positioning)
-
-qt_add_executable(satelliteinfo
- main.cpp
- satellitemodel.cpp satellitemodel.h
-)
-set_target_properties(satelliteinfo PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(satelliteinfo PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Positioning
- Qt::Quick
-)
-
-qt_add_qml_module(satelliteinfo
- URI Local
- VERSION 1.0
- QML_FILES satelliteinfo.qml
- NO_RESOURCE_TARGET_PATH
-)
-
-install(TARGETS satelliteinfo
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/positioning/satelliteinfo/doc/images/example-satelliteinfo.png b/examples/positioning/satelliteinfo/doc/images/example-satelliteinfo.png
deleted file mode 100644
index aa9a217c..00000000
--- a/examples/positioning/satelliteinfo/doc/images/example-satelliteinfo.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc b/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc
deleted file mode 100644
index fb314ea3..00000000
--- a/examples/positioning/satelliteinfo/doc/src/satelliteinfo.qdoc
+++ /dev/null
@@ -1,134 +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$
-**
-****************************************************************************/
-
-/*!
- \example satelliteinfo
- \title SatelliteInfo (C++/QML)
-
- \brief The SatelliteInfo example shows the available satellites
- at the user's current position and marks the satellites
- currently contributing to the GPS fix as pink.
-
- \ingroup qtpositioning-examples
-
- Key \l{Qt Positioning} classes used in this example:
-
- \list
- \li \l{QGeoSatelliteInfo}
- \li \l{QGeoSatelliteInfoSource}
- \endlist
-
- \image ../images/example-satelliteinfo.png
-
- The example displays the signal strength of all satellites in view. Any
- satellite that is currently used to calculate the GPS fix is marked pink.
- The number at the bottom of each signal bar is the individual satellite
- identifier.
-
- The application operates in three different modes:
-
- \table
- \header
- \li Application mode
- \li Description
- \row
- \li running
- \li The application continuously queries the system for satellite updates. When new data
- is available it will be displayed.
- \row
- \li stopped
- \li The application stops updating the satellite information.
- \row
- \li single
- \li The application makes a single update request with a timeout of 10s. The display
- remains empty until the request was answered by the system.
- \endtable
-
- If the platform does not provide satellite information, the application
- automatically switches into a demo mode, whereby it continuously switches
- between predefined sets of satellite data.
-
- \include examples-run.qdocinc
-
- \section1 Satellite Info Model
-
- The key part of this example is the \c SatelliteModel data model. It
- represents the information about the satellites.
- It uses the \l Q_PROPERTY and \l QML_ELEMENT macros, so that it can be
- available from QML.
-
- \snippet satelliteinfo/satellitemodel.h 0
- \snippet satelliteinfo/satellitemodel.h 1
- \snippet satelliteinfo/satellitemodel.h 2
-
- The \c SatelliteModel object creates an instance of
- \l QGeoSatelliteInfoSource using the \l {QGeoSatelliteInfoSource::}
- {createDefaultSource()} method. Once the source is created, the
- \l {QGeoSatelliteInfoSource::}{satellitesInViewUpdated()} and
- \l {QGeoSatelliteInfoSource::}{satellitesInUseUpdated()} signals are used
- to notify about the changes in satellite information.
-
- \snippet satelliteinfo/satellitemodel.cpp 0
-
- The aforementioned signals provide the lists of \l QGeoSatelliteInfo
- objects that represent satellites in view and satellites in use,
- respectively. This data is used to update the model.
-
- \snippet satelliteinfo/satellitemodel.cpp 1
-
- If the satellite info source is not available, demo data is used to simulate
- satellite information updates.
-
- \snippet satelliteinfo/satellitemodel.cpp 2
-
- The model is later used in QML to visualize the data.
-
- \section1 Exposing the Model to QML
-
- To expose \c SatelliteModel to QML, we use the \l QML_ELEMENT macro.
- See the \l QQmlEngine class documentation for more details on it.
-
- To make the type available in QML, we need to update our build accordingly.
-
- \section2 CMake Build
-
- For a CMake-based build, we need to add the following to the
- \c {CMakeLists.txt}:
-
- \quotefromfile satelliteinfo/CMakeLists.txt
- \skipto qt_add_qml_module(satelliteinfo
- \printuntil )
-
- \section2 qmake Build
-
- For a qmake build, we need to modify the \c {satelliteinfo.pro} file in the
- following way:
-
- \quotefromfile satelliteinfo/satelliteinfo.pro
- \skipto CONFIG
- \printuntil QML_IMPORT_MAJOR_VERSION
-*/
diff --git a/examples/positioning/satelliteinfo/main.cpp b/examples/positioning/satelliteinfo/main.cpp
deleted file mode 100644
index 4a96c4c9..00000000
--- a/examples/positioning/satelliteinfo/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 <QtGui/QGuiApplication>
-#include <QtQml/qqml.h>
-#include <QtQml/QQmlEngine>
-#include <QtQuick/QQuickView>
-#include "satellitemodel.h"
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- QQuickView view;
- view.setSource(QStringLiteral("qrc:///satelliteinfo.qml"));
- view.setResizeMode(QQuickView::SizeRootObjectToView);
-
- QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
- view.show();
-
- return app.exec();
-}
-
-
diff --git a/examples/positioning/satelliteinfo/satelliteinfo.pro b/examples/positioning/satelliteinfo/satelliteinfo.pro
deleted file mode 100644
index ebee0945..00000000
--- a/examples/positioning/satelliteinfo/satelliteinfo.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TEMPLATE = app
-TARGET = satelliteinfo
-
-QT += quick positioning
-
-CONFIG += qmltypes
-QML_IMPORT_NAME = Local
-QML_IMPORT_MAJOR_VERSION = 1
-
-SOURCES += main.cpp \
- satellitemodel.cpp
-
-HEADERS += \
- satellitemodel.h
-
-OTHER_FILES += \
- satelliteinfo.qml
-
-RESOURCES += \
- satelliteinfo.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/positioning/satelliteinfo
-INSTALLS += target
-
-
-
diff --git a/examples/positioning/satelliteinfo/satelliteinfo.qml b/examples/positioning/satelliteinfo/satelliteinfo.qml
deleted file mode 100644
index ef0c965e..00000000
--- a/examples/positioning/satelliteinfo/satelliteinfo.qml
+++ /dev/null
@@ -1,316 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-import Local 1.0
-
-Rectangle {
- id: page
- width: 360
- height: 360
-
- SatelliteModel {
- id: satelliteModel
- running: true
- onErrorFound: function(code) {
- errorLabel.text = qsTr("Last Error: %1", "%1=error number").arg(code)
- }
- }
-
- Item {
- id: header
- height: column.height + 30
- width: parent.width
- state: "running"
-
- anchors.top: parent.top
-
- function toggle()
- {
- switch (header.state) {
- case "single": header.state = "running"; break;
- default:
- case "running": header.state = "stopped"; break;
- case "stopped": header.state = "single"; break;
- }
- }
-
- function enterSingle()
- {
- satelliteModel.singleRequestMode = true;
- satelliteModel.running = true;
- }
-
- function enterRunning()
- {
- satelliteModel.running = false;
- satelliteModel.singleRequestMode = false;
- satelliteModel.running = true;
- }
-
- states: [
- State {
- name: "stopped"
- PropertyChanges { target: startStop; bText: qsTr("Single") }
- PropertyChanges {
- target: modeLabel; text: qsTr("Current Mode: stopped")
- }
- PropertyChanges { target: satelliteModel; running: false; }
- },
- State {
- name: "single"
- PropertyChanges { target: startStop; bText: qsTr("Start") }
- PropertyChanges {
- target: modeLabel; text: qsTr("Current Mode: single")
- }
- StateChangeScript { script: header.enterSingle(); }
- },
- State {
- name: "running"
- PropertyChanges { target: startStop; bText: qsTr("Stop") }
- PropertyChanges {
- target: modeLabel; text: qsTr("Current Mode: running")
- }
- StateChangeScript { script: header.enterRunning(); }
- }
- ]
-
- Column {
- id: column
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.margins: 7
- Text {
- id: overview
- text: satelliteModel.satelliteInfoAvailable
- ? qsTr("Known Satellites")
- : qsTr("Known Satellites (Demo Mode)")
- font.pointSize: 12
- }
-
- Text {
- id: modeLabel
- font.pointSize: 12
- }
-
- Text {
- id: errorLabel
- text: qsTr("Last Error: None")
- font.pointSize: 12
- }
- }
- Rectangle {
- id: startStop
- border.color: "black"
- border.width: 3
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: 7
- radius: 10
- height: maxField.height*1.4
- width: maxField.width*1.4
-
- property string bText: qsTr("Stop");
-
- Text { //need this for sizing
- id: maxField
- text: qsTr("Single")
- font.pointSize: 13
- opacity: 0
- }
-
- Text {
- id: buttonText
- anchors.centerIn: parent
- text: startStop.bText
- font.pointSize: 13
- }
-
- MouseArea {
- anchors.fill: parent
- onPressed: { startStop.color = "lightGray" }
- onClicked: { header.toggle() }
- onReleased: { startStop.color = "white" }
- }
- }
- }
-
- Rectangle {
- anchors.top: header.bottom
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.margins: rect.myMargin
- border.width: 3
- radius: 10
- border.color: "black"
-
- Item {
- id: rect
- anchors.fill: parent
- anchors.margins: myMargin
- property int myMargin: 7
-
- Row {
- id: view
- property int rows: repeater.model.entryCount
- property int singleWidth: ((rect.width - scale.width)/rows )-rect.myMargin
- spacing: rect.myMargin
-
- Rectangle {
- id: scale
- width: strengthLabel.width+10
- height: rect.height
- color: "#32cd32"
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: lawngreenRect.top
- font.pointSize: 11
- text: "50"
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.top: parent.top
- font.pointSize: 11
- text: "100"
- }
-
- Rectangle {
- id: redRect
- width: parent.width
- color: "red"
- height: parent.height*10/100
- anchors.bottom: parent.bottom
- Text {
- id: strengthLabel
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- font.pointSize: 11
- text: "00"
- }
- }
- Rectangle {
- id: orangeRect
- height: parent.height*10/100
- anchors.bottom: redRect.top
- width: parent.width
- color: "#ffa500"
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- font.pointSize: 11
- text: "10"
- }
- }
- Rectangle {
- id: goldRect
- height: parent.height*10/100
- anchors.bottom: orangeRect.top
- width: parent.width
- color: "#ffd700"
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- font.pointSize: 11
- text: "20"
- }
- }
- Rectangle {
- id: yellowRect
- height: parent.height*10/100
- anchors.bottom: goldRect.top
- width: parent.width
- color: "yellow"
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- font.pointSize: 11
- text: "30"
- }
- }
- Rectangle {
- id: lawngreenRect
- height: parent.height*10/100
- anchors.bottom: yellowRect.top
- width: parent.width
- color: "#7cFc00"
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- font.pointSize: 11
- text: "40"
- }
- }
- }
-
- Repeater {
- id: repeater
- model: satelliteModel
- delegate: Rectangle {
- height: rect.height
- width: view.singleWidth
- Rectangle {
- anchors.bottom: parent.bottom
- width: parent.width
- height: parent.height*signalStrength/100
- color: isInUse ? "#7FFF0000" : "#7F0000FF"
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- text: satelliteIdentifier
- }
- }
- }
- }
- }
- }
-}
-
diff --git a/examples/positioning/satelliteinfo/satelliteinfo.qrc b/examples/positioning/satelliteinfo/satelliteinfo.qrc
deleted file mode 100644
index 8745f87e..00000000
--- a/examples/positioning/satelliteinfo/satelliteinfo.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>satelliteinfo.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/positioning/satelliteinfo/satellitemodel.cpp b/examples/positioning/satelliteinfo/satellitemodel.cpp
deleted file mode 100644
index 77c89035..00000000
--- a/examples/positioning/satelliteinfo/satellitemodel.cpp
+++ /dev/null
@@ -1,324 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "satellitemodel.h"
-#include <QTimer>
-#include <QDebug>
-
-//! [0]
-SatelliteModel::SatelliteModel(QObject *parent) :
- QAbstractListModel(parent), source(0), m_componentCompleted(false), m_running(false),
- m_runningRequested(false), demo(false), isSingle(false), singleRequestServed(false)
-{
- source = QGeoSatelliteInfoSource::createDefaultSource(this);
- if (!demo && !source) {
- qWarning() << "No satellite data source found. Changing to demo mode.";
- demo = true;
- }
- if (!demo) {
- source->setUpdateInterval(3000);
- connect(source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)),
- this, SLOT(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- connect(source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)),
- this, SLOT(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- connect(source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)),
- this, SLOT(error(QGeoSatelliteInfoSource::Error)));
- }
-
- if (demo) {
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(updateDemoData()));
- timer->start(3000);
- }
-}
-//! [0]
-
-int SatelliteModel::rowCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- if (!source && !demo)
- return 0;
-
- return knownSatellites.count();
-}
-
-QVariant SatelliteModel::data(const QModelIndex &index, int role) const
-{
- if (!demo && !source)
- return QVariant();
-
- if (!index.isValid() || index.row() < 0)
- return QVariant();
-
- if (index.row() >= knownSatellites.count()) {
- qWarning() << "SatelliteModel: Index out of bound";
- return QVariant();
- }
-
- const QGeoSatelliteInfo &info = knownSatellites.at(index.row());
- switch (role) {
- case IdentifierRole:
- return info.satelliteIdentifier();
- case InUseRole:
- return satellitesInUse.contains(info.satelliteIdentifier());
- case SignalStrengthRole:
- return info.signalStrength();
- case ElevationRole:
- if (!info.hasAttribute(QGeoSatelliteInfo::Elevation))
- return QVariant();
- return info.attribute(QGeoSatelliteInfo::Elevation);
- case AzimuthRole:
- if (!info.hasAttribute(QGeoSatelliteInfo::Azimuth))
- return QVariant();
- return info.attribute(QGeoSatelliteInfo::Azimuth);
- default:
- break;
-
- }
-
- return QVariant();
-}
-
-QHash<int, QByteArray> SatelliteModel::roleNames() const
-{
- QHash<int, QByteArray> roleNames;
- roleNames.insert(IdentifierRole, "satelliteIdentifier");
- roleNames.insert(InUseRole, "isInUse");
- roleNames.insert(SignalStrengthRole, "signalStrength");
- roleNames.insert(ElevationRole, "elevation");
- roleNames.insert(AzimuthRole, "azimuth");
- return roleNames;
-}
-
-void SatelliteModel::componentComplete()
-{
- m_componentCompleted = true;
- if (m_runningRequested)
- setRunning(true);
-}
-
-bool SatelliteModel::running() const
-{
- return m_running;
-}
-
-bool SatelliteModel::isSingleRequest() const
-{
- return isSingle;
-}
-
-void SatelliteModel::setSingleRequest(bool single)
-{
- if (running()) {
- qWarning() << "Cannot change single request mode while running";
- return;
- }
-
- if (single != isSingle) { //flag changed
- isSingle = single;
- emit singleRequestChanged();
- }
-}
-
-void SatelliteModel::setRunning(bool isActive)
-{
- if (!source && !demo)
- return;
-
- if (!m_componentCompleted) {
- m_runningRequested = isActive;
- return;
- }
-
- if (m_running == isActive)
- return;
-
- m_running = isActive;
-
- if (m_running) {
- clearModel();
- if (demo)
- timer->start(2000);
- else if (isSingleRequest())
- source->requestUpdate(10000);
- else
- source->startUpdates();
-
- if (demo)
- singleRequestServed = false;
- } else {
- if (demo)
- timer->stop();
- else if (!isSingleRequest())
- source->stopUpdates();
- }
-
-
- Q_EMIT runningChanged();
-}
-
-int SatelliteModel::entryCount() const
-{
- return knownSatellites.count();
-}
-
-bool SatelliteModel::canProvideSatelliteInfo() const
-{
- return !demo;
-}
-
-void SatelliteModel::clearModel()
-{
- beginResetModel();
- knownSatelliteIds.clear();
- knownSatellites.clear();
- satellitesInUse.clear();
- endResetModel();
-}
-
-//! [2]
-void SatelliteModel::updateDemoData()
-{
- static bool flag = true;
- QList<QGeoSatelliteInfo> satellites;
- if (flag) {
- for (int i = 0; i<5; i++) {
- QGeoSatelliteInfo info;
- info.setSatelliteIdentifier(i);
- info.setSignalStrength(20 + 20*i);
- satellites.append(info);
- }
- } else {
- for (int i = 0; i<9; i++) {
- QGeoSatelliteInfo info;
- info.setSatelliteIdentifier(i*2);
- info.setSignalStrength(20 + 10*i);
- satellites.append(info);
- }
- }
-
-
- satellitesInViewUpdated(satellites);
- flag ? satellitesInUseUpdated(QList<QGeoSatelliteInfo>() << satellites.at(2))
- : satellitesInUseUpdated(QList<QGeoSatelliteInfo>() << satellites.at(3));
- flag = !flag;
-
- emit errorFound(flag);
-
- if (isSingleRequest() && !singleRequestServed) {
- singleRequestServed = true;
- setRunning(false);
- }
-}
-//! [2]
-
-void SatelliteModel::error(QGeoSatelliteInfoSource::Error error)
-{
- emit errorFound((int)error);
-}
-
-QT_BEGIN_NAMESPACE
-inline bool operator<(const QGeoSatelliteInfo& a, const QGeoSatelliteInfo& b)
-{
- return a.satelliteIdentifier() < b.satelliteIdentifier();
-}
-QT_END_NAMESPACE
-
-//! [1]
-void SatelliteModel::satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &infos)
-{
- if (!running())
- return;
-
- int oldEntryCount = knownSatellites.count();
-
-
- QSet<int> satelliteIdsInUpdate;
- foreach (const QGeoSatelliteInfo &info, infos)
- satelliteIdsInUpdate.insert(info.satelliteIdentifier());
-
- QSet<int> toBeRemoved = knownSatelliteIds - satelliteIdsInUpdate;
-
- //We reset the model as in reality just about all entry values change
- //and there are generally a lot of inserts and removals each time
- //Hence we don't bother with complex model update logic beyond resetModel()
- beginResetModel();
-
- knownSatellites = infos;
-
- //sort them for presentation purposes
- std::sort(knownSatellites.begin(), knownSatellites.end());
-
- //remove old "InUse" data
- //new satellites are by default not in "InUse"
- //existing satellites keep their "inUse" state
- satellitesInUse -= toBeRemoved;
-
- knownSatelliteIds = satelliteIdsInUpdate;
- endResetModel();
-
- if (oldEntryCount != knownSatellites.count())
- emit entryCountChanged();
-}
-
-void SatelliteModel::satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &infos)
-{
- if (!running())
- return;
-
- beginResetModel();
-
- satellitesInUse.clear();
- foreach (const QGeoSatelliteInfo &info, infos)
- satellitesInUse.insert(info.satelliteIdentifier());
-
- endResetModel();
-}
-//! [1]
diff --git a/examples/positioning/satelliteinfo/satellitemodel.h b/examples/positioning/satelliteinfo/satellitemodel.h
deleted file mode 100644
index 18d94a59..00000000
--- a/examples/positioning/satelliteinfo/satellitemodel.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-
-#ifndef SATELLITEMODEL_H
-#define SATELLITEMODEL_H
-
-#include <QAbstractListModel>
-#include <QSet>
-#include <QtQml/qqml.h>
-#include <QtQml/QQmlParserStatus>
-#include <QtPositioning/QGeoSatelliteInfoSource>
-
-QT_FORWARD_DECLARE_CLASS(QTimer)
-QT_FORWARD_DECLARE_CLASS(QGeoSatelliteInfoSource)
-
-//! [0]
-class SatelliteModel : public QAbstractListModel, public QQmlParserStatus
-{
- Q_OBJECT
- Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
- Q_PROPERTY(bool satelliteInfoAvailable READ canProvideSatelliteInfo NOTIFY canProvideSatelliteInfoChanged)
- Q_PROPERTY(int entryCount READ entryCount NOTIFY entryCountChanged)
- Q_PROPERTY(bool singleRequestMode READ isSingleRequest WRITE setSingleRequest NOTIFY singleRequestChanged)
- Q_INTERFACES(QQmlParserStatus)
- QML_ELEMENT
-public:
- explicit SatelliteModel(QObject *parent = 0);
-
- enum {
- IdentifierRole = Qt::UserRole + 1,
- InUseRole,
- SignalStrengthRole,
- ElevationRole,
- AzimuthRole
- };
-
- //From QAbstractListModel
- int rowCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role) const override;
- QHash<int, QByteArray> roleNames() const override;
-
- //From QQmlParserStatus
- void classBegin() override {}
- void componentComplete() override;
-//! [0]
-
- bool running() const;
- void setRunning(bool isActive);
-
- bool isSingleRequest() const;
- void setSingleRequest(bool single);
-
- int entryCount() const;
-
- bool canProvideSatelliteInfo() const;
-
-//! [1]
-signals:
- void runningChanged();
- void entryCountChanged();
- void errorFound(int code);
- void canProvideSatelliteInfoChanged();
- void singleRequestChanged();
-
-public slots:
- void clearModel();
- void updateDemoData();
-//! [1]
-
-private slots:
- void error(QGeoSatelliteInfoSource::Error);
- void satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &infos);
- void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &infos);
-
-private:
- QGeoSatelliteInfoSource *source;
- bool m_componentCompleted;
- bool m_running;
- bool m_runningRequested;
- QList <QGeoSatelliteInfo> knownSatellites;
- QSet<int> knownSatelliteIds;
- QSet<int> satellitesInUse;
- bool demo;
- QTimer *timer;
- bool isSingle;
- bool singleRequestServed;
-//! [2]
-};
-//! [2]
-
-QML_DECLARE_TYPE(SatelliteModel)
-
-#endif // SATELLITEMODEL_H
diff --git a/examples/positioning/weatherinfo/CMakeLists.txt b/examples/positioning/weatherinfo/CMakeLists.txt
deleted file mode 100644
index 63e13830..00000000
--- a/examples/positioning/weatherinfo/CMakeLists.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-# Generated from weatherinfo.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(weatherinfo LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/positioning/weatherinfo")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Positioning)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-
-qt_add_executable(weatherinfo
- appmodel.cpp appmodel.h
- providerbackend.cpp providerbackend.h
- openweathermapbackend.cpp openweathermapbackend.h
- weatherapibackend.cpp weatherapibackend.h
- main.cpp
-)
-set_target_properties(weatherinfo PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(weatherinfo PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Positioning
- Qt::Qml
- Qt::Quick
-)
-
-qt_add_qml_module(weatherinfo
- URI WeatherInfo
- VERSION 1.0
- QML_FILES
- components/BigForecastIcon.qml
- components/ForecastIcon.qml
- components/WeatherIcon.qml
- weatherinfo.qml
- RESOURCES
- icons/weather-few-clouds.png
- icons/weather-fog.png
- icons/weather-haze.png
- icons/weather-icy.png
- icons/weather-overcast.png
- icons/weather-showers.png
- icons/weather-sleet.png
- icons/weather-snow.png
- icons/weather-storm.png
- icons/weather-sunny-very-few-clouds.png
- icons/weather-sunny.png
- icons/weather-thundershower.png
- icons/weather-showers-scattered.png
- NO_RESOURCE_TARGET_PATH
-)
-
-install(TARGETS weatherinfo
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/positioning/weatherinfo/appmodel.cpp b/examples/positioning/weatherinfo/appmodel.cpp
deleted file mode 100644
index a5f207f1..00000000
--- a/examples/positioning/weatherinfo/appmodel.cpp
+++ /dev/null
@@ -1,514 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "appmodel.h"
-#include "openweathermapbackend.h"
-#include "weatherapibackend.h"
-
-#include <QGeoPositionInfoSource>
-#include <QGeoPositionInfo>
-#include <QGeoCircle>
-#include <QLoggingCategory>
-
-Q_LOGGING_CATEGORY(requestsLog, "wapp.requests")
-
-WeatherData::WeatherData(QObject *parent) :
- QObject(parent)
-{
-}
-
-WeatherData::WeatherData(const WeatherData &other) :
- QObject(nullptr),
- m_dayOfWeek(other.m_dayOfWeek),
- m_weather(other.m_weather),
- m_weatherDescription(other.m_weatherDescription),
- m_temperature(other.m_temperature)
-{
-}
-
-WeatherData::WeatherData(const WeatherInfo &other)
- : QObject(nullptr),
- m_dayOfWeek(other.m_dayOfWeek),
- m_weather(other.m_weatherIconId),
- m_weatherDescription(other.m_weatherDescription),
- m_temperature(other.m_temperature)
-{
-}
-
-QString WeatherData::dayOfWeek() const
-{
- return m_dayOfWeek;
-}
-
-/*!
- * The icon value is based on OpenWeatherMap.org icon set. For details
- * see http://bugs.openweathermap.org/projects/api/wiki/Weather_Condition_Codes
- *
- * e.g. 01d ->sunny day
- *
- * The icon string will be translated to
- * http://openweathermap.org/img/w/01d.png
- */
-QString WeatherData::weatherIcon() const
-{
- return m_weather;
-}
-
-QString WeatherData::weatherDescription() const
-{
- return m_weatherDescription;
-}
-
-QString WeatherData::temperature() const
-{
- return m_temperature;
-}
-
-void WeatherData::setDayOfWeek(const QString &value)
-{
- m_dayOfWeek = value;
- emit dataChanged();
-}
-
-void WeatherData::setWeatherIcon(const QString &value)
-{
- m_weather = value;
- emit dataChanged();
-}
-
-void WeatherData::setWeatherDescription(const QString &value)
-{
- m_weatherDescription = value;
- emit dataChanged();
-}
-
-void WeatherData::setTemperature(const QString &value)
-{
- m_temperature = value;
- emit dataChanged();
-}
-
-/*
- The class is used as a cache for the weather information.
- It contains a map to cache weather for cities.
- The gps location is cached separately.
-
- For the coordiante search we do not compare the coordinate directly, but
- check if it's within a circle of 3 km radius (we assume that the weather
- does not really change within that radius).
-
- The cache returns a pair with empty location and weather data if no data
- is found, or if the data is outdated.
-*/
-class WeatherDataCache
-{
-public:
- WeatherDataCache() = default;
-
- using WeatherDataPair = QPair<QString, QList<WeatherInfo>>;
-
- WeatherDataPair getWeatherData(const QString &name) const;
- WeatherDataPair getWeatherData(const QGeoCoordinate &coordinate) const;
-
- void addCacheElement(const LocationInfo &location, const QList<WeatherInfo> &info);
-
- static bool isCacheResultValid(const WeatherDataPair &result);
-
-private:
- struct CacheItem
- {
- qint64 m_cacheTime;
- QList<WeatherInfo> m_weatherData;
- };
-
- QMap<QString, CacheItem> m_cityCache;
-
- QGeoCoordinate m_gpsLocation;
- QString m_gpsName;
- CacheItem m_gpsData;
-
- static const qint64 kCacheTimeoutInterval = 3600; // 1 hour
- static const int kCircleRadius = 3000; // 3 km
-};
-
-WeatherDataCache::WeatherDataPair WeatherDataCache::getWeatherData(const QString &name) const
-{
- if (m_cityCache.contains(name)) {
- const qint64 currentTime = QDateTime::currentSecsSinceEpoch();
- const auto &item = m_cityCache.value(name);
- if (currentTime - item.m_cacheTime < kCacheTimeoutInterval)
- return qMakePair(name, item.m_weatherData);
- }
- return qMakePair(QString(), QList<WeatherInfo>());
-}
-
-WeatherDataCache::WeatherDataPair WeatherDataCache::getWeatherData(const QGeoCoordinate &coordinate) const
-{
- if (m_gpsLocation.isValid() && !m_gpsName.isEmpty()) {
- const QGeoCircle area(m_gpsLocation, kCircleRadius);
- if (area.contains(coordinate)) {
- const qint64 currentTime = QDateTime::currentSecsSinceEpoch();
- if (currentTime - m_gpsData.m_cacheTime < kCacheTimeoutInterval)
- return qMakePair(m_gpsName, m_gpsData.m_weatherData);
- }
- }
- return qMakePair(QString(), QList<WeatherInfo>());
-}
-
-void WeatherDataCache::addCacheElement(const LocationInfo &location, const QList<WeatherInfo> &info)
-{
- // It it expected that we have valid QGeoCoordinate only when the weather
- // is received based on coordinates.
- const qint64 currentTime = QDateTime::currentSecsSinceEpoch();
- if (location.m_coordinate.isValid()) {
- m_gpsLocation = location.m_coordinate;
- m_gpsName = location.m_name;
- m_gpsData = { currentTime, info };
- } else {
- m_cityCache[location.m_name] = { currentTime, info };
- }
-}
-
-bool WeatherDataCache::isCacheResultValid(const WeatherDataCache::WeatherDataPair &result)
-{
- return !result.first.isEmpty() && !result.second.isEmpty();
-}
-
-class AppModelPrivate
-{
-public:
- QGeoPositionInfoSource *src = nullptr;
- QGeoCoordinate coord;
- QString city;
- WeatherData now;
- QList<WeatherData*> forecast;
- QQmlListProperty<WeatherData> *fcProp = nullptr;
- bool ready = false;
- bool useGps = true;
- WeatherDataCache m_dataCache;
- ProviderBackend *m_currentBackend = nullptr;
- QList<ProviderBackend*> m_supportedBackends;
- qsizetype m_currentBackendIndex = 0;
-};
-
-static void forecastAppend(QQmlListProperty<WeatherData> *prop, WeatherData *val)
-{
- Q_UNUSED(val);
- Q_UNUSED(prop);
-}
-
-static WeatherData *forecastAt(QQmlListProperty<WeatherData> *prop, qsizetype index)
-{
- AppModelPrivate *d = static_cast<AppModelPrivate*>(prop->data);
- return d->forecast.at(index);
-}
-
-static qsizetype forecastCount(QQmlListProperty<WeatherData> *prop)
-{
- AppModelPrivate *d = static_cast<AppModelPrivate*>(prop->data);
- return d->forecast.size();
-}
-
-static void forecastClear(QQmlListProperty<WeatherData> *prop)
-{
- static_cast<AppModelPrivate*>(prop->data)->forecast.clear();
-}
-
-//! [0]
-AppModel::AppModel(QObject *parent) :
- QObject(parent),
- d(new AppModelPrivate)
-{
-//! [0]
- d->fcProp = new QQmlListProperty<WeatherData>(this, d, forecastAppend,
- forecastCount,
- forecastAt,
- forecastClear);
-
- d->m_supportedBackends.push_back(new OpenWeatherMapBackend(this));
- d->m_supportedBackends.push_back(new WeatherApiBackend(this));
- registerBackend(0);
-
-//! [1]
- d->src = QGeoPositionInfoSource::createDefaultSource(this);
-
- if (d->src) {
- d->useGps = true;
- connect(d->src, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
- connect(d->src, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(positionError(QGeoPositionInfoSource::Error)));
- d->src->startUpdates();
- } else {
- d->useGps = false;
- d->city = "Brisbane";
- emit cityChanged();
- requestWeatherByCity();
- }
-}
-//! [1]
-
-AppModel::~AppModel()
-{
- if (d->src)
- d->src->stopUpdates();
- if (d->fcProp)
- delete d->fcProp;
- foreach (WeatherData *inf, d->forecast)
- delete inf;
- d->forecast.clear();
- delete d;
-}
-
-//! [2]
-void AppModel::positionUpdated(QGeoPositionInfo gpsPos)
-{
- d->coord = gpsPos.coordinate();
-
- if (!d->useGps)
- return;
-
- requestWeatherByCoordinates();
-}
-//! [2]
-
-void AppModel::positionError(QGeoPositionInfoSource::Error e)
-{
- Q_UNUSED(e);
- qWarning() << "Position source error. Falling back to simulation mode.";
-
- // activate simulation mode
- if (d->useGps) {
- d->useGps = false;
- d->city = "Brisbane";
- emit cityChanged();
- requestWeatherByCity();
- }
-}
-
-void AppModel::refreshWeather()
-{
- if (d->city.isEmpty()) {
- qCDebug(requestsLog) << "refreshing weather skipped (no city)";
- return;
- }
- qCDebug(requestsLog) << "refreshing weather";
- requestWeatherByCity();
-}
-
-void AppModel::handleWeatherData(const LocationInfo &location,
- const QList<WeatherInfo> &weatherDetails)
-{
- if (applyWeatherData(location.m_name, weatherDetails))
- d->m_dataCache.addCacheElement(location, weatherDetails);
-}
-
-void AppModel::switchToNextBackend()
-{
- deregisterCurrentBackend();
- registerBackend(d->m_currentBackendIndex + 1);
- if (d->m_currentBackend) {
- // repeat the query
- if (d->useGps)
- requestWeatherByCoordinates();
- else
- requestWeatherByCity();
- } else {
- qWarning("The application has iterated through all of the weather backends, "
- "and none of them seems to respond now. Please wait until any of the "
- "backends becomes available again.");
- }
-}
-
-bool AppModel::applyWeatherData(const QString &city, const QList<WeatherInfo> &weatherDetails)
-{
- // Check that we didn't get outdated weather data. The city should match,
- // if only we do not use GPS.
- if (city != d->city && !d->useGps)
- return false;
-
- if (city != d->city && d->useGps) {
- d->city = city;
- emit cityChanged();
- }
-
- // delete previous forecast
- foreach (WeatherData *inf, d->forecast)
- delete inf;
- d->forecast.clear();
-
- // The first item in the list represents current weather.
- if (!weatherDetails.isEmpty()) {
- d->now.setTemperature(weatherDetails.first().m_temperature);
- d->now.setWeatherIcon(weatherDetails.first().m_weatherIconId);
- d->now.setWeatherDescription(weatherDetails.first().m_weatherDescription);
- }
-
- // The other items represent weather forecast. The amount of items depends
- // on the provider backend.
- for (qsizetype i = 1; i < weatherDetails.size(); ++i) {
- WeatherData *forecastEntry = new WeatherData(weatherDetails.at(i));
- d->forecast.append(forecastEntry);
- }
-
- if (!d->ready) {
- d->ready = true;
- emit readyChanged();
- }
-
- emit weatherChanged();
-
- return true;
-}
-
-void AppModel::requestWeatherByCoordinates()
-{
- const auto cacheResult = d->m_dataCache.getWeatherData(d->coord);
- if (WeatherDataCache::isCacheResultValid(cacheResult))
- applyWeatherData(cacheResult.first, cacheResult.second);
- else if (d->m_currentBackend)
- d->m_currentBackend->requestWeatherInfo(d->coord);
-}
-
-void AppModel::requestWeatherByCity()
-{
- const auto cacheResult = d->m_dataCache.getWeatherData(d->city);
- if (WeatherDataCache::isCacheResultValid(cacheResult))
- applyWeatherData(cacheResult.first, cacheResult.second);
- else if (d->m_currentBackend)
- d->m_currentBackend->requestWeatherInfo(d->city);
-}
-
-void AppModel::registerBackend(qsizetype index)
-{
- if (index >= 0 && index < d->m_supportedBackends.size()) {
- d->m_currentBackend = d->m_supportedBackends.at(index);
- d->m_currentBackendIndex = index;
- connect(d->m_currentBackend, &ProviderBackend::weatherInformation,
- this, &AppModel::handleWeatherData);
- connect(d->m_currentBackend, &ProviderBackend::errorOccurred,
- this, &AppModel::switchToNextBackend);
- }
-}
-
-void AppModel::deregisterCurrentBackend()
-{
- if (d->m_currentBackend) {
- disconnect(d->m_currentBackend, &ProviderBackend::weatherInformation,
- this, &AppModel::handleWeatherData);
- disconnect(d->m_currentBackend, &ProviderBackend::errorOccurred,
- this, &AppModel::switchToNextBackend);
- d->m_currentBackend = nullptr;
- }
-}
-
-bool AppModel::hasValidCity() const
-{
- return (!(d->city.isEmpty()) && d->city.size() > 1 && d->city != "");
-}
-
-bool AppModel::hasValidWeather() const
-{
- return hasValidCity() && (!(d->now.weatherIcon().isEmpty()) &&
- (d->now.weatherIcon().size() > 1) &&
- d->now.weatherIcon() != "");
-}
-
-WeatherData *AppModel::weather() const
-{
- return &(d->now);
-}
-
-QQmlListProperty<WeatherData> AppModel::forecast() const
-{
- return *(d->fcProp);
-}
-
-bool AppModel::ready() const
-{
- return d->ready;
-}
-
-bool AppModel::hasSource() const
-{
- return (d->src != NULL);
-}
-
-bool AppModel::useGps() const
-{
- return d->useGps;
-}
-
-void AppModel::setUseGps(bool value)
-{
- d->useGps = value;
- if (value) {
- d->city = "";
- emit cityChanged();
- emit weatherChanged();
- // if we already have a valid GPS position, do not wait until it
- // updates, but query the city immediately
- if (d->coord.isValid())
- requestWeatherByCoordinates();
- }
- emit useGpsChanged();
-}
-
-QString AppModel::city() const
-{
- return d->city;
-}
-
-void AppModel::setCity(const QString &value)
-{
- d->city = value;
- emit cityChanged();
- requestWeatherByCity();
-}
diff --git a/examples/positioning/weatherinfo/appmodel.h b/examples/positioning/weatherinfo/appmodel.h
deleted file mode 100644
index 73a9d06a..00000000
--- a/examples/positioning/weatherinfo/appmodel.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-
-#ifndef APPMODEL_H
-#define APPMODEL_H
-
-#include <QtCore/QObject>
-#include <QtCore/QString>
-#include <QtNetwork/QNetworkReply>
-#include <QtQml/QQmlListProperty>
-#include <QtQml/qqml.h>
-
-#include <QtPositioning/QGeoPositionInfoSource>
-
-#include "providerbackend.h"
-
-//! [0]
-class WeatherData : public QObject {
- Q_OBJECT
- Q_PROPERTY(QString dayOfWeek
- READ dayOfWeek WRITE setDayOfWeek
- NOTIFY dataChanged)
- Q_PROPERTY(QString weatherIcon
- READ weatherIcon WRITE setWeatherIcon
- NOTIFY dataChanged)
- Q_PROPERTY(QString weatherDescription
- READ weatherDescription WRITE setWeatherDescription
- NOTIFY dataChanged)
- Q_PROPERTY(QString temperature
- READ temperature WRITE setTemperature
- NOTIFY dataChanged)
- QML_ANONYMOUS
-
-public:
- explicit WeatherData(QObject *parent = 0);
- WeatherData(const WeatherData &other);
- WeatherData(const WeatherInfo &other);
-
- QString dayOfWeek() const;
- QString weatherIcon() const;
- QString weatherDescription() const;
- QString temperature() const;
-
- void setDayOfWeek(const QString &value);
- void setWeatherIcon(const QString &value);
- void setWeatherDescription(const QString &value);
- void setTemperature(const QString &value);
-
-signals:
- void dataChanged();
-//! [0]
-private:
- QString m_dayOfWeek;
- QString m_weather;
- QString m_weatherDescription;
- QString m_temperature;
-//! [1]
-};
-//! [1]
-
-Q_DECLARE_METATYPE(WeatherData)
-
-class AppModelPrivate;
-//! [2]
-class AppModel : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool ready
- READ ready
- NOTIFY readyChanged)
- Q_PROPERTY(bool hasSource
- READ hasSource
- NOTIFY readyChanged)
- Q_PROPERTY(bool hasValidCity
- READ hasValidCity
- NOTIFY cityChanged)
- Q_PROPERTY(bool hasValidWeather
- READ hasValidWeather
- NOTIFY weatherChanged)
- Q_PROPERTY(bool useGps
- READ useGps WRITE setUseGps
- NOTIFY useGpsChanged)
- Q_PROPERTY(QString city
- READ city WRITE setCity
- NOTIFY cityChanged)
- Q_PROPERTY(WeatherData *weather
- READ weather
- NOTIFY weatherChanged)
- Q_PROPERTY(QQmlListProperty<WeatherData> forecast
- READ forecast
- NOTIFY weatherChanged)
- QML_ELEMENT
-
-public:
- explicit AppModel(QObject *parent = 0);
- ~AppModel();
-
- bool ready() const;
- bool hasSource() const;
- bool useGps() const;
- bool hasValidCity() const;
- bool hasValidWeather() const;
- void setUseGps(bool value);
-
- QString city() const;
- void setCity(const QString &value);
-
- WeatherData *weather() const;
- QQmlListProperty<WeatherData> forecast() const;
-
-public slots:
- Q_INVOKABLE void refreshWeather();
-
-//! [2]
-private slots:
- void positionUpdated(QGeoPositionInfo gpsPos);
- void positionError(QGeoPositionInfoSource::Error e);
- void handleWeatherData(const LocationInfo &location, const QList<WeatherInfo> &weatherDetails);
- void switchToNextBackend();
-
-//! [3]
-signals:
- void readyChanged();
- void useGpsChanged();
- void cityChanged();
- void weatherChanged();
-//! [3]
-
-private:
- bool applyWeatherData(const QString &city, const QList<WeatherInfo> &weatherDetails);
- void requestWeatherByCoordinates();
- void requestWeatherByCity();
- void registerBackend(qsizetype index);
- void deregisterCurrentBackend();
-
-
- AppModelPrivate *d;
-
-//! [4]
-};
-//! [4]
-
-#endif // APPMODEL_H
diff --git a/examples/positioning/weatherinfo/components/BigForecastIcon.qml b/examples/positioning/weatherinfo/components/BigForecastIcon.qml
deleted file mode 100644
index 9fa854a0..00000000
--- a/examples/positioning/weatherinfo/components/BigForecastIcon.qml
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: current
-
- property string topText: "20*"
- property string bottomText: "Mostly cloudy"
- property string weatherIcon: "sunny"
- property real smallSide: (current.width < current.height ? current.width : current.height)
-
- Text {
- text: current.topText
- font.pointSize: 28
- anchors {
- top: current.top
- left: current.left
- topMargin: 5
- leftMargin: 5
- }
- }
-
- WeatherIcon {
- weatherIcon: current.weatherIcon
- anchors.centerIn: parent
- anchors.verticalCenterOffset: -15
- width: current.smallSide
- height: current.smallSide
- }
-
- Text {
- text: current.bottomText
- font.pointSize: 23
- wrapMode: Text.WordWrap
- width: parent.width
- horizontalAlignment: Text.AlignRight
- anchors {
- bottom: current.bottom
- right: current.right
- rightMargin: 5
- }
- }
-}
diff --git a/examples/positioning/weatherinfo/components/ForecastIcon.qml b/examples/positioning/weatherinfo/components/ForecastIcon.qml
deleted file mode 100644
index ecf9a463..00000000
--- a/examples/positioning/weatherinfo/components/ForecastIcon.qml
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: top
-
- property string topText: "Mon"
- property string weatherIcon: "sunny"
- property string bottomText: "22*/23*"
-
- Text {
- id: dayText
- horizontalAlignment: Text.AlignHCenter
- width: top.width
- text: top.topText
-
- anchors.top: parent.top
- anchors.topMargin: top.height / 5 - dayText.paintedHeight
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- WeatherIcon {
- id: icon
- weatherIcon: top.weatherIcon
-
- property real side: {
- var h = 3 * top.height / 5
- if (top.width < h)
- top.width;
- else
- h;
- }
-
- width: icon.side
- height: icon.side
-
- anchors.centerIn: parent
- }
-
- Text {
- id: tempText
- horizontalAlignment: Text.AlignHCenter
- width: top.width
- text: top.bottomText
-
- anchors.bottom: parent.bottom
- anchors.bottomMargin: top.height / 5 - tempText.paintedHeight
- anchors.horizontalCenter: parent.horizontalCenter
- }
-}
diff --git a/examples/positioning/weatherinfo/components/WeatherIcon.qml b/examples/positioning/weatherinfo/components/WeatherIcon.qml
deleted file mode 100644
index 47832c0e..00000000
--- a/examples/positioning/weatherinfo/components/WeatherIcon.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-
-Item {
- id: container
-
- property string weatherIcon: "sunny"
-
- Image {
- id: img
- source: "../icons/weather-" + container.weatherIcon + ".png"
- smooth: true
- anchors.fill: parent
- }
-}
diff --git a/examples/positioning/weatherinfo/doc/images/example-weatherinfo.png b/examples/positioning/weatherinfo/doc/images/example-weatherinfo.png
deleted file mode 100644
index 3a1c6c24..00000000
--- a/examples/positioning/weatherinfo/doc/images/example-weatherinfo.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc b/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc
deleted file mode 100644
index 7d9cab6f..00000000
--- a/examples/positioning/weatherinfo/doc/src/weatherinfo.qdoc
+++ /dev/null
@@ -1,164 +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$
-**
-****************************************************************************/
-
-/*!
- \example weatherinfo
- \title Weather Info (C++/QML)
-
- \brief The Weather Info example shows how to use the user's current position
- to retrieve local content from a web service in a C++ plugin for QML.
-
- \ingroup qtpositioning-examples
-
- Key \l{Qt Positioning} classes used in this example:
-
- \list
- \li \l{QGeoPositionInfo}
- \li \l{QGeoPositionInfoSource}
- \endlist
-
- \image ../images/example-weatherinfo.png
-
- \include examples-run.qdocinc
-
- \section1 Weather Data Providers
-
- The example uses two unrelated weather data providers:
-
- \list
- \li \l {http://www.openweathermap.org}{OpenWeather}
- \li \l {https://www.weatherapi.com/}{WeatherAPI.com}
- \endlist
-
- The provider to be used is selected automatically at runtime and can be
- changed if the selected provider is not available. However, it can't be
- specified manually.
-
- \note Free plans are used for both providers, which implies certain
- limitations on the amount of weather requests. If the limits are exceeded,
- the providers become temporary unavailable. When both providers are
- unavailable, the application would not be able to show any weather
- information. In this case it is required to wait until at least one of the
- providers becomes available again.
-
- \section1 Application Data Models
-
- The key part of this example is the application's data model, contained
- in the \c WeatherData and \c AppModel classes. \c WeatherData represents
- the weather information taken from the HTTP service. It is a simple data
- class, but we use \l Q_PROPERTY to expose it nicely to QML later.
- It also uses \l QML_ANONYMOUS macro, which makes it recognized in QML.
-
- \snippet weatherinfo/appmodel.h 0
- \snippet weatherinfo/appmodel.h 1
-
- \c AppModel models the state of the entire application. At startup, we
- get the platform's default position source using
- \l QGeoPositionInfoSource::createDefaultSource().
-
- \snippet weatherinfo/appmodel.cpp 0
- \snippet weatherinfo/appmodel.cpp 1
-
- If no default source is available, we take a static position and fetch
- weather for that. If, however, we do have a position source, we connect
- its \l {QGeoPositionInfoSource::}{positionUpdated()} signal to a slot on the
- \c AppModel and call \l {QGeoPositionInfoSource::}{startUpdates()}, which
- begins regular updates of device position.
-
- When a position update is received, we use the longitude and latitude
- of the returned coordinate to retrieve weather data for the specified
- location.
-
- \snippet weatherinfo/appmodel.cpp 2
-
- To inform the UI about this process, the \c cityChanged() signal is emitted
- when a new city is used, and the \c weatherChanged() signal whenever a
- weather update occurs.
-
- The model also uses \l QML_ELEMENT macro, which makes it available in QML.
-
- \snippet weatherinfo/appmodel.h 2
- \snippet weatherinfo/appmodel.h 3
- \snippet weatherinfo/appmodel.h 4
-
- We use a \l QQmlListProperty for the weather forecast information,
- which contains the weather forecast for the next days (the number of days
- is provider-specific). This makes it easy to access the forecast from QML.
-
- \section1 Expose Custom Models to QML
-
- To expose the models to the QML UI layer, we use the \l QML_ELEMENT and
- \l QML_ANONYMOUS macros. See the \l QQmlEngine class description for more
- details on these macros.
-
- To make the types available in QML, we need to update our build accordingly.
-
- \section2 CMake Build
-
- For a CMake-based build, we need to add the following to the
- \c {CMakeLists.txt}:
-
- \quotefromfile weatherinfo/CMakeLists.txt
- \skipto qt_add_qml_module(weatherinfo
- \printuntil )
-
- \section2 qmake Build
-
- For a qmake build, we need to modify the \c {weatherinfo.pro} file in the
- following way:
-
- \quotefromfile weatherinfo/weatherinfo.pro
- \skipto CONFIG
- \printuntil QML_IMPORT_MAJOR_VERSION
-
- \section1 Instantiate the Models in QML
-
- Finally, in the actual QML, we instantiate the \c {AppModel}:
-
- \snippet weatherinfo/weatherinfo.qml 0
- \snippet weatherinfo/weatherinfo.qml 1
- \snippet weatherinfo/weatherinfo.qml 2
-
- Once the model is instantiated like this, we can use its properties
- elsewhere in the QML document:
-
- \snippet weatherinfo/weatherinfo.qml 3
- \snippet weatherinfo/weatherinfo.qml 4
-
- \section1 Files and Attributions
-
- The example bundles the following images from Third-Party sources:
-
- \table
- \row
- \li \l{weatherinfo-tango-icons}{Tango Icons}
- \li Public Domain
- \row
- \li \l{weatherinfo-tango-weather-pack}{Tango Weather Icon Pack by Darkobra}
- \li Public Domain
- \endtable
-*/
diff --git a/examples/positioning/weatherinfo/icons/README.txt b/examples/positioning/weatherinfo/icons/README.txt
deleted file mode 100644
index d3841532..00000000
--- a/examples/positioning/weatherinfo/icons/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-The scalable icons are from:
-
-http://tango.freedesktop.org/Tango_Icon_Library
-http://darkobra.deviantart.com/art/Tango-Weather-Icon-Pack-98024429
-
diff --git a/examples/positioning/weatherinfo/icons/qt_attribution.json b/examples/positioning/weatherinfo/icons/qt_attribution.json
deleted file mode 100644
index 23bbe386..00000000
--- a/examples/positioning/weatherinfo/icons/qt_attribution.json
+++ /dev/null
@@ -1,28 +0,0 @@
-[
- {
- "Id": "weatherinfo-tango-weather-pack",
- "Name": "Tango Weather Icon Pack by Darkobra",
- "QDocModule": "qtpositioning",
- "QtUsage": "Used in the \"Weather Info (C++/QML)\" example",
- "QtParts": [ "examples" ],
- "Description": "74 brand spankin' new Tango icons for your viewing pleasure.",
- "Homepage": "https://www.deviantart.com/darkobra/art/Tango-Weather-Icon-Pack-98024429",
-
- "License": "Public Domain",
- "Copyright": "Copyright DarKobra (C Stark)",
- "Files": "weather-fog.png weather-haze.png weather-icy.png weather-sleet.png weather-sunny.png weather-sunny-very-few-clouds.png weather-sunny-few-clouds.png weather-thunder-shower.png"
- },
- {
- "Id": "weatherinfo-tango-icons",
- "Name": "Tango Icons",
- "QDocModule": "qtpositioning",
- "QtUsage": "Used in the \"Weather Info (C++/QML)\" example",
- "QtParts": [ "examples" ],
- "Description": "The Tango Desktop Project exists to help create a consistent graphical user interface experience for free and Open Source software. ",
- "Homepage": "http://tango.freedesktop.org/Tango_Desktop_Project",
-
- "License": "Public Domain",
- "Copyright": "Copyright Tango Project contributors",
- "Files": "weather-few-clouds.png weather-overcast.png weather-showers.png weather-storm.png weather-snow.png weather-showers-scattered.png"
- }
-]
diff --git a/examples/positioning/weatherinfo/icons/weather-few-clouds.png b/examples/positioning/weatherinfo/icons/weather-few-clouds.png
deleted file mode 100644
index a8000ef0..00000000
--- a/examples/positioning/weatherinfo/icons/weather-few-clouds.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-fog.png b/examples/positioning/weatherinfo/icons/weather-fog.png
deleted file mode 100644
index 9ffe9c4a..00000000
--- a/examples/positioning/weatherinfo/icons/weather-fog.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-haze.png b/examples/positioning/weatherinfo/icons/weather-haze.png
deleted file mode 100644
index ae6f13eb..00000000
--- a/examples/positioning/weatherinfo/icons/weather-haze.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-icy.png b/examples/positioning/weatherinfo/icons/weather-icy.png
deleted file mode 100644
index 18d20384..00000000
--- a/examples/positioning/weatherinfo/icons/weather-icy.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-overcast.png b/examples/positioning/weatherinfo/icons/weather-overcast.png
deleted file mode 100644
index 9d50f77f..00000000
--- a/examples/positioning/weatherinfo/icons/weather-overcast.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-showers-scattered.png b/examples/positioning/weatherinfo/icons/weather-showers-scattered.png
deleted file mode 100644
index d3e5b166..00000000
--- a/examples/positioning/weatherinfo/icons/weather-showers-scattered.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-showers.png b/examples/positioning/weatherinfo/icons/weather-showers.png
deleted file mode 100644
index 07489aaa..00000000
--- a/examples/positioning/weatherinfo/icons/weather-showers.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-sleet.png b/examples/positioning/weatherinfo/icons/weather-sleet.png
deleted file mode 100644
index 3d225895..00000000
--- a/examples/positioning/weatherinfo/icons/weather-sleet.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-snow.png b/examples/positioning/weatherinfo/icons/weather-snow.png
deleted file mode 100644
index e7426e3c..00000000
--- a/examples/positioning/weatherinfo/icons/weather-snow.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-storm.png b/examples/positioning/weatherinfo/icons/weather-storm.png
deleted file mode 100644
index 6b6b366a..00000000
--- a/examples/positioning/weatherinfo/icons/weather-storm.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-sunny-very-few-clouds.png b/examples/positioning/weatherinfo/icons/weather-sunny-very-few-clouds.png
deleted file mode 100644
index 133bcb29..00000000
--- a/examples/positioning/weatherinfo/icons/weather-sunny-very-few-clouds.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-sunny.png b/examples/positioning/weatherinfo/icons/weather-sunny.png
deleted file mode 100644
index 0fac921d..00000000
--- a/examples/positioning/weatherinfo/icons/weather-sunny.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/icons/weather-thundershower.png b/examples/positioning/weatherinfo/icons/weather-thundershower.png
deleted file mode 100644
index 1aff1639..00000000
--- a/examples/positioning/weatherinfo/icons/weather-thundershower.png
+++ /dev/null
Binary files differ
diff --git a/examples/positioning/weatherinfo/main.cpp b/examples/positioning/weatherinfo/main.cpp
deleted file mode 100644
index a002a244..00000000
--- a/examples/positioning/weatherinfo/main.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 <QtGui/QGuiApplication>
-#include <QtQuick/QQuickView>
-#include <QtQml/QQmlEngine>
-#include <QtQml/QQmlContext>
-#include <QtQuick/QQuickItem>
-#include <QLoggingCategory>
-
-#include "appmodel.h"
-
-int main(int argc, char *argv[])
-{
- QLoggingCategory::setFilterRules("wapp.*.debug=false");
- QGuiApplication application(argc, argv);
-
- const QString mainQmlApp = QStringLiteral("qrc:///weatherinfo.qml");
- QQuickView view;
- view.setSource(QUrl(mainQmlApp));
- view.setResizeMode(QQuickView::SizeRootObjectToView);
-
- QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
- view.setGeometry(QRect(100, 100, 360, 640));
- view.show();
- return application.exec();
-}
diff --git a/examples/positioning/weatherinfo/openweathermapbackend.cpp b/examples/positioning/weatherinfo/openweathermapbackend.cpp
deleted file mode 100644
index 0a77579b..00000000
--- a/examples/positioning/weatherinfo/openweathermapbackend.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "openweathermapbackend.h"
-
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QUrlQuery>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonValue>
-#include <QJsonArray>
-#include <QGeoCoordinate>
-#include <QLoggingCategory>
-
-Q_DECLARE_LOGGING_CATEGORY(requestsLog)
-
-static constexpr auto kZeroKelvin = 273.15;
-
-static QString niceTemperatureString(double t)
-{
- return QString::number(qRound(t - kZeroKelvin)) + QChar(0xB0);
-}
-
-/*
- Converts weather code to a string that will be used to show the icon.
- The possible strings are based on the icon names. The icon name is built up
- as follows:
- weather-[mystring].png
- where [mystring] is the value returned by this method.
- Check resources for the full list of available icons.
-*/
-static QString weatherCodeToString(const QString &code)
-{
- if (code == u"01d" || code == u"01n")
- return "sunny";
- else if (code == u"02d" || code == u"02n")
- return "sunny-very-few-clouds";
- else if (code == u"03d" || code == u"03n")
- return "few-clouds";
- else if (code == u"04d" || code == u"04n")
- return "overcast";
- else if (code == u"09d" || code == u"09n" || code == u"10d" || code == u"10n")
- return "showers";
- else if (code == u"11d" || code == u"11n")
- return "thundershower";
- else if (code == u"13d" || code == u"13n")
- return "snow";
- else if (code == u"50d" || code == u"50n")
- return "fog";
-
- return "sunny"; // default choice
-}
-
-static void parseWeatherDescription(const QJsonObject &object, WeatherInfo &info)
-{
- const QJsonArray weatherArray = object.value(u"weather").toArray();
- if (!weatherArray.isEmpty()) {
- const QJsonObject obj = weatherArray.first().toObject();
- info.m_weatherDescription = obj.value(u"description").toString();
- info.m_weatherIconId = weatherCodeToString(obj.value(u"icon").toString());
- } else {
- qCDebug(requestsLog, "An empty weather array is returned.");
- }
-}
-
-OpenWeatherMapBackend::OpenWeatherMapBackend(QObject *parent)
- : ProviderBackend(parent),
- m_networkManager(new QNetworkAccessManager(this)),
- m_appId(QStringLiteral("36496bad1955bf3365448965a42b9eac"))
-{
-}
-
-void OpenWeatherMapBackend::requestWeatherInfo(const QString &city)
-{
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("q"), city);
-
- requestCurrentWeather(query, QGeoCoordinate());
-}
-
-void OpenWeatherMapBackend::requestWeatherInfo(const QGeoCoordinate &coordinate)
-{
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("lat"), QString::number(coordinate.latitude()));
- query.addQueryItem(QStringLiteral("lon"), QString::number(coordinate.longitude()));
-
- requestCurrentWeather(query, coordinate);
-}
-
-void OpenWeatherMapBackend::handleCurrentWeatherReply(QNetworkReply *reply,
- const QGeoCoordinate &coordinate)
-{
- if (!reply) {
- emit errorOccurred();
- return;
- }
- bool parsed = false;
- if (!reply->error()) {
- // extract info about current weather
- const QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
- const QJsonObject documentObject = document.object();
-
- LocationInfo currentLocation;
- currentLocation.m_name = documentObject.value(u"name").toString();
- if (coordinate.isValid())
- currentLocation.m_coordinate = coordinate;
- qCDebug(requestsLog) << "Got current weather for" << currentLocation.m_name;
-
- WeatherInfo currentWeather;
-
- parseWeatherDescription(documentObject, currentWeather);
-
- const QJsonObject mainObject = documentObject.value(u"main").toObject();
- const QJsonValue tempValue = mainObject.value(u"temp");
- if (tempValue.isDouble())
- currentWeather.m_temperature = niceTemperatureString(tempValue.toDouble());
- else
- qCDebug(requestsLog, "Failed to parse current temperature.");
-
- parsed = !currentLocation.m_name.isEmpty() && !currentWeather.m_temperature.isEmpty();
-
- if (parsed) {
- // request forecast
- requestWeatherForecast(currentLocation, currentWeather);
- }
- }
- if (!parsed) {
- emit errorOccurred();
- if (reply->error())
- qCDebug(requestsLog) << reply->errorString();
- else
- qCDebug(requestsLog, "Failed to parse current weather JSON.");
- }
-
- reply->deleteLater();
-}
-
-void OpenWeatherMapBackend::handleWeatherForecastReply(QNetworkReply *reply,
- const LocationInfo &location,
- const WeatherInfo &currentWeather)
-{
- if (!reply) {
- emit errorOccurred();
- return;
- }
- if (!reply->error()) {
- QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
- const QJsonObject documentObject = document.object();
-
- QList<WeatherInfo> weatherDetails;
- // current weather will be the first in the list
- weatherDetails << currentWeather;
-
- QJsonArray daysList = documentObject.value(u"list").toArray();
- // include current day as well
- for (qsizetype i = 0; i < daysList.size(); ++i) {
- QJsonObject dayObject = daysList.at(i).toObject();
- WeatherInfo info;
-
- const QDateTime dt = QDateTime::fromSecsSinceEpoch(dayObject.value(u"dt").toInteger());
- info.m_dayOfWeek = dt.toString(u"ddd");
-
- const QJsonObject tempObject = dayObject.value(u"temp").toObject();
-
- const QJsonValue minTemp = tempObject.value(u"min");
- const QJsonValue maxTemp = tempObject.value(u"max");
- if (minTemp.isDouble() && maxTemp.isDouble()) {
- info.m_temperature = niceTemperatureString(minTemp.toDouble()) + QChar('/')
- + niceTemperatureString(maxTemp.toDouble());
- } else {
- qCDebug(requestsLog, "Failed to parse min or max temperature.");
- }
-
- parseWeatherDescription(dayObject, info);
-
- if (!info.m_temperature.isEmpty() && !info.m_weatherIconId.isEmpty())
- weatherDetails.push_back(info);
- }
-
- emit weatherInformation(location, weatherDetails);
- } else {
- emit errorOccurred();
- qCDebug(requestsLog) << reply->errorString();
- }
-
- reply->deleteLater();
-}
-
-void OpenWeatherMapBackend::requestCurrentWeather(QUrlQuery &query,
- const QGeoCoordinate &coordinate)
-{
- QUrl url("http://api.openweathermap.org/data/2.5/weather");
- query.addQueryItem(QStringLiteral("mode"), QStringLiteral("json"));
- query.addQueryItem(QStringLiteral("APPID"), m_appId);
- url.setQuery(query);
-
- QNetworkReply *reply = m_networkManager->get(QNetworkRequest(url));
- connect(reply, &QNetworkReply::finished, this,
- [this, reply, coordinate]() { handleCurrentWeatherReply(reply, coordinate); });
-}
-
-void OpenWeatherMapBackend::requestWeatherForecast(const LocationInfo &location,
- const WeatherInfo &currentWeather)
-{
- QUrl url("http://api.openweathermap.org/data/2.5/forecast/daily");
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("q"), location.m_name);
- query.addQueryItem(QStringLiteral("mode"), QStringLiteral("json"));
- query.addQueryItem(QStringLiteral("cnt"), QStringLiteral("4"));
- query.addQueryItem(QStringLiteral("APPID"), m_appId);
- url.setQuery(query);
-
- QNetworkReply *reply = m_networkManager->get(QNetworkRequest(url));
- connect(reply, &QNetworkReply::finished, this, [this, reply, location, currentWeather]() {
- handleWeatherForecastReply(reply, location, currentWeather);
- });
-}
diff --git a/examples/positioning/weatherinfo/openweathermapbackend.h b/examples/positioning/weatherinfo/openweathermapbackend.h
deleted file mode 100644
index 7f4e5f97..00000000
--- a/examples/positioning/weatherinfo/openweathermapbackend.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-
-#ifndef OPENWEATHERMAPBACKEND_H
-#define OPENWEATHERMAPBACKEND_H
-
-#include "providerbackend.h"
-
-QT_BEGIN_NAMESPACE
-class QNetworkAccessManager;
-class QNetworkReply;
-class QUrlQuery;
-QT_END_NAMESPACE
-
-class OpenWeatherMapBackend : public ProviderBackend
-{
- Q_OBJECT
-public:
- explicit OpenWeatherMapBackend(QObject *parent = nullptr);
- ~OpenWeatherMapBackend() = default;
-
- void requestWeatherInfo(const QString &city) override;
- void requestWeatherInfo(const QGeoCoordinate &coordinate) override;
-
-private slots:
- void handleCurrentWeatherReply(QNetworkReply *reply, const QGeoCoordinate &coordinate);
- void handleWeatherForecastReply(QNetworkReply *reply, const LocationInfo &location,
- const WeatherInfo &currentWeather);
-
-private:
- void requestCurrentWeather(QUrlQuery &query, const QGeoCoordinate &coordinate);
- void requestWeatherForecast(const LocationInfo &location, const WeatherInfo &currentWeather);
-
- QNetworkAccessManager *m_networkManager;
- const QString m_appId;
-};
-
-#endif // OPENWEATHERMAPBACKEND_H
diff --git a/examples/positioning/weatherinfo/providerbackend.cpp b/examples/positioning/weatherinfo/providerbackend.cpp
deleted file mode 100644
index 30c45209..00000000
--- a/examples/positioning/weatherinfo/providerbackend.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "providerbackend.h"
-
-ProviderBackend::ProviderBackend(QObject *parent) : QObject(parent) { }
diff --git a/examples/positioning/weatherinfo/providerbackend.h b/examples/positioning/weatherinfo/providerbackend.h
deleted file mode 100644
index c59f6c49..00000000
--- a/examples/positioning/weatherinfo/providerbackend.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-
-#ifndef PROVIDERBACKEND_H
-#define PROVIDERBACKEND_H
-
-#include <QObject>
-#include <QGeoCoordinate>
-
-struct WeatherInfo
-{
- QString m_dayOfWeek;
- QString m_weatherIconId;
- QString m_weatherDescription;
- QString m_temperature;
-};
-
-struct LocationInfo
-{
- QString m_name;
- QGeoCoordinate m_coordinate;
-};
-
-class ProviderBackend : public QObject
-{
- Q_OBJECT
-public:
- explicit ProviderBackend(QObject *parent = nullptr);
-
- virtual void requestWeatherInfo(const QString &city) = 0;
- virtual void requestWeatherInfo(const QGeoCoordinate &coordinate) = 0;
-
-signals:
- // The first element in weatherDetails represents current weather.
- // Next are the weather forecast, including the current day.
- // The LocationInfo object should contain valid coordinate only when it was
- // initially used to request the weather. If the city name was used, an
- // empty coordinate is expected to be transferred.
- void weatherInformation(const LocationInfo &location, const QList<WeatherInfo> &weatherDetails);
- void errorOccurred();
-};
-
-#endif // PROVIDERBACKEND_H
diff --git a/examples/positioning/weatherinfo/weatherapibackend.cpp b/examples/positioning/weatherinfo/weatherapibackend.cpp
deleted file mode 100644
index a98f7dbb..00000000
--- a/examples/positioning/weatherinfo/weatherapibackend.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "weatherapibackend.h"
-
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QUrlQuery>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonValue>
-#include <QJsonArray>
-#include <QLoggingCategory>
-
-Q_DECLARE_LOGGING_CATEGORY(requestsLog)
-
-static QString niceTemperatureString(double t)
-{
- return QString::number(qRound(t)) + QChar(0xB0);
-}
-
-/*
- Converts weather code to a string that will be used to show the icon.
- The possible strings are based on the icon names. The icon name is built up
- as follows:
- weather-[mystring].png
- where [mystring] is the value returned by this method.
- Check resources for the full list of available icons.
-*/
-static QString weatherCodeToString(int code)
-{
- switch (code) {
- case 1000:
- return "sunny";
- case 1003:
- return "sunny-very-few-clouds";
- case 1006:
- return "few-clouds";
- case 1009:
- return "overcast";
- case 1030:
- case 1135:
- case 1147:
- return "fog";
- case 1063:
- case 1072:
- case 1150:
- case 1153:
- case 1168:
- case 1171:
- case 1180:
- case 1183:
- case 1186:
- case 1189:
- case 1198:
- return "showers-scattered";
- case 1066:
- case 1069:
- case 1114:
- case 1117:
- case 1210:
- case 1213:
- case 1216:
- case 1219:
- case 1222:
- case 1225:
- case 1237:
- case 1255:
- case 1258:
- case 1261:
- case 1264:
- case 1279:
- case 1282:
- return "snow";
- case 1087:
- return "storm";
- case 1192:
- case 1195:
- case 1201:
- case 1240:
- case 1243:
- case 1246:
- return "showers";
- case 1204:
- case 1207:
- case 1249:
- case 1252:
- return "sleet";
- case 1273:
- case 1276:
- return "thundershower";
- default:
- return "sunny";
- }
-
- return "sunny"; // default choice
-}
-
-static void parseWeatherDescription(const QJsonObject &object, WeatherInfo &info)
-{
- const QJsonObject conditionObject = object.value(u"condition").toObject();
- info.m_weatherDescription = conditionObject.value(u"text").toString();
- info.m_weatherIconId = weatherCodeToString(conditionObject.value(u"code").toInt());
-}
-
-WeatherApiBackend::WeatherApiBackend(QObject *parent)
- : ProviderBackend(parent),
- m_networkManager(new QNetworkAccessManager(this)),
- m_apiKey(QStringLiteral("8edde160c63c4be6b77101828211208"))
-{
-}
-
-void WeatherApiBackend::requestWeatherInfo(const QString &city)
-{
- generateWeatherRequest(city, QGeoCoordinate());
-}
-
-void WeatherApiBackend::requestWeatherInfo(const QGeoCoordinate &coordinate)
-{
- const QString coordinateStr =
- QString("%1,%2").arg(coordinate.latitude()).arg(coordinate.longitude());
- generateWeatherRequest(coordinateStr, coordinate);
-}
-
-void WeatherApiBackend::handleWeatherForecastReply(QNetworkReply *reply,
- const QGeoCoordinate &coordinate)
-{
- if (!reply) {
- emit errorOccurred();
- return;
- }
- bool parsed = false;
- if (!reply->error()) {
- QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
- const QJsonObject documentObject = document.object();
- const QJsonObject locationObject = documentObject.value(u"location").toObject();
-
- // extract location name
- LocationInfo location;
- location.m_name = locationObject.value(u"name").toString();
- if (coordinate.isValid())
- location.m_coordinate = coordinate;
- qCDebug(requestsLog) << "Got weather for" << location.m_name;
-
- // extract current weather
- WeatherInfo currentWeather;
-
- const QJsonObject currentWeatherObject = documentObject.value(u"current").toObject();
- const QJsonValue temperature = currentWeatherObject.value(u"temp_c");
- if (temperature.isDouble())
- currentWeather.m_temperature = niceTemperatureString(temperature.toDouble());
-
- parseWeatherDescription(currentWeatherObject, currentWeather);
-
- parsed = !location.m_name.isEmpty() && !currentWeather.m_temperature.isEmpty();
-
- if (parsed) {
- QList<WeatherInfo> weatherDetails;
- weatherDetails << currentWeather;
-
- // extract forecast details
- const QJsonObject forecastObject = documentObject.value(u"forecast").toObject();
- const QJsonArray forecastDays = forecastObject.value(u"forecastday").toArray();
- for (qsizetype i = 0; i < forecastDays.size(); ++i) {
- const QJsonObject dayInfo = forecastDays.at(i).toObject();
- WeatherInfo info;
-
- const QDateTime dt =
- QDateTime::fromSecsSinceEpoch(dayInfo.value(u"date_epoch").toInteger());
- info.m_dayOfWeek = dt.toString(u"ddd");
-
- const QJsonObject dayObject = dayInfo.value(u"day").toObject();
- const QJsonValue minTemp = dayObject.value(u"mintemp_c");
- const QJsonValue maxTemp = dayObject.value(u"maxtemp_c");
- if (minTemp.isDouble() && maxTemp.isDouble()) {
- info.m_temperature = niceTemperatureString(minTemp.toDouble()) + QChar('/')
- + niceTemperatureString(maxTemp.toDouble());
- } else {
- qCDebug(requestsLog, "Failed to parse min or max temperature.");
- }
-
- parseWeatherDescription(dayObject, info);
-
- if (!info.m_temperature.isEmpty() && !info.m_weatherIconId.isEmpty())
- weatherDetails.push_back(info);
- }
-
- emit weatherInformation(location, weatherDetails);
- }
- }
- if (!parsed) {
- emit errorOccurred();
- if (reply->error())
- qCDebug(requestsLog) << reply->errorString();
- else
- qCDebug(requestsLog, "Failed to parse weather JSON.");
- }
-
- reply->deleteLater();
-}
-
-void WeatherApiBackend::generateWeatherRequest(const QString &locationString,
- const QGeoCoordinate &coordinate)
-{
- QUrl url("https://api.weatherapi.com/v1/forecast.json");
-
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("key"), m_apiKey);
- query.addQueryItem(QStringLiteral("q"), locationString);
- query.addQueryItem(QStringLiteral("days"), QStringLiteral("4"));
- query.addQueryItem(QStringLiteral("aqi"), QStringLiteral("no"));
- query.addQueryItem(QStringLiteral("alerts"), QStringLiteral("no"));
-
- url.setQuery(query);
-
- QNetworkReply *reply = m_networkManager->get(QNetworkRequest(url));
- connect(reply, &QNetworkReply::finished, this,
- [this, reply, coordinate]() { handleWeatherForecastReply(reply, coordinate); });
-}
diff --git a/examples/positioning/weatherinfo/weatherapibackend.h b/examples/positioning/weatherinfo/weatherapibackend.h
deleted file mode 100644
index dce078a1..00000000
--- a/examples/positioning/weatherinfo/weatherapibackend.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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$
-**
-****************************************************************************/
-
-#ifndef WEATHERAPIBACKEND_H
-#define WEATHERAPIBACKEND_H
-
-#include "providerbackend.h"
-
-QT_BEGIN_NAMESPACE
-class QNetworkAccessManager;
-class QNetworkReply;
-QT_END_NAMESPACE
-
-class WeatherApiBackend : public ProviderBackend
-{
- Q_OBJECT
-public:
- explicit WeatherApiBackend(QObject *parent = nullptr);
-
- void requestWeatherInfo(const QString &city) override;
- void requestWeatherInfo(const QGeoCoordinate &coordinate) override;
-
-private slots:
- void handleWeatherForecastReply(QNetworkReply *reply, const QGeoCoordinate &coordinate);
-
-private:
- void generateWeatherRequest(const QString &locationString, const QGeoCoordinate &coordinate);
-
- QNetworkAccessManager *m_networkManager;
- const QString m_apiKey;
-};
-
-#endif // WEATHERAPIBACKEND_H
diff --git a/examples/positioning/weatherinfo/weatherinfo.pro b/examples/positioning/weatherinfo/weatherinfo.pro
deleted file mode 100644
index eb88ca42..00000000
--- a/examples/positioning/weatherinfo/weatherinfo.pro
+++ /dev/null
@@ -1,31 +0,0 @@
-TEMPLATE = app
-TARGET = weatherinfo
-
-QT += core network positioning qml quick
-
-CONFIG += qmltypes
-QML_IMPORT_NAME = WeatherInfo
-QML_IMPORT_MAJOR_VERSION = 1
-
-SOURCES += main.cpp \
- appmodel.cpp \
- openweathermapbackend.cpp \
- providerbackend.cpp \
- weatherapibackend.cpp
-
-OTHER_FILES += weatherinfo.qml \
- components/WeatherIcon.qml \
- components/ForecastIcon.qml \
- components/BigForecastIcon.qml \
- icons/*
-
-
-RESOURCES += weatherinfo.qrc
-
-HEADERS += appmodel.h \
- openweathermapbackend.h \
- providerbackend.h \
- weatherapibackend.h
-
-target.path = $$[QT_INSTALL_EXAMPLES]/positioning/weatherinfo
-INSTALLS += target
diff --git a/examples/positioning/weatherinfo/weatherinfo.qml b/examples/positioning/weatherinfo/weatherinfo.qml
deleted file mode 100644
index 62bbe7d7..00000000
--- a/examples/positioning/weatherinfo/weatherinfo.qml
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 QtQuick 2.0
-import "components"
-//! [0]
-import WeatherInfo 1.0
-
-Item {
- id: window
-//! [0]
- width: 360
- height: 640
-
- state: "loading"
-
- states: [
- State {
- name: "loading"
- PropertyChanges { target: main; opacity: 0 }
- PropertyChanges { target: wait; opacity: 1 }
- },
- State {
- name: "ready"
- PropertyChanges { target: main; opacity: 1 }
- PropertyChanges { target: wait; opacity: 0 }
- }
- ]
-//! [1]
- AppModel {
- id: appModel
- onReadyChanged: {
- if (appModel.ready)
- window.state = "ready"
- else
- window.state = "loading"
- }
- }
-//! [1]
- Item {
- id: wait
- anchors.fill: parent
-
- Text {
- text: "Loading weather data..."
- anchors.centerIn: parent
- font.pointSize: 18
- }
- }
-
- Item {
- id: main
- anchors.fill: parent
-
- Column {
- spacing: 6
-
- anchors {
- fill: parent
- topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6
- }
-
- Rectangle {
- width: parent.width
- height: 25
- color: "lightgrey"
-
- Text {
- text: (appModel.hasValidCity ? appModel.city : "Unknown location") + (appModel.useGps ? " (GPS)" : "")
- anchors.fill: parent
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (appModel.useGps) {
- appModel.useGps = false
- appModel.city = "Brisbane"
- } else {
- switch (appModel.city) {
- case "Brisbane":
- appModel.city = "Oslo"
- break
- case "Oslo":
- appModel.city = "Helsinki"
- break
- case "Helsinki":
- appModel.city = "New York"
- break
- case "New York":
- appModel.useGps = true
- break
- }
- }
- }
- }
- }
-
-//! [3]
- BigForecastIcon {
- id: current
-
- width: main.width -12
- height: 2 * (main.height - 25 - 12) / 3
-
- weatherIcon: (appModel.hasValidWeather
- ? appModel.weather.weatherIcon
- : "sunny")
-//! [3]
- topText: (appModel.hasValidWeather
- ? appModel.weather.temperature
- : "??")
- bottomText: (appModel.hasValidWeather
- ? appModel.weather.weatherDescription
- : "No weather data")
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- appModel.refreshWeather()
- }
- }
-//! [4]
- }
-//! [4]
-
- Row {
- id: iconRow
- spacing: 6
-
- width: main.width - 12
- height: (main.height - 25 - 24) / 3
-
- property int daysCount: appModel.forecast.length
- property real iconWidth: (daysCount > 0) ? (iconRow.width / daysCount) - 10
- : iconRow.width
- property real iconHeight: iconRow.height
-
- Repeater {
- model: appModel.forecast
- ForecastIcon {
- id: forecast1
- width: iconRow.iconWidth
- height: iconRow.iconHeight
-
- topText: (appModel.hasValidWeather ?
- modelData.dayOfWeek : "??")
- bottomText: (appModel.hasValidWeather ?
- modelData.temperature : "??/??")
- weatherIcon: (appModel.hasValidWeather ?
- modelData.weatherIcon : "sunny")
- }
- }
- }
- }
- }
-//! [2]
-}
-//! [2]
diff --git a/examples/positioning/weatherinfo/weatherinfo.qrc b/examples/positioning/weatherinfo/weatherinfo.qrc
deleted file mode 100644
index 1578fa9d..00000000
--- a/examples/positioning/weatherinfo/weatherinfo.qrc
+++ /dev/null
@@ -1,21 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>weatherinfo.qml</file>
- <file>components/BigForecastIcon.qml</file>
- <file>components/ForecastIcon.qml</file>
- <file>components/WeatherIcon.qml</file>
- <file>icons/weather-few-clouds.png</file>
- <file>icons/weather-fog.png</file>
- <file>icons/weather-haze.png</file>
- <file>icons/weather-icy.png</file>
- <file>icons/weather-overcast.png</file>
- <file>icons/weather-showers.png</file>
- <file>icons/weather-sleet.png</file>
- <file>icons/weather-snow.png</file>
- <file>icons/weather-storm.png</file>
- <file>icons/weather-sunny-very-few-clouds.png</file>
- <file>icons/weather-sunny.png</file>
- <file>icons/weather-thundershower.png</file>
- <file>icons/weather-showers-scattered.png</file>
- </qresource>
-</RCC>
diff --git a/qtlocation.pro b/qtlocation.pro
index 6f58f846..43dae2cb 100644
--- a/qtlocation.pro
+++ b/qtlocation.pro
@@ -5,8 +5,6 @@
requires(!wasm)
load(configure)
-qtCompileTest(gypsy)
-qtCompileTest(winrt)
load(qt_parts)
diff --git a/src/3rdparty/clip2tri/CMakeLists.txt b/src/3rdparty/clip2tri/CMakeLists.txt
deleted file mode 100644
index 9b5a56b3..00000000
--- a/src/3rdparty/clip2tri/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Generated from clip2tri.pro.
-
-#####################################################################
-## Bundled_Clip2Tri Generic Library:
-#####################################################################
-
-qt_internal_add_3rdparty_library(Bundled_Clip2Tri
- QMAKE_LIB_NAME _clip2tri
- STATIC
- SKIP_AUTOMOC # special case
- EXCEPTIONS
- SOURCES
- clip2tri.cpp clip2tri.h
- INCLUDE_DIRECTORIES
- ../clipper
- ../poly2tri
- LIBRARIES
- Qt::Bundled_Clipper # special case
- Qt::Bundled_Poly2Tri # special case
-)
-qt_disable_warnings(Bundled_Clip2Tri)
-qt_set_symbol_visibility_hidden(Bundled_Clip2Tri)
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:clip2tri.pro:GCC:
-# QMAKE_CFLAGS_OPTIMIZE_FULL = "-ffast-math"
-
-#### Keys ignored in scope 4:.:.:clip2tri.pro:NOT CLANG AND NOT ICC AND NOT rim_qcc:
-# QMAKE_CXXFLAGS_WARN_ON = "-Wno-error=return-type"
diff --git a/src/3rdparty/clip2tri/LICENSE b/src/3rdparty/clip2tri/LICENSE
deleted file mode 100644
index 9d99b888..00000000
--- a/src/3rdparty/clip2tri/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Bitfighter developers
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/src/3rdparty/clip2tri/clip2tri.cpp b/src/3rdparty/clip2tri/clip2tri.cpp
deleted file mode 100644
index db4911c1..00000000
--- a/src/3rdparty/clip2tri/clip2tri.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Authors: kaen, raptor, sam686, watusimoto
- *
- * Originally from the bitfighter source code
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2014 Bitfighter developers
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "clip2tri.h"
-#include <poly2tri.h>
-
-#include <cstdio>
-
-static const double clipperScaleFactor = 1073741822.0;
-static const double clipperScaleFactorInv = 1.0 / 1073741822.0;
-
-using namespace p2t;
-
-namespace c2t
-{
-
-
-static const F32 CLIPPER_SCALE_FACT = 1000.0f;
-static const F32 CLIPPER_SCALE_FACT_INVERSE = 0.001f;
-
-/////////////////////////////////
-
-Point::Point()
-{
- x = 0;
- y = 0;
-}
-
-Point::Point(const Point& pt)
-{
- x = pt.x;
- y = pt.y;
-}
-
-
-/////////////////////////////////
-
-clip2tri::clip2tri() : openSubject(false)
-{
- // Do nothing!
-}
-
-clip2tri::~clip2tri()
-{
- // Do nothing!
-}
-
-
-void clip2tri::triangulate(const vector<vector<Point> > &inputPolygons, vector<Point> &outputTriangles,
- const vector<Point> &boundingPolygon)
-{
- // Use clipper to clean. This upscales the floating point input
- PolyTree solution;
- mergePolysToPolyTree(inputPolygons, solution);
-
- Path bounds = upscaleClipperPoints(boundingPolygon);
-
- // This will downscale the Clipper output and use poly2tri to triangulate
- triangulateComplex(outputTriangles, bounds, solution);
-}
-
-void clip2tri::addClipPolygon(const Path &path)
-{
- try // prevent any exception to spill into Qt
- {
- clipper.AddPath(path, ptClip, true);
- }
- catch(QtClipperLib::clipperException &e)
- {
- printf("addClipPolygon: %s\n", e.what());
- }
-}
-
-void clip2tri::addSubjectPath(const Path &path, bool closed)
-{
- try // prevent any exception to spill into Qt
- {
- clipper.AddPath(path, ptSubject, closed);
- }
- catch(QtClipperLib::clipperException &e)
- {
- printf("addSubjectPath: %s\n", e.what());
- return;
- }
- if (!closed)
- openSubject = true;
-}
-
-void clip2tri::clearClipper()
-{
- // clear doesn't throw
- clipper.Clear();
- openSubject = false;
-}
-
-static QtClipperLib::ClipType operation(const clip2tri::Operation &op)
-{
- switch (op) {
- case clip2tri::Intersection:
- return QtClipperLib::ctIntersection;
- case clip2tri::Union:
- return QtClipperLib::ctUnion;
- case clip2tri::Difference:
- return QtClipperLib::ctDifference;
- case clip2tri::Xor:
- return QtClipperLib::ctXor;
- }
- return ctIntersection;
-}
-
-static std::string operationName(const clip2tri::Operation &op)
-{
- switch (op) {
- case clip2tri::Intersection:
- return std::string("Intersection");
- case clip2tri::Union:
- return std::string("Union");
- case clip2tri::Difference:
- return std::string("Difference");
- case clip2tri::Xor:
- return std::string("Xor");
- }
- return std::string("Intersection");
-}
-
-Paths clip2tri::execute(const clip2tri::Operation op, const PolyFillType subjFillType, const PolyFillType clipFillType)
-{
- Paths solution;
- try // prevent any exception from spilling into Qt
- {
- if (!openSubject) {
- clipper.Execute(operation(op), solution, subjFillType, clipFillType);
- } else {
- PolyTree res;
- clipper.Execute(operation(op), res, subjFillType, clipFillType);
- PolyNode *n = res.GetFirst();
- if (n) {
- solution.push_back(n->Contour);
- while ((n = n->GetNext()))
- solution.push_back(n->Contour);
- }
- }
- }
- catch(QtClipperLib::clipperException &e)
- {
- printf("executing %s: %s\n", operationName(op).c_str(), e.what());
- }
- return solution;
-}
-
-int clip2tri::pointInPolygon(const IntPoint &pt, const Path &path)
-{
- return PointInPolygon(pt, path);
-}
-
-Path clip2tri::upscaleClipperPoints(const vector<Point> &inputPolygon)
-{
- Path outputPolygon;
- outputPolygon.resize(inputPolygon.size());
-
- for(S32 i = 0; i < inputPolygon.size(); i++)
- outputPolygon[i] = IntPoint(S64(inputPolygon[i].x * CLIPPER_SCALE_FACT), S64(inputPolygon[i].y * CLIPPER_SCALE_FACT));
-
- return outputPolygon;
-}
-
-
-Paths clip2tri::upscaleClipperPoints(const vector<vector<Point> > &inputPolygons)
-{
- Paths outputPolygons;
-
- outputPolygons.resize(inputPolygons.size());
-
- for(S32 i = 0; i < inputPolygons.size(); i++)
- {
- outputPolygons[i].resize(inputPolygons[i].size());
-
- for(S32 j = 0; j < inputPolygons[i].size(); j++)
- outputPolygons[i][j] = IntPoint(S64(inputPolygons[i][j].x * CLIPPER_SCALE_FACT), S64(inputPolygons[i][j].y * CLIPPER_SCALE_FACT));
- }
-
- return outputPolygons;
-}
-
-
-vector<vector<Point> > clip2tri::downscaleClipperPoints(const Paths &inputPolygons)
-{
- vector<vector<Point> > outputPolygons;
-
- outputPolygons.resize(inputPolygons.size());
-
- for(U32 i = 0; i < inputPolygons.size(); i++)
- {
- outputPolygons[i].resize(inputPolygons[i].size());
-
- for(U32 j = 0; j < inputPolygons[i].size(); j++)
- outputPolygons[i][j] = Point(F32(inputPolygons[i][j].X) * CLIPPER_SCALE_FACT_INVERSE, F32(inputPolygons[i][j].Y) * CLIPPER_SCALE_FACT_INVERSE);
- }
-
- return outputPolygons;
-}
-
-
-// Use Clipper to merge inputPolygons, placing the result in a Polytree
-// NOTE: this does NOT downscale the Clipper points. You must do this afterwards
-//
-// Here you add all your non-navigatable objects (e.g. walls, barriers, etc.)
-bool clip2tri::mergePolysToPolyTree(const vector<vector<Point> > &inputPolygons, PolyTree &solution)
-{
- Paths input = upscaleClipperPoints(inputPolygons);
-
- // Fire up clipper and union!
- Clipper clipper;
- clipper.StrictlySimple(true);
-
- try // there is a "throw" in AddPolygon
- {
- clipper.AddPaths(input, ptSubject, true);
- }
- catch(QtClipperLib::clipperException &e)
- {
- printf("mergePolysToPolyTree: %s\n", e.what());
- }
-
- return clipper.Execute(ctUnion, solution, pftNonZero, pftNonZero);
-}
-
-
-// Delete all poly2tri points from a vector and clear the vector
-static void deleteAndClear(vector<p2t::Point*> &vec)
-{
- for(U32 i = 0; i < vec.size(); i++)
- delete vec[i];
-
- vec.clear();
-}
-
-
-// Shrink large polygons by reducing each coordinate by 1 in the
-// general direction of the last point as we wind around
-//
-// This normally wouldn't work in every case, but our upscaled-by-1000 polygons
-// have little chance to create new duplicate points with this method.
-//
-// For information on why this was needed, see:
-//
-// https://code.google.com/p/poly2tri/issues/detail?id=90
-//
-static void edgeShrink(Path &path)
-{
- U32 prev = path.size() - 1;
- for(U32 i = 0; i < path.size(); i++)
- {
- // Adjust coordinate by 1 depending on the direction
- path[i].X - path[prev].X > 0 ? path[i].X-- : path[i].X++;
- path[i].Y - path[prev].Y > 0 ? path[i].Y-- : path[i].Y++;
-
- prev = i;
- }
-}
-
-
-// This uses poly2tri to triangulate. poly2tri isn't very robust so clipper needs to do
-// the cleaning of points before getting here.
-//
-// A tree structure of polygons is required for doing complex polygons-within-polygons.
-// For reference discussion on how this started to be developed, see here:
-//
-// https://code.google.com/p/poly2tri/issues/detail?id=74
-//
-// For assistance with a special case crash, see this utility:
-// http://javascript.poly2tri.googlecode.com/hg/index.html
-//
-// FIXME: what is ignoreFills and ignoreHoles for? kaen?
-bool clip2tri::triangulateComplex(vector<Point> &outputTriangles, const Path &outline,
- const PolyTree &polyTree, bool ignoreFills, bool ignoreHoles)
-{
- // Keep track of memory for all the poly2tri objects we create
- vector<p2t::CDT*> cdtRegistry;
- vector<vector<p2t::Point*> > holesRegistry;
- vector<vector<p2t::Point*> > polylinesRegistry;
-
-
- // Let's be tricky and add our outline to the root node (it should have none), it'll be
- // our first Clipper hole
- PolyNode *rootNode = NULL;
-
- PolyNode tempNode;
- if(polyTree.Total() == 0) // Polytree is empty with no root node, e.g. on an empty level
- rootNode = &tempNode;
- else
- rootNode = polyTree.GetFirst()->Parent;
-
- rootNode->Contour = outline;
-
- // Now traverse our polyline nodes and triangulate them with only their children holes
- PolyNode *currentNode = rootNode;
- while(currentNode != NULL)
- {
- // A Clipper hole is actually what we want to build zones for; they become our bounding
- // polylines. poly2tri holes are therefore the inverse
- if((!ignoreHoles && currentNode->IsHole()) ||
- (!ignoreFills && !currentNode->IsHole()))
- {
- // Build up this polyline in poly2tri's format (downscale Clipper points)
- vector<p2t::Point*> polyline;
- for(U32 j = 0; j < currentNode->Contour.size(); j++)
- polyline.push_back(new p2t::Point(F64(currentNode->Contour[j].X), F64(currentNode->Contour[j].Y)));
-
- polylinesRegistry.push_back(polyline); // Memory
-
- // Set our polyline in poly2tri
- p2t::CDT* cdt = new p2t::CDT(polyline);
- cdtRegistry.push_back(cdt);
-
- for(U32 j = 0; j < currentNode->Childs.size(); j++)
- {
- PolyNode *childNode = currentNode->Childs[j];
-
- // Slightly modify the polygon to guarantee no duplicate points
- edgeShrink(childNode->Contour);
-
- vector<p2t::Point*> hole;
- for(U32 k = 0; k < childNode->Contour.size(); k++)
- hole.push_back(new p2t::Point(F64(childNode->Contour[k].X), F64(childNode->Contour[k].Y)));
-
- holesRegistry.push_back(hole); // Memory
-
- // Add the holes for this polyline
- cdt->AddHole(hole);
- }
-
- cdt->Triangulate();
-
- // Add current output triangles to our total
- vector<p2t::Triangle*> currentOutput = cdt->GetTriangles();
-
- // Copy our data to TNL::Point and to our output Vector
- p2t::Triangle *currentTriangle;
- for(U32 j = 0; j < currentOutput.size(); j++)
- {
- currentTriangle = currentOutput[j];
- outputTriangles.push_back(Point(currentTriangle->GetPoint(0)->x * CLIPPER_SCALE_FACT_INVERSE, currentTriangle->GetPoint(0)->y * CLIPPER_SCALE_FACT_INVERSE));
- outputTriangles.push_back(Point(currentTriangle->GetPoint(1)->x * CLIPPER_SCALE_FACT_INVERSE, currentTriangle->GetPoint(1)->y * CLIPPER_SCALE_FACT_INVERSE));
- outputTriangles.push_back(Point(currentTriangle->GetPoint(2)->x * CLIPPER_SCALE_FACT_INVERSE, currentTriangle->GetPoint(2)->y * CLIPPER_SCALE_FACT_INVERSE));
- }
- }
-
- currentNode = currentNode->GetNext();
- }
-
-
- // Clean up memory used with poly2tri
- //
- // Clean-up workers
- for(S32 i = 0; i < cdtRegistry.size(); i++)
- delete cdtRegistry[i];
-
- // Free the polylines
- for(S32 i = 0; i < polylinesRegistry.size(); i++)
- {
- vector<p2t::Point*> polyline = polylinesRegistry[i];
- deleteAndClear(polyline);
- }
-
- // Free the holes
- for(S32 i = 0; i < holesRegistry.size(); i++)
- {
- vector<p2t::Point*> hole = holesRegistry[i];
- deleteAndClear(hole);
- }
-
- // Make sure we have output data
- if(outputTriangles.size() == 0)
- return false;
-
- return true;
-}
-
-
-} /* namespace c2t */
diff --git a/src/3rdparty/clip2tri/clip2tri.h b/src/3rdparty/clip2tri/clip2tri.h
deleted file mode 100644
index 3848d009..00000000
--- a/src/3rdparty/clip2tri/clip2tri.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Authors: kaen, raptor, sam686, watusimoto
- *
- * Originally from the bitfighter source code
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2014 Bitfighter developers
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef CLIP2TRI_H_
-#define CLIP2TRI_H_
-
-#include <vector>
-#include <clipper.h>
-
-using namespace std;
-using namespace QtClipperLib;
-
-namespace c2t
-{
-
-typedef signed int S32;
-typedef signed long long S64;
-typedef unsigned int U32;
-typedef float F32;
-typedef double F64;
-
-
-struct Point
-{
- F32 x;
- F32 y;
-
- Point();
- Point(const Point &pt);
-
- template<class T, class U>
- Point(T in_x, U in_y) { x = static_cast<F32>(in_x); y = static_cast<F32>(in_y); }
-};
-
-class clip2tri
-{
-private:
- //
- Path upscaleClipperPoints(const vector<Point> &inputPolygon);
-
- // These operate on a vector of polygons
- Paths upscaleClipperPoints(const vector<vector<Point> > &inputPolygons);
- vector<vector<Point> > downscaleClipperPoints(const Paths &inputPolygons);
-
- bool mergePolysToPolyTree(const vector<vector<Point> > &inputPolygons, PolyTree &solution);
-
- bool triangulateComplex(vector<Point> &outputTriangles, const Path &outline,
- const PolyTree &polyTree, bool ignoreFills = true, bool ignoreHoles = false);
-
-public:
- enum Operation { Union, Intersection, Difference, Xor };
- clip2tri();
- virtual ~clip2tri();
-
- void triangulate(const vector<vector<Point> > &inputPolygons, vector<Point> &outputTriangles,
- const vector<Point> &boundingPolygon);
-
- // Clip polygons are intended as closed, even if the first and last vertex aren't the same.
- void addClipPolygon(const Path &path);
- // Closed means the path has to be effectively closed. Meaning path[0] == path[path.size()-1]
- void addSubjectPath(const Path &path, bool closed);
-
- void clearClipper();
-
- Paths execute(const Operation op,
- const PolyFillType subjFillType = pftNonZero,
- const PolyFillType clipFillType = pftNonZero);
-
- static int pointInPolygon(const IntPoint &pt, const Path &path);
-
- Clipper clipper;
- bool openSubject;
-};
-
-} /* namespace c2t */
-
-#endif /* CLIP2TRI_H_ */
diff --git a/src/3rdparty/clip2tri/clip2tri.pro b/src/3rdparty/clip2tri/clip2tri.pro
deleted file mode 100644
index 4059a63a..00000000
--- a/src/3rdparty/clip2tri/clip2tri.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TARGET = qt_clip2tri
-
-CONFIG += staticlib exceptions warn_off optimize_full
-
-INCLUDEPATH += ../poly2tri
-INCLUDEPATH += ../clipper
-
-load(qt_helper_lib)
-
-# workaround for QTBUG-31586
-contains(QT_CONFIG, c++11): CONFIG += c++11
-
-gcc {
- QMAKE_CFLAGS_OPTIMIZE_FULL += -ffast-math
- !clang:!intel_icc:!rim_qcc: QMAKE_CXXFLAGS_WARN_ON += -Wno-error=return-type
-}
-
-HEADERS += clip2tri.h
-SOURCES += clip2tri.cpp
-
-LIBS_PRIVATE += -L$$MODULE_BASE_OUTDIR/lib -lqt_poly2tri$$qtPlatformTargetSuffix() -lqt_clipper$$qtPlatformTargetSuffix()
-
diff --git a/src/3rdparty/clip2tri/qt_attribution.json b/src/3rdparty/clip2tri/qt_attribution.json
deleted file mode 100644
index a4a1f183..00000000
--- a/src/3rdparty/clip2tri/qt_attribution.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "Id": "clip2tri",
- "Name": "Clip2Tri Polygon Triangulation Library",
- "QDocModule": "qtpositioning",
- "QtUsage": "Used in the QML plugin of Qt Location and in Qt Positioning.",
-
- "Description": "Clip2Tri can be used together with Clipper for robust triangulation.",
- "Homepage": "https://github.com/raptor/clip2tri",
- "LicenseId": "MIT",
- "License": "MIT License",
- "LicenseFile": "LICENSE",
- "Copyright": "Copyright (c) 2014 Bitfighter developers"
-}
diff --git a/src/3rdparty/clipper/CMakeLists.txt b/src/3rdparty/clipper/CMakeLists.txt
deleted file mode 100644
index 08f2fada..00000000
--- a/src/3rdparty/clipper/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# Generated from clipper.pro.
-
-#####################################################################
-## Bundled_Clipper Generic Library:
-#####################################################################
-
-qt_internal_add_3rdparty_library(Bundled_Clipper
- QMAKE_LIB_NAME _clipper
- STATIC
- SKIP_AUTOMOC # special case
- EXCEPTIONS
- SOURCES
- clipper.cpp clipper.h
-)
-qt_disable_warnings(Bundled_Clipper)
-qt_set_symbol_visibility_hidden(Bundled_Clipper)
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:clipper.pro:GCC:
-# QMAKE_CFLAGS_OPTIMIZE_FULL = "-ffast-math"
-
-#### Keys ignored in scope 4:.:.:clipper.pro:NOT CLANG AND NOT ICC AND NOT rim_qcc:
-# QMAKE_CXXFLAGS_WARN_ON = "-Wno-error=return-type"
diff --git a/src/3rdparty/clipper/LICENSE b/src/3rdparty/clipper/LICENSE
deleted file mode 100644
index 2213e374..00000000
--- a/src/3rdparty/clipper/LICENSE
+++ /dev/null
@@ -1,48 +0,0 @@
-Use, modification & distribution is subject to Boost Software License Ver 1.
-http://www.boost.org/LICENSE_1_0.txt
-
-Attributions:
-The code in this library is an extension of Bala Vatti's clipping algorithm:
-"A generic solution to polygon clipping"
-Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63.
-http://portal.acm.org/citation.cfm?id=129906
-
-Computer graphics and geometric modeling: implementation and algorithms
-By Max K. Agoston
-Springer; 1 edition (January 4, 2005)
-http://books.google.com/books?q=vatti+clipping+agoston
-
-See also:
-"Polygon Offsetting by Computing Winding Numbers"
-Paper no. DETC2005-85513 pp. 565-575
-ASME 2005 International Design Engineering Technical Conferences
-and Computers and Information in Engineering Conference (IDETC/CIE2005)
-September 24-28, 2005 , Long Beach, California, USA
-http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf
-
-
-
-Boost Software License - Version 1.0 - August 17th, 2003
-http://www.boost.org/LICENSE_1_0.txt
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/src/3rdparty/clipper/clipper.cpp b/src/3rdparty/clipper/clipper.cpp
deleted file mode 100644
index d9735649..00000000
--- a/src/3rdparty/clipper/clipper.cpp
+++ /dev/null
@@ -1,4629 +0,0 @@
-/*******************************************************************************
-* *
-* Author : Angus Johnson *
-* Version : 6.4.2 *
-* Date : 27 February 2017 *
-* Website : http://www.angusj.com *
-* Copyright : Angus Johnson 2010-2017 *
-* *
-* License: *
-* Use, modification & distribution is subject to Boost Software License Ver 1. *
-* http://www.boost.org/LICENSE_1_0.txt *
-* *
-* Attributions: *
-* The code in this library is an extension of Bala Vatti's clipping algorithm: *
-* "A generic solution to polygon clipping" *
-* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. *
-* http://portal.acm.org/citation.cfm?id=129906 *
-* *
-* Computer graphics and geometric modeling: implementation and algorithms *
-* By Max K. Agoston *
-* Springer; 1 edition (January 4, 2005) *
-* http://books.google.com/books?q=vatti+clipping+agoston *
-* *
-* See also: *
-* "Polygon Offsetting by Computing Winding Numbers" *
-* Paper no. DETC2005-85513 pp. 565-575 *
-* ASME 2005 International Design Engineering Technical Conferences *
-* and Computers and Information in Engineering Conference (IDETC/CIE2005) *
-* September 24-28, 2005 , Long Beach, California, USA *
-* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf *
-* *
-*******************************************************************************/
-
-/*******************************************************************************
-* *
-* This is a translation of the Delphi Clipper library and the naming style *
-* used has retained a Delphi flavour. *
-* *
-*******************************************************************************/
-
-#include "clipper.h"
-#include <cmath>
-#include <vector>
-#include <algorithm>
-#include <stdexcept>
-#include <cstring>
-#include <cstdlib>
-#include <ostream>
-#include <functional>
-
-namespace QtClipperLib {
-
-static double const pi = 3.141592653589793238;
-static double const two_pi = pi *2;
-static double const def_arc_tolerance = 0.25;
-
-enum Direction { dRightToLeft, dLeftToRight };
-
-static int const Unassigned = -1; //edge not currently 'owning' a solution
-static int const Skip = -2; //edge that would otherwise close a path
-
-#define HORIZONTAL (-1.0E+40)
-#define TOLERANCE (1.0e-20)
-#define NEAR_ZERO(val) (((val) > -TOLERANCE) && ((val) < TOLERANCE))
-
-struct TEdge {
- IntPoint Bot;
- IntPoint Curr; //current (updated for every new scanbeam)
- IntPoint Top;
- double Dx;
- PolyType PolyTyp;
- EdgeSide Side; //side only refers to current side of solution poly
- int WindDelta; //1 or -1 depending on winding direction
- int WindCnt;
- int WindCnt2; //winding count of the opposite polytype
- int OutIdx;
- TEdge *Next;
- TEdge *Prev;
- TEdge *NextInLML;
- TEdge *NextInAEL;
- TEdge *PrevInAEL;
- TEdge *NextInSEL;
- TEdge *PrevInSEL;
-};
-
-struct IntersectNode {
- TEdge *Edge1;
- TEdge *Edge2;
- IntPoint Pt;
-};
-
-struct LocalMinimum {
- cInt Y;
- TEdge *LeftBound;
- TEdge *RightBound;
-};
-
-struct OutPt;
-
-//OutRec: contains a path in the clipping solution. Edges in the AEL will
-//carry a pointer to an OutRec when they are part of the clipping solution.
-struct OutRec {
- int Idx;
- bool IsHole;
- bool IsOpen;
- OutRec *FirstLeft; //see comments in clipper.pas
- PolyNode *PolyNd;
- OutPt *Pts;
- OutPt *BottomPt;
-};
-
-struct OutPt {
- int Idx;
- IntPoint Pt;
- OutPt *Next;
- OutPt *Prev;
-};
-
-struct Join {
- OutPt *OutPt1;
- OutPt *OutPt2;
- IntPoint OffPt;
-};
-
-struct LocMinSorter
-{
- inline bool operator()(const LocalMinimum& locMin1, const LocalMinimum& locMin2)
- {
- return locMin2.Y < locMin1.Y;
- }
-};
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-inline cInt Round(double val)
-{
- if ((val < 0)) return static_cast<cInt>(val - 0.5);
- else return static_cast<cInt>(val + 0.5);
-}
-//------------------------------------------------------------------------------
-
-inline cInt Abs(cInt val)
-{
- return val < 0 ? -val : val;
-}
-
-//------------------------------------------------------------------------------
-// PolyTree methods ...
-//------------------------------------------------------------------------------
-
-void PolyTree::Clear()
-{
- for (PolyNodes::size_type i = 0; i < AllNodes.size(); ++i)
- delete AllNodes[i];
- AllNodes.resize(0);
- Childs.resize(0);
-}
-//------------------------------------------------------------------------------
-
-PolyNode* PolyTree::GetFirst() const
-{
- if (!Childs.empty())
- return Childs[0];
- else
- return 0;
-}
-//------------------------------------------------------------------------------
-
-int PolyTree::Total() const
-{
- int result = (int)AllNodes.size();
- //with negative offsets, ignore the hidden outer polygon ...
- if (result > 0 && Childs[0] != AllNodes[0]) result--;
- return result;
-}
-
-//------------------------------------------------------------------------------
-// PolyNode methods ...
-//------------------------------------------------------------------------------
-
-PolyNode::PolyNode(): Parent(0), Index(0), m_IsOpen(false)
-{
-}
-//------------------------------------------------------------------------------
-
-int PolyNode::ChildCount() const
-{
- return (int)Childs.size();
-}
-//------------------------------------------------------------------------------
-
-void PolyNode::AddChild(PolyNode& child)
-{
- unsigned cnt = (unsigned)Childs.size();
- Childs.push_back(&child);
- child.Parent = this;
- child.Index = cnt;
-}
-//------------------------------------------------------------------------------
-
-PolyNode* PolyNode::GetNext() const
-{
- if (!Childs.empty())
- return Childs[0];
- else
- return GetNextSiblingUp();
-}
-//------------------------------------------------------------------------------
-
-PolyNode* PolyNode::GetNextSiblingUp() const
-{
- if (!Parent) //protects against PolyTree.GetNextSiblingUp()
- return 0;
- else if (Index == Parent->Childs.size() - 1)
- return Parent->GetNextSiblingUp();
- else
- return Parent->Childs[Index + 1];
-}
-//------------------------------------------------------------------------------
-
-bool PolyNode::IsHole() const
-{
- bool result = true;
- PolyNode* node = Parent;
- while (node)
- {
- result = !result;
- node = node->Parent;
- }
- return result;
-}
-//------------------------------------------------------------------------------
-
-bool PolyNode::IsOpen() const
-{
- return m_IsOpen;
-}
-//------------------------------------------------------------------------------
-
-#ifndef use_int32
-
-//------------------------------------------------------------------------------
-// Int128 class (enables safe math on signed 64bit integers)
-// eg Int128 val1((long64)9223372036854775807); //ie 2^63 -1
-// Int128 val2((long64)9223372036854775807);
-// Int128 val3 = val1 * val2;
-// val3.AsString => "85070591730234615847396907784232501249" (8.5e+37)
-//------------------------------------------------------------------------------
-
-class Int128
-{
- public:
- ulong64 lo;
- long64 hi;
-
- Int128(long64 _lo = 0)
- {
- lo = (ulong64)_lo;
- if (_lo < 0) hi = -1; else hi = 0;
- }
-
-
- Int128(const Int128 &val): lo(val.lo), hi(val.hi){}
-
- Int128(const long64& _hi, const ulong64& _lo): lo(_lo), hi(_hi){}
-
- Int128& operator = (const long64 &val)
- {
- lo = (ulong64)val;
- if (val < 0) hi = -1; else hi = 0;
- return *this;
- }
-
- bool operator == (const Int128 &val) const
- {return (hi == val.hi && lo == val.lo);}
-
- bool operator != (const Int128 &val) const
- { return !(*this == val);}
-
- bool operator > (const Int128 &val) const
- {
- if (hi != val.hi)
- return hi > val.hi;
- else
- return lo > val.lo;
- }
-
- bool operator < (const Int128 &val) const
- {
- if (hi != val.hi)
- return hi < val.hi;
- else
- return lo < val.lo;
- }
-
- bool operator >= (const Int128 &val) const
- { return !(*this < val);}
-
- bool operator <= (const Int128 &val) const
- { return !(*this > val);}
-
- Int128& operator += (const Int128 &rhs)
- {
- hi += rhs.hi;
- lo += rhs.lo;
- if (lo < rhs.lo) hi++;
- return *this;
- }
-
- Int128 operator + (const Int128 &rhs) const
- {
- Int128 result(*this);
- result+= rhs;
- return result;
- }
-
- Int128& operator -= (const Int128 &rhs)
- {
- *this += -rhs;
- return *this;
- }
-
- Int128 operator - (const Int128 &rhs) const
- {
- Int128 result(*this);
- result -= rhs;
- return result;
- }
-
- Int128 operator-() const //unary negation
- {
- if (lo == 0)
- return Int128(-hi, 0);
- else
- return Int128(~hi, ~lo + 1);
- }
-
- operator double() const
- {
- const double shift64 = 18446744073709551616.0; //2^64
- if (hi < 0)
- {
- if (lo == 0) return (double)hi * shift64;
- else return -(double)(~lo + ~hi * shift64);
- }
- else
- return (double)(lo + hi * shift64);
- }
-
-};
-//------------------------------------------------------------------------------
-
-Int128 Int128Mul (long64 lhs, long64 rhs)
-{
- bool negate = (lhs < 0) != (rhs < 0);
-
- if (lhs < 0) lhs = -lhs;
- ulong64 int1Hi = ulong64(lhs) >> 32;
- ulong64 int1Lo = ulong64(lhs & 0xFFFFFFFF);
-
- if (rhs < 0) rhs = -rhs;
- ulong64 int2Hi = ulong64(rhs) >> 32;
- ulong64 int2Lo = ulong64(rhs & 0xFFFFFFFF);
-
- //nb: see comments in clipper.pas
- ulong64 a = int1Hi * int2Hi;
- ulong64 b = int1Lo * int2Lo;
- ulong64 c = int1Hi * int2Lo + int1Lo * int2Hi;
-
- Int128 tmp;
- tmp.hi = long64(a + (c >> 32));
- tmp.lo = long64(c << 32);
- tmp.lo += long64(b);
- if (tmp.lo < b) tmp.hi++;
- if (negate) tmp = -tmp;
- return tmp;
-};
-#endif
-
-//------------------------------------------------------------------------------
-// Miscellaneous global functions
-//------------------------------------------------------------------------------
-
-bool Orientation(const Path &poly)
-{
- return Area(poly) >= 0;
-}
-//------------------------------------------------------------------------------
-
-double Area(const Path &poly)
-{
- int size = (int)poly.size();
- if (size < 3) return 0;
-
- double a = 0;
- for (int i = 0, j = size -1; i < size; ++i)
- {
- a += ((double)poly[j].X + poly[i].X) * ((double)poly[j].Y - poly[i].Y);
- j = i;
- }
- return -a * 0.5;
-}
-//------------------------------------------------------------------------------
-
-double Area(const OutPt *op)
-{
- const OutPt *startOp = op;
- if (!op) return 0;
- double a = 0;
- do {
- a += (double)(op->Prev->Pt.X + op->Pt.X) * (double)(op->Prev->Pt.Y - op->Pt.Y);
- op = op->Next;
- } while (op != startOp);
- return a * 0.5;
-}
-//------------------------------------------------------------------------------
-
-double Area(const OutRec &outRec)
-{
- return Area(outRec.Pts);
-}
-//------------------------------------------------------------------------------
-
-bool PointIsVertex(const IntPoint &Pt, OutPt *pp)
-{
- OutPt *pp2 = pp;
- do
- {
- if (pp2->Pt == Pt) return true;
- pp2 = pp2->Next;
- }
- while (pp2 != pp);
- return false;
-}
-//------------------------------------------------------------------------------
-
-//See "The Point in Polygon Problem for Arbitrary Polygons" by Hormann & Agathos
-//http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.5498&rep=rep1&type=pdf
-int PointInPolygon(const IntPoint &pt, const Path &path)
-{
- //returns 0 if false, +1 if true, -1 if pt ON polygon boundary
- int result = 0;
- size_t cnt = path.size();
- if (cnt < 3) return 0;
- IntPoint ip = path[0];
- for(size_t i = 1; i <= cnt; ++i)
- {
- IntPoint ipNext = (i == cnt ? path[0] : path[i]);
- if (ipNext.Y == pt.Y)
- {
- if ((ipNext.X == pt.X) || (ip.Y == pt.Y &&
- ((ipNext.X > pt.X) == (ip.X < pt.X)))) return -1;
- }
- if ((ip.Y < pt.Y) != (ipNext.Y < pt.Y))
- {
- if (ip.X >= pt.X)
- {
- if (ipNext.X > pt.X) result = 1 - result;
- else
- {
- double d = (double)(ip.X - pt.X) * (ipNext.Y - pt.Y) -
- (double)(ipNext.X - pt.X) * (ip.Y - pt.Y);
- if (!d) return -1;
- if ((d > 0) == (ipNext.Y > ip.Y)) result = 1 - result;
- }
- } else
- {
- if (ipNext.X > pt.X)
- {
- double d = (double)(ip.X - pt.X) * (ipNext.Y - pt.Y) -
- (double)(ipNext.X - pt.X) * (ip.Y - pt.Y);
- if (!d) return -1;
- if ((d > 0) == (ipNext.Y > ip.Y)) result = 1 - result;
- }
- }
- }
- ip = ipNext;
- }
- return result;
-}
-//------------------------------------------------------------------------------
-
-int PointInPolygon (const IntPoint &pt, OutPt *op)
-{
- //returns 0 if false, +1 if true, -1 if pt ON polygon boundary
- int result = 0;
- OutPt* startOp = op;
- for(;;)
- {
- if (op->Next->Pt.Y == pt.Y)
- {
- if ((op->Next->Pt.X == pt.X) || (op->Pt.Y == pt.Y &&
- ((op->Next->Pt.X > pt.X) == (op->Pt.X < pt.X)))) return -1;
- }
- if ((op->Pt.Y < pt.Y) != (op->Next->Pt.Y < pt.Y))
- {
- if (op->Pt.X >= pt.X)
- {
- if (op->Next->Pt.X > pt.X) result = 1 - result;
- else
- {
- double d = (double)(op->Pt.X - pt.X) * (op->Next->Pt.Y - pt.Y) -
- (double)(op->Next->Pt.X - pt.X) * (op->Pt.Y - pt.Y);
- if (!d) return -1;
- if ((d > 0) == (op->Next->Pt.Y > op->Pt.Y)) result = 1 - result;
- }
- } else
- {
- if (op->Next->Pt.X > pt.X)
- {
- double d = (double)(op->Pt.X - pt.X) * (op->Next->Pt.Y - pt.Y) -
- (double)(op->Next->Pt.X - pt.X) * (op->Pt.Y - pt.Y);
- if (!d) return -1;
- if ((d > 0) == (op->Next->Pt.Y > op->Pt.Y)) result = 1 - result;
- }
- }
- }
- op = op->Next;
- if (startOp == op) break;
- }
- return result;
-}
-//------------------------------------------------------------------------------
-
-bool Poly2ContainsPoly1(OutPt *OutPt1, OutPt *OutPt2)
-{
- OutPt* op = OutPt1;
- do
- {
- //nb: PointInPolygon returns 0 if false, +1 if true, -1 if pt on polygon
- int res = PointInPolygon(op->Pt, OutPt2);
- if (res >= 0) return res > 0;
- op = op->Next;
- }
- while (op != OutPt1);
- return true;
-}
-//----------------------------------------------------------------------
-
-bool SlopesEqual(const TEdge &e1, const TEdge &e2, bool UseFullInt64Range)
-{
-#ifndef use_int32
- if (UseFullInt64Range)
- return Int128Mul(e1.Top.Y - e1.Bot.Y, e2.Top.X - e2.Bot.X) ==
- Int128Mul(e1.Top.X - e1.Bot.X, e2.Top.Y - e2.Bot.Y);
- else
-#endif
- return (e1.Top.Y - e1.Bot.Y) * (e2.Top.X - e2.Bot.X) ==
- (e1.Top.X - e1.Bot.X) * (e2.Top.Y - e2.Bot.Y);
-}
-//------------------------------------------------------------------------------
-
-bool SlopesEqual(const IntPoint pt1, const IntPoint pt2,
- const IntPoint pt3, bool UseFullInt64Range)
-{
-#ifndef use_int32
- if (UseFullInt64Range)
- return Int128Mul(pt1.Y-pt2.Y, pt2.X-pt3.X) == Int128Mul(pt1.X-pt2.X, pt2.Y-pt3.Y);
- else
-#endif
- return (pt1.Y-pt2.Y)*(pt2.X-pt3.X) == (pt1.X-pt2.X)*(pt2.Y-pt3.Y);
-}
-//------------------------------------------------------------------------------
-
-bool SlopesEqual(const IntPoint pt1, const IntPoint pt2,
- const IntPoint pt3, const IntPoint pt4, bool UseFullInt64Range)
-{
-#ifndef use_int32
- if (UseFullInt64Range)
- return Int128Mul(pt1.Y-pt2.Y, pt3.X-pt4.X) == Int128Mul(pt1.X-pt2.X, pt3.Y-pt4.Y);
- else
-#endif
- return (pt1.Y-pt2.Y)*(pt3.X-pt4.X) == (pt1.X-pt2.X)*(pt3.Y-pt4.Y);
-}
-//------------------------------------------------------------------------------
-
-inline bool IsHorizontal(TEdge &e)
-{
- return e.Dx == HORIZONTAL;
-}
-//------------------------------------------------------------------------------
-
-inline double GetDx(const IntPoint pt1, const IntPoint pt2)
-{
- return (pt1.Y == pt2.Y) ?
- HORIZONTAL : (double)(pt2.X - pt1.X) / (pt2.Y - pt1.Y);
-}
-//---------------------------------------------------------------------------
-
-inline void SetDx(TEdge &e)
-{
- cInt dy = (e.Top.Y - e.Bot.Y);
- if (dy == 0) e.Dx = HORIZONTAL;
- else e.Dx = (double)(e.Top.X - e.Bot.X) / dy;
-}
-//---------------------------------------------------------------------------
-
-inline void SwapSides(TEdge &Edge1, TEdge &Edge2)
-{
- EdgeSide Side = Edge1.Side;
- Edge1.Side = Edge2.Side;
- Edge2.Side = Side;
-}
-//------------------------------------------------------------------------------
-
-inline void SwapPolyIndexes(TEdge &Edge1, TEdge &Edge2)
-{
- int OutIdx = Edge1.OutIdx;
- Edge1.OutIdx = Edge2.OutIdx;
- Edge2.OutIdx = OutIdx;
-}
-//------------------------------------------------------------------------------
-
-inline cInt TopX(TEdge &edge, const cInt currentY)
-{
- return ( currentY == edge.Top.Y ) ?
- edge.Top.X : edge.Bot.X + Round(edge.Dx *(currentY - edge.Bot.Y));
-}
-//------------------------------------------------------------------------------
-
-void IntersectPoint(TEdge &Edge1, TEdge &Edge2, IntPoint &ip)
-{
-#ifdef use_xyz
- ip.Z = 0;
-#endif
-
- double b1, b2;
- if (Edge1.Dx == Edge2.Dx)
- {
- ip.Y = Edge1.Curr.Y;
- ip.X = TopX(Edge1, ip.Y);
- return;
- }
- else if (Edge1.Dx == 0)
- {
- ip.X = Edge1.Bot.X;
- if (IsHorizontal(Edge2))
- ip.Y = Edge2.Bot.Y;
- else
- {
- b2 = Edge2.Bot.Y - (Edge2.Bot.X / Edge2.Dx);
- ip.Y = Round(ip.X / Edge2.Dx + b2);
- }
- }
- else if (Edge2.Dx == 0)
- {
- ip.X = Edge2.Bot.X;
- if (IsHorizontal(Edge1))
- ip.Y = Edge1.Bot.Y;
- else
- {
- b1 = Edge1.Bot.Y - (Edge1.Bot.X / Edge1.Dx);
- ip.Y = Round(ip.X / Edge1.Dx + b1);
- }
- }
- else
- {
- b1 = Edge1.Bot.X - Edge1.Bot.Y * Edge1.Dx;
- b2 = Edge2.Bot.X - Edge2.Bot.Y * Edge2.Dx;
- double q = (b2-b1) / (Edge1.Dx - Edge2.Dx);
- ip.Y = Round(q);
- if (std::fabs(Edge1.Dx) < std::fabs(Edge2.Dx))
- ip.X = Round(Edge1.Dx * q + b1);
- else
- ip.X = Round(Edge2.Dx * q + b2);
- }
-
- if (ip.Y < Edge1.Top.Y || ip.Y < Edge2.Top.Y)
- {
- if (Edge1.Top.Y > Edge2.Top.Y)
- ip.Y = Edge1.Top.Y;
- else
- ip.Y = Edge2.Top.Y;
- if (std::fabs(Edge1.Dx) < std::fabs(Edge2.Dx))
- ip.X = TopX(Edge1, ip.Y);
- else
- ip.X = TopX(Edge2, ip.Y);
- }
- //finally, don't allow 'ip' to be BELOW curr.Y (ie bottom of scanbeam) ...
- if (ip.Y > Edge1.Curr.Y)
- {
- ip.Y = Edge1.Curr.Y;
- //use the more vertical edge to derive X ...
- if (std::fabs(Edge1.Dx) > std::fabs(Edge2.Dx))
- ip.X = TopX(Edge2, ip.Y); else
- ip.X = TopX(Edge1, ip.Y);
- }
-}
-//------------------------------------------------------------------------------
-
-void ReversePolyPtLinks(OutPt *pp)
-{
- if (!pp) return;
- OutPt *pp1, *pp2;
- pp1 = pp;
- do {
- pp2 = pp1->Next;
- pp1->Next = pp1->Prev;
- pp1->Prev = pp2;
- pp1 = pp2;
- } while( pp1 != pp );
-}
-//------------------------------------------------------------------------------
-
-void DisposeOutPts(OutPt*& pp)
-{
- if (pp == 0) return;
- pp->Prev->Next = 0;
- while( pp )
- {
- OutPt *tmpPp = pp;
- pp = pp->Next;
- delete tmpPp;
- }
-}
-//------------------------------------------------------------------------------
-
-inline void InitEdge(TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt)
-{
- std::memset(e, 0, sizeof(TEdge));
- e->Next = eNext;
- e->Prev = ePrev;
- e->Curr = Pt;
- e->OutIdx = Unassigned;
-}
-//------------------------------------------------------------------------------
-
-void InitEdge2(TEdge& e, PolyType Pt)
-{
- if (e.Curr.Y >= e.Next->Curr.Y)
- {
- e.Bot = e.Curr;
- e.Top = e.Next->Curr;
- } else
- {
- e.Top = e.Curr;
- e.Bot = e.Next->Curr;
- }
- SetDx(e);
- e.PolyTyp = Pt;
-}
-//------------------------------------------------------------------------------
-
-TEdge* RemoveEdge(TEdge* e)
-{
- //removes e from double_linked_list (but without removing from memory)
- e->Prev->Next = e->Next;
- e->Next->Prev = e->Prev;
- TEdge* result = e->Next;
- e->Prev = 0; //flag as removed (see ClipperBase.Clear)
- return result;
-}
-//------------------------------------------------------------------------------
-
-inline void ReverseHorizontal(TEdge &e)
-{
- //swap horizontal edges' Top and Bottom x's so they follow the natural
- //progression of the bounds - ie so their xbots will align with the
- //adjoining lower edge. [Helpful in the ProcessHorizontal() method.]
- std::swap(e.Top.X, e.Bot.X);
-#ifdef use_xyz
- std::swap(e.Top.Z, e.Bot.Z);
-#endif
-}
-//------------------------------------------------------------------------------
-
-void SwapPoints(IntPoint &pt1, IntPoint &pt2)
-{
- IntPoint tmp = pt1;
- pt1 = pt2;
- pt2 = tmp;
-}
-//------------------------------------------------------------------------------
-
-bool GetOverlapSegment(IntPoint pt1a, IntPoint pt1b, IntPoint pt2a,
- IntPoint pt2b, IntPoint &pt1, IntPoint &pt2)
-{
- //precondition: segments are Collinear.
- if (Abs(pt1a.X - pt1b.X) > Abs(pt1a.Y - pt1b.Y))
- {
- if (pt1a.X > pt1b.X) SwapPoints(pt1a, pt1b);
- if (pt2a.X > pt2b.X) SwapPoints(pt2a, pt2b);
- if (pt1a.X > pt2a.X) pt1 = pt1a; else pt1 = pt2a;
- if (pt1b.X < pt2b.X) pt2 = pt1b; else pt2 = pt2b;
- return pt1.X < pt2.X;
- } else
- {
- if (pt1a.Y < pt1b.Y) SwapPoints(pt1a, pt1b);
- if (pt2a.Y < pt2b.Y) SwapPoints(pt2a, pt2b);
- if (pt1a.Y < pt2a.Y) pt1 = pt1a; else pt1 = pt2a;
- if (pt1b.Y > pt2b.Y) pt2 = pt1b; else pt2 = pt2b;
- return pt1.Y > pt2.Y;
- }
-}
-//------------------------------------------------------------------------------
-
-bool FirstIsBottomPt(const OutPt* btmPt1, const OutPt* btmPt2)
-{
- OutPt *p = btmPt1->Prev;
- while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Prev;
- double dx1p = std::fabs(GetDx(btmPt1->Pt, p->Pt));
- p = btmPt1->Next;
- while ((p->Pt == btmPt1->Pt) && (p != btmPt1)) p = p->Next;
- double dx1n = std::fabs(GetDx(btmPt1->Pt, p->Pt));
-
- p = btmPt2->Prev;
- while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Prev;
- double dx2p = std::fabs(GetDx(btmPt2->Pt, p->Pt));
- p = btmPt2->Next;
- while ((p->Pt == btmPt2->Pt) && (p != btmPt2)) p = p->Next;
- double dx2n = std::fabs(GetDx(btmPt2->Pt, p->Pt));
-
- if (std::max(dx1p, dx1n) == std::max(dx2p, dx2n) &&
- std::min(dx1p, dx1n) == std::min(dx2p, dx2n))
- return Area(btmPt1) > 0; //if otherwise identical use orientation
- else
- return (dx1p >= dx2p && dx1p >= dx2n) || (dx1n >= dx2p && dx1n >= dx2n);
-}
-//------------------------------------------------------------------------------
-
-OutPt* GetBottomPt(OutPt *pp)
-{
- OutPt* dups = 0;
- OutPt* p = pp->Next;
- while (p != pp)
- {
- if (p->Pt.Y > pp->Pt.Y)
- {
- pp = p;
- dups = 0;
- }
- else if (p->Pt.Y == pp->Pt.Y && p->Pt.X <= pp->Pt.X)
- {
- if (p->Pt.X < pp->Pt.X)
- {
- dups = 0;
- pp = p;
- } else
- {
- if (p->Next != pp && p->Prev != pp) dups = p;
- }
- }
- p = p->Next;
- }
- if (dups)
- {
- //there appears to be at least 2 vertices at BottomPt so ...
- while (dups != p)
- {
- if (!FirstIsBottomPt(p, dups)) pp = dups;
- dups = dups->Next;
- while (dups->Pt != pp->Pt) dups = dups->Next;
- }
- }
- return pp;
-}
-//------------------------------------------------------------------------------
-
-bool Pt2IsBetweenPt1AndPt3(const IntPoint pt1,
- const IntPoint pt2, const IntPoint pt3)
-{
- if ((pt1 == pt3) || (pt1 == pt2) || (pt3 == pt2))
- return false;
- else if (pt1.X != pt3.X)
- return (pt2.X > pt1.X) == (pt2.X < pt3.X);
- else
- return (pt2.Y > pt1.Y) == (pt2.Y < pt3.Y);
-}
-//------------------------------------------------------------------------------
-
-bool HorzSegmentsOverlap(cInt seg1a, cInt seg1b, cInt seg2a, cInt seg2b)
-{
- if (seg1a > seg1b) std::swap(seg1a, seg1b);
- if (seg2a > seg2b) std::swap(seg2a, seg2b);
- return (seg1a < seg2b) && (seg2a < seg1b);
-}
-
-//------------------------------------------------------------------------------
-// ClipperBase class methods ...
-//------------------------------------------------------------------------------
-
-ClipperBase::ClipperBase() //constructor
-{
- m_CurrentLM = m_MinimaList.begin(); //begin() == end() here
- m_UseFullRange = false;
-}
-//------------------------------------------------------------------------------
-
-ClipperBase::~ClipperBase() //destructor
-{
- Clear();
-}
-//------------------------------------------------------------------------------
-
-void RangeTest(const IntPoint& Pt, bool& useFullRange)
-{
- if (useFullRange)
- {
- if (Pt.X > hiRange || Pt.Y > hiRange || -Pt.X > hiRange || -Pt.Y > hiRange)
- throw clipperException("Coordinate outside allowed range");
- }
- else if (Pt.X > loRange|| Pt.Y > loRange || -Pt.X > loRange || -Pt.Y > loRange)
- {
- useFullRange = true;
- RangeTest(Pt, useFullRange);
- }
-}
-//------------------------------------------------------------------------------
-
-TEdge* FindNextLocMin(TEdge* E)
-{
- for (;;)
- {
- while (E->Bot != E->Prev->Bot || E->Curr == E->Top) E = E->Next;
- if (!IsHorizontal(*E) && !IsHorizontal(*E->Prev)) break;
- while (IsHorizontal(*E->Prev)) E = E->Prev;
- TEdge* E2 = E;
- while (IsHorizontal(*E)) E = E->Next;
- if (E->Top.Y == E->Prev->Bot.Y) continue; //ie just an intermediate horz.
- if (E2->Prev->Bot.X < E->Bot.X) E = E2;
- break;
- }
- return E;
-}
-//------------------------------------------------------------------------------
-
-TEdge* ClipperBase::ProcessBound(TEdge* E, bool NextIsForward)
-{
- TEdge *Result = E;
- TEdge *Horz = 0;
-
- if (E->OutIdx == Skip)
- {
- //if edges still remain in the current bound beyond the skip edge then
- //create another LocMin and call ProcessBound once more
- if (NextIsForward)
- {
- while (E->Top.Y == E->Next->Bot.Y) E = E->Next;
- //don't include top horizontals when parsing a bound a second time,
- //they will be contained in the opposite bound ...
- while (E != Result && IsHorizontal(*E)) E = E->Prev;
- }
- else
- {
- while (E->Top.Y == E->Prev->Bot.Y) E = E->Prev;
- while (E != Result && IsHorizontal(*E)) E = E->Next;
- }
-
- if (E == Result)
- {
- if (NextIsForward) Result = E->Next;
- else Result = E->Prev;
- }
- else
- {
- //there are more edges in the bound beyond result starting with E
- if (NextIsForward)
- E = Result->Next;
- else
- E = Result->Prev;
- MinimaList::value_type locMin;
- locMin.Y = E->Bot.Y;
- locMin.LeftBound = 0;
- locMin.RightBound = E;
- E->WindDelta = 0;
- Result = ProcessBound(E, NextIsForward);
- m_MinimaList.push_back(locMin);
- }
- return Result;
- }
-
- TEdge *EStart;
-
- if (IsHorizontal(*E))
- {
- //We need to be careful with open paths because this may not be a
- //true local minima (ie E may be following a skip edge).
- //Also, consecutive horz. edges may start heading left before going right.
- if (NextIsForward)
- EStart = E->Prev;
- else
- EStart = E->Next;
- if (IsHorizontal(*EStart)) //ie an adjoining horizontal skip edge
- {
- if (EStart->Bot.X != E->Bot.X && EStart->Top.X != E->Bot.X)
- ReverseHorizontal(*E);
- }
- else if (EStart->Bot.X != E->Bot.X)
- ReverseHorizontal(*E);
- }
-
- EStart = E;
- if (NextIsForward)
- {
- while (Result->Top.Y == Result->Next->Bot.Y && Result->Next->OutIdx != Skip)
- Result = Result->Next;
- if (IsHorizontal(*Result) && Result->Next->OutIdx != Skip)
- {
- //nb: at the top of a bound, horizontals are added to the bound
- //only when the preceding edge attaches to the horizontal's left vertex
- //unless a Skip edge is encountered when that becomes the top divide
- Horz = Result;
- while (IsHorizontal(*Horz->Prev)) Horz = Horz->Prev;
- if (Horz->Prev->Top.X > Result->Next->Top.X) Result = Horz->Prev;
- }
- while (E != Result)
- {
- E->NextInLML = E->Next;
- if (IsHorizontal(*E) && E != EStart &&
- E->Bot.X != E->Prev->Top.X) ReverseHorizontal(*E);
- E = E->Next;
- }
- if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Prev->Top.X)
- ReverseHorizontal(*E);
- Result = Result->Next; //move to the edge just beyond current bound
- } else
- {
- while (Result->Top.Y == Result->Prev->Bot.Y && Result->Prev->OutIdx != Skip)
- Result = Result->Prev;
- if (IsHorizontal(*Result) && Result->Prev->OutIdx != Skip)
- {
- Horz = Result;
- while (IsHorizontal(*Horz->Next)) Horz = Horz->Next;
- if (Horz->Next->Top.X == Result->Prev->Top.X ||
- Horz->Next->Top.X > Result->Prev->Top.X) Result = Horz->Next;
- }
-
- while (E != Result)
- {
- E->NextInLML = E->Prev;
- if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Next->Top.X)
- ReverseHorizontal(*E);
- E = E->Prev;
- }
- if (IsHorizontal(*E) && E != EStart && E->Bot.X != E->Next->Top.X)
- ReverseHorizontal(*E);
- Result = Result->Prev; //move to the edge just beyond current bound
- }
-
- return Result;
-}
-//------------------------------------------------------------------------------
-
-bool ClipperBase::AddPath(const Path &pg, PolyType PolyTyp, bool Closed)
-{
-#ifdef use_lines
- if (!Closed && PolyTyp == ptClip)
- throw clipperException("AddPath: Open paths must be subject.");
-#else
- if (!Closed)
- throw clipperException("AddPath: Open paths have been disabled.");
-#endif
-
- int highI = (int)pg.size() -1;
- if (Closed) while (highI > 0 && (pg[highI] == pg[0])) --highI;
- while (highI > 0 && (pg[highI] == pg[highI -1])) --highI;
- if ((Closed && highI < 2) || (!Closed && highI < 1)) return false;
-
- //create a new edge array ...
- TEdge *edges = new TEdge [highI +1];
-
- bool IsFlat = true;
- //1. Basic (first) edge initialization ...
- try
- {
- edges[1].Curr = pg[1];
- RangeTest(pg[0], m_UseFullRange);
- RangeTest(pg[highI], m_UseFullRange);
- InitEdge(&edges[0], &edges[1], &edges[highI], pg[0]);
- InitEdge(&edges[highI], &edges[0], &edges[highI-1], pg[highI]);
- for (int i = highI - 1; i >= 1; --i)
- {
- RangeTest(pg[i], m_UseFullRange);
- InitEdge(&edges[i], &edges[i+1], &edges[i-1], pg[i]);
- }
- }
- catch(...)
- {
- delete [] edges;
- throw; //range test fails
- }
- TEdge *eStart = &edges[0];
-
- //2. Remove duplicate vertices, and (when closed) collinear edges ...
- TEdge *E = eStart, *eLoopStop = eStart;
- for (;;)
- {
- //nb: allows matching start and end points when not Closed ...
- if (E->Curr == E->Next->Curr && (Closed || E->Next != eStart))
- {
- if (E == E->Next) break;
- if (E == eStart) eStart = E->Next;
- E = RemoveEdge(E);
- eLoopStop = E;
- continue;
- }
- if (E->Prev == E->Next)
- break; //only two vertices
- else if (Closed &&
- SlopesEqual(E->Prev->Curr, E->Curr, E->Next->Curr, m_UseFullRange) &&
- (!m_PreserveCollinear ||
- !Pt2IsBetweenPt1AndPt3(E->Prev->Curr, E->Curr, E->Next->Curr)))
- {
- //Collinear edges are allowed for open paths but in closed paths
- //the default is to merge adjacent collinear edges into a single edge.
- //However, if the PreserveCollinear property is enabled, only overlapping
- //collinear edges (ie spikes) will be removed from closed paths.
- if (E == eStart) eStart = E->Next;
- E = RemoveEdge(E);
- E = E->Prev;
- eLoopStop = E;
- continue;
- }
- E = E->Next;
- if ((E == eLoopStop) || (!Closed && E->Next == eStart)) break;
- }
-
- if ((!Closed && (E == E->Next)) || (Closed && (E->Prev == E->Next)))
- {
- delete [] edges;
- return false;
- }
-
- if (!Closed)
- {
- m_HasOpenPaths = true;
- eStart->Prev->OutIdx = Skip;
- }
-
- //3. Do second stage of edge initialization ...
- E = eStart;
- do
- {
- InitEdge2(*E, PolyTyp);
- E = E->Next;
- if (IsFlat && E->Curr.Y != eStart->Curr.Y) IsFlat = false;
- }
- while (E != eStart);
-
- //4. Finally, add edge bounds to LocalMinima list ...
-
- //Totally flat paths must be handled differently when adding them
- //to LocalMinima list to avoid endless loops etc ...
- if (IsFlat)
- {
- if (Closed)
- {
- delete [] edges;
- return false;
- }
- E->Prev->OutIdx = Skip;
- MinimaList::value_type locMin;
- locMin.Y = E->Bot.Y;
- locMin.LeftBound = 0;
- locMin.RightBound = E;
- locMin.RightBound->Side = esRight;
- locMin.RightBound->WindDelta = 0;
- for (;;)
- {
- if (E->Bot.X != E->Prev->Top.X) ReverseHorizontal(*E);
- if (E->Next->OutIdx == Skip) break;
- E->NextInLML = E->Next;
- E = E->Next;
- }
- m_MinimaList.push_back(locMin);
- m_edges.push_back(edges);
- return true;
- }
-
- m_edges.push_back(edges);
- bool leftBoundIsForward;
- TEdge* EMin = 0;
-
- //workaround to avoid an endless loop in the while loop below when
- //open paths have matching start and end points ...
- if (E->Prev->Bot == E->Prev->Top) E = E->Next;
-
- for (;;)
- {
- E = FindNextLocMin(E);
- if (E == EMin) break;
- else if (!EMin) EMin = E;
-
- //E and E.Prev now share a local minima (left aligned if horizontal).
- //Compare their slopes to find which starts which bound ...
- MinimaList::value_type locMin;
- locMin.Y = E->Bot.Y;
- if (E->Dx < E->Prev->Dx)
- {
- locMin.LeftBound = E->Prev;
- locMin.RightBound = E;
- leftBoundIsForward = false; //Q.nextInLML = Q.prev
- } else
- {
- locMin.LeftBound = E;
- locMin.RightBound = E->Prev;
- leftBoundIsForward = true; //Q.nextInLML = Q.next
- }
-
- if (!Closed) locMin.LeftBound->WindDelta = 0;
- else if (locMin.LeftBound->Next == locMin.RightBound)
- locMin.LeftBound->WindDelta = -1;
- else locMin.LeftBound->WindDelta = 1;
- locMin.RightBound->WindDelta = -locMin.LeftBound->WindDelta;
-
- E = ProcessBound(locMin.LeftBound, leftBoundIsForward);
- if (E->OutIdx == Skip) E = ProcessBound(E, leftBoundIsForward);
-
- TEdge* E2 = ProcessBound(locMin.RightBound, !leftBoundIsForward);
- if (E2->OutIdx == Skip) E2 = ProcessBound(E2, !leftBoundIsForward);
-
- if (locMin.LeftBound->OutIdx == Skip)
- locMin.LeftBound = 0;
- else if (locMin.RightBound->OutIdx == Skip)
- locMin.RightBound = 0;
- m_MinimaList.push_back(locMin);
- if (!leftBoundIsForward) E = E2;
- }
- return true;
-}
-//------------------------------------------------------------------------------
-
-bool ClipperBase::AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed)
-{
- bool result = false;
- for (Paths::size_type i = 0; i < ppg.size(); ++i)
- if (AddPath(ppg[i], PolyTyp, Closed)) result = true;
- return result;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::Clear()
-{
- DisposeLocalMinimaList();
- for (EdgeList::size_type i = 0; i < m_edges.size(); ++i)
- {
- TEdge* edges = m_edges[i];
- delete [] edges;
- }
- m_edges.clear();
- m_UseFullRange = false;
- m_HasOpenPaths = false;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::Reset()
-{
- m_CurrentLM = m_MinimaList.begin();
- if (m_CurrentLM == m_MinimaList.end()) return; //ie nothing to process
- std::sort(m_MinimaList.begin(), m_MinimaList.end(), LocMinSorter());
-
- m_Scanbeam = ScanbeamList(); //clears/resets priority_queue
- //reset all edges ...
- for (MinimaList::iterator lm = m_MinimaList.begin(); lm != m_MinimaList.end(); ++lm)
- {
- InsertScanbeam(lm->Y);
- TEdge* e = lm->LeftBound;
- if (e)
- {
- e->Curr = e->Bot;
- e->Side = esLeft;
- e->OutIdx = Unassigned;
- }
-
- e = lm->RightBound;
- if (e)
- {
- e->Curr = e->Bot;
- e->Side = esRight;
- e->OutIdx = Unassigned;
- }
- }
- m_ActiveEdges = 0;
- m_CurrentLM = m_MinimaList.begin();
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::DisposeLocalMinimaList()
-{
- m_MinimaList.clear();
- m_CurrentLM = m_MinimaList.begin();
-}
-//------------------------------------------------------------------------------
-
-bool ClipperBase::PopLocalMinima(cInt Y, const LocalMinimum *&locMin)
-{
- if (m_CurrentLM == m_MinimaList.end() || (*m_CurrentLM).Y != Y) return false;
- locMin = &(*m_CurrentLM);
- ++m_CurrentLM;
- return true;
-}
-//------------------------------------------------------------------------------
-
-IntRect ClipperBase::GetBounds()
-{
- IntRect result;
- MinimaList::iterator lm = m_MinimaList.begin();
- if (lm == m_MinimaList.end())
- {
- result.left = result.top = result.right = result.bottom = 0;
- return result;
- }
- result.left = lm->LeftBound->Bot.X;
- result.top = lm->LeftBound->Bot.Y;
- result.right = lm->LeftBound->Bot.X;
- result.bottom = lm->LeftBound->Bot.Y;
- while (lm != m_MinimaList.end())
- {
- //todo - needs fixing for open paths
- result.bottom = std::max(result.bottom, lm->LeftBound->Bot.Y);
- TEdge* e = lm->LeftBound;
- for (;;) {
- TEdge* bottomE = e;
- while (e->NextInLML)
- {
- if (e->Bot.X < result.left) result.left = e->Bot.X;
- if (e->Bot.X > result.right) result.right = e->Bot.X;
- e = e->NextInLML;
- }
- result.left = std::min(result.left, e->Bot.X);
- result.right = std::max(result.right, e->Bot.X);
- result.left = std::min(result.left, e->Top.X);
- result.right = std::max(result.right, e->Top.X);
- result.top = std::min(result.top, e->Top.Y);
- if (bottomE == lm->LeftBound) e = lm->RightBound;
- else break;
- }
- ++lm;
- }
- return result;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::InsertScanbeam(const cInt Y)
-{
- m_Scanbeam.push(Y);
-}
-//------------------------------------------------------------------------------
-
-bool ClipperBase::PopScanbeam(cInt &Y)
-{
- if (m_Scanbeam.empty()) return false;
- Y = m_Scanbeam.top();
- m_Scanbeam.pop();
- while (!m_Scanbeam.empty() && Y == m_Scanbeam.top()) { m_Scanbeam.pop(); } // Pop duplicates.
- return true;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::DisposeAllOutRecs(){
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- DisposeOutRec(i);
- m_PolyOuts.clear();
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::DisposeOutRec(PolyOutList::size_type index)
-{
- OutRec *outRec = m_PolyOuts[index];
- if (outRec->Pts) DisposeOutPts(outRec->Pts);
- delete outRec;
- m_PolyOuts[index] = 0;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::DeleteFromAEL(TEdge *e)
-{
- TEdge* AelPrev = e->PrevInAEL;
- TEdge* AelNext = e->NextInAEL;
- if (!AelPrev && !AelNext && (e != m_ActiveEdges)) return; //already deleted
- if (AelPrev) AelPrev->NextInAEL = AelNext;
- else m_ActiveEdges = AelNext;
- if (AelNext) AelNext->PrevInAEL = AelPrev;
- e->NextInAEL = 0;
- e->PrevInAEL = 0;
-}
-//------------------------------------------------------------------------------
-
-OutRec* ClipperBase::CreateOutRec()
-{
- OutRec* result = new OutRec;
- result->IsHole = false;
- result->IsOpen = false;
- result->FirstLeft = 0;
- result->Pts = 0;
- result->BottomPt = 0;
- result->PolyNd = 0;
- m_PolyOuts.push_back(result);
- result->Idx = (int)m_PolyOuts.size() - 1;
- return result;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::SwapPositionsInAEL(TEdge *Edge1, TEdge *Edge2)
-{
- //check that one or other edge hasn't already been removed from AEL ...
- if (Edge1->NextInAEL == Edge1->PrevInAEL ||
- Edge2->NextInAEL == Edge2->PrevInAEL) return;
-
- if (Edge1->NextInAEL == Edge2)
- {
- TEdge* Next = Edge2->NextInAEL;
- if (Next) Next->PrevInAEL = Edge1;
- TEdge* Prev = Edge1->PrevInAEL;
- if (Prev) Prev->NextInAEL = Edge2;
- Edge2->PrevInAEL = Prev;
- Edge2->NextInAEL = Edge1;
- Edge1->PrevInAEL = Edge2;
- Edge1->NextInAEL = Next;
- }
- else if (Edge2->NextInAEL == Edge1)
- {
- TEdge* Next = Edge1->NextInAEL;
- if (Next) Next->PrevInAEL = Edge2;
- TEdge* Prev = Edge2->PrevInAEL;
- if (Prev) Prev->NextInAEL = Edge1;
- Edge1->PrevInAEL = Prev;
- Edge1->NextInAEL = Edge2;
- Edge2->PrevInAEL = Edge1;
- Edge2->NextInAEL = Next;
- }
- else
- {
- TEdge* Next = Edge1->NextInAEL;
- TEdge* Prev = Edge1->PrevInAEL;
- Edge1->NextInAEL = Edge2->NextInAEL;
- if (Edge1->NextInAEL) Edge1->NextInAEL->PrevInAEL = Edge1;
- Edge1->PrevInAEL = Edge2->PrevInAEL;
- if (Edge1->PrevInAEL) Edge1->PrevInAEL->NextInAEL = Edge1;
- Edge2->NextInAEL = Next;
- if (Edge2->NextInAEL) Edge2->NextInAEL->PrevInAEL = Edge2;
- Edge2->PrevInAEL = Prev;
- if (Edge2->PrevInAEL) Edge2->PrevInAEL->NextInAEL = Edge2;
- }
-
- if (!Edge1->PrevInAEL) m_ActiveEdges = Edge1;
- else if (!Edge2->PrevInAEL) m_ActiveEdges = Edge2;
-}
-//------------------------------------------------------------------------------
-
-void ClipperBase::UpdateEdgeIntoAEL(TEdge *&e)
-{
- if (!e->NextInLML)
- throw clipperException("UpdateEdgeIntoAEL: invalid call");
-
- e->NextInLML->OutIdx = e->OutIdx;
- TEdge* AelPrev = e->PrevInAEL;
- TEdge* AelNext = e->NextInAEL;
- if (AelPrev) AelPrev->NextInAEL = e->NextInLML;
- else m_ActiveEdges = e->NextInLML;
- if (AelNext) AelNext->PrevInAEL = e->NextInLML;
- e->NextInLML->Side = e->Side;
- e->NextInLML->WindDelta = e->WindDelta;
- e->NextInLML->WindCnt = e->WindCnt;
- e->NextInLML->WindCnt2 = e->WindCnt2;
- e = e->NextInLML;
- e->Curr = e->Bot;
- e->PrevInAEL = AelPrev;
- e->NextInAEL = AelNext;
- if (!IsHorizontal(*e)) InsertScanbeam(e->Top.Y);
-}
-//------------------------------------------------------------------------------
-
-bool ClipperBase::LocalMinimaPending()
-{
- return (m_CurrentLM != m_MinimaList.end());
-}
-
-//------------------------------------------------------------------------------
-// TClipper methods ...
-//------------------------------------------------------------------------------
-
-Clipper::Clipper(int initOptions) : ClipperBase() //constructor
-{
- m_ExecuteLocked = false;
- m_UseFullRange = false;
- m_ReverseOutput = ((initOptions & ioReverseSolution) != 0);
- m_StrictSimple = ((initOptions & ioStrictlySimple) != 0);
- m_PreserveCollinear = ((initOptions & ioPreserveCollinear) != 0);
- m_HasOpenPaths = false;
-#ifdef use_xyz
- m_ZFill = 0;
-#endif
-}
-//------------------------------------------------------------------------------
-
-#ifdef use_xyz
-void Clipper::ZFillFunction(ZFillCallback zFillFunc)
-{
- m_ZFill = zFillFunc;
-}
-//------------------------------------------------------------------------------
-#endif
-
-bool Clipper::Execute(ClipType clipType, Paths &solution, PolyFillType fillType)
-{
- return Execute(clipType, solution, fillType, fillType);
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::Execute(ClipType clipType, PolyTree &polytree, PolyFillType fillType)
-{
- return Execute(clipType, polytree, fillType, fillType);
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::Execute(ClipType clipType, Paths &solution,
- PolyFillType subjFillType, PolyFillType clipFillType)
-{
- if( m_ExecuteLocked ) return false;
- if (m_HasOpenPaths)
- throw clipperException("Error: PolyTree struct is needed for open path clipping.");
- m_ExecuteLocked = true;
- solution.resize(0);
- m_SubjFillType = subjFillType;
- m_ClipFillType = clipFillType;
- m_ClipType = clipType;
- m_UsingPolyTree = false;
- bool succeeded = ExecuteInternal();
- if (succeeded) BuildResult(solution);
- DisposeAllOutRecs();
- m_ExecuteLocked = false;
- return succeeded;
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::Execute(ClipType clipType, PolyTree& polytree,
- PolyFillType subjFillType, PolyFillType clipFillType)
-{
- if( m_ExecuteLocked ) return false;
- m_ExecuteLocked = true;
- m_SubjFillType = subjFillType;
- m_ClipFillType = clipFillType;
- m_ClipType = clipType;
- m_UsingPolyTree = true;
- bool succeeded = ExecuteInternal();
- if (succeeded) BuildResult2(polytree);
- DisposeAllOutRecs();
- m_ExecuteLocked = false;
- return succeeded;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::FixHoleLinkage(OutRec &outrec)
-{
- //skip OutRecs that (a) contain outermost polygons or
- //(b) already have the correct owner/child linkage ...
- if (!outrec.FirstLeft ||
- (outrec.IsHole != outrec.FirstLeft->IsHole &&
- outrec.FirstLeft->Pts)) return;
-
- OutRec* orfl = outrec.FirstLeft;
- while (orfl && ((orfl->IsHole == outrec.IsHole) || !orfl->Pts))
- orfl = orfl->FirstLeft;
- outrec.FirstLeft = orfl;
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::ExecuteInternal()
-{
- bool succeeded = true;
- try {
- Reset();
- m_Maxima = MaximaList();
- m_SortedEdges = 0;
-
- succeeded = true;
- cInt botY, topY;
- if (!PopScanbeam(botY)) return false;
- InsertLocalMinimaIntoAEL(botY);
- while (PopScanbeam(topY) || LocalMinimaPending())
- {
- ProcessHorizontals();
- ClearGhostJoins();
- if (!ProcessIntersections(topY))
- {
- succeeded = false;
- break;
- }
- ProcessEdgesAtTopOfScanbeam(topY);
- botY = topY;
- InsertLocalMinimaIntoAEL(botY);
- }
- }
- catch(...)
- {
- succeeded = false;
- }
-
- if (succeeded)
- {
- //fix orientations ...
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- {
- OutRec *outRec = m_PolyOuts[i];
- if (!outRec->Pts || outRec->IsOpen) continue;
- if ((outRec->IsHole ^ m_ReverseOutput) == (Area(*outRec) > 0))
- ReversePolyPtLinks(outRec->Pts);
- }
-
- if (!m_Joins.empty()) JoinCommonEdges();
-
- //unfortunately FixupOutPolygon() must be done after JoinCommonEdges()
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- {
- OutRec *outRec = m_PolyOuts[i];
- if (!outRec->Pts) continue;
- if (outRec->IsOpen)
- FixupOutPolyline(*outRec);
- else
- FixupOutPolygon(*outRec);
- }
-
- if (m_StrictSimple) DoSimplePolygons();
- }
-
- ClearJoins();
- ClearGhostJoins();
- return succeeded;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::SetWindingCount(TEdge &edge)
-{
- TEdge *e = edge.PrevInAEL;
- //find the edge of the same polytype that immediately preceeds 'edge' in AEL
- while (e && ((e->PolyTyp != edge.PolyTyp) || (e->WindDelta == 0))) e = e->PrevInAEL;
- if (!e)
- {
- if (edge.WindDelta == 0)
- {
- PolyFillType pft = (edge.PolyTyp == ptSubject ? m_SubjFillType : m_ClipFillType);
- edge.WindCnt = (pft == pftNegative ? -1 : 1);
- }
- else
- edge.WindCnt = edge.WindDelta;
- edge.WindCnt2 = 0;
- e = m_ActiveEdges; //ie get ready to calc WindCnt2
- }
- else if (edge.WindDelta == 0 && m_ClipType != ctUnion)
- {
- edge.WindCnt = 1;
- edge.WindCnt2 = e->WindCnt2;
- e = e->NextInAEL; //ie get ready to calc WindCnt2
- }
- else if (IsEvenOddFillType(edge))
- {
- //EvenOdd filling ...
- if (edge.WindDelta == 0)
- {
- //are we inside a subj polygon ...
- bool Inside = true;
- TEdge *e2 = e->PrevInAEL;
- while (e2)
- {
- if (e2->PolyTyp == e->PolyTyp && e2->WindDelta != 0)
- Inside = !Inside;
- e2 = e2->PrevInAEL;
- }
- edge.WindCnt = (Inside ? 0 : 1);
- }
- else
- {
- edge.WindCnt = edge.WindDelta;
- }
- edge.WindCnt2 = e->WindCnt2;
- e = e->NextInAEL; //ie get ready to calc WindCnt2
- }
- else
- {
- //nonZero, Positive or Negative filling ...
- if (e->WindCnt * e->WindDelta < 0)
- {
- //prev edge is 'decreasing' WindCount (WC) toward zero
- //so we're outside the previous polygon ...
- if (Abs(e->WindCnt) > 1)
- {
- //outside prev poly but still inside another.
- //when reversing direction of prev poly use the same WC
- if (e->WindDelta * edge.WindDelta < 0) edge.WindCnt = e->WindCnt;
- //otherwise continue to 'decrease' WC ...
- else edge.WindCnt = e->WindCnt + edge.WindDelta;
- }
- else
- //now outside all polys of same polytype so set own WC ...
- edge.WindCnt = (edge.WindDelta == 0 ? 1 : edge.WindDelta);
- } else
- {
- //prev edge is 'increasing' WindCount (WC) away from zero
- //so we're inside the previous polygon ...
- if (edge.WindDelta == 0)
- edge.WindCnt = (e->WindCnt < 0 ? e->WindCnt - 1 : e->WindCnt + 1);
- //if wind direction is reversing prev then use same WC
- else if (e->WindDelta * edge.WindDelta < 0) edge.WindCnt = e->WindCnt;
- //otherwise add to WC ...
- else edge.WindCnt = e->WindCnt + edge.WindDelta;
- }
- edge.WindCnt2 = e->WindCnt2;
- e = e->NextInAEL; //ie get ready to calc WindCnt2
- }
-
- //update WindCnt2 ...
- if (IsEvenOddAltFillType(edge))
- {
- //EvenOdd filling ...
- while (e != &edge)
- {
- if (e->WindDelta != 0)
- edge.WindCnt2 = (edge.WindCnt2 == 0 ? 1 : 0);
- e = e->NextInAEL;
- }
- } else
- {
- //nonZero, Positive or Negative filling ...
- while ( e != &edge )
- {
- edge.WindCnt2 += e->WindDelta;
- e = e->NextInAEL;
- }
- }
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::IsEvenOddFillType(const TEdge& edge) const
-{
- if (edge.PolyTyp == ptSubject)
- return m_SubjFillType == pftEvenOdd; else
- return m_ClipFillType == pftEvenOdd;
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::IsEvenOddAltFillType(const TEdge& edge) const
-{
- if (edge.PolyTyp == ptSubject)
- return m_ClipFillType == pftEvenOdd; else
- return m_SubjFillType == pftEvenOdd;
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::IsContributing(const TEdge& edge) const
-{
- PolyFillType pft, pft2;
- if (edge.PolyTyp == ptSubject)
- {
- pft = m_SubjFillType;
- pft2 = m_ClipFillType;
- } else
- {
- pft = m_ClipFillType;
- pft2 = m_SubjFillType;
- }
-
- switch(pft)
- {
- case pftEvenOdd:
- //return false if a subj line has been flagged as inside a subj polygon
- if (edge.WindDelta == 0 && edge.WindCnt != 1) return false;
- break;
- case pftNonZero:
- if (Abs(edge.WindCnt) != 1) return false;
- break;
- case pftPositive:
- if (edge.WindCnt != 1) return false;
- break;
- default: //pftNegative
- if (edge.WindCnt != -1) return false;
- }
-
- switch(m_ClipType)
- {
- case ctIntersection:
- switch(pft2)
- {
- case pftEvenOdd:
- case pftNonZero:
- return (edge.WindCnt2 != 0);
- case pftPositive:
- return (edge.WindCnt2 > 0);
- default:
- return (edge.WindCnt2 < 0);
- }
- break;
- case ctUnion:
- switch(pft2)
- {
- case pftEvenOdd:
- case pftNonZero:
- return (edge.WindCnt2 == 0);
- case pftPositive:
- return (edge.WindCnt2 <= 0);
- default:
- return (edge.WindCnt2 >= 0);
- }
- break;
- case ctDifference:
- if (edge.PolyTyp == ptSubject)
- switch(pft2)
- {
- case pftEvenOdd:
- case pftNonZero:
- return (edge.WindCnt2 == 0);
- case pftPositive:
- return (edge.WindCnt2 <= 0);
- default:
- return (edge.WindCnt2 >= 0);
- }
- else
- switch(pft2)
- {
- case pftEvenOdd:
- case pftNonZero:
- return (edge.WindCnt2 != 0);
- case pftPositive:
- return (edge.WindCnt2 > 0);
- default:
- return (edge.WindCnt2 < 0);
- }
- break;
- case ctXor:
- if (edge.WindDelta == 0) //XOr always contributing unless open
- switch(pft2)
- {
- case pftEvenOdd:
- case pftNonZero:
- return (edge.WindCnt2 == 0);
- case pftPositive:
- return (edge.WindCnt2 <= 0);
- default:
- return (edge.WindCnt2 >= 0);
- }
- else
- return true;
- break;
- default:
- return true;
- }
-}
-//------------------------------------------------------------------------------
-
-OutPt* Clipper::AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &Pt)
-{
- OutPt* result;
- TEdge *e, *prevE;
- if (IsHorizontal(*e2) || ( e1->Dx > e2->Dx ))
- {
- result = AddOutPt(e1, Pt);
- e2->OutIdx = e1->OutIdx;
- e1->Side = esLeft;
- e2->Side = esRight;
- e = e1;
- if (e->PrevInAEL == e2)
- prevE = e2->PrevInAEL;
- else
- prevE = e->PrevInAEL;
- } else
- {
- result = AddOutPt(e2, Pt);
- e1->OutIdx = e2->OutIdx;
- e1->Side = esRight;
- e2->Side = esLeft;
- e = e2;
- if (e->PrevInAEL == e1)
- prevE = e1->PrevInAEL;
- else
- prevE = e->PrevInAEL;
- }
-
- if (prevE && prevE->OutIdx >= 0 && prevE->Top.Y < Pt.Y && e->Top.Y < Pt.Y)
- {
- cInt xPrev = TopX(*prevE, Pt.Y);
- cInt xE = TopX(*e, Pt.Y);
- if (xPrev == xE && (e->WindDelta != 0) && (prevE->WindDelta != 0) &&
- SlopesEqual(IntPoint(xPrev, Pt.Y), prevE->Top, IntPoint(xE, Pt.Y), e->Top, m_UseFullRange))
- {
- OutPt* outPt = AddOutPt(prevE, Pt);
- AddJoin(result, outPt, e->Top);
- }
- }
- return result;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &Pt)
-{
- AddOutPt( e1, Pt );
- if (e2->WindDelta == 0) AddOutPt(e2, Pt);
- if( e1->OutIdx == e2->OutIdx )
- {
- e1->OutIdx = Unassigned;
- e2->OutIdx = Unassigned;
- }
- else if (e1->OutIdx < e2->OutIdx)
- AppendPolygon(e1, e2);
- else
- AppendPolygon(e2, e1);
-}
-//------------------------------------------------------------------------------
-
-void Clipper::AddEdgeToSEL(TEdge *edge)
-{
- //SEL pointers in PEdge are reused to build a list of horizontal edges.
- //However, we don't need to worry about order with horizontal edge processing.
- if( !m_SortedEdges )
- {
- m_SortedEdges = edge;
- edge->PrevInSEL = 0;
- edge->NextInSEL = 0;
- }
- else
- {
- edge->NextInSEL = m_SortedEdges;
- edge->PrevInSEL = 0;
- m_SortedEdges->PrevInSEL = edge;
- m_SortedEdges = edge;
- }
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::PopEdgeFromSEL(TEdge *&edge)
-{
- if (!m_SortedEdges) return false;
- edge = m_SortedEdges;
- DeleteFromSEL(m_SortedEdges);
- return true;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::CopyAELToSEL()
-{
- TEdge* e = m_ActiveEdges;
- m_SortedEdges = e;
- while ( e )
- {
- e->PrevInSEL = e->PrevInAEL;
- e->NextInSEL = e->NextInAEL;
- e = e->NextInAEL;
- }
-}
-//------------------------------------------------------------------------------
-
-void Clipper::AddJoin(OutPt *op1, OutPt *op2, const IntPoint OffPt)
-{
- Join* j = new Join;
- j->OutPt1 = op1;
- j->OutPt2 = op2;
- j->OffPt = OffPt;
- m_Joins.push_back(j);
-}
-//------------------------------------------------------------------------------
-
-void Clipper::ClearJoins()
-{
- for (JoinList::size_type i = 0; i < m_Joins.size(); i++)
- delete m_Joins[i];
- m_Joins.resize(0);
-}
-//------------------------------------------------------------------------------
-
-void Clipper::ClearGhostJoins()
-{
- for (JoinList::size_type i = 0; i < m_GhostJoins.size(); i++)
- delete m_GhostJoins[i];
- m_GhostJoins.resize(0);
-}
-//------------------------------------------------------------------------------
-
-void Clipper::AddGhostJoin(OutPt *op, const IntPoint OffPt)
-{
- Join* j = new Join;
- j->OutPt1 = op;
- j->OutPt2 = 0;
- j->OffPt = OffPt;
- m_GhostJoins.push_back(j);
-}
-//------------------------------------------------------------------------------
-
-void Clipper::InsertLocalMinimaIntoAEL(const cInt botY)
-{
- const LocalMinimum *lm;
- while (PopLocalMinima(botY, lm))
- {
- TEdge* lb = lm->LeftBound;
- TEdge* rb = lm->RightBound;
-
- OutPt *Op1 = 0;
- if (!lb)
- {
- //nb: don't insert LB into either AEL or SEL
- InsertEdgeIntoAEL(rb, 0);
- SetWindingCount(*rb);
- if (IsContributing(*rb))
- Op1 = AddOutPt(rb, rb->Bot);
- }
- else if (!rb)
- {
- InsertEdgeIntoAEL(lb, 0);
- SetWindingCount(*lb);
- if (IsContributing(*lb))
- Op1 = AddOutPt(lb, lb->Bot);
- InsertScanbeam(lb->Top.Y);
- }
- else
- {
- InsertEdgeIntoAEL(lb, 0);
- InsertEdgeIntoAEL(rb, lb);
- SetWindingCount( *lb );
- rb->WindCnt = lb->WindCnt;
- rb->WindCnt2 = lb->WindCnt2;
- if (IsContributing(*lb))
- Op1 = AddLocalMinPoly(lb, rb, lb->Bot);
- InsertScanbeam(lb->Top.Y);
- }
-
- if (rb)
- {
- if (IsHorizontal(*rb))
- {
- AddEdgeToSEL(rb);
- if (rb->NextInLML)
- InsertScanbeam(rb->NextInLML->Top.Y);
- }
- else InsertScanbeam( rb->Top.Y );
- }
-
- if (!lb || !rb) continue;
-
- //if any output polygons share an edge, they'll need joining later ...
- if (Op1 && IsHorizontal(*rb) &&
- m_GhostJoins.size() > 0 && (rb->WindDelta != 0))
- {
- for (JoinList::size_type i = 0; i < m_GhostJoins.size(); ++i)
- {
- Join* jr = m_GhostJoins[i];
- //if the horizontal Rb and a 'ghost' horizontal overlap, then convert
- //the 'ghost' join to a real join ready for later ...
- if (HorzSegmentsOverlap(jr->OutPt1->Pt.X, jr->OffPt.X, rb->Bot.X, rb->Top.X))
- AddJoin(jr->OutPt1, Op1, jr->OffPt);
- }
- }
-
- if (lb->OutIdx >= 0 && lb->PrevInAEL &&
- lb->PrevInAEL->Curr.X == lb->Bot.X &&
- lb->PrevInAEL->OutIdx >= 0 &&
- SlopesEqual(lb->PrevInAEL->Bot, lb->PrevInAEL->Top, lb->Curr, lb->Top, m_UseFullRange) &&
- (lb->WindDelta != 0) && (lb->PrevInAEL->WindDelta != 0))
- {
- OutPt *Op2 = AddOutPt(lb->PrevInAEL, lb->Bot);
- AddJoin(Op1, Op2, lb->Top);
- }
-
- if(lb->NextInAEL != rb)
- {
-
- if (rb->OutIdx >= 0 && rb->PrevInAEL->OutIdx >= 0 &&
- SlopesEqual(rb->PrevInAEL->Curr, rb->PrevInAEL->Top, rb->Curr, rb->Top, m_UseFullRange) &&
- (rb->WindDelta != 0) && (rb->PrevInAEL->WindDelta != 0))
- {
- OutPt *Op2 = AddOutPt(rb->PrevInAEL, rb->Bot);
- AddJoin(Op1, Op2, rb->Top);
- }
-
- TEdge* e = lb->NextInAEL;
- if (e)
- {
- while( e != rb )
- {
- //nb: For calculating winding counts etc, IntersectEdges() assumes
- //that param1 will be to the Right of param2 ABOVE the intersection ...
- IntersectEdges(rb , e , lb->Curr); //order important here
- e = e->NextInAEL;
- }
- }
- }
-
- }
-}
-//------------------------------------------------------------------------------
-
-void Clipper::DeleteFromSEL(TEdge *e)
-{
- TEdge* SelPrev = e->PrevInSEL;
- TEdge* SelNext = e->NextInSEL;
- if( !SelPrev && !SelNext && (e != m_SortedEdges) ) return; //already deleted
- if( SelPrev ) SelPrev->NextInSEL = SelNext;
- else m_SortedEdges = SelNext;
- if( SelNext ) SelNext->PrevInSEL = SelPrev;
- e->NextInSEL = 0;
- e->PrevInSEL = 0;
-}
-//------------------------------------------------------------------------------
-
-#ifdef use_xyz
-void Clipper::SetZ(IntPoint& pt, TEdge& e1, TEdge& e2)
-{
- if (pt.Z != 0 || !m_ZFill) return;
- else if (pt == e1.Bot) pt.Z = e1.Bot.Z;
- else if (pt == e1.Top) pt.Z = e1.Top.Z;
- else if (pt == e2.Bot) pt.Z = e2.Bot.Z;
- else if (pt == e2.Top) pt.Z = e2.Top.Z;
- else (*m_ZFill)(e1.Bot, e1.Top, e2.Bot, e2.Top, pt);
-}
-//------------------------------------------------------------------------------
-#endif
-
-void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &Pt)
-{
- bool e1Contributing = ( e1->OutIdx >= 0 );
- bool e2Contributing = ( e2->OutIdx >= 0 );
-
-#ifdef use_xyz
- SetZ(Pt, *e1, *e2);
-#endif
-
-#ifdef use_lines
- //if either edge is on an OPEN path ...
- if (e1->WindDelta == 0 || e2->WindDelta == 0)
- {
- //ignore subject-subject open path intersections UNLESS they
- //are both open paths, AND they are both 'contributing maximas' ...
- if (e1->WindDelta == 0 && e2->WindDelta == 0) return;
-
- //if intersecting a subj line with a subj poly ...
- else if (e1->PolyTyp == e2->PolyTyp &&
- e1->WindDelta != e2->WindDelta && m_ClipType == ctUnion)
- {
- if (e1->WindDelta == 0)
- {
- if (e2Contributing)
- {
- AddOutPt(e1, Pt);
- if (e1Contributing) e1->OutIdx = Unassigned;
- }
- }
- else
- {
- if (e1Contributing)
- {
- AddOutPt(e2, Pt);
- if (e2Contributing) e2->OutIdx = Unassigned;
- }
- }
- }
- else if (e1->PolyTyp != e2->PolyTyp)
- {
- //toggle subj open path OutIdx on/off when Abs(clip.WndCnt) == 1 ...
- if ((e1->WindDelta == 0) && abs(e2->WindCnt) == 1 &&
- (m_ClipType != ctUnion || e2->WindCnt2 == 0))
- {
- AddOutPt(e1, Pt);
- if (e1Contributing) e1->OutIdx = Unassigned;
- }
- else if ((e2->WindDelta == 0) && (abs(e1->WindCnt) == 1) &&
- (m_ClipType != ctUnion || e1->WindCnt2 == 0))
- {
- AddOutPt(e2, Pt);
- if (e2Contributing) e2->OutIdx = Unassigned;
- }
- }
- return;
- }
-#endif
-
- //update winding counts...
- //assumes that e1 will be to the Right of e2 ABOVE the intersection
- if ( e1->PolyTyp == e2->PolyTyp )
- {
- if ( IsEvenOddFillType( *e1) )
- {
- int oldE1WindCnt = e1->WindCnt;
- e1->WindCnt = e2->WindCnt;
- e2->WindCnt = oldE1WindCnt;
- } else
- {
- if (e1->WindCnt + e2->WindDelta == 0 ) e1->WindCnt = -e1->WindCnt;
- else e1->WindCnt += e2->WindDelta;
- if ( e2->WindCnt - e1->WindDelta == 0 ) e2->WindCnt = -e2->WindCnt;
- else e2->WindCnt -= e1->WindDelta;
- }
- } else
- {
- if (!IsEvenOddFillType(*e2)) e1->WindCnt2 += e2->WindDelta;
- else e1->WindCnt2 = ( e1->WindCnt2 == 0 ) ? 1 : 0;
- if (!IsEvenOddFillType(*e1)) e2->WindCnt2 -= e1->WindDelta;
- else e2->WindCnt2 = ( e2->WindCnt2 == 0 ) ? 1 : 0;
- }
-
- PolyFillType e1FillType, e2FillType, e1FillType2, e2FillType2;
- if (e1->PolyTyp == ptSubject)
- {
- e1FillType = m_SubjFillType;
- e1FillType2 = m_ClipFillType;
- } else
- {
- e1FillType = m_ClipFillType;
- e1FillType2 = m_SubjFillType;
- }
- if (e2->PolyTyp == ptSubject)
- {
- e2FillType = m_SubjFillType;
- e2FillType2 = m_ClipFillType;
- } else
- {
- e2FillType = m_ClipFillType;
- e2FillType2 = m_SubjFillType;
- }
-
- cInt e1Wc, e2Wc;
- switch (e1FillType)
- {
- case pftPositive: e1Wc = e1->WindCnt; break;
- case pftNegative: e1Wc = -e1->WindCnt; break;
- default: e1Wc = Abs(e1->WindCnt);
- }
- switch(e2FillType)
- {
- case pftPositive: e2Wc = e2->WindCnt; break;
- case pftNegative: e2Wc = -e2->WindCnt; break;
- default: e2Wc = Abs(e2->WindCnt);
- }
-
- if ( e1Contributing && e2Contributing )
- {
- if ((e1Wc != 0 && e1Wc != 1) || (e2Wc != 0 && e2Wc != 1) ||
- (e1->PolyTyp != e2->PolyTyp && m_ClipType != ctXor) )
- {
- AddLocalMaxPoly(e1, e2, Pt);
- }
- else
- {
- AddOutPt(e1, Pt);
- AddOutPt(e2, Pt);
- SwapSides( *e1 , *e2 );
- SwapPolyIndexes( *e1 , *e2 );
- }
- }
- else if ( e1Contributing )
- {
- if (e2Wc == 0 || e2Wc == 1)
- {
- AddOutPt(e1, Pt);
- SwapSides(*e1, *e2);
- SwapPolyIndexes(*e1, *e2);
- }
- }
- else if ( e2Contributing )
- {
- if (e1Wc == 0 || e1Wc == 1)
- {
- AddOutPt(e2, Pt);
- SwapSides(*e1, *e2);
- SwapPolyIndexes(*e1, *e2);
- }
- }
- else if ( (e1Wc == 0 || e1Wc == 1) && (e2Wc == 0 || e2Wc == 1))
- {
- //neither edge is currently contributing ...
-
- cInt e1Wc2, e2Wc2;
- switch (e1FillType2)
- {
- case pftPositive: e1Wc2 = e1->WindCnt2; break;
- case pftNegative : e1Wc2 = -e1->WindCnt2; break;
- default: e1Wc2 = Abs(e1->WindCnt2);
- }
- switch (e2FillType2)
- {
- case pftPositive: e2Wc2 = e2->WindCnt2; break;
- case pftNegative: e2Wc2 = -e2->WindCnt2; break;
- default: e2Wc2 = Abs(e2->WindCnt2);
- }
-
- if (e1->PolyTyp != e2->PolyTyp)
- {
- AddLocalMinPoly(e1, e2, Pt);
- }
- else if (e1Wc == 1 && e2Wc == 1)
- switch( m_ClipType ) {
- case ctIntersection:
- if (e1Wc2 > 0 && e2Wc2 > 0)
- AddLocalMinPoly(e1, e2, Pt);
- break;
- case ctUnion:
- if ( e1Wc2 <= 0 && e2Wc2 <= 0 )
- AddLocalMinPoly(e1, e2, Pt);
- break;
- case ctDifference:
- if (((e1->PolyTyp == ptClip) && (e1Wc2 > 0) && (e2Wc2 > 0)) ||
- ((e1->PolyTyp == ptSubject) && (e1Wc2 <= 0) && (e2Wc2 <= 0)))
- AddLocalMinPoly(e1, e2, Pt);
- break;
- case ctXor:
- AddLocalMinPoly(e1, e2, Pt);
- }
- else
- SwapSides( *e1, *e2 );
- }
-}
-//------------------------------------------------------------------------------
-
-void Clipper::SetHoleState(TEdge *e, OutRec *outrec)
-{
- TEdge *e2 = e->PrevInAEL;
- TEdge *eTmp = 0;
- while (e2)
- {
- if (e2->OutIdx >= 0 && e2->WindDelta != 0)
- {
- if (!eTmp) eTmp = e2;
- else if (eTmp->OutIdx == e2->OutIdx) eTmp = 0;
- }
- e2 = e2->PrevInAEL;
- }
- if (!eTmp)
- {
- outrec->FirstLeft = 0;
- outrec->IsHole = false;
- }
- else
- {
- outrec->FirstLeft = m_PolyOuts[eTmp->OutIdx];
- outrec->IsHole = !outrec->FirstLeft->IsHole;
- }
-}
-//------------------------------------------------------------------------------
-
-OutRec* GetLowermostRec(OutRec *outRec1, OutRec *outRec2)
-{
- //work out which polygon fragment has the correct hole state ...
- if (!outRec1->BottomPt)
- outRec1->BottomPt = GetBottomPt(outRec1->Pts);
- if (!outRec2->BottomPt)
- outRec2->BottomPt = GetBottomPt(outRec2->Pts);
- OutPt *OutPt1 = outRec1->BottomPt;
- OutPt *OutPt2 = outRec2->BottomPt;
- if (OutPt1->Pt.Y > OutPt2->Pt.Y) return outRec1;
- else if (OutPt1->Pt.Y < OutPt2->Pt.Y) return outRec2;
- else if (OutPt1->Pt.X < OutPt2->Pt.X) return outRec1;
- else if (OutPt1->Pt.X > OutPt2->Pt.X) return outRec2;
- else if (OutPt1->Next == OutPt1) return outRec2;
- else if (OutPt2->Next == OutPt2) return outRec1;
- else if (FirstIsBottomPt(OutPt1, OutPt2)) return outRec1;
- else return outRec2;
-}
-//------------------------------------------------------------------------------
-
-bool OutRec1RightOfOutRec2(OutRec* outRec1, OutRec* outRec2)
-{
- do
- {
- outRec1 = outRec1->FirstLeft;
- if (outRec1 == outRec2) return true;
- } while (outRec1);
- return false;
-}
-//------------------------------------------------------------------------------
-
-OutRec* Clipper::GetOutRec(int Idx)
-{
- OutRec* outrec = m_PolyOuts[Idx];
- while (outrec != m_PolyOuts[outrec->Idx])
- outrec = m_PolyOuts[outrec->Idx];
- return outrec;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::AppendPolygon(TEdge *e1, TEdge *e2)
-{
- //get the start and ends of both output polygons ...
- OutRec *outRec1 = m_PolyOuts[e1->OutIdx];
- OutRec *outRec2 = m_PolyOuts[e2->OutIdx];
-
- OutRec *holeStateRec;
- if (OutRec1RightOfOutRec2(outRec1, outRec2))
- holeStateRec = outRec2;
- else if (OutRec1RightOfOutRec2(outRec2, outRec1))
- holeStateRec = outRec1;
- else
- holeStateRec = GetLowermostRec(outRec1, outRec2);
-
- //get the start and ends of both output polygons and
- //join e2 poly onto e1 poly and delete pointers to e2 ...
-
- OutPt* p1_lft = outRec1->Pts;
- OutPt* p1_rt = p1_lft->Prev;
- OutPt* p2_lft = outRec2->Pts;
- OutPt* p2_rt = p2_lft->Prev;
-
- //join e2 poly onto e1 poly and delete pointers to e2 ...
- if( e1->Side == esLeft )
- {
- if( e2->Side == esLeft )
- {
- //z y x a b c
- ReversePolyPtLinks(p2_lft);
- p2_lft->Next = p1_lft;
- p1_lft->Prev = p2_lft;
- p1_rt->Next = p2_rt;
- p2_rt->Prev = p1_rt;
- outRec1->Pts = p2_rt;
- } else
- {
- //x y z a b c
- p2_rt->Next = p1_lft;
- p1_lft->Prev = p2_rt;
- p2_lft->Prev = p1_rt;
- p1_rt->Next = p2_lft;
- outRec1->Pts = p2_lft;
- }
- } else
- {
- if( e2->Side == esRight )
- {
- //a b c z y x
- ReversePolyPtLinks(p2_lft);
- p1_rt->Next = p2_rt;
- p2_rt->Prev = p1_rt;
- p2_lft->Next = p1_lft;
- p1_lft->Prev = p2_lft;
- } else
- {
- //a b c x y z
- p1_rt->Next = p2_lft;
- p2_lft->Prev = p1_rt;
- p1_lft->Prev = p2_rt;
- p2_rt->Next = p1_lft;
- }
- }
-
- outRec1->BottomPt = 0;
- if (holeStateRec == outRec2)
- {
- if (outRec2->FirstLeft != outRec1)
- outRec1->FirstLeft = outRec2->FirstLeft;
- outRec1->IsHole = outRec2->IsHole;
- }
- outRec2->Pts = 0;
- outRec2->BottomPt = 0;
- outRec2->FirstLeft = outRec1;
-
- int OKIdx = e1->OutIdx;
- int ObsoleteIdx = e2->OutIdx;
-
- e1->OutIdx = Unassigned; //nb: safe because we only get here via AddLocalMaxPoly
- e2->OutIdx = Unassigned;
-
- TEdge* e = m_ActiveEdges;
- while( e )
- {
- if( e->OutIdx == ObsoleteIdx )
- {
- e->OutIdx = OKIdx;
- e->Side = e1->Side;
- break;
- }
- e = e->NextInAEL;
- }
-
- outRec2->Idx = outRec1->Idx;
-}
-//------------------------------------------------------------------------------
-
-OutPt* Clipper::AddOutPt(TEdge *e, const IntPoint &pt)
-{
- if( e->OutIdx < 0 )
- {
- OutRec *outRec = CreateOutRec();
- outRec->IsOpen = (e->WindDelta == 0);
- OutPt* newOp = new OutPt;
- outRec->Pts = newOp;
- newOp->Idx = outRec->Idx;
- newOp->Pt = pt;
- newOp->Next = newOp;
- newOp->Prev = newOp;
- if (!outRec->IsOpen)
- SetHoleState(e, outRec);
- e->OutIdx = outRec->Idx;
- return newOp;
- } else
- {
- OutRec *outRec = m_PolyOuts[e->OutIdx];
- //OutRec.Pts is the 'Left-most' point & OutRec.Pts.Prev is the 'Right-most'
- OutPt* op = outRec->Pts;
-
- bool ToFront = (e->Side == esLeft);
- if (ToFront && (pt == op->Pt)) return op;
- else if (!ToFront && (pt == op->Prev->Pt)) return op->Prev;
-
- OutPt* newOp = new OutPt;
- newOp->Idx = outRec->Idx;
- newOp->Pt = pt;
- newOp->Next = op;
- newOp->Prev = op->Prev;
- newOp->Prev->Next = newOp;
- op->Prev = newOp;
- if (ToFront) outRec->Pts = newOp;
- return newOp;
- }
-}
-//------------------------------------------------------------------------------
-
-OutPt* Clipper::GetLastOutPt(TEdge *e)
-{
- OutRec *outRec = m_PolyOuts[e->OutIdx];
- if (e->Side == esLeft)
- return outRec->Pts;
- else
- return outRec->Pts->Prev;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::ProcessHorizontals()
-{
- TEdge* horzEdge;
- while (PopEdgeFromSEL(horzEdge))
- ProcessHorizontal(horzEdge);
-}
-//------------------------------------------------------------------------------
-
-inline bool IsMinima(TEdge *e)
-{
- return e && (e->Prev->NextInLML != e) && (e->Next->NextInLML != e);
-}
-//------------------------------------------------------------------------------
-
-inline bool IsMaxima(TEdge *e, const cInt Y)
-{
- return e && e->Top.Y == Y && !e->NextInLML;
-}
-//------------------------------------------------------------------------------
-
-inline bool IsIntermediate(TEdge *e, const cInt Y)
-{
- return e->Top.Y == Y && e->NextInLML;
-}
-//------------------------------------------------------------------------------
-
-TEdge *GetMaximaPair(TEdge *e)
-{
- if ((e->Next->Top == e->Top) && !e->Next->NextInLML)
- return e->Next;
- else if ((e->Prev->Top == e->Top) && !e->Prev->NextInLML)
- return e->Prev;
- else return 0;
-}
-//------------------------------------------------------------------------------
-
-TEdge *GetMaximaPairEx(TEdge *e)
-{
- //as GetMaximaPair() but returns 0 if MaxPair isn't in AEL (unless it's horizontal)
- TEdge* result = GetMaximaPair(e);
- if (result && (result->OutIdx == Skip ||
- (result->NextInAEL == result->PrevInAEL && !IsHorizontal(*result)))) return 0;
- return result;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::SwapPositionsInSEL(TEdge *Edge1, TEdge *Edge2)
-{
- if( !( Edge1->NextInSEL ) && !( Edge1->PrevInSEL ) ) return;
- if( !( Edge2->NextInSEL ) && !( Edge2->PrevInSEL ) ) return;
-
- if( Edge1->NextInSEL == Edge2 )
- {
- TEdge* Next = Edge2->NextInSEL;
- if( Next ) Next->PrevInSEL = Edge1;
- TEdge* Prev = Edge1->PrevInSEL;
- if( Prev ) Prev->NextInSEL = Edge2;
- Edge2->PrevInSEL = Prev;
- Edge2->NextInSEL = Edge1;
- Edge1->PrevInSEL = Edge2;
- Edge1->NextInSEL = Next;
- }
- else if( Edge2->NextInSEL == Edge1 )
- {
- TEdge* Next = Edge1->NextInSEL;
- if( Next ) Next->PrevInSEL = Edge2;
- TEdge* Prev = Edge2->PrevInSEL;
- if( Prev ) Prev->NextInSEL = Edge1;
- Edge1->PrevInSEL = Prev;
- Edge1->NextInSEL = Edge2;
- Edge2->PrevInSEL = Edge1;
- Edge2->NextInSEL = Next;
- }
- else
- {
- TEdge* Next = Edge1->NextInSEL;
- TEdge* Prev = Edge1->PrevInSEL;
- Edge1->NextInSEL = Edge2->NextInSEL;
- if( Edge1->NextInSEL ) Edge1->NextInSEL->PrevInSEL = Edge1;
- Edge1->PrevInSEL = Edge2->PrevInSEL;
- if( Edge1->PrevInSEL ) Edge1->PrevInSEL->NextInSEL = Edge1;
- Edge2->NextInSEL = Next;
- if( Edge2->NextInSEL ) Edge2->NextInSEL->PrevInSEL = Edge2;
- Edge2->PrevInSEL = Prev;
- if( Edge2->PrevInSEL ) Edge2->PrevInSEL->NextInSEL = Edge2;
- }
-
- if( !Edge1->PrevInSEL ) m_SortedEdges = Edge1;
- else if( !Edge2->PrevInSEL ) m_SortedEdges = Edge2;
-}
-//------------------------------------------------------------------------------
-
-TEdge* GetNextInAEL(TEdge *e, Direction dir)
-{
- return dir == dLeftToRight ? e->NextInAEL : e->PrevInAEL;
-}
-//------------------------------------------------------------------------------
-
-void GetHorzDirection(TEdge& HorzEdge, Direction& Dir, cInt& Left, cInt& Right)
-{
- if (HorzEdge.Bot.X < HorzEdge.Top.X)
- {
- Left = HorzEdge.Bot.X;
- Right = HorzEdge.Top.X;
- Dir = dLeftToRight;
- } else
- {
- Left = HorzEdge.Top.X;
- Right = HorzEdge.Bot.X;
- Dir = dRightToLeft;
- }
-}
-//------------------------------------------------------------------------
-
-/*******************************************************************************
-* Notes: Horizontal edges (HEs) at scanline intersections (ie at the Top or *
-* Bottom of a scanbeam) are processed as if layered. The order in which HEs *
-* are processed doesn't matter. HEs intersect with other HE Bot.Xs only [#] *
-* (or they could intersect with Top.Xs only, ie EITHER Bot.Xs OR Top.Xs), *
-* and with other non-horizontal edges [*]. Once these intersections are *
-* processed, intermediate HEs then 'promote' the Edge above (NextInLML) into *
-* the AEL. These 'promoted' edges may in turn intersect [%] with other HEs. *
-*******************************************************************************/
-
-void Clipper::ProcessHorizontal(TEdge *horzEdge)
-{
- Direction dir;
- cInt horzLeft, horzRight;
- bool IsOpen = (horzEdge->WindDelta == 0);
-
- GetHorzDirection(*horzEdge, dir, horzLeft, horzRight);
-
- TEdge* eLastHorz = horzEdge, *eMaxPair = 0;
- while (eLastHorz->NextInLML && IsHorizontal(*eLastHorz->NextInLML))
- eLastHorz = eLastHorz->NextInLML;
- if (!eLastHorz->NextInLML)
- eMaxPair = GetMaximaPair(eLastHorz);
-
- MaximaList::const_iterator maxIt;
- MaximaList::const_reverse_iterator maxRit;
- if (m_Maxima.size() > 0)
- {
- //get the first maxima in range (X) ...
- if (dir == dLeftToRight)
- {
- maxIt = m_Maxima.begin();
- while (maxIt != m_Maxima.end() && *maxIt <= horzEdge->Bot.X) maxIt++;
- if (maxIt != m_Maxima.end() && *maxIt >= eLastHorz->Top.X)
- maxIt = m_Maxima.end();
- }
- else
- {
- maxRit = m_Maxima.rbegin();
- while (maxRit != m_Maxima.rend() && *maxRit > horzEdge->Bot.X) maxRit++;
- if (maxRit != m_Maxima.rend() && *maxRit <= eLastHorz->Top.X)
- maxRit = m_Maxima.rend();
- }
- }
-
- OutPt* op1 = 0;
-
- for (;;) //loop through consec. horizontal edges
- {
-
- bool IsLastHorz = (horzEdge == eLastHorz);
- TEdge* e = GetNextInAEL(horzEdge, dir);
- while(e)
- {
-
- //this code block inserts extra coords into horizontal edges (in output
- //polygons) whereever maxima touch these horizontal edges. This helps
- //'simplifying' polygons (ie if the Simplify property is set).
- if (m_Maxima.size() > 0)
- {
- if (dir == dLeftToRight)
- {
- while (maxIt != m_Maxima.end() && *maxIt < e->Curr.X)
- {
- if (horzEdge->OutIdx >= 0 && !IsOpen)
- AddOutPt(horzEdge, IntPoint(*maxIt, horzEdge->Bot.Y));
- maxIt++;
- }
- }
- else
- {
- while (maxRit != m_Maxima.rend() && *maxRit > e->Curr.X)
- {
- if (horzEdge->OutIdx >= 0 && !IsOpen)
- AddOutPt(horzEdge, IntPoint(*maxRit, horzEdge->Bot.Y));
- maxRit++;
- }
- }
- };
-
- if ((dir == dLeftToRight && e->Curr.X > horzRight) ||
- (dir == dRightToLeft && e->Curr.X < horzLeft)) break;
-
- //Also break if we've got to the end of an intermediate horizontal edge ...
- //nb: Smaller Dx's are to the right of larger Dx's ABOVE the horizontal.
- if (e->Curr.X == horzEdge->Top.X && horzEdge->NextInLML &&
- e->Dx < horzEdge->NextInLML->Dx) break;
-
- if (horzEdge->OutIdx >= 0 && !IsOpen) //note: may be done multiple times
- {
-#ifdef use_xyz
- if (dir == dLeftToRight) SetZ(e->Curr, *horzEdge, *e);
- else SetZ(e->Curr, *e, *horzEdge);
-#endif
- op1 = AddOutPt(horzEdge, e->Curr);
- TEdge* eNextHorz = m_SortedEdges;
- while (eNextHorz)
- {
- if (eNextHorz->OutIdx >= 0 &&
- HorzSegmentsOverlap(horzEdge->Bot.X,
- horzEdge->Top.X, eNextHorz->Bot.X, eNextHorz->Top.X))
- {
- OutPt* op2 = GetLastOutPt(eNextHorz);
- AddJoin(op2, op1, eNextHorz->Top);
- }
- eNextHorz = eNextHorz->NextInSEL;
- }
- AddGhostJoin(op1, horzEdge->Bot);
- }
-
- //OK, so far we're still in range of the horizontal Edge but make sure
- //we're at the last of consec. horizontals when matching with eMaxPair
- if(e == eMaxPair && IsLastHorz)
- {
- if (horzEdge->OutIdx >= 0)
- AddLocalMaxPoly(horzEdge, eMaxPair, horzEdge->Top);
- DeleteFromAEL(horzEdge);
- DeleteFromAEL(eMaxPair);
- return;
- }
-
- if(dir == dLeftToRight)
- {
- IntPoint Pt = IntPoint(e->Curr.X, horzEdge->Curr.Y);
- IntersectEdges(horzEdge, e, Pt);
- }
- else
- {
- IntPoint Pt = IntPoint(e->Curr.X, horzEdge->Curr.Y);
- IntersectEdges( e, horzEdge, Pt);
- }
- TEdge* eNext = GetNextInAEL(e, dir);
- SwapPositionsInAEL( horzEdge, e );
- e = eNext;
- } //end while(e)
-
- //Break out of loop if HorzEdge.NextInLML is not also horizontal ...
- if (!horzEdge->NextInLML || !IsHorizontal(*horzEdge->NextInLML)) break;
-
- UpdateEdgeIntoAEL(horzEdge);
- if (horzEdge->OutIdx >= 0) AddOutPt(horzEdge, horzEdge->Bot);
- GetHorzDirection(*horzEdge, dir, horzLeft, horzRight);
-
- } //end for (;;)
-
- if (horzEdge->OutIdx >= 0 && !op1)
- {
- op1 = GetLastOutPt(horzEdge);
- TEdge* eNextHorz = m_SortedEdges;
- while (eNextHorz)
- {
- if (eNextHorz->OutIdx >= 0 &&
- HorzSegmentsOverlap(horzEdge->Bot.X,
- horzEdge->Top.X, eNextHorz->Bot.X, eNextHorz->Top.X))
- {
- OutPt* op2 = GetLastOutPt(eNextHorz);
- AddJoin(op2, op1, eNextHorz->Top);
- }
- eNextHorz = eNextHorz->NextInSEL;
- }
- AddGhostJoin(op1, horzEdge->Top);
- }
-
- if (horzEdge->NextInLML)
- {
- if(horzEdge->OutIdx >= 0)
- {
- op1 = AddOutPt( horzEdge, horzEdge->Top);
- UpdateEdgeIntoAEL(horzEdge);
- if (horzEdge->WindDelta == 0) return;
- //nb: HorzEdge is no longer horizontal here
- TEdge* ePrev = horzEdge->PrevInAEL;
- TEdge* eNext = horzEdge->NextInAEL;
- if (ePrev && ePrev->Curr.X == horzEdge->Bot.X &&
- ePrev->Curr.Y == horzEdge->Bot.Y && ePrev->WindDelta != 0 &&
- (ePrev->OutIdx >= 0 && ePrev->Curr.Y > ePrev->Top.Y &&
- SlopesEqual(*horzEdge, *ePrev, m_UseFullRange)))
- {
- OutPt* op2 = AddOutPt(ePrev, horzEdge->Bot);
- AddJoin(op1, op2, horzEdge->Top);
- }
- else if (eNext && eNext->Curr.X == horzEdge->Bot.X &&
- eNext->Curr.Y == horzEdge->Bot.Y && eNext->WindDelta != 0 &&
- eNext->OutIdx >= 0 && eNext->Curr.Y > eNext->Top.Y &&
- SlopesEqual(*horzEdge, *eNext, m_UseFullRange))
- {
- OutPt* op2 = AddOutPt(eNext, horzEdge->Bot);
- AddJoin(op1, op2, horzEdge->Top);
- }
- }
- else
- UpdateEdgeIntoAEL(horzEdge);
- }
- else
- {
- if (horzEdge->OutIdx >= 0) AddOutPt(horzEdge, horzEdge->Top);
- DeleteFromAEL(horzEdge);
- }
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::ProcessIntersections(const cInt topY)
-{
- if( !m_ActiveEdges ) return true;
- try {
- BuildIntersectList(topY);
- size_t IlSize = m_IntersectList.size();
- if (IlSize == 0) return true;
- if (IlSize == 1 || FixupIntersectionOrder()) ProcessIntersectList();
- else return false;
- }
- catch(...)
- {
- m_SortedEdges = 0;
- DisposeIntersectNodes();
- throw clipperException("ProcessIntersections error");
- }
- m_SortedEdges = 0;
- return true;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::DisposeIntersectNodes()
-{
- for (size_t i = 0; i < m_IntersectList.size(); ++i )
- delete m_IntersectList[i];
- m_IntersectList.clear();
-}
-//------------------------------------------------------------------------------
-
-void Clipper::BuildIntersectList(const cInt topY)
-{
- if ( !m_ActiveEdges ) return;
-
- //prepare for sorting ...
- TEdge* e = m_ActiveEdges;
- m_SortedEdges = e;
- while( e )
- {
- e->PrevInSEL = e->PrevInAEL;
- e->NextInSEL = e->NextInAEL;
- e->Curr.X = TopX( *e, topY );
- e = e->NextInAEL;
- }
-
- //bubblesort ...
- bool isModified;
- do
- {
- isModified = false;
- e = m_SortedEdges;
- while( e->NextInSEL )
- {
- TEdge *eNext = e->NextInSEL;
- IntPoint Pt;
- if(e->Curr.X > eNext->Curr.X)
- {
- IntersectPoint(*e, *eNext, Pt);
- if (Pt.Y < topY) Pt = IntPoint(TopX(*e, topY), topY);
- IntersectNode * newNode = new IntersectNode;
- newNode->Edge1 = e;
- newNode->Edge2 = eNext;
- newNode->Pt = Pt;
- m_IntersectList.push_back(newNode);
-
- SwapPositionsInSEL(e, eNext);
- isModified = true;
- }
- else
- e = eNext;
- }
- if( e->PrevInSEL ) e->PrevInSEL->NextInSEL = 0;
- else break;
- }
- while ( isModified );
- m_SortedEdges = 0; //important
-}
-//------------------------------------------------------------------------------
-
-
-void Clipper::ProcessIntersectList()
-{
- for (size_t i = 0; i < m_IntersectList.size(); ++i)
- {
- IntersectNode* iNode = m_IntersectList[i];
- {
- IntersectEdges( iNode->Edge1, iNode->Edge2, iNode->Pt);
- SwapPositionsInAEL( iNode->Edge1 , iNode->Edge2 );
- }
- delete iNode;
- }
- m_IntersectList.clear();
-}
-//------------------------------------------------------------------------------
-
-bool IntersectListSort(IntersectNode* node1, IntersectNode* node2)
-{
- return node2->Pt.Y < node1->Pt.Y;
-}
-//------------------------------------------------------------------------------
-
-inline bool EdgesAdjacent(const IntersectNode &inode)
-{
- return (inode.Edge1->NextInSEL == inode.Edge2) ||
- (inode.Edge1->PrevInSEL == inode.Edge2);
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::FixupIntersectionOrder()
-{
- //pre-condition: intersections are sorted Bottom-most first.
- //Now it's crucial that intersections are made only between adjacent edges,
- //so to ensure this the order of intersections may need adjusting ...
- CopyAELToSEL();
- std::sort(m_IntersectList.begin(), m_IntersectList.end(), IntersectListSort);
- size_t cnt = m_IntersectList.size();
- for (size_t i = 0; i < cnt; ++i)
- {
- if (!EdgesAdjacent(*m_IntersectList[i]))
- {
- size_t j = i + 1;
- while (j < cnt && !EdgesAdjacent(*m_IntersectList[j])) j++;
- if (j == cnt) return false;
- std::swap(m_IntersectList[i], m_IntersectList[j]);
- }
- SwapPositionsInSEL(m_IntersectList[i]->Edge1, m_IntersectList[i]->Edge2);
- }
- return true;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::DoMaxima(TEdge *e)
-{
- TEdge* eMaxPair = GetMaximaPairEx(e);
- if (!eMaxPair)
- {
- if (e->OutIdx >= 0)
- AddOutPt(e, e->Top);
- DeleteFromAEL(e);
- return;
- }
-
- TEdge* eNext = e->NextInAEL;
- while(eNext && eNext != eMaxPair)
- {
- IntersectEdges(e, eNext, e->Top);
- SwapPositionsInAEL(e, eNext);
- eNext = e->NextInAEL;
- }
-
- if(e->OutIdx == Unassigned && eMaxPair->OutIdx == Unassigned)
- {
- DeleteFromAEL(e);
- DeleteFromAEL(eMaxPair);
- }
- else if( e->OutIdx >= 0 && eMaxPair->OutIdx >= 0 )
- {
- if (e->OutIdx >= 0) AddLocalMaxPoly(e, eMaxPair, e->Top);
- DeleteFromAEL(e);
- DeleteFromAEL(eMaxPair);
- }
-#ifdef use_lines
- else if (e->WindDelta == 0)
- {
- if (e->OutIdx >= 0)
- {
- AddOutPt(e, e->Top);
- e->OutIdx = Unassigned;
- }
- DeleteFromAEL(e);
-
- if (eMaxPair->OutIdx >= 0)
- {
- AddOutPt(eMaxPair, e->Top);
- eMaxPair->OutIdx = Unassigned;
- }
- DeleteFromAEL(eMaxPair);
- }
-#endif
- else throw clipperException("DoMaxima error");
-}
-//------------------------------------------------------------------------------
-
-void Clipper::ProcessEdgesAtTopOfScanbeam(const cInt topY)
-{
- TEdge* e = m_ActiveEdges;
- while( e )
- {
- //1. process maxima, treating them as if they're 'bent' horizontal edges,
- // but exclude maxima with horizontal edges. nb: e can't be a horizontal.
- bool IsMaximaEdge = IsMaxima(e, topY);
-
- if(IsMaximaEdge)
- {
- TEdge* eMaxPair = GetMaximaPairEx(e);
- IsMaximaEdge = (!eMaxPair || !IsHorizontal(*eMaxPair));
- }
-
- if(IsMaximaEdge)
- {
- if (m_StrictSimple) m_Maxima.push_back(e->Top.X);
- TEdge* ePrev = e->PrevInAEL;
- DoMaxima(e);
- if( !ePrev ) e = m_ActiveEdges;
- else e = ePrev->NextInAEL;
- }
- else
- {
- //2. promote horizontal edges, otherwise update Curr.X and Curr.Y ...
- if (IsIntermediate(e, topY) && IsHorizontal(*e->NextInLML))
- {
- UpdateEdgeIntoAEL(e);
- if (e->OutIdx >= 0)
- AddOutPt(e, e->Bot);
- AddEdgeToSEL(e);
- }
- else
- {
- e->Curr.X = TopX( *e, topY );
- e->Curr.Y = topY;
-#ifdef use_xyz
- e->Curr.Z = topY == e->Top.Y ? e->Top.Z : (topY == e->Bot.Y ? e->Bot.Z : 0);
-#endif
- }
-
- //When StrictlySimple and 'e' is being touched by another edge, then
- //make sure both edges have a vertex here ...
- if (m_StrictSimple)
- {
- TEdge* ePrev = e->PrevInAEL;
- if ((e->OutIdx >= 0) && (e->WindDelta != 0) && ePrev && (ePrev->OutIdx >= 0) &&
- (ePrev->Curr.X == e->Curr.X) && (ePrev->WindDelta != 0))
- {
- IntPoint pt = e->Curr;
-#ifdef use_xyz
- SetZ(pt, *ePrev, *e);
-#endif
- OutPt* op = AddOutPt(ePrev, pt);
- OutPt* op2 = AddOutPt(e, pt);
- AddJoin(op, op2, pt); //StrictlySimple (type-3) join
- }
- }
-
- e = e->NextInAEL;
- }
- }
-
- //3. Process horizontals at the Top of the scanbeam ...
- m_Maxima.sort();
- ProcessHorizontals();
- m_Maxima.clear();
-
- //4. Promote intermediate vertices ...
- e = m_ActiveEdges;
- while(e)
- {
- if(IsIntermediate(e, topY))
- {
- OutPt* op = 0;
- if( e->OutIdx >= 0 )
- op = AddOutPt(e, e->Top);
- UpdateEdgeIntoAEL(e);
-
- //if output polygons share an edge, they'll need joining later ...
- TEdge* ePrev = e->PrevInAEL;
- TEdge* eNext = e->NextInAEL;
- if (ePrev && ePrev->Curr.X == e->Bot.X &&
- ePrev->Curr.Y == e->Bot.Y && op &&
- ePrev->OutIdx >= 0 && ePrev->Curr.Y > ePrev->Top.Y &&
- SlopesEqual(e->Curr, e->Top, ePrev->Curr, ePrev->Top, m_UseFullRange) &&
- (e->WindDelta != 0) && (ePrev->WindDelta != 0))
- {
- OutPt* op2 = AddOutPt(ePrev, e->Bot);
- AddJoin(op, op2, e->Top);
- }
- else if (eNext && eNext->Curr.X == e->Bot.X &&
- eNext->Curr.Y == e->Bot.Y && op &&
- eNext->OutIdx >= 0 && eNext->Curr.Y > eNext->Top.Y &&
- SlopesEqual(e->Curr, e->Top, eNext->Curr, eNext->Top, m_UseFullRange) &&
- (e->WindDelta != 0) && (eNext->WindDelta != 0))
- {
- OutPt* op2 = AddOutPt(eNext, e->Bot);
- AddJoin(op, op2, e->Top);
- }
- }
- e = e->NextInAEL;
- }
-}
-//------------------------------------------------------------------------------
-
-void Clipper::FixupOutPolyline(OutRec &outrec)
-{
- OutPt *pp = outrec.Pts;
- OutPt *lastPP = pp->Prev;
- while (pp != lastPP)
- {
- pp = pp->Next;
- if (pp->Pt == pp->Prev->Pt)
- {
- if (pp == lastPP) lastPP = pp->Prev;
- OutPt *tmpPP = pp->Prev;
- tmpPP->Next = pp->Next;
- pp->Next->Prev = tmpPP;
- delete pp;
- pp = tmpPP;
- }
- }
-
- if (pp == pp->Prev)
- {
- DisposeOutPts(pp);
- outrec.Pts = 0;
- return;
- }
-}
-//------------------------------------------------------------------------------
-
-void Clipper::FixupOutPolygon(OutRec &outrec)
-{
- //FixupOutPolygon() - removes duplicate points and simplifies consecutive
- //parallel edges by removing the middle vertex.
- OutPt *lastOK = 0;
- outrec.BottomPt = 0;
- OutPt *pp = outrec.Pts;
- bool preserveCol = m_PreserveCollinear || m_StrictSimple;
-
- for (;;)
- {
- if (pp->Prev == pp || pp->Prev == pp->Next)
- {
- DisposeOutPts(pp);
- outrec.Pts = 0;
- return;
- }
-
- //test for duplicate points and collinear edges ...
- if ((pp->Pt == pp->Next->Pt) || (pp->Pt == pp->Prev->Pt) ||
- (SlopesEqual(pp->Prev->Pt, pp->Pt, pp->Next->Pt, m_UseFullRange) &&
- (!preserveCol || !Pt2IsBetweenPt1AndPt3(pp->Prev->Pt, pp->Pt, pp->Next->Pt))))
- {
- lastOK = 0;
- OutPt *tmp = pp;
- pp->Prev->Next = pp->Next;
- pp->Next->Prev = pp->Prev;
- pp = pp->Prev;
- delete tmp;
- }
- else if (pp == lastOK) break;
- else
- {
- if (!lastOK) lastOK = pp;
- pp = pp->Next;
- }
- }
- outrec.Pts = pp;
-}
-//------------------------------------------------------------------------------
-
-int PointCount(OutPt *Pts)
-{
- if (!Pts) return 0;
- int result = 0;
- OutPt* p = Pts;
- do
- {
- result++;
- p = p->Next;
- }
- while (p != Pts);
- return result;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::BuildResult(Paths &polys)
-{
- polys.reserve(m_PolyOuts.size());
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- {
- if (!m_PolyOuts[i]->Pts) continue;
- Path pg;
- OutPt* p = m_PolyOuts[i]->Pts->Prev;
- int cnt = PointCount(p);
- if (cnt < 2) continue;
- pg.reserve(cnt);
- for (int i = 0; i < cnt; ++i)
- {
- pg.push_back(p->Pt);
- p = p->Prev;
- }
- polys.push_back(pg);
- }
-}
-//------------------------------------------------------------------------------
-
-void Clipper::BuildResult2(PolyTree& polytree)
-{
- polytree.Clear();
- polytree.AllNodes.reserve(m_PolyOuts.size());
- //add each output polygon/contour to polytree ...
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++)
- {
- OutRec* outRec = m_PolyOuts[i];
- int cnt = PointCount(outRec->Pts);
- if ((outRec->IsOpen && cnt < 2) || (!outRec->IsOpen && cnt < 3)) continue;
- FixHoleLinkage(*outRec);
- PolyNode* pn = new PolyNode();
- //nb: polytree takes ownership of all the PolyNodes
- polytree.AllNodes.push_back(pn);
- outRec->PolyNd = pn;
- pn->Parent = 0;
- pn->Index = 0;
- pn->Contour.reserve(cnt);
- OutPt *op = outRec->Pts->Prev;
- for (int j = 0; j < cnt; j++)
- {
- pn->Contour.push_back(op->Pt);
- op = op->Prev;
- }
- }
-
- //fixup PolyNode links etc ...
- polytree.Childs.reserve(m_PolyOuts.size());
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++)
- {
- OutRec* outRec = m_PolyOuts[i];
- if (!outRec->PolyNd) continue;
- if (outRec->IsOpen)
- {
- outRec->PolyNd->m_IsOpen = true;
- polytree.AddChild(*outRec->PolyNd);
- }
- else if (outRec->FirstLeft && outRec->FirstLeft->PolyNd)
- outRec->FirstLeft->PolyNd->AddChild(*outRec->PolyNd);
- else
- polytree.AddChild(*outRec->PolyNd);
- }
-}
-//------------------------------------------------------------------------------
-
-void SwapIntersectNodes(IntersectNode &int1, IntersectNode &int2)
-{
- //just swap the contents (because fIntersectNodes is a single-linked-list)
- IntersectNode inode = int1; //gets a copy of Int1
- int1.Edge1 = int2.Edge1;
- int1.Edge2 = int2.Edge2;
- int1.Pt = int2.Pt;
- int2.Edge1 = inode.Edge1;
- int2.Edge2 = inode.Edge2;
- int2.Pt = inode.Pt;
-}
-//------------------------------------------------------------------------------
-
-inline bool E2InsertsBeforeE1(TEdge &e1, TEdge &e2)
-{
- if (e2.Curr.X == e1.Curr.X)
- {
- if (e2.Top.Y > e1.Top.Y)
- return e2.Top.X < TopX(e1, e2.Top.Y);
- else return e1.Top.X > TopX(e2, e1.Top.Y);
- }
- else return e2.Curr.X < e1.Curr.X;
-}
-//------------------------------------------------------------------------------
-
-bool GetOverlap(const cInt a1, const cInt a2, const cInt b1, const cInt b2,
- cInt& Left, cInt& Right)
-{
- if (a1 < a2)
- {
- if (b1 < b2) {Left = std::max(a1,b1); Right = std::min(a2,b2);}
- else {Left = std::max(a1,b2); Right = std::min(a2,b1);}
- }
- else
- {
- if (b1 < b2) {Left = std::max(a2,b1); Right = std::min(a1,b2);}
- else {Left = std::max(a2,b2); Right = std::min(a1,b1);}
- }
- return Left < Right;
-}
-//------------------------------------------------------------------------------
-
-inline void UpdateOutPtIdxs(OutRec& outrec)
-{
- OutPt* op = outrec.Pts;
- do
- {
- op->Idx = outrec.Idx;
- op = op->Prev;
- }
- while(op != outrec.Pts);
-}
-//------------------------------------------------------------------------------
-
-void Clipper::InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge)
-{
- if(!m_ActiveEdges)
- {
- edge->PrevInAEL = 0;
- edge->NextInAEL = 0;
- m_ActiveEdges = edge;
- }
- else if(!startEdge && E2InsertsBeforeE1(*m_ActiveEdges, *edge))
- {
- edge->PrevInAEL = 0;
- edge->NextInAEL = m_ActiveEdges;
- m_ActiveEdges->PrevInAEL = edge;
- m_ActiveEdges = edge;
- }
- else
- {
- if(!startEdge) startEdge = m_ActiveEdges;
- while(startEdge->NextInAEL &&
- !E2InsertsBeforeE1(*startEdge->NextInAEL , *edge))
- startEdge = startEdge->NextInAEL;
- edge->NextInAEL = startEdge->NextInAEL;
- if(startEdge->NextInAEL) startEdge->NextInAEL->PrevInAEL = edge;
- edge->PrevInAEL = startEdge;
- startEdge->NextInAEL = edge;
- }
-}
-//----------------------------------------------------------------------
-
-OutPt* DupOutPt(OutPt* outPt, bool InsertAfter)
-{
- OutPt* result = new OutPt;
- result->Pt = outPt->Pt;
- result->Idx = outPt->Idx;
- if (InsertAfter)
- {
- result->Next = outPt->Next;
- result->Prev = outPt;
- outPt->Next->Prev = result;
- outPt->Next = result;
- }
- else
- {
- result->Prev = outPt->Prev;
- result->Next = outPt;
- outPt->Prev->Next = result;
- outPt->Prev = result;
- }
- return result;
-}
-//------------------------------------------------------------------------------
-
-bool JoinHorz(OutPt* op1, OutPt* op1b, OutPt* op2, OutPt* op2b,
- const IntPoint Pt, bool DiscardLeft)
-{
- Direction Dir1 = (op1->Pt.X > op1b->Pt.X ? dRightToLeft : dLeftToRight);
- Direction Dir2 = (op2->Pt.X > op2b->Pt.X ? dRightToLeft : dLeftToRight);
- if (Dir1 == Dir2) return false;
-
- //When DiscardLeft, we want Op1b to be on the Left of Op1, otherwise we
- //want Op1b to be on the Right. (And likewise with Op2 and Op2b.)
- //So, to facilitate this while inserting Op1b and Op2b ...
- //when DiscardLeft, make sure we're AT or RIGHT of Pt before adding Op1b,
- //otherwise make sure we're AT or LEFT of Pt. (Likewise with Op2b.)
- if (Dir1 == dLeftToRight)
- {
- while (op1->Next->Pt.X <= Pt.X &&
- op1->Next->Pt.X >= op1->Pt.X && op1->Next->Pt.Y == Pt.Y)
- op1 = op1->Next;
- if (DiscardLeft && (op1->Pt.X != Pt.X)) op1 = op1->Next;
- op1b = DupOutPt(op1, !DiscardLeft);
- if (op1b->Pt != Pt)
- {
- op1 = op1b;
- op1->Pt = Pt;
- op1b = DupOutPt(op1, !DiscardLeft);
- }
- }
- else
- {
- while (op1->Next->Pt.X >= Pt.X &&
- op1->Next->Pt.X <= op1->Pt.X && op1->Next->Pt.Y == Pt.Y)
- op1 = op1->Next;
- if (!DiscardLeft && (op1->Pt.X != Pt.X)) op1 = op1->Next;
- op1b = DupOutPt(op1, DiscardLeft);
- if (op1b->Pt != Pt)
- {
- op1 = op1b;
- op1->Pt = Pt;
- op1b = DupOutPt(op1, DiscardLeft);
- }
- }
-
- if (Dir2 == dLeftToRight)
- {
- while (op2->Next->Pt.X <= Pt.X &&
- op2->Next->Pt.X >= op2->Pt.X && op2->Next->Pt.Y == Pt.Y)
- op2 = op2->Next;
- if (DiscardLeft && (op2->Pt.X != Pt.X)) op2 = op2->Next;
- op2b = DupOutPt(op2, !DiscardLeft);
- if (op2b->Pt != Pt)
- {
- op2 = op2b;
- op2->Pt = Pt;
- op2b = DupOutPt(op2, !DiscardLeft);
- };
- } else
- {
- while (op2->Next->Pt.X >= Pt.X &&
- op2->Next->Pt.X <= op2->Pt.X && op2->Next->Pt.Y == Pt.Y)
- op2 = op2->Next;
- if (!DiscardLeft && (op2->Pt.X != Pt.X)) op2 = op2->Next;
- op2b = DupOutPt(op2, DiscardLeft);
- if (op2b->Pt != Pt)
- {
- op2 = op2b;
- op2->Pt = Pt;
- op2b = DupOutPt(op2, DiscardLeft);
- };
- };
-
- if ((Dir1 == dLeftToRight) == DiscardLeft)
- {
- op1->Prev = op2;
- op2->Next = op1;
- op1b->Next = op2b;
- op2b->Prev = op1b;
- }
- else
- {
- op1->Next = op2;
- op2->Prev = op1;
- op1b->Prev = op2b;
- op2b->Next = op1b;
- }
- return true;
-}
-//------------------------------------------------------------------------------
-
-bool Clipper::JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2)
-{
- OutPt *op1 = j->OutPt1, *op1b;
- OutPt *op2 = j->OutPt2, *op2b;
-
- //There are 3 kinds of joins for output polygons ...
- //1. Horizontal joins where Join.OutPt1 & Join.OutPt2 are vertices anywhere
- //along (horizontal) collinear edges (& Join.OffPt is on the same horizontal).
- //2. Non-horizontal joins where Join.OutPt1 & Join.OutPt2 are at the same
- //location at the Bottom of the overlapping segment (& Join.OffPt is above).
- //3. StrictSimple joins where edges touch but are not collinear and where
- //Join.OutPt1, Join.OutPt2 & Join.OffPt all share the same point.
- bool isHorizontal = (j->OutPt1->Pt.Y == j->OffPt.Y);
-
- if (isHorizontal && (j->OffPt == j->OutPt1->Pt) &&
- (j->OffPt == j->OutPt2->Pt))
- {
- //Strictly Simple join ...
- if (outRec1 != outRec2) return false;
- op1b = j->OutPt1->Next;
- while (op1b != op1 && (op1b->Pt == j->OffPt))
- op1b = op1b->Next;
- bool reverse1 = (op1b->Pt.Y > j->OffPt.Y);
- op2b = j->OutPt2->Next;
- while (op2b != op2 && (op2b->Pt == j->OffPt))
- op2b = op2b->Next;
- bool reverse2 = (op2b->Pt.Y > j->OffPt.Y);
- if (reverse1 == reverse2) return false;
- if (reverse1)
- {
- op1b = DupOutPt(op1, false);
- op2b = DupOutPt(op2, true);
- op1->Prev = op2;
- op2->Next = op1;
- op1b->Next = op2b;
- op2b->Prev = op1b;
- j->OutPt1 = op1;
- j->OutPt2 = op1b;
- return true;
- } else
- {
- op1b = DupOutPt(op1, true);
- op2b = DupOutPt(op2, false);
- op1->Next = op2;
- op2->Prev = op1;
- op1b->Prev = op2b;
- op2b->Next = op1b;
- j->OutPt1 = op1;
- j->OutPt2 = op1b;
- return true;
- }
- }
- else if (isHorizontal)
- {
- //treat horizontal joins differently to non-horizontal joins since with
- //them we're not yet sure where the overlapping is. OutPt1.Pt & OutPt2.Pt
- //may be anywhere along the horizontal edge.
- op1b = op1;
- while (op1->Prev->Pt.Y == op1->Pt.Y && op1->Prev != op1b && op1->Prev != op2)
- op1 = op1->Prev;
- while (op1b->Next->Pt.Y == op1b->Pt.Y && op1b->Next != op1 && op1b->Next != op2)
- op1b = op1b->Next;
- if (op1b->Next == op1 || op1b->Next == op2) return false; //a flat 'polygon'
-
- op2b = op2;
- while (op2->Prev->Pt.Y == op2->Pt.Y && op2->Prev != op2b && op2->Prev != op1b)
- op2 = op2->Prev;
- while (op2b->Next->Pt.Y == op2b->Pt.Y && op2b->Next != op2 && op2b->Next != op1)
- op2b = op2b->Next;
- if (op2b->Next == op2 || op2b->Next == op1) return false; //a flat 'polygon'
-
- cInt Left, Right;
- //Op1 --> Op1b & Op2 --> Op2b are the extremites of the horizontal edges
- if (!GetOverlap(op1->Pt.X, op1b->Pt.X, op2->Pt.X, op2b->Pt.X, Left, Right))
- return false;
-
- //DiscardLeftSide: when overlapping edges are joined, a spike will created
- //which needs to be cleaned up. However, we don't want Op1 or Op2 caught up
- //on the discard Side as either may still be needed for other joins ...
- IntPoint Pt;
- bool DiscardLeftSide;
- if (op1->Pt.X >= Left && op1->Pt.X <= Right)
- {
- Pt = op1->Pt; DiscardLeftSide = (op1->Pt.X > op1b->Pt.X);
- }
- else if (op2->Pt.X >= Left&& op2->Pt.X <= Right)
- {
- Pt = op2->Pt; DiscardLeftSide = (op2->Pt.X > op2b->Pt.X);
- }
- else if (op1b->Pt.X >= Left && op1b->Pt.X <= Right)
- {
- Pt = op1b->Pt; DiscardLeftSide = op1b->Pt.X > op1->Pt.X;
- }
- else
- {
- Pt = op2b->Pt; DiscardLeftSide = (op2b->Pt.X > op2->Pt.X);
- }
- j->OutPt1 = op1; j->OutPt2 = op2;
- return JoinHorz(op1, op1b, op2, op2b, Pt, DiscardLeftSide);
- } else
- {
- //nb: For non-horizontal joins ...
- // 1. Jr.OutPt1.Pt.Y == Jr.OutPt2.Pt.Y
- // 2. Jr.OutPt1.Pt > Jr.OffPt.Y
-
- //make sure the polygons are correctly oriented ...
- op1b = op1->Next;
- while ((op1b->Pt == op1->Pt) && (op1b != op1)) op1b = op1b->Next;
- bool Reverse1 = ((op1b->Pt.Y > op1->Pt.Y) ||
- !SlopesEqual(op1->Pt, op1b->Pt, j->OffPt, m_UseFullRange));
- if (Reverse1)
- {
- op1b = op1->Prev;
- while ((op1b->Pt == op1->Pt) && (op1b != op1)) op1b = op1b->Prev;
- if ((op1b->Pt.Y > op1->Pt.Y) ||
- !SlopesEqual(op1->Pt, op1b->Pt, j->OffPt, m_UseFullRange)) return false;
- };
- op2b = op2->Next;
- while ((op2b->Pt == op2->Pt) && (op2b != op2))op2b = op2b->Next;
- bool Reverse2 = ((op2b->Pt.Y > op2->Pt.Y) ||
- !SlopesEqual(op2->Pt, op2b->Pt, j->OffPt, m_UseFullRange));
- if (Reverse2)
- {
- op2b = op2->Prev;
- while ((op2b->Pt == op2->Pt) && (op2b != op2)) op2b = op2b->Prev;
- if ((op2b->Pt.Y > op2->Pt.Y) ||
- !SlopesEqual(op2->Pt, op2b->Pt, j->OffPt, m_UseFullRange)) return false;
- }
-
- if ((op1b == op1) || (op2b == op2) || (op1b == op2b) ||
- ((outRec1 == outRec2) && (Reverse1 == Reverse2))) return false;
-
- if (Reverse1)
- {
- op1b = DupOutPt(op1, false);
- op2b = DupOutPt(op2, true);
- op1->Prev = op2;
- op2->Next = op1;
- op1b->Next = op2b;
- op2b->Prev = op1b;
- j->OutPt1 = op1;
- j->OutPt2 = op1b;
- return true;
- } else
- {
- op1b = DupOutPt(op1, true);
- op2b = DupOutPt(op2, false);
- op1->Next = op2;
- op2->Prev = op1;
- op1b->Prev = op2b;
- op2b->Next = op1b;
- j->OutPt1 = op1;
- j->OutPt2 = op1b;
- return true;
- }
- }
-}
-//----------------------------------------------------------------------
-
-static OutRec* ParseFirstLeft(OutRec* FirstLeft)
-{
- while (FirstLeft && !FirstLeft->Pts)
- FirstLeft = FirstLeft->FirstLeft;
- return FirstLeft;
-}
-//------------------------------------------------------------------------------
-
-void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec)
-{
- //tests if NewOutRec contains the polygon before reassigning FirstLeft
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- {
- OutRec* outRec = m_PolyOuts[i];
- OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft);
- if (outRec->Pts && firstLeft == OldOutRec)
- {
- if (Poly2ContainsPoly1(outRec->Pts, NewOutRec->Pts))
- outRec->FirstLeft = NewOutRec;
- }
- }
-}
-//----------------------------------------------------------------------
-
-void Clipper::FixupFirstLefts2(OutRec* InnerOutRec, OutRec* OuterOutRec)
-{
- //A polygon has split into two such that one is now the inner of the other.
- //It's possible that these polygons now wrap around other polygons, so check
- //every polygon that's also contained by OuterOutRec's FirstLeft container
- //(including 0) to see if they've become inner to the new inner polygon ...
- OutRec* orfl = OuterOutRec->FirstLeft;
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- {
- OutRec* outRec = m_PolyOuts[i];
-
- if (!outRec->Pts || outRec == OuterOutRec || outRec == InnerOutRec)
- continue;
- OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft);
- if (firstLeft != orfl && firstLeft != InnerOutRec && firstLeft != OuterOutRec)
- continue;
- if (Poly2ContainsPoly1(outRec->Pts, InnerOutRec->Pts))
- outRec->FirstLeft = InnerOutRec;
- else if (Poly2ContainsPoly1(outRec->Pts, OuterOutRec->Pts))
- outRec->FirstLeft = OuterOutRec;
- else if (outRec->FirstLeft == InnerOutRec || outRec->FirstLeft == OuterOutRec)
- outRec->FirstLeft = orfl;
- }
-}
-//----------------------------------------------------------------------
-void Clipper::FixupFirstLefts3(OutRec* OldOutRec, OutRec* NewOutRec)
-{
- //reassigns FirstLeft WITHOUT testing if NewOutRec contains the polygon
- for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i)
- {
- OutRec* outRec = m_PolyOuts[i];
- OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft);
- if (outRec->Pts && firstLeft == OldOutRec)
- outRec->FirstLeft = NewOutRec;
- }
-}
-//----------------------------------------------------------------------
-
-void Clipper::JoinCommonEdges()
-{
- for (JoinList::size_type i = 0; i < m_Joins.size(); i++)
- {
- Join* join = m_Joins[i];
-
- OutRec *outRec1 = GetOutRec(join->OutPt1->Idx);
- OutRec *outRec2 = GetOutRec(join->OutPt2->Idx);
-
- if (!outRec1->Pts || !outRec2->Pts) continue;
- if (outRec1->IsOpen || outRec2->IsOpen) continue;
-
- //get the polygon fragment with the correct hole state (FirstLeft)
- //before calling JoinPoints() ...
- OutRec *holeStateRec;
- if (outRec1 == outRec2) holeStateRec = outRec1;
- else if (OutRec1RightOfOutRec2(outRec1, outRec2)) holeStateRec = outRec2;
- else if (OutRec1RightOfOutRec2(outRec2, outRec1)) holeStateRec = outRec1;
- else holeStateRec = GetLowermostRec(outRec1, outRec2);
-
- if (!JoinPoints(join, outRec1, outRec2)) continue;
-
- if (outRec1 == outRec2)
- {
- //instead of joining two polygons, we've just created a new one by
- //splitting one polygon into two.
- outRec1->Pts = join->OutPt1;
- outRec1->BottomPt = 0;
- outRec2 = CreateOutRec();
- outRec2->Pts = join->OutPt2;
-
- //update all OutRec2.Pts Idx's ...
- UpdateOutPtIdxs(*outRec2);
-
- if (Poly2ContainsPoly1(outRec2->Pts, outRec1->Pts))
- {
- //outRec1 contains outRec2 ...
- outRec2->IsHole = !outRec1->IsHole;
- outRec2->FirstLeft = outRec1;
-
- if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1);
-
- if ((outRec2->IsHole ^ m_ReverseOutput) == (Area(*outRec2) > 0))
- ReversePolyPtLinks(outRec2->Pts);
-
- } else if (Poly2ContainsPoly1(outRec1->Pts, outRec2->Pts))
- {
- //outRec2 contains outRec1 ...
- outRec2->IsHole = outRec1->IsHole;
- outRec1->IsHole = !outRec2->IsHole;
- outRec2->FirstLeft = outRec1->FirstLeft;
- outRec1->FirstLeft = outRec2;
-
- if (m_UsingPolyTree) FixupFirstLefts2(outRec1, outRec2);
-
- if ((outRec1->IsHole ^ m_ReverseOutput) == (Area(*outRec1) > 0))
- ReversePolyPtLinks(outRec1->Pts);
- }
- else
- {
- //the 2 polygons are completely separate ...
- outRec2->IsHole = outRec1->IsHole;
- outRec2->FirstLeft = outRec1->FirstLeft;
-
- //fixup FirstLeft pointers that may need reassigning to OutRec2
- if (m_UsingPolyTree) FixupFirstLefts1(outRec1, outRec2);
- }
-
- } else
- {
- //joined 2 polygons together ...
-
- outRec2->Pts = 0;
- outRec2->BottomPt = 0;
- outRec2->Idx = outRec1->Idx;
-
- outRec1->IsHole = holeStateRec->IsHole;
- if (holeStateRec == outRec2)
- outRec1->FirstLeft = outRec2->FirstLeft;
- outRec2->FirstLeft = outRec1;
-
- if (m_UsingPolyTree) FixupFirstLefts3(outRec2, outRec1);
- }
- }
-}
-
-//------------------------------------------------------------------------------
-// ClipperOffset support functions ...
-//------------------------------------------------------------------------------
-
-DoublePoint GetUnitNormal(const IntPoint &pt1, const IntPoint &pt2)
-{
- if(pt2.X == pt1.X && pt2.Y == pt1.Y)
- return DoublePoint(0, 0);
-
- double Dx = (double)(pt2.X - pt1.X);
- double dy = (double)(pt2.Y - pt1.Y);
- double f = 1 *1.0/ std::sqrt( Dx*Dx + dy*dy );
- Dx *= f;
- dy *= f;
- return DoublePoint(dy, -Dx);
-}
-
-//------------------------------------------------------------------------------
-// ClipperOffset class
-//------------------------------------------------------------------------------
-
-ClipperOffset::ClipperOffset(double miterLimit, double arcTolerance)
-{
- this->MiterLimit = miterLimit;
- this->ArcTolerance = arcTolerance;
- m_lowest.X = -1;
-}
-//------------------------------------------------------------------------------
-
-ClipperOffset::~ClipperOffset()
-{
- Clear();
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::Clear()
-{
- for (int i = 0; i < m_polyNodes.ChildCount(); ++i)
- delete m_polyNodes.Childs[i];
- m_polyNodes.Childs.clear();
- m_lowest.X = -1;
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::AddPath(const Path& path, JoinType joinType, EndType endType)
-{
- int highI = (int)path.size() - 1;
- if (highI < 0) return;
- PolyNode* newNode = new PolyNode();
- newNode->m_jointype = joinType;
- newNode->m_endtype = endType;
-
- //strip duplicate points from path and also get index to the lowest point ...
- if (endType == etClosedLine || endType == etClosedPolygon)
- while (highI > 0 && path[0] == path[highI]) highI--;
- newNode->Contour.reserve(highI + 1);
- newNode->Contour.push_back(path[0]);
- int j = 0, k = 0;
- for (int i = 1; i <= highI; i++)
- if (newNode->Contour[j] != path[i])
- {
- j++;
- newNode->Contour.push_back(path[i]);
- if (path[i].Y > newNode->Contour[k].Y ||
- (path[i].Y == newNode->Contour[k].Y &&
- path[i].X < newNode->Contour[k].X)) k = j;
- }
- if (endType == etClosedPolygon && j < 2)
- {
- delete newNode;
- return;
- }
- m_polyNodes.AddChild(*newNode);
-
- //if this path's lowest pt is lower than all the others then update m_lowest
- if (endType != etClosedPolygon) return;
- if (m_lowest.X < 0)
- m_lowest = IntPoint(m_polyNodes.ChildCount() - 1, k);
- else
- {
- IntPoint ip = m_polyNodes.Childs[(int)m_lowest.X]->Contour[(int)m_lowest.Y];
- if (newNode->Contour[k].Y > ip.Y ||
- (newNode->Contour[k].Y == ip.Y &&
- newNode->Contour[k].X < ip.X))
- m_lowest = IntPoint(m_polyNodes.ChildCount() - 1, k);
- }
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::AddPaths(const Paths& paths, JoinType joinType, EndType endType)
-{
- for (Paths::size_type i = 0; i < paths.size(); ++i)
- AddPath(paths[i], joinType, endType);
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::FixOrientations()
-{
- //fixup orientations of all closed paths if the orientation of the
- //closed path with the lowermost vertex is wrong ...
- if (m_lowest.X >= 0 &&
- !Orientation(m_polyNodes.Childs[(int)m_lowest.X]->Contour))
- {
- for (int i = 0; i < m_polyNodes.ChildCount(); ++i)
- {
- PolyNode& node = *m_polyNodes.Childs[i];
- if (node.m_endtype == etClosedPolygon ||
- (node.m_endtype == etClosedLine && Orientation(node.Contour)))
- ReversePath(node.Contour);
- }
- } else
- {
- for (int i = 0; i < m_polyNodes.ChildCount(); ++i)
- {
- PolyNode& node = *m_polyNodes.Childs[i];
- if (node.m_endtype == etClosedLine && !Orientation(node.Contour))
- ReversePath(node.Contour);
- }
- }
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::Execute(Paths& solution, double delta)
-{
- solution.clear();
- FixOrientations();
- DoOffset(delta);
-
- //now clean up 'corners' ...
- Clipper clpr;
- clpr.AddPaths(m_destPolys, ptSubject, true);
- if (delta > 0)
- {
- clpr.Execute(ctUnion, solution, pftPositive, pftPositive);
- }
- else
- {
- IntRect r = clpr.GetBounds();
- Path outer(4);
- outer[0] = IntPoint(r.left - 10, r.bottom + 10);
- outer[1] = IntPoint(r.right + 10, r.bottom + 10);
- outer[2] = IntPoint(r.right + 10, r.top - 10);
- outer[3] = IntPoint(r.left - 10, r.top - 10);
-
- clpr.AddPath(outer, ptSubject, true);
- clpr.ReverseSolution(true);
- clpr.Execute(ctUnion, solution, pftNegative, pftNegative);
- if (solution.size() > 0) solution.erase(solution.begin());
- }
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::Execute(PolyTree& solution, double delta)
-{
- solution.Clear();
- FixOrientations();
- DoOffset(delta);
-
- //now clean up 'corners' ...
- Clipper clpr;
- clpr.AddPaths(m_destPolys, ptSubject, true);
- if (delta > 0)
- {
- clpr.Execute(ctUnion, solution, pftPositive, pftPositive);
- }
- else
- {
- IntRect r = clpr.GetBounds();
- Path outer(4);
- outer[0] = IntPoint(r.left - 10, r.bottom + 10);
- outer[1] = IntPoint(r.right + 10, r.bottom + 10);
- outer[2] = IntPoint(r.right + 10, r.top - 10);
- outer[3] = IntPoint(r.left - 10, r.top - 10);
-
- clpr.AddPath(outer, ptSubject, true);
- clpr.ReverseSolution(true);
- clpr.Execute(ctUnion, solution, pftNegative, pftNegative);
- //remove the outer PolyNode rectangle ...
- if (solution.ChildCount() == 1 && solution.Childs[0]->ChildCount() > 0)
- {
- PolyNode* outerNode = solution.Childs[0];
- solution.Childs.reserve(outerNode->ChildCount());
- solution.Childs[0] = outerNode->Childs[0];
- solution.Childs[0]->Parent = outerNode->Parent;
- for (int i = 1; i < outerNode->ChildCount(); ++i)
- solution.AddChild(*outerNode->Childs[i]);
- }
- else
- solution.Clear();
- }
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::DoOffset(double delta)
-{
- m_destPolys.clear();
- m_delta = delta;
-
- //if Zero offset, just copy any CLOSED polygons to m_p and return ...
- if (NEAR_ZERO(delta))
- {
- m_destPolys.reserve(m_polyNodes.ChildCount());
- for (int i = 0; i < m_polyNodes.ChildCount(); i++)
- {
- PolyNode& node = *m_polyNodes.Childs[i];
- if (node.m_endtype == etClosedPolygon)
- m_destPolys.push_back(node.Contour);
- }
- return;
- }
-
- //see offset_triginometry3.svg in the documentation folder ...
- if (MiterLimit > 2) m_miterLim = 2/(MiterLimit * MiterLimit);
- else m_miterLim = 0.5;
-
- double y;
- if (ArcTolerance <= 0.0) y = def_arc_tolerance;
- else if (ArcTolerance > std::fabs(delta) * def_arc_tolerance)
- y = std::fabs(delta) * def_arc_tolerance;
- else y = ArcTolerance;
- //see offset_triginometry2.svg in the documentation folder ...
- double steps = pi / std::acos(1 - y / std::fabs(delta));
- if (steps > std::fabs(delta) * pi)
- steps = std::fabs(delta) * pi; //ie excessive precision check
- m_sin = std::sin(two_pi / steps);
- m_cos = std::cos(two_pi / steps);
- m_StepsPerRad = steps / two_pi;
- if (delta < 0.0) m_sin = -m_sin;
-
- m_destPolys.reserve(m_polyNodes.ChildCount() * 2);
- for (int i = 0; i < m_polyNodes.ChildCount(); i++)
- {
- PolyNode& node = *m_polyNodes.Childs[i];
- m_srcPoly = node.Contour;
-
- int len = (int)m_srcPoly.size();
- if (len == 0 || (delta <= 0 && (len < 3 || node.m_endtype != etClosedPolygon)))
- continue;
-
- m_destPoly.clear();
- if (len == 1)
- {
- if (node.m_jointype == jtRound)
- {
- double X = 1.0, Y = 0.0;
- for (cInt j = 1; j <= steps; j++)
- {
- m_destPoly.push_back(IntPoint(
- Round(m_srcPoly[0].X + X * delta),
- Round(m_srcPoly[0].Y + Y * delta)));
- double X2 = X;
- X = X * m_cos - m_sin * Y;
- Y = X2 * m_sin + Y * m_cos;
- }
- }
- else
- {
- double X = -1.0, Y = -1.0;
- for (int j = 0; j < 4; ++j)
- {
- m_destPoly.push_back(IntPoint(
- Round(m_srcPoly[0].X + X * delta),
- Round(m_srcPoly[0].Y + Y * delta)));
- if (X < 0) X = 1;
- else if (Y < 0) Y = 1;
- else X = -1;
- }
- }
- m_destPolys.push_back(m_destPoly);
- continue;
- }
- //build m_normals ...
- m_normals.clear();
- m_normals.reserve(len);
- for (int j = 0; j < len - 1; ++j)
- m_normals.push_back(GetUnitNormal(m_srcPoly[j], m_srcPoly[j + 1]));
- if (node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon)
- m_normals.push_back(GetUnitNormal(m_srcPoly[len - 1], m_srcPoly[0]));
- else
- m_normals.push_back(DoublePoint(m_normals[len - 2]));
-
- if (node.m_endtype == etClosedPolygon)
- {
- int k = len - 1;
- for (int j = 0; j < len; ++j)
- OffsetPoint(j, k, node.m_jointype);
- m_destPolys.push_back(m_destPoly);
- }
- else if (node.m_endtype == etClosedLine)
- {
- int k = len - 1;
- for (int j = 0; j < len; ++j)
- OffsetPoint(j, k, node.m_jointype);
- m_destPolys.push_back(m_destPoly);
- m_destPoly.clear();
- //re-build m_normals ...
- DoublePoint n = m_normals[len -1];
- for (int j = len - 1; j > 0; j--)
- m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y);
- m_normals[0] = DoublePoint(-n.X, -n.Y);
- k = 0;
- for (int j = len - 1; j >= 0; j--)
- OffsetPoint(j, k, node.m_jointype);
- m_destPolys.push_back(m_destPoly);
- }
- else
- {
- int k = 0;
- for (int j = 1; j < len - 1; ++j)
- OffsetPoint(j, k, node.m_jointype);
-
- IntPoint pt1;
- if (node.m_endtype == etOpenButt)
- {
- int j = len - 1;
- pt1 = IntPoint((cInt)Round(m_srcPoly[j].X + m_normals[j].X *
- delta), (cInt)Round(m_srcPoly[j].Y + m_normals[j].Y * delta));
- m_destPoly.push_back(pt1);
- pt1 = IntPoint((cInt)Round(m_srcPoly[j].X - m_normals[j].X *
- delta), (cInt)Round(m_srcPoly[j].Y - m_normals[j].Y * delta));
- m_destPoly.push_back(pt1);
- }
- else
- {
- int j = len - 1;
- k = len - 2;
- m_sinA = 0;
- m_normals[j] = DoublePoint(-m_normals[j].X, -m_normals[j].Y);
- if (node.m_endtype == etOpenSquare)
- DoSquare(j, k);
- else
- DoRound(j, k);
- }
-
- //re-build m_normals ...
- for (int j = len - 1; j > 0; j--)
- m_normals[j] = DoublePoint(-m_normals[j - 1].X, -m_normals[j - 1].Y);
- m_normals[0] = DoublePoint(-m_normals[1].X, -m_normals[1].Y);
-
- k = len - 1;
- for (int j = k - 1; j > 0; --j) OffsetPoint(j, k, node.m_jointype);
-
- if (node.m_endtype == etOpenButt)
- {
- pt1 = IntPoint((cInt)Round(m_srcPoly[0].X - m_normals[0].X * delta),
- (cInt)Round(m_srcPoly[0].Y - m_normals[0].Y * delta));
- m_destPoly.push_back(pt1);
- pt1 = IntPoint((cInt)Round(m_srcPoly[0].X + m_normals[0].X * delta),
- (cInt)Round(m_srcPoly[0].Y + m_normals[0].Y * delta));
- m_destPoly.push_back(pt1);
- }
- else
- {
- k = 1;
- m_sinA = 0;
- if (node.m_endtype == etOpenSquare)
- DoSquare(0, 1);
- else
- DoRound(0, 1);
- }
- m_destPolys.push_back(m_destPoly);
- }
- }
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::OffsetPoint(int j, int& k, JoinType jointype)
-{
- //cross product ...
- m_sinA = (m_normals[k].X * m_normals[j].Y - m_normals[j].X * m_normals[k].Y);
- if (std::fabs(m_sinA * m_delta) < 1.0)
- {
- //dot product ...
- double cosA = (m_normals[k].X * m_normals[j].X + m_normals[j].Y * m_normals[k].Y );
- if (cosA > 0) // angle => 0 degrees
- {
- m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta),
- Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta)));
- return;
- }
- //else angle => 180 degrees
- }
- else if (m_sinA > 1.0) m_sinA = 1.0;
- else if (m_sinA < -1.0) m_sinA = -1.0;
-
- if (m_sinA * m_delta < 0)
- {
- m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta),
- Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta)));
- m_destPoly.push_back(m_srcPoly[j]);
- m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[j].X * m_delta),
- Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta)));
- }
- else
- switch (jointype)
- {
- case jtMiter:
- {
- double r = 1 + (m_normals[j].X * m_normals[k].X +
- m_normals[j].Y * m_normals[k].Y);
- if (r >= m_miterLim) DoMiter(j, k, r); else DoSquare(j, k);
- break;
- }
- case jtSquare: DoSquare(j, k); break;
- case jtRound: DoRound(j, k); break;
- }
- k = j;
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::DoSquare(int j, int k)
-{
- double dx = std::tan(std::atan2(m_sinA,
- m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y) / 4);
- m_destPoly.push_back(IntPoint(
- Round(m_srcPoly[j].X + m_delta * (m_normals[k].X - m_normals[k].Y * dx)),
- Round(m_srcPoly[j].Y + m_delta * (m_normals[k].Y + m_normals[k].X * dx))));
- m_destPoly.push_back(IntPoint(
- Round(m_srcPoly[j].X + m_delta * (m_normals[j].X + m_normals[j].Y * dx)),
- Round(m_srcPoly[j].Y + m_delta * (m_normals[j].Y - m_normals[j].X * dx))));
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::DoMiter(int j, int k, double r)
-{
- double q = m_delta / r;
- m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + (m_normals[k].X + m_normals[j].X) * q),
- Round(m_srcPoly[j].Y + (m_normals[k].Y + m_normals[j].Y) * q)));
-}
-//------------------------------------------------------------------------------
-
-void ClipperOffset::DoRound(int j, int k)
-{
- double a = std::atan2(m_sinA,
- m_normals[k].X * m_normals[j].X + m_normals[k].Y * m_normals[j].Y);
- int steps = std::max((int)Round(m_StepsPerRad * std::fabs(a)), 1);
-
- double X = m_normals[k].X, Y = m_normals[k].Y, X2;
- for (int i = 0; i < steps; ++i)
- {
- m_destPoly.push_back(IntPoint(
- Round(m_srcPoly[j].X + X * m_delta),
- Round(m_srcPoly[j].Y + Y * m_delta)));
- X2 = X;
- X = X * m_cos - m_sin * Y;
- Y = X2 * m_sin + Y * m_cos;
- }
- m_destPoly.push_back(IntPoint(
- Round(m_srcPoly[j].X + m_normals[j].X * m_delta),
- Round(m_srcPoly[j].Y + m_normals[j].Y * m_delta)));
-}
-
-//------------------------------------------------------------------------------
-// Miscellaneous public functions
-//------------------------------------------------------------------------------
-
-void Clipper::DoSimplePolygons()
-{
- PolyOutList::size_type i = 0;
- while (i < m_PolyOuts.size())
- {
- OutRec* outrec = m_PolyOuts[i++];
- OutPt* op = outrec->Pts;
- if (!op || outrec->IsOpen) continue;
- do //for each Pt in Polygon until duplicate found do ...
- {
- OutPt* op2 = op->Next;
- while (op2 != outrec->Pts)
- {
- if ((op->Pt == op2->Pt) && op2->Next != op && op2->Prev != op)
- {
- //split the polygon into two ...
- OutPt* op3 = op->Prev;
- OutPt* op4 = op2->Prev;
- op->Prev = op4;
- op4->Next = op;
- op2->Prev = op3;
- op3->Next = op2;
-
- outrec->Pts = op;
- OutRec* outrec2 = CreateOutRec();
- outrec2->Pts = op2;
- UpdateOutPtIdxs(*outrec2);
- if (Poly2ContainsPoly1(outrec2->Pts, outrec->Pts))
- {
- //OutRec2 is contained by OutRec1 ...
- outrec2->IsHole = !outrec->IsHole;
- outrec2->FirstLeft = outrec;
- if (m_UsingPolyTree) FixupFirstLefts2(outrec2, outrec);
- }
- else
- if (Poly2ContainsPoly1(outrec->Pts, outrec2->Pts))
- {
- //OutRec1 is contained by OutRec2 ...
- outrec2->IsHole = outrec->IsHole;
- outrec->IsHole = !outrec2->IsHole;
- outrec2->FirstLeft = outrec->FirstLeft;
- outrec->FirstLeft = outrec2;
- if (m_UsingPolyTree) FixupFirstLefts2(outrec, outrec2);
- }
- else
- {
- //the 2 polygons are separate ...
- outrec2->IsHole = outrec->IsHole;
- outrec2->FirstLeft = outrec->FirstLeft;
- if (m_UsingPolyTree) FixupFirstLefts1(outrec, outrec2);
- }
- op2 = op; //ie get ready for the Next iteration
- }
- op2 = op2->Next;
- }
- op = op->Next;
- }
- while (op != outrec->Pts);
- }
-}
-//------------------------------------------------------------------------------
-
-void ReversePath(Path& p)
-{
- std::reverse(p.begin(), p.end());
-}
-//------------------------------------------------------------------------------
-
-void ReversePaths(Paths& p)
-{
- for (Paths::size_type i = 0; i < p.size(); ++i)
- ReversePath(p[i]);
-}
-//------------------------------------------------------------------------------
-
-void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType)
-{
- Clipper c;
- c.StrictlySimple(true);
- c.AddPath(in_poly, ptSubject, true);
- c.Execute(ctUnion, out_polys, fillType, fillType);
-}
-//------------------------------------------------------------------------------
-
-void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType)
-{
- Clipper c;
- c.StrictlySimple(true);
- c.AddPaths(in_polys, ptSubject, true);
- c.Execute(ctUnion, out_polys, fillType, fillType);
-}
-//------------------------------------------------------------------------------
-
-void SimplifyPolygons(Paths &polys, PolyFillType fillType)
-{
- SimplifyPolygons(polys, polys, fillType);
-}
-//------------------------------------------------------------------------------
-
-inline double DistanceSqrd(const IntPoint& pt1, const IntPoint& pt2)
-{
- double Dx = ((double)pt1.X - pt2.X);
- double dy = ((double)pt1.Y - pt2.Y);
- return (Dx*Dx + dy*dy);
-}
-//------------------------------------------------------------------------------
-
-double DistanceFromLineSqrd(
- const IntPoint& pt, const IntPoint& ln1, const IntPoint& ln2)
-{
- //The equation of a line in general form (Ax + By + C = 0)
- //given 2 points (x¹,y¹) & (x²,y²) is ...
- //(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0
- //A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹
- //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²)
- //see http://en.wikipedia.org/wiki/Perpendicular_distance
- double A = double(ln1.Y - ln2.Y);
- double B = double(ln2.X - ln1.X);
- double C = A * ln1.X + B * ln1.Y;
- C = A * pt.X + B * pt.Y - C;
- return (C * C) / (A * A + B * B);
-}
-//---------------------------------------------------------------------------
-
-bool SlopesNearCollinear(const IntPoint& pt1,
- const IntPoint& pt2, const IntPoint& pt3, double distSqrd)
-{
- //this function is more accurate when the point that's geometrically
- //between the other 2 points is the one that's tested for distance.
- //ie makes it more likely to pick up 'spikes' ...
- if (Abs(pt1.X - pt2.X) > Abs(pt1.Y - pt2.Y))
- {
- if ((pt1.X > pt2.X) == (pt1.X < pt3.X))
- return DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd;
- else if ((pt2.X > pt1.X) == (pt2.X < pt3.X))
- return DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd;
- else
- return DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd;
- }
- else
- {
- if ((pt1.Y > pt2.Y) == (pt1.Y < pt3.Y))
- return DistanceFromLineSqrd(pt1, pt2, pt3) < distSqrd;
- else if ((pt2.Y > pt1.Y) == (pt2.Y < pt3.Y))
- return DistanceFromLineSqrd(pt2, pt1, pt3) < distSqrd;
- else
- return DistanceFromLineSqrd(pt3, pt1, pt2) < distSqrd;
- }
-}
-//------------------------------------------------------------------------------
-
-bool PointsAreClose(IntPoint pt1, IntPoint pt2, double distSqrd)
-{
- double Dx = (double)pt1.X - pt2.X;
- double dy = (double)pt1.Y - pt2.Y;
- return ((Dx * Dx) + (dy * dy) <= distSqrd);
-}
-//------------------------------------------------------------------------------
-
-OutPt* ExcludeOp(OutPt* op)
-{
- OutPt* result = op->Prev;
- result->Next = op->Next;
- op->Next->Prev = result;
- result->Idx = 0;
- return result;
-}
-//------------------------------------------------------------------------------
-
-void CleanPolygon(const Path& in_poly, Path& out_poly, double distance)
-{
- //distance = proximity in units/pixels below which vertices
- //will be stripped. Default ~= sqrt(2).
-
- size_t size = in_poly.size();
-
- if (size == 0)
- {
- out_poly.clear();
- return;
- }
-
- OutPt* outPts = new OutPt[size];
- for (size_t i = 0; i < size; ++i)
- {
- outPts[i].Pt = in_poly[i];
- outPts[i].Next = &outPts[(i + 1) % size];
- outPts[i].Next->Prev = &outPts[i];
- outPts[i].Idx = 0;
- }
-
- double distSqrd = distance * distance;
- OutPt* op = &outPts[0];
- while (op->Idx == 0 && op->Next != op->Prev)
- {
- if (PointsAreClose(op->Pt, op->Prev->Pt, distSqrd))
- {
- op = ExcludeOp(op);
- size--;
- }
- else if (PointsAreClose(op->Prev->Pt, op->Next->Pt, distSqrd))
- {
- ExcludeOp(op->Next);
- op = ExcludeOp(op);
- size -= 2;
- }
- else if (SlopesNearCollinear(op->Prev->Pt, op->Pt, op->Next->Pt, distSqrd))
- {
- op = ExcludeOp(op);
- size--;
- }
- else
- {
- op->Idx = 1;
- op = op->Next;
- }
- }
-
- if (size < 3) size = 0;
- out_poly.resize(size);
- for (size_t i = 0; i < size; ++i)
- {
- out_poly[i] = op->Pt;
- op = op->Next;
- }
- delete [] outPts;
-}
-//------------------------------------------------------------------------------
-
-void CleanPolygon(Path& poly, double distance)
-{
- CleanPolygon(poly, poly, distance);
-}
-//------------------------------------------------------------------------------
-
-void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance)
-{
- out_polys.resize(in_polys.size());
- for (Paths::size_type i = 0; i < in_polys.size(); ++i)
- CleanPolygon(in_polys[i], out_polys[i], distance);
-}
-//------------------------------------------------------------------------------
-
-void CleanPolygons(Paths& polys, double distance)
-{
- CleanPolygons(polys, polys, distance);
-}
-//------------------------------------------------------------------------------
-
-void Minkowski(const Path& poly, const Path& path,
- Paths& solution, bool isSum, bool isClosed)
-{
- int delta = (isClosed ? 1 : 0);
- size_t polyCnt = poly.size();
- size_t pathCnt = path.size();
- Paths pp;
- pp.reserve(pathCnt);
- if (isSum)
- for (size_t i = 0; i < pathCnt; ++i)
- {
- Path p;
- p.reserve(polyCnt);
- for (size_t j = 0; j < poly.size(); ++j)
- p.push_back(IntPoint(path[i].X + poly[j].X, path[i].Y + poly[j].Y));
- pp.push_back(p);
- }
- else
- for (size_t i = 0; i < pathCnt; ++i)
- {
- Path p;
- p.reserve(polyCnt);
- for (size_t j = 0; j < poly.size(); ++j)
- p.push_back(IntPoint(path[i].X - poly[j].X, path[i].Y - poly[j].Y));
- pp.push_back(p);
- }
-
- solution.clear();
- solution.reserve((pathCnt + delta) * (polyCnt + 1));
- for (size_t i = 0; i < pathCnt - 1 + delta; ++i)
- for (size_t j = 0; j < polyCnt; ++j)
- {
- Path quad;
- quad.reserve(4);
- quad.push_back(pp[i % pathCnt][j % polyCnt]);
- quad.push_back(pp[(i + 1) % pathCnt][j % polyCnt]);
- quad.push_back(pp[(i + 1) % pathCnt][(j + 1) % polyCnt]);
- quad.push_back(pp[i % pathCnt][(j + 1) % polyCnt]);
- if (!Orientation(quad)) ReversePath(quad);
- solution.push_back(quad);
- }
-}
-//------------------------------------------------------------------------------
-
-void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed)
-{
- Minkowski(pattern, path, solution, true, pathIsClosed);
- Clipper c;
- c.AddPaths(solution, ptSubject, true);
- c.Execute(ctUnion, solution, pftNonZero, pftNonZero);
-}
-//------------------------------------------------------------------------------
-
-void TranslatePath(const Path& input, Path& output, const IntPoint delta)
-{
- //precondition: input != output
- output.resize(input.size());
- for (size_t i = 0; i < input.size(); ++i)
- output[i] = IntPoint(input[i].X + delta.X, input[i].Y + delta.Y);
-}
-//------------------------------------------------------------------------------
-
-void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed)
-{
- Clipper c;
- for (size_t i = 0; i < paths.size(); ++i)
- {
- Paths tmp;
- Minkowski(pattern, paths[i], tmp, true, pathIsClosed);
- c.AddPaths(tmp, ptSubject, true);
- if (pathIsClosed)
- {
- Path tmp2;
- TranslatePath(paths[i], tmp2, pattern[0]);
- c.AddPath(tmp2, ptClip, true);
- }
- }
- c.Execute(ctUnion, solution, pftNonZero, pftNonZero);
-}
-//------------------------------------------------------------------------------
-
-void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution)
-{
- Minkowski(poly1, poly2, solution, false, true);
- Clipper c;
- c.AddPaths(solution, ptSubject, true);
- c.Execute(ctUnion, solution, pftNonZero, pftNonZero);
-}
-//------------------------------------------------------------------------------
-
-enum NodeType {ntAny, ntOpen, ntClosed};
-
-void AddPolyNodeToPaths(const PolyNode& polynode, NodeType nodetype, Paths& paths)
-{
- bool match = true;
- if (nodetype == ntClosed) match = !polynode.IsOpen();
- else if (nodetype == ntOpen) return;
-
- if (!polynode.Contour.empty() && match)
- paths.push_back(polynode.Contour);
- for (int i = 0; i < polynode.ChildCount(); ++i)
- AddPolyNodeToPaths(*polynode.Childs[i], nodetype, paths);
-}
-//------------------------------------------------------------------------------
-
-void PolyTreeToPaths(const PolyTree& polytree, Paths& paths)
-{
- paths.resize(0);
- paths.reserve(polytree.Total());
- AddPolyNodeToPaths(polytree, ntAny, paths);
-}
-//------------------------------------------------------------------------------
-
-void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths)
-{
- paths.resize(0);
- paths.reserve(polytree.Total());
- AddPolyNodeToPaths(polytree, ntClosed, paths);
-}
-//------------------------------------------------------------------------------
-
-void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths)
-{
- paths.resize(0);
- paths.reserve(polytree.Total());
- //Open paths are top level only, so ...
- for (int i = 0; i < polytree.ChildCount(); ++i)
- if (polytree.Childs[i]->IsOpen())
- paths.push_back(polytree.Childs[i]->Contour);
-}
-//------------------------------------------------------------------------------
-
-std::ostream& operator <<(std::ostream &s, const IntPoint &p)
-{
- s << "(" << p.X << "," << p.Y << ")";
- return s;
-}
-//------------------------------------------------------------------------------
-
-std::ostream& operator <<(std::ostream &s, const Path &p)
-{
- if (p.empty()) return s;
- Path::size_type last = p.size() -1;
- for (Path::size_type i = 0; i < last; i++)
- s << "(" << p[i].X << "," << p[i].Y << "), ";
- s << "(" << p[last].X << "," << p[last].Y << ")\n";
- return s;
-}
-//------------------------------------------------------------------------------
-
-std::ostream& operator <<(std::ostream &s, const Paths &p)
-{
- for (Paths::size_type i = 0; i < p.size(); i++)
- s << p[i];
- s << "\n";
- return s;
-}
-//------------------------------------------------------------------------------
-
-} //QtClipperLib namespace
diff --git a/src/3rdparty/clipper/clipper.h b/src/3rdparty/clipper/clipper.h
deleted file mode 100644
index de4a540d..00000000
--- a/src/3rdparty/clipper/clipper.h
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
-* *
-* Author : Angus Johnson *
-* Version : 6.4.2 *
-* Date : 27 February 2017 *
-* Website : http://www.angusj.com *
-* Copyright : Angus Johnson 2010-2017 *
-* *
-* License: *
-* Use, modification & distribution is subject to Boost Software License Ver 1. *
-* http://www.boost.org/LICENSE_1_0.txt *
-* *
-* Attributions: *
-* The code in this library is an extension of Bala Vatti's clipping algorithm: *
-* "A generic solution to polygon clipping" *
-* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. *
-* http://portal.acm.org/citation.cfm?id=129906 *
-* *
-* Computer graphics and geometric modeling: implementation and algorithms *
-* By Max K. Agoston *
-* Springer; 1 edition (January 4, 2005) *
-* http://books.google.com/books?q=vatti+clipping+agoston *
-* *
-* See also: *
-* "Polygon Offsetting by Computing Winding Numbers" *
-* Paper no. DETC2005-85513 pp. 565-575 *
-* ASME 2005 International Design Engineering Technical Conferences *
-* and Computers and Information in Engineering Conference (IDETC/CIE2005) *
-* September 24-28, 2005 , Long Beach, California, USA *
-* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf *
-* *
-*******************************************************************************/
-
-#ifndef clipper_hpp
-#define clipper_hpp
-
-#define CLIPPER_VERSION "6.4.2"
-
-//use_int32: When enabled 32bit ints are used instead of 64bit ints. This
-//improve performance but coordinate values are limited to the range +/- 46340
-//#define use_int32
-
-//use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance.
-//#define use_xyz
-
-//use_lines: Enables line clipping. Adds a very minor cost to performance.
-#define use_lines
-
-//use_deprecated: Enables temporary support for the obsolete functions
-//#define use_deprecated
-
-#include <vector>
-#include <list>
-#include <set>
-#include <stdexcept>
-#include <cstring>
-#include <cstdlib>
-#include <ostream>
-#include <functional>
-#include <queue>
-
-namespace QtClipperLib {
-
-enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
-enum PolyType { ptSubject, ptClip };
-//By far the most widely used winding rules for polygon filling are
-//EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32)
-//Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL)
-//see http://glprogramming.com/red/chapter11.html
-enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
-
-#ifdef use_int32
- typedef int cInt;
- static cInt const loRange = 0x7FFF;
- static cInt const hiRange = 0x7FFF;
-#else
- typedef signed long long cInt;
- static cInt const loRange = 0x3FFFFFFF;
- static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
- typedef signed long long long64; //used by Int128 class
- typedef unsigned long long ulong64;
-
-#endif
-
-struct IntPoint {
- cInt X;
- cInt Y;
-#ifdef use_xyz
- cInt Z;
- IntPoint(cInt x = 0, cInt y = 0, cInt z = 0): X(x), Y(y), Z(z) {};
-#else
- IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {};
-#endif
-
- friend inline bool operator== (const IntPoint& a, const IntPoint& b)
- {
- return a.X == b.X && a.Y == b.Y;
- }
- friend inline bool operator!= (const IntPoint& a, const IntPoint& b)
- {
- return a.X != b.X || a.Y != b.Y;
- }
-};
-//------------------------------------------------------------------------------
-
-typedef std::vector< IntPoint > Path;
-typedef std::vector< Path > Paths;
-
-inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;}
-inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;}
-
-std::ostream& operator <<(std::ostream &s, const IntPoint &p);
-std::ostream& operator <<(std::ostream &s, const Path &p);
-std::ostream& operator <<(std::ostream &s, const Paths &p);
-
-struct DoublePoint
-{
- double X;
- double Y;
- DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {}
- DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {}
-};
-//------------------------------------------------------------------------------
-
-#ifdef use_xyz
-typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
-#endif
-
-enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
-enum JoinType {jtSquare, jtRound, jtMiter};
-enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound};
-
-class PolyNode;
-typedef std::vector< PolyNode* > PolyNodes;
-
-class PolyNode
-{
-public:
- PolyNode();
- virtual ~PolyNode(){};
- Path Contour;
- PolyNodes Childs;
- PolyNode* Parent;
- PolyNode* GetNext() const;
- bool IsHole() const;
- bool IsOpen() const;
- int ChildCount() const;
-private:
- unsigned Index; //node index in Parent.Childs
- bool m_IsOpen;
- JoinType m_jointype;
- EndType m_endtype;
- PolyNode* GetNextSiblingUp() const;
- void AddChild(PolyNode& child);
- friend class Clipper; //to access Index
- friend class ClipperOffset;
-};
-
-class PolyTree: public PolyNode
-{
-public:
- ~PolyTree(){ Clear(); };
- PolyNode* GetFirst() const;
- void Clear();
- int Total() const;
-private:
- PolyNodes AllNodes;
- friend class Clipper; //to access AllNodes
-};
-
-bool Orientation(const Path &poly);
-double Area(const Path &poly);
-int PointInPolygon(const IntPoint &pt, const Path &path);
-
-void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
-void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
-void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
-
-void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415);
-void CleanPolygon(Path& poly, double distance = 1.415);
-void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415);
-void CleanPolygons(Paths& polys, double distance = 1.415);
-
-void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
-void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed);
-void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
-
-void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
-void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths);
-void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
-
-void ReversePath(Path& p);
-void ReversePaths(Paths& p);
-
-struct IntRect { cInt left; cInt top; cInt right; cInt bottom; };
-
-//enums that are used internally ...
-enum EdgeSide { esLeft = 1, esRight = 2};
-
-//forward declarations (for stuff used internally) ...
-struct TEdge;
-struct IntersectNode;
-struct LocalMinimum;
-struct OutPt;
-struct OutRec;
-struct Join;
-
-typedef std::vector < OutRec* > PolyOutList;
-typedef std::vector < TEdge* > EdgeList;
-typedef std::vector < Join* > JoinList;
-typedef std::vector < IntersectNode* > IntersectList;
-
-//------------------------------------------------------------------------------
-
-//ClipperBase is the ancestor to the Clipper class. It should not be
-//instantiated directly. This class simply abstracts the conversion of sets of
-//polygon coordinates into edge objects that are stored in a LocalMinima list.
-class ClipperBase
-{
-public:
- ClipperBase();
- virtual ~ClipperBase();
- virtual bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed);
- bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed);
- virtual void Clear();
- IntRect GetBounds();
- bool PreserveCollinear() {return m_PreserveCollinear;};
- void PreserveCollinear(bool value) {m_PreserveCollinear = value;};
-protected:
- void DisposeLocalMinimaList();
- TEdge* AddBoundsToLML(TEdge *e, bool IsClosed);
- virtual void Reset();
- TEdge* ProcessBound(TEdge* E, bool IsClockwise);
- void InsertScanbeam(const cInt Y);
- bool PopScanbeam(cInt &Y);
- bool LocalMinimaPending();
- bool PopLocalMinima(cInt Y, const LocalMinimum *&locMin);
- OutRec* CreateOutRec();
- void DisposeAllOutRecs();
- void DisposeOutRec(PolyOutList::size_type index);
- void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2);
- void DeleteFromAEL(TEdge *e);
- void UpdateEdgeIntoAEL(TEdge *&e);
-
- typedef std::vector<LocalMinimum> MinimaList;
- MinimaList::iterator m_CurrentLM;
- MinimaList m_MinimaList;
-
- bool m_UseFullRange;
- EdgeList m_edges;
- bool m_PreserveCollinear;
- bool m_HasOpenPaths;
- PolyOutList m_PolyOuts;
- TEdge *m_ActiveEdges;
-
- typedef std::priority_queue<cInt> ScanbeamList;
- ScanbeamList m_Scanbeam;
-};
-//------------------------------------------------------------------------------
-
-class Clipper : public virtual ClipperBase
-{
-public:
- Clipper(int initOptions = 0);
- bool Execute(ClipType clipType,
- Paths &solution,
- PolyFillType fillType = pftEvenOdd);
- bool Execute(ClipType clipType,
- Paths &solution,
- PolyFillType subjFillType,
- PolyFillType clipFillType);
- bool Execute(ClipType clipType,
- PolyTree &polytree,
- PolyFillType fillType = pftEvenOdd);
- bool Execute(ClipType clipType,
- PolyTree &polytree,
- PolyFillType subjFillType,
- PolyFillType clipFillType);
- bool ReverseSolution() { return m_ReverseOutput; };
- void ReverseSolution(bool value) {m_ReverseOutput = value;};
- bool StrictlySimple() {return m_StrictSimple;};
- void StrictlySimple(bool value) {m_StrictSimple = value;};
- //set the callback function for z value filling on intersections (otherwise Z is 0)
-#ifdef use_xyz
- void ZFillFunction(ZFillCallback zFillFunc);
-#endif
-protected:
- virtual bool ExecuteInternal();
-private:
- JoinList m_Joins;
- JoinList m_GhostJoins;
- IntersectList m_IntersectList;
- ClipType m_ClipType;
- typedef std::list<cInt> MaximaList;
- MaximaList m_Maxima;
- TEdge *m_SortedEdges;
- bool m_ExecuteLocked;
- PolyFillType m_ClipFillType;
- PolyFillType m_SubjFillType;
- bool m_ReverseOutput;
- bool m_UsingPolyTree;
- bool m_StrictSimple;
-#ifdef use_xyz
- ZFillCallback m_ZFill; //custom callback
-#endif
- void SetWindingCount(TEdge& edge);
- bool IsEvenOddFillType(const TEdge& edge) const;
- bool IsEvenOddAltFillType(const TEdge& edge) const;
- void InsertLocalMinimaIntoAEL(const cInt botY);
- void InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge);
- void AddEdgeToSEL(TEdge *edge);
- bool PopEdgeFromSEL(TEdge *&edge);
- void CopyAELToSEL();
- void DeleteFromSEL(TEdge *e);
- void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2);
- bool IsContributing(const TEdge& edge) const;
- bool IsTopHorz(const cInt XPos);
- void DoMaxima(TEdge *e);
- void ProcessHorizontals();
- void ProcessHorizontal(TEdge *horzEdge);
- void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
- OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
- OutRec* GetOutRec(int idx);
- void AppendPolygon(TEdge *e1, TEdge *e2);
- void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt);
- OutPt* AddOutPt(TEdge *e, const IntPoint &pt);
- OutPt* GetLastOutPt(TEdge *e);
- bool ProcessIntersections(const cInt topY);
- void BuildIntersectList(const cInt topY);
- void ProcessIntersectList();
- void ProcessEdgesAtTopOfScanbeam(const cInt topY);
- void BuildResult(Paths& polys);
- void BuildResult2(PolyTree& polytree);
- void SetHoleState(TEdge *e, OutRec *outrec);
- void DisposeIntersectNodes();
- bool FixupIntersectionOrder();
- void FixupOutPolygon(OutRec &outrec);
- void FixupOutPolyline(OutRec &outrec);
- bool IsHole(TEdge *e);
- bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl);
- void FixHoleLinkage(OutRec &outrec);
- void AddJoin(OutPt *op1, OutPt *op2, const IntPoint offPt);
- void ClearJoins();
- void ClearGhostJoins();
- void AddGhostJoin(OutPt *op, const IntPoint offPt);
- bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2);
- void JoinCommonEdges();
- void DoSimplePolygons();
- void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
- void FixupFirstLefts2(OutRec* InnerOutRec, OutRec* OuterOutRec);
- void FixupFirstLefts3(OutRec* OldOutRec, OutRec* NewOutRec);
-#ifdef use_xyz
- void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2);
-#endif
-};
-//------------------------------------------------------------------------------
-
-class ClipperOffset
-{
-public:
- ClipperOffset(double miterLimit = 2.0, double roundPrecision = 0.25);
- ~ClipperOffset();
- void AddPath(const Path& path, JoinType joinType, EndType endType);
- void AddPaths(const Paths& paths, JoinType joinType, EndType endType);
- void Execute(Paths& solution, double delta);
- void Execute(PolyTree& solution, double delta);
- void Clear();
- double MiterLimit;
- double ArcTolerance;
-private:
- Paths m_destPolys;
- Path m_srcPoly;
- Path m_destPoly;
- std::vector<DoublePoint> m_normals;
- double m_delta, m_sinA, m_sin, m_cos;
- double m_miterLim, m_StepsPerRad;
- IntPoint m_lowest;
- PolyNode m_polyNodes;
-
- void FixOrientations();
- void DoOffset(double delta);
- void OffsetPoint(int j, int& k, JoinType jointype);
- void DoSquare(int j, int k);
- void DoMiter(int j, int k, double r);
- void DoRound(int j, int k);
-};
-//------------------------------------------------------------------------------
-
-class clipperException : public std::exception
-{
- public:
- clipperException(const char* description): m_descr(description) {}
- virtual ~clipperException() throw() {}
- const char* what() const throw() override {return m_descr.c_str();}
- private:
- std::string m_descr;
-};
-//------------------------------------------------------------------------------
-
-} //QtClipperLib namespace
-
-#endif //clipper_hpp
-
-
diff --git a/src/3rdparty/clipper/clipper.pro b/src/3rdparty/clipper/clipper.pro
deleted file mode 100644
index a518d248..00000000
--- a/src/3rdparty/clipper/clipper.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qt_clipper
-
-CONFIG += staticlib exceptions warn_off optimize_full
-
-load(qt_helper_lib)
-
-# workaround for QTBUG-31586
-contains(QT_CONFIG, c++11): CONFIG += c++11
-
-gcc {
- QMAKE_CFLAGS_OPTIMIZE_FULL += -ffast-math
- !clang:!intel_icc:!rim_qcc: QMAKE_CXXFLAGS_WARN_ON += -Wno-error=return-type
-}
-
-HEADERS += clipper.h
-SOURCES += clipper.cpp
diff --git a/src/3rdparty/clipper/qt_attribution.json b/src/3rdparty/clipper/qt_attribution.json
deleted file mode 100644
index cc00a496..00000000
--- a/src/3rdparty/clipper/qt_attribution.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "Id": "clipper",
- "Name": "Clipper Polygon Clipping Library",
- "QDocModule": "qtpositioning",
- "QtUsage": "Used in the QML plugin of Qt Location and in Qt Positioning.",
- "Description": "The Clipper library performs line & polygon clipping - intersection, union, difference & exclusive-or, and line & polygon offsetting.",
- "Homepage": "http://www.angusj.com/delphi/clipper.php",
- "Version": "6.4.2",
- "LicenseId": "BSL-1.0",
- "License": "Boost Software License 1.0",
- "LicenseFile": "LICENSE",
- "Copyright": "Copyright Angus Johnson 2010-2017"
-}
diff --git a/src/3rdparty/poly2tri/AUTHORS b/src/3rdparty/poly2tri/AUTHORS
deleted file mode 100644
index d8f4899f..00000000
--- a/src/3rdparty/poly2tri/AUTHORS
+++ /dev/null
@@ -1,8 +0,0 @@
-Primary Contributors:
-
- Mason Green <mason.green@gmail.com> (C++, Python)
- Thomas Åhlén <thahlen@gmail.com> (Java)
-
-Other Contributors:
-
-
diff --git a/src/3rdparty/poly2tri/CMakeLists.txt b/src/3rdparty/poly2tri/CMakeLists.txt
deleted file mode 100644
index 167485db..00000000
--- a/src/3rdparty/poly2tri/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Generated from poly2tri.pro.
-
-#####################################################################
-## Bundled_Poly2Tri Generic Library:
-#####################################################################
-
-qt_internal_add_3rdparty_library(Bundled_Poly2Tri
- QMAKE_LIB_NAME _poly2tri
- STATIC
- SKIP_AUTOMOC # special case
- SOURCES
- common/shapes.cpp common/shapes.h
- common/utils.h
- poly2tri.h
- sweep/advancing_front.cpp sweep/advancing_front.h
- sweep/cdt.cpp sweep/cdt.h
- sweep/sweep.cpp sweep/sweep.h
- sweep/sweep_context.cpp sweep/sweep_context.h
-)
-qt_disable_warnings(Bundled_Poly2Tri)
-qt_set_symbol_visibility_hidden(Bundled_Poly2Tri)
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 3:.:.:poly2tri.pro:GCC:
-# QMAKE_CFLAGS_OPTIMIZE_FULL = "-ffast-math"
-
-#### Keys ignored in scope 4:.:.:poly2tri.pro:NOT CLANG AND NOT ICC AND NOT rim_qcc:
-# QMAKE_CXXFLAGS_WARN_ON = "-Wno-error=return-type"
diff --git a/src/3rdparty/poly2tri/LICENSE b/src/3rdparty/poly2tri/LICENSE
deleted file mode 100644
index 9417c083..00000000
--- a/src/3rdparty/poly2tri/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
-http://code.google.com/p/poly2tri/
-
-All rights reserved.
-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 Poly2Tri 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.
diff --git a/src/3rdparty/poly2tri/common/shapes.cpp b/src/3rdparty/poly2tri/common/shapes.cpp
deleted file mode 100644
index 2ac7e979..00000000
--- a/src/3rdparty/poly2tri/common/shapes.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-#include "shapes.h"
-#include <iostream>
-
-namespace p2t {
-
-Triangle::Triangle(Point& a, Point& b, Point& c)
-{
- points_[0] = &a; points_[1] = &b; points_[2] = &c;
- neighbors_[0] = NULL; neighbors_[1] = NULL; neighbors_[2] = NULL;
- constrained_edge[0] = constrained_edge[1] = constrained_edge[2] = false;
- delaunay_edge[0] = delaunay_edge[1] = delaunay_edge[2] = false;
- interior_ = false;
-}
-
-// Update neighbor pointers
-void Triangle::MarkNeighbor(Point* p1, Point* p2, Triangle* t)
-{
- if ((p1 == points_[2] && p2 == points_[1]) || (p1 == points_[1] && p2 == points_[2]))
- neighbors_[0] = t;
- else if ((p1 == points_[0] && p2 == points_[2]) || (p1 == points_[2] && p2 == points_[0]))
- neighbors_[1] = t;
- else if ((p1 == points_[0] && p2 == points_[1]) || (p1 == points_[1] && p2 == points_[0]))
- neighbors_[2] = t;
- else
- assert(0);
-}
-
-// Exhaustive search to update neighbor pointers
-void Triangle::MarkNeighbor(Triangle& t)
-{
- if (t.Contains(points_[1], points_[2])) {
- neighbors_[0] = &t;
- t.MarkNeighbor(points_[1], points_[2], this);
- } else if (t.Contains(points_[0], points_[2])) {
- neighbors_[1] = &t;
- t.MarkNeighbor(points_[0], points_[2], this);
- } else if (t.Contains(points_[0], points_[1])) {
- neighbors_[2] = &t;
- t.MarkNeighbor(points_[0], points_[1], this);
- }
-}
-
-/**
- * Clears all references to all other triangles and points
- */
-void Triangle::Clear()
-{
- Triangle *t;
- for (int i=0; i<3; i++)
- {
- t = neighbors_[i];
- if (t != NULL)
- {
- t->ClearNeighbor( this );
- }
- }
- ClearNeighbors();
- points_[0]=points_[1]=points_[2] = NULL;
-}
-
-void Triangle::ClearNeighbor(Triangle *triangle )
-{
- if (neighbors_[0] == triangle)
- {
- neighbors_[0] = NULL;
- }
- else if (neighbors_[1] == triangle)
- {
- neighbors_[1] = NULL;
- }
- else
- {
- neighbors_[2] = NULL;
- }
-}
-
-void Triangle::ClearNeighbors()
-{
- neighbors_[0] = NULL;
- neighbors_[1] = NULL;
- neighbors_[2] = NULL;
-}
-
-void Triangle::ClearDelunayEdges()
-{
- delaunay_edge[0] = delaunay_edge[1] = delaunay_edge[2] = false;
-}
-
-Point* Triangle::OppositePoint(Triangle& t, Point& p)
-{
- Point *cw = t.PointCW(p);
- return PointCW(*cw);
-}
-
-// Legalized triangle by rotating clockwise around point(0)
-void Triangle::Legalize(Point& point)
-{
- points_[1] = points_[0];
- points_[0] = points_[2];
- points_[2] = &point;
-}
-
-// Legalize triagnle by rotating clockwise around oPoint
-void Triangle::Legalize(Point& opoint, Point& npoint)
-{
- if (&opoint == points_[0]) {
- points_[1] = points_[0];
- points_[0] = points_[2];
- points_[2] = &npoint;
- } else if (&opoint == points_[1]) {
- points_[2] = points_[1];
- points_[1] = points_[0];
- points_[0] = &npoint;
- } else if (&opoint == points_[2]) {
- points_[0] = points_[2];
- points_[2] = points_[1];
- points_[1] = &npoint;
- } else {
- assert(0);
- }
-}
-
-int Triangle::Index(const Point* p)
-{
- if (p == points_[0]) {
- return 0;
- } else if (p == points_[1]) {
- return 1;
- } else if (p == points_[2]) {
- return 2;
- }
- assert(0);
-}
-
-int Triangle::EdgeIndex(const Point* p1, const Point* p2)
-{
- if (points_[0] == p1) {
- if (points_[1] == p2) {
- return 2;
- } else if (points_[2] == p2) {
- return 1;
- }
- } else if (points_[1] == p1) {
- if (points_[2] == p2) {
- return 0;
- } else if (points_[0] == p2) {
- return 2;
- }
- } else if (points_[2] == p1) {
- if (points_[0] == p2) {
- return 1;
- } else if (points_[1] == p2) {
- return 0;
- }
- }
- return -1;
-}
-
-void Triangle::MarkConstrainedEdge(const int index)
-{
- constrained_edge[index] = true;
-}
-
-void Triangle::MarkConstrainedEdge(Edge& edge)
-{
- MarkConstrainedEdge(edge.p, edge.q);
-}
-
-// Mark edge as constrained
-void Triangle::MarkConstrainedEdge(Point* p, Point* q)
-{
- if ((q == points_[0] && p == points_[1]) || (q == points_[1] && p == points_[0])) {
- constrained_edge[2] = true;
- } else if ((q == points_[0] && p == points_[2]) || (q == points_[2] && p == points_[0])) {
- constrained_edge[1] = true;
- } else if ((q == points_[1] && p == points_[2]) || (q == points_[2] && p == points_[1])) {
- constrained_edge[0] = true;
- }
-}
-
-// The point counter-clockwise to given point
-Point* Triangle::PointCW(Point& point)
-{
- if (&point == points_[0]) {
- return points_[2];
- } else if (&point == points_[1]) {
- return points_[0];
- } else if (&point == points_[2]) {
- return points_[1];
- }
- assert(0);
-}
-
-// The point counter-clockwise to given point
-Point* Triangle::PointCCW(Point& point)
-{
- if (&point == points_[0]) {
- return points_[1];
- } else if (&point == points_[1]) {
- return points_[2];
- } else if (&point == points_[2]) {
- return points_[0];
- }
- assert(0);
-}
-
-// The neighbor clockwise to given point
-Triangle* Triangle::NeighborCW(Point& point)
-{
- if (&point == points_[0]) {
- return neighbors_[1];
- } else if (&point == points_[1]) {
- return neighbors_[2];
- }
- return neighbors_[0];
-}
-
-// The neighbor counter-clockwise to given point
-Triangle* Triangle::NeighborCCW(Point& point)
-{
- if (&point == points_[0]) {
- return neighbors_[2];
- } else if (&point == points_[1]) {
- return neighbors_[0];
- }
- return neighbors_[1];
-}
-
-bool Triangle::GetConstrainedEdgeCCW(Point& p)
-{
- if (&p == points_[0]) {
- return constrained_edge[2];
- } else if (&p == points_[1]) {
- return constrained_edge[0];
- }
- return constrained_edge[1];
-}
-
-bool Triangle::GetConstrainedEdgeCW(Point& p)
-{
- if (&p == points_[0]) {
- return constrained_edge[1];
- } else if (&p == points_[1]) {
- return constrained_edge[2];
- }
- return constrained_edge[0];
-}
-
-void Triangle::SetConstrainedEdgeCCW(Point& p, bool ce)
-{
- if (&p == points_[0]) {
- constrained_edge[2] = ce;
- } else if (&p == points_[1]) {
- constrained_edge[0] = ce;
- } else {
- constrained_edge[1] = ce;
- }
-}
-
-void Triangle::SetConstrainedEdgeCW(Point& p, bool ce)
-{
- if (&p == points_[0]) {
- constrained_edge[1] = ce;
- } else if (&p == points_[1]) {
- constrained_edge[2] = ce;
- } else {
- constrained_edge[0] = ce;
- }
-}
-
-bool Triangle::GetDelunayEdgeCCW(Point& p)
-{
- if (&p == points_[0]) {
- return delaunay_edge[2];
- } else if (&p == points_[1]) {
- return delaunay_edge[0];
- }
- return delaunay_edge[1];
-}
-
-bool Triangle::GetDelunayEdgeCW(Point& p)
-{
- if (&p == points_[0]) {
- return delaunay_edge[1];
- } else if (&p == points_[1]) {
- return delaunay_edge[2];
- }
- return delaunay_edge[0];
-}
-
-void Triangle::SetDelunayEdgeCCW(Point& p, bool e)
-{
- if (&p == points_[0]) {
- delaunay_edge[2] = e;
- } else if (&p == points_[1]) {
- delaunay_edge[0] = e;
- } else {
- delaunay_edge[1] = e;
- }
-}
-
-void Triangle::SetDelunayEdgeCW(Point& p, bool e)
-{
- if (&p == points_[0]) {
- delaunay_edge[1] = e;
- } else if (&p == points_[1]) {
- delaunay_edge[2] = e;
- } else {
- delaunay_edge[0] = e;
- }
-}
-
-// The neighbor across to given point
-Triangle& Triangle::NeighborAcross(Point& opoint)
-{
- if (&opoint == points_[0]) {
- return *neighbors_[0];
- } else if (&opoint == points_[1]) {
- return *neighbors_[1];
- }
- return *neighbors_[2];
-}
-
-void Triangle::DebugPrint()
-{
- using namespace std;
- cout << points_[0]->x << "," << points_[0]->y << " ";
- cout << points_[1]->x << "," << points_[1]->y << " ";
- cout << points_[2]->x << "," << points_[2]->y << endl;
-}
-
-}
-
diff --git a/src/3rdparty/poly2tri/common/shapes.h b/src/3rdparty/poly2tri/common/shapes.h
deleted file mode 100644
index 5b90ea6c..00000000
--- a/src/3rdparty/poly2tri/common/shapes.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-
-// Include guard
-#ifndef SHAPES_H
-#define SHAPES_H
-
-#include <vector>
-#include <cstddef>
-#include <assert.h>
-#include <cmath>
-
-namespace p2t {
-
-struct Edge;
-
-struct Point {
-
- double x, y;
-
- /// Default constructor does nothing (for performance).
- Point()
- {
- x = 0.0;
- y = 0.0;
- }
-
- /// The edges this point constitutes an upper ending point
- std::vector<Edge*> edge_list;
-
- /// Construct using coordinates.
- Point(double x, double y) : x(x), y(y) {}
-
- /// Set this point to all zeros.
- void set_zero()
- {
- x = 0.0;
- y = 0.0;
- }
-
- /// Set this point to some specified coordinates.
- void set(double x_, double y_)
- {
- x = x_;
- y = y_;
- }
-
- /// Negate this point.
- Point operator -() const
- {
- Point v;
- v.set(-x, -y);
- return v;
- }
-
- /// Add a point to this point.
- void operator +=(const Point& v)
- {
- x += v.x;
- y += v.y;
- }
-
- /// Subtract a point from this point.
- void operator -=(const Point& v)
- {
- x -= v.x;
- y -= v.y;
- }
-
- /// Multiply this point by a scalar.
- void operator *=(double a)
- {
- x *= a;
- y *= a;
- }
-
- /// Get the length of this point (the norm).
- double Length() const
- {
- return std::sqrt(x * x + y * y);
- }
-
- /// Convert this point into a unit point. Returns the Length.
- double Normalize()
- {
- double len = Length();
- x /= len;
- y /= len;
- return len;
- }
-
-};
-
-// Represents a simple polygon's edge
-struct Edge {
-
- Point* p, *q;
-
- /// Constructor
- Edge(Point& p1, Point& p2) : p(&p1), q(&p2)
- {
- if (p1.y > p2.y) {
- q = &p1;
- p = &p2;
- } else if (p1.y == p2.y) {
- if (p1.x > p2.x) {
- q = &p1;
- p = &p2;
- } else if (p1.x == p2.x) {
- // Repeat points
- assert(false);
- }
- }
-
- q->edge_list.push_back(this);
- }
-};
-
-// Triangle-based data structures are know to have better performance than quad-edge structures
-// See: J. Shewchuk, "Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator"
-// "Triangulations in CGAL"
-class Triangle {
-public:
-
-/// Constructor
-Triangle(Point& a, Point& b, Point& c);
-
-/// Flags to determine if an edge is a Constrained edge
-bool constrained_edge[3];
-/// Flags to determine if an edge is a Delauney edge
-bool delaunay_edge[3];
-
-Point* GetPoint(const int& index);
-Point* PointCW(Point& point);
-Point* PointCCW(Point& point);
-Point* OppositePoint(Triangle& t, Point& p);
-
-Triangle* GetNeighbor(const int& index);
-void MarkNeighbor(Point* p1, Point* p2, Triangle* t);
-void MarkNeighbor(Triangle& t);
-
-void MarkConstrainedEdge(const int index);
-void MarkConstrainedEdge(Edge& edge);
-void MarkConstrainedEdge(Point* p, Point* q);
-
-int Index(const Point* p);
-int EdgeIndex(const Point* p1, const Point* p2);
-
-Triangle* NeighborCW(Point& point);
-Triangle* NeighborCCW(Point& point);
-bool GetConstrainedEdgeCCW(Point& p);
-bool GetConstrainedEdgeCW(Point& p);
-void SetConstrainedEdgeCCW(Point& p, bool ce);
-void SetConstrainedEdgeCW(Point& p, bool ce);
-bool GetDelunayEdgeCCW(Point& p);
-bool GetDelunayEdgeCW(Point& p);
-void SetDelunayEdgeCCW(Point& p, bool e);
-void SetDelunayEdgeCW(Point& p, bool e);
-
-bool Contains(Point* p);
-bool Contains(const Edge& e);
-bool Contains(Point* p, Point* q);
-void Legalize(Point& point);
-void Legalize(Point& opoint, Point& npoint);
-/**
- * Clears all references to all other triangles and points
- */
-void Clear();
-void ClearNeighbor(Triangle *triangle );
-void ClearNeighbors();
-void ClearDelunayEdges();
-
-inline bool IsInterior();
-inline void IsInterior(bool b);
-
-Triangle& NeighborAcross(Point& opoint);
-
-void DebugPrint();
-
-private:
-
-/// Triangle points
-Point* points_[3];
-/// Neighbor list
-Triangle* neighbors_[3];
-
-/// Has this triangle been marked as an interior triangle?
-bool interior_;
-};
-
-inline bool cmp(const Point* a, const Point* b)
-{
- if (a->y < b->y) {
- return true;
- } else if (a->y == b->y) {
- // Make sure q is point with greater x value
- if (a->x < b->x) {
- return true;
- }
- }
- return false;
-}
-
-/// Add two points_ component-wise.
-inline Point operator +(const Point& a, const Point& b)
-{
- return Point(a.x + b.x, a.y + b.y);
-}
-
-/// Subtract two points_ component-wise.
-inline Point operator -(const Point& a, const Point& b)
-{
- return Point(a.x - b.x, a.y - b.y);
-}
-
-/// Multiply point by scalar
-inline Point operator *(double s, const Point& a)
-{
- return Point(s * a.x, s * a.y);
-}
-
-inline bool operator ==(const Point& a, const Point& b)
-{
- return a.x == b.x && a.y == b.y;
-}
-
-inline bool operator !=(const Point& a, const Point& b)
-{
- return !(a.x == b.x) && !(a.y == b.y);
-}
-
-/// Peform the dot product on two vectors.
-inline double Dot(const Point& a, const Point& b)
-{
- return a.x * b.x + a.y * b.y;
-}
-
-/// Perform the cross product on two vectors. In 2D this produces a scalar.
-inline double Cross(const Point& a, const Point& b)
-{
- return a.x * b.y - a.y * b.x;
-}
-
-/// Perform the cross product on a point and a scalar. In 2D this produces
-/// a point.
-inline Point Cross(const Point& a, double s)
-{
- return Point(s * a.y, -s * a.x);
-}
-
-/// Perform the cross product on a scalar and a point. In 2D this produces
-/// a point.
-inline Point Cross(const double s, const Point& a)
-{
- return Point(-s * a.y, s * a.x);
-}
-
-inline Point* Triangle::GetPoint(const int& index)
-{
- return points_[index];
-}
-
-inline Triangle* Triangle::GetNeighbor(const int& index)
-{
- return neighbors_[index];
-}
-
-inline bool Triangle::Contains(Point* p)
-{
- return p == points_[0] || p == points_[1] || p == points_[2];
-}
-
-inline bool Triangle::Contains(const Edge& e)
-{
- return Contains(e.p) && Contains(e.q);
-}
-
-inline bool Triangle::Contains(Point* p, Point* q)
-{
- return Contains(p) && Contains(q);
-}
-
-inline bool Triangle::IsInterior()
-{
- return interior_;
-}
-
-inline void Triangle::IsInterior(bool b)
-{
- interior_ = b;
-}
-
-}
-
-#endif
-
-
diff --git a/src/3rdparty/poly2tri/common/utils.h b/src/3rdparty/poly2tri/common/utils.h
deleted file mode 100644
index 8744b6d2..00000000
--- a/src/3rdparty/poly2tri/common/utils.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-
-#ifndef UTILS_H
-#define UTILS_H
-
-// Otherwise #defines like M_PI are undeclared under Visual Studio
-#define _USE_MATH_DEFINES
-
-#include <exception>
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI (3.14159265358979323846)
-#endif
-
-namespace p2t {
-
-const double PI_3div4 = 3 * M_PI / 4;
-const double PI_div2 = 1.57079632679489661923;
-const double EPSILON = 1e-12;
-
-enum Orientation { CW, CCW, COLLINEAR };
-
-/**
- * Forumla to calculate signed area<br>
- * Positive if CCW<br>
- * Negative if CW<br>
- * 0 if collinear<br>
- * <pre>
- * A[P1,P2,P3] = (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
- * = (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
- * </pre>
- */
-Orientation Orient2d(Point& pa, Point& pb, Point& pc)
-{
- double detleft = (pa.x - pc.x) * (pb.y - pc.y);
- double detright = (pa.y - pc.y) * (pb.x - pc.x);
- double val = detleft - detright;
- if (val > -EPSILON && val < EPSILON) {
- return COLLINEAR;
- } else if (val > 0) {
- return CCW;
- }
- return CW;
-}
-
-/*
-bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
-{
- double pdx = pd.x;
- double pdy = pd.y;
- double adx = pa.x - pdx;
- double ady = pa.y - pdy;
- double bdx = pb.x - pdx;
- double bdy = pb.y - pdy;
-
- double adxbdy = adx * bdy;
- double bdxady = bdx * ady;
- double oabd = adxbdy - bdxady;
-
- if (oabd <= EPSILON) {
- return false;
- }
-
- double cdx = pc.x - pdx;
- double cdy = pc.y - pdy;
-
- double cdxady = cdx * ady;
- double adxcdy = adx * cdy;
- double ocad = cdxady - adxcdy;
-
- if (ocad <= EPSILON) {
- return false;
- }
-
- return true;
-}
-
-*/
-
-bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
-{
- double oadb = (pa.x - pb.x)*(pd.y - pb.y) - (pd.x - pb.x)*(pa.y - pb.y);
- if (oadb >= -EPSILON) {
- return false;
- }
-
- double oadc = (pa.x - pc.x)*(pd.y - pc.y) - (pd.x - pc.x)*(pa.y - pc.y);
- if (oadc <= EPSILON) {
- return false;
- }
- return true;
-}
-
-}
-
-#endif
-
diff --git a/src/3rdparty/poly2tri/poly2tri.h b/src/3rdparty/poly2tri/poly2tri.h
deleted file mode 100644
index 042cb3dc..00000000
--- a/src/3rdparty/poly2tri/poly2tri.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-
-#ifndef POLY2TRI_H
-#define POLY2TRI_H
-
-#include "common/shapes.h"
-#include "sweep/cdt.h"
-
-#endif
-
diff --git a/src/3rdparty/poly2tri/poly2tri.pro b/src/3rdparty/poly2tri/poly2tri.pro
deleted file mode 100644
index 6c5f7692..00000000
--- a/src/3rdparty/poly2tri/poly2tri.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-TARGET = qt_poly2tri
-
-CONFIG += staticlib warn_off optimize_full
-
-load(qt_helper_lib)
-
-# workaround for QTBUG-31586
-contains(QT_CONFIG, c++11): CONFIG += c++11
-
-gcc {
- QMAKE_CFLAGS_OPTIMIZE_FULL += -ffast-math
- !clang:!intel_icc:!rim_qcc: QMAKE_CXXFLAGS_WARN_ON += -Wno-error=return-type
-}
-
-HEADERS += poly2tri.h \
- common/shapes.h \
- common/utils.h \
- sweep/advancing_front.h \
- sweep/cdt.h \
- sweep/sweep.h \
- sweep/sweep_context.h
-
-SOURCES += common/shapes.cpp \
- sweep/sweep_context.cpp \
- sweep/cdt.cpp \
- sweep/sweep.cpp \
- sweep/advancing_front.cpp
diff --git a/src/3rdparty/poly2tri/qt_attribution.json b/src/3rdparty/poly2tri/qt_attribution.json
deleted file mode 100644
index 0571384d..00000000
--- a/src/3rdparty/poly2tri/qt_attribution.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "Id": "poly2tri",
- "Name": "Poly2Tri Polygon Triangulation Library",
- "QDocModule": "qtpositioning",
- "QtUsage": "Used in the QML plugin of Qt Location and in Qt Positioning.",
-
- "Description": "Poly2Tri is a sweepline constrained Delaunay Polygon Triangulation Library.",
- "Homepage": "https://github.com/greenm01/poly2tri",
- "LicenseId": "BSD-3-Clause",
- "License": "BSD 3-clause \"New\" or \"Revised\" License",
- "LicenseFile": "LICENSE",
- "Copyright": "Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors"
-}
diff --git a/src/3rdparty/poly2tri/sweep/advancing_front.cpp b/src/3rdparty/poly2tri/sweep/advancing_front.cpp
deleted file mode 100644
index 03779840..00000000
--- a/src/3rdparty/poly2tri/sweep/advancing_front.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-#include "advancing_front.h"
-
-namespace p2t {
-
-AdvancingFront::AdvancingFront(Node& head, Node& tail)
-{
- head_ = &head;
- tail_ = &tail;
- search_node_ = &head;
-}
-
-Node* AdvancingFront::LocateNode(const double& x)
-{
- Node* node = search_node_;
-
- if (x < node->value) {
- while ((node = node->prev) != NULL) {
- if (x >= node->value) {
- search_node_ = node;
- return node;
- }
- }
- } else {
- while ((node = node->next) != NULL) {
- if (x < node->value) {
- search_node_ = node->prev;
- return node->prev;
- }
- }
- }
- return NULL;
-}
-
-Node* AdvancingFront::FindSearchNode(const double& x)
-{
- (void)x; // suppress compiler warnings "unused parameter 'x'"
- // TODO: implement BST index
- return search_node_;
-}
-
-Node* AdvancingFront::LocatePoint(const Point* point)
-{
- const double px = point->x;
- Node* node = FindSearchNode(px);
- const double nx = node->point->x;
-
- if (px == nx) {
- if (point != node->point) {
- // We might have two nodes with same x value for a short time
- if (point == node->prev->point) {
- node = node->prev;
- } else if (point == node->next->point) {
- node = node->next;
- } else {
- assert(0);
- }
- }
- } else if (px < nx) {
- while ((node = node->prev) != NULL) {
- if (point == node->point) {
- break;
- }
- }
- } else {
- while ((node = node->next) != NULL) {
- if (point == node->point)
- break;
- }
- }
- if (node) search_node_ = node;
- return node;
-}
-
-AdvancingFront::~AdvancingFront()
-{
-}
-
-}
-
diff --git a/src/3rdparty/poly2tri/sweep/advancing_front.h b/src/3rdparty/poly2tri/sweep/advancing_front.h
deleted file mode 100644
index bab73d44..00000000
--- a/src/3rdparty/poly2tri/sweep/advancing_front.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-
-#ifndef ADVANCED_FRONT_H
-#define ADVANCED_FRONT_H
-
-#include "../common/shapes.h"
-
-namespace p2t {
-
-struct Node;
-
-// Advancing front node
-struct Node {
- Point* point;
- Triangle* triangle;
-
- Node* next;
- Node* prev;
-
- double value;
-
- Node(Point& p) : point(&p), triangle(NULL), next(NULL), prev(NULL), value(p.x)
- {
- }
-
- Node(Point& p, Triangle& t) : point(&p), triangle(&t), next(NULL), prev(NULL), value(p.x)
- {
- }
-
-};
-
-// Advancing front
-class AdvancingFront {
-public:
-
-AdvancingFront(Node& head, Node& tail);
-// Destructor
-~AdvancingFront();
-
-Node* head();
-void set_head(Node* node);
-Node* tail();
-void set_tail(Node* node);
-Node* search();
-void set_search(Node* node);
-
-/// Locate insertion point along advancing front
-Node* LocateNode(const double& x);
-
-Node* LocatePoint(const Point* point);
-
-private:
-
-Node* head_, *tail_, *search_node_;
-
-Node* FindSearchNode(const double& x);
-};
-
-inline Node* AdvancingFront::head()
-{
- return head_;
-}
-inline void AdvancingFront::set_head(Node* node)
-{
- head_ = node;
-}
-
-inline Node* AdvancingFront::tail()
-{
- return tail_;
-}
-inline void AdvancingFront::set_tail(Node* node)
-{
- tail_ = node;
-}
-
-inline Node* AdvancingFront::search()
-{
- return search_node_;
-}
-
-inline void AdvancingFront::set_search(Node* node)
-{
- search_node_ = node;
-}
-
-}
-
-#endif
diff --git a/src/3rdparty/poly2tri/sweep/cdt.cpp b/src/3rdparty/poly2tri/sweep/cdt.cpp
deleted file mode 100644
index e0b3ec79..00000000
--- a/src/3rdparty/poly2tri/sweep/cdt.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-#include "cdt.h"
-
-namespace p2t {
-
-CDT::CDT(std::vector<Point*> polyline)
-{
- sweep_context_ = new SweepContext(polyline);
- sweep_ = new Sweep;
-}
-
-void CDT::AddHole(std::vector<Point*> polyline)
-{
- sweep_context_->AddHole(polyline);
-}
-
-void CDT::AddPoint(Point* point) {
- sweep_context_->AddPoint(point);
-}
-
-void CDT::Triangulate()
-{
- sweep_->Triangulate(*sweep_context_);
-}
-
-std::vector<p2t::Triangle*> CDT::GetTriangles()
-{
- return sweep_context_->GetTriangles();
-}
-
-std::list<p2t::Triangle*> CDT::GetMap()
-{
- return sweep_context_->GetMap();
-}
-
-CDT::~CDT()
-{
- delete sweep_context_;
- delete sweep_;
-}
-
-}
-
diff --git a/src/3rdparty/poly2tri/sweep/cdt.h b/src/3rdparty/poly2tri/sweep/cdt.h
deleted file mode 100644
index e7b703de..00000000
--- a/src/3rdparty/poly2tri/sweep/cdt.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-
-#ifndef CDT_H
-#define CDT_H
-
-#include "advancing_front.h"
-#include "sweep_context.h"
-#include "sweep.h"
-
-/**
- *
- * @author Mason Green <mason.green@gmail.com>
- *
- */
-
-namespace p2t {
-
-class CDT
-{
-public:
-
- /**
- * Constructor - add polyline with non repeating points
- *
- * @param polyline
- */
- CDT(std::vector<Point*> polyline);
-
- /**
- * Destructor - clean up memory
- */
- ~CDT();
-
- /**
- * Add a hole
- *
- * @param polyline
- */
- void AddHole(std::vector<Point*> polyline);
-
- /**
- * Add a steiner point
- *
- * @param point
- */
- void AddPoint(Point* point);
-
- /**
- * Triangulate - do this AFTER you've added the polyline, holes, and Steiner points
- */
- void Triangulate();
-
- /**
- * Get CDT triangles
- */
- std::vector<Triangle*> GetTriangles();
-
- /**
- * Get triangle map
- */
- std::list<Triangle*> GetMap();
-
- private:
-
- /**
- * Internals
- */
-
- SweepContext* sweep_context_;
- Sweep* sweep_;
-
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/poly2tri/sweep/sweep.cpp b/src/3rdparty/poly2tri/sweep/sweep.cpp
deleted file mode 100644
index 954d2db2..00000000
--- a/src/3rdparty/poly2tri/sweep/sweep.cpp
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-#include <stddef.h>
-#include <stdexcept>
-#include "sweep.h"
-#include "sweep_context.h"
-#include "advancing_front.h"
-#include "../common/utils.h"
-
-namespace p2t {
-
-// Triangulate simple polygon with holes
-void Sweep::Triangulate(SweepContext& tcx)
-{
- tcx.InitTriangulation();
- tcx.CreateAdvancingFront(nodes_);
- // Sweep points; build mesh
- SweepPoints(tcx);
- // Clean up
- FinalizationPolygon(tcx);
-}
-
-void Sweep::SweepPoints(SweepContext& tcx)
-{
- for (int i = 1; i < tcx.point_count(); i++) {
- Point& point = *tcx.GetPoint(i);
- Node* node = &PointEvent(tcx, point);
- for (unsigned int i = 0; i < point.edge_list.size(); i++) {
- EdgeEvent(tcx, point.edge_list[i], node);
- }
- }
-}
-
-void Sweep::FinalizationPolygon(SweepContext& tcx)
-{
- // Get an Internal triangle to start with
- Triangle* t = tcx.front()->head()->next->triangle;
- Point* p = tcx.front()->head()->next->point;
- while (!t->GetConstrainedEdgeCW(*p)) {
- t = t->NeighborCCW(*p);
- }
-
- // Collect interior triangles constrained by edges
- tcx.MeshClean(*t);
-}
-
-Node& Sweep::PointEvent(SweepContext& tcx, Point& point)
-{
- Node& node = tcx.LocateNode(point);
- Node& new_node = NewFrontTriangle(tcx, point, node);
-
- // Only need to check +epsilon since point never have smaller
- // x value than node due to how we fetch nodes from the front
- if (point.x <= node.point->x + EPSILON) {
- Fill(tcx, node);
- }
-
- //tcx.AddNode(new_node);
-
- FillAdvancingFront(tcx, new_node);
- return new_node;
-}
-
-void Sweep::EdgeEvent(SweepContext& tcx, Edge* edge, Node* node)
-{
- tcx.edge_event.constrained_edge = edge;
- tcx.edge_event.right = (edge->p->x > edge->q->x);
-
- if (IsEdgeSideOfTriangle(*node->triangle, *edge->p, *edge->q)) {
- return;
- }
-
- // For now we will do all needed filling
- // TODO: integrate with flip process might give some better performance
- // but for now this avoid the issue with cases that needs both flips and fills
- FillEdgeEvent(tcx, edge, node);
- EdgeEvent(tcx, *edge->p, *edge->q, node->triangle, *edge->q);
-}
-
-void Sweep::EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point)
-{
- if (IsEdgeSideOfTriangle(*triangle, ep, eq)) {
- return;
- }
-
- Point* p1 = triangle->PointCCW(point);
- Orientation o1 = Orient2d(eq, *p1, ep);
- if (o1 == COLLINEAR) {
- if ( triangle->Contains(&eq, p1)) {
- triangle->MarkConstrainedEdge(&eq, p1 );
- // We are modifying the constraint maybe it would be better to
- // not change the given constraint and just keep a variable for the new constraint
- tcx.edge_event.constrained_edge->q = p1;
- triangle = &triangle->NeighborAcross(point);
- EdgeEvent( tcx, ep, *p1, triangle, *p1 );
- } else {
- std::runtime_error("EdgeEvent - collinear points not supported");
- assert(0);
- }
- return;
- }
-
- Point* p2 = triangle->PointCW(point);
- Orientation o2 = Orient2d(eq, *p2, ep);
- if (o2 == COLLINEAR) {
- if ( triangle->Contains(&eq, p2)) {
- triangle->MarkConstrainedEdge(&eq, p2 );
- // We are modifying the constraint maybe it would be better to
- // not change the given constraint and just keep a variable for the new constraint
- tcx.edge_event.constrained_edge->q = p2;
- triangle = &triangle->NeighborAcross(point);
- EdgeEvent( tcx, ep, *p2, triangle, *p2 );
- } else {
- std::runtime_error("EdgeEvent - collinear points not supported");
- assert(0);
- }
- return;
- }
-
- if (o1 == o2) {
- // Need to decide if we are rotating CW or CCW to get to a triangle
- // that will cross edge
- if (o1 == CW) {
- triangle = triangle->NeighborCCW(point);
- } else{
- triangle = triangle->NeighborCW(point);
- }
- EdgeEvent(tcx, ep, eq, triangle, point);
- } else {
- // This triangle crosses constraint so lets flippin start!
- FlipEdgeEvent(tcx, ep, eq, triangle, point);
- }
-}
-
-bool Sweep::IsEdgeSideOfTriangle(Triangle& triangle, Point& ep, Point& eq)
-{
- int index = triangle.EdgeIndex(&ep, &eq);
-
- if (index != -1) {
- triangle.MarkConstrainedEdge(index);
- Triangle* t = triangle.GetNeighbor(index);
- if (t) {
- t->MarkConstrainedEdge(&ep, &eq);
- }
- return true;
- }
- return false;
-}
-
-Node& Sweep::NewFrontTriangle(SweepContext& tcx, Point& point, Node& node)
-{
- Triangle* triangle = new Triangle(point, *node.point, *node.next->point);
-
- triangle->MarkNeighbor(*node.triangle);
- tcx.AddToMap(triangle);
-
- Node* new_node = new Node(point);
- nodes_.push_back(new_node);
-
- new_node->next = node.next;
- new_node->prev = &node;
- node.next->prev = new_node;
- node.next = new_node;
-
- if (!Legalize(tcx, *triangle)) {
- tcx.MapTriangleToNodes(*triangle);
- }
-
- return *new_node;
-}
-
-void Sweep::Fill(SweepContext& tcx, Node& node)
-{
- Triangle* triangle = new Triangle(*node.prev->point, *node.point, *node.next->point);
-
- // TODO: should copy the constrained_edge value from neighbor triangles
- // for now constrained_edge values are copied during the legalize
- triangle->MarkNeighbor(*node.prev->triangle);
- triangle->MarkNeighbor(*node.triangle);
-
- tcx.AddToMap(triangle);
-
- // Update the advancing front
- node.prev->next = node.next;
- node.next->prev = node.prev;
-
- // If it was legalized the triangle has already been mapped
- if (!Legalize(tcx, *triangle)) {
- tcx.MapTriangleToNodes(*triangle);
- }
-
-}
-
-void Sweep::FillAdvancingFront(SweepContext& tcx, Node& n)
-{
-
- // Fill right holes
- Node* node = n.next;
-
- while (node->next) {
- // if HoleAngle exceeds 90 degrees then break.
- if (LargeHole_DontFill(node)) break;
- Fill(tcx, *node);
- node = node->next;
- }
-
- // Fill left holes
- node = n.prev;
-
- while (node->prev) {
- // if HoleAngle exceeds 90 degrees then break.
- if (LargeHole_DontFill(node)) break;
- Fill(tcx, *node);
- node = node->prev;
- }
-
- // Fill right basins
- if (n.next && n.next->next) {
- double angle = BasinAngle(n);
- if (angle < PI_3div4) {
- FillBasin(tcx, n);
- }
- }
-}
-
-// True if HoleAngle exceeds 90 degrees.
-bool Sweep::LargeHole_DontFill(Node* node) {
-
- Node* nextNode = node->next;
- Node* prevNode = node->prev;
- if (!AngleExceeds90Degrees(node->point, nextNode->point, prevNode->point))
- return false;
-
- // Check additional points on front.
- Node* next2Node = nextNode->next;
- // "..Plus.." because only want angles on same side as point being added.
- if ((next2Node != NULL) && !AngleExceedsPlus90DegreesOrIsNegative(node->point, next2Node->point, prevNode->point))
- return false;
-
- Node* prev2Node = prevNode->prev;
- // "..Plus.." because only want angles on same side as point being added.
- if ((prev2Node != NULL) && !AngleExceedsPlus90DegreesOrIsNegative(node->point, nextNode->point, prev2Node->point))
- return false;
-
- return true;
-}
-
-bool Sweep::AngleExceeds90Degrees(Point* origin, Point* pa, Point* pb) {
- double angle = Angle(*origin, *pa, *pb);
- bool exceeds90Degrees = ((angle > PI_div2) || (angle < -PI_div2));
- return exceeds90Degrees;
-}
-
-bool Sweep::AngleExceedsPlus90DegreesOrIsNegative(Point* origin, Point* pa, Point* pb) {
- double angle = Angle(*origin, *pa, *pb);
- bool exceedsPlus90DegreesOrIsNegative = (angle > PI_div2) || (angle < 0);
- return exceedsPlus90DegreesOrIsNegative;
-}
-
-double Sweep::Angle(Point& origin, Point& pa, Point& pb) {
- /* Complex plane
- * ab = cosA +i*sinA
- * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx)
- * atan2(y,x) computes the principal value of the argument function
- * applied to the complex number x+iy
- * Where x = ax*bx + ay*by
- * y = ax*by - ay*bx
- */
- double px = origin.x;
- double py = origin.y;
- double ax = pa.x- px;
- double ay = pa.y - py;
- double bx = pb.x - px;
- double by = pb.y - py;
- double x = ax * by - ay * bx;
- double y = ax * bx + ay * by;
- double angle = atan2(x, y);
- return angle;
-}
-
-double Sweep::BasinAngle(Node& node)
-{
- double ax = node.point->x - node.next->next->point->x;
- double ay = node.point->y - node.next->next->point->y;
- return atan2(ay, ax);
-}
-
-double Sweep::HoleAngle(Node& node)
-{
- /* Complex plane
- * ab = cosA +i*sinA
- * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx)
- * atan2(y,x) computes the principal value of the argument function
- * applied to the complex number x+iy
- * Where x = ax*bx + ay*by
- * y = ax*by - ay*bx
- */
- double ax = node.next->point->x - node.point->x;
- double ay = node.next->point->y - node.point->y;
- double bx = node.prev->point->x - node.point->x;
- double by = node.prev->point->y - node.point->y;
- return atan2(ax * by - ay * bx, ax * bx + ay * by);
-}
-
-bool Sweep::Legalize(SweepContext& tcx, Triangle& t)
-{
- // To legalize a triangle we start by finding if any of the three edges
- // violate the Delaunay condition
- for (int i = 0; i < 3; i++) {
- if (t.delaunay_edge[i])
- continue;
-
- Triangle* ot = t.GetNeighbor(i);
-
- if (ot) {
- Point* p = t.GetPoint(i);
- Point* op = ot->OppositePoint(t, *p);
- int oi = ot->Index(op);
-
- // If this is a Constrained Edge or a Delaunay Edge(only during recursive legalization)
- // then we should not try to legalize
- if (ot->constrained_edge[oi] || ot->delaunay_edge[oi]) {
- t.constrained_edge[i] = ot->constrained_edge[oi];
- continue;
- }
-
- bool inside = Incircle(*p, *t.PointCCW(*p), *t.PointCW(*p), *op);
-
- if (inside) {
- // Lets mark this shared edge as Delaunay
- t.delaunay_edge[i] = true;
- ot->delaunay_edge[oi] = true;
-
- // Lets rotate shared edge one vertex CW to legalize it
- RotateTrianglePair(t, *p, *ot, *op);
-
- // We now got one valid Delaunay Edge shared by two triangles
- // This gives us 4 new edges to check for Delaunay
-
- // Make sure that triangle to node mapping is done only one time for a specific triangle
- bool not_legalized = !Legalize(tcx, t);
- if (not_legalized) {
- tcx.MapTriangleToNodes(t);
- }
-
- not_legalized = !Legalize(tcx, *ot);
- if (not_legalized)
- tcx.MapTriangleToNodes(*ot);
-
- // Reset the Delaunay edges, since they only are valid Delaunay edges
- // until we add a new triangle or point.
- // XXX: need to think about this. Can these edges be tried after we
- // return to previous recursive level?
- t.delaunay_edge[i] = false;
- ot->delaunay_edge[oi] = false;
-
- // If triangle have been legalized no need to check the other edges since
- // the recursive legalization will handles those so we can end here.
- return true;
- }
- }
- }
- return false;
-}
-
-bool Sweep::Incircle(Point& pa, Point& pb, Point& pc, Point& pd)
-{
- double adx = pa.x - pd.x;
- double ady = pa.y - pd.y;
- double bdx = pb.x - pd.x;
- double bdy = pb.y - pd.y;
-
- double adxbdy = adx * bdy;
- double bdxady = bdx * ady;
- double oabd = adxbdy - bdxady;
-
- if (oabd <= 0)
- return false;
-
- double cdx = pc.x - pd.x;
- double cdy = pc.y - pd.y;
-
- double cdxady = cdx * ady;
- double adxcdy = adx * cdy;
- double ocad = cdxady - adxcdy;
-
- if (ocad <= 0)
- return false;
-
- double bdxcdy = bdx * cdy;
- double cdxbdy = cdx * bdy;
-
- double alift = adx * adx + ady * ady;
- double blift = bdx * bdx + bdy * bdy;
- double clift = cdx * cdx + cdy * cdy;
-
- double det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd;
-
- return det > 0;
-}
-
-void Sweep::RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op)
-{
- Triangle* n1, *n2, *n3, *n4;
- n1 = t.NeighborCCW(p);
- n2 = t.NeighborCW(p);
- n3 = ot.NeighborCCW(op);
- n4 = ot.NeighborCW(op);
-
- bool ce1, ce2, ce3, ce4;
- ce1 = t.GetConstrainedEdgeCCW(p);
- ce2 = t.GetConstrainedEdgeCW(p);
- ce3 = ot.GetConstrainedEdgeCCW(op);
- ce4 = ot.GetConstrainedEdgeCW(op);
-
- bool de1, de2, de3, de4;
- de1 = t.GetDelunayEdgeCCW(p);
- de2 = t.GetDelunayEdgeCW(p);
- de3 = ot.GetDelunayEdgeCCW(op);
- de4 = ot.GetDelunayEdgeCW(op);
-
- t.Legalize(p, op);
- ot.Legalize(op, p);
-
- // Remap delaunay_edge
- ot.SetDelunayEdgeCCW(p, de1);
- t.SetDelunayEdgeCW(p, de2);
- t.SetDelunayEdgeCCW(op, de3);
- ot.SetDelunayEdgeCW(op, de4);
-
- // Remap constrained_edge
- ot.SetConstrainedEdgeCCW(p, ce1);
- t.SetConstrainedEdgeCW(p, ce2);
- t.SetConstrainedEdgeCCW(op, ce3);
- ot.SetConstrainedEdgeCW(op, ce4);
-
- // Remap neighbors
- // XXX: might optimize the markNeighbor by keeping track of
- // what side should be assigned to what neighbor after the
- // rotation. Now mark neighbor does lots of testing to find
- // the right side.
- t.ClearNeighbors();
- ot.ClearNeighbors();
- if (n1) ot.MarkNeighbor(*n1);
- if (n2) t.MarkNeighbor(*n2);
- if (n3) t.MarkNeighbor(*n3);
- if (n4) ot.MarkNeighbor(*n4);
- t.MarkNeighbor(ot);
-}
-
-void Sweep::FillBasin(SweepContext& tcx, Node& node)
-{
- if (Orient2d(*node.point, *node.next->point, *node.next->next->point) == CCW) {
- tcx.basin.left_node = node.next->next;
- } else {
- tcx.basin.left_node = node.next;
- }
-
- // Find the bottom and right node
- tcx.basin.bottom_node = tcx.basin.left_node;
- while (tcx.basin.bottom_node->next
- && tcx.basin.bottom_node->point->y >= tcx.basin.bottom_node->next->point->y) {
- tcx.basin.bottom_node = tcx.basin.bottom_node->next;
- }
- if (tcx.basin.bottom_node == tcx.basin.left_node) {
- // No valid basin
- return;
- }
-
- tcx.basin.right_node = tcx.basin.bottom_node;
- while (tcx.basin.right_node->next
- && tcx.basin.right_node->point->y < tcx.basin.right_node->next->point->y) {
- tcx.basin.right_node = tcx.basin.right_node->next;
- }
- if (tcx.basin.right_node == tcx.basin.bottom_node) {
- // No valid basins
- return;
- }
-
- tcx.basin.width = tcx.basin.right_node->point->x - tcx.basin.left_node->point->x;
- tcx.basin.left_highest = tcx.basin.left_node->point->y > tcx.basin.right_node->point->y;
-
- FillBasinReq(tcx, tcx.basin.bottom_node);
-}
-
-void Sweep::FillBasinReq(SweepContext& tcx, Node* node)
-{
- // if shallow stop filling
- if (IsShallow(tcx, *node)) {
- return;
- }
-
- Fill(tcx, *node);
-
- if (node->prev == tcx.basin.left_node && node->next == tcx.basin.right_node) {
- return;
- } else if (node->prev == tcx.basin.left_node) {
- Orientation o = Orient2d(*node->point, *node->next->point, *node->next->next->point);
- if (o == CW) {
- return;
- }
- node = node->next;
- } else if (node->next == tcx.basin.right_node) {
- Orientation o = Orient2d(*node->point, *node->prev->point, *node->prev->prev->point);
- if (o == CCW) {
- return;
- }
- node = node->prev;
- } else {
- // Continue with the neighbor node with lowest Y value
- if (node->prev->point->y < node->next->point->y) {
- node = node->prev;
- } else {
- node = node->next;
- }
- }
-
- FillBasinReq(tcx, node);
-}
-
-bool Sweep::IsShallow(SweepContext& tcx, Node& node)
-{
- double height;
-
- if (tcx.basin.left_highest) {
- height = tcx.basin.left_node->point->y - node.point->y;
- } else {
- height = tcx.basin.right_node->point->y - node.point->y;
- }
-
- // if shallow stop filling
- if (tcx.basin.width > height) {
- return true;
- }
- return false;
-}
-
-void Sweep::FillEdgeEvent(SweepContext& tcx, Edge* edge, Node* node)
-{
- if (tcx.edge_event.right) {
- FillRightAboveEdgeEvent(tcx, edge, node);
- } else {
- FillLeftAboveEdgeEvent(tcx, edge, node);
- }
-}
-
-void Sweep::FillRightAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node)
-{
- while (node->next->point->x < edge->p->x) {
- // Check if next node is below the edge
- if (Orient2d(*edge->q, *node->next->point, *edge->p) == CCW) {
- FillRightBelowEdgeEvent(tcx, edge, *node);
- } else {
- node = node->next;
- }
- }
-}
-
-void Sweep::FillRightBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
-{
- if (node.point->x < edge->p->x) {
- if (Orient2d(*node.point, *node.next->point, *node.next->next->point) == CCW) {
- // Concave
- FillRightConcaveEdgeEvent(tcx, edge, node);
- } else{
- // Convex
- FillRightConvexEdgeEvent(tcx, edge, node);
- // Retry this one
- FillRightBelowEdgeEvent(tcx, edge, node);
- }
- }
-}
-
-void Sweep::FillRightConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
-{
- Fill(tcx, *node.next);
- if (node.next->point != edge->p) {
- // Next above or below edge?
- if (Orient2d(*edge->q, *node.next->point, *edge->p) == CCW) {
- // Below
- if (Orient2d(*node.point, *node.next->point, *node.next->next->point) == CCW) {
- // Next is concave
- FillRightConcaveEdgeEvent(tcx, edge, node);
- } else {
- // Next is convex
- }
- }
- }
-
-}
-
-void Sweep::FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
-{
- // Next concave or convex?
- if (Orient2d(*node.next->point, *node.next->next->point, *node.next->next->next->point) == CCW) {
- // Concave
- FillRightConcaveEdgeEvent(tcx, edge, *node.next);
- } else{
- // Convex
- // Next above or below edge?
- if (Orient2d(*edge->q, *node.next->next->point, *edge->p) == CCW) {
- // Below
- FillRightConvexEdgeEvent(tcx, edge, *node.next);
- } else{
- // Above
- }
- }
-}
-
-void Sweep::FillLeftAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node)
-{
- while (node->prev->point->x > edge->p->x) {
- // Check if next node is below the edge
- if (Orient2d(*edge->q, *node->prev->point, *edge->p) == CW) {
- FillLeftBelowEdgeEvent(tcx, edge, *node);
- } else {
- node = node->prev;
- }
- }
-}
-
-void Sweep::FillLeftBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
-{
- if (node.point->x > edge->p->x) {
- if (Orient2d(*node.point, *node.prev->point, *node.prev->prev->point) == CW) {
- // Concave
- FillLeftConcaveEdgeEvent(tcx, edge, node);
- } else {
- // Convex
- FillLeftConvexEdgeEvent(tcx, edge, node);
- // Retry this one
- FillLeftBelowEdgeEvent(tcx, edge, node);
- }
- }
-}
-
-void Sweep::FillLeftConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
-{
- // Next concave or convex?
- if (Orient2d(*node.prev->point, *node.prev->prev->point, *node.prev->prev->prev->point) == CW) {
- // Concave
- FillLeftConcaveEdgeEvent(tcx, edge, *node.prev);
- } else{
- // Convex
- // Next above or below edge?
- if (Orient2d(*edge->q, *node.prev->prev->point, *edge->p) == CW) {
- // Below
- FillLeftConvexEdgeEvent(tcx, edge, *node.prev);
- } else{
- // Above
- }
- }
-}
-
-void Sweep::FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node)
-{
- Fill(tcx, *node.prev);
- if (node.prev->point != edge->p) {
- // Next above or below edge?
- if (Orient2d(*edge->q, *node.prev->point, *edge->p) == CW) {
- // Below
- if (Orient2d(*node.point, *node.prev->point, *node.prev->prev->point) == CW) {
- // Next is concave
- FillLeftConcaveEdgeEvent(tcx, edge, node);
- } else{
- // Next is convex
- }
- }
- }
-
-}
-
-void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p)
-{
- Triangle& ot = t->NeighborAcross(p);
- Point& op = *ot.OppositePoint(*t, p);
-
- if (&ot == NULL) {
- // If we want to integrate the fillEdgeEvent do it here
- // With current implementation we should never get here
- //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
- assert(0);
- }
-
- if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) {
- // Lets rotate shared edge one vertex CW
- RotateTrianglePair(*t, p, ot, op);
- tcx.MapTriangleToNodes(*t);
- tcx.MapTriangleToNodes(ot);
-
- if (p == eq && op == ep) {
- if (eq == *tcx.edge_event.constrained_edge->q && ep == *tcx.edge_event.constrained_edge->p) {
- t->MarkConstrainedEdge(&ep, &eq);
- ot.MarkConstrainedEdge(&ep, &eq);
- Legalize(tcx, *t);
- Legalize(tcx, ot);
- } else {
- // XXX: I think one of the triangles should be legalized here?
- }
- } else {
- Orientation o = Orient2d(eq, op, ep);
- t = &NextFlipTriangle(tcx, (int)o, *t, ot, p, op);
- FlipEdgeEvent(tcx, ep, eq, t, p);
- }
- } else {
- Point& newP = NextFlipPoint(ep, eq, ot, op);
- FlipScanEdgeEvent(tcx, ep, eq, *t, ot, newP);
- EdgeEvent(tcx, ep, eq, t, p);
- }
-}
-
-Triangle& Sweep::NextFlipTriangle(SweepContext& tcx, int o, Triangle& t, Triangle& ot, Point& p, Point& op)
-{
- if (o == CCW) {
- // ot is not crossing edge after flip
- int edge_index = ot.EdgeIndex(&p, &op);
- ot.delaunay_edge[edge_index] = true;
- Legalize(tcx, ot);
- ot.ClearDelunayEdges();
- return t;
- }
-
- // t is not crossing edge after flip
- int edge_index = t.EdgeIndex(&p, &op);
-
- t.delaunay_edge[edge_index] = true;
- Legalize(tcx, t);
- t.ClearDelunayEdges();
- return ot;
-}
-
-Point& Sweep::NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op)
-{
- Orientation o2d = Orient2d(eq, op, ep);
- if (o2d == CW) {
- // Right
- return *ot.PointCCW(op);
- } else if (o2d == CCW) {
- // Left
- return *ot.PointCW(op);
- } else{
- //throw new RuntimeException("[Unsupported] Opposing point on constrained edge");
- assert(0);
- }
-}
-
-void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& flip_triangle,
- Triangle& t, Point& p)
-{
- Triangle& ot = t.NeighborAcross(p);
- Point& op = *ot.OppositePoint(t, p);
-
- if (&t.NeighborAcross(p) == NULL) {
- // If we want to integrate the fillEdgeEvent do it here
- // With current implementation we should never get here
- //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
- assert(0);
- }
-
- if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) {
- // flip with new edge op->eq
- FlipEdgeEvent(tcx, eq, op, &ot, op);
- // TODO: Actually I just figured out that it should be possible to
- // improve this by getting the next ot and op before the above
- // flip and continue the flipScanEdgeEvent here
- // set new ot and op here and loop back to inScanArea test
- // also need to set a new flip_triangle first
- // Turns out at first glance that this is somewhat complicated
- // so it will have to wait.
- } else{
- Point& newP = NextFlipPoint(ep, eq, ot, op);
- FlipScanEdgeEvent(tcx, ep, eq, flip_triangle, ot, newP);
- }
-}
-
-Sweep::~Sweep() {
-
- // Clean up memory
- for (size_t i = 0; i < nodes_.size(); i++) {
- delete nodes_[i];
- }
-
-}
-
-}
-
diff --git a/src/3rdparty/poly2tri/sweep/sweep.h b/src/3rdparty/poly2tri/sweep/sweep.h
deleted file mode 100644
index 9bb0b5d8..00000000
--- a/src/3rdparty/poly2tri/sweep/sweep.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-/**
- * Sweep-line, Constrained Delauney Triangulation (CDT) See: Domiter, V. and
- * Zalik, B.(2008)'Sweep-line algorithm for constrained Delaunay triangulation',
- * International Journal of Geographical Information Science
- *
- * "FlipScan" Constrained Edge Algorithm invented by Thomas Åhlén, thahlen@gmail.com
- */
-
-#ifndef SWEEP_H
-#define SWEEP_H
-
-#include <vector>
-
-namespace p2t {
-
-class SweepContext;
-struct Node;
-struct Point;
-struct Edge;
-class Triangle;
-
-class Sweep
-{
-public:
-
- /**
- * Triangulate
- *
- * @param tcx
- */
- void Triangulate(SweepContext& tcx);
-
- /**
- * Destructor - clean up memory
- */
- ~Sweep();
-
-private:
-
- /**
- * Start sweeping the Y-sorted point set from bottom to top
- *
- * @param tcx
- */
- void SweepPoints(SweepContext& tcx);
-
- /**
- * Find closes node to the left of the new point and
- * create a new triangle. If needed new holes and basins
- * will be filled to.
- *
- * @param tcx
- * @param point
- * @return
- */
- Node& PointEvent(SweepContext& tcx, Point& point);
-
- /**
- *
- *
- * @param tcx
- * @param edge
- * @param node
- */
- void EdgeEvent(SweepContext& tcx, Edge* edge, Node* node);
-
- void EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point);
-
- /**
- * Creates a new front triangle and legalize it
- *
- * @param tcx
- * @param point
- * @param node
- * @return
- */
- Node& NewFrontTriangle(SweepContext& tcx, Point& point, Node& node);
-
- /**
- * Adds a triangle to the advancing front to fill a hole.
- * @param tcx
- * @param node - middle node, that is the bottom of the hole
- */
- void Fill(SweepContext& tcx, Node& node);
-
- /**
- * Returns true if triangle was legalized
- */
- bool Legalize(SweepContext& tcx, Triangle& t);
-
- /**
- * <b>Requirement</b>:<br>
- * 1. a,b and c form a triangle.<br>
- * 2. a and d is know to be on opposite side of bc<br>
- * <pre>
- * a
- * +
- * / \
- * / \
- * b/ \c
- * +-------+
- * / d \
- * / \
- * </pre>
- * <b>Fact</b>: d has to be in area B to have a chance to be inside the circle formed by
- * a,b and c<br>
- * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW<br>
- * This preknowledge gives us a way to optimize the incircle test
- * @param a - triangle point, opposite d
- * @param b - triangle point
- * @param c - triangle point
- * @param d - point opposite a
- * @return true if d is inside circle, false if on circle edge
- */
- bool Incircle(Point& pa, Point& pb, Point& pc, Point& pd);
-
- /**
- * Rotates a triangle pair one vertex CW
- *<pre>
- * n2 n2
- * P +-----+ P +-----+
- * | t /| |\ t |
- * | / | | \ |
- * n1| / |n3 n1| \ |n3
- * | / | after CW | \ |
- * |/ oT | | oT \|
- * +-----+ oP +-----+
- * n4 n4
- * </pre>
- */
- void RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op);
-
- /**
- * Fills holes in the Advancing Front
- *
- *
- * @param tcx
- * @param n
- */
- void FillAdvancingFront(SweepContext& tcx, Node& n);
-
- // Decision-making about when to Fill hole.
- // Contributed by ToolmakerSteve2
- bool LargeHole_DontFill(Node* node);
- bool AngleExceeds90Degrees(Point* origin, Point* pa, Point* pb);
- bool AngleExceedsPlus90DegreesOrIsNegative(Point* origin, Point* pa, Point* pb);
- double Angle(Point& origin, Point& pa, Point& pb);
-
- /**
- *
- * @param node - middle node
- * @return the angle between 3 front nodes
- */
- double HoleAngle(Node& node);
-
- /**
- * The basin angle is decided against the horizontal line [1,0]
- */
- double BasinAngle(Node& node);
-
- /**
- * Fills a basin that has formed on the Advancing Front to the right
- * of given node.<br>
- * First we decide a left,bottom and right node that forms the
- * boundaries of the basin. Then we do a reqursive fill.
- *
- * @param tcx
- * @param node - starting node, this or next node will be left node
- */
- void FillBasin(SweepContext& tcx, Node& node);
-
- /**
- * Recursive algorithm to fill a Basin with triangles
- *
- * @param tcx
- * @param node - bottom_node
- * @param cnt - counter used to alternate on even and odd numbers
- */
- void FillBasinReq(SweepContext& tcx, Node* node);
-
- bool IsShallow(SweepContext& tcx, Node& node);
-
- bool IsEdgeSideOfTriangle(Triangle& triangle, Point& ep, Point& eq);
-
- void FillEdgeEvent(SweepContext& tcx, Edge* edge, Node* node);
-
- void FillRightAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node);
-
- void FillRightBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node);
-
- void FillRightConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node);
-
- void FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node);
-
- void FillLeftAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node);
-
- void FillLeftBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node);
-
- void FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node);
-
- void FillLeftConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node);
-
- void FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p);
-
- /**
- * After a flip we have two triangles and know that only one will still be
- * intersecting the edge. So decide which to contiune with and legalize the other
- *
- * @param tcx
- * @param o - should be the result of an orient2d( eq, op, ep )
- * @param t - triangle 1
- * @param ot - triangle 2
- * @param p - a point shared by both triangles
- * @param op - another point shared by both triangles
- * @return returns the triangle still intersecting the edge
- */
- Triangle& NextFlipTriangle(SweepContext& tcx, int o, Triangle& t, Triangle& ot, Point& p, Point& op);
-
- /**
- * When we need to traverse from one triangle to the next we need
- * the point in current triangle that is the opposite point to the next
- * triangle.
- *
- * @param ep
- * @param eq
- * @param ot
- * @param op
- * @return
- */
- Point& NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op);
-
- /**
- * Scan part of the FlipScan algorithm<br>
- * When a triangle pair isn't flippable we will scan for the next
- * point that is inside the flip triangle scan area. When found
- * we generate a new flipEdgeEvent
- *
- * @param tcx
- * @param ep - last point on the edge we are traversing
- * @param eq - first point on the edge we are traversing
- * @param flipTriangle - the current triangle sharing the point eq with edge
- * @param t
- * @param p
- */
- void FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& flip_triangle, Triangle& t, Point& p);
-
- void FinalizationPolygon(SweepContext& tcx);
-
- std::vector<Node*> nodes_;
-
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/poly2tri/sweep/sweep_context.cpp b/src/3rdparty/poly2tri/sweep/sweep_context.cpp
deleted file mode 100644
index 24dde11f..00000000
--- a/src/3rdparty/poly2tri/sweep/sweep_context.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-#include "sweep_context.h"
-#include <algorithm>
-#include "advancing_front.h"
-
-namespace p2t {
-
-SweepContext::SweepContext(std::vector<Point*> polyline) :
- front_(0),
- head_(0),
- tail_(0),
- af_head_(0),
- af_middle_(0),
- af_tail_(0)
-{
- basin = Basin();
- edge_event = EdgeEvent();
-
- points_ = polyline;
-
- InitEdges(points_);
-}
-
-void SweepContext::AddHole(std::vector<Point*> polyline)
-{
- InitEdges(polyline);
- for (unsigned int i = 0; i < polyline.size(); i++) {
- points_.push_back(polyline[i]);
- }
-}
-
-void SweepContext::AddPoint(Point* point) {
- points_.push_back(point);
-}
-
-std::vector<Triangle*> SweepContext::GetTriangles()
-{
- return triangles_;
-}
-
-std::list<Triangle*> SweepContext::GetMap()
-{
- return map_;
-}
-
-void SweepContext::InitTriangulation()
-{
- double xmax(points_[0]->x), xmin(points_[0]->x);
- double ymax(points_[0]->y), ymin(points_[0]->y);
-
- // Calculate bounds.
- for (unsigned int i = 0; i < points_.size(); i++) {
- Point& p = *points_[i];
- if (p.x > xmax)
- xmax = p.x;
- if (p.x < xmin)
- xmin = p.x;
- if (p.y > ymax)
- ymax = p.y;
- if (p.y < ymin)
- ymin = p.y;
- }
-
- double dx = kAlpha * (xmax - xmin);
- double dy = kAlpha * (ymax - ymin);
- head_ = new Point(xmax + dx, ymin - dy);
- tail_ = new Point(xmin - dx, ymin - dy);
-
- // Sort points along y-axis
- std::sort(points_.begin(), points_.end(), cmp);
-
-}
-
-void SweepContext::InitEdges(std::vector<Point*> polyline)
-{
- int num_points = polyline.size();
- for (int i = 0; i < num_points; i++) {
- int j = i < num_points - 1 ? i + 1 : 0;
- edge_list.push_back(new Edge(*polyline[i], *polyline[j]));
- }
-}
-
-Point* SweepContext::GetPoint(const int& index)
-{
- return points_[index];
-}
-
-void SweepContext::AddToMap(Triangle* triangle)
-{
- map_.push_back(triangle);
-}
-
-Node& SweepContext::LocateNode(Point& point)
-{
- // TODO implement search tree
- return *front_->LocateNode(point.x);
-}
-
-void SweepContext::CreateAdvancingFront(std::vector<Node*> nodes)
-{
-
- (void) nodes;
- // Initial triangle
- Triangle* triangle = new Triangle(*points_[0], *tail_, *head_);
-
- map_.push_back(triangle);
-
- af_head_ = new Node(*triangle->GetPoint(1), *triangle);
- af_middle_ = new Node(*triangle->GetPoint(0), *triangle);
- af_tail_ = new Node(*triangle->GetPoint(2));
- front_ = new AdvancingFront(*af_head_, *af_tail_);
-
- // TODO: More intuitive if head is middles next and not previous?
- // so swap head and tail
- af_head_->next = af_middle_;
- af_middle_->next = af_tail_;
- af_middle_->prev = af_head_;
- af_tail_->prev = af_middle_;
-}
-
-void SweepContext::RemoveNode(Node* node)
-{
- delete node;
-}
-
-void SweepContext::MapTriangleToNodes(Triangle& t)
-{
- for (int i = 0; i < 3; i++) {
- if (!t.GetNeighbor(i)) {
- Node* n = front_->LocatePoint(t.PointCW(*t.GetPoint(i)));
- if (n)
- n->triangle = &t;
- }
- }
-}
-
-void SweepContext::RemoveFromMap(Triangle* triangle)
-{
- map_.remove(triangle);
-}
-
-void SweepContext::MeshClean(Triangle& triangle)
-{
- std::vector<Triangle *> triangles;
- triangles.push_back(&triangle);
-
- while(!triangles.empty()){
- Triangle *t = triangles.back();
- triangles.pop_back();
-
- if (t != NULL && !t->IsInterior()) {
- t->IsInterior(true);
- triangles_.push_back(t);
- for (int i = 0; i < 3; i++) {
- if (!t->constrained_edge[i])
- triangles.push_back(t->GetNeighbor(i));
- }
- }
- }
-}
-
-SweepContext::~SweepContext()
-{
-
- // Clean up memory
-
- delete head_;
- delete tail_;
- delete front_;
- delete af_head_;
- delete af_middle_;
- delete af_tail_;
-
- typedef std::list<Triangle*> type_list;
-
- for (type_list::iterator iter = map_.begin(); iter != map_.end(); ++iter) {
- Triangle* ptr = *iter;
- delete ptr;
- }
-
- for (unsigned int i = 0; i < edge_list.size(); i++) {
- delete edge_list[i];
- }
-
-}
-
-}
diff --git a/src/3rdparty/poly2tri/sweep/sweep_context.h b/src/3rdparty/poly2tri/sweep/sweep_context.h
deleted file mode 100644
index c110a744..00000000
--- a/src/3rdparty/poly2tri/sweep/sweep_context.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
- * http://code.google.com/p/poly2tri/
- *
- * All rights reserved.
- *
- * 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 Poly2Tri 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.
- */
-
-#ifndef SWEEP_CONTEXT_H
-#define SWEEP_CONTEXT_H
-
-#include <list>
-#include <vector>
-#include <cstddef>
-
-namespace p2t {
-
-// Initial triangle factor, seed triangle will extend 30% of
-// PointSet width to both left and right.
-const double kAlpha = 0.3;
-
-struct Point;
-class Triangle;
-struct Node;
-struct Edge;
-class AdvancingFront;
-
-class SweepContext {
-public:
-
-/// Constructor
-SweepContext(std::vector<Point*> polyline);
-/// Destructor
-~SweepContext();
-
-void set_head(Point* p1);
-
-Point* head();
-
-void set_tail(Point* p1);
-
-Point* tail();
-
-int point_count();
-
-Node& LocateNode(Point& point);
-
-void RemoveNode(Node* node);
-
-void CreateAdvancingFront(std::vector<Node*> nodes);
-
-/// Try to map a node to all sides of this triangle that don't have a neighbor
-void MapTriangleToNodes(Triangle& t);
-
-void AddToMap(Triangle* triangle);
-
-Point* GetPoint(const int& index);
-
-Point* GetPoints();
-
-void RemoveFromMap(Triangle* triangle);
-
-void AddHole(std::vector<Point*> polyline);
-
-void AddPoint(Point* point);
-
-AdvancingFront* front();
-
-void MeshClean(Triangle& triangle);
-
-std::vector<Triangle*> GetTriangles();
-std::list<Triangle*> GetMap();
-
-std::vector<Edge*> edge_list;
-
-struct Basin {
- Node* left_node;
- Node* bottom_node;
- Node* right_node;
- double width;
- bool left_highest;
-
- Basin() : left_node(NULL), bottom_node(NULL), right_node(NULL), width(0.0), left_highest(false)
- {
- }
-
- void Clear()
- {
- left_node = NULL;
- bottom_node = NULL;
- right_node = NULL;
- width = 0.0;
- left_highest = false;
- }
-};
-
-struct EdgeEvent {
- Edge* constrained_edge;
- bool right;
-
- EdgeEvent() : constrained_edge(NULL), right(false)
- {
- }
-};
-
-Basin basin;
-EdgeEvent edge_event;
-
-private:
-
-friend class Sweep;
-
-std::vector<Triangle*> triangles_;
-std::list<Triangle*> map_;
-std::vector<Point*> points_;
-
-// Advancing front
-AdvancingFront* front_;
-// head point used with advancing front
-Point* head_;
-// tail point used with advancing front
-Point* tail_;
-
-Node *af_head_, *af_middle_, *af_tail_;
-
-void InitTriangulation();
-void InitEdges(std::vector<Point*> polyline);
-
-};
-
-inline AdvancingFront* SweepContext::front()
-{
- return front_;
-}
-
-inline int SweepContext::point_count()
-{
- return int(points_.size());
-}
-
-inline void SweepContext::set_head(Point* p1)
-{
- head_ = p1;
-}
-
-inline Point* SweepContext::head()
-{
- return head_;
-}
-
-inline void SweepContext::set_tail(Point* p1)
-{
- tail_ = p1;
-}
-
-inline Point* SweepContext::tail()
-{
- return tail_;
-}
-
-}
-
-#endif
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5e115c2c..d8516848 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,10 +1,4 @@
# special case begin
-add_subdirectory(3rdparty/clip2tri)
-add_subdirectory(3rdparty/poly2tri)
-add_subdirectory(3rdparty/clipper)
-add_subdirectory(positioning)
-add_subdirectory(plugins)
-if(TARGET Qt::Quick)
- add_subdirectory(positioningquick)
-endif()
+#add_subdirectory(location)
+#add_subdirectory(plugins)
# special case end
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index bf9732ab..36532ae7 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -1,9 +1,5 @@
# Generated from plugins.pro.
-if(TARGET Qt::Positioning)
- add_subdirectory(position)
+if(TARGET Qt::Location)
+ add_subdirectory(geoservices)
endif()
-# TODO: enable location plugins later!
-# if(TARGET Qt::Location)
-# add_subdirectory(geoservices)
-# endif()
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 35b462d4..c27440f0 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,3 +1,2 @@
TEMPLATE = subdirs
-qtHaveModule(positioning): SUBDIRS += position
qtHaveModule(location): SUBDIRS += geoservices
diff --git a/src/plugins/position/CMakeLists.txt b/src/plugins/position/CMakeLists.txt
deleted file mode 100644
index ceb4fe27..00000000
--- a/src/plugins/position/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from position.pro.
-
-add_subdirectory(positionpoll)
-if(FREEBSD OR LINUX OR OPENBSD OR (NETBSD AND TARGET Qt::DBus))
- add_subdirectory(geoclue2)
-endif()
-if(QT_FEATURE_gypsy)
- add_subdirectory(gypsy)
-endif()
-if(QT_FEATURE_winrt_geolocation)
- add_subdirectory(winrt)
-endif()
-if(IOS OR MACOS OR TVOS)
- add_subdirectory(corelocation)
-endif()
-if(ANDROID)
- add_subdirectory(android)
-endif()
-if(TARGET Qt::SerialPort AND TARGET Qt::Network)
- add_subdirectory(nmea)
-endif()
diff --git a/src/plugins/position/android/CMakeLists.txt b/src/plugins/position/android/CMakeLists.txt
deleted file mode 100644
index 22fe2b6b..00000000
--- a/src/plugins/position/android/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from android.pro.
-
-add_subdirectory(jar)
-add_subdirectory(src)
diff --git a/src/plugins/position/android/android.pro b/src/plugins/position/android/android.pro
deleted file mode 100644
index 0dc6a3fc..00000000
--- a/src/plugins/position/android/android.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += jar src
diff --git a/src/plugins/position/android/jar/AndroidManifest.xml b/src/plugins/position/android/jar/AndroidManifest.xml
deleted file mode 100644
index 2e847fd1..00000000
--- a/src/plugins/position/android/jar/AndroidManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.qtproject.qt.android.positioning"
- android:versionCode="1"
- android:versionName="1.0" >
- <supports-screens android:smallScreens="true" android:largeScreens="true" android:anyDensity="true" android:normalScreens="true"/>
-</manifest>
diff --git a/src/plugins/position/android/jar/CMakeLists.txt b/src/plugins/position/android/jar/CMakeLists.txt
deleted file mode 100644
index 8eadc79c..00000000
--- a/src/plugins/position/android/jar/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated from jar.pro.
-
-set(java_sources
- src/org/qtproject/qt/android/positioning/QtPositioning.java # special case
-)
-
-qt_internal_add_jar(Qt${QtLocation_VERSION_MAJOR}AndroidPositioning # special case
- INCLUDE_JARS ${QT_ANDROID_JAR}
- SOURCES ${java_sources}
- OUTPUT_DIR "${QT_BUILD_DIR}/jar"
-)
-
-install_jar(Qt${QtLocation_VERSION_MAJOR}AndroidPositioning # special case
- DESTINATION jar
- COMPONENT Devel
-)
-
diff --git a/src/plugins/position/android/jar/jar.pro b/src/plugins/position/android/jar/jar.pro
deleted file mode 100644
index fae1f855..00000000
--- a/src/plugins/position/android/jar/jar.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = Qt$${QT_MAJOR_VERSION}AndroidPositioning
-
-load(qt_build_paths)
-
-CONFIG += java
-DESTDIR = $$MODULE_BASE_OUTDIR/jar
-
-JAVACLASSPATH += $$PWD/src
-
-JAVASOURCES += \
- $$PWD/src/org/qtproject/qt/android/positioning/QtPositioning.java
-
-# install
-target.path = $$[QT_INSTALL_PREFIX]/jar
-INSTALLS += target
-
diff --git a/src/plugins/position/android/jar/src/org/qtproject/qt/android/positioning/QtPositioning.java b/src/plugins/position/android/jar/src/org/qtproject/qt/android/positioning/QtPositioning.java
deleted file mode 100644
index 18ef40a2..00000000
--- a/src/plugins/position/android/jar/src/org/qtproject/qt/android/positioning/QtPositioning.java
+++ /dev/null
@@ -1,658 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation 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$
-**
-****************************************************************************/
-
-package org.qtproject.qt.android.positioning;
-
-import android.content.Context;
-import android.location.GpsSatellite;
-import android.location.GpsStatus;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.location.GnssStatus;
-import android.location.GnssStatus.Callback;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Build;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import android.util.Log;
-
-public class QtPositioning implements LocationListener
-{
-
- private static final String TAG = "qt.positioning.android";
- static LocationManager locationManager = null;
- static Object m_syncObject = new Object();
- static HashMap<Integer, QtPositioning> runningListeners = new HashMap<Integer, QtPositioning>();
-
- /*
- The positionInfo instance to which this
- QtPositioning instance is attached to.
- */
- private int nativeClassReference = 0;
-
- /*
- The provider type requested by Qt
- */
- private int expectedProviders = 0;
-
- public static final int QT_GPS_PROVIDER = 1;
- public static final int QT_NETWORK_PROVIDER = 2;
-
- /* The following values must match the corresponding error enums in the Qt API*/
- public static final int QT_ACCESS_ERROR = 0;
- public static final int QT_CLOSED_ERROR = 1;
- public static final int QT_POSITION_UNKNOWN_SOURCE_ERROR = 2;
- public static final int QT_POSITION_NO_ERROR = 3;
- public static final int QT_SATELLITE_NO_ERROR = 2;
- public static final int QT_SATELLITE_UNKNOWN_SOURCE_ERROR = -1;
-
- /* True, if updates were caused by requestUpdate() */
- private boolean isSingleUpdate = false;
- /* The length requested for regular intervals in msec. */
- private int updateIntervalTime = 0;
-
- /* The last received GPS update */
- private Location lastGps = null;
- /* The last received network update */
- private Location lastNetwork = null;
- /* If true this class acts as satellite signal monitor rather than location monitor */
- private boolean isSatelliteUpdate = false;
-
- private PositioningLooperBase looperThread;
-
- private boolean isLocationProvidersDisabledInvoked = false;
-
- static public void setContext(Context context)
- {
- try {
- locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- static private int[] providerList()
- {
- if (locationManager == null) {
- Log.w(TAG, "No locationManager available in QtPositioning");
- return new int[0];
- }
- List<String> providers = locationManager.getProviders(true);
- int retList[] = new int[providers.size()];
- for (int i = 0; i < providers.size(); i++) {
- if (providers.get(i).equals(LocationManager.GPS_PROVIDER)) {
- //must be in sync with AndroidPositioning::PositionProvider::PROVIDER_GPS
- retList[i] = 0;
- } else if (providers.get(i).equals(LocationManager.NETWORK_PROVIDER)) {
- //must be in sync with AndroidPositioning::PositionProvider::PROVIDER_NETWORK
- retList[i] = 1;
- } else if (providers.get(i).equals(LocationManager.PASSIVE_PROVIDER)) {
- //must be in sync with AndroidPositioning::PositionProvider::PROVIDER_PASSIVE
- retList[i] = 2;
- } else {
- retList[i] = -1;
- }
- }
- return retList;
- }
-
- static public Location lastKnownPosition(boolean fromSatelliteOnly)
- {
- Location gps = null;
- Location network = null;
- try {
- gps = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
- if (!fromSatelliteOnly)
- network = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- } catch(Exception e) {
- e.printStackTrace();
- gps = network = null;
- }
-
- if (gps != null && network != null) {
- //we return the most recent location but slightly prefer GPS
- //prefer GPS if it is max 4 hrs older than network
- long delta = network.getTime() - gps.getTime();
- if (delta < 4*60*60*1000) {
- return gps;
- } else {
- return network;
- }
- } else if (gps != null ) {
- return gps;
- } else if (network != null) {
- return network;
- }
-
- return null;
- }
-
- /* Returns true if at least on of the given providers is enabled. */
- static private boolean expectedProvidersAvailable(int desiredProviders)
- {
- List<String> enabledProviders = locationManager.getProviders(true);
- if ((desiredProviders & QT_GPS_PROVIDER) > 0) { //gps desired
- if (enabledProviders.contains(LocationManager.GPS_PROVIDER)) {
- return true;
- }
- }
- if ((desiredProviders & QT_NETWORK_PROVIDER) > 0) { //network desired
- if (enabledProviders.contains(LocationManager.NETWORK_PROVIDER)) {
- return true;
- }
- }
-
- return false;
- }
-
-
- static private void addActiveListener(QtPositioning listener, String provider)
- {
- int androidClassKey = listener.nativeClassReference;
- //start update thread
- listener.setActiveLooper(true);
-
- if (runningListeners.containsKey(androidClassKey) && runningListeners.get(androidClassKey) != listener) {
- removeActiveListener(androidClassKey);
- }
-
- locationManager.requestSingleUpdate(provider,
- listener,
- listener.looper());
-
- runningListeners.put(androidClassKey, listener);
- }
-
-
- static private void addActiveListener(QtPositioning listener, String provider, long minTime, float minDistance)
- {
- int androidClassKey = listener.nativeClassReference;
- //start update thread
- listener.setActiveLooper(true);
-
- if (runningListeners.containsKey(androidClassKey) && runningListeners.get(androidClassKey) != listener) {
- removeActiveListener(androidClassKey);
- }
-
- locationManager.requestLocationUpdates(provider,
- minTime, minDistance,
- listener,
- listener.looper());
-
- runningListeners.put(androidClassKey, listener);
- }
-
-
- static private void removeActiveListener(QtPositioning listener)
- {
- removeActiveListener(listener.nativeClassReference);
- }
-
-
- static private void removeActiveListener(int androidClassKey)
- {
- QtPositioning listener = runningListeners.remove(androidClassKey);
-
- if (listener != null) {
- locationManager.removeUpdates(listener);
- listener.setActiveLooper(false);
- }
- }
-
-
- static public int startUpdates(int androidClassKey, int locationProvider, int updateInterval)
- {
- synchronized (m_syncObject) {
- try {
- boolean exceptionOccurred = false;
- QtPositioning positioningListener = new QtPositioning();
- positioningListener.nativeClassReference = androidClassKey;
- positioningListener.expectedProviders = locationProvider;
- positioningListener.isSatelliteUpdate = false;
-
- if (updateInterval == 0)
- updateInterval = 50; //don't update more often than once per 50ms
-
- positioningListener.updateIntervalTime = updateInterval;
- if ((locationProvider & QT_GPS_PROVIDER) > 0) {
- Log.d(TAG, "Regular updates using GPS " + updateInterval);
- try {
- addActiveListener(positioningListener,
- LocationManager.GPS_PROVIDER,
- updateInterval, 0);
- } catch (SecurityException se) {
- se.printStackTrace();
- exceptionOccurred = true;
- }
- }
-
- if ((locationProvider & QT_NETWORK_PROVIDER) > 0) {
- Log.d(TAG, "Regular updates using network " + updateInterval);
- try {
- addActiveListener(positioningListener,
- LocationManager.NETWORK_PROVIDER,
- updateInterval, 0);
- } catch (SecurityException se) {
- se.printStackTrace();
- exceptionOccurred = true;
- }
- }
- if (exceptionOccurred) {
- removeActiveListener(positioningListener);
- return QT_ACCESS_ERROR;
- }
-
- if (!expectedProvidersAvailable(locationProvider)) {
- //all location providers unavailbe -> when they come back we resume automatically
- return QT_CLOSED_ERROR;
- }
-
- } catch(Exception e) {
- e.printStackTrace();
- return QT_POSITION_UNKNOWN_SOURCE_ERROR;
- }
-
- return QT_POSITION_NO_ERROR;
- }
- }
-
- static public void stopUpdates(int androidClassKey)
- {
- synchronized (m_syncObject) {
- try {
- Log.d(TAG, "Stopping updates");
- removeActiveListener(androidClassKey);
- } catch(Exception e) {
- e.printStackTrace();
- return;
- }
- }
- }
-
- static public int requestUpdate(int androidClassKey, int locationProvider)
- {
- synchronized (m_syncObject) {
- try {
- boolean exceptionOccurred = false;
- QtPositioning positioningListener = new QtPositioning();
- positioningListener.nativeClassReference = androidClassKey;
- positioningListener.isSingleUpdate = true;
- positioningListener.expectedProviders = locationProvider;
- positioningListener.isSatelliteUpdate = false;
-
- if ((locationProvider & QT_GPS_PROVIDER) > 0) {
- Log.d(TAG, "Single update using GPS");
- try {
- addActiveListener(positioningListener, LocationManager.GPS_PROVIDER);
- } catch (SecurityException se) {
- se.printStackTrace();
- exceptionOccurred = true;
- }
- }
-
- if ((locationProvider & QT_NETWORK_PROVIDER) > 0) {
- Log.d(TAG, "Single update using network");
- try {
- addActiveListener(positioningListener, LocationManager.NETWORK_PROVIDER);
- } catch (SecurityException se) {
- se.printStackTrace();
- exceptionOccurred = true;
- }
- }
- if (exceptionOccurred) {
- removeActiveListener(positioningListener);
- return QT_ACCESS_ERROR;
- }
-
- if (!expectedProvidersAvailable(locationProvider)) {
- //all location providers unavailable -> when they come back we resume automatically
- //in the mean time return ClosedError
- return QT_CLOSED_ERROR;
- }
-
- } catch(Exception e) {
- e.printStackTrace();
- return QT_POSITION_UNKNOWN_SOURCE_ERROR;
- }
-
- return QT_POSITION_NO_ERROR;
- }
- }
-
- static public int startSatelliteUpdates(int androidClassKey, int updateInterval, boolean isSingleRequest)
- {
- synchronized (m_syncObject) {
- try {
- boolean exceptionOccurred = false;
- QtPositioning positioningListener = new QtPositioning();
- positioningListener.isSatelliteUpdate = true;
- positioningListener.nativeClassReference = androidClassKey;
- positioningListener.expectedProviders = 1; //always satellite provider
- positioningListener.isSingleUpdate = isSingleRequest;
-
- if (updateInterval == 0)
- updateInterval = 50; //don't update more often than once per 50ms
-
- if (isSingleRequest)
- Log.d(TAG, "Single update for Satellites " + updateInterval);
- else
- Log.d(TAG, "Regular updates for Satellites " + updateInterval);
- try {
- addActiveListener(positioningListener, LocationManager.GPS_PROVIDER,
- updateInterval, 0);
- } catch (SecurityException se) {
- se.printStackTrace();
- exceptionOccurred = true;
- }
-
- if (exceptionOccurred) {
- removeActiveListener(positioningListener);
- return QT_ACCESS_ERROR;
- }
-
- if (!expectedProvidersAvailable(positioningListener.expectedProviders)) {
- //all location providers unavailable -> when they come back we resume automatically
- //in the mean time return ClosedError
- return QT_CLOSED_ERROR;
- }
-
- } catch(Exception e) {
- e.printStackTrace();
- return QT_SATELLITE_UNKNOWN_SOURCE_ERROR;
- }
-
- return QT_SATELLITE_NO_ERROR;
- }
- }
-
- public QtPositioning()
- {
- // Use GpsStatus for API Level <= 23 (version M and below) and
- // GnssStatus for other API levels.
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M)
- looperThread = new PositioningLooperGps();
- else
- looperThread = new PositioningLooperGnss();
- }
-
- public Looper looper()
- {
- return looperThread.looper();
- }
-
- private void setActiveLooper(boolean setActive)
- {
- try{
- if (setActive) {
- if (looperThread.isAlive())
- return;
-
- if (isSatelliteUpdate)
- looperThread.isSatelliteListener(true);
-
- long start = System.currentTimeMillis();
- looperThread.start();
-
- //busy wait but lasts ~20-30 ms only
- while (!looperThread.isReady());
-
- long stop = System.currentTimeMillis();
- Log.d(TAG, "Looper Thread startup time in ms: " + (stop-start));
- } else {
- looperThread.quitLooper();
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- private abstract class PositioningLooperBase extends Thread
- {
- private boolean looperRunning;
- private Looper posLooper;
- private boolean isSatelliteLooper = false;
-
- abstract protected void addSatelliteInfoListener();
- abstract protected void removeSatelliteInfoListener();
-
- private PositioningLooperBase()
- {
- looperRunning = false;
- }
-
- public void run()
- {
- Looper.prepare();
- Handler handler = new Handler();
-
- if (isSatelliteLooper)
- addSatelliteInfoListener();
-
- posLooper = Looper.myLooper();
- synchronized (this) {
- looperRunning = true;
- }
- Looper.loop();
- synchronized (this) {
- looperRunning = false;
- }
- }
-
- public void quitLooper()
- {
- if (isSatelliteLooper)
- removeSatelliteInfoListener();
- looper().quit();
- }
-
- public synchronized boolean isReady()
- {
- return looperRunning;
- }
-
- public void isSatelliteListener(boolean isListener)
- {
- isSatelliteLooper = isListener;
- }
-
- public Looper looper()
- {
- return posLooper;
- }
-
- }
-
- private class PositioningLooperGps extends PositioningLooperBase implements GpsStatus.Listener
- {
- @Override
- protected void addSatelliteInfoListener()
- {
- try {
- locationManager.addGpsStatusListener(this);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void removeSatelliteInfoListener()
- {
- locationManager.removeGpsStatusListener(this);
- }
-
- @Override
- public void onGpsStatusChanged(int event) {
- switch (event) {
- case GpsStatus.GPS_EVENT_FIRST_FIX:
- break;
- case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
- GpsStatus status = locationManager.getGpsStatus(null);
- Iterable<GpsSatellite> iterable = status.getSatellites();
- Iterator<GpsSatellite> it = iterable.iterator();
-
- ArrayList<GpsSatellite> list = new ArrayList<GpsSatellite>();
- while (it.hasNext()) {
- GpsSatellite sat = (GpsSatellite) it.next();
- list.add(sat);
- }
- GpsSatellite[] sats = list.toArray(new GpsSatellite[list.size()]);
- satelliteGpsUpdated(sats, nativeClassReference, isSingleUpdate);
-
- break;
- case GpsStatus.GPS_EVENT_STARTED:
- break;
- case GpsStatus.GPS_EVENT_STOPPED:
- break;
- }
- }
- }
-
- private class PositioningGnssListener extends GnssStatus.Callback
- {
- @Override
- public void onSatelliteStatusChanged(GnssStatus status)
- {
- satelliteGnssUpdated(status, nativeClassReference, isSingleUpdate);
- }
- }
-
- private class PositioningLooperGnss extends PositioningLooperBase
- {
- private PositioningGnssListener gnssListener;
-
- private PositioningLooperGnss()
- {
- gnssListener = new PositioningGnssListener();
- }
-
- @Override
- protected void addSatelliteInfoListener()
- {
- try {
- locationManager.registerGnssStatusCallback(gnssListener);
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void removeSatelliteInfoListener()
- {
- locationManager.unregisterGnssStatusCallback(gnssListener);
- }
- }
-
- public static native void positionUpdated(Location update, int androidClassKey, boolean isSingleUpdate);
- public static native void locationProvidersDisabled(int androidClassKey);
- public static native void locationProvidersChanged(int androidClassKey);
- public static native void satelliteGpsUpdated(GpsSatellite[] update, int androidClassKey, boolean isSingleUpdate);
- public static native void satelliteGnssUpdated(GnssStatus update, int androidClassKey, boolean isSingleUpdate);
-
- @Override
- public void onLocationChanged(Location location) {
- //Log.d(TAG, "**** Position Update ****: " + location.toString() + " " + isSingleUpdate);
- if (location == null)
- return;
-
- if (isSatelliteUpdate) //we are a QGeoSatelliteInfoSource -> ignore
- return;
-
- if (isSingleUpdate || expectedProviders < 3) {
- positionUpdated(location, nativeClassReference, isSingleUpdate);
- return;
- }
-
- /*
- We can use GPS and Network, pick the better location provider.
- Generally we prefer GPS data due to their higher accurancy but we
- let Network data pass until GPS fix is available
- */
-
- if (location.getProvider().equals(LocationManager.GPS_PROVIDER)) {
- lastGps = location;
-
- // assumption: GPS always better -> pass it on
- positionUpdated(location, nativeClassReference, isSingleUpdate);
- } else if (location.getProvider().equals(LocationManager.NETWORK_PROVIDER)) {
- lastNetwork = location;
-
- if (lastGps == null) { //no GPS fix yet use network location
- positionUpdated(location, nativeClassReference, isSingleUpdate);
- return;
- }
-
- long delta = location.getTime() - lastGps.getTime();
-
- // Ignore if network update is older than last GPS (delta < 0)
- // Ignore if gps update still has time to provide next location (delta < updateInterval)
- if (delta < updateIntervalTime)
- return;
-
- // Use network data -> GPS has timed out on updateInterval
- positionUpdated(location, nativeClassReference, isSingleUpdate);
- }
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {}
-
- @Override
- public void onProviderEnabled(String provider) {
- Log.d(TAG, "Enabled provider: " + provider);
- locationProvidersChanged(nativeClassReference);
- if (isLocationProvidersDisabledInvoked && expectedProvidersAvailable(expectedProviders))
- isLocationProvidersDisabledInvoked = false;
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- Log.d(TAG, "Disabled provider: " + provider);
- locationProvidersChanged(nativeClassReference);
- if (!isLocationProvidersDisabledInvoked && !expectedProvidersAvailable(expectedProviders)) {
- isLocationProvidersDisabledInvoked = true;
- locationProvidersDisabled(nativeClassReference);
- }
- }
-}
diff --git a/src/plugins/position/android/src/CMakeLists.txt b/src/plugins/position/android/src/CMakeLists.txt
deleted file mode 100644
index b91181f4..00000000
--- a/src/plugins/position/android/src/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated from src.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryAndroid Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryAndroidPlugin
- OUTPUT_NAME qtposition_android
- CLASS_NAME QGeoPositionInfoSourceFactoryAndroid
- PLUGIN_TYPE position
- SOURCES
- jnipositioning.cpp jnipositioning.h
- positionfactory_android.cpp positionfactory_android.h
- qgeopositioninfosource_android.cpp qgeopositioninfosource_android_p.h
- qgeosatelliteinfosource_android.cpp qgeosatelliteinfosource_android_p.h
- LIBRARIES
- Qt::Core
- Qt::CorePrivate
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:src.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/position/android/src/jnipositioning.cpp b/src/plugins/position/android/src/jnipositioning.cpp
deleted file mode 100644
index 5f87d08b..00000000
--- a/src/plugins/position/android/src/jnipositioning.cpp
+++ /dev/null
@@ -1,741 +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$
-**
-****************************************************************************/
-
-#include <QDateTime>
-#include <QMap>
-#include <QRandomGenerator>
-#include <QGeoPositionInfo>
-#include <QJniEnvironment>
-#include <QJniObject>
-#include <QtCore/private/qandroidextras_p.h>
-#include <QCoreApplication>
-#include <android/log.h>
-#include "qgeopositioninfosource_android_p.h"
-#include "qgeosatelliteinfosource_android_p.h"
-#include "jnipositioning.h"
-
-class GlobalClassRefWrapper
-{
-public:
- GlobalClassRefWrapper() = default;
- ~GlobalClassRefWrapper()
- {
- if (m_classRef) {
- QJniEnvironment env;
- if (env.jniEnv())
- env->DeleteGlobalRef(m_classRef);
- }
- }
-
- bool init(const char *className)
- {
- QJniEnvironment env;
- if (env.jniEnv()) {
- if (m_classRef) {
- env->DeleteGlobalRef(m_classRef);
- m_classRef = nullptr;
- }
-
- m_classRef = env.findClass(className); // it returns global ref!
- }
- return m_classRef != nullptr;
- }
-
- jclass operator()() { return m_classRef; }
-
-private:
- jclass m_classRef = nullptr;
-};
-
-static GlobalClassRefWrapper positioningClass;
-
-static jmethodID providerListMethodId;
-static jmethodID lastKnownPositionMethodId;
-static jmethodID startUpdatesMethodId;
-static jmethodID stopUpdatesMethodId;
-static jmethodID requestUpdateMethodId;
-static jmethodID startSatelliteUpdatesMethodId;
-
-static const char logTag[] = "qt.positioning.android";
-static const char methodErrorMsg[] = "Can't find method \"%s%s\"";
-
-Q_LOGGING_CATEGORY(lcPositioning, logTag)
-
-namespace {
-
-/*!
- \internal
- This class encapsulates satellite system types, as defined by Android
- GnssStatus API. Initialize during JNI_OnLoad() by the init() method, from
- the Java side, rather than hard-coding.
-*/
-class ConstellationMapper
-{
-public:
- static bool init()
- {
- m_gnssStatusObject = nullptr;
- if (QNativeInterface::QAndroidApplication::sdkVersion() > 23) {
- m_gnssStatusObject = QJniEnvironment().findClass("android/location/GnssStatus");
- if (!m_gnssStatusObject)
- return false;
- }
- // no need to query it for API level <= 23
- return true;
- }
-
- static QGeoSatelliteInfo::SatelliteSystem toSatelliteSystem(int constellationType)
- {
- if (!m_gnssStatusObject)
- return QGeoSatelliteInfo::Undefined;
-
- static const int gps =
- QJniObject::getStaticField<jint>(m_gnssStatusObject, "CONSTELLATION_GPS");
- static const int glonass =
- QJniObject::getStaticField<jint>(m_gnssStatusObject, "CONSTELLATION_GLONASS");
- static const int galileo =
- QJniObject::getStaticField<jint>(m_gnssStatusObject, "CONSTELLATION_GALILEO");
- static const int beidou =
- QJniObject::getStaticField<jint>(m_gnssStatusObject, "CONSTELLATION_BEIDOU");
- static const int qzss =
- QJniObject::getStaticField<jint>(m_gnssStatusObject, "CONSTELLATION_QZSS");
-
- if (constellationType == gps) {
- return QGeoSatelliteInfo::GPS;
- } else if (constellationType == glonass) {
- return QGeoSatelliteInfo::GLONASS;
- } else if (constellationType == galileo) {
- return QGeoSatelliteInfo::GALILEO;
- } else if (constellationType == beidou) {
- return QGeoSatelliteInfo::BEIDOU;
- } else if (constellationType == qzss){
- return QGeoSatelliteInfo::QZSS;
- } else {
- qCWarning(lcPositioning) << "Unknown satellite system" << constellationType;
- return QGeoSatelliteInfo::Undefined;
- }
- }
-
-private:
- static jclass m_gnssStatusObject;
-};
-
-jclass ConstellationMapper::m_gnssStatusObject = nullptr;
-
-} // anonymous namespace
-
-namespace AndroidPositioning {
- typedef QMap<int, QGeoPositionInfoSourceAndroid * > PositionSourceMap;
- typedef QMap<int, QGeoSatelliteInfoSourceAndroid * > SatelliteSourceMap;
-
- Q_GLOBAL_STATIC(PositionSourceMap, idToPosSource)
-
- Q_GLOBAL_STATIC(SatelliteSourceMap, idToSatSource)
-
- int registerPositionInfoSource(QObject *obj)
- {
- int key = -1;
- if (obj->inherits("QGeoPositionInfoSource")) {
- QGeoPositionInfoSourceAndroid *src = qobject_cast<QGeoPositionInfoSourceAndroid *>(obj);
- Q_ASSERT(src);
- do {
- key = qAbs(int(QRandomGenerator::global()->generate()));
- } while (idToPosSource()->contains(key));
-
- idToPosSource()->insert(key, src);
- } else if (obj->inherits("QGeoSatelliteInfoSource")) {
- QGeoSatelliteInfoSourceAndroid *src = qobject_cast<QGeoSatelliteInfoSourceAndroid *>(obj);
- Q_ASSERT(src);
- do {
- key = qAbs(int(QRandomGenerator::global()->generate()));
- } while (idToSatSource()->contains(key));
-
- idToSatSource()->insert(key, src);
- }
-
- return key;
- }
-
- void unregisterPositionInfoSource(int key)
- {
- idToPosSource()->remove(key);
- idToSatSource()->remove(key);
- }
-
- enum PositionProvider
- {
- PROVIDER_GPS = 0,
- PROVIDER_NETWORK = 1,
- PROVIDER_PASSIVE = 2
- };
-
-
- QGeoPositionInfoSource::PositioningMethods availableProviders()
- {
- QGeoPositionInfoSource::PositioningMethods ret = QGeoPositionInfoSource::NoPositioningMethods;
- QJniEnvironment env;
- if (!env.jniEnv())
- return ret;
- QJniObject jniProvidersObj =
- QJniObject::callStaticObjectMethod(positioningClass(), providerListMethodId);
- jintArray jProviders = jniProvidersObj.object<jintArray>();
- jint *providers = env->GetIntArrayElements(jProviders, nullptr);
- const int size = env->GetArrayLength(jProviders);
- for (int i = 0; i < size; i++) {
- switch (providers[i]) {
- case PROVIDER_GPS:
- ret |= QGeoPositionInfoSource::SatellitePositioningMethods;
- break;
- case PROVIDER_NETWORK:
- ret |= QGeoPositionInfoSource::NonSatellitePositioningMethods;
- break;
- case PROVIDER_PASSIVE:
- //we ignore as Qt doesn't have interface for it right now
- break;
- default:
- __android_log_print(ANDROID_LOG_INFO, logTag, "Unknown positioningMethod");
- }
- }
-
- env->ReleaseIntArrayElements(jProviders, providers, 0);
-
- return ret;
- }
-
- QGeoPositionInfo positionInfoFromJavaLocation(const jobject &location)
- {
- QGeoPositionInfo info;
-
- QJniObject jniObject(location);
- if (!jniObject.isValid())
- return QGeoPositionInfo();
-
- const jdouble latitude = jniObject.callMethod<jdouble>("getLatitude");
- const jdouble longitude = jniObject.callMethod<jdouble>("getLongitude");
-
- QGeoCoordinate coordinate(latitude, longitude);
-
- // altitude
- jboolean attributeExists = jniObject.callMethod<jboolean>("hasAltitude");
- if (attributeExists) {
- const jdouble value = jniObject.callMethod<jdouble>("getAltitude");
- if (!qFuzzyIsNull(value))
- coordinate.setAltitude(value);
- }
-
- info.setCoordinate(coordinate);
-
- // time stamp
- const jlong timestamp = jniObject.callMethod<jlong>("getTime");
- info.setTimestamp(QDateTime::fromMSecsSinceEpoch(timestamp, Qt::UTC));
-
- // horizontal accuracy
- attributeExists = jniObject.callMethod<jboolean>("hasAccuracy");
- if (attributeExists) {
- const jfloat accuracy = jniObject.callMethod<jfloat>("getAccuracy");
- if (!qFuzzyIsNull(accuracy))
- info.setAttribute(QGeoPositionInfo::HorizontalAccuracy, qreal(accuracy));
- }
-
- // vertical accuracy
- // The check for method existence happens inside QJniObject. If the
- // method is not found, 0 (or 0.0, or false) is returned, so we do not
- // need to handle it specially.
- attributeExists = jniObject.callMethod<jboolean>("hasVerticalAccuracy");
- if (attributeExists) {
- const jfloat accuracy = jniObject.callMethod<jfloat>("getVerticalAccuracyMeters");
- if (!qFuzzyIsNull(accuracy))
- info.setAttribute(QGeoPositionInfo::VerticalAccuracy, qreal(accuracy));
- }
-
- // ground speed
- attributeExists = jniObject.callMethod<jboolean>("hasSpeed");
- if (attributeExists) {
- const jfloat speed = jniObject.callMethod<jfloat>("getSpeed");
- if (!qFuzzyIsNull(speed))
- info.setAttribute(QGeoPositionInfo::GroundSpeed, qreal(speed));
- }
-
- // bearing
- attributeExists = jniObject.callMethod<jboolean>("hasBearing");
- if (attributeExists) {
- const jfloat bearing = jniObject.callMethod<jfloat>("getBearing");
- if (!qFuzzyIsNull(bearing))
- info.setAttribute(QGeoPositionInfo::Direction, qreal(bearing));
- }
-
- return info;
- }
-
- QList<QGeoSatelliteInfo> satelliteInfoFromJavaLocation(JNIEnv *jniEnv,
- jobjectArray satellites,
- QList<QGeoSatelliteInfo>* usedInFix)
- {
- QList<QGeoSatelliteInfo> sats;
- jsize length = jniEnv->GetArrayLength(satellites);
- for (int i = 0; i<length; i++) {
- jobject element = jniEnv->GetObjectArrayElement(satellites, i);
- if (QJniEnvironment::checkAndClearExceptions(jniEnv)) {
- qCWarning(lcPositioning) << "Cannot process all satellite data due to exception.";
- break;
- }
-
- QJniObject jniObj = QJniObject::fromLocalRef(element);
- if (!jniObj.isValid())
- continue;
-
- QGeoSatelliteInfo info;
-
- // signal strength
- const jfloat snr = jniObj.callMethod<jfloat>("getSnr");
- info.setSignalStrength(int(snr));
-
- // ignore any satellite with no signal whatsoever
- if (qFuzzyIsNull(snr))
- continue;
-
- // prn
- const jint prn = jniObj.callMethod<jint>("getPrn");
- info.setSatelliteIdentifier(prn);
-
- if (prn >= 1 && prn <= 32)
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- else if (prn >= 65 && prn <= 96)
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- else if (prn >= 193 && prn <= 200)
- info.setSatelliteSystem(QGeoSatelliteInfo::QZSS);
- else if ((prn >= 201 && prn <= 235) || (prn >= 401 && prn <= 437))
- info.setSatelliteSystem(QGeoSatelliteInfo::BEIDOU);
- else if (prn >= 301 && prn <= 336)
- info.setSatelliteSystem(QGeoSatelliteInfo::GALILEO);
-
- // azimuth
- const jfloat azimuth = jniObj.callMethod<jfloat>("getAzimuth");
- info.setAttribute(QGeoSatelliteInfo::Azimuth, qreal(azimuth));
-
- // elevation
- const jfloat elevation = jniObj.callMethod<jfloat>("getElevation");
- info.setAttribute(QGeoSatelliteInfo::Elevation, qreal(elevation));
-
- // Used in fix - true if this satellite is actually used in
- // determining the position.
- const jboolean inFix = jniObj.callMethod<jboolean>("usedInFix");
-
- sats.append(info);
-
- if (inFix)
- usedInFix->append(info);
- }
-
- return sats;
- }
-
- QList<QGeoSatelliteInfo> satelliteInfoFromJavaGnssStatus(jobject gnssStatus,
- QList<QGeoSatelliteInfo>* usedInFix)
- {
- QJniObject jniStatus(gnssStatus);
- QList<QGeoSatelliteInfo> sats;
-
- const int satellitesCount = jniStatus.callMethod<jint>("getSatelliteCount");
- for (int i = 0; i < satellitesCount; ++i) {
- QGeoSatelliteInfo info;
-
- // signal strength - this is actually a carrier-to-noise density,
- // but the values are very close to what was previously returned by
- // getSnr() method of the GpsSatellite API.
- const jfloat cn0 = jniStatus.callMethod<jfloat>("getCn0DbHz", "(I)F", i);
- info.setSignalStrength(static_cast<int>(cn0));
-
- // satellite system
- const jint constellationType =
- jniStatus.callMethod<jint>("getConstellationType", "(I)I", i);
- info.setSatelliteSystem(ConstellationMapper::toSatelliteSystem(constellationType));
-
- // satellite identifier
- const jint svId = jniStatus.callMethod<jint>("getSvid", "(I)I", i);
- info.setSatelliteIdentifier(svId);
-
- // azimuth
- const jfloat azimuth = jniStatus.callMethod<jfloat>("getAzimuthDegrees", "(I)F", i);
- info.setAttribute(QGeoSatelliteInfo::Azimuth, static_cast<qreal>(azimuth));
-
- // elevation
- const jfloat elevation = jniStatus.callMethod<jfloat>("getElevationDegrees", "(I)F", i);
- info.setAttribute(QGeoSatelliteInfo::Elevation, static_cast<qreal>(elevation));
-
- // Used in fix - true if this satellite is actually used in
- // determining the position.
- const jboolean inFix = jniStatus.callMethod<jboolean>("usedInFix", "(I)Z", i);
-
- sats.append(info);
-
- if (inFix)
- usedInFix->append(info);
- }
-
- return sats;
- }
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly)
- {
- QJniEnvironment env;
- if (!env.jniEnv())
- return QGeoPositionInfo();
-
- if (!requestionPositioningPermissions())
- return {};
-
- QJniObject locationObj = QJniObject::callStaticObjectMethod(
- positioningClass(), lastKnownPositionMethodId, fromSatellitePositioningMethodsOnly);
- jobject location = locationObj.object();
- if (location == nullptr)
- return QGeoPositionInfo();
-
- const QGeoPositionInfo info = positionInfoFromJavaLocation(location);
-
- return info;
- }
-
- inline int positioningMethodToInt(QGeoPositionInfoSource::PositioningMethods m)
- {
- int providerSelection = 0;
- if (m & QGeoPositionInfoSource::SatellitePositioningMethods)
- providerSelection |= 1;
- if (m & QGeoPositionInfoSource::NonSatellitePositioningMethods)
- providerSelection |= 2;
-
- return providerSelection;
- }
-
- QGeoPositionInfoSource::Error startUpdates(int androidClassKey)
- {
- QJniEnvironment env;
- if (!env.jniEnv())
- return QGeoPositionInfoSource::UnknownSourceError;
-
- QGeoPositionInfoSourceAndroid *source = AndroidPositioning::idToPosSource()->value(androidClassKey);
-
- if (source) {
- if (!requestionPositioningPermissions())
- return QGeoPositionInfoSource::AccessError;
-
- int errorCode = QJniObject::callStaticMethod<jint>(
- positioningClass(), startUpdatesMethodId, androidClassKey,
- positioningMethodToInt(source->preferredPositioningMethods()),
- source->updateInterval());
- switch (errorCode) {
- case 0:
- case 1:
- case 2:
- case 3:
- return static_cast<QGeoPositionInfoSource::Error>(errorCode);
- default:
- break;
- }
- }
-
- return QGeoPositionInfoSource::UnknownSourceError;
- }
-
- //used for stopping regular and single updates
- void stopUpdates(int androidClassKey)
- {
- QJniObject::callStaticMethod<void>(positioningClass(), stopUpdatesMethodId,
- androidClassKey);
- }
-
- QGeoPositionInfoSource::Error requestUpdate(int androidClassKey)
- {
- QJniEnvironment env;
- if (!env.jniEnv())
- return QGeoPositionInfoSource::UnknownSourceError;
-
- QGeoPositionInfoSourceAndroid *source = AndroidPositioning::idToPosSource()->value(androidClassKey);
-
- if (source) {
- if (!requestionPositioningPermissions())
- return QGeoPositionInfoSource::AccessError;
-
- int errorCode = QJniObject::callStaticMethod<jint>(
- positioningClass(), requestUpdateMethodId, androidClassKey,
- positioningMethodToInt(source->preferredPositioningMethods()));
- switch (errorCode) {
- case 0:
- case 1:
- case 2:
- case 3:
- return static_cast<QGeoPositionInfoSource::Error>(errorCode);
- default:
- break;
- }
- }
- return QGeoPositionInfoSource::UnknownSourceError;
- }
-
- QGeoSatelliteInfoSource::Error startSatelliteUpdates(int androidClassKey, bool isSingleRequest, int requestTimeout)
- {
- QJniEnvironment env;
- if (!env.jniEnv())
- return QGeoSatelliteInfoSource::UnknownSourceError;
-
- QGeoSatelliteInfoSourceAndroid *source = AndroidPositioning::idToSatSource()->value(androidClassKey);
-
- if (source) {
- if (!requestionPositioningPermissions())
- return QGeoSatelliteInfoSource::AccessError;
-
- int interval = source->updateInterval();
- if (isSingleRequest)
- interval = requestTimeout;
- int errorCode = QJniObject::callStaticMethod<jint>(positioningClass(),
- startSatelliteUpdatesMethodId,
- androidClassKey, interval,
- isSingleRequest);
- switch (errorCode) {
- case -1:
- case 0:
- case 1:
- case 2:
- return static_cast<QGeoSatelliteInfoSource::Error>(errorCode);
- default:
- qCWarning(lcPositioning)
- << "startSatelliteUpdates: Unknown error code" << errorCode;
- break;
- }
- }
- return QGeoSatelliteInfoSource::UnknownSourceError;
- }
-
- bool requestionPositioningPermissions()
- {
- // If the code is running as a service, we can't request permissions.
- // We can only check if we have the needed permissions. Also make sure
- // to request the background location permissions.
- if (!QNativeInterface::QAndroidApplication::isActivityContext()) {
- const auto permission = QtAndroidPrivate::PreciseBackgroundLocation;
- const auto result = QtAndroidPrivate::checkPermission(permission).result();
- if (result != QtAndroidPrivate::Authorized) {
- qCWarning(lcPositioning)
- << "Position data not available due to missing permission" << permission;
- }
- return result == QtAndroidPrivate::Authorized;
- } else {
- // Running from a normal Activity. Checking and requesting the
- // permissions if necessary.
-
- // Android v23+ requires runtime permission check and requests
- const auto permission = QtAndroidPrivate::PreciseLocation;
- auto checkFuture = QtAndroidPrivate::checkPermission(permission);
- if (checkFuture.result() == QtAndroidPrivate::Denied) {
- auto requestFuture = QtAndroidPrivate::requestPermission(permission);
- if (requestFuture.result() != QtAndroidPrivate::Authorized) {
- qCWarning(lcPositioning)
- << "Position data not available due to missing permission"
- << permission;
- return false;
- }
- }
-
- return true;
- }
- }
-}
-
-static void positionUpdated(JNIEnv *env, jobject thiz, jobject location,
- jint androidClassKey, jboolean isSingleUpdate)
-{
- Q_UNUSED(env);
- Q_UNUSED(thiz);
- QGeoPositionInfo info = AndroidPositioning::positionInfoFromJavaLocation(location);
-
- QGeoPositionInfoSourceAndroid *source = AndroidPositioning::idToPosSource()->value(androidClassKey);
- if (!source) {
- qCWarning(lcPositioning) << "positionUpdated: source == 0";
- return;
- }
-
- //we need to invoke indirectly as the Looper thread is likely to be not the same thread
- if (!isSingleUpdate)
- QMetaObject::invokeMethod(source, "processPositionUpdate", Qt::AutoConnection,
- Q_ARG(QGeoPositionInfo, info));
- else
- QMetaObject::invokeMethod(source, "processSinglePositionUpdate", Qt::AutoConnection,
- Q_ARG(QGeoPositionInfo, info));
-}
-
-static void locationProvidersDisabled(JNIEnv *env, jobject thiz, jint androidClassKey)
-{
- Q_UNUSED(env);
- Q_UNUSED(thiz);
- QObject *source = AndroidPositioning::idToPosSource()->value(androidClassKey);
- if (!source)
- source = AndroidPositioning::idToSatSource()->value(androidClassKey);
- if (!source) {
- qCWarning(lcPositioning) << "locationProvidersDisabled: source == 0";
- return;
- }
-
- QMetaObject::invokeMethod(source, "locationProviderDisabled", Qt::AutoConnection);
-}
-
-static void locationProvidersChanged(JNIEnv *env, jobject thiz, jint androidClassKey)
-{
- Q_UNUSED(env);
- Q_UNUSED(thiz);
- QObject *source = AndroidPositioning::idToPosSource()->value(androidClassKey);
- if (!source) {
- qCWarning(lcPositioning) << "locationProvidersChanged: source == 0";
- return;
- }
-
- QMetaObject::invokeMethod(source, "locationProvidersChanged", Qt::AutoConnection);
-}
-
-static void notifySatelliteInfoUpdated(const QList<QGeoSatelliteInfo> &inView,
- const QList<QGeoSatelliteInfo> &inUse,
- jint androidClassKey, jboolean isSingleUpdate)
-{
- QGeoSatelliteInfoSourceAndroid *source = AndroidPositioning::idToSatSource()->value(androidClassKey);
- if (!source) {
- qCWarning(lcPositioning) << "notifySatelliteInfoUpdated: source == 0";
- return;
- }
-
- QMetaObject::invokeMethod(source, "processSatelliteUpdateInView", Qt::AutoConnection,
- Q_ARG(QList<QGeoSatelliteInfo>, inView), Q_ARG(bool, isSingleUpdate));
-
- QMetaObject::invokeMethod(source, "processSatelliteUpdateInUse", Qt::AutoConnection,
- Q_ARG(QList<QGeoSatelliteInfo>, inUse), Q_ARG(bool, isSingleUpdate));
-}
-
-static void satelliteGpsUpdated(JNIEnv *env, jobject thiz, jobjectArray satellites,
- jint androidClassKey, jboolean isSingleUpdate)
-{
- Q_UNUSED(thiz);
- QList<QGeoSatelliteInfo> inUse;
- QList<QGeoSatelliteInfo> sats =
- AndroidPositioning::satelliteInfoFromJavaLocation(env, satellites, &inUse);
-
- notifySatelliteInfoUpdated(sats, inUse, androidClassKey, isSingleUpdate);
-}
-
-static void satelliteGnssUpdated(JNIEnv *env, jobject thiz, jobject gnssStatus,
- jint androidClassKey, jboolean isSingleUpdate)
-{
- Q_UNUSED(env);
- Q_UNUSED(thiz);
-
- QList<QGeoSatelliteInfo> inUse;
- QList<QGeoSatelliteInfo> sats =
- AndroidPositioning::satelliteInfoFromJavaGnssStatus(gnssStatus, &inUse);
-
- notifySatelliteInfoUpdated(sats, inUse, androidClassKey, isSingleUpdate);
-}
-
-#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
- VAR = env.findStaticMethod(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
- if (!VAR) { \
- __android_log_print(ANDROID_LOG_FATAL, logTag, methodErrorMsg, METHOD_NAME, \
- METHOD_SIGNATURE); \
- return false; \
- }
-
-static bool registerNatives()
-{
- const JNINativeMethod methods[] = {
- {"positionUpdated", "(Landroid/location/Location;IZ)V", (void *)positionUpdated},
- {"locationProvidersDisabled", "(I)V", (void *) locationProvidersDisabled},
- {"satelliteGpsUpdated", "([Landroid/location/GpsSatellite;IZ)V", (void *)satelliteGpsUpdated},
- {"locationProvidersChanged", "(I)V", (void *) locationProvidersChanged},
- {"satelliteGnssUpdated", "(Landroid/location/GnssStatus;IZ)V", (void *)satelliteGnssUpdated}
- };
-
- QJniEnvironment env;
- if (!env.jniEnv()) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "Failed to create environment");
- return false;
- }
-
- if (!positioningClass.init("org/qtproject/qt/android/positioning/QtPositioning")) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "Failed to create global class ref");
- return false;
- }
-
- if (!env.registerNativeMethods(positioningClass(), methods,
- sizeof(methods) / sizeof(methods[0]))) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "Failed to register native methods");
- return false;
- }
-
- GET_AND_CHECK_STATIC_METHOD(providerListMethodId, positioningClass(), "providerList", "()[I");
- GET_AND_CHECK_STATIC_METHOD(lastKnownPositionMethodId, positioningClass(), "lastKnownPosition",
- "(Z)Landroid/location/Location;");
- GET_AND_CHECK_STATIC_METHOD(startUpdatesMethodId, positioningClass(), "startUpdates", "(III)I");
- GET_AND_CHECK_STATIC_METHOD(stopUpdatesMethodId, positioningClass(), "stopUpdates", "(I)V");
- GET_AND_CHECK_STATIC_METHOD(requestUpdateMethodId, positioningClass(), "requestUpdate",
- "(II)I");
- GET_AND_CHECK_STATIC_METHOD(startSatelliteUpdatesMethodId, positioningClass(),
- "startSatelliteUpdates", "(IIZ)I");
-
- return true;
-}
-
-Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM * /*vm*/, void * /*reserved*/)
-{
- static bool initialized = false;
- if (initialized)
- return JNI_VERSION_1_6;
- initialized = true;
-
- __android_log_print(ANDROID_LOG_INFO, logTag, "Positioning start");
-
- if (!registerNatives()) {
- __android_log_print(ANDROID_LOG_FATAL, logTag, "registerNatives() failed");
- return -1;
- }
-
- if (!ConstellationMapper::init()) {
- __android_log_print(ANDROID_LOG_ERROR, logTag,
- "Failed to extract constellation type constants. "
- "Satellite system will be undefined!");
- }
-
- return JNI_VERSION_1_6;
-}
-
diff --git a/src/plugins/position/android/src/jnipositioning.h b/src/plugins/position/android/src/jnipositioning.h
deleted file mode 100644
index a9a72ecb..00000000
--- a/src/plugins/position/android/src/jnipositioning.h
+++ /dev/null
@@ -1,64 +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 JNIPOSITIONING_H
-#define JNIPOSITIONING_H
-
-#include <QGeoPositionInfoSource>
-#include <QGeoSatelliteInfoSource>
-
-namespace AndroidPositioning
-{
- int registerPositionInfoSource(QObject *obj);
- void unregisterPositionInfoSource(int key);
-
- QGeoPositionInfoSource::PositioningMethods availableProviders();
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly);
-
- QGeoPositionInfoSource::Error startUpdates(int androidClassKey);
- void stopUpdates(int androidClassKey);
- QGeoPositionInfoSource::Error requestUpdate(int androidClassKey);
-
- QGeoSatelliteInfoSource::Error startSatelliteUpdates(int androidClassKey,
- bool isSingleRequest,
- int updateRequestTimeout);
- bool requestionPositioningPermissions();
-}
-
-#endif // JNIPOSITIONING_H
diff --git a/src/plugins/position/android/src/plugin.json b/src/plugins/position/android/src/plugin.json
deleted file mode 100644
index 4fd87892..00000000
--- a/src/plugins/position/android/src/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["android"],
- "Provider": "android",
- "Position": true,
- "Satellite": true,
- "Monitor": false,
- "Priority": 1000,
- "Testable": false
-}
diff --git a/src/plugins/position/android/src/positionfactory_android.cpp b/src/plugins/position/android/src/positionfactory_android.cpp
deleted file mode 100644
index 436b1df6..00000000
--- a/src/plugins/position/android/src/positionfactory_android.cpp
+++ /dev/null
@@ -1,63 +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 "positionfactory_android.h"
-#include "qgeopositioninfosource_android_p.h"
-#include "qgeosatelliteinfosource_android_p.h"
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryAndroid::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parameters)
- QGeoPositionInfoSourceAndroid *src = new QGeoPositionInfoSourceAndroid(parent);
- return src;
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryAndroid::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parameters)
- QGeoSatelliteInfoSourceAndroid *src = new QGeoSatelliteInfoSourceAndroid(parent);
- return src;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryAndroid::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
diff --git a/src/plugins/position/android/src/positionfactory_android.h b/src/plugins/position/android/src/positionfactory_android.h
deleted file mode 100644
index 0494b533..00000000
--- a/src/plugins/position/android/src/positionfactory_android.h
+++ /dev/null
@@ -1,58 +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 POSITIONPOLLFACTORY_H
-#define POSITIONPOLLFACTORY_H
-
-#include <QObject>
-#include <QGeoPositionInfoSourceFactory>
-
-class QGeoPositionInfoSourceFactoryAndroid : 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;
-};
-
-#endif // POSITIONPOLLFACTORY_H
diff --git a/src/plugins/position/android/src/qgeopositioninfosource_android.cpp b/src/plugins/position/android/src/qgeopositioninfosource_android.cpp
deleted file mode 100644
index b1a41e92..00000000
--- a/src/plugins/position/android/src/qgeopositioninfosource_android.cpp
+++ /dev/null
@@ -1,296 +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_android_p.h"
-#include "jnipositioning.h"
-#include <QGeoPositionInfo>
-
-static constexpr int kUpdateFromColdStart = 2 * 60 * 1000;
-static constexpr int kRegularUpdatesTimerInterval = 30 * 1000;
-
-QGeoPositionInfoSourceAndroid::QGeoPositionInfoSourceAndroid(QObject *parent) :
- QGeoPositionInfoSource(parent)
-{
- androidClassKeyForUpdate = AndroidPositioning::registerPositionInfoSource(this);
- androidClassKeyForSingleRequest = AndroidPositioning::registerPositionInfoSource(this);
-
- //by default use all methods
- setPreferredPositioningMethods(AllPositioningMethods);
-
- m_requestTimer.setSingleShot(true);
- connect(&m_requestTimer, &QTimer::timeout, this,
- &QGeoPositionInfoSourceAndroid::requestTimeout);
-
- m_regularUpdatesTimer.setSingleShot(false);
- connect(&m_regularUpdatesTimer, &QTimer::timeout, this,
- &QGeoPositionInfoSourceAndroid::regularUpdatesTimeout);
-}
-
-QGeoPositionInfoSourceAndroid::~QGeoPositionInfoSourceAndroid()
-{
- stopUpdates();
-
- if (m_requestTimer.isActive()) {
- m_requestTimer.stop();
- AndroidPositioning::stopUpdates(androidClassKeyForSingleRequest);
- }
-
- AndroidPositioning::unregisterPositionInfoSource(androidClassKeyForUpdate);
- AndroidPositioning::unregisterPositionInfoSource(androidClassKeyForSingleRequest);
-}
-
-void QGeoPositionInfoSourceAndroid::setUpdateInterval(int msec)
-{
- int previousInterval = updateInterval();
- msec = (((msec > 0) && (msec < minimumUpdateInterval())) || msec < 0)? minimumUpdateInterval() : msec;
-
- if (msec == previousInterval)
- return;
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-
- if (updatesRunning)
- reconfigureRunningSystem();
-}
-
-QGeoPositionInfo QGeoPositionInfoSourceAndroid::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- return AndroidPositioning::lastKnownPosition(fromSatellitePositioningMethodsOnly);
-}
-
-QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceAndroid::supportedPositioningMethods() const
-{
- return AndroidPositioning::availableProviders();
-}
-
-void QGeoPositionInfoSourceAndroid::setPreferredPositioningMethods(QGeoPositionInfoSource::PositioningMethods methods)
-{
- PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods();
- QGeoPositionInfoSource::setPreferredPositioningMethods(methods);
- if (previousPreferredPositioningMethods == preferredPositioningMethods())
- return;
-
- if (updatesRunning)
- reconfigureRunningSystem();
-}
-
-int QGeoPositionInfoSourceAndroid::minimumUpdateInterval() const
-{
- return 50;
-}
-
-QGeoPositionInfoSource::Error QGeoPositionInfoSourceAndroid::error() const
-{
- return m_error;
-}
-
-void QGeoPositionInfoSourceAndroid::setError(Error error)
-{
- m_error = error;
- if (error != QGeoPositionInfoSource::NoError)
- emit QGeoPositionInfoSource::errorOccurred(m_error);
-}
-
-void QGeoPositionInfoSourceAndroid::startUpdates()
-{
- if (updatesRunning)
- return;
-
- m_error = QGeoPositionInfoSource::NoError;
-
- if (preferredPositioningMethods() == 0) {
- setError(UnknownSourceError);
- return;
- }
-
- updatesRunning = true;
- // Start calculating updates from now.
- m_lastUpdateTime = QDateTime::currentMSecsSinceEpoch();
- m_regularUpdatesErrorRaised = false;
- QGeoPositionInfoSource::Error error = AndroidPositioning::startUpdates(androidClassKeyForUpdate);
- if (error != QGeoPositionInfoSource::NoError) {
- updatesRunning = false;
- setError(error);
- } else {
- m_regularUpdatesTimer.start(kRegularUpdatesTimerInterval);
- }
-}
-
-void QGeoPositionInfoSourceAndroid::stopUpdates()
-{
- if (!updatesRunning)
- return;
-
- updatesRunning = false;
- m_regularUpdatesTimer.stop();
- AndroidPositioning::stopUpdates(androidClassKeyForUpdate);
-}
-
-void QGeoPositionInfoSourceAndroid::requestUpdate(int timeout)
-{
- if (m_requestTimer.isActive())
- return;
-
- m_error = QGeoPositionInfoSource::NoError;
-
- if (timeout != 0 && timeout < minimumUpdateInterval()) {
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
- return;
- }
-
- if (timeout == 0)
- timeout = kUpdateFromColdStart;
-
- m_requestTimer.start(timeout);
-
- // if updates already running with interval equal to timeout
- // then we wait for next update coming through
- // assume that a single update will not be quicker than regular updates anyway
- if (updatesRunning && updateInterval() <= timeout)
- return;
-
- QGeoPositionInfoSource::Error error = AndroidPositioning::requestUpdate(androidClassKeyForSingleRequest);
- if (error != QGeoPositionInfoSource::NoError) {
- m_requestTimer.stop();
- setError(error);
- }
-}
-
-void QGeoPositionInfoSourceAndroid::processPositionUpdate(const QGeoPositionInfo &pInfo)
-{
- //single update request and served as part of regular update
- if (m_requestTimer.isActive())
- m_requestTimer.stop();
-
- m_lastUpdateTime = QDateTime::currentMSecsSinceEpoch();
- m_regularUpdatesErrorRaised = false;
-
- emit positionUpdated(pInfo);
-}
-
-// Might still be called multiple times (once for each provider)
-void QGeoPositionInfoSourceAndroid::processSinglePositionUpdate(const QGeoPositionInfo &pInfo)
-{
- //timeout but we received a late update -> ignore
- if (!m_requestTimer.isActive())
- return;
-
- queuedSingleUpdates.append(pInfo);
-}
-
-void QGeoPositionInfoSourceAndroid::locationProviderDisabled()
-{
- if (updatesRunning && !m_regularUpdatesErrorRaised) {
- m_regularUpdatesErrorRaised = true;
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
- }
-
- setError(QGeoPositionInfoSource::ClosedError);
-}
-
-void QGeoPositionInfoSourceAndroid::locationProvidersChanged()
-{
- emit supportedPositioningMethodsChanged();
-}
-
-void QGeoPositionInfoSourceAndroid::requestTimeout()
-{
- AndroidPositioning::stopUpdates(androidClassKeyForSingleRequest);
- //no queued update to process -> timeout
- const int count = queuedSingleUpdates.count();
-
- if (!count) {
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
- return;
- }
-
- //pick best
- QGeoPositionInfo best = queuedSingleUpdates[0];
- for (int i = 1; i < count; i++) {
- const QGeoPositionInfo info = queuedSingleUpdates[i];
-
- //anything newer by 20s is always better
- const qint64 timeDelta = best.timestamp().secsTo(info.timestamp());
- if (abs(timeDelta) > 20) {
- if (timeDelta > 0)
- best = info;
- continue;
- }
-
- //compare accuracy
- if (info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy) &&
- best.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- {
- best = info.attribute(QGeoPositionInfo::HorizontalAccuracy) <
- best.attribute(QGeoPositionInfo::HorizontalAccuracy) ? info : best;
- continue;
- }
-
- //prefer info with accuracy information
- if (info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- best = info;
- }
-
- queuedSingleUpdates.clear();
- emit positionUpdated(best);
-}
-
-void QGeoPositionInfoSourceAndroid::regularUpdatesTimeout()
-{
- if (!m_regularUpdatesErrorRaised) {
- const auto now = QDateTime::currentMSecsSinceEpoch();
- if ((now - m_lastUpdateTime) > (updateInterval() + kUpdateFromColdStart)) {
- m_regularUpdatesErrorRaised = true;
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
- }
- }
-}
-
-/*
- Updates the system assuming that updateInterval
- and/or preferredPositioningMethod have changed.
- */
-void QGeoPositionInfoSourceAndroid::reconfigureRunningSystem()
-{
- if (!updatesRunning)
- return;
-
- stopUpdates();
- startUpdates();
-}
diff --git a/src/plugins/position/android/src/qgeopositioninfosource_android_p.h b/src/plugins/position/android/src/qgeopositioninfosource_android_p.h
deleted file mode 100644
index 44cb2799..00000000
--- a/src/plugins/position/android/src/qgeopositioninfosource_android_p.h
+++ /dev/null
@@ -1,102 +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_ANDROID_P_H
-#define QGEOPOSITIONINFOSOURCE_ANDROID_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 <QGeoPositionInfoSource>
-#include <QTimer>
-
-class QGeoPositionInfoSourceAndroid : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- QGeoPositionInfoSourceAndroid(QObject *parent = 0);
- ~QGeoPositionInfoSourceAndroid();
-
- // From QGeoPositionInfoSource
- void setUpdateInterval(int msec) override;
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
- PositioningMethods supportedPositioningMethods() const override;
- void setPreferredPositioningMethods(PositioningMethods methods) override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-public Q_SLOTS:
- virtual void startUpdates() override;
- virtual void stopUpdates() override;
-
- virtual void requestUpdate(int timeout = 0) override;
-
- void processPositionUpdate(const QGeoPositionInfo& pInfo);
- void processSinglePositionUpdate(const QGeoPositionInfo& pInfo);
-
- void locationProviderDisabled();
- void locationProvidersChanged();
-private Q_SLOTS:
- void requestTimeout();
- void regularUpdatesTimeout();
-
-private:
- void reconfigureRunningSystem();
- void setError(Error error);
-
- bool updatesRunning = false;
- int androidClassKeyForUpdate;
- int androidClassKeyForSingleRequest;
- QList<QGeoPositionInfo> queuedSingleUpdates;
- Error m_error = NoError;
- QTimer m_requestTimer;
- QTimer m_regularUpdatesTimer;
- qint64 m_lastUpdateTime = 0;
- bool m_regularUpdatesErrorRaised = false;
-};
-
-#endif // QGEOPOSITIONINFOSOURCE_ANDROID_P_H
diff --git a/src/plugins/position/android/src/qgeosatelliteinfosource_android.cpp b/src/plugins/position/android/src/qgeosatelliteinfosource_android.cpp
deleted file mode 100644
index 13c09680..00000000
--- a/src/plugins/position/android/src/qgeosatelliteinfosource_android.cpp
+++ /dev/null
@@ -1,223 +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 <QDebug>
-
-#include "qgeosatelliteinfosource_android_p.h"
-#include "jnipositioning.h"
-
-Q_DECLARE_METATYPE(QList<QGeoSatelliteInfo>)
-
-#define UPDATE_FROM_COLD_START 2*60*1000
-
-QGeoSatelliteInfoSourceAndroid::QGeoSatelliteInfoSourceAndroid(QObject *parent) :
- QGeoSatelliteInfoSource(parent), m_error(NoError), updatesRunning(false)
-{
- qRegisterMetaType< QGeoSatelliteInfo >();
- qRegisterMetaType< QList<QGeoSatelliteInfo> >();
- androidClassKeyForUpdate = AndroidPositioning::registerPositionInfoSource(this);
- androidClassKeyForSingleRequest = AndroidPositioning::registerPositionInfoSource(this);
-
- requestTimer.setSingleShot(true);
- QObject::connect(&requestTimer, SIGNAL(timeout()),
- this, SLOT(requestTimeout()));
-}
-
-QGeoSatelliteInfoSourceAndroid::~QGeoSatelliteInfoSourceAndroid()
-{
- stopUpdates();
-
- if (requestTimer.isActive()) {
- requestTimer.stop();
- AndroidPositioning::stopUpdates(androidClassKeyForSingleRequest);
- }
-
- AndroidPositioning::unregisterPositionInfoSource(androidClassKeyForUpdate);
- AndroidPositioning::unregisterPositionInfoSource(androidClassKeyForSingleRequest);
-}
-
-
-void QGeoSatelliteInfoSourceAndroid::setUpdateInterval(int msec)
-{
- int previousInterval = updateInterval();
- msec = (((msec > 0) && (msec < minimumUpdateInterval())) || msec < 0)? minimumUpdateInterval() : msec;
-
- if (msec == previousInterval)
- return;
-
- QGeoSatelliteInfoSource::setUpdateInterval(msec);
-
- if (updatesRunning)
- reconfigureRunningSystem();
-}
-
-int QGeoSatelliteInfoSourceAndroid::minimumUpdateInterval() const
-{
- return 50;
-}
-
-QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceAndroid::error() const
-{
- return m_error;
-}
-
-void QGeoSatelliteInfoSourceAndroid::startUpdates()
-{
- if (updatesRunning)
- return;
-
- updatesRunning = true;
-
- m_error = QGeoSatelliteInfoSource::NoError;
-
- QGeoSatelliteInfoSource::Error error = AndroidPositioning::startSatelliteUpdates(
- androidClassKeyForUpdate, false, updateInterval());
- if (error != QGeoSatelliteInfoSource::NoError) {
- updatesRunning = false;
- setError(error);
- }
-}
-
-void QGeoSatelliteInfoSourceAndroid::stopUpdates()
-{
- if (!updatesRunning)
- return;
-
- updatesRunning = false;
- AndroidPositioning::stopUpdates(androidClassKeyForUpdate);
-}
-
-void QGeoSatelliteInfoSourceAndroid::requestUpdate(int timeout)
-{
- if (requestTimer.isActive())
- return;
-
- m_error = QGeoSatelliteInfoSource::NoError;
-
- if (timeout != 0 && timeout < minimumUpdateInterval()) {
- setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
- return;
- }
-
- if (timeout == 0)
- timeout = UPDATE_FROM_COLD_START;
-
- requestTimer.start(timeout);
-
- // if updates already running with interval equal or less then timeout
- // then we wait for next update coming through
- // assume that a single update will not be quicker than regular updates anyway
- if (updatesRunning && updateInterval() <= timeout)
- return;
-
- QGeoSatelliteInfoSource::Error error = AndroidPositioning::startSatelliteUpdates(
- androidClassKeyForSingleRequest, true, timeout);
- if (error != QGeoSatelliteInfoSource::NoError) {
- requestTimer.stop();
- setError(error);
- }
-}
-
-void QGeoSatelliteInfoSourceAndroid::processSatelliteUpdateInView(const QList<QGeoSatelliteInfo> &satsInView, bool isSingleUpdate)
-{
- if (!isSingleUpdate) {
- //if requested while regular updates were running
- if (requestTimer.isActive())
- requestTimer.stop();
- emit QGeoSatelliteInfoSource::satellitesInViewUpdated(satsInView);
- return;
- }
-
- m_satsInView = satsInView;
-}
-
-void QGeoSatelliteInfoSourceAndroid::processSatelliteUpdateInUse(const QList<QGeoSatelliteInfo> &satsInUse, bool isSingleUpdate)
-{
- if (!isSingleUpdate) {
- //if requested while regular updates were running
- if (requestTimer.isActive())
- requestTimer.stop();
- emit QGeoSatelliteInfoSource::satellitesInUseUpdated(satsInUse);
- return;
- }
-
- m_satsInUse = satsInUse;
-}
-
-void QGeoSatelliteInfoSourceAndroid::requestTimeout()
-{
- AndroidPositioning::stopUpdates(androidClassKeyForSingleRequest);
-
- const int count = m_satsInView.count();
- if (!count) {
- setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
- return;
- }
-
- emit QGeoSatelliteInfoSource::satellitesInViewUpdated(m_satsInView);
- emit QGeoSatelliteInfoSource::satellitesInUseUpdated(m_satsInUse);
-
- m_satsInUse.clear();
- m_satsInView.clear();
-}
-
-/*
- Updates the system assuming that updateInterval
- and/or preferredPositioningMethod have changed.
- */
-void QGeoSatelliteInfoSourceAndroid::reconfigureRunningSystem()
-{
- if (!updatesRunning)
- return;
-
- stopUpdates();
- startUpdates();
-}
-
-void QGeoSatelliteInfoSourceAndroid::setError(QGeoSatelliteInfoSource::Error error)
-{
- m_error = error;
- if (m_error != QGeoSatelliteInfoSource::NoError)
- emit QGeoSatelliteInfoSource::errorOccurred(m_error);
-}
-
-void QGeoSatelliteInfoSourceAndroid::locationProviderDisabled()
-{
- setError(QGeoSatelliteInfoSource::ClosedError);
-}
diff --git a/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h b/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h
deleted file mode 100644
index 19b7b577..00000000
--- a/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h
+++ /dev/null
@@ -1,98 +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 QGEOSATELLITEINFOSOURCEANDROID_H
-#define QGEOSATELLITEINFOSOURCEANDROID_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 <QGeoSatelliteInfoSource>
-#include <QTimer>
-
-class QGeoSatelliteInfoSourceAndroid : public QGeoSatelliteInfoSource
-{
- Q_OBJECT
-public:
- explicit QGeoSatelliteInfoSourceAndroid(QObject *parent = 0);
- ~QGeoSatelliteInfoSourceAndroid();
-
- //From QGeoSatelliteInfoSource
- void setUpdateInterval(int msec) override;
- int minimumUpdateInterval() const override;
-
- Error error() const override;
-
-public Q_SLOTS:
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 0) override;
-
- void processSatelliteUpdateInView(const QList<QGeoSatelliteInfo> &satsInView, bool isSingleUpdate);
- void processSatelliteUpdateInUse(const QList<QGeoSatelliteInfo> &satsInUse, bool isSingleUpdate);
-
- void locationProviderDisabled();
-private Q_SLOTS:
- void requestTimeout();
-
-private:
- void reconfigureRunningSystem();
- void setError(QGeoSatelliteInfoSource::Error error);
-
- Error m_error;
- int androidClassKeyForUpdate;
- int androidClassKeyForSingleRequest;
- bool updatesRunning;
-
- QTimer requestTimer;
- QList<QGeoSatelliteInfo> m_satsInUse;
- QList<QGeoSatelliteInfo> m_satsInView;
-
-};
-
-#endif // QGEOSATELLITEINFOSOURCEANDROID_H
diff --git a/src/plugins/position/android/src/src.pro b/src/plugins/position/android/src/src.pro
deleted file mode 100644
index 36facc55..00000000
--- a/src/plugins/position/android/src/src.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-TARGET = qtposition_android
-
-QT = core core-private positioning
-
-HEADERS = \
- positionfactory_android.h \
- qgeopositioninfosource_android_p.h \
- jnipositioning.h \
- qgeosatelliteinfosource_android_p.h
-
-SOURCES = \
- positionfactory_android.cpp \
- qgeopositioninfosource_android.cpp \
- jnipositioning.cpp \
- qgeosatelliteinfosource_android.cpp
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryAndroid
-load(qt_plugin)
diff --git a/src/plugins/position/corelocation/CMakeLists.txt b/src/plugins/position/corelocation/CMakeLists.txt
deleted file mode 100644
index 0126aa65..00000000
--- a/src/plugins/position/corelocation/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from corelocation.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryCL Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryCLPlugin
- OUTPUT_NAME qtposition_cl
- CLASS_NAME QGeoPositionInfoSourceFactoryCL
- PLUGIN_TYPE position
- SOURCES
- qgeopositioninfosource_cl.mm qgeopositioninfosource_cl_p.h
- qgeopositioninfosourcefactory_cl.h qgeopositioninfosourcefactory_cl.mm
- LIBRARIES
- ${FWCoreLocation}
- ${FWFoundation}
- Qt::Core
- Qt::CorePrivate
- Qt::Positioning
-)
-
-# special case begin
-set_target_properties(QGeoPositionInfoSourceFactoryCLPlugin
- PROPERTIES
- DISABLE_PRECOMPILE_HEADERS ON
-)
-# special case end
-
-#### Keys ignored in scope 1:.:.:corelocation.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:corelocation.pro:NOT APPLE:
-# DISTFILES = "$$OBJECTIVE_SOURCES"
diff --git a/src/plugins/position/corelocation/corelocation.pro b/src/plugins/position/corelocation/corelocation.pro
deleted file mode 100644
index 6b7ba82c..00000000
--- a/src/plugins/position/corelocation/corelocation.pro
+++ /dev/null
@@ -1,24 +0,0 @@
-TARGET = qtposition_cl
-
-QT = core core-private positioning
-
-OBJECTIVE_SOURCES += \
- qgeopositioninfosource_cl.mm \
- qgeopositioninfosourcefactory_cl.mm
-
-HEADERS += \
- qgeopositioninfosource_cl_p.h \
- qgeopositioninfosourcefactory_cl.h
-
-OTHER_FILES += \
- plugin.json
-
-LIBS += -framework Foundation -framework CoreLocation
-
-!darwin {
- DISTFILES += $$OBJECTIVE_SOURCES
-}
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryCL
-load(qt_plugin)
diff --git a/src/plugins/position/corelocation/plugin.json b/src/plugins/position/corelocation/plugin.json
deleted file mode 100644
index 58e3acd0..00000000
--- a/src/plugins/position/corelocation/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["corelocation"],
- "Provider": "corelocation",
- "Position": true,
- "Satellite": false,
- "Monitor" : false,
- "Priority": 1000,
- "Testable": false
-}
diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
deleted file mode 100644
index c7e02443..00000000
--- a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
+++ /dev/null
@@ -1,336 +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 <QTimerEvent>
-#include <QDebug>
-#include <QtCore/qglobal.h>
-#include <QtCore/private/qglobal_p.h>
-
-#include "qgeopositioninfosource_cl_p.h"
-
-#define MINIMUM_UPDATE_INTERVAL 1000
-
-@interface PositionLocationDelegate : NSObject <CLLocationManagerDelegate>
-@end
-
-@implementation PositionLocationDelegate
-{
- QGeoPositionInfoSourceCL *m_positionInfoSource;
-}
-
-- (instancetype)initWithInfoSource:(QGeoPositionInfoSourceCL*) positionInfoSource
-{
- if ((self = [self init])) {
- m_positionInfoSource = positionInfoSource;
- }
- return self;
-}
-- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
-{
- Q_UNUSED(manager);
- if (status == kCLAuthorizationStatusNotDetermined)
- m_positionInfoSource->requestUpdate(MINIMUM_UPDATE_INTERVAL);
-}
-
-- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
-{
- Q_UNUSED(manager);
- Q_UNUSED(oldLocation);
-
- // Convert location timestamp to QDateTime
- NSTimeInterval locationTimeStamp = [newLocation.timestamp timeIntervalSince1970];
- const QDateTime timeStamp = QDateTime::fromMSecsSinceEpoch(qRound64(locationTimeStamp * 1000), Qt::UTC);
-
- // Construct position info from location data
- QGeoPositionInfo location(QGeoCoordinate(newLocation.coordinate.latitude,
- newLocation.coordinate.longitude,
- newLocation.altitude),
- timeStamp);
- if (newLocation.horizontalAccuracy >= 0)
- location.setAttribute(QGeoPositionInfo::HorizontalAccuracy, newLocation.horizontalAccuracy);
- if (newLocation.verticalAccuracy >= 0)
- location.setAttribute(QGeoPositionInfo::VerticalAccuracy, newLocation.verticalAccuracy);
-#ifndef Q_OS_TVOS
- if (newLocation.course >= 0)
- location.setAttribute(QGeoPositionInfo::Direction, newLocation.course);
- if (newLocation.speed >= 0)
- location.setAttribute(QGeoPositionInfo::GroundSpeed, newLocation.speed);
-#endif
-
- m_positionInfoSource->locationDataAvailable(location);
-}
-
-- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
-{
- Q_UNUSED(manager);
- m_positionInfoSource->setError(QGeoPositionInfoSource::AccessError);
-
- qWarning() << QString::fromNSString([error localizedDescription]);
-
- if ([error code] == 0
- && QString::fromNSString([error domain]) == QStringLiteral("kCLErrorDomain"))
- qWarning() << "(is Wi-Fi turned on?)";
-}
-@end
-
-QT_BEGIN_NAMESPACE
-
-QGeoPositionInfoSourceCL::QGeoPositionInfoSourceCL(QObject *parent)
- : QGeoPositionInfoSource(parent)
- , m_locationManager(0)
- , m_started(false)
- , m_updateTimer(0)
- , m_updateTimeout(0)
- , m_positionError(QGeoPositionInfoSource::NoError)
-{
-}
-
-QGeoPositionInfoSourceCL::~QGeoPositionInfoSourceCL()
-{
- stopUpdates();
- [m_locationManager release];
-}
-
-void QGeoPositionInfoSourceCL::setUpdateInterval(int msec)
-{
- // If msec is 0 we send updates as data becomes available, otherwise we force msec to be equal
- // to or larger than the minimum update interval.
- if (msec != 0 && msec < minimumUpdateInterval())
- msec = minimumUpdateInterval();
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-
- // Must timeout if update takes longer than specified interval
- m_updateTimeout = msec;
- if (m_started) setTimeoutInterval(m_updateTimeout);
-}
-
-bool QGeoPositionInfoSourceCL::enableLocationManager()
-{
- if (!m_locationManager) {
- if ([CLLocationManager locationServicesEnabled]) {
- // Location Services Are Enabled
- switch ([CLLocationManager authorizationStatus]) {
- case kCLAuthorizationStatusNotDetermined:
- // User has not yet made a choice with regards to this application
- break;
- case kCLAuthorizationStatusRestricted:
- // This application is not authorized to use location services. Due
- // to active restrictions on location services, the user cannot change
- // this status, and may not have personally denied authorization
- return false;
- case kCLAuthorizationStatusDenied:
- // User has explicitly denied authorization for this application, or
- // location services are disabled in Settings
- return false;
- case kCLAuthorizationStatusAuthorizedAlways:
- // This app is authorized to start location services at any time.
- break;
-#ifndef Q_OS_MACOS
- case kCLAuthorizationStatusAuthorizedWhenInUse:
- // This app is authorized to start most location services while running in the foreground.
- break;
-#endif
- default:
- // By default, try to enable it
- break;
- }
- } else {
- // Location Services Disabled
- return false;
- }
-
- m_locationManager = [[CLLocationManager alloc] init];
-
-#if defined(Q_OS_IOS) || defined(Q_OS_WATCHOS)
- if (__builtin_available(watchOS 4.0, *)) {
- NSDictionary<NSString *, id> *infoDict = [[NSBundle mainBundle] infoDictionary];
- if (id value = [infoDict objectForKey:@"UIBackgroundModes"]) {
- if ([value isKindOfClass:[NSArray class]]) {
- NSArray *modes = static_cast<NSArray *>(value);
- for (id mode in modes) {
- if ([@"location" isEqualToString:mode]) {
- m_locationManager.allowsBackgroundLocationUpdates = YES;
- break;
- }
- }
- }
- }
- }
-#endif
-
- m_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
- m_locationManager.delegate = [[PositionLocationDelegate alloc] initWithInfoSource:this];
-
- // -requestAlwaysAuthorization is available on iOS (>= 8.0) and watchOS (>= 2.0).
- // This method requires both NSLocationAlwaysAndWhenInUseUsageDescription and
- // NSLocationWhenInUseUsageDescription entries present in Info.plist (otherwise,
- // while probably a noop, the call generates a warning).
- // -requestWhenInUseAuthorization only requires NSLocationWhenInUseUsageDescription
- // entry in Info.plist (available on iOS (>= 8.0), tvOS (>= 9.0) and watchOS (>= 2.0).
- }
-
-#ifndef Q_OS_MACOS
- NSDictionary<NSString *, id> *infoDict = NSBundle.mainBundle.infoDictionary;
- const bool hasAlwaysUseUsage = !![infoDict objectForKey:@"NSLocationAlwaysAndWhenInUseUsageDescription"];
- const bool hasWhenInUseUsage = !![infoDict objectForKey:@"NSLocationWhenInUseUsageDescription"];
-#ifndef Q_OS_TVOS
- if (hasAlwaysUseUsage && hasWhenInUseUsage)
- [m_locationManager requestAlwaysAuthorization];
- else
-#endif // !Q_OS_TVOS
- if (hasWhenInUseUsage)
- [m_locationManager requestWhenInUseAuthorization];
-#endif // !Q_OS_MACOS
-
- return (m_locationManager != nullptr);
-}
-
-void QGeoPositionInfoSourceCL::setTimeoutInterval(int msec)
-{
- // Start timeout timer
- if (m_updateTimer) killTimer(m_updateTimer);
- if (msec > 0) m_updateTimer = startTimer(msec);
- else m_updateTimer = 0;
-}
-
-void QGeoPositionInfoSourceCL::startUpdates()
-{
- m_positionError = QGeoPositionInfoSource::NoError;
- if (enableLocationManager()) {
-#ifdef Q_OS_TVOS
- [m_locationManager requestLocation]; // service will run long enough for one location update
-#else
- [m_locationManager startUpdatingLocation];
-#endif
- m_started = true;
-
- setTimeoutInterval(m_updateTimeout);
- } else setError(QGeoPositionInfoSource::AccessError);
-}
-
-void QGeoPositionInfoSourceCL::stopUpdates()
-{
- if (m_locationManager) {
- [m_locationManager stopUpdatingLocation];
- m_started = false;
-
- // Stop timeout timer
- setTimeoutInterval(0);
- } else setError(QGeoPositionInfoSource::AccessError);
-}
-
-void QGeoPositionInfoSourceCL::requestUpdate(int timeout)
-{
- // Get a single update within timeframe
- m_positionError = QGeoPositionInfoSource::NoError;
- if (timeout < minimumUpdateInterval() && timeout != 0)
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
- else if (enableLocationManager()) {
- // This will force LM to generate a new update
- [m_locationManager stopUpdatingLocation];
-#ifdef Q_OS_TVOS
- [m_locationManager requestLocation]; // service will run long enough for one location update
-#else
- [m_locationManager startUpdatingLocation];
-#endif
-
- setTimeoutInterval(timeout);
- } else setError(QGeoPositionInfoSource::AccessError);
-}
-
-void QGeoPositionInfoSourceCL::timerEvent( QTimerEvent * event )
-{
- // Update timed out?
- if (event->timerId() == m_updateTimer) {
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
-
- // Only timeout once since last data
- setTimeoutInterval(0);
-
- // Started for single update?
- if (!m_started) stopUpdates();
- }
-}
-
-QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceCL::supportedPositioningMethods() const
-{
- // CoreLocation doesn't say which positioning method(s) it used
- return QGeoPositionInfoSource::AllPositioningMethods;
-}
-
-int QGeoPositionInfoSourceCL::minimumUpdateInterval() const
-{
- return MINIMUM_UPDATE_INTERVAL;
-}
-
-void QGeoPositionInfoSourceCL::locationDataAvailable(QGeoPositionInfo location)
-{
- // Signal position data available
- m_lastUpdate = location;
- emit positionUpdated(location);
-
- // Started for single update?
- if (!m_started) stopUpdates();
- // ...otherwise restart timeout timer
- else setTimeoutInterval(m_updateTimeout);
-}
-
-QGeoPositionInfo QGeoPositionInfoSourceCL::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
-
- return m_lastUpdate;
-}
-
-QGeoPositionInfoSource::Error QGeoPositionInfoSourceCL::error() const
-{
- return m_positionError;
-}
-
-void QGeoPositionInfoSourceCL::setError(QGeoPositionInfoSource::Error positionError)
-{
- m_positionError = positionError;
- if (m_positionError != QGeoPositionInfoSource::NoError)
- emit QGeoPositionInfoSource::errorOccurred(positionError);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qgeopositioninfosource_cl_p.cpp"
diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h b/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h
deleted file mode 100644
index d38e7c3b..00000000
--- a/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h
+++ /dev/null
@@ -1,106 +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 QGEOPOSITIONINFOSOURCECL_H
-#define QGEOPOSITIONINFOSOURCECL_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.
-//
-
-#import <CoreLocation/CoreLocation.h>
-
-#include "qgeopositioninfosource.h"
-#include "qgeopositioninfo.h"
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoSourceCL : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- QGeoPositionInfoSourceCL(QObject *parent = 0);
- ~QGeoPositionInfoSourceCL();
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
- PositioningMethods supportedPositioningMethods() const override;
-
- void setUpdateInterval(int msec) override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
- void locationDataAvailable(QGeoPositionInfo location);
- void setError(QGeoPositionInfoSource::Error positionError);
-
-private:
- bool enableLocationManager();
- void setTimeoutInterval(int msec);
-
-public Q_SLOTS:
- void startUpdates() override;
- void stopUpdates() override;
-
- void requestUpdate(int timeout = 0) override;
-
-protected:
- void timerEvent(QTimerEvent *event) override;
-
-private:
- Q_DISABLE_COPY(QGeoPositionInfoSourceCL);
- CLLocationManager *m_locationManager;
- bool m_started;
-
- QGeoPositionInfo m_lastUpdate;
-
- int m_updateTimer;
- int m_updateTimeout;
-
- QGeoPositionInfoSource::Error m_positionError;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCECL_H
diff --git a/src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.h b/src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.h
deleted file mode 100644
index 7e14e31f..00000000
--- a/src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.h
+++ /dev/null
@@ -1,58 +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_CL_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_CL_H
-
-#include <QObject>
-#include <QGeoPositionInfoSourceFactory>
-
-class QGeoPositionInfoSourceFactoryCL : 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;
-};
-
-#endif // QGEOPOSITIONINFOSOURCEFACTORY_CL_H
diff --git a/src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.mm b/src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.mm
deleted file mode 100644
index e7d2a116..00000000
--- a/src/plugins/position/corelocation/qgeopositioninfosourcefactory_cl.mm
+++ /dev/null
@@ -1,61 +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_cl_p.h"
-#include "qgeopositioninfosourcefactory_cl.h"
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryCL::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parameters)
- return new QGeoPositionInfoSourceCL(parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryCL::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryCL::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
diff --git a/src/plugins/position/geoclue2/CMakeLists.txt b/src/plugins/position/geoclue2/CMakeLists.txt
deleted file mode 100644
index c573ee1d..00000000
--- a/src/plugins/position/geoclue2/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Generated from geoclue2.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryGeoclue2 Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryGeoclue2Plugin
- OUTPUT_NAME qtposition_geoclue2
- CLASS_NAME QGeoPositionInfoSourceFactoryGeoclue2
- PLUGIN_TYPE position
- SOURCES
- geocluetypes.cpp geocluetypes.h
- qgeopositioninfosource_geoclue2.cpp qgeopositioninfosource_geoclue2_p.h
- qgeopositioninfosourcefactory_geoclue2.cpp qgeopositioninfosourcefactory_geoclue2.h
- DBUS_INTERFACE_SOURCES
- org.freedesktop.GeoClue2.Client.xml
- org.freedesktop.GeoClue2.Location.xml
- org.freedesktop.GeoClue2.Manager.xml
- DBUS_INTERFACE_FLAGS
- -N -i geocluetypes.h # special case
- INCLUDE_DIRECTORIES
- ${CMAKE_CURRENT_BINARY_DIR}
- core.location.includes
- LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:geoclue2.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/position/geoclue2/geoclue2.pro b/src/plugins/position/geoclue2/geoclue2.pro
deleted file mode 100644
index 1bd129d5..00000000
--- a/src/plugins/position/geoclue2/geoclue2.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-TARGET = qtposition_geoclue2
-
-QT = core positioning dbus
-
-HEADERS += \
- qgeopositioninfosource_geoclue2_p.h \
- qgeopositioninfosourcefactory_geoclue2.h \
- geocluetypes.h
-
-SOURCES += \
- qgeopositioninfosource_geoclue2.cpp \
- qgeopositioninfosourcefactory_geoclue2.cpp \
- geocluetypes.cpp
-
-QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += \
- "-N -i geocluetypes.h"
-
-DBUS_INTERFACES += \
- org.freedesktop.GeoClue2.Manager.xml \
- org.freedesktop.GeoClue2.Client.xml \
- org.freedesktop.GeoClue2.Location.xml
-
-INCLUDEPATH += $$QT.location.includes $$OUT_PWD
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryGeoclue2
-load(qt_plugin)
diff --git a/src/plugins/position/geoclue2/geocluetypes.cpp b/src/plugins/position/geoclue2/geocluetypes.cpp
deleted file mode 100644
index dec55d3c..00000000
--- a/src/plugins/position/geoclue2/geocluetypes.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** 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 "geocluetypes.h"
-
-QT_BEGIN_NAMESPACE
-
-QDBusArgument &operator<<(QDBusArgument &arg, const Timestamp &ts)
-{
- arg.beginStructure();
- arg << ts.m_seconds;
- arg << ts.m_microseconds;
- arg.endStructure();
- return arg;
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &arg, Timestamp &ts)
-{
- arg.beginStructure();
- arg >> ts.m_seconds;
- arg >> ts.m_microseconds;
- arg.endStructure();
- return arg;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue2/geocluetypes.h b/src/plugins/position/geoclue2/geocluetypes.h
deleted file mode 100644
index 2fc3ca2d..00000000
--- a/src/plugins/position/geoclue2/geocluetypes.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** 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 GEOCLUETYPES_H
-#define GEOCLUETYPES_H
-
-#include <QtDBus/QDBusArgument>
-
-class Timestamp
-{
-public:
- quint64 m_seconds = 0;
- quint64 m_microseconds = 0;
-};
-
-QT_BEGIN_NAMESPACE
-
-Q_DECLARE_TYPEINFO(Timestamp, Q_RELOCATABLE_TYPE);
-
-QDBusArgument &operator<<(QDBusArgument &arg, const Timestamp &ts);
-const QDBusArgument &operator>>(const QDBusArgument &arg, Timestamp &ts);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Timestamp)
-
-#endif // GEOCLUETYPES_H
diff --git a/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Client.xml b/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Client.xml
deleted file mode 100644
index 4a9399b7..00000000
--- a/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Client.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-
-<!--
- GeoClue 2.0 Interface Specification
-
- Copyright 2013 Red Hat, Inc.
--->
-
-<node>
-
- <!--
- org.freedesktop.GeoClue2.Client:
- @short_description: The Application-specific client API
-
- This is the interface you use to retrieve location information and receive
- location update signals from GeoClue service. You get the client object to
- use this interface on from org.freedesktop.GeoClue2.Manager.GetClient()
- method.
- -->
- <interface name="org.freedesktop.GeoClue2.Client">
- <!--
- Location:
-
- Current location as path to a #org.freedesktop.GeoClue2.Location object.
- Please note that this property will be set to "/" (D-Bus equivalent of
- null) initially, until Geoclue finds user's location. You want to delay
- reading this property until your callback to
- #org.freedesktop.GeoClue2.Client::LocationUpdated signal is called for
- the first time after starting the client.
- -->
- <property name="Location" type="o" access="read"/>
-
- <!--
- DistanceThreshold:
-
- Contains the current distance threshold in meters. This value is used
- by the service when it gets new location info. If the distance moved is
- below the threshold, it won't emit the LocationUpdated signal.
- The default value is 0. When TimeThreshold is zero, it always emits
- the signal.
- -->
- <property name="DistanceThreshold" type="u" access="readwrite">
- <annotation name="org.freedesktop.Accounts.DefaultValue" value="0"/>
- </property>
-
- <!--
- TimeThreshold:
-
- Contains the current time threshold in seconds. This value is used
- by the service when it gets new location info. If the time since the
- last update is below the threshold, it won't emit the LocationUpdated
- signal. The default value is 0. When TimeThreshold is zero, it always
- emits the signal.
- -->
- <property name="TimeThreshold" type="u" access="readwrite">
- <annotation name="org.freedesktop.Accounts.DefaultValue" value="0"/>
- </property>
-
- <!--
- DesktopId:
-
- The desktop file id (the basename of the desktop file). This property
- must be set by applications for authorization to work.
- -->
- <property name="DesktopId" type="s" access="readwrite"/>
-
- <!--
- RequestedAccuracyLevel:
-
- The level of accuracy requested by client, as
- <link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link>.
-
- Please keep in mind that the actual accuracy of location information is
- dependent on available hardware on your machine, external resources
- and/or how much accuracy user agrees to be confortable with.
- -->
- <property name="RequestedAccuracyLevel" type="u" access="readwrite"/>
-
- <!--
- Active:
-
- If client is active, i-e started successfully using
- org.freedesktop.GeoClue2.Client.Start() and receiving location updates.
-
- Please keep in mind that geoclue can at any time stop and start the
- client on user (agent) request. Applications that are interested in
- in these changes, should watch for changes in this property.
- -->
- <property name="Active" type="b" access="read"/>
-
- <!--
- Start:
-
- Start receiving events about the current location. Applications should
- hook-up to #org.freedesktop.GeoClue2.Client::LocationUpdated signal
- before calling this method.
- -->
- <method name="Start"/>
-
- <!--
- Stop:
-
- Stop receiving events about the current location.
- -->
- <method name="Stop"/>
-
- <!--
- LocationUpdated:
- @old: old location as path to a #org.freedesktop.GeoClue2.Location object
- @new: new location as path to a #org.freedesktop.GeoClue2.Location object
-
- The signal is emitted every time the location changes.
- The client should set the DistanceThreshold property to control how
- often this signal is emitted.
- -->
- <signal name="LocationUpdated">
- <arg name="oldLocation" type="o"/>
- <arg name="newLocation" type="o"/>
- </signal>
- </interface>
-</node>
diff --git a/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Location.xml b/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Location.xml
deleted file mode 100644
index ebf2ea6b..00000000
--- a/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Location.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-
-<!--
- GeoClue 2.0 Interface Specification
-
- Copyright 2013 Red Hat, Inc.
--->
-
-<node>
-
- <!--
- org.freedesktop.GeoClue2.Location:
- @short_description: The Location interface
-
- This is the interface you use on location objects.
- -->
- <interface name="org.freedesktop.GeoClue2.Location">
-
- <!--
- Latitude:
-
- The latitude of the location, in degrees.
- -->
- <property name="Latitude" type="d" access="read"/>
-
- <!--
- Longitude:
-
- The longitude of the location, in degrees.
- -->
- <property name="Longitude" type="d" access="read"/>
-
- <!--
- Accuracy:
-
- The accuracy of the location fix, in meters.
- -->
- <property name="Accuracy" type="d" access="read"/>
-
- <!--
- Altitude:
-
- The altitude of the location fix, in meters. When unknown, its set to
- minimum double value, -1.7976931348623157e+308.
- -->
- <property name="Altitude" type="d" access="read"/>
-
- <!--
- Speed:
-
- The speed in meters per second. When unknown, it's set to -1.0.
- -->
- <property name="Speed" type="d" access="read"/>
-
- <!--
- Heading:
-
- The heading direction in degrees with respect to North direction, in
- clockwise order. That means North becomes 0 degree, East: 90 degrees,
- South: 180 degrees, West: 270 degrees and so on. When unknown,
- it's set to -1.0.
- -->
- <property name="Heading" type="d" access="read"/>
-
- <!--
- Description:
-
- A human-readable description of the location, if available.
-
- WARNING: Applications should not rely on this property since not all
- sources provide a description. If you really need a description (or
- more details) about current location, use a reverse-geocoding API, e.g
- geocode-glib.
- -->
- <property name="Description" type="s" access="read"/>
-
-
- <!--
- Timestamp:
-
- The timestamp when the location was determined, in seconds and
- microseconds since the Epoch. This is the time of measurement if the
- backend provided that information, otherwise the time when GeoClue
- received the new location.
-
- Note that GeoClue can't guarantee that the timestamp will always
- monotonically increase, as a backend may not respect that.
- Also note that a timestamp can be very old, e.g. because of a cached
- location.
- -->
- <property name="Timestamp" type="(tt)" access="read">
- <annotation name="org.qtproject.QtDBus.QtTypeName" value="Timestamp"/>
- </property>
- </interface>
-</node>
diff --git a/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Manager.xml b/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Manager.xml
deleted file mode 100644
index cf9590f6..00000000
--- a/src/plugins/position/geoclue2/org.freedesktop.GeoClue2.Manager.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-
-<!--
- GeoClue 2.0 Interface Specification
-
- Copyright 2013 Red Hat, Inc.
--->
-
-<node>
-
- <!--
- org.freedesktop.GeoClue2.Manager:
- @short_description: The GeoClue service manager
-
- This is the interface you use to talk to main GeoClue2 manager object at
- path "/org/freedesktop/GeoClue2/Manager". The only thing you do with this
- interface is to call org.freedesktop.GeoClue2.Manager.GetClient() on it
- to get your application specific client object.
- -->
- <interface name="org.freedesktop.GeoClue2.Manager">
- <!--
- InUse:
-
- Whether service is currently is use by any application.
- -->
- <property name="InUse" type="b" access="read"/>
-
- <!--
- AvailableAccuracyLevel:
-
- The level of available accuracy, as
- <link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link>.
- -->
- <property name="AvailableAccuracyLevel" type="u" access="read"/>
-
- <!--
- GetClient:
- @client: The path for newly created client object
-
- Retrieves a client object which can only be used by the calling
- application only.
- -->
- <method name="GetClient">
- <arg name="client" type="o" direction="out"/>
- </method>
-
- <!--
- AddAgent:
- @id: The Desktop ID (excluding .desktop) of the agent
-
- An API for user authorization agents to register themselves. Each agent
- is responsible for the user it is running as. Application developers
- can and should simply ignore this API.
- -->
- <method name="AddAgent">
- <arg name="id" type="s" direction="in"/>
- </method>
- </interface>
-</node>
diff --git a/src/plugins/position/geoclue2/plugin.json b/src/plugins/position/geoclue2/plugin.json
deleted file mode 100644
index c23d40e0..00000000
--- a/src/plugins/position/geoclue2/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["geoclue2"],
- "Provider": "geoclue2",
- "Position": true,
- "Satellite": false,
- "Monitor": false,
- "Priority": 1000,
- "Testable": false
-}
diff --git a/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp b/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp
deleted file mode 100644
index 3c78a075..00000000
--- a/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2.cpp
+++ /dev/null
@@ -1,458 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** 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_geoclue2_p.h"
-
-#include <QtCore/QLoggingCategory>
-#include <QtCore/QSaveFile>
-#include <QtCore/QScopedPointer>
-#include <QtCore/QTimer>
-#include <QtDBus/QDBusPendingCallWatcher>
-
-// Auto-generated D-Bus files.
-#include <client_interface.h>
-#include <location_interface.h>
-
-Q_DECLARE_LOGGING_CATEGORY(lcPositioningGeoclue2)
-
-QT_BEGIN_NAMESPACE
-
-namespace {
-
-// NOTE: Copied from the /usr/include/libgeoclue-2.0/gclue-client.h
-enum GClueAccuracyLevel {
- GCLUE_ACCURACY_LEVEL_NONE = 0,
- GCLUE_ACCURACY_LEVEL_COUNTRY = 1,
- GCLUE_ACCURACY_LEVEL_CITY = 4,
- GCLUE_ACCURACY_LEVEL_NEIGHBORHOOD = 5,
- GCLUE_ACCURACY_LEVEL_STREET = 6,
- GCLUE_ACCURACY_LEVEL_EXACT = 8
-};
-
-const char GEOCLUE2_SERVICE_NAME[] = "org.freedesktop.GeoClue2";
-const int MINIMUM_UPDATE_INTERVAL = 1000;
-const int UPDATE_TIMEOUT_COLD_START = 120000;
-static const auto desktopIdParameter = "desktopId";
-
-static QString lastPositionFilePath()
-{
- return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
- + QStringLiteral("/qtposition-geoclue2");
-}
-
-} // namespace
-
-QGeoPositionInfoSourceGeoclue2::QGeoPositionInfoSourceGeoclue2(const QVariantMap &parameters,
- QObject *parent)
- : QGeoPositionInfoSource(parent)
- , m_requestTimer(new QTimer(this))
- , m_manager(QLatin1String(GEOCLUE2_SERVICE_NAME),
- QStringLiteral("/org/freedesktop/GeoClue2/Manager"),
- QDBusConnection::systemBus(),
- this)
-{
- parseParameters(parameters);
-
- qDBusRegisterMetaType<Timestamp>();
-
- restoreLastPosition();
-
- m_requestTimer->setSingleShot(true);
- connect(m_requestTimer, &QTimer::timeout,
- this, &QGeoPositionInfoSourceGeoclue2::requestUpdateTimeout);
-}
-
-QGeoPositionInfoSourceGeoclue2::~QGeoPositionInfoSourceGeoclue2()
-{
- saveLastPosition();
-}
-
-void QGeoPositionInfoSourceGeoclue2::setUpdateInterval(int msec)
-{
- QGeoPositionInfoSource::setUpdateInterval(msec);
- configureClient();
-}
-
-QGeoPositionInfo QGeoPositionInfoSourceGeoclue2::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- if (fromSatellitePositioningMethodsOnly && !m_lastPositionFromSatellite)
- return QGeoPositionInfo();
- return m_lastPosition;
-}
-
-QGeoPositionInfoSourceGeoclue2::PositioningMethods QGeoPositionInfoSourceGeoclue2::supportedPositioningMethods() const
-{
- bool ok;
- const auto accuracy = m_manager.property("AvailableAccuracyLevel").toUInt(&ok);
- if (!ok) {
- const_cast<QGeoPositionInfoSourceGeoclue2 *>(this)->setError(AccessError);
- return NoPositioningMethods;
- }
-
- switch (accuracy) {
- case GCLUE_ACCURACY_LEVEL_COUNTRY:
- case GCLUE_ACCURACY_LEVEL_CITY:
- case GCLUE_ACCURACY_LEVEL_NEIGHBORHOOD:
- case GCLUE_ACCURACY_LEVEL_STREET:
- return NonSatellitePositioningMethods;
- case GCLUE_ACCURACY_LEVEL_EXACT:
- return AllPositioningMethods;
- case GCLUE_ACCURACY_LEVEL_NONE:
- default:
- return NoPositioningMethods;
- }
-}
-
-void QGeoPositionInfoSourceGeoclue2::setPreferredPositioningMethods(PositioningMethods methods)
-{
- QGeoPositionInfoSource::setPreferredPositioningMethods(methods);
- configureClient();
-}
-
-int QGeoPositionInfoSourceGeoclue2::minimumUpdateInterval() const
-{
- return MINIMUM_UPDATE_INTERVAL;
-}
-
-QGeoPositionInfoSource::Error QGeoPositionInfoSourceGeoclue2::error() const
-{
- return m_error;
-}
-
-void QGeoPositionInfoSourceGeoclue2::startUpdates()
-{
- if (m_running) {
- qCWarning(lcPositioningGeoclue2) << "Already running";
- return;
- }
-
- qCDebug(lcPositioningGeoclue2) << "Starting updates";
-
- m_error = QGeoPositionInfoSource::NoError;
-
- m_running = true;
-
- startClient();
-
- if (m_lastPosition.isValid()) {
- QMetaObject::invokeMethod(this, "positionUpdated", Qt::QueuedConnection,
- Q_ARG(QGeoPositionInfo, m_lastPosition));
- }
-}
-
-void QGeoPositionInfoSourceGeoclue2::stopUpdates()
-{
- if (!m_running) {
- qCWarning(lcPositioningGeoclue2) << "Already stopped";
- return;
- }
-
- qCDebug(lcPositioningGeoclue2) << "Stopping updates";
- m_running = false;
-
- stopClient();
-}
-
-void QGeoPositionInfoSourceGeoclue2::requestUpdate(int timeout)
-{
- if (m_requestTimer->isActive()) {
- qCDebug(lcPositioningGeoclue2) << "Request timer was active, ignoring startUpdates";
- return;
- }
-
- m_error = QGeoPositionInfoSource::NoError;
-
- if (timeout < minimumUpdateInterval() && timeout != 0) {
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
- return;
- }
-
- m_requestTimer->start(timeout ? timeout : UPDATE_TIMEOUT_COLD_START);
- startClient();
-}
-
-void QGeoPositionInfoSourceGeoclue2::setError(QGeoPositionInfoSource::Error error)
-{
- m_error = error;
- if (m_error != QGeoPositionInfoSource::NoError)
- emit QGeoPositionInfoSource::errorOccurred(m_error);
-}
-
-void QGeoPositionInfoSourceGeoclue2::restoreLastPosition()
-{
-#if !defined(QT_NO_DATASTREAM)
- const auto filePath = lastPositionFilePath();
- QFile file(filePath);
- if (file.open(QIODevice::ReadOnly)) {
- QDataStream out(&file);
- out >> m_lastPosition;
- }
-#endif
-}
-
-void QGeoPositionInfoSourceGeoclue2::saveLastPosition()
-{
-#if !defined(QT_NO_DATASTREAM) && QT_CONFIG(temporaryfile)
- if (!m_lastPosition.isValid())
- return;
-
- const auto filePath = lastPositionFilePath();
- QSaveFile file(filePath);
- if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- QDataStream out(&file);
- // Only save position and timestamp.
- out << QGeoPositionInfo(m_lastPosition.coordinate(), m_lastPosition.timestamp());
- file.commit();
- }
-#endif
-}
-
-void QGeoPositionInfoSourceGeoclue2::createClient()
-{
- const QDBusPendingReply<QDBusObjectPath> reply = m_manager.GetClient();
- const auto watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, &QDBusPendingCallWatcher::finished,
- [this](QDBusPendingCallWatcher *watcher) {
- const QScopedPointer<QDBusPendingCallWatcher, QScopedPointerDeleteLater>
- scopedWatcher(watcher);
- const QDBusPendingReply<QDBusObjectPath> reply = *scopedWatcher;
- if (reply.isError()) {
- const auto error = reply.error();
- qCWarning(lcPositioningGeoclue2) << "Unable to obtain the client patch:"
- << error.name() + error.message();
- setError(AccessError);
- } else {
- const QString clientPath = reply.value().path();
- qCDebug(lcPositioningGeoclue2) << "Client path is:"
- << clientPath;
- delete m_client;
- m_client = new OrgFreedesktopGeoClue2ClientInterface(
- QLatin1String(GEOCLUE2_SERVICE_NAME),
- clientPath,
- QDBusConnection::systemBus(),
- this);
- if (!m_client->isValid()) {
- const auto error = m_client->lastError();
- qCCritical(lcPositioningGeoclue2) << "Unable to create the client object:"
- << error.name() << error.message();
- setError(AccessError);
- delete m_client;
- } else {
- connect(m_client.data(), &OrgFreedesktopGeoClue2ClientInterface::LocationUpdated,
- this, &QGeoPositionInfoSourceGeoclue2::handleNewLocation);
-
- if (configureClient())
- startClient();
- }
- }
- });
-}
-
-void QGeoPositionInfoSourceGeoclue2::startClient()
-{
- // only start the client if someone asked for it already
- if (!m_running && !m_requestTimer->isActive())
- return;
-
- if (!m_client) {
- createClient();
- return;
- }
-
- const QDBusPendingReply<> reply = m_client->Start();
- const auto watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, &QDBusPendingCallWatcher::finished,
- [this](QDBusPendingCallWatcher *watcher) {
- const QScopedPointer<QDBusPendingCallWatcher, QScopedPointerDeleteLater>
- scopedWatcher(watcher);
- const QDBusPendingReply<> reply = *scopedWatcher;
- if (reply.isError()) {
- const auto error = reply.error();
- qCCritical(lcPositioningGeoclue2) << "Unable to start the client:"
- << error.name() << error.message();
- setError(AccessError);
- delete m_client;
- } else {
- qCDebug(lcPositioningGeoclue2) << "Client successfully started";
-
- const QDBusObjectPath location = m_client->location();
- const QString path = location.path();
- if (path.isEmpty() || path == QLatin1String("/"))
- return;
-
- handleNewLocation({}, location);
- }
- });
-}
-
-void QGeoPositionInfoSourceGeoclue2::stopClient()
-{
- // Only stop client if updates are no longer wanted.
- if (m_requestTimer->isActive() || m_running || !m_client)
- return;
-
- const QDBusPendingReply<> reply = m_client->Stop();
- const auto watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, &QDBusPendingCallWatcher::finished,
- [this](QDBusPendingCallWatcher *watcher) {
- const QScopedPointer<QDBusPendingCallWatcher, QScopedPointerDeleteLater>
- scopedWatcher(watcher);
- const QDBusPendingReply<> reply = *scopedWatcher;
- if (reply.isError()) {
- const auto error = reply.error();
- qCCritical(lcPositioningGeoclue2) << "Unable to stop the client:"
- << error.name() << error.message();
- setError(AccessError);
- } else {
- qCDebug(lcPositioningGeoclue2) << "Client successfully stopped";
- }
- delete m_client;
- });
-}
-
-bool QGeoPositionInfoSourceGeoclue2::configureClient()
-{
- if (!m_client)
- return false;
-
- if (m_desktopId.isEmpty()) {
- qCCritical(lcPositioningGeoclue2)
- << "Unable to configure the client due to the desktop id is not set via"
- << desktopIdParameter << "plugin parameter or QCoreApplication::applicationName";
- setError(AccessError);
- return false;
- }
-
- m_client->setDesktopId(m_desktopId);
-
- const auto msecs = updateInterval();
- const uint secs = qMax(uint(msecs), 0u) / 1000u;
- m_client->setTimeThreshold(secs);
-
- const auto methods = preferredPositioningMethods();
- switch (methods) {
- case SatellitePositioningMethods:
- m_client->setRequestedAccuracyLevel(GCLUE_ACCURACY_LEVEL_EXACT);
- break;
- case NonSatellitePositioningMethods:
- m_client->setRequestedAccuracyLevel(GCLUE_ACCURACY_LEVEL_STREET);
- break;
- case AllPositioningMethods:
- m_client->setRequestedAccuracyLevel(GCLUE_ACCURACY_LEVEL_EXACT);
- break;
- default:
- m_client->setRequestedAccuracyLevel(GCLUE_ACCURACY_LEVEL_NONE);
- break;
- }
-
- return true;
-}
-
-void QGeoPositionInfoSourceGeoclue2::requestUpdateTimeout()
-{
- qCDebug(lcPositioningGeoclue2) << "Request update timeout occurred";
-
- setError(QGeoPositionInfoSource::UpdateTimeoutError);
-
- stopClient();
-}
-
-void QGeoPositionInfoSourceGeoclue2::handleNewLocation(const QDBusObjectPath &oldLocation,
- const QDBusObjectPath &newLocation)
-{
- if (m_requestTimer->isActive())
- m_requestTimer->stop();
-
- const auto oldPath = oldLocation.path();
- const auto newPath = newLocation.path();
- qCDebug(lcPositioningGeoclue2) << "Old location object path:" << oldPath;
- qCDebug(lcPositioningGeoclue2) << "New location object path:" << newPath;
-
- OrgFreedesktopGeoClue2LocationInterface location(
- QLatin1String(GEOCLUE2_SERVICE_NAME),
- newPath,
- QDBusConnection::systemBus(),
- this);
- if (!location.isValid()) {
- const auto error = location.lastError();
- qCCritical(lcPositioningGeoclue2) << "Unable to create the location object:"
- << error.name() << error.message();
- } else {
- QGeoCoordinate coordinate(location.latitude(),
- location.longitude());
- if (const auto altitude = location.altitude() > std::numeric_limits<double>::min())
- coordinate.setAltitude(altitude);
-
- const Timestamp ts = location.timestamp();
- if (ts.m_seconds == 0 && ts.m_microseconds == 0) {
- const auto dt = QDateTime::currentDateTime();
- m_lastPosition = QGeoPositionInfo(coordinate, dt);
- } else {
- auto dt = QDateTime::fromSecsSinceEpoch(qint64(ts.m_seconds));
- dt = dt.addMSecs(ts.m_microseconds / 1000);
- m_lastPosition = QGeoPositionInfo(coordinate, dt);
- }
-
- const auto accuracy = location.accuracy();
- // We assume that an accuracy as 0.0 means that it comes from a sattelite.
- m_lastPositionFromSatellite = qFuzzyCompare(accuracy, 0.0);
-
- m_lastPosition.setAttribute(QGeoPositionInfo::HorizontalAccuracy, accuracy);
- if (const auto speed = location.speed() >= 0.0)
- m_lastPosition.setAttribute(QGeoPositionInfo::GroundSpeed, speed);
- if (const auto heading = location.heading() >= 0.0)
- m_lastPosition.setAttribute(QGeoPositionInfo::Direction, heading);
-
- emit positionUpdated(m_lastPosition);
- qCDebug(lcPositioningGeoclue2) << "New position:" << m_lastPosition;
- }
-
- stopClient();
-}
-
-void QGeoPositionInfoSourceGeoclue2::parseParameters(const QVariantMap &parameters)
-{
- if (parameters.contains(desktopIdParameter))
- m_desktopId = parameters.value(desktopIdParameter).toString();
-
- if (m_desktopId.isEmpty())
- m_desktopId = QCoreApplication::applicationName();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2_p.h b/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2_p.h
deleted file mode 100644
index f5ec2b06..00000000
--- a/src/plugins/position/geoclue2/qgeopositioninfosource_geoclue2_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** 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_GEOCLUE2_P_H
-#define QGEOPOSITIONINFOSOURCE_GEOCLUE2_P_H
-
-#include <QtPositioning/QGeoPositionInfoSource>
-#include <QtCore/QPointer>
-#include <manager_interface.h>
-
-class OrgFreedesktopGeoClue2ClientInterface;
-
-QT_BEGIN_NAMESPACE
-class QDBusObjectPath;
-class QTimer;
-
-class QGeoPositionInfoSourceGeoclue2 : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- explicit QGeoPositionInfoSourceGeoclue2(const QVariantMap &parameters,
- QObject *parent = nullptr);
- ~QGeoPositionInfoSourceGeoclue2();
-
- // From QGeoPositionInfoSource
- void setUpdateInterval(int msec) override;
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
- PositioningMethods supportedPositioningMethods() const override;
- void setPreferredPositioningMethods(PositioningMethods methods) override;
- int minimumUpdateInterval() const override;
-
- Error error() const override;
-
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 5000) override;
-
-private:
- void setError(QGeoPositionInfoSource::Error error);
- void restoreLastPosition();
- void saveLastPosition();
- void createClient();
- bool configureClient();
- void startClient();
- void stopClient();
- void requestUpdateTimeout();
- void handleNewLocation(const QDBusObjectPath &oldLocation,
- const QDBusObjectPath &newLocation);
- void parseParameters(const QVariantMap &parameters);
-
- QTimer *m_requestTimer = nullptr;
- OrgFreedesktopGeoClue2ManagerInterface m_manager;
- QPointer<OrgFreedesktopGeoClue2ClientInterface> m_client;
- bool m_running = false;
- bool m_lastPositionFromSatellite = false;
- QGeoPositionInfoSource::Error m_error = NoError;
- QGeoPositionInfo m_lastPosition;
- QString m_desktopId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCE_GEOCLUE2_P_H
diff --git a/src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.cpp b/src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.cpp
deleted file mode 100644
index 68161f41..00000000
--- a/src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** 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_geoclue2_p.h"
-#include "qgeopositioninfosourcefactory_geoclue2.h"
-
-#include <QtCore/QLoggingCategory>
-
-Q_LOGGING_CATEGORY(lcPositioningGeoclue2, "qt.positioning.geoclue2")
-
-QT_BEGIN_NAMESPACE
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryGeoclue2::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parameters)
- return new QGeoPositionInfoSourceGeoclue2(parameters, parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryGeoclue2::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryGeoclue2::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.h b/src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.h
deleted file mode 100644
index 1cd72fff..00000000
--- a/src/plugins/position/geoclue2/qgeopositioninfosourcefactory_geoclue2.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Denis Shienkov <denis.shienkov@gmail.com>
-** Contact: http://www.qt-project.org/legal
-**
-** 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_GEOCLUE2_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_GEOCLUE2_H
-
-#include <QtCore/QObject>
-#include <QtPositioning/QGeoPositionInfoSourceFactory>
-
-QT_BEGIN_NAMESPACE
-
-/*
- Qt Positioning plugin for Geoclue. This plugin supports Geoclue version 2.x.
-*/
-class QGeoPositionInfoSourceFactoryGeoclue2 : 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;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCEFACTORY_GEOCLUE2_H
diff --git a/src/plugins/position/gypsy/CMakeLists.txt b/src/plugins/position/gypsy/CMakeLists.txt
deleted file mode 100644
index 1791bdcc..00000000
--- a/src/plugins/position/gypsy/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-# Generated from gypsy.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryGypsy Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryGypsyPlugin
- OUTPUT_NAME qtposition_gypsy
- CLASS_NAME QGeoPositionInfoSourceFactoryGypsy
- PLUGIN_TYPE position
- SOURCES
- qgeopositioninfosourcefactory_gypsy.cpp qgeopositioninfosourcefactory_gypsy.h
- qgeosatelliteinfosource_gypsy.cpp qgeosatelliteinfosource_gypsy_p.h
-# special case begin
- LIBRARIES
- Gypsy::Gypsy
- Gconf::Gconf
- Qt::Core
- Qt::Positioning
-# special case end
-)
-
-#### Keys ignored in scope 1:.:.:gypsy.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/position/gypsy/gypsy.pro b/src/plugins/position/gypsy/gypsy.pro
deleted file mode 100644
index c7b74325..00000000
--- a/src/plugins/position/gypsy/gypsy.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGET = qtposition_gypsy
-
-QT = core positioning-private
-
-HEADERS += \
- qgeosatelliteinfosource_gypsy_p.h \
- qgeopositioninfosourcefactory_gypsy.h
-
-SOURCES += \
- qgeosatelliteinfosource_gypsy.cpp \
- qgeopositioninfosourcefactory_gypsy.cpp
-
-QMAKE_USE_PRIVATE += gypsy
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryGypsy
-load(qt_plugin)
diff --git a/src/plugins/position/gypsy/plugin.json b/src/plugins/position/gypsy/plugin.json
deleted file mode 100644
index 9cef03f8..00000000
--- a/src/plugins/position/gypsy/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["gypsy"],
- "Provider": "gypsy",
- "Position": false,
- "Satellite": true,
- "Monitor" : false,
- "Priority": 1000,
- "Testable": false
-}
diff --git a/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp b/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp
deleted file mode 100644
index be7634cd..00000000
--- a/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosourcefactory_gypsy.h"
-#include "qgeosatelliteinfosource_gypsy_p.h"
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryGypsy::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryGypsy::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parameters)
- QGeoSatelliteInfoSourceGypsy *src = new QGeoSatelliteInfoSourceGypsy(parent);
- if (src->init(parameters) < 0) {
- delete src;
- src = nullptr;
- }
- return src;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryGypsy::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
diff --git a/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h b/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h
deleted file mode 100644
index 495301fd..00000000
--- a/src/plugins/position/gypsy/qgeopositioninfosourcefactory_gypsy.h
+++ /dev/null
@@ -1,59 +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_GYPSY_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_GYPSY_H
-
-#include <QObject>
-#include <qgeopositioninfosourcefactory.h>
-
-class QGeoPositionInfoSourceFactoryGypsy : 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;
-};
-
-#endif
diff --git a/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
deleted file mode 100644
index b7f91131..00000000
--- a/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy.cpp
+++ /dev/null
@@ -1,442 +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_gypsy_p.h"
-
-#ifdef Q_LOCATION_GYPSY_DEBUG
-#include <QDebug>
-#endif
-#include <QFile>
-#include <QVariantMap>
-
-QT_BEGIN_NAMESPACE
-
-#define UPDATE_TIMEOUT_COLD_START 120000
-
-static const auto deviceNameParameter = "deviceName";
-static const auto gconfKeyParameter = "gconfKey";
-static const auto defaultGconfKey = "/apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice";
-
-// Callback function for 'satellites-changed' -signal
-static void satellites_changed (GypsySatellite *satellite,
- GPtrArray *satellites,
- gpointer userdata)
-{
-#ifdef Q_LOCATION_GYPSY_DEBUG
- qDebug() << "QGeoSatelliteInfoSourceGypsy Gypsy satellites-changed -signal received.";
-#endif
- ((QGeoSatelliteInfoSourceGypsy *)userdata)->satellitesChanged(satellite, satellites);
-}
-
-SatelliteGypsyEngine::SatelliteGypsyEngine(QGeoSatelliteInfoSource *parent) :
- m_owner(parent)
-{
-}
-SatelliteGypsyEngine::~SatelliteGypsyEngine()
-{
-}
-
-// Glib symbols
-gulong SatelliteGypsyEngine::eng_g_signal_connect(gpointer instance,
- const gchar *detailed_signal,
- GCallback c_handler,
- gpointer data)
-{
- return ::g_signal_connect(instance, detailed_signal, c_handler, data);
-}
-guint SatelliteGypsyEngine::eng_g_signal_handlers_disconnect_by_func (gpointer instance,
- gpointer func,
- gpointer data)
-{
- return ::g_signal_handlers_disconnect_by_func(instance, func, data);
-}
-
-void SatelliteGypsyEngine::eng_g_free(gpointer mem)
-{
- return ::g_free(mem);
-}
-// Gypsy symbols
-GypsyControl *SatelliteGypsyEngine::eng_gypsy_control_get_default (void)
-{
- return ::gypsy_control_get_default();
-}
-char *SatelliteGypsyEngine::eng_gypsy_control_create (GypsyControl *control, const char *device_name, GError **error)
-{
- return ::gypsy_control_create(control, device_name, error);
-}
-GypsyDevice *SatelliteGypsyEngine::eng_gypsy_device_new (const char *object_path)
-{
- return ::gypsy_device_new(object_path);
-}
-GypsySatellite *SatelliteGypsyEngine::eng_gypsy_satellite_new (const char *object_path)
-{
- return ::gypsy_satellite_new (object_path);
-}
-gboolean SatelliteGypsyEngine::eng_gypsy_device_start (GypsyDevice *device, GError **error)
-{
- return ::gypsy_device_start(device, error);
-}
-gboolean SatelliteGypsyEngine::eng_gypsy_device_stop (GypsyDevice *device, GError **error)
-{
- // Unfortunately this cannot be done; calling this will stop the GPS device
- // (basically makes gypsy-daemon unusable for anyone), regardless of applications
- // using it (see bug http://bugs.meego.com/show_bug.cgi?id=11707).
- Q_UNUSED(device);
- Q_UNUSED(error);
- return true;
- //return ::gypsy_device_stop (device, error);
-}
-GypsyDeviceFixStatus SatelliteGypsyEngine::eng_gypsy_device_get_fix_status (GypsyDevice *device, GError **error)
-{
- return ::gypsy_device_get_fix_status (device, error);
-}
-GPtrArray *SatelliteGypsyEngine::eng_gypsy_satellite_get_satellites (GypsySatellite *satellite, GError **error)
-{
- return ::gypsy_satellite_get_satellites (satellite, error);
-}
-void SatelliteGypsyEngine::eng_gypsy_satellite_free_satellite_array (GPtrArray *satellites)
-{
- return ::gypsy_satellite_free_satellite_array(satellites);
-}
-// GConf symbols (mockability due to X11 requirement)
-GConfClient *SatelliteGypsyEngine::eng_gconf_client_get_default(void)
-{
- return ::gconf_client_get_default();
-}
-gchar *SatelliteGypsyEngine::eng_gconf_client_get_string(GConfClient *client, const gchar *key, GError** err)
-{
- return ::gconf_client_get_string(client, key, err);
-}
-
-QGeoSatelliteInfoSourceGypsy::QGeoSatelliteInfoSourceGypsy(QObject *parent)
- : QGeoSatelliteInfoSource(parent), m_engine(0), m_satellite(0), m_device(0),
- m_requestTimer(this), m_updatesOngoing(false), m_requestOngoing(false)
-{
- m_requestTimer.setSingleShot(true);
- QObject::connect(&m_requestTimer, SIGNAL(timeout()), this, SLOT(requestUpdateTimeout()));
-}
-
-void QGeoSatelliteInfoSourceGypsy::createEngine()
-{
- delete m_engine;
- m_engine = new SatelliteGypsyEngine(this);
-}
-
-QGeoSatelliteInfoSourceGypsy::~QGeoSatelliteInfoSourceGypsy()
-{
- GError *error = NULL;
- if (m_device) {
- m_engine->eng_gypsy_device_stop (m_device, &error);
- g_object_unref(m_device);
- }
- if (m_satellite)
- g_object_unref(m_satellite);
- if (m_control)
- g_object_unref(m_control);
- if (error)
- g_error_free(error);
- delete m_engine;
-}
-
-static QGeoSatelliteInfo::SatelliteSystem idToSystem(int prn)
-{
- if (prn >= 1 && prn <= 32)
- return QGeoSatelliteInfo::GPS;
- else if (prn >= 65 && prn <= 96)
- return QGeoSatelliteInfo::GLONASS;
- else if (prn >= 193 && prn <= 200)
- return QGeoSatelliteInfo::QZSS;
- else if ((prn >= 201 && prn <= 235) || (prn >= 401 && prn <= 437))
- return QGeoSatelliteInfo::BEIDOU;
- else if (prn >= 301 && prn <= 336)
- return QGeoSatelliteInfo::GALILEO;
- return QGeoSatelliteInfo::Undefined;
-}
-
-void QGeoSatelliteInfoSourceGypsy::satellitesChanged(GypsySatellite *satellite,
- GPtrArray *satellites)
-{
- if (!satellite || !satellites)
- return;
- // We have satellite data and assume it is valid.
- // If a single updateRequest was active, send signals right away.
- // If a periodic timer was running (meaning that the client wishes
- // to have updates at defined intervals), store the data for later sending.
- QList<QGeoSatelliteInfo> lastSatellitesInView;
- QList<QGeoSatelliteInfo> lastSatellitesInUse;
-
- unsigned int i;
- for (i = 0; i < satellites->len; i++) {
- GypsySatelliteDetails *details = (GypsySatelliteDetails *)satellites->pdata[i];
- QGeoSatelliteInfo info;
- info.setSatelliteIdentifier(details->satellite_id);
- info.setSatelliteSystem(idToSystem(details->satellite_id));
- info.setAttribute(QGeoSatelliteInfo::Elevation, details->elevation);
- info.setAttribute(QGeoSatelliteInfo::Azimuth, details->azimuth);
- info.setSignalStrength(details->snr);
- if (details->in_use)
- lastSatellitesInUse.append(info);
- lastSatellitesInView.append(info);
- }
- bool sendUpdates(false);
- // If a single updateRequest() has been issued:
- if (m_requestOngoing) {
- sendUpdates = true;
- m_requestTimer.stop();
- m_requestOngoing = false;
- // If there is no regular updates ongoing, disconnect now.
- if (!m_updatesOngoing) {
- m_engine->eng_g_signal_handlers_disconnect_by_func(G_OBJECT(m_satellite), (void *)satellites_changed, this);
- }
- }
- // If regular updates are to be delivered as they come:
- if (m_updatesOngoing)
- sendUpdates = true;
-
- if (sendUpdates) {
- emit satellitesInUseUpdated(lastSatellitesInUse);
- emit satellitesInViewUpdated(lastSatellitesInView);
- }
-}
-
-QString QGeoSatelliteInfoSourceGypsy::extractDeviceNameFromParameters(const QVariantMap &parameters) const
-{
- // The logic is as follows:
- // 1. If the deviceNameParameter is specified, its value is used to get the
- // device name.
- // 2. If the gconfKeyParameter is specified, its value is used as a key to
- // extract the device name from GConf.
- // 3. If nothing is specified, defaultGconfKey is used as a key to extract
- // the device name from GConf.
- if (parameters.contains(deviceNameParameter))
- return parameters.value(deviceNameParameter).toString();
-
- QString gconfKey = parameters.value(gconfKeyParameter).toString();
- if (gconfKey.isEmpty())
- gconfKey = defaultGconfKey;
-
- if (!m_engine)
- return QString();
-
- GConfClient *client = m_engine->eng_gconf_client_get_default();
- if (!client)
- return QString();
-
- gchar *device_name = m_engine->eng_gconf_client_get_string(client,
- gconfKey.toLatin1().constData(),
- nullptr);
- g_object_unref(client);
-
- const QString deviceName = QString::fromLatin1(device_name);
- m_engine->eng_g_free(device_name);
-
- return deviceName;
-}
-
-int QGeoSatelliteInfoSourceGypsy::init(const QVariantMap parameters)
-{
- GError *error = NULL;
- char *path;
-
-#if !GLIB_CHECK_VERSION(2, 36, 0)
- g_type_init (); // this function was deprecated in glib 2.36
-#endif
- createEngine();
-
- const QString deviceName = extractDeviceNameFromParameters(parameters);
-
- if (deviceName.isEmpty() ||
- (deviceName.trimmed().at(0) == '/' && !QFile::exists(deviceName.trimmed()))) {
- qWarning ("QGeoSatelliteInfoSourceGypsy Empty/nonexistent GPS device name detected.");
- qWarning("Use '%s' plugin parameter to specify device name directly", deviceNameParameter);
- qWarning("or use '%s' plugin parameter to specify a GConf key to extract the device name.",
- gconfKeyParameter);
- qWarning ("If the GConf key is used, the gconftool-2 tool can be used to set device name "
- "for the selected key, e.g. on terminal:");
- qWarning ("gconftool-2 -t string -s %s /dev/ttyUSB0", gconfKeyParameter);
- return -1;
- }
- m_control = m_engine->eng_gypsy_control_get_default();
- if (!m_control) {
- qWarning("QGeoSatelliteInfoSourceGypsy unable to create Gypsy control.");
- return -1;
- }
- // (path is the DBus path)
- path = m_engine->eng_gypsy_control_create(m_control, deviceName.toLatin1().constData(), &error);
- if (!path) {
- qWarning ("QGeoSatelliteInfoSourceGypsy error creating client.");
- if (error) {
- qWarning ("error message: %s", error->message);
- g_error_free (error);
- }
- return -1;
- }
- m_device = m_engine->eng_gypsy_device_new (path);
- m_satellite = m_engine->eng_gypsy_satellite_new (path);
- m_engine->eng_g_free(path);
- if (!m_device || !m_satellite) {
- qWarning ("QGeoSatelliteInfoSourceGypsy error creating satellite device.");
- qWarning ("Please check that the GPS device is specified correctly.");
- qWarning("Use '%s' plugin parameter to specify device name directly", deviceNameParameter);
- qWarning("or use '%s' plugin parameter to specify a GConf key to extract the device name.",
- gconfKeyParameter);
- qWarning ("If the GConf key is used, the gconftool-2 tool can be used to set device name "
- "for the selected key, e.g. on terminal:");
- qWarning ("gconftool-2 -t string -s %s /dev/ttyUSB0", gconfKeyParameter);
- if (m_device)
- g_object_unref(m_device);
- if (m_satellite)
- g_object_unref(m_satellite);
- return -1;
- }
- m_engine->eng_gypsy_device_start (m_device, &error);
- if (error) {
- qWarning ("QGeoSatelliteInfoSourceGypsy error starting device: %s ",
- error->message);
- g_error_free(error);
- g_object_unref(m_device);
- g_object_unref(m_satellite);
- return -1;
- }
- return 0;
-}
-
-int QGeoSatelliteInfoSourceGypsy::minimumUpdateInterval() const
-{
- return 1;
-}
-
-QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceGypsy::error() const
-{
- return m_error;
-}
-
-void QGeoSatelliteInfoSourceGypsy::startUpdates()
-{
- if (m_updatesOngoing)
- return;
-
- m_error = QGeoSatelliteInfoSource::NoError;
-
- // If there is a request timer ongoing, we've connected to the signal already
- if (!m_requestTimer.isActive()) {
- m_engine->eng_g_signal_connect (m_satellite, "satellites-changed",
- G_CALLBACK (satellites_changed), this);
- }
- m_updatesOngoing = true;
-}
-
-void QGeoSatelliteInfoSourceGypsy::stopUpdates()
-{
- if (!m_updatesOngoing)
- return;
- m_updatesOngoing = false;
- // Disconnect only if there is no single update request ongoing. Once single update request
- // is completed and it notices that there is no active update ongoing, it will disconnect
- // the signal.
- if (!m_requestTimer.isActive())
- m_engine->eng_g_signal_handlers_disconnect_by_func(G_OBJECT(m_satellite), (void *)satellites_changed, this);
-}
-
-void QGeoSatelliteInfoSourceGypsy::requestUpdate(int timeout)
-{
- if (m_requestOngoing)
- return;
-
- m_error = QGeoSatelliteInfoSource::NoError;
-
- if (timeout < 0) {
- setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
- return;
- }
- m_requestOngoing = true;
- GError *error = 0;
- // If GPS has a fix a already, request current data.
- GypsyDeviceFixStatus fixStatus = m_engine->eng_gypsy_device_get_fix_status(m_device, &error);
- if (!error && (fixStatus != GYPSY_DEVICE_FIX_STATUS_INVALID &&
- fixStatus != GYPSY_DEVICE_FIX_STATUS_NONE)) {
-#ifdef Q_LOCATION_GYPSY_DEBUG
- qDebug() << "QGeoSatelliteInfoSourceGypsy fix available, requesting current satellite data";
-#endif
- GPtrArray *satelliteData = m_engine->eng_gypsy_satellite_get_satellites(m_satellite, &error);
- if (!error) {
- // The fix was available and we have satellite data to deliver right away.
- satellitesChanged(m_satellite, satelliteData);
- m_engine->eng_gypsy_satellite_free_satellite_array(satelliteData);
- return;
- }
- }
- // No fix is available. If updates are not ongoing already, start them.
- m_requestTimer.setInterval(timeout == 0? UPDATE_TIMEOUT_COLD_START: timeout);
- if (!m_updatesOngoing) {
- m_engine->eng_g_signal_connect (m_satellite, "satellites-changed",
- G_CALLBACK (satellites_changed), this);
- }
- m_requestTimer.start();
- if (error) {
-#ifdef Q_LOCATION_GYPSY_DEBUG
- qDebug() << "QGeoSatelliteInfoSourceGypsy error asking fix status or satellite data: " << error->message;
-#endif
- g_error_free(error);
- }
-}
-
-void QGeoSatelliteInfoSourceGypsy::requestUpdateTimeout()
-{
-#ifdef Q_LOCATION_GYPSY_DEBUG
- qDebug("QGeoSatelliteInfoSourceGypsy request update timeout occurred.");
-#endif
- // If we end up here, there has not been valid satellite update.
- // Emit timeout and disconnect from signal if regular updates are not
- // ongoing (as we were listening just for one single requestUpdate).
- if (!m_updatesOngoing) {
- m_engine->eng_g_signal_handlers_disconnect_by_func(G_OBJECT(m_satellite), (void *)satellites_changed, this);
- }
- m_requestOngoing = false;
- setError(QGeoSatelliteInfoSource::UpdateTimeoutError);
-}
-
-void QGeoSatelliteInfoSourceGypsy::setError(QGeoSatelliteInfoSource::Error error)
-{
- m_error = error;
- if (m_error != QGeoSatelliteInfoSource::NoError)
- emit QGeoSatelliteInfoSource::errorOccurred(m_error);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h b/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h
deleted file mode 100644
index c9d1de71..00000000
--- a/src/plugins/position/gypsy/qgeosatelliteinfosource_gypsy_p.h
+++ /dev/null
@@ -1,143 +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_GYPSY_H
-#define QGEOSATELLITEINFOSOURCE_GYPSY_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 "qgeosatelliteinfosource.h"
-#include "qgeosatelliteinfo.h"
-#include <gypsy/gypsy-satellite.h>
-#include <gypsy/gypsy-control.h>
-#include <gypsy/gypsy-device.h>
-#include <gconf/gconf-client.h>
-#include <QTimer>
-
-// #define Q_LOCATION_GYPSY_DEBUG
-
-QT_BEGIN_NAMESPACE
-
-// An engine that encapsulates all symbols we want
-// to be able to mock (for unit/autotest purposes).
-class SatelliteGypsyEngine
-{
-public:
- SatelliteGypsyEngine(QGeoSatelliteInfoSource *parent = 0);
- virtual ~SatelliteGypsyEngine();
- // Glib symbols
- virtual gulong eng_g_signal_connect(gpointer instance,
- const gchar *detailed_signal,
- GCallback c_handler,
- gpointer data);
- virtual guint eng_g_signal_handlers_disconnect_by_func(gpointer instance,
- gpointer func,
- gpointer data);
- virtual void eng_g_free(gpointer mem);
- // Gypsy symbols
- virtual GypsyControl *eng_gypsy_control_get_default (void);
- virtual char *eng_gypsy_control_create (GypsyControl *control, const char *device_name, GError **error);
- virtual GypsyDevice *eng_gypsy_device_new (const char *object_path);
- virtual GypsySatellite *eng_gypsy_satellite_new (const char *object_path);
- virtual gboolean eng_gypsy_device_start (GypsyDevice *device, GError **error);
- virtual gboolean eng_gypsy_device_stop (GypsyDevice *device, GError **error);
- virtual GypsyDeviceFixStatus eng_gypsy_device_get_fix_status (GypsyDevice *device, GError **error);
- virtual GPtrArray *eng_gypsy_satellite_get_satellites (GypsySatellite *satellite, GError **error);
- virtual void eng_gypsy_satellite_free_satellite_array (GPtrArray *satellites);
- // GConf symbols (mockability due to X11 requirement)
- virtual GConfClient *eng_gconf_client_get_default(void);
- virtual gchar *eng_gconf_client_get_string(GConfClient *client, const gchar *key, GError** err);
-protected:
- QGeoSatelliteInfoSource *m_owner;
-};
-
-class QGeoSatelliteInfoSourceGypsy : public QGeoSatelliteInfoSource
- {
- Q_OBJECT
-
-public:
- explicit QGeoSatelliteInfoSourceGypsy(QObject *parent = 0);
- ~QGeoSatelliteInfoSourceGypsy();
- int init(const QVariantMap parameters);
-
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-public slots:
- virtual void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 5000) override;
- void satellitesChanged(GypsySatellite *satellite, GPtrArray *satellites);
-
-private slots:
- void requestUpdateTimeout();
-
-private:
- void setError(QGeoSatelliteInfoSource::Error error);
- QString extractDeviceNameFromParameters(const QVariantMap &parameters) const;
-
-protected:
- // Creates an engine which encapsulates all used symbols
- // that we want to be also able to mock.
- virtual void createEngine();
- SatelliteGypsyEngine *m_engine;
-
-private:
- Q_DISABLE_COPY(QGeoSatelliteInfoSourceGypsy)
- GypsySatellite *m_satellite;
- GypsyDevice *m_device;
- QTimer m_requestTimer;
- bool m_updatesOngoing;
- bool m_requestOngoing;
- QGeoSatelliteInfoSource::Error m_error = QGeoSatelliteInfoSource::NoError;
- GypsyControl *m_control = nullptr;
- };
-
-QT_END_NAMESPACE
-
-#endif // QGEOSATELLITEINFOSOURCE_GYPSY_H
diff --git a/src/plugins/position/nmea/CMakeLists.txt b/src/plugins/position/nmea/CMakeLists.txt
deleted file mode 100644
index 73c5a3b1..00000000
--- a/src/plugins/position/nmea/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from nmea.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryNmea Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryNmeaPlugin
- OUTPUT_NAME qtposition_nmea
- CLASS_NAME QGeoPositionInfoSourceFactoryNmea
- PLUGIN_TYPE position
- SOURCES
- qgeopositioninfosourcefactory_nmea.cpp qgeopositioninfosourcefactory_nmea.h
- qiopipe.cpp qiopipe_p.h
- LIBRARIES
- Qt::CorePrivate
- Qt::Positioning
- Qt::SerialPort
- Qt::Network
-)
-
-#### Keys ignored in scope 1:.:.:serialnmea.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/position/nmea/nmea.pro b/src/plugins/position/nmea/nmea.pro
deleted file mode 100644
index f52d8812..00000000
--- a/src/plugins/position/nmea/nmea.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qtposition_nmea
-
-QT = core-private positioning-private serialport
-
-HEADERS += \
- qgeopositioninfosourcefactory_nmea.h qiopipe_p.h
-
-SOURCES += \
- qgeopositioninfosourcefactory_nmea.cpp qiopipe.cpp
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryNmea
-load(qt_plugin)
diff --git a/src/plugins/position/nmea/plugin.json b/src/plugins/position/nmea/plugin.json
deleted file mode 100644
index 15d22f1f..00000000
--- a/src/plugins/position/nmea/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["nmea"],
- "Provider": "nmea",
- "Position": true,
- "Satellite": false,
- "Monitor" : false,
- "Priority": 1000,
- "Testable": false
-}
diff --git a/src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.cpp b/src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.cpp
deleted file mode 100644
index 15460062..00000000
--- a/src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.cpp
+++ /dev/null
@@ -1,505 +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$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosourcefactory_nmea.h"
-#include <QtPositioning/QNmeaPositionInfoSource>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include <QtSerialPort/QSerialPort>
-#include <QtSerialPort/QSerialPortInfo>
-#include <QtNetwork/QTcpSocket>
-#include <QLoggingCategory>
-#include <QSet>
-#include <QUrl>
-#include <QFile>
-#include <QSharedPointer>
-#include "qiopipe_p.h"
-
-Q_LOGGING_CATEGORY(lcNmea, "qt.positioning.nmea")
-
-QT_BEGIN_NAMESPACE
-
-static const auto sourceParameterName = QStringLiteral("nmea.source");
-static const auto socketScheme = QStringLiteral("socket:");
-static const auto serialScheme = QStringLiteral("serial:");
-
-// This class is used only for SerialPort devices, because we can't open the
-// same serial port twice.
-// In case of files and sockets it's easier to explicitly create a QIODevice for
-// each new instance of Nmea*InfoSource.
-// Also QFile can't be directly used with QIOPipe, because QFile is not a
-// sequential device.
-// TcpSocket could be used with QIOPipe, but it complicates error handling
-// dramatically, as we would need to somehow forward socket errors through
-// QIOPipes to the clients.
-class IODeviceContainer
-{
-public:
- IODeviceContainer() {}
- IODeviceContainer(IODeviceContainer const&) = delete;
- void operator=(IODeviceContainer const&) = delete;
-
- QSharedPointer<QIOPipe> serial(const QString &portName)
- {
- if (m_serialPorts.contains(portName)) {
- m_serialPorts[portName].refs++;
- QIOPipe *endPipe = new QIOPipe(m_serialPorts[portName].proxy);
- m_serialPorts[portName].proxy->addChildPipe(endPipe);
- return QSharedPointer<QIOPipe>(endPipe);
- }
- IODevice device;
- QSerialPort *port = new QSerialPort(portName);
- port->setBaudRate(4800);
- qCDebug(lcNmea) << "Opening serial port" << portName;
- if (!port->open(QIODevice::ReadOnly)) {
- qWarning("nmea: Failed to open %s", qPrintable(portName));
- delete port;
- return {};
- }
- qCDebug(lcNmea) << "Opened successfully";
- device.device = port;
- device.refs = 1;
- device.proxy = new QIOPipe(port, QIOPipe::ProxyPipe);
- m_serialPorts[portName] = device;
- QIOPipe *endPipe = new QIOPipe(device.proxy);
- device.proxy->addChildPipe(endPipe);
- return QSharedPointer<QIOPipe>(endPipe);
- }
-
- void releaseSerial(const QString &portName, QSharedPointer<QIOPipe> &pipe)
- {
- if (!m_serialPorts.contains(portName))
- return;
-
- pipe.clear(); // make sure to release the pipe returned by getSerial, or else, if there are still refs, data will be leaked through it
- IODevice &device = m_serialPorts[portName];
- if (device.refs > 1) {
- device.refs--;
- return;
- }
-
- IODevice taken = m_serialPorts.take(portName);
- taken.device->deleteLater();
- }
-
-private:
-
- struct IODevice {
- QIODevice *device = nullptr;
- QIOPipe *proxy = nullptr; // adding client pipes as children of proxy
- // allows to dynamically add clients to one device.
- unsigned int refs = 1;
- };
-
- QMap<QString, IODevice> m_serialPorts;
-};
-
-Q_GLOBAL_STATIC(IODeviceContainer, deviceContainer)
-
-// We use a string prefix to distinguish between the different data sources.
-// "socket:" means that we use a socket connection
-// "serial:" means that we use a serial port connection
-// "file:///", "qrc:///" and just plain strings mean that we try to use local
-// file.
-// Note: if we do not specify anything, or specify "serial:" without specifying
-// the port name, then we will try to search for a well-known serial port
-// device.
-class NmeaSource : public QNmeaPositionInfoSource
-{
- Q_OBJECT
-public:
- NmeaSource(QObject *parent, const QVariantMap &parameters);
- NmeaSource(QObject *parent, const QString &fileName);
- ~NmeaSource() override;
- bool isValid() const
- {
- return !m_dataSource.isNull() || !m_fileSource.isNull() || !m_socket.isNull();
- }
-
-private slots:
- void onSocketError(QAbstractSocket::SocketError error);
-
-private:
- void parseSourceParameter(const QString &source);
- void addSerialDevice(const QString &requestedPort);
- void setFileName(const QString &fileName);
- void connectSocket(const QString &source);
-
- QSharedPointer<QIOPipe> m_dataSource;
- QScopedPointer<QFile> m_fileSource;
- QScopedPointer<QTcpSocket> m_socket;
- QString m_sourceName;
-};
-
-NmeaSource::NmeaSource(QObject *parent, const QVariantMap &parameters)
- : QNmeaPositionInfoSource(RealTimeMode, parent)
-{
- const QString source = parameters.value(sourceParameterName).toString();
- parseSourceParameter(source);
-}
-
-NmeaSource::NmeaSource(QObject *parent, const QString &fileName)
- : QNmeaPositionInfoSource(SimulationMode, parent)
-{
- setFileName(fileName);
-}
-
-NmeaSource::~NmeaSource()
-{
- deviceContainer->releaseSerial(m_sourceName, m_dataSource);
-}
-
-void NmeaSource::onSocketError(QAbstractSocket::SocketError error)
-{
- m_socket->close();
-
- switch (error) {
- case QAbstractSocket::UnknownSocketError:
- setError(QGeoPositionInfoSource::UnknownSourceError);
- break;
- case QAbstractSocket::SocketAccessError:
- setError(QGeoPositionInfoSource::AccessError);
- break;
- case QAbstractSocket::RemoteHostClosedError:
- setError(QGeoPositionInfoSource::ClosedError);
- break;
- default:
- qWarning() << "Connection failed! QAbstractSocket::SocketError" << error;
- // TODO - introduce new type of error. TransportError?
- setError(QGeoPositionInfoSource::UnknownSourceError);
- break;
- }
-}
-
-void NmeaSource::parseSourceParameter(const QString &source)
-{
- if (source.startsWith(socketScheme)) {
- // This is a socket
- connectSocket(source);
- } else {
- // Last chance - this can be serial device.
- // Note: File is handled in a separate case.
- addSerialDevice(source);
- }
-}
-
-static QString tryFindSerialDevice(const QString &requestedPort)
-{
- QString portName;
- if (requestedPort.isEmpty()) {
- const QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts();
- qCDebug(lcNmea) << "Found" << ports.count() << "serial ports";
- if (ports.isEmpty()) {
- qWarning("nmea: No serial ports found");
- return portName;
- }
-
- // Try to find a well-known device.
- QSet<int> supportedDevices;
- supportedDevices << 0x67b; // GlobalSat (BU-353S4 and probably others)
- supportedDevices << 0xe8d; // Qstarz MTK II
- for (const QSerialPortInfo& port : ports) {
- if (port.hasVendorIdentifier() && supportedDevices.contains(port.vendorIdentifier())) {
- portName = port.portName();
- break;
- }
- }
-
- if (portName.isEmpty()) {
- qWarning("nmea: No known GPS device found.");
- }
- } else {
- portName = requestedPort;
- if (portName.startsWith(serialScheme))
- portName.remove(0, 7);
- }
- return portName;
-}
-
-void NmeaSource::addSerialDevice(const QString &requestedPort)
-{
- m_sourceName = tryFindSerialDevice(requestedPort);
- if (m_sourceName.isEmpty())
- return;
-
- m_dataSource = deviceContainer->serial(m_sourceName);
- if (!m_dataSource)
- return;
-
- setDevice(m_dataSource.data());
-}
-
-void NmeaSource::setFileName(const QString &fileName)
-{
- m_sourceName = fileName;
-
- m_fileSource.reset(new QFile(fileName));
- qCDebug(lcNmea) << "Opening file" << fileName;
- if (!m_fileSource->open(QIODevice::ReadOnly)) {
- qWarning("nmea: failed to open file %s", qPrintable(fileName));
- m_fileSource.reset();
- }
-
- if (!m_fileSource)
- return;
-
- qCDebug(lcNmea) << "Opened successfully";
-
- setDevice(m_fileSource.data());
-}
-
-void NmeaSource::connectSocket(const QString &source)
-{
- const QUrl url(source);
- const QString host = url.host();
- const int port = url.port();
- if (!host.isEmpty() && (port > 0)) {
- m_socket.reset(new QTcpSocket);
- // no need to explicitly connect to connected() signal
- connect(m_socket.get(), &QTcpSocket::errorOccurred, this, &NmeaSource::onSocketError);
- m_socket->connectToHost(host, port, QTcpSocket::ReadOnly);
- m_sourceName = source;
-
- setDevice(m_socket.data());
- } else {
- qWarning("nmea: incorrect socket parameters %s:%d", qPrintable(host), port);
- }
-}
-
-class NmeaSatelliteSource : public QNmeaSatelliteInfoSource
-{
- Q_OBJECT
-public:
- NmeaSatelliteSource(QObject *parent, const QVariantMap &parameters);
- NmeaSatelliteSource(QObject *parent, const QString &fileName, const QVariantMap &parameters);
- ~NmeaSatelliteSource();
-
- bool isValid() const { return !m_port.isNull() || !m_file.isNull() || !m_socket.isNull(); }
-
-private slots:
- void onSocketError(QAbstractSocket::SocketError error);
-
-private:
- void parseRealtimeSource(const QString &source);
- void parseSimulationSource(const QString &localFileName);
-
- QSharedPointer<QIOPipe> m_port;
- QScopedPointer<QFile> m_file;
- QScopedPointer<QTcpSocket> m_socket;
- QString m_sourceName;
-};
-
-NmeaSatelliteSource::NmeaSatelliteSource(QObject *parent, const QVariantMap &parameters)
- : QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode, parent)
-{
- const QString source = parameters.value(sourceParameterName).toString();
- parseRealtimeSource(source);
-}
-
-// We can use a QNmeaSatelliteInfoSource::SimulationUpdateInterval parameter to
-// set the file read frequency in simulation mode. We use setBackendProperty()
-// for it. The value can't be smaller than minimumUpdateInterval().
-// This check is done on the QNmeaSatelliteInfoSource level
-NmeaSatelliteSource::NmeaSatelliteSource(QObject *parent, const QString &fileName,
- const QVariantMap &parameters)
- : QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::SimulationMode, parent)
-{
- bool ok = false;
- const int interval =
- parameters.value(QNmeaSatelliteInfoSource::SimulationUpdateInterval).toInt(&ok);
- if (ok)
- setBackendProperty(QNmeaSatelliteInfoSource::SimulationUpdateInterval, interval);
- parseSimulationSource(fileName);
-}
-
-NmeaSatelliteSource::~NmeaSatelliteSource()
-{
- deviceContainer->releaseSerial(m_sourceName, m_port);
-}
-
-void NmeaSatelliteSource::onSocketError(QAbstractSocket::SocketError error)
-{
- m_socket->close();
-
- switch (error) {
- case QAbstractSocket::UnknownSocketError:
- setError(QGeoSatelliteInfoSource::UnknownSourceError);
- break;
- case QAbstractSocket::SocketAccessError:
- setError(QGeoSatelliteInfoSource::AccessError);
- break;
- case QAbstractSocket::RemoteHostClosedError:
- setError(QGeoSatelliteInfoSource::ClosedError);
- break;
- default:
- qWarning() << "Connection failed! QAbstractSocket::SocketError" << error;
- // TODO - introduce new type of error. TransportError?
- setError(QGeoSatelliteInfoSource::UnknownSourceError);
- break;
- }
-}
-
-void NmeaSatelliteSource::parseRealtimeSource(const QString &source)
-{
- if (source.startsWith(socketScheme)) {
- // This is a socket.
- const QUrl url(source);
- const QString host = url.host();
- const int port = url.port();
- if (!host.isEmpty() && (port > 0)) {
- m_socket.reset(new QTcpSocket);
- // no need to explicitly connect to connected() signal
- connect(m_socket.get(), &QTcpSocket::errorOccurred,
- this, &NmeaSatelliteSource::onSocketError);
- m_socket->connectToHost(host, port, QTcpSocket::ReadOnly);
- m_sourceName = source;
-
- setDevice(m_socket.data());
- } else {
- qWarning("nmea: incorrect socket parameters %s:%d", qPrintable(host), port);
- }
- } else {
- // Last chance - this can be serial device.
- m_sourceName = tryFindSerialDevice(source);
- if (m_sourceName.isEmpty())
- return;
-
- m_port = deviceContainer->serial(m_sourceName);
- if (!m_port)
- return;
-
- setDevice(m_port.data());
- }
-}
-
-void NmeaSatelliteSource::parseSimulationSource(const QString &localFileName)
-{
- // This is a text file.
- m_sourceName = localFileName;
-
- qCDebug(lcNmea) << "Opening file" << localFileName;
- m_file.reset(new QFile(localFileName));
- if (!m_file->open(QIODevice::ReadOnly)) {
- qWarning("nmea: failed to open file %s", qPrintable(localFileName));
- m_file.reset();
- return;
- }
- qCDebug(lcNmea) << "Opened successfully";
-
- setDevice(m_file.data());
-}
-
-/*!
- \internal
- Returns a local file name if \a source represents it.
- The returned value can be different from \a source, as the method tries to
- modify the path
-*/
-static QString checkSourceIsFile(const QString &source)
-{
- if (source.isEmpty())
- return QString();
-
- QString localFileName = source;
-
- if (!QFile::exists(localFileName)) {
- if (localFileName.startsWith(QStringLiteral("qrc:///")))
- localFileName.remove(0, 7);
- else if (localFileName.startsWith(QStringLiteral("file:///")))
- localFileName.remove(0, 7);
- else if (localFileName.startsWith(QStringLiteral("qrc:/")))
- localFileName.remove(0, 5);
-
- if (!QFile::exists(localFileName) && localFileName.startsWith(QLatin1Char('/')))
- localFileName.remove(0, 1);
- }
- if (!QFile::exists(localFileName))
- localFileName.prepend(QLatin1Char(':'));
-
- const bool isLocalFile = QFile::exists(localFileName);
- return isLocalFile ? localFileName : QString();
-}
-
-/*!
- \internal
- Returns a local file name if file exists, or an empty string otherwise
-*/
-static QString extractLocalFileName(const QVariantMap &parameters)
-{
- QString localFileName = parameters.value(sourceParameterName).toString();
- return checkSourceIsFile(localFileName);
-}
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryNmea::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- std::unique_ptr<NmeaSource> src = nullptr;
-
- const QString localFileName = extractLocalFileName(parameters);
- if (localFileName.isEmpty())
- src = std::make_unique<NmeaSource>(parent, parameters); // use RealTimeMode
- else
- src = std::make_unique<NmeaSource>(parent, localFileName); // use SimulationMode
-
- return (src && src->isValid()) ? src.release() : nullptr;
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryNmea::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- std::unique_ptr<NmeaSatelliteSource> src = nullptr;
-
- const QString localFileName = extractLocalFileName(parameters);
- if (localFileName.isEmpty()) {
- // use RealTimeMode
- src = std::make_unique<NmeaSatelliteSource>(parent, parameters);
- } else {
- // use SimulationMode
- src = std::make_unique<NmeaSatelliteSource>(parent, localFileName, parameters);
- }
- return (src && src->isValid()) ? src.release() : nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryNmea::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-QT_END_NAMESPACE
-
-#include "qgeopositioninfosourcefactory_nmea.moc"
diff --git a/src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.h b/src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.h
deleted file mode 100644
index d7ac98aa..00000000
--- a/src/plugins/position/nmea/qgeopositioninfosourcefactory_nmea.h
+++ /dev/null
@@ -1,63 +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_NMEA_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_NMEA_H
-
-#include <QObject>
-#include <QtPositioning/QGeoPositionInfoSourceFactory>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoSourceFactoryNmea : 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;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/position/nmea/qiopipe.cpp b/src/plugins/position/nmea/qiopipe.cpp
deleted file mode 100644
index 75cd923c..00000000
--- a/src/plugins/position/nmea/qiopipe.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
-
-#include "qiopipe_p.h"
-#include <QtCore/qmetaobject.h>
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-/*
- proxying means do *not* emit readyRead, and instead pump data
- into child pipes directly in a zero-copy fashion.
-*/
-QIOPipePrivate::QIOPipePrivate(QIODevice *iodevice, bool proxying)
- : m_proxying(proxying), source(iodevice)
-{
-}
-
-QIOPipePrivate::~QIOPipePrivate()
-{
-}
-
-void QIOPipePrivate::initialize()
-{
- const QIOPipe *parentPipe = qobject_cast<QIOPipe *>(source);
- if (parentPipe && parentPipe->d_func()->m_proxying) // with proxying parent,
- return; // don't do anything
-
- // read available data, does not emit.
- readAvailableData();
- // connect readyRead to onReadyRead
- QObjectPrivate::connect(source, &QIODevice::readyRead, this, &QIOPipePrivate::_q_onReadyRead);
-}
-
-bool QIOPipePrivate::readAvailableData() {
- if (!source)
- return false;
- QByteArray ba = source->readAll();
- if (!ba.size())
- return false;
-
- pumpData(ba);
- return true;
-}
-
-void QIOPipePrivate::pumpData(const QByteArray &ba)
-{
- if (m_proxying) {
- QList<int> toRemove;
- for (int i = 0; i < childPipes.size(); ++i) {
- const QPointer<QIOPipe> &cp = childPipes.at(i);
- if (!cp) {
- toRemove.append(i);
- continue;
- }
- QIOPipePrivate *cpp = cp->d_func();
- cpp->pushData(ba);
- }
- for (int i = toRemove.size() - 1; i >= 0; --i) {
- childPipes.remove(i);
- }
- } else {
- for (int i = 0; i < readBuffers.size(); i++)
- readBuffers[i].append(ba);
- }
-}
-
-void QIOPipePrivate::pushData(const QByteArray &ba)
-{
- Q_Q(QIOPipe);
- if (!ba.size())
- return;
-
- pumpData(ba);
- if (!m_proxying)
- emit q->readyRead();
-}
-
-void QIOPipePrivate::_q_onReadyRead()
-{
- Q_Q(QIOPipe);
- if (readAvailableData() && !m_proxying)
- emit q->readyRead();
-}
-
-void QIOPipePrivate::addChildPipe(QIOPipe *childPipe)
-{
- if (childPipes.contains(childPipe))
- return;
- childPipes.append(childPipe);
-}
-
-void QIOPipePrivate::removeChildPipe(QIOPipe *childPipe)
-{
- childPipes.removeOne(childPipe);
-}
-
-QIOPipe::QIOPipe(QIODevice *parent, Mode mode)
- : QIODevice(*new QIOPipePrivate(parent, mode == ProxyPipe), parent)
-{
- this->d_func()->initialize();
- if (!parent->isOpen() && !parent->open(QIODevice::ReadOnly)) {
- qWarning() << "QIOPipe: Failed to open " << parent;
- return;
- }
- open(ReadOnly);
-}
-
-QIOPipe::~QIOPipe()
-{
-
-}
-
-bool QIOPipe::open(QIODevice::OpenMode mode)
-{
- if (isOpen())
- return true;
-
- static const OpenMode supportedOpenMode = ReadOnly; // Currently limit it to read only
- if (!(mode & supportedOpenMode)) {
- qFatal("Unsupported open mode");
- return false;
- }
-
- return QIODevice::open(mode);
-}
-
-bool QIOPipe::isSequential() const
-{
- return true;
-}
-
-void QIOPipe::setReadChannelCount(int count)
-{
- Q_D(QIOPipe);
- d->setReadChannelCount(qMax(count, 1));
-}
-
-void QIOPipe::addChildPipe(QIOPipe *childPipe)
-{
- Q_D(QIOPipe);
- d->addChildPipe(childPipe);
-}
-
-/*!
- \reimp
-
- \omit
- This function does not really read anything, as we use QIODevicePrivate's
- buffer. The buffer will be read inside of QIODevice before this
- method will be called.
- See QIODevicePrivate::read, buffer.read(data, maxSize).
- \endomit
-*/
-qint64 QIOPipe::readData(char *data, qint64 maxlen)
-{
- Q_UNUSED(data);
- Q_UNUSED(maxlen);
-
- // return 0 indicating there may be more data in the future
- // Returning -1 means no more data in the future (end of stream).
- return qint64(0);
-}
-
-qint64 QIOPipe::writeData(const char * /*data*/, qint64 /*len*/)
-{
- qFatal("QIOPipe is a read-only device");
- return qint64(0);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/nmea/qiopipe_p.h b/src/plugins/position/nmea/qiopipe_p.h
deleted file mode 100644
index dd83588a..00000000
--- a/src/plugins/position/nmea/qiopipe_p.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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 QIOPIPE_P_H
-#define QIOPIPE_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/qiodevice.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/private/qiodevice_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QObject;
-class QIOPipePrivate;
-
-class QIOPipe : public QIODevice
-{
- Q_OBJECT
-
-public:
- enum Mode {
- EndPipe = 0x0000,
- ProxyPipe = 0x0001
- };
-
- explicit QIOPipe(QIODevice *parent, Mode mode = EndPipe);
- ~QIOPipe() override;
-
- bool open(OpenMode openMode) override;
- bool isSequential() const override;
- void setReadChannelCount(int count);
- void addChildPipe(QIOPipe *childPipe);
-
-protected:
- qint64 readData(char *data, qint64 maxlen) override;
- qint64 writeData(const char *data, qint64 len) override;
-
-private:
- Q_DECLARE_PRIVATE(QIOPipe)
- Q_DISABLE_COPY(QIOPipe)
-};
-
-class QIOPipePrivate : public QIODevicePrivate
-{
- Q_DECLARE_PUBLIC(QIOPipe)
-
-public:
- explicit QIOPipePrivate(QIODevice *iodevice, bool proxying);
- ~QIOPipePrivate() override;
-
- void initialize();
- bool readAvailableData();
- void pumpData(const QByteArray &ba);
- void pushData(const QByteArray &ba);
- void _q_onReadyRead();
- void addChildPipe(QIOPipe *childPipe);
- void removeChildPipe(QIOPipe *childPipe);
-
- bool m_proxying = false;
- QPointer<QIODevice> source;
- QList<QPointer<QIOPipe>> childPipes;
-};
-
-QT_END_NAMESPACE
-
-#endif // QIOPIPE_P_H
-
diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro
deleted file mode 100644
index 145150ee..00000000
--- a/src/plugins/position/position.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = subdirs
-
-QT_FOR_CONFIG += positioning-private
-
-linux|freebsd|openbsd|netbsd:qtHaveModule(dbus):SUBDIRS += geoclue2
-qtConfig(gypsy):SUBDIRS += gypsy
-qtConfig(winrt_geolocation):SUBDIRS += winrt
-osx|ios|tvos:SUBDIRS += corelocation
-android:SUBDIRS += android
-qtHaveModule(serialport):SUBDIRS += serialnmea
-
-SUBDIRS += \
- positionpoll
diff --git a/src/plugins/position/positionpoll/CMakeLists.txt b/src/plugins/position/positionpoll/CMakeLists.txt
deleted file mode 100644
index 59810be1..00000000
--- a/src/plugins/position/positionpoll/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Generated from positionpoll.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryPoll Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryPollPlugin
- OUTPUT_NAME qtposition_positionpoll
- CLASS_NAME QGeoPositionInfoSourceFactoryPoll
- PLUGIN_TYPE position
- SOURCES
- positionpollfactory.cpp positionpollfactory.h
- qgeoareamonitor_polling.cpp qgeoareamonitor_polling.h
- LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionpoll.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/position/positionpoll/plugin.json b/src/plugins/position/positionpoll/plugin.json
deleted file mode 100644
index df1f47de..00000000
--- a/src/plugins/position/positionpoll/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["positionpoll"],
- "Provider": "positionpoll",
- "Position": false,
- "Satellite": false,
- "Monitor": true,
- "Priority": 1000,
- "Testable": true
-}
diff --git a/src/plugins/position/positionpoll/positionpoll.pro b/src/plugins/position/positionpoll/positionpoll.pro
deleted file mode 100644
index be60bf43..00000000
--- a/src/plugins/position/positionpoll/positionpoll.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TARGET = qtposition_positionpoll
-
-QT = core positioning
-
-SOURCES += \
- qgeoareamonitor_polling.cpp \
- positionpollfactory.cpp
-
-HEADERS += \
- qgeoareamonitor_polling.h \
- positionpollfactory.h
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryPoll
-load(qt_plugin)
diff --git a/src/plugins/position/positionpoll/positionpollfactory.cpp b/src/plugins/position/positionpoll/positionpollfactory.cpp
deleted file mode 100644
index a47b2b10..00000000
--- a/src/plugins/position/positionpoll/positionpollfactory.cpp
+++ /dev/null
@@ -1,65 +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 "positionpollfactory.h"
-#include "qgeoareamonitor_polling.h"
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryPoll::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryPoll::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryPoll::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parameters)
- QGeoAreaMonitorPolling *ret = new QGeoAreaMonitorPolling(parent);
- if (ret && ret->isValid())
- return ret;
- delete ret;
- return nullptr;
-}
diff --git a/src/plugins/position/positionpoll/positionpollfactory.h b/src/plugins/position/positionpoll/positionpollfactory.h
deleted file mode 100644
index 570b3b21..00000000
--- a/src/plugins/position/positionpoll/positionpollfactory.h
+++ /dev/null
@@ -1,58 +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 POSITIONPOLLFACTORY_H
-#define POSITIONPOLLFACTORY_H
-
-#include <QObject>
-#include <QtPositioning/qgeopositioninfosourcefactory.h>
-
-class QGeoPositionInfoSourceFactoryPoll : 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;
-};
-
-#endif // POSITIONPOLLFACTORY_H
diff --git a/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp b/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp
deleted file mode 100644
index e69516c8..00000000
--- a/src/plugins/position/positionpoll/qgeoareamonitor_polling.cpp
+++ /dev/null
@@ -1,508 +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$
-**
-****************************************************************************/
-
-#include "qgeoareamonitor_polling.h"
-#include <QtPositioning/qgeocoordinate.h>
-#include <QtPositioning/qgeorectangle.h>
-#include <QtPositioning/qgeocircle.h>
-
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qmutex.h>
-
-#include <mutex>
-
-#define UPDATE_INTERVAL_5S 5000
-
-typedef QHash<QString, QGeoAreaMonitorInfo> MonitorTable;
-
-
-static QMetaMethod areaEnteredSignal()
-{
- static QMetaMethod signal = QMetaMethod::fromSignal(&QGeoAreaMonitorPolling::areaEntered);
- return signal;
-}
-
-static QMetaMethod areaExitedSignal()
-{
- static QMetaMethod signal = QMetaMethod::fromSignal(&QGeoAreaMonitorPolling::areaExited);
- return signal;
-}
-
-static QMetaMethod monitorExpiredSignal()
-{
- static QMetaMethod signal = QMetaMethod::fromSignal(&QGeoAreaMonitorPolling::monitorExpired);
- return signal;
-}
-
-class QGeoAreaMonitorPollingPrivate : public QObject
-{
- Q_OBJECT
-public:
- QGeoAreaMonitorPollingPrivate()
- {
- nextExpiryTimer = new QTimer(this);
- nextExpiryTimer->setSingleShot(true);
- connect(nextExpiryTimer, SIGNAL(timeout()),
- this, SLOT(timeout()));
- }
-
- void startMonitoring(const QGeoAreaMonitorInfo &monitor)
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- activeMonitorAreas.insert(monitor.identifier(), monitor);
- singleShotTrigger.remove(monitor.identifier());
-
- checkStartStop();
- setupNextExpiryTimeout();
- }
-
- void requestUpdate(const QGeoAreaMonitorInfo &monitor, int signalId)
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- activeMonitorAreas.insert(monitor.identifier(), monitor);
- singleShotTrigger.insert(monitor.identifier(), signalId);
-
- checkStartStop();
- setupNextExpiryTimeout();
- }
-
- QGeoAreaMonitorInfo stopMonitoring(const QGeoAreaMonitorInfo &monitor)
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- QGeoAreaMonitorInfo mon = activeMonitorAreas.take(monitor.identifier());
-
- checkStartStop();
- setupNextExpiryTimeout();
-
- return mon;
- }
-
- void registerClient(QGeoAreaMonitorPolling *client)
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- connect(this, SIGNAL(timeout(QGeoAreaMonitorInfo)),
- client, SLOT(timeout(QGeoAreaMonitorInfo)));
-
- connect(this, SIGNAL(positionError(QGeoPositionInfoSource::Error)),
- client, SLOT(positionError(QGeoPositionInfoSource::Error)));
-
- connect(this, SIGNAL(areaEventDetected(QGeoAreaMonitorInfo,QGeoPositionInfo,bool)),
- client, SLOT(processAreaEvent(QGeoAreaMonitorInfo,QGeoPositionInfo,bool)));
-
- registeredClients.append(client);
- }
-
- void deregisterClient(QGeoAreaMonitorPolling *client)
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- registeredClients.removeAll(client);
- if (registeredClients.isEmpty())
- checkStartStop();
- }
-
- void setPositionSource(QGeoPositionInfoSource *newSource)
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- if (newSource == source)
- return;
-
- if (source)
- delete source;
-
- source = newSource;
-
- if (source) {
- source->setParent(this);
- source->moveToThread(this->thread());
- if (source->updateInterval() == 0)
- source->setUpdateInterval(UPDATE_INTERVAL_5S);
- disconnect(source, 0, 0, 0); //disconnect all
- connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
- connect(source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SIGNAL(positionError(QGeoPositionInfoSource::Error)));
- checkStartStop();
- }
- }
-
- QGeoPositionInfoSource* positionSource() const
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
- return source;
- }
-
- MonitorTable activeMonitors() const
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- return activeMonitorAreas;
- }
-
- void checkStartStop()
- {
- const std::lock_guard<QRecursiveMutex> locker(mutex);
-
- bool signalsConnected = false;
- foreach (const QGeoAreaMonitorPolling *client, registeredClients) {
- if (client->hasConnections()) {
- signalsConnected = true;
- break;
- }
- }
-
- if (signalsConnected && !activeMonitorAreas.isEmpty()) {
- if (source)
- source->startUpdates();
- else
- //translated to InsufficientPositionInfo
- emit positionError(QGeoPositionInfoSource::ClosedError);
- } else {
- if (source)
- source->stopUpdates();
- }
- }
-
-private:
- void setupNextExpiryTimeout()
- {
- nextExpiryTimer->stop();
- activeExpiry.first = QDateTime();
- activeExpiry.second = QString();
-
- foreach (const QGeoAreaMonitorInfo &info, activeMonitors()) {
- if (info.expiration().isValid()) {
- if (!activeExpiry.first.isValid()) {
- activeExpiry.first = info.expiration();
- activeExpiry.second = info.identifier();
- continue;
- }
- if (info.expiration() < activeExpiry.first) {
- activeExpiry.first = info.expiration();
- activeExpiry.second = info.identifier();
- }
- }
- }
-
- if (activeExpiry.first.isValid())
- nextExpiryTimer->start(QDateTime::currentDateTime().msecsTo(activeExpiry.first));
- }
-
-
- //returns true if areaEntered should be emitted
- bool processInsideArea(const QString &monitorIdent)
- {
- if (!insideArea.contains(monitorIdent)) {
- if (singleShotTrigger.value(monitorIdent, -1) == areaEnteredSignal().methodIndex()) {
- //this is the finishing singleshot event
- singleShotTrigger.remove(monitorIdent);
- activeMonitorAreas.remove(monitorIdent);
- setupNextExpiryTimeout();
- } else {
- insideArea.insert(monitorIdent);
- }
- return true;
- }
-
- return false;
- }
-
- //returns true if areaExited should be emitted
- bool processOutsideArea(const QString &monitorIdent)
- {
- if (insideArea.contains(monitorIdent)) {
- if (singleShotTrigger.value(monitorIdent, -1) == areaExitedSignal().methodIndex()) {
- //this is the finishing singleShot event
- singleShotTrigger.remove(monitorIdent);
- activeMonitorAreas.remove(monitorIdent);
- setupNextExpiryTimeout();
- } else {
- insideArea.remove(monitorIdent);
- }
- return true;
- }
- return false;
- }
-
-
-
-Q_SIGNALS:
- void timeout(const QGeoAreaMonitorInfo &info);
- void positionError(const QGeoPositionInfoSource::Error error);
- void areaEventDetected(const QGeoAreaMonitorInfo &minfo,
- const QGeoPositionInfo &pinfo, bool isEnteredEvent);
-private Q_SLOTS:
- void timeout()
- {
- /*
- * Don't block timer firing even if monitorExpiredSignal is not connected.
- * This allows us to continue to remove the existing monitors as they expire.
- **/
- const QGeoAreaMonitorInfo info = activeMonitorAreas.take(activeExpiry.second);
- setupNextExpiryTimeout();
- emit timeout(info);
-
- }
-
- void positionUpdated(const QGeoPositionInfo &info)
- {
- foreach (const QGeoAreaMonitorInfo &monInfo, activeMonitors()) {
- const QString identifier = monInfo.identifier();
- if (monInfo.area().contains(info.coordinate())) {
- if (processInsideArea(identifier))
- emit areaEventDetected(monInfo, info, true);
- } else {
- if (processOutsideArea(identifier))
- emit areaEventDetected(monInfo, info, false);
- }
- }
- }
-
-private:
- QPair<QDateTime, QString> activeExpiry;
- QHash<QString, int> singleShotTrigger;
- QTimer* nextExpiryTimer;
- QSet<QString> insideArea;
-
- MonitorTable activeMonitorAreas;
-
- QGeoPositionInfoSource* source = nullptr;
- QList<QGeoAreaMonitorPolling*> registeredClients;
- mutable QRecursiveMutex mutex;
-};
-
-Q_GLOBAL_STATIC(QGeoAreaMonitorPollingPrivate, pollingPrivate)
-
-QGeoAreaMonitorPolling::QGeoAreaMonitorPolling(QObject *parent) : QGeoAreaMonitorSource(parent)
-{
- d = pollingPrivate();
- d->registerClient(this);
- //hookup to default source if existing
- if (!positionInfoSource())
- setPositionInfoSource(QGeoPositionInfoSource::createDefaultSource(this));
-}
-
-QGeoAreaMonitorPolling::~QGeoAreaMonitorPolling()
-{
- d->deregisterClient(this);
-}
-
-QGeoPositionInfoSource* QGeoAreaMonitorPolling::positionInfoSource() const
-{
- return d->positionSource();
-}
-
-void QGeoAreaMonitorPolling::setPositionInfoSource(QGeoPositionInfoSource *source)
-{
- d->setPositionSource(source);
-}
-
-QGeoAreaMonitorSource::Error QGeoAreaMonitorPolling::error() const
-{
- return lastError;
-}
-
-bool QGeoAreaMonitorPolling::startMonitoring(const QGeoAreaMonitorInfo &monitor)
-{
- if (!monitor.isValid())
- return false;
-
- //reject an expiry in the past
- if (monitor.expiration().isValid() &&
- (monitor.expiration() < QDateTime::currentDateTime()))
- return false;
-
- //don't accept persistent monitor since we don't support it
- if (monitor.isPersistent())
- return false;
-
- lastError = QGeoAreaMonitorSource::NoError;
-
- //update or insert
- d->startMonitoring(monitor);
-
- return true;
-}
-
-int QGeoAreaMonitorPolling::idForSignal(const char *signal)
-{
- const QByteArray sig = QMetaObject::normalizedSignature(signal + 1);
- const QMetaObject * const mo = metaObject();
-
- return mo->indexOfSignal(sig.constData());
-}
-
-bool QGeoAreaMonitorPolling::hasConnections() const
-{
- // This method is internal and requires the mutex to be already locked.
- return signalConnections > 0;
-}
-
-bool QGeoAreaMonitorPolling::requestUpdate(const QGeoAreaMonitorInfo &monitor, const char *signal)
-{
- if (!monitor.isValid())
- return false;
- //reject an expiry in the past
- if (monitor.expiration().isValid() &&
- (monitor.expiration() < QDateTime::currentDateTime()))
- return false;
-
- //don't accept persistent monitor since we don't support it
- if (monitor.isPersistent())
- return false;
-
- if (!signal)
- return false;
-
- const int signalId = idForSignal(signal);
- if (signalId < 0)
- return false;
-
- //only accept area entered or exit signal
- if (signalId != areaEnteredSignal().methodIndex() &&
- signalId != areaExitedSignal().methodIndex())
- {
- return false;
- }
-
- lastError = QGeoAreaMonitorSource::NoError;
-
- d->requestUpdate(monitor, signalId);
-
- return true;
-}
-
-bool QGeoAreaMonitorPolling::stopMonitoring(const QGeoAreaMonitorInfo &monitor)
-{
- QGeoAreaMonitorInfo info = d->stopMonitoring(monitor);
-
- return info.isValid();
-}
-
-QList<QGeoAreaMonitorInfo> QGeoAreaMonitorPolling::activeMonitors() const
-{
- return d->activeMonitors().values();
-}
-
-QList<QGeoAreaMonitorInfo> QGeoAreaMonitorPolling::activeMonitors(const QGeoShape &region) const
-{
- QList<QGeoAreaMonitorInfo> results;
- if (region.isEmpty())
- return results;
-
- const MonitorTable list = d->activeMonitors();
- foreach (const QGeoAreaMonitorInfo &monitor, list) {
- if (region.contains(monitor.area().center()))
- results.append(monitor);
- }
-
- return results;
-}
-
-QGeoAreaMonitorSource::AreaMonitorFeatures QGeoAreaMonitorPolling::supportedAreaMonitorFeatures() const
-{
- return {};
-}
-
-void QGeoAreaMonitorPolling::connectNotify(const QMetaMethod &signal)
-{
- QMutexLocker locker(&connectionMutex);
- if (signal == areaEnteredSignal() || signal == areaExitedSignal()) {
- const bool alreadyConnected = hasConnections();
- signalConnections++;
- if (!alreadyConnected)
- d->checkStartStop();
- }
-}
-
-void QGeoAreaMonitorPolling::disconnectNotify(const QMetaMethod &signal)
-{
- QMutexLocker locker(&connectionMutex);
- if (signal == areaEnteredSignal() || signal == areaExitedSignal()) {
- if (hasConnections())
- signalConnections--;
- if (!hasConnections())
- d->checkStartStop();
- }
-}
-
-void QGeoAreaMonitorPolling::positionError(const QGeoPositionInfoSource::Error error)
-{
- switch (error) {
- case QGeoPositionInfoSource::AccessError:
- lastError = QGeoAreaMonitorSource::AccessError;
- break;
- case QGeoPositionInfoSource::UnknownSourceError:
- lastError = QGeoAreaMonitorSource::UnknownSourceError;
- break;
- case QGeoPositionInfoSource::ClosedError:
- case QGeoPositionInfoSource::UpdateTimeoutError:
- lastError = QGeoAreaMonitorSource::InsufficientPositionInfo;
- break;
- case QGeoPositionInfoSource::NoError:
- return;
- }
-
- emit QGeoAreaMonitorSource::errorOccurred(lastError);
-}
-
-void QGeoAreaMonitorPolling::timeout(const QGeoAreaMonitorInfo& monitor)
-{
- if (isSignalConnected(monitorExpiredSignal()))
- emit monitorExpired(monitor);
-}
-
-void QGeoAreaMonitorPolling::processAreaEvent(const QGeoAreaMonitorInfo &minfo,
- const QGeoPositionInfo &pinfo, bool isEnteredEvent)
-{
- if (isEnteredEvent)
- emit areaEntered(minfo, pinfo);
- else
- emit areaExited(minfo, pinfo);
-}
-
-#include "qgeoareamonitor_polling.moc"
-#include "moc_qgeoareamonitor_polling.cpp"
diff --git a/src/plugins/position/positionpoll/qgeoareamonitor_polling.h b/src/plugins/position/positionpoll/qgeoareamonitor_polling.h
deleted file mode 100644
index 38a685d4..00000000
--- a/src/plugins/position/positionpoll/qgeoareamonitor_polling.h
+++ /dev/null
@@ -1,100 +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 QGEOAREAMONITORPOLLING_H
-#define QGEOAREAMONITORPOLLING_H
-
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtCore/qmutex.h>
-
-/**
- * QGeoAreaMonitorPolling
- *
- */
-
-class QGeoAreaMonitorPollingPrivate;
-class QGeoAreaMonitorPolling : public QGeoAreaMonitorSource
-{
- Q_OBJECT
-public :
- explicit QGeoAreaMonitorPolling(QObject *parent = 0);
- ~QGeoAreaMonitorPolling();
-
- void setPositionInfoSource(QGeoPositionInfoSource *source) override;
- QGeoPositionInfoSource* positionInfoSource() const override;
-
- Error error() const override;
-
- bool startMonitoring(const QGeoAreaMonitorInfo &monitor) override;
- bool requestUpdate(const QGeoAreaMonitorInfo &monitor,
- const char *signal) override;
- bool stopMonitoring(const QGeoAreaMonitorInfo &monitor) override;
-
- QList<QGeoAreaMonitorInfo> activeMonitors() const override;
- QList<QGeoAreaMonitorInfo> activeMonitors(const QGeoShape &region) const override;
-
- QGeoAreaMonitorSource::AreaMonitorFeatures supportedAreaMonitorFeatures() const override;
-
- inline bool isValid() { return positionInfoSource(); }
-
-private Q_SLOTS:
- void positionError(QGeoPositionInfoSource::Error error);
- void timeout(const QGeoAreaMonitorInfo &monitor);
- void processAreaEvent(const QGeoAreaMonitorInfo &minfo, const QGeoPositionInfo &pinfo, bool isEnteredEvent);
-
-private:
- QGeoAreaMonitorPollingPrivate* d;
- QGeoAreaMonitorSource::Error lastError = QGeoAreaMonitorSource::NoError;
- friend class QGeoAreaMonitorPollingPrivate;
-
- int signalConnections = 0;
- // connectNotify() and disconnectNotify() can be called from a different
- // thread, so we need to synchronize the access to signalConnections
- QMutex connectionMutex;
-
- void connectNotify(const QMetaMethod &signal) override;
- void disconnectNotify(const QMetaMethod &signal) override;
-
- int idForSignal(const char *signal);
-
- bool hasConnections() const;
-};
-
-#endif // QGEOAREAMONITORPOLLING_H
diff --git a/src/plugins/position/winrt/CMakeLists.txt b/src/plugins/position/winrt/CMakeLists.txt
deleted file mode 100644
index 44de9655..00000000
--- a/src/plugins/position/winrt/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated from winrt.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryWinRT Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryWinRTPlugin
- OUTPUT_NAME qtposition_winrt
- CLASS_NAME QGeoPositionInfoSourceFactoryWinRT
- PLUGIN_TYPE position
- SOURCES
- qgeopositioninfosource_winrt.cpp qgeopositioninfosource_winrt_p.h
- qgeopositioninfosourcefactory_winrt.cpp qgeopositioninfosourcefactory_winrt.h
- LIBRARIES
- Qt::Core
- Qt::CorePrivate
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:winrt.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-
-## Scopes:
-#####################################################################
-
-qt_internal_extend_target(QGeoPositionInfoSourceFactoryWinRTPlugin CONDITION MSVC AND NOT WINRT
- LIBRARIES
- runtimeobject.lib
-)
diff --git a/src/plugins/position/winrt/plugin.json b/src/plugins/position/winrt/plugin.json
deleted file mode 100644
index 0696cb0a..00000000
--- a/src/plugins/position/winrt/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["winrt"],
- "Provider": "winrt",
- "Position": true,
- "Satellite": false,
- "Monitor" : false,
- "Priority": 1000,
- "Testable": false
-}
diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp
deleted file mode 100644
index a8e9816f..00000000
--- a/src/plugins/position/winrt/qgeopositioninfosource_winrt.cpp
+++ /dev/null
@@ -1,675 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosource_winrt_p.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/private/qfunctions_winrt_p.h>
-#include <QtCore/qloggingcategory.h>
-#include <QtCore/qmutex.h>
-#ifdef Q_OS_WINRT
-#include <QtCore/private/qeventdispatcher_winrt_p.h>
-#endif
-
-#include <functional>
-#include <windows.system.h>
-#include <windows.devices.geolocation.h>
-#include <windows.foundation.h>
-#include <windows.foundation.collections.h>
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-using namespace ABI::Windows::Devices::Geolocation;
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-
-typedef ITypedEventHandler<Geolocator *, PositionChangedEventArgs *> GeoLocatorPositionHandler;
-typedef ITypedEventHandler<Geolocator *, StatusChangedEventArgs *> GeoLocatorStatusHandler;
-typedef IAsyncOperationCompletedHandler<Geoposition*> PositionHandler;
-typedef IAsyncOperationCompletedHandler<GeolocationAccessStatus> AccessHandler;
-
-Q_DECLARE_LOGGING_CATEGORY(lcPositioningWinRT)
-
-Q_DECLARE_METATYPE(QGeoPositionInfoSource::Error)
-
-QT_BEGIN_NAMESPACE
-
-#ifndef Q_OS_WINRT
-namespace QEventDispatcherWinRT {
-HRESULT runOnXamlThread(const std::function<HRESULT ()> &delegate, bool waitForRun = true)
-{
- Q_UNUSED(waitForRun);
- return delegate();
-}
-}
-
-static inline HRESULT await(const ComPtr<IAsyncOperation<GeolocationAccessStatus>> &asyncOp,
- GeolocationAccessStatus *result)
-{
- ComPtr<IAsyncInfo> asyncInfo;
- HRESULT hr = asyncOp.As(&asyncInfo);
- if (FAILED(hr))
- return hr;
-
- AsyncStatus status;
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started)
- QThread::yieldCurrentThread();
-
- if (FAILED(hr) || status != AsyncStatus::Completed) {
- HRESULT ec;
- hr = asyncInfo->get_ErrorCode(&ec);
- if (FAILED(hr))
- return hr;
- hr = asyncInfo->Close();
- if (FAILED(hr))
- return hr;
- return ec;
- }
-
- if (FAILED(hr))
- return hr;
-
- return asyncOp->GetResults(result);
-}
-#endif // !Q_OS_WINRT
-
-enum class InitializationState {
- Uninitialized,
- Initializing,
- Initialized
-};
-
-class QGeoPositionInfoSourceWinRTPrivate {
-public:
- ComPtr<IGeolocator> locator;
- mutable ComPtr<IGeolocatorStatics> statics;
- QTimer periodicTimer;
- QTimer singleUpdateTimer;
- QGeoPositionInfo lastPosition;
- QGeoPositionInfoSource::Error positionError = QGeoPositionInfoSource::NoError;
- EventRegistrationToken statusToken;
- EventRegistrationToken positionToken;
- QMutex mutex;
- bool updatesOngoing = false;
- int minimumUpdateInterval = -1;
- int updateInterval = -1;
- InitializationState initState = InitializationState::Uninitialized;
-
- PositionStatus positionStatus = PositionStatus_NotInitialized;
-};
-
-QGeoPositionInfoSourceWinRT::QGeoPositionInfoSourceWinRT(QObject *parent)
- : QGeoPositionInfoSource(parent)
- , d_ptr(new QGeoPositionInfoSourceWinRTPrivate)
-{
- qRegisterMetaType<QGeoPositionInfoSource::Error>();
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
- Q_D(QGeoPositionInfoSourceWinRT);
- d->positionError = QGeoPositionInfoSource::NoError;
- d->updatesOngoing = false;
- d->positionToken.value = 0;
- d->statusToken.value = 0;
-}
-
-QGeoPositionInfoSourceWinRT::~QGeoPositionInfoSourceWinRT()
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- CoUninitialize();
-}
-
-int QGeoPositionInfoSourceWinRT::init()
-{
- Q_D(QGeoPositionInfoSourceWinRT);
- Q_ASSERT(d->initState != InitializationState::Initializing);
- if (d->initState == InitializationState::Initialized)
- return 0;
-
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- d->initState = InitializationState::Initializing;
- if (!requestAccess()) {
- d->initState = InitializationState::Uninitialized;
- setError(QGeoPositionInfoSource::AccessError);
- qWarning ("Location access failed.");
- return -1;
- }
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() {
- HRESULT hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Devices_Geolocation_Geolocator).Get(),
- &d->locator);
- RETURN_HR_IF_FAILED("Could not initialize native location services.");
-
- if (d->minimumUpdateInterval == -1) {
- UINT32 interval;
- hr = d->locator->get_ReportInterval(&interval);
- RETURN_HR_IF_FAILED("Could not retrieve report interval.");
- d->minimumUpdateInterval = static_cast<int>(interval);
- }
- if (d->updateInterval == -1)
- d->updateInterval = d->minimumUpdateInterval;
- setUpdateInterval(d->updateInterval);
-
- return hr;
- });
- if (FAILED(hr)) {
- d->initState = InitializationState::Uninitialized;
- setError(QGeoPositionInfoSource::UnknownSourceError);
- return -1;
- }
-
- d->periodicTimer.setSingleShot(true);
- connect(&d->periodicTimer, &QTimer::timeout, this, &QGeoPositionInfoSourceWinRT::virtualPositionUpdate);
-
- d->singleUpdateTimer.setSingleShot(true);
- connect(&d->singleUpdateTimer, &QTimer::timeout, this, &QGeoPositionInfoSourceWinRT::singleUpdateTimeOut);
-
- QGeoPositionInfoSource::PositioningMethods preferredMethods = preferredPositioningMethods();
- if (preferredMethods == QGeoPositionInfoSource::NoPositioningMethods)
- preferredMethods = QGeoPositionInfoSource::AllPositioningMethods;
- setPreferredPositioningMethods(preferredMethods);
-
- connect(this, &QGeoPositionInfoSourceWinRT::nativePositionUpdate, this, &QGeoPositionInfoSourceWinRT::updateSynchronized);
- d->initState = InitializationState::Initialized;
- return 0;
-}
-
-QGeoPositionInfo QGeoPositionInfoSourceWinRT::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_D(const QGeoPositionInfoSourceWinRT);
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
- return d->lastPosition;
-}
-
-QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceWinRT::supportedPositioningMethods() const
-{
- return requestAccess() ? QGeoPositionInfoSource::AllPositioningMethods
- : QGeoPositionInfoSource::NoPositioningMethods;
-}
-
-void QGeoPositionInfoSourceWinRT::setPreferredPositioningMethods(QGeoPositionInfoSource::PositioningMethods methods)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << methods;
- Q_D(QGeoPositionInfoSourceWinRT);
-
- PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods();
- QGeoPositionInfoSource::setPreferredPositioningMethods(methods);
- if (previousPreferredPositioningMethods == preferredPositioningMethods()
- || d->initState == InitializationState::Uninitialized) {
- return;
- }
-
- const bool needsRestart = d->positionToken.value != 0 || d->statusToken.value != 0;
-
- if (needsRestart)
- stopHandler();
-
- PositionAccuracy acc = methods & PositioningMethod::SatellitePositioningMethods ?
- PositionAccuracy::PositionAccuracy_High :
- PositionAccuracy::PositionAccuracy_Default;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, acc]() {
- return d->locator->put_DesiredAccuracy(acc);
- });
- RETURN_VOID_IF_FAILED("Could not set positioning accuracy.");
-
- if (needsRestart)
- startHandler();
-}
-
-void QGeoPositionInfoSourceWinRT::setUpdateInterval(int msec)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << msec;
- Q_D(QGeoPositionInfoSourceWinRT);
- if (d->initState == InitializationState::Uninitialized) {
- d->updateInterval = msec;
- return;
- }
-
- // minimumUpdateInterval is initialized to the lowest possible update interval in init().
- // Passing 0 will cause an error on Windows 10.
- // See https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation.geolocator.reportinterval
- if (msec != 0 && msec < minimumUpdateInterval())
- msec = minimumUpdateInterval();
-
- const bool needsRestart = d->positionToken.value != 0 || d->statusToken.value != 0;
-
- if (needsRestart)
- stopHandler();
-
- HRESULT hr = d->locator->put_ReportInterval(static_cast<UINT32>(msec));
- if (FAILED(hr)) {
- setError(QGeoPositionInfoSource::UnknownSourceError);
- qErrnoWarning(hr, "Failed to set update interval");
- return;
- }
-
- d->updateInterval = msec;
- d->periodicTimer.setInterval(d->updateInterval);
-
- QGeoPositionInfoSource::setUpdateInterval(d->updateInterval);
-
- if (needsRestart)
- startHandler();
-}
-
-int QGeoPositionInfoSourceWinRT::minimumUpdateInterval() const
-{
- Q_D(const QGeoPositionInfoSourceWinRT);
- return d->minimumUpdateInterval == -1 ? 1000 : d->minimumUpdateInterval;
-}
-
-void QGeoPositionInfoSourceWinRT::startUpdates()
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_D(QGeoPositionInfoSourceWinRT);
-
- setError(QGeoPositionInfoSource::NoError);
- if (init() < 0)
- return;
-
- if (d->updatesOngoing)
- return;
-
- if (!startHandler())
- return;
- d->updatesOngoing = true;
- d->periodicTimer.start();
-}
-
-void QGeoPositionInfoSourceWinRT::stopUpdates()
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_D(QGeoPositionInfoSourceWinRT);
-
- if (init() < 0)
- return;
-
- stopHandler();
- d->updatesOngoing = false;
- d->periodicTimer.stop();
-}
-
-bool QGeoPositionInfoSourceWinRT::startHandler()
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_D(QGeoPositionInfoSourceWinRT);
-
- // Check if already attached
- if (d->positionToken.value != 0)
- return true;
-
- if (preferredPositioningMethods() == QGeoPositionInfoSource::NoPositioningMethods) {
- setError(QGeoPositionInfoSource::UnknownSourceError);
- return false;
- }
-
- if (!requestAccess()) {
- setError(QGeoPositionInfoSource::AccessError);
- return false;
- }
-
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, d]() {
- HRESULT hr;
-
- // We need to call this at least once on Windows 10 Mobile.
- // Unfortunately this operation does not have a completion handler
- // registered. That could have helped in the single update case
- ComPtr<IAsyncOperation<Geoposition*>> op;
- hr = d->locator->GetGeopositionAsync(&op);
- RETURN_HR_IF_FAILED("Could not start position operation");
-
- hr = d->locator->add_PositionChanged(Callback<GeoLocatorPositionHandler>(this,
- &QGeoPositionInfoSourceWinRT::onPositionChanged).Get(),
- &d->positionToken);
- RETURN_HR_IF_FAILED("Could not add position handler");
-
- hr = d->locator->add_StatusChanged(Callback<GeoLocatorStatusHandler>(this,
- &QGeoPositionInfoSourceWinRT::onStatusChanged).Get(),
- &d->statusToken);
- RETURN_HR_IF_FAILED("Could not add status handler");
- return hr;
- });
- if (FAILED(hr)) {
- setError(QGeoPositionInfoSource::UnknownSourceError);
- return false;
- }
-
- return true;
-}
-
-void QGeoPositionInfoSourceWinRT::stopHandler()
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_D(QGeoPositionInfoSourceWinRT);
-
- if (!d->positionToken.value)
- return;
- QEventDispatcherWinRT::runOnXamlThread([d]() {
- d->locator->remove_PositionChanged(d->positionToken);
- d->locator->remove_StatusChanged(d->statusToken);
- return S_OK;
- });
- d->positionToken.value = 0;
- d->statusToken.value = 0;
-}
-
-void QGeoPositionInfoSourceWinRT::requestUpdate(int timeout)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << timeout;
- Q_D(QGeoPositionInfoSourceWinRT);
-
- if (init() < 0)
- return;
-
- setError(QGeoPositionInfoSource::NoError);
- if (timeout != 0 && timeout < minimumUpdateInterval()) {
- d->positionError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(d->positionError);
- return;
- }
-
- if (timeout == 0)
- timeout = 2*60*1000; // Maximum time for cold start (see Android)
-
- startHandler();
- d->singleUpdateTimer.start(timeout);
-}
-
-void QGeoPositionInfoSourceWinRT::virtualPositionUpdate()
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_D(QGeoPositionInfoSourceWinRT);
- QMutexLocker locker(&d->mutex);
-
- // The operating system did not provide information in time
- // Hence we send a virtual position update to keep same behavior
- // between backends.
- // This only applies to the periodic timer, not for single requests
- // We can only do this if we received a valid position before
- if (d->lastPosition.isValid()) {
- QGeoPositionInfo sent = d->lastPosition;
- sent.setTimestamp(sent.timestamp().addMSecs(updateInterval()));
- d->lastPosition = sent;
- emit positionUpdated(sent);
- }
- d->periodicTimer.start();
-}
-
-void QGeoPositionInfoSourceWinRT::singleUpdateTimeOut()
-{
- Q_D(QGeoPositionInfoSourceWinRT);
- QMutexLocker locker(&d->mutex);
-
- if (d->singleUpdateTimer.isActive()) {
- d->positionError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(d->positionError);
- if (!d->updatesOngoing)
- stopHandler();
- }
-}
-
-void QGeoPositionInfoSourceWinRT::updateSynchronized(QGeoPositionInfo currentInfo)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << currentInfo;
- Q_D(QGeoPositionInfoSourceWinRT);
- QMutexLocker locker(&d->mutex);
-
- d->periodicTimer.stop();
- d->lastPosition = currentInfo;
-
- if (d->updatesOngoing)
- d->periodicTimer.start();
-
- if (d->singleUpdateTimer.isActive()) {
- d->singleUpdateTimer.stop();
- if (!d->updatesOngoing)
- stopHandler();
- }
-
- emit positionUpdated(currentInfo);
-}
-
-QGeoPositionInfoSource::Error QGeoPositionInfoSourceWinRT::error() const
-{
- Q_D(const QGeoPositionInfoSourceWinRT);
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << d->positionError;
-
- // If the last encountered error was "Access denied", it is possible that the location service
- // has been enabled by now so that we are clear again.
- if ((d->positionError == QGeoPositionInfoSource::AccessError
- || d->positionError == QGeoPositionInfoSource::UnknownSourceError) && requestAccess())
- return QGeoPositionInfoSource::NoError;
-
- return d->positionError;
-}
-
-void QGeoPositionInfoSourceWinRT::setError(QGeoPositionInfoSource::Error positionError)
-{
- Q_D(QGeoPositionInfoSourceWinRT);
-
- if (positionError == d->positionError)
- return;
-
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << positionError;
- d->positionError = positionError;
- if (positionError != QGeoPositionInfoSource::NoError)
- emit QGeoPositionInfoSource::errorOccurred(positionError);
-}
-
-void QGeoPositionInfoSourceWinRT::reactOnError(QGeoPositionInfoSource::Error positionError)
-{
- setError(positionError);
- stopUpdates();
-}
-
-HRESULT QGeoPositionInfoSourceWinRT::onPositionChanged(IGeolocator *locator, IPositionChangedEventArgs *args)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_UNUSED(locator);
-
- HRESULT hr;
- ComPtr<IGeoposition> position;
- hr = args->get_Position(&position);
- RETURN_HR_IF_FAILED("Could not access position object.");
-
- QGeoPositionInfo currentInfo;
-
- ComPtr<IGeocoordinate> coord;
- hr = position->get_Coordinate(&coord);
- if (FAILED(hr))
- qErrnoWarning(hr, "Could not access coordinate");
-
- ComPtr<IGeocoordinateWithPoint> pointCoordinate;
- hr = coord.As(&pointCoordinate);
- if (FAILED(hr))
- qErrnoWarning(hr, "Could not cast coordinate.");
-
- ComPtr<IGeopoint> point;
- hr = pointCoordinate->get_Point(&point);
- if (FAILED(hr))
- qErrnoWarning(hr, "Could not obtain coordinate's point.");
-
- BasicGeoposition pos;
- hr = point->get_Position(&pos);
- if (FAILED(hr))
- qErrnoWarning(hr, "Could not obtain point's position.");
-
- DOUBLE lat = pos.Latitude;
- DOUBLE lon = pos.Longitude;
- DOUBLE alt = pos.Altitude;
-
- bool altitudeAvailable = false;
- ComPtr<IGeoshape> shape;
- hr = point.As(&shape);
- if (SUCCEEDED(hr) && shape) {
- AltitudeReferenceSystem altitudeSystem;
- hr = shape->get_AltitudeReferenceSystem(&altitudeSystem);
- if (SUCCEEDED(hr) && altitudeSystem == AltitudeReferenceSystem_Geoid)
- altitudeAvailable = true;
- }
- if (altitudeAvailable)
- currentInfo.setCoordinate(QGeoCoordinate(lat, lon, alt));
- else
- currentInfo.setCoordinate(QGeoCoordinate(lat, lon));
-
- DOUBLE accuracy;
- hr = coord->get_Accuracy(&accuracy);
- if (SUCCEEDED(hr))
- currentInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, accuracy);
-
- IReference<double> *altAccuracy;
- hr = coord->get_AltitudeAccuracy(&altAccuracy);
- if (SUCCEEDED(hr) && altAccuracy) {
- double value;
- hr = altAccuracy->get_Value(&value);
- currentInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, value);
- }
-
- IReference<double> *speed;
- hr = coord->get_Speed(&speed);
- if (SUCCEEDED(hr) && speed) {
- double value;
- hr = speed->get_Value(&value);
- currentInfo.setAttribute(QGeoPositionInfo::GroundSpeed, value);
- }
-
- IReference<double> *heading;
- hr = coord->get_Heading(&heading);
- if (SUCCEEDED(hr) && heading) {
- double value;
- hr = heading->get_Value(&value);
- double mod = 0;
- value = modf(value, &mod);
- value += static_cast<int>(mod) % 360;
- if (value >=0 && value <= 359) // get_Value might return nan/-nan
- currentInfo.setAttribute(QGeoPositionInfo::Direction, value);
- }
-
- DateTime dateTime;
- hr = coord->get_Timestamp(&dateTime);
-
- if (dateTime.UniversalTime > 0) {
- ULARGE_INTEGER uLarge;
- uLarge.QuadPart = dateTime.UniversalTime;
- FILETIME fileTime;
- fileTime.dwHighDateTime = uLarge.HighPart;
- fileTime.dwLowDateTime = uLarge.LowPart;
- SYSTEMTIME systemTime;
- if (FileTimeToSystemTime(&fileTime, &systemTime)) {
- currentInfo.setTimestamp(QDateTime(QDate(systemTime.wYear, systemTime.wMonth,
- systemTime.wDay),
- QTime(systemTime.wHour, systemTime.wMinute,
- systemTime.wSecond, systemTime.wMilliseconds),
- Qt::UTC));
- }
- }
-
- emit nativePositionUpdate(currentInfo);
-
- return S_OK;
-}
-
-static inline bool isDisabledStatus(PositionStatus status)
-{
- return status == PositionStatus_NoData || status == PositionStatus_Disabled
- || status == PositionStatus_NotAvailable;
-}
-
-HRESULT QGeoPositionInfoSourceWinRT::onStatusChanged(IGeolocator *, IStatusChangedEventArgs *args)
-{
- Q_D(QGeoPositionInfoSourceWinRT);
-
- const PositionStatus oldStatus = d->positionStatus;
- HRESULT hr = args->get_Status(&d->positionStatus);
- RETURN_HR_IF_FAILED("Could not obtain position status");
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << d->positionStatus;
- QGeoPositionInfoSource::Error error = QGeoPositionInfoSource::NoError;
- switch (d->positionStatus) {
- case PositionStatus::PositionStatus_NotAvailable:
- error = QGeoPositionInfoSource::UnknownSourceError;
- break;
- case PositionStatus::PositionStatus_Disabled:
- error = QGeoPositionInfoSource::AccessError;
- break;
- case PositionStatus::PositionStatus_NoData:
- error = QGeoPositionInfoSource::ClosedError;
- break;
- }
- if (error != QGeoPositionInfoSource::NoError) {
- QMetaObject::invokeMethod(this, "reactOnError", Qt::QueuedConnection,
- Q_ARG(QGeoPositionInfoSource::Error,
- QGeoPositionInfoSource::UnknownSourceError));
- }
-
- if (isDisabledStatus(oldStatus) != isDisabledStatus(d->positionStatus))
- emit supportedPositioningMethodsChanged();
-
- return S_OK;
-}
-
-bool QGeoPositionInfoSourceWinRT::requestAccess() const
-{
- Q_D(const QGeoPositionInfoSourceWinRT);
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- GeolocationAccessStatus accessStatus;
-
- ComPtr<IAsyncOperation<GeolocationAccessStatus>> op;
- HRESULT hr;
- hr = QEventDispatcherWinRT::runOnXamlThread([&op, d]() {
- HRESULT hr;
- if (!d->statics) {
- hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Geolocation_Geolocator).Get(),
- IID_PPV_ARGS(&d->statics));
- RETURN_HR_IF_FAILED("Could not access Geolocation Statics.");
- }
-
- hr = d->statics->RequestAccessAsync(&op);
- return hr;
- });
- if (FAILED(hr)) {
- qCDebug(lcPositioningWinRT) << __FUNCTION__ << "Requesting access from Xaml thread failed";
- return false;
- }
-
- // We cannot wait inside the XamlThread as that would deadlock
-#ifdef Q_OS_WINRT
- QWinRTFunctions::await(op, &accessStatus);
-#else
- await(op, &accessStatus);
-#endif
- return accessStatus == GeolocationAccessStatus_Allowed;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h
deleted file mode 100644
index dbfde0e9..00000000
--- a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCEWINRT_H
-#define QGEOPOSITIONINFOSOURCEWINRT_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 "qgeopositioninfosource.h"
-#include "qgeopositioninfo.h"
-
-#include <QtCore/qtimer.h>
-
-#include <EventToken.h>
-#include <wrl.h>
-
-namespace ABI {
- namespace Windows {
- namespace Devices {
- namespace Geolocation{
- struct IGeolocator;
- struct IPositionChangedEventArgs;
- struct IStatusChangedEventArgs;
- }
- }
- }
-}
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoSourceWinRTPrivate;
-
-class QGeoPositionInfoSourceWinRT : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- QGeoPositionInfoSourceWinRT(QObject *parent = nullptr);
- ~QGeoPositionInfoSourceWinRT() override;
- int init();
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
- PositioningMethods supportedPositioningMethods() const override;
-
- void setPreferredPositioningMethods(PositioningMethods methods) override;
-
- void setUpdateInterval(int msec) override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
- HRESULT onPositionChanged(ABI::Windows::Devices::Geolocation::IGeolocator *locator,
- ABI::Windows::Devices::Geolocation::IPositionChangedEventArgs *args);
- HRESULT onStatusChanged(ABI::Windows::Devices::Geolocation::IGeolocator *locator,
- ABI::Windows::Devices::Geolocation::IStatusChangedEventArgs *args);
-
- bool requestAccess() const;
-Q_SIGNALS:
- void nativePositionUpdate(const QGeoPositionInfo);
-public slots:
- void startUpdates() override;
- void stopUpdates() override;
-
- void requestUpdate(int timeout = 0) override;
-
-private slots:
- void stopHandler();
- void virtualPositionUpdate();
- void singleUpdateTimeOut();
- void updateSynchronized(const QGeoPositionInfo info);
- void reactOnError(QGeoPositionInfoSource::Error positionError);
-private:
- bool startHandler();
-
- Q_DISABLE_COPY(QGeoPositionInfoSourceWinRT)
- void setError(QGeoPositionInfoSource::Error positionError);
-
- QScopedPointer<QGeoPositionInfoSourceWinRTPrivate> d_ptr;
- Q_DECLARE_PRIVATE(QGeoPositionInfoSourceWinRT)
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCEWINRT_H
diff --git a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp b/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp
deleted file mode 100644
index 4e75c242..00000000
--- a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosourcefactory_winrt.h"
-#include "qgeopositioninfosource_winrt_p.h"
-
-#include <QtCore/qloggingcategory.h>
-
-Q_LOGGING_CATEGORY(lcPositioningWinRT, "qt.positioning.winrt")
-
-QT_BEGIN_NAMESPACE
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryWinRT::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_UNUSED(parameters)
- QGeoPositionInfoSourceWinRT *src = new QGeoPositionInfoSourceWinRT(parent);
- return src;
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryWinRT::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryWinRT::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- qCDebug(lcPositioningWinRT) << __FUNCTION__;
- Q_UNUSED(parent)
- Q_UNUSED(parameters)
- return nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h b/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h
deleted file mode 100644
index 3e1ca3c5..00000000
--- a/src/plugins/position/winrt/qgeopositioninfosourcefactory_winrt.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCEFACTORY_WINRT_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_WINRT_H
-
-#include <QtCore/qobject.h>
-#include <QtPositioning/qgeopositioninfosourcefactory.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoPositionInfoSourceFactoryWinRT : 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;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGEOPOSITIONINFOSOURCEFACTORY_WINRT_H
diff --git a/src/plugins/position/winrt/winrt.pro b/src/plugins/position/winrt/winrt.pro
deleted file mode 100644
index 446cb345..00000000
--- a/src/plugins/position/winrt/winrt.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qtposition_winrt
-
-QT = core core-private positioning
-
-SOURCES += qgeopositioninfosource_winrt.cpp \
- qgeopositioninfosourcefactory_winrt.cpp
-HEADERS += qgeopositioninfosource_winrt_p.h \
- qgeopositioninfosourcefactory_winrt.h
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryWinRT
-msvc:!winrt: LIBS += runtimeobject.lib
-load(qt_plugin)
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
diff --git a/src/positioningquick/CMakeLists.txt b/src/positioningquick/CMakeLists.txt
deleted file mode 100644
index 28375160..00000000
--- a/src/positioningquick/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Generated from positioningquick.pro.
-
-#####################################################################
-## PositioningQuick Module:
-#####################################################################
-
-qt_internal_add_qml_module(PositioningQuick
- URI QtPositioning
- VERSION ${CMAKE_PROJECT_VERSION}
- PLUGIN_TARGET positioningquickplugin
- NO_GENERATE_PLUGIN_SOURCE
- NO_PLUGIN_OPTIONAL
- CLASS_NAME QtPositioningDeclarativeModule
- SOURCES
- qdeclarativegeoaddress_p.h qdeclarativegeoaddress.cpp
- qdeclarativegeolocation_p.h qdeclarativegeolocation.cpp
- qdeclarativepluginparameter_p.h qdeclarativepluginparameter.cpp
- qdeclarativeposition_p.h qdeclarativeposition.cpp
- qdeclarativepositionsource_p.h qdeclarativepositionsource.cpp
- qquickgeocoordinateanimation_p.h qquickgeocoordinateanimation.cpp
- locationsingleton_p.h locationsingleton.cpp
- qquickgeocoordinateanimation_p_p.h
- qpositioningquickglobal.h
- qpositioningquickglobal_p.h
- qpositioningquickmodule_p.h
- LIBRARIES
- Qt::PositioningPrivate
- Qt::QuickPrivate
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Qml
- Qt::Quick
- PRIVATE_MODULE_INTERFACE
- Qt::PositioningPrivate
- Qt::QuickPrivate
-)
-
-qt_internal_extend_target(positioningquickplugin
- SOURCES
- positioningplugin.cpp
- LIBRARIES
- Qt::PositioningQuickPrivate
- Qt::Quick
-)
-
diff --git a/src/positioningquick/locationsingleton.cpp b/src/positioningquick/locationsingleton.cpp
deleted file mode 100644
index 81ca3eda..00000000
--- a/src/positioningquick/locationsingleton.cpp
+++ /dev/null
@@ -1,387 +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 "locationsingleton_p.h"
-#include <QtPositioning/private/qwebmercator_p.h>
-#include <QtPositioning/private/qdoublevector2d_p.h>
-#include <QDebug>
-
-static QGeoCoordinate parseCoordinate(const QJSValue &value, bool *ok)
-{
- QGeoCoordinate c;
-
- if (value.isObject()) {
- if (value.hasProperty(QStringLiteral("latitude")))
- c.setLatitude(value.property(QStringLiteral("latitude")).toNumber());
- if (value.hasProperty(QStringLiteral("longitude")))
- c.setLongitude(value.property(QStringLiteral("longitude")).toNumber());
- if (value.hasProperty(QStringLiteral("altitude")))
- c.setAltitude(value.property(QStringLiteral("altitude")).toNumber());
-
- if (ok)
- *ok = true;
- } else if (ok) {
- *ok = false;
- }
-
- return c;
-}
-
-
-/*!
- \qmltype QtPositioning
- \inqmlmodule QtPositioning
- \since 5.2
-
- \brief The QtPositioning global object provides useful functions for working with location-based
- types in QML.
-
- \qml
- import QtPositioning
-
- Item {
- property var coordinate: QtPositioning.coordinate(-27.5, 153.1)
- }
- \endqml
-*/
-
-LocationSingleton::LocationSingleton(QObject *parent)
-: QObject(parent)
-{
-}
-
-/*!
- \qmlmethod coordinate ::QtPositioning::coordinate()
-
- Constructs an invalid coordinate.
-
-*/
-QGeoCoordinate LocationSingleton::coordinate() const
-{
- return QGeoCoordinate();
-}
-
-/*!
- \qmlmethod coordinate QtPositioning::coordinate(real latitude, real longitude, real altitude) const
-
- Constructs a coordinate with the specified \a latitude, \a longitude and optional \a altitude.
- Both \a latitude and \a longitude must be valid, otherwise an invalid coordinate is returned.
-
- \sa {coordinate}
-*/
-QGeoCoordinate LocationSingleton::coordinate(double latitude, double longitude, double altitude) const
-{
- return QGeoCoordinate(latitude, longitude, altitude);
-}
-
-/*!
- \qmlmethod geoshape QtPositioning::shape() const
-
- Constructs an invalid geoshape.
-
- \sa {geoshape}
-*/
-QGeoShape LocationSingleton::shape() const
-{
- return QGeoShape();
-}
-
-/*!
- \qmlmethod georectangle QtPositioning::rectangle() const
-
- Constructs an invalid georectangle.
-
- \sa {georectangle}
-*/
-QGeoRectangle LocationSingleton::rectangle() const
-{
- return QGeoRectangle();
-}
-
-/*!
- \qmlmethod georectangle QtPositioning::rectangle(coordinate center, real width, real height) const
-
- Constructs a georectangle centered at \a center with a width of \a width degrees and a hight of
- \a height degrees.
-
- \sa {georectangle}
-*/
-QGeoRectangle LocationSingleton::rectangle(const QGeoCoordinate &center,
- double width, double height) const
-{
- return QGeoRectangle(center, width, height);
-}
-
-/*!
- \qmlmethod georectangle QtPositioning::rectangle(coordinate topLeft, coordinate bottomRight) const
-
- Constructs a georectangle with its top left corner positioned at \a topLeft and its bottom
- right corner positioned at \a {bottomRight}.
-
- \sa {georectangle}
-*/
-QGeoRectangle LocationSingleton::rectangle(const QGeoCoordinate &topLeft,
- const QGeoCoordinate &bottomRight) const
-{
- return QGeoRectangle(topLeft, bottomRight);
-}
-
-/*!
- \qmlmethod georectangle QtLocation5::QtLocation::rectangle(list<coordinate> coordinates) const
-
- Constructs a georectangle from the list of coordinates, the returned list is the smallest possible
- containing all the coordinates.
-
- \sa {georectangle}
-*/
-QGeoRectangle LocationSingleton::rectangle(const QVariantList &coordinates) const
-{
- QList<QGeoCoordinate> internalCoordinates;
- for (int i = 0; i < coordinates.size(); i++) {
- if (coordinates.at(i).canConvert<QGeoCoordinate>())
- internalCoordinates << coordinates.at(i).value<QGeoCoordinate>();
- }
- return QGeoRectangle(internalCoordinates);
-}
-
-/*!
- \qmlmethod geocircle QtPositioning::circle() const
-
- Constructs an invalid geocircle.
-
- \sa {geocircle}
-*/
-QGeoCircle LocationSingleton::circle() const
-{
- return QGeoCircle();
-}
-
-/*!
- \qmlmethod geocircle QtPositioning::circle(coordinate center, real radius) const
-
- Constructs a geocircle centered at \a center with a radius of \a radius meters.
-*/
-QGeoCircle LocationSingleton::circle(const QGeoCoordinate &center, qreal radius) const
-{
- return QGeoCircle(center, radius);
-}
-
-/*!
- \qmlmethod geopath QtPositioning::path() const
-
- Constructs an empty geopath.
-
- \sa {geopath}
- \since 5.9
-*/
-QGeoPath LocationSingleton::path() const
-{
- return QGeoPath();
-}
-
-/*!
- \qmlmethod geopath QtPositioning::path(list<coordinate> coordinates, real width) const
-
- Constructs a geopath from coordinates and width.
-
- \sa {geopath}
- \since 5.9
-*/
-QGeoPath LocationSingleton::path(const QJSValue &value, qreal width) const
-{
- QList<QGeoCoordinate> pathList;
-
- if (value.isArray()) {
- quint32 length = value.property(QStringLiteral("length")).toUInt();
- for (quint32 i = 0; i < length; ++i) {
- bool ok = false;
- QGeoCoordinate c = parseCoordinate(value.property(i), &ok);
-
- if (!ok || !c.isValid()) {
- pathList.clear(); // aborting
- break;
- }
-
- pathList.append(c);
- }
- }
-
- return QGeoPath(pathList, width);
-}
-
-/*!
- \qmlmethod geopolygon QtPositioning::polygon() const
-
- Constructs an empty polygon.
-
- \sa {geopolygon}
- \since 5.10
-*/
-QGeoPolygon LocationSingleton::polygon() const
-{
- return QGeoPolygon();
-}
-
-/*!
- \qmlmethod geopolygon QtPositioning::polygon(list<coordinate> coordinates) const
-
- Constructs a polygon from coordinates.
-
- \sa {geopolygon}
- \since 5.10
-*/
-QGeoPolygon LocationSingleton::polygon(const QVariantList &coordinates) const
-{
- QList<QGeoCoordinate> internalCoordinates;
- for (int i = 0; i < coordinates.size(); i++) {
- if (coordinates.at(i).canConvert<QGeoCoordinate>())
- internalCoordinates << coordinates.at(i).value<QGeoCoordinate>();
- }
- return QGeoPolygon(internalCoordinates);
-}
-
-/*!
- \qmlmethod geopolygon QtPositioning::polygon(list<coordinate> perimeter, list<list<coordinate>> holes) const
-
- Constructs a polygon from coordinates for perimeter and inner holes.
-
- \sa {geopolygon}
- \since 5.12
-*/
-QGeoPolygon LocationSingleton::polygon(const QVariantList &perimeter, const QVariantList &holes) const
-{
- QList<QGeoCoordinate> internalCoordinates;
- for (int i = 0; i < perimeter.size(); i++) {
- if (perimeter.at(i).canConvert<QGeoCoordinate>())
- internalCoordinates << perimeter.at(i).value<QGeoCoordinate>();
- }
- QGeoPolygon poly(internalCoordinates);
-
- for (int i = 0; i < holes.size(); i++) {
- if (holes.at(i).metaType().id() == QMetaType::QVariantList) {
- QList<QGeoCoordinate> hole;
- const QVariantList &holeData = holes.at(i).toList();
- for (int j = 0; j < holeData.size(); j++) {
- if (holeData.at(j).canConvert<QGeoCoordinate>())
- hole << holeData.at(j).value<QGeoCoordinate>();
- }
- if (hole.size())
- poly.addHole(hole);
- }
- }
-
- return poly;
-}
-
-/*!
- \qmlmethod geocircle QtPositioning::shapeToCircle(geoshape shape) const
-
- Converts \a shape to a geocircle.
-
- \sa {geocircle}
- \since 5.5
-*/
-QGeoCircle LocationSingleton::shapeToCircle(const QGeoShape &shape) const
-{
- return QGeoCircle(shape);
-}
-
-/*!
- \qmlmethod georectangle QtPositioning::shapeToRectangle(geoshape shape) const
-
- Converts \a shape to a georectangle.
-
- \sa {georectangle}
- \since 5.5
-*/
-QGeoRectangle LocationSingleton::shapeToRectangle(const QGeoShape &shape) const
-{
- return QGeoRectangle(shape);
-}
-
-/*!
- \qmlmethod geopath QtPositioning::shapeToPath(geoshape shape) const
-
- Converts \a shape to a geopath.
-
- \sa {geopath}
- \since 5.9
-*/
-QGeoPath LocationSingleton::shapeToPath(const QGeoShape &shape) const
-{
- return QGeoPath(shape);
-}
-
-/*!
- \qmlmethod geopolygon QtPositioning::shapeToPolygon(geoshape shape) const
-
- Converts \a shape to a polygon.
-
- \sa {geopolygon}
- \since 5.10
-*/
-QGeoPolygon LocationSingleton::shapeToPolygon(const QGeoShape &shape) const
-{
- return QGeoPolygon(shape);
-}
-
-/*!
- \qmlmethod coordinate QtPositioning::mercatorToCoord(point mercator) const
-
- Converts a \a mercator coordinate into a latitude-longitude coordinate.
-
- \sa {coordToMercator}
- \since 5.12
-*/
-QGeoCoordinate LocationSingleton::mercatorToCoord(const QPointF &mercator) const
-{
- return QWebMercator::mercatorToCoord(QDoubleVector2D(mercator.x(), mercator.y()));
-}
-
-/*!
- \qmlmethod point QtPositioning::coordToMercator(coordinate coord) const
-
- Converts a coordinate \a coord into a mercator coordinate and returns it.
- \sa {mercatorToCoord}
- \since 5.12
-*/
-QPointF LocationSingleton::coordToMercator(const QGeoCoordinate &coord) const
-{
- return QWebMercator::coordToMercator(coord).toPointF();
-}
diff --git a/src/positioningquick/locationsingleton_p.h b/src/positioningquick/locationsingleton_p.h
deleted file mode 100644
index 75459cb1..00000000
--- a/src/positioningquick/locationsingleton_p.h
+++ /dev/null
@@ -1,110 +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 LOCATIONSINGLETON_H
-#define LOCATIONSINGLETON_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/QObject>
-#include <QtCore/qnumeric.h>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoShape>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoPath>
-#include <QtPositioning/QGeoPolygon>
-#include <QtQml/QJSValue>
-#include <QVariant>
-#include <QPointF>
-#include <QQmlEngine>
-#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT LocationSingleton : public QObject
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(QtPositioning)
- QML_SINGLETON
- QML_ADDED_IN_VERSION(5, 0)
-
-public:
- explicit LocationSingleton(QObject *parent = 0);
-
- Q_INVOKABLE QGeoCoordinate coordinate() const;
- Q_INVOKABLE QGeoCoordinate coordinate(double latitude, double longitude,
- double altitude = qQNaN()) const;
-
- Q_INVOKABLE QGeoShape shape() const;
-
- Q_INVOKABLE QGeoRectangle rectangle() const;
- Q_INVOKABLE QGeoRectangle rectangle(const QGeoCoordinate &center,
- double width, double height) const;
- Q_INVOKABLE QGeoRectangle rectangle(const QGeoCoordinate &topLeft,
- const QGeoCoordinate &bottomRight) const;
- Q_INVOKABLE QGeoRectangle rectangle(const QVariantList &coordinates) const;
-
- Q_INVOKABLE QGeoCircle circle() const;
- Q_INVOKABLE QGeoCircle circle(const QGeoCoordinate &center, qreal radius = -1.0) const;
-
- Q_INVOKABLE QGeoPath path() const;
- Q_INVOKABLE QGeoPath path(const QJSValue &value, qreal width = 0.0) const;
-
- Q_INVOKABLE QGeoPolygon polygon() const;
- Q_INVOKABLE QGeoPolygon polygon(const QVariantList &value) const;
- Q_INVOKABLE QGeoPolygon polygon(const QVariantList &perimeter, const QVariantList &holes) const;
-
- Q_INVOKABLE QGeoCircle shapeToCircle(const QGeoShape &shape) const;
- Q_INVOKABLE QGeoRectangle shapeToRectangle(const QGeoShape &shape) const;
- Q_INVOKABLE QGeoPath shapeToPath(const QGeoShape &shape) const;
- Q_INVOKABLE QGeoPolygon shapeToPolygon(const QGeoShape &shape) const;
-
- Q_REVISION(5, 12) Q_INVOKABLE QGeoCoordinate mercatorToCoord(const QPointF &mercator) const;
- Q_REVISION(5, 12) Q_INVOKABLE QPointF coordToMercator(const QGeoCoordinate &coord) const;
-};
-
-#endif // LOCATIONSINGLETON_H
diff --git a/src/positioningquick/positioningplugin.cpp b/src/positioningquick/positioningplugin.cpp
deleted file mode 100644
index 91a9c943..00000000
--- a/src/positioningquick/positioningplugin.cpp
+++ /dev/null
@@ -1,555 +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 <private/qpositioningquickglobal_p.h>
-#include <QtPositioningQuick/private/qquickgeocoordinateanimation_p.h>
-#include <QtCore/QVariantAnimation>
-#include <QtQml/QQmlEngineExtensionPlugin>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlbasictype coordinate
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-basictypes
- \since 5.2
-
- \brief The coordinate type represents and stores a geographic position.
-
- This type is a QML representation of \l QGeoCoordinate and represents a geographic
- position in the form of \l {latitude}, \l longitude and \l altitude attributes.
- The \l latitude attribute specifies the number of
- decimal degrees above and below the equator. A positive latitude indicates the Northern
- Hemisphere and a negative latitude indicates the Southern Hemisphere. The \l longitude
- attribute specifies the number of decimal degrees east and west. A positive longitude
- indicates the Eastern Hemisphere and a negative longitude indicates the Western Hemisphere.
- The \l altitude attribute specifies the number of meters above sea level. Together, these
- attributes specify a 3-dimensional position anywhere on or near the Earth's surface.
-
- The \l isValid attribute can be used to test if a coordinate is valid. A coordinate is
- considered valid if it has a valid latitude and longitude. A valid altitude is not required.
- The latitude must be between -90 and 90 inclusive and the longitude must be between -180 and
- 180 inclusive.
-
- The \c coordinate type is used by many other types in the Qt Location module, for specifying
- the position of an object on a Map, the current position of a device and many other tasks.
- They also feature a number of important utility methods that make otherwise complex
- calculations simple to use, such as \l {atDistanceAndAzimuth}().
-
- \section1 Accuracy
-
- The latitude, longitude and altitude attributes stored in the coordinate type are represented
- as doubles, giving them approximately 16 decimal digits of precision -- enough to specify
- micrometers. The calculations performed in coordinate's methods such as \l {azimuthTo}() and
- \l {distanceTo}() also use doubles for all intermediate values, but the inherent inaccuracies in
- their spherical Earth model dominate the amount of error in their output.
-
- \section1 Example Usage
-
- Use properties of type \l var to store a \c {coordinate}. To create a \c coordinate use
- one of the methods described below. In all cases, specifying the \l altitude attribute is
- optional.
-
- To create a \c coordinate value, use the \l{QtPositioning::coordinate}{QtPositioning.coordinate()}
- function:
-
- \qml
- import QtPositioning
-
- Location { coordinate: QtPositioning.coordinate(-27.5, 153.1) }
- \endqml
-
- or as separate \l latitude, \l longitude and \l altitude components:
-
- \qml
- Location {
- coordinate {
- latitude: -27.5
- longitude: 153.1
- }
- }
- \endqml
-
- When integrating with C++, note that any QGeoCoordinate value passed into QML from C++ is
- automatically converted into a \c coordinate value, and vice-versa.
-
- \section1 Properties
-
- \section2 latitude
-
- \code
- real latitude
- \endcode
-
- This property holds the latitude value of the geographical position
- (decimal degrees). A positive latitude indicates the Northern Hemisphere,
- and a negative latitude indicates the Southern Hemisphere.
- If the property has not been set, its default value is NaN.
-
- For more details see the \l {QGeoCoordinate::latitude} property
-
- \section2 longitude
-
- \code
- real longitude
- \endcode
-
- This property holds the longitude value of the geographical position
- (decimal degrees). A positive longitude indicates the Eastern Hemisphere,
- and a negative longitude indicates the Western Hemisphere
- If the property has not been set, its default value is NaN.
-
- For more details see the \l {QGeoCoordinate::longitude} property
-
- \section2 altitude
-
- \code
- real altitude
- \endcode
-
- This property holds the altitude value (meters above sea level).
- If the property has not been set, its default value is NaN.
-
- For more details see the \l {QGeoCoordinate::altitude} property
-
- \section2 isValid
-
- \code
- bool isValid
- \endcode
-
- This property holds the current validity of the coordinate. Coordinates
- are considered valid if they have been set with a valid latitude and
- longitude (altitude is not required).
-
- The latitude must be between -90 to 90 inclusive to be considered valid,
- and the longitude must be between -180 to 180 inclusive to be considered
- valid.
-
- This is a read-only property.
-
- \section1 Methods
-
- \section2 distanceTo()
-
- \code
- real distanceTo(coordinate other)
- \endcode
-
- 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.
-
- \section2 azimuthTo()
-
- \code
- real azimuth(coordinate other)
- \endcode
-
- Returns the azimuth (or bearing) in degrees from this coordinate to the coordinate specified by
- \a other. Altitude is not used in the calculation.
-
- There is an assumption that the Earth is spherical for the purpose of this calculation.
-
- \section2 atDistanceAndAzimuth()
-
- \code
- coordinate atDistanceAndAzimuth(real distance, real azimuth)
- \endcode
-
- Returns the coordinate that is reached by traveling \a distance metres from this coordinate at
- \a azimuth degrees along a great-circle.
-
- There is an assumption that the Earth is spherical for the purpose of this calculation.
-*/
-
-/*!
- \qmlbasictype geoshape
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-basictypes
- \since 5.2
-
- \brief A geoshape type represents an abstract geographic area.
-
- This type is a QML representation of \l QGeoShape which is an abstract geographic area.
- It includes attributes and methods common to all geographic areas. To create objects
- that represent a valid geographic area use \l {georectangle} or \l {geocircle}.
-
- The \l isValid attribute can be used to test if the geoshape represents a valid geographic
- area.
-
- The \l isEmpty attribute can be used to test if the geoshape represents a region with a
- geometrical area of 0.
-
- The \l {contains}() method can be used to test if a \l {coordinate} is
- within the geoshape.
-
- \section1 Example Usage
-
- Use properties of type \l var to store a \c {geoshape}. To create a \c geoshape use one
- of the methods described below.
-
- To create a \c geoshape value, specify it as a "shape()" string:
-
- \qml
- import QtPositioning
-
- Item {
- property var region: "shape()"
- }
- \endqml
-
- or with the \l {QtPositioning::shape}{QtPositioning.shape()} function:
-
- \qml
- import QtPositioning
-
- Item {
- property var region: QtPositioning.shape()
- }
- \endqml
-
- When integrating with C++, note that any QGeoShape value passed into QML from C++ is
- automatically converted into a \c geoshape value, and vice-versa.
-
- \section1 Properties
-
- \section2 isEmpty
-
- \code
- bool isEmpty
- \endcode
-
- Returns whether this geoshape is empty. An empty geoshape is a region which has
- a geometrical area of 0.
-
- \section2 isValid
-
- \code
- bool isValid
- \endcode
-
- Returns whether this geoshape is valid.
-
- A geoshape is considered to be invalid if some of the data that is required to
- unambiguously describe the geoshape has not been set or has been set to an
- unsuitable value.
-
- \section2 type
-
- \code
- ShapeType type
- \endcode
-
- Returns the current type of the shape.
-
- \list
- \li \c GeoShape.UnknownType - The shape's type is not known.
- \li \c GeoShape.RectangleType - The shape is a \l georectangle.
- \li \c GeoShape.CircleType - The shape is a \l geocircle.
- \li \c GeoShape.PathType - The shape is a \l geopath. (Since Qt 5.9)
- \li \c GeoShape.PolygonType - The shape is a \l geopolygon. (Since Qt 5.10)
- \endlist
-
- This QML property was introduced by Qt 5.5.
-
- \section1 Methods
-
- \section2 contains()
-
- \code
- bool contains(coordinate coord)
- \endcode
-
- Returns true if the \l {QtPositioning::coordinate}{coordinate} specified by \a coord is within
- this geoshape; Otherwise returns false.
-*/
-
-/*!
- \qmlbasictype georectangle
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-basictypes
- \since 5.2
-
- \brief The georectangle type represents a rectangular geographic area.
-
- The \c georectangle type is a \l {geoshape} that represents a
- rectangular geographic area. The type is direct representation of a \l QGeoRectangle.
- It is defined by a pair of \l {coordinate}{coordinates} which represent the top-left
- and bottom-right corners of the \c {georectangle}. The coordinates are accessible
- from the \l topLeft and \l bottomRight attributes.
-
- A \c georectangle 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.
-
- The coordinates of the four corners of the \c georectangle can be accessed with the
- \l {topLeft}, \l {topRight}, \l {bottomLeft} and \l {bottomRight} attributes. The \l center
- attribute can be used to get the coordinate of the center of the \c georectangle. The \l width
- and \l height attributes can be used to get the width and height of the \c georectangle in
- degrees. Setting one of these attributes will cause the other attributes to be adjusted
- accordingly.
-
- \section1 Limitations
-
- A \c georectangle can never cross the poles.
-
- If the height or center of a \c georectangle is adjusted such that it would cross one of the
- poles the height is modified such that the \c georectangle touches but does not cross the pole
- and that the center coordinate is still in the center of the \c georectangle.
-
- \section1 Example Usage
-
- Use properties of type \l var to store a \c {georectangle}. To create a \c georectangle
- value, use the \l {QtPositioning::rectangle}{QtPositioning.rectangle()} function:
-
- \qml
- import QtPositioning
-
- Item {
- property var region: QtPositioning.rectangle(QtPositioning.coordinate(-27.5, 153.1), QtPositioning.coordinate(-27.6, 153.2))
- }
- \endqml
-
- When integrating with C++, note that any QGeoRectangle value passed into QML from C++ is
- automatically converted into a \c georectangle value, and vice-versa.
-
- \section1 Properties
-
- \section2 bottomLeft
-
- \code
- coordinate bottomLeft
- \endcode
-
- This property holds the bottom left coordinate of this georectangle.
-
- \section2 bottomRight
-
- \code
- coordinate bottomRight
- \endcode
-
- This property holds the bottom right coordinate of this georectangle.
-
- \section2 center
-
- \code
- coordinate center
- \endcode
-
- This property holds the center coordinate of this georectangle. For more details
- see \l {QGeoRectangle::setCenter()}.
-
- \section2 height
-
- \code
- double height
- \endcode
-
- This property holds the height of this georectangle (in degrees). For more details
- see \l {QGeoRectangle::setHeight()}.
-
- \note If the georectangle is invalid, it is not possible to set the height. QtPositioning
- releases prior to Qt 5.5 permitted the setting of the height even on invalid georectangles.
-
- \section2 topLeft
-
- \code
- coordinate topLeft
- \endcode
-
- This property holds the top left coordinate of this georectangle.
-
- \section2 topRight
-
- \code
- coordinate topRight
- \endcode
-
- This property holds the top right coordinate of this georectangle.
-
- \section2 width
-
- \code
- double width
- \endcode
-
- This property holds the width of this georectangle (in degrees). For more details
- see \l {QGeoRectangle::setWidth()}.
-
- \note If the georectangle is invalid, it is not possible to set the width. QtPositioning
- releases prior to Qt 5.5 permitted the setting of the width even on invalid georectangles.
-*/
-
-/*!
- \qmlbasictype geocircle
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-basictypes
- \since 5.2
-
- \brief The geocircle type represents a circular geographic area.
-
- The \c geocircle type is a \l {geoshape} that represents a circular
- geographic area. It is a direct representation of a \l QGeoCircle and is defined
- in terms of a \l {coordinate} which specifies the \l center of the circle and
- a qreal which specifies the \l radius of the circle in meters.
-
- The circle is considered invalid if the \l center coordinate is invalid or if
- the \l radius is less than zero.
-
- \section1 Example Usage
-
- Use properties of type \l var to store a \c {geocircle}. To create a \c geocircle value,
- use the \l {QtPositioning::circle}{QtPositioning.circle()} function:
-
- \qml
- import QtPositioning
-
- Item {
- property var region: QtPositioning.circle(QtPositioning.coordinate(-27.5, 153.1), 1000)
- }
- \endqml
-
- When integrating with C++, note that any QGeoCircle value passed into QML from C++ is
- automatically converted into a \c geocircle value, and vise-versa.
-
- \section1 Properties
-
- \section2 center
-
- \code
- coordinate radius
- \endcode
-
- This property holds the coordinate of the center of the geocircle.
-
- \section2 radius
-
- \code
- real radius
- \endcode
-
- This property holds the radius of the geocircle in meters.
-
- The default value for the radius is -1 indicating an invalid geocircle area.
-*/
-
-/*!
- \qmlbasictype geopath
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-basictypes
- \since 5.9
-
- \brief The geopath type represents a geographic path.
-
- The \c geopath type is a \l {geoshape} that represents a geographic
- path. It is a direct representation of a \l QGeoPath and is defined
- in terms of a \l {path} which holds the list of geo coordinates in the
- path.
-
- The path is considered invalid if it is empty.
-
- When integrating with C++, note that any QGeoPath value passed into QML from C++ is
- automatically converted into a \c geopath value, and vice versa.
-
- \section1 Properties
-
- \section2 path
-
- This property holds the list of coordinates defining the path.
-
- \section2 width
-
- This property holds the width of the path in meters. This is currently only used
- when calling the \l {contains}() method.
-
- The default value for the width is 0.
-*/
-
-/*!
- \qmlbasictype geopolygon
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-basictypes
- \since 5.10
-
- \brief The geopolygon type represents a geographic polygon.
-
- The \c geopolygon type is a \l [QML] geoshape that represents a geographic
- polygon. It is a direct representation of QGeoPolygon and is defined in
- terms of a \l path which holds a list of geo coordinates in the polygon.
-
- The polygon is considered invalid if its path holds less than three
- coordinates.
-
- When integrating with C++, note that any QGeoPolygon value passed into QML
- is automatically converted into a \c geopolygon, and vice versa.
-
- \section1 Properties
-
- \section2 path
-
- This property holds the list of coordinates defining the polygon.
-*/
-
-class QtPositioningDeclarativeModule: public QQmlEngineExtensionPlugin
-{
- Q_OBJECT
-
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- QtPositioningDeclarativeModule(QObject *parent = 0) : QQmlEngineExtensionPlugin(parent)
- {
- volatile auto registration = &qml_register_types_QtPositioning;
- Q_UNUSED(registration)
- }
-};
-
-void QtPositioningDeclarative_initializeModule()
-{
- qRegisterAnimationInterpolator<QGeoCoordinate>(q_coordinateInterpolator);
-}
-
-Q_CONSTRUCTOR_FUNCTION(QtPositioningDeclarative_initializeModule)
-
-QT_END_NAMESPACE
-
-#include "positioningplugin.moc"
diff --git a/src/positioningquick/positioningquick.pro b/src/positioningquick/positioningquick.pro
deleted file mode 100644
index 75bd68a3..00000000
--- a/src/positioningquick/positioningquick.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = QtPositioningQuick
-QT = quick-private positioning-private qml-private core-private
-CONFIG += simd optimize_full
-
-INCLUDEPATH += $$PWD
-
-SOURCES += $$files(*.cpp)
-HEADERS += $$files(*.h)
-
-load(qt_module)
diff --git a/src/positioningquick/qdeclarativegeoaddress.cpp b/src/positioningquick/qdeclarativegeoaddress.cpp
deleted file mode 100644
index 9954a7b7..00000000
--- a/src/positioningquick/qdeclarativegeoaddress.cpp
+++ /dev/null
@@ -1,380 +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 "qdeclarativegeoaddress_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Address
- \inqmlmodule QtPositioning
- \since 5.2
-
- \brief The Address QML type represents a specific location as a street address.
-
- An Address is used as a unit of data for queries such as (Reverse) Geocoding
- or Places searches -- many of these operations either accept an Address
- or return one.
-
- Not all properties of an Address are necessarily available or relevant
- in all parts of the world and all locales. The \l district, \l state and
- \l county properties are particularly area-specific for many data sources,
- and often only one or two of these are available or useful.
-
- The Address has a \l text property which holds a formatted string. It
- is the recommended way to display an address to the user and typically
- takes the format of an address as found on an envelope, but this is not always
- the case. The \l text may be automatically generated from constituent
- address properties such as \l street, \l city and and so on, but can also
- be explicitly assigned. See \l text for details.
-
- \section2 Example Usage
-
- The following code snippet shows the declaration of an Address object.
-
- \code
- Address {
- id: address
- street: "53 Brandl St"
- city: "Eight Mile Plains"
- country: "Australia"
- countryCode: "AUS"
- }
- \endcode
-
- This could then be used, for example, as the value of a geocoding query,
- to get an exact longitude and latitude for the address.
-
- \sa {QGeoAddress}
-*/
-
-QDeclarativeGeoAddress::QDeclarativeGeoAddress(QObject *parent) :
- QObject(parent)
-{
-}
-
-QDeclarativeGeoAddress::QDeclarativeGeoAddress(const QGeoAddress &address, QObject *parent) :
- QObject(parent), m_address(address)
-{
-}
-
-/*!
- \qmlproperty QGeoAddress QtPositioning::Address::address
-
- For details on how to use this property to interface between C++ and QML see
- "\l {Address - QGeoAddress} {Interfaces between C++ and QML Code}".
-*/
-QGeoAddress QDeclarativeGeoAddress::address() const
-{
- return m_address;
-}
-
-void QDeclarativeGeoAddress::setAddress(const QGeoAddress &address)
-{
- // Elaborate but takes care of emiting needed signals
- setText(address.text());
- setCountry(address.country());
- setCountryCode(address.countryCode());
- setState(address.state());
- setCounty(address.county());
- setCity(address.city());
- setDistrict(address.district());
- setStreet(address.street());
- setStreetNumber(address.streetNumber());
- setPostalCode(address.postalCode());
- m_address = address;
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::text
-
- This property holds 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 \c text is either automatically generated or explicitly assigned,
- this can be determined by checking \l isTextGenerated.
-
- If an empty string is assigned to \c text, then \l isTextGenerated will be set
- to true and \c text will return a string which is locally formatted according to
- \l countryCode and based on the properties of the address. Modifying the address
- properties such as \l street, \l city and so on may cause the contents of \c text to
- change.
-
- If a non-empty string is assigned to \c text, then \l isTextGenerated will be
- set to false and \c text will always return the explicitly assigned string.
- Modifying address properties will not affect the \c text property.
-*/
-QString QDeclarativeGeoAddress::text() const
-{
- return m_address.text();
-}
-
-void QDeclarativeGeoAddress::setText(const QString &address)
-{
- QString oldText = m_address.text();
- bool oldIsTextGenerated = m_address.isTextGenerated();
- m_address.setText(address);
-
- if (oldText != m_address.text())
- emit textChanged();
- if (oldIsTextGenerated != m_address.isTextGenerated())
- emit isTextGeneratedChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::country
-
- This property holds the country of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::country() const
-{
- return m_address.country();
-}
-
-void QDeclarativeGeoAddress::setCountry(const QString &country)
-{
- if (m_address.country() == country)
- return;
- QString oldText = m_address.text();
- m_address.setCountry(country);
- emit countryChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::countryCode
-
- This property holds the country code of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::countryCode() const
-{
- return m_address.countryCode();
-}
-
-void QDeclarativeGeoAddress::setCountryCode(const QString &countryCode)
-{
- if (m_address.countryCode() == countryCode)
- return;
- QString oldText = m_address.text();
- m_address.setCountryCode(countryCode);
- emit countryCodeChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::state
-
- This property holds the state of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::state() const
-{
- return m_address.state();
-}
-
-void QDeclarativeGeoAddress::setState(const QString &state)
-{
- if (m_address.state() == state)
- return;
- QString oldText = m_address.text();
- m_address.setState(state);
- emit stateChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::county
-
- This property holds the county of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::county() const
-{
- return m_address.county();
-}
-
-void QDeclarativeGeoAddress::setCounty(const QString &county)
-{
- if (m_address.county() == county)
- return;
- QString oldText = m_address.text();
- m_address.setCounty(county);
- emit countyChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::city
-
- This property holds the city of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::city() const
-{
- return m_address.city();
-}
-
-void QDeclarativeGeoAddress::setCity(const QString &city)
-{
- if (m_address.city() == city)
- return;
- QString oldText = m_address.text();
- m_address.setCity(city);
- emit cityChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::district
-
- This property holds the district of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::district() const
-{
- return m_address.district();
-}
-
-void QDeclarativeGeoAddress::setDistrict(const QString &district)
-{
- if (m_address.district() == district)
- return;
- QString oldText = m_address.text();
- m_address.setDistrict(district);
- emit districtChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::street
-
- This property holds the street of the address.
-
- \note Before Qt6 this property could also contain things like a unit number,
- a building name, or anything else that might be used to distinguish one
- address from another. Since Qt6 use \l{QtPositioning::Address::}{streetNumber}
- property for such information.
-*/
-QString QDeclarativeGeoAddress::street() const
-{
- return m_address.street();
-}
-
-void QDeclarativeGeoAddress::setStreet(const QString &street)
-{
- if (m_address.street() == street)
- return;
- QString oldText = m_address.text();
- m_address.setStreet(street);
- emit streetChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::streetNumber
- \since QtPositioning 6.2
-
- This property holds the street number of the address like a unit number,
- a building name, or anything else that might be used to distinguish one
- address from another.
-*/
-QString QDeclarativeGeoAddress::streetNumber() const
-{
- return m_address.streetNumber();
-}
-
-void QDeclarativeGeoAddress::setStreetNumber(const QString &streetNumber)
-{
- if (m_address.streetNumber() == streetNumber)
- return;
- QString oldText = m_address.text();
- m_address.setStreetNumber(streetNumber);
- emit streetNumberChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty string QtPositioning::Address::postalCode
-
- This property holds the postal code of the address as a single formatted string.
-*/
-QString QDeclarativeGeoAddress::postalCode() const
-{
- return m_address.postalCode();
-}
-
-void QDeclarativeGeoAddress::setPostalCode(const QString &postalCode)
-{
- if (m_address.postalCode() == postalCode)
- return;
- QString oldText = m_address.text();
- m_address.setPostalCode(postalCode);
- emit postalCodeChanged();
-
- if (m_address.isTextGenerated() && oldText != m_address.text())
- emit textChanged();
-}
-
-/*!
- \qmlproperty bool QtPositioning::Address::isTextGenerated
-
- This property holds a boolean that if true, indicates that \l text is automatically
- generated from address properties. If false, it indicates that the \l text has been
- explicitly assigned.
-
-*/
-bool QDeclarativeGeoAddress::isTextGenerated() const
-{
- return m_address.isTextGenerated();
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioningquick/qdeclarativegeoaddress_p.h b/src/positioningquick/qdeclarativegeoaddress_p.h
deleted file mode 100644
index d98be2e4..00000000
--- a/src/positioningquick/qdeclarativegeoaddress_p.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 QDECLARATIVEGEOADDRESS_P_H
-#define QDECLARATIVEGEOADDRESS_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/QObject>
-#include <QtPositioning/QGeoAddress>
-#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-#include <QQmlEngine>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativeGeoAddress : public QObject
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(Address)
- QML_ADDED_IN_VERSION(5, 0)
-
- Q_PROPERTY(QGeoAddress address READ address WRITE setAddress)
- Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
- Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged)
- Q_PROPERTY(QString countryCode READ countryCode WRITE setCountryCode NOTIFY countryCodeChanged)
- Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
- Q_PROPERTY(QString county READ county WRITE setCounty NOTIFY countyChanged)
- Q_PROPERTY(QString city READ city WRITE setCity NOTIFY cityChanged)
- Q_PROPERTY(QString district READ district WRITE setDistrict NOTIFY districtChanged)
- Q_PROPERTY(QString street READ street WRITE setStreet NOTIFY streetChanged)
- Q_PROPERTY(QString streetNumber READ streetNumber WRITE setStreetNumber
- NOTIFY streetNumberChanged REVISION(6, 2))
- Q_PROPERTY(QString postalCode READ postalCode WRITE setPostalCode NOTIFY postalCodeChanged)
- Q_PROPERTY(bool isTextGenerated READ isTextGenerated NOTIFY isTextGeneratedChanged)
-
-public:
- explicit QDeclarativeGeoAddress(QObject *parent = 0);
- QDeclarativeGeoAddress(const QGeoAddress &address, QObject *parent = 0);
- QGeoAddress address() const;
- void setAddress(const QGeoAddress &address);
-
- QString text() const;
- void setText(const QString &address);
-
- 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 street() const;
- void setStreet(const QString &street);
- QString streetNumber() const;
- void setStreetNumber(const QString &streetNumber);
- QString postalCode() const;
- void setPostalCode(const QString &postalCode);
- bool isTextGenerated() const;
-
-Q_SIGNALS:
- void textChanged();
- void countryChanged();
- void countryCodeChanged();
- void stateChanged();
- void countyChanged();
- void cityChanged();
- void districtChanged();
- void streetChanged();
- void streetNumberChanged();
- void postalCodeChanged();
- void isTextGeneratedChanged();
-
-private:
- QGeoAddress m_address;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVEGEOADDRESS_P_H
diff --git a/src/positioningquick/qdeclarativegeolocation.cpp b/src/positioningquick/qdeclarativegeolocation.cpp
deleted file mode 100644
index b62ab7ca..00000000
--- a/src/positioningquick/qdeclarativegeolocation.cpp
+++ /dev/null
@@ -1,244 +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 "qdeclarativegeolocation_p.h"
-
-QT_USE_NAMESPACE
-
-/*!
- \qmltype Location
- \inqmlmodule QtPositioning
- \since 5.2
-
- \brief The Location type holds location data.
-
- Location types represent a geographic "location", in a human sense. This
- consists of a specific \l {coordinate}, an \l {address} and a
- \l {boundingShape}{bounding shape}.
- The \l {boundingShape}{bounding shape} represents the recommended region
- to display when viewing this location.
-
- The Location type is most commonly seen as the contents of a search
- model such as the GeocodeModel. When a GeocodeModel returns the list of
- locations found for a given query, it represents these as Location objects.
-
- \section2 Example Usage
-
- The following example shows a simple Location object being declared:
-
- \code
- Location {
- coordinate {
- latitude: -27.3
- longitude: 153.1
- }
- address: Address {
- ...
- }
- }
- \endcode
-*/
-
-/*!
- \qmlproperty VariantMap QDeclarativeGeoLocation::extendedAttributes
-
- This property holds the extended attributes for this Location.
- Extended attributes are backend-dependent and can be location-dependent.
-
- \since 5.13
-*/
-
-QDeclarativeGeoLocation::QDeclarativeGeoLocation(QObject *parent)
-: QObject(parent)
-
-{
- setLocation(QGeoLocation());
-}
-
-QDeclarativeGeoLocation::QDeclarativeGeoLocation(const QGeoLocation &src, QObject *parent)
-: QObject(parent)
-{
- setLocation(src);
-}
-
-QDeclarativeGeoLocation::~QDeclarativeGeoLocation()
-{
-}
-
-/*!
- \qmlproperty QGeoLocation QtPositioning::Location::location
-
- For details on how to use this property to interface between C++ and QML see
- "\l {Location - QGeoLocation} {Interfaces between C++ and QML Code}".
-
- \note This property updates the whole geo location information, so using it
- will result in breaking of all the bindings for all other properties.
-*/
-void QDeclarativeGeoLocation::setLocation(const QGeoLocation &src)
-{
- if (m_address && m_address->parent() == this) {
- m_address->setAddress(src.address());
- } else if (!m_address || m_address->parent() != this) {
- m_address.setValue(new QDeclarativeGeoAddress(src.address(), this));
- m_address.notify();
- }
-
- setCoordinate(src.coordinate());
- setBoundingShape(src.boundingShape());
- setExtendedAttributes(src.extendedAttributes());
-}
-
-QGeoLocation QDeclarativeGeoLocation::location() const
-{
- QGeoLocation retValue;
- retValue.setAddress(m_address ? m_address->address() : QGeoAddress());
- retValue.setCoordinate(m_coordinate);
- retValue.setBoundingShape(m_boundingShape);
- retValue.setExtendedAttributes(m_extendedAttributes);
- return retValue;
-}
-
-/*!
- \qmlproperty Address QtPositioning::Location::address
-
- This property holds the address of the location which can be use to retrieve address details of the location.
-*/
-void QDeclarativeGeoLocation::setAddress(QDeclarativeGeoAddress *address)
-{
- m_address.removeBindingUnlessInWrapper();
- if (m_address == address)
- return;
-
- // implicitly deleting m_address.value() will force the QML bindings to
- // be reevaluated by the QML engine. So we defer the deletion of the old
- // address until a new value is assigned to the m_address.
- QDeclarativeGeoAddress *oldAddress = nullptr;
- if (m_address && m_address->parent() == this)
- oldAddress = m_address.value();
-
- m_address.setValueBypassingBindings(address);
- m_address.notify();
- delete oldAddress;
-}
-
-QBindable<QDeclarativeGeoAddress *> QDeclarativeGeoLocation::bindableAddress()
-{
- return QBindable<QDeclarativeGeoAddress *>(&m_address);
-}
-
-QDeclarativeGeoAddress *QDeclarativeGeoLocation::address() const
-{
- return m_address;
-}
-
-/*!
- \qmlproperty coordinate QtPositioning::Location::coordinate
-
- This property holds the exact geographical coordinate of the location which can be used to retrieve the latitude, longitude and altitude of the location.
-
- \note this property's changed() signal is currently emitted only if the
- whole object changes, not if only the contents of the object change.
-*/
-void QDeclarativeGeoLocation::setCoordinate(const QGeoCoordinate coordinate)
-{
- m_coordinate = coordinate;
-}
-
-QBindable<QGeoCoordinate> QDeclarativeGeoLocation::bindableCoordinate()
-{
- return QBindable<QGeoCoordinate>(&m_coordinate);
-}
-
-QGeoCoordinate QDeclarativeGeoLocation::coordinate() const
-{
- return m_coordinate;
-}
-
-/*!
- \since QtPositioning 6.2
-
- \qmlproperty geoshape QtPositioning::Location::boundingShape
-
- This property holds the recommended region to use when displaying the 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 property's changed() signal is currently emitted only if the
- whole object changes, not if only the contents of the object change.
-
- \note This property was introduced in Qt6 instead of boundingBox property.
- It returns a \l geoshape instead of a \l georectangle.
- Use \l QGeoShape::boundingGeoRectangle() to obtain a bounding
- \l georectangle for the shape.
-
- If you need to convert the returned shape to a specific type, use the
- \c type property of \l geoshape together with convenience
- methods from \l [QML]{QtPositioning} like
- \l {QtPositioning::shapeToRectangle}{QtPositioning.shapeToRectangle()}.
-*/
-void QDeclarativeGeoLocation::setBoundingShape(const QGeoShape &boundingShape)
-{
- m_boundingShape = boundingShape;
-}
-
-QBindable<QGeoShape> QDeclarativeGeoLocation::bindableBoundingShape()
-{
- return QBindable<QGeoShape>(&m_boundingShape);
-}
-
-QVariantMap QDeclarativeGeoLocation::extendedAttributes() const
-{
- return m_extendedAttributes;
-}
-
-void QDeclarativeGeoLocation::setExtendedAttributes(const QVariantMap &attributes)
-{
- m_extendedAttributes = attributes;
-}
-
-QBindable<QVariantMap> QDeclarativeGeoLocation::bindableExtendedAttributes()
-{
- return QBindable<QVariantMap>(&m_extendedAttributes);
-}
-
-QGeoShape QDeclarativeGeoLocation::boundingShape() const
-{
- return m_boundingShape;
-}
diff --git a/src/positioningquick/qdeclarativegeolocation_p.h b/src/positioningquick/qdeclarativegeolocation_p.h
deleted file mode 100644
index c1083952..00000000
--- a/src/positioningquick/qdeclarativegeolocation_p.h
+++ /dev/null
@@ -1,114 +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 QDECLARATIVEGEOLOCATION_P_H
-#define QDECLARATIVEGEOLOCATION_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/QObject>
-#include <QtCore/QVariantMap>
-#include <QtCore/private/qproperty_p.h>
-#include <QtPositioning/QGeoLocation>
-#include <QtPositioning/QGeoShape>
-#include <QtPositioningQuick/private/qdeclarativegeoaddress_p.h>
-#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativeGeoLocation : public QObject
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(Location)
- QML_ADDED_IN_VERSION(5, 0)
-
- Q_PROPERTY(QGeoLocation location READ location WRITE setLocation)
- Q_PROPERTY(QDeclarativeGeoAddress *address READ address WRITE setAddress BINDABLE
- bindableAddress)
- Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate BINDABLE
- bindableCoordinate)
- Q_PROPERTY(QGeoShape boundingShape READ boundingShape WRITE setBoundingShape BINDABLE
- bindableBoundingShape REVISION(6, 2))
- Q_PROPERTY(QVariantMap extendedAttributes READ extendedAttributes WRITE setExtendedAttributes
- BINDABLE bindableExtendedAttributes REVISION(5, 13))
-
-public:
- explicit QDeclarativeGeoLocation(QObject *parent = 0);
- explicit QDeclarativeGeoLocation(const QGeoLocation &src, QObject *parent = 0);
- ~QDeclarativeGeoLocation();
-
- QGeoLocation location() const;
- void setLocation(const QGeoLocation &src);
-
- QDeclarativeGeoAddress *address() const;
- void setAddress(QDeclarativeGeoAddress *address);
- QBindable<QDeclarativeGeoAddress *> bindableAddress();
-
- QGeoCoordinate coordinate() const;
- void setCoordinate(const QGeoCoordinate coordinate);
- QBindable<QGeoCoordinate> bindableCoordinate();
-
- QGeoShape boundingShape() const;
- void setBoundingShape(const QGeoShape &boundingShape);
- QBindable<QGeoShape> bindableBoundingShape();
-
- QVariantMap extendedAttributes() const;
- void setExtendedAttributes(const QVariantMap &attributes);
- QBindable<QVariantMap> bindableExtendedAttributes();
-
-private:
- Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QDeclarativeGeoLocation, QDeclarativeGeoAddress *, m_address,
- &QDeclarativeGeoLocation::setAddress, nullptr)
- Q_OBJECT_BINDABLE_PROPERTY(QDeclarativeGeoLocation, QGeoShape, m_boundingShape)
- Q_OBJECT_BINDABLE_PROPERTY(QDeclarativeGeoLocation, QGeoCoordinate, m_coordinate)
- Q_OBJECT_BINDABLE_PROPERTY(QDeclarativeGeoLocation, QVariantMap, m_extendedAttributes)
-};
-
-QT_END_NAMESPACE
-
-#endif // QDECLARATIVELOCATION_P_H
diff --git a/src/positioningquick/qdeclarativepluginparameter.cpp b/src/positioningquick/qdeclarativepluginparameter.cpp
deleted file mode 100644
index 0092777f..00000000
--- a/src/positioningquick/qdeclarativepluginparameter.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativepluginparameter_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype PluginParameter
- \inqmlmodule QtPositioning
- \ingroup qml-QtPositioning5-common
- \since QtPositioning 5.14
-
- \brief The PluginParameter type describes a parameter for a
- \omit
- plugin, either geoservice \l Plugin, or
- \endomit
- position plugin.
-
- The PluginParameter object is used to provide a parameter of some kind
- to a plugin. Typically, these parameters contain details like an application
- token for access to a service, or a proxy server to use for network access,
- or the serial port to which a serial GPS receiver is connected.
-
- To set such a parameter, declare a PluginParameter inside an element that
- accepts plugin parameters as configuration objects, such as a
- \omit
- \l Plugin object, or a
- \endomit
- \l PositionSource object, and set values for its \l{name} and \l{value}
- properties. A list of valid parameter names for each plugin is available
- from the
- \omit
- \l {Qt Location#Plugin References and Parameters}{plugin reference pages}
- for geoservice plugins, and
- \endomit
- \l {Qt Positioning plugins#Default plugins}{default plugins page} for
- position plugins.
-
- \section2 Example Usage
-
- The following example shows the instantiation of the
- \l {Qt Positioning NMEA plugin}{NMEA} plugin with the \e nmea.source
- parameter that specifies the data source.
-
- \code
- PositionSource {
- name: "nmea"
- PluginParameter { name: "nmea.source"; value: "serial:/dev/ttyACM0" }
- }
- \endcode
-*/
-
-/*!
- \qmlproperty string PluginParameter::name
-
- This property holds the name of the plugin parameter as a single formatted string.
- This property is a write-once property.
-*/
-
-/*!
- \qmlproperty QVariant PluginParameter::value
-
- This property holds the value of the plugin parameter which support different types of values (variant).
- This property is a write-once property.
-*/
-
-QDeclarativePluginParameter::QDeclarativePluginParameter(QObject *parent)
- : QObject(parent) {}
-
-QDeclarativePluginParameter::~QDeclarativePluginParameter() {}
-
-void QDeclarativePluginParameter::setName(const QString &name)
-{
- if (!name_.isEmpty() || name.isEmpty())
- return;
-
- name_ = name;
-
- emit nameChanged(name_);
- if (value_.isValid())
- emit initialized();
-}
-
-QString QDeclarativePluginParameter::name() const
-{
- return name_;
-}
-
-void QDeclarativePluginParameter::setValue(const QVariant &value)
-{
- if (value_.isValid() || !value.isValid() || value.isNull())
- return;
-
- value_ = value;
-
- emit valueChanged(value_);
- if (!name_.isEmpty())
- emit initialized();
-}
-
-QVariant QDeclarativePluginParameter::value() const
-{
- return value_;
-}
-
-bool QDeclarativePluginParameter::isInitialized() const
-{
- return !name_.isEmpty() && value_.isValid();
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioningquick/qdeclarativepluginparameter_p.h b/src/positioningquick/qdeclarativepluginparameter_p.h
deleted file mode 100644
index 2d3b8e2a..00000000
--- a/src/positioningquick/qdeclarativepluginparameter_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** 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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEPLUGINPARAMETER_P_H
-#define QDECLARATIVEPLUGINPARAMETER_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 <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-#include <QtQml/qqml.h>
-#include <QtCore/QMap>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
-#include <QtCore/QVariant>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePluginParameter : public QObject
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(PluginParameter)
- QML_ADDED_IN_VERSION(5, 14)
-
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
-
-public:
- explicit QDeclarativePluginParameter(QObject *parent = 0);
- ~QDeclarativePluginParameter();
-
- void setName(const QString &name);
- QString name() const;
-
- void setValue(const QVariant &value);
- QVariant value() const;
-
- bool isInitialized() const;
-
-Q_SIGNALS:
- void nameChanged(const QString &name);
- void valueChanged(const QVariant &value);
- void initialized();
-
-private:
- QString name_;
- QVariant value_;
-};
-
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativePluginParameter)
-
-#endif // QDECLARATIVEPLUGINPARAMETER_P_H
diff --git a/src/positioningquick/qdeclarativeposition.cpp b/src/positioningquick/qdeclarativeposition.cpp
deleted file mode 100644
index 515fef9d..00000000
--- a/src/positioningquick/qdeclarativeposition.cpp
+++ /dev/null
@@ -1,621 +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 <QtCore/QtNumeric>
-#include "qdeclarativeposition_p.h"
-#include <QtQml/qqml.h>
-#include <qnmeapositioninfosource.h>
-#include <QFile>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Position
- //! \instantiates QDeclarativePosition
- \inqmlmodule QtPositioning
- \since 5.2
-
- \brief The Position type holds positional data at a particular point in time,
- such as coordinate (longitude, latitude, altitude) and speed.
-
- The Position type holds values related to geographic location such as
- a \l coordinate (longitude, latitude, and altitude), the \l timestamp when
- the Position was obtained, the \l speed at that time, and the accuracy of
- the data.
-
- Primarily, it is used in the \l{PositionSource::position}{position} property
- of a \l{PositionSource}, as the basic unit of data available from the system
- location data source.
-
- Not all properties of a Position object are necessarily valid or available
- (for example latitude and longitude may be valid, but speed update has not been
- received or set manually). As a result, corresponding "valid" properties
- are available (for example \l{coordinate} and \l{longitudeValid}, \l{latitudeValid}
- etc) to discern whether the data is available and valid in this position
- update.
-
- Position objects are read-only and can only be produced by a PositionSource.
-
- \section2 Example Usage
-
- See the example given for the \l{PositionSource} type, or the
- \l{geoflickr}{GeoFlickr} example application.
-
- \sa PositionSource, coordinate
-*/
-
-namespace
-{
-
-bool equalOrNaN(qreal a, qreal b)
-{
- return a == b || (qIsNaN(a) && qIsNaN(b));
-}
-
-bool exclusiveNaN(qreal a, qreal b)
-{
- return qIsNaN(a) != qIsNaN(b);
-}
-
-}
-
-QDeclarativePosition::QDeclarativePosition(QObject *parent)
-: QObject(parent)
-{
-}
-
-QDeclarativePosition::~QDeclarativePosition()
-{
-}
-
-void QDeclarativePosition::setPosition(const QGeoPositionInfo &info)
-{
- // timestamp
- const QDateTime pTimestamp = m_info.timestamp();
- const QDateTime timestamp = info.timestamp();
- const bool timestampChanged = pTimestamp != timestamp;
-
- // coordinate
- const QGeoCoordinate pCoordinate = m_info.coordinate();
- const QGeoCoordinate coordinate = info.coordinate();
- const bool coordinateChanged = pCoordinate != coordinate;
- const bool latitudeValidChanged = exclusiveNaN(pCoordinate.latitude(), coordinate.latitude());
- const bool longitudeValidChanged =
- exclusiveNaN(pCoordinate.longitude(), coordinate.longitude());
- const bool altitudeValidChanged = exclusiveNaN(pCoordinate.altitude(), coordinate.altitude());
-
- // direction
- const qreal pDirection = m_info.attribute(QGeoPositionInfo::Direction);
- const qreal direction = info.attribute(QGeoPositionInfo::Direction);
- const bool directionChanged = !equalOrNaN(pDirection, direction);
- const bool directionValidChanged = exclusiveNaN(pDirection, direction);
-
- // ground speed
- const qreal pSpeed = m_info.attribute(QGeoPositionInfo::GroundSpeed);
- const qreal speed = info.attribute(QGeoPositionInfo::GroundSpeed);
- const bool speedChanged = !equalOrNaN(pSpeed, speed);
- const bool speedValidChanged = exclusiveNaN(pSpeed, speed);
-
- // vertical speed
- const qreal pVerticalSpeed = m_info.attribute(QGeoPositionInfo::VerticalSpeed);
- const qreal verticalSpeed = info.attribute(QGeoPositionInfo::VerticalSpeed);
- const bool verticalSpeedChanged = !equalOrNaN(pVerticalSpeed, verticalSpeed);
- const bool verticalSpeedValidChanged = exclusiveNaN(pVerticalSpeed, verticalSpeed);
-
- // magnetic variation
- const qreal pMagneticVariation = m_info.attribute(QGeoPositionInfo::MagneticVariation);
- const qreal magneticVariation = info.attribute(QGeoPositionInfo::MagneticVariation);
- const bool magneticVariationChanged = !equalOrNaN(pMagneticVariation, magneticVariation);
- const bool magneticVariationValidChanged = exclusiveNaN(pMagneticVariation, magneticVariation);
-
- // horizontal accuracy
- const qreal pHorizontalAccuracy = m_info.attribute(QGeoPositionInfo::HorizontalAccuracy);
- const qreal horizontalAccuracy = info.attribute(QGeoPositionInfo::HorizontalAccuracy);
- const bool horizontalAccuracyChanged = !equalOrNaN(pHorizontalAccuracy, horizontalAccuracy);
- const bool horizontalAccuracyValidChanged =
- exclusiveNaN(pHorizontalAccuracy, horizontalAccuracy);
-
- // vertical accuracy
- const qreal pVerticalAccuracy = m_info.attribute(QGeoPositionInfo::VerticalAccuracy);
- const qreal verticalAccuracy = info.attribute(QGeoPositionInfo::VerticalAccuracy);
- const bool verticalAccuracyChanged = !equalOrNaN(pVerticalAccuracy, verticalAccuracy);
- const bool verticalAccuracyValidChanged = exclusiveNaN(pVerticalAccuracy, verticalAccuracy);
-
- m_info = info;
-
- if (timestampChanged)
- m_computedTimestamp.notify();
-
- if (coordinateChanged)
- m_computedCoordinate.notify();
- if (latitudeValidChanged)
- m_computedLatitudeValid.notify();
- if (longitudeValidChanged)
- m_computedLongitudeValid.notify();
- if (altitudeValidChanged)
- m_computedAltitudeValid.notify();
-
- if (directionChanged)
- m_computedDirection.notify();
- if (directionValidChanged)
- m_computedDirectionValid.notify();
-
- if (speedChanged)
- m_computedSpeed.notify();
- if (speedValidChanged)
- m_computedSpeedValid.notify();
-
- if (verticalSpeedChanged)
- m_computedVerticalSpeed.notify();
- if (verticalSpeedValidChanged)
- m_computedVerticalSpeedValid.notify();
-
- if (horizontalAccuracyChanged)
- m_computedHorizontalAccuracy.notify();
- if (horizontalAccuracyValidChanged)
- m_computedHorizontalAccuracyValid.notify();
-
- if (verticalAccuracyChanged)
- m_computedVerticalAccuracy.notify();
- if (verticalAccuracyValidChanged)
- m_computedVerticalAccuracyValid.notify();
-
- if (magneticVariationChanged)
- m_computedMagneticVariation.notify();
- if (magneticVariationValidChanged)
- m_computedMagneticVariationValid.notify();
-}
-
-const QGeoPositionInfo &QDeclarativePosition::position() const
-{
- return m_info;
-}
-
-QBindable<bool> QDeclarativePosition::bindableLatitudeValid() const
-{
- return QBindable<bool>(&m_computedLatitudeValid);
-}
-
-QBindable<bool> QDeclarativePosition::bindableLongitudeValid() const
-{
- return QBindable<bool>(&m_computedLongitudeValid);
-}
-
-QBindable<bool> QDeclarativePosition::bindableAltitudeValid() const
-{
- return QBindable<bool>(&m_computedAltitudeValid);
-}
-
-QBindable<QGeoCoordinate> QDeclarativePosition::bindableCoordinate() const
-{
- return QBindable<QGeoCoordinate>(&m_computedCoordinate);
-}
-
-QBindable<QDateTime> QDeclarativePosition::bindableTimestamp() const
-{
- return QBindable<QDateTime>(&m_computedTimestamp);
-}
-
-QBindable<double> QDeclarativePosition::bindableSpeed() const
-{
- return QBindable<double>(&m_computedSpeed);
-}
-
-QBindable<bool> QDeclarativePosition::bindableSpeedValid() const
-{
- return QBindable<bool>(&m_computedSpeedValid);
-}
-
-QBindable<qreal> QDeclarativePosition::bindableHorizontalAccuracy() const
-{
- return QBindable<qreal>(&m_computedHorizontalAccuracy);
-}
-
-QBindable<qreal> QDeclarativePosition::binableVerticalAccuracy() const
-{
- return QBindable<qreal>(&m_computedVerticalAccuracy);
-}
-
-QBindable<bool> QDeclarativePosition::bindableHorizontalAccuracyValid() const
-{
- return QBindable<bool>(&m_computedHorizontalAccuracyValid);
-}
-
-QBindable<bool> QDeclarativePosition::bindableVerticalAccuracyValid() const
-{
- return QBindable<bool>(&m_computedVerticalAccuracyValid);
-}
-
-QBindable<bool> QDeclarativePosition::bindableDirectionValid() const
-{
- return QBindable<bool>(&m_computedDirectionValid);
-}
-
-QBindable<double> QDeclarativePosition::bindableDirection() const
-{
- return QBindable<double>(&m_computedDirection);
-}
-
-QBindable<bool> QDeclarativePosition::bindableVerticalSpeedValid() const
-{
- return QBindable<bool>(&m_computedVerticalSpeedValid);
-}
-
-QBindable<double> QDeclarativePosition::bindableVerticalSpeed() const
-{
- return QBindable<double>(&m_computedVerticalSpeed);
-}
-
-QBindable<double> QDeclarativePosition::bindableMagneticVariation() const
-{
- return QBindable<double>(&m_computedMagneticVariation);
-}
-
-QBindable<bool> QDeclarativePosition::bindableMagneticVariationValid() const
-{
- return QBindable<bool>(&m_computedMagneticVariationValid);
-}
-
-/*!
- \qmlproperty coordinate Position::coordinate
-
- This property holds the latitude, longitude, and altitude value of the Position.
-
- It is a read-only property.
-
- \sa longitudeValid, latitudeValid, altitudeValid
-*/
-QGeoCoordinate QDeclarativePosition::coordinate() const
-{
- return m_computedCoordinate.value();
-}
-
-QGeoCoordinate QDeclarativePosition::coordinateActualCalculation() const
-{
- return m_info.coordinate();
-}
-
-/*!
- \qmlproperty bool Position::latitudeValid
-
- This property is true if coordinate's latitude has been set
- (to indicate whether that data has been received or not, as every update
- does not necessarily contain all data).
-
- \sa coordinate
-*/
-bool QDeclarativePosition::isLatitudeValid() const
-{
- return m_computedLatitudeValid.value();
-}
-
-bool QDeclarativePosition::isLatitudeValidActualCalculation() const
-{
- return !qIsNaN(m_info.coordinate().latitude());
-}
-
-/*!
- \qmlproperty bool Position::longitudeValid
-
- This property is true if coordinate's longitude has been set
- (to indicate whether that data has been received or not, as every update
- does not necessarily contain all data).
-
- \sa coordinate
-*/
-bool QDeclarativePosition::isLongitudeValid() const
-{
- return m_computedLongitudeValid.value();
-}
-
-bool QDeclarativePosition::isLongitudeValidActualCalculation() const
-{
- return !qIsNaN(m_info.coordinate().longitude());
-}
-
-/*!
- \qmlproperty bool Position::speedValid
-
- This property is true if \l speed has been set
- (to indicate whether that data has been received or not, as every update
- does not necessarily contain all data).
-
- \sa speed
-*/
-bool QDeclarativePosition::isSpeedValid() const
-{
- return m_computedSpeedValid.value();
-}
-
-bool QDeclarativePosition::isSpeedValidActualCalculation() const
-{
- return !qIsNaN(m_info.attribute(QGeoPositionInfo::GroundSpeed));
-}
-
-/*!
- \qmlproperty bool Position::altitudeValid
-
- This property is true if coordinate's altitude has been set
- (to indicate whether that data has been received or not, as every update
- does not necessarily contain all data).
-
- \sa coordinate
-*/
-bool QDeclarativePosition::isAltitudeValid() const
-{
- return m_computedAltitudeValid.value();
-}
-
-bool QDeclarativePosition::isAltitudeValidActualCalculation() const
-{
- return !qIsNaN(m_info.coordinate().altitude());
-}
-
-/*!
- \qmlproperty double Position::speed
-
- This property holds the value of speed (groundspeed, meters / second).
-
- It is a read-only property.
-
- \sa speedValid, coordinate
-*/
-double QDeclarativePosition::speed() const
-{
- return m_computedSpeed.value();
-}
-
-double QDeclarativePosition::speedActualCalculation() const
-{
- return m_info.attribute(QGeoPositionInfo::GroundSpeed);
-}
-
-/*!
- \qmlproperty real Position::horizontalAccuracy
-
- This property holds the horizontal accuracy of the coordinate (in meters).
-
- \sa horizontalAccuracyValid, coordinate
-*/
-qreal QDeclarativePosition::horizontalAccuracy() const
-{
- return m_computedHorizontalAccuracy.value();
-}
-
-qreal QDeclarativePosition::horizontalAccuracyActualCalculation() const
-{
- return m_info.attribute(QGeoPositionInfo::HorizontalAccuracy);
-}
-
-/*!
- \qmlproperty bool Position::horizontalAccuracyValid
-
- This property is true if \l horizontalAccuracy has been set
- (to indicate whether that data has been received or not, as every update
- does not necessarily contain all data).
-
- \sa horizontalAccuracy
-*/
-bool QDeclarativePosition::isHorizontalAccuracyValid() const
-{
- return m_computedHorizontalAccuracyValid.value();
-}
-
-bool QDeclarativePosition::isHorizontalAccuracyValidActualCalculation() const
-{
- return !qIsNaN(m_info.attribute(QGeoPositionInfo::HorizontalAccuracy));
-}
-
-/*!
- \qmlproperty real Position::verticalAccuracy
-
- This property holds the vertical accuracy of the coordinate (in meters).
-
- \sa verticalAccuracyValid, coordinate
-*/
-qreal QDeclarativePosition::verticalAccuracy() const
-{
- return m_computedVerticalAccuracy.value();
-}
-
-qreal QDeclarativePosition::verticalAccuracyActualCalculation() const
-{
- return m_info.attribute(QGeoPositionInfo::VerticalAccuracy);
-}
-
-/*!
- \qmlproperty bool Position::verticalAccuracyValid
-
- This property is true if \l verticalAccuracy has been set
- (to indicate whether that data has been received or not, as every update
- does not necessarily contain all data).
-
- \sa verticalAccuracy
-*/
-bool QDeclarativePosition::isVerticalAccuracyValid() const
-{
- return m_computedVerticalAccuracyValid.value();
-}
-
-bool QDeclarativePosition::isVerticalAccuracyValidActualCalculation() const
-{
- return !qIsNaN(m_info.attribute(QGeoPositionInfo::VerticalAccuracy));
-}
-
-/*!
- \qmlproperty date Position::timestamp
-
- This property holds the timestamp when this position
- was received. If the property has not been set, it is invalid.
-
- It is a read-only property.
-*/
-QDateTime QDeclarativePosition::timestamp() const
-{
- return m_computedTimestamp.value();
-}
-
-QDateTime QDeclarativePosition::timestampActualCalculation() const
-{
- return m_info.timestamp();
-}
-
-/*!
- \qmlproperty bool Position::directionValid
- \since Qt Positioning 5.3
-
- This property is true if \l direction has been set (to indicate whether that data has been
- received or not, as every update does not necessarily contain all data).
-
- \sa direction
-*/
-bool QDeclarativePosition::isDirectionValid() const
-{
- return m_computedDirectionValid.value();
-}
-
-bool QDeclarativePosition::isDirectionValidActualCalculation() const
-{
- return !qIsNaN(m_info.attribute(QGeoPositionInfo::Direction));
-}
-
-/*!
- \qmlproperty double Position::direction
- \since Qt Positioning 5.3
-
- This property holds the value of the direction of travel in degrees from true north.
-
- It is a read-only property.
-
- \sa directionValid
-*/
-double QDeclarativePosition::direction() const
-{
- return m_computedDirection.value();
-}
-
-double QDeclarativePosition::directionActualCalculation() const
-{
- return m_info.attribute(QGeoPositionInfo::Direction);
-}
-
-/*!
- \qmlproperty bool Position::verticalSpeedValid
- \since Qt Positioning 5.3
-
- This property is true if \l verticalSpeed has been set (to indicate whether that data has been
- received or not, as every update does not necessarily contain all data).
-
- \sa verticalSpeed
-*/
-bool QDeclarativePosition::isVerticalSpeedValid() const
-{
- return m_computedVerticalSpeedValid.value();
-}
-
-bool QDeclarativePosition::isVerticalSpeedValidActualCalculation() const
-{
- return !qIsNaN(m_info.attribute(QGeoPositionInfo::VerticalSpeed));
-}
-
-/*!
- \qmlproperty double Position::verticalSpeed
- \since Qt Positioning 5.3
-
- This property holds the value of the vertical speed in meters per second.
-
- It is a read-only property.
-
- \sa verticalSpeedValid
-*/
-double QDeclarativePosition::verticalSpeed() const
-{
- return m_computedVerticalSpeed.value();
-}
-
-double QDeclarativePosition::verticalSpeedActualCalculation() const
-{
- return m_info.attribute(QGeoPositionInfo::VerticalSpeed);
-}
-
-/*!
- \qmlproperty bool Position::magneticVariationValid
- \since Qt Positioning 5.4
-
- This property is true if \l magneticVariation has been set (to indicate whether that data has been
- received or not, as every update does not necessarily contain all data).
-
- \sa magneticVariation
-*/
-bool QDeclarativePosition::isMagneticVariationValid() const
-{
- return m_computedMagneticVariationValid.value();
-}
-
-bool QDeclarativePosition::isMagneticVariationValidActualCalculation() const
-{
- return !qIsNaN(m_info.attribute(QGeoPositionInfo::MagneticVariation));
-}
-
-/*!
- \qmlproperty double Position::magneticVariation
- \since Qt Positioning 5.4
-
- This property holds 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.
-
- It is a read-only property.
-
- \sa magneticVariationValid
-*/
-double QDeclarativePosition::magneticVariation() const
-{
- return m_computedMagneticVariation.value();
-}
-
-double QDeclarativePosition::magneticVariationActualCalculation() const
-{
- return m_info.attribute(QGeoPositionInfo::MagneticVariation);
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioningquick/qdeclarativeposition_p.h b/src/positioningquick/qdeclarativeposition_p.h
deleted file mode 100644
index 174828bf..00000000
--- a/src/positioningquick/qdeclarativeposition_p.h
+++ /dev/null
@@ -1,204 +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$
-**
-***************************************************************************/
-
-#ifndef QDECLARATIVEPOSITION_H
-#define QDECLARATIVEPOSITION_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 <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-#include <QtPositioning/QGeoPositionInfo>
-#include <QtCore/QObject>
-#include <QtCore/QDateTime>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePosition : public QObject
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(Position)
- QML_ADDED_IN_VERSION(5, 0)
-
- Q_PROPERTY(bool latitudeValid READ isLatitudeValid BINDABLE bindableLatitudeValid)
- Q_PROPERTY(bool longitudeValid READ isLongitudeValid BINDABLE bindableLongitudeValid)
- Q_PROPERTY(bool altitudeValid READ isAltitudeValid BINDABLE bindableAltitudeValid)
- Q_PROPERTY(QGeoCoordinate coordinate READ coordinate BINDABLE bindableCoordinate)
- Q_PROPERTY(QDateTime timestamp READ timestamp BINDABLE bindableTimestamp)
- Q_PROPERTY(double speed READ speed BINDABLE bindableSpeed)
- Q_PROPERTY(bool speedValid READ isSpeedValid BINDABLE bindableSpeedValid)
- Q_PROPERTY(qreal horizontalAccuracy READ horizontalAccuracy BINDABLE bindableHorizontalAccuracy)
- Q_PROPERTY(qreal verticalAccuracy READ verticalAccuracy BINDABLE binableVerticalAccuracy)
- Q_PROPERTY(bool horizontalAccuracyValid READ isHorizontalAccuracyValid BINDABLE
- bindableHorizontalAccuracyValid)
- Q_PROPERTY(bool verticalAccuracyValid READ isVerticalAccuracyValid BINDABLE
- bindableVerticalAccuracyValid)
-
- Q_PROPERTY(bool directionValid READ isDirectionValid BINDABLE bindableDirectionValid
- REVISION(5, 1))
- Q_PROPERTY(double direction READ direction BINDABLE bindableDirection REVISION(5, 1))
- Q_PROPERTY(bool verticalSpeedValid READ isVerticalSpeedValid BINDABLE bindableVerticalSpeedValid
- REVISION(5, 1))
- Q_PROPERTY(double verticalSpeed READ verticalSpeed BINDABLE bindableVerticalSpeed
- REVISION(5, 1))
-
- Q_PROPERTY(double magneticVariation READ magneticVariation BINDABLE bindableMagneticVariation
- REVISION(5, 2))
- Q_PROPERTY(bool magneticVariationValid READ isMagneticVariationValid BINDABLE
- bindableMagneticVariationValid REVISION(5, 2))
-
-public:
- explicit QDeclarativePosition(QObject *parent = 0);
- ~QDeclarativePosition();
-
- bool isLatitudeValid() const;
- bool isLongitudeValid() const;
- bool isAltitudeValid() const;
- QDateTime timestamp() const;
- double speed() const;
- bool isSpeedValid() const;
- QGeoCoordinate coordinate() const;
- bool isHorizontalAccuracyValid() const;
- qreal horizontalAccuracy() const;
- bool isVerticalAccuracyValid() const;
- qreal verticalAccuracy() const;
-
- bool isDirectionValid() const;
- double direction() const;
-
- bool isVerticalSpeedValid() const;
- double verticalSpeed() const;
-
- bool isMagneticVariationValid() const;
- double magneticVariation() const;
-
- void setPosition(const QGeoPositionInfo &info);
- const QGeoPositionInfo &position() const;
-
- QBindable<bool> bindableLatitudeValid() const;
- QBindable<bool> bindableLongitudeValid() const;
- QBindable<bool> bindableAltitudeValid() const;
- QBindable<QGeoCoordinate> bindableCoordinate() const;
- QBindable<QDateTime> bindableTimestamp() const;
- QBindable<double> bindableSpeed() const;
- QBindable<bool> bindableSpeedValid() const;
- QBindable<qreal> bindableHorizontalAccuracy() const;
- QBindable<qreal> binableVerticalAccuracy() const;
- QBindable<bool> bindableHorizontalAccuracyValid() const;
- QBindable<bool> bindableVerticalAccuracyValid() const;
- QBindable<bool> bindableDirectionValid() const;
- QBindable<double> bindableDirection() const;
- QBindable<bool> bindableVerticalSpeedValid() const;
- QBindable<double> bindableVerticalSpeed() const;
- QBindable<double> bindableMagneticVariation() const;
- QBindable<bool> bindableMagneticVariationValid() const;
-
-private:
- bool isLatitudeValidActualCalculation() const;
- bool isLongitudeValidActualCalculation() const;
- bool isAltitudeValidActualCalculation() const;
- QGeoCoordinate coordinateActualCalculation() const;
- QDateTime timestampActualCalculation() const;
- double speedActualCalculation() const;
- bool isSpeedValidActualCalculation() const;
- qreal horizontalAccuracyActualCalculation() const;
- qreal verticalAccuracyActualCalculation() const;
- bool isHorizontalAccuracyValidActualCalculation() const;
- bool isVerticalAccuracyValidActualCalculation() const;
- bool isDirectionValidActualCalculation() const;
- double directionActualCalculation() const;
- bool isVerticalSpeedValidActualCalculation() const;
- double verticalSpeedActualCalculation() const;
- double magneticVariationActualCalculation() const;
- bool isMagneticVariationValidActualCalculation() const;
-
- QGeoPositionInfo m_info;
-
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedLatitudeValid,
- &QDeclarativePosition::isLatitudeValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedLongitudeValid,
- &QDeclarativePosition::isLongitudeValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedAltitudeValid,
- &QDeclarativePosition::isAltitudeValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, QGeoCoordinate, m_computedCoordinate,
- &QDeclarativePosition::coordinateActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, QDateTime, m_computedTimestamp,
- &QDeclarativePosition::timestampActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, double, m_computedSpeed,
- &QDeclarativePosition::speedActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedSpeedValid,
- &QDeclarativePosition::isSpeedValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, qreal, m_computedHorizontalAccuracy,
- &QDeclarativePosition::horizontalAccuracyActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, qreal, m_computedVerticalAccuracy,
- &QDeclarativePosition::verticalAccuracyActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedHorizontalAccuracyValid,
- &QDeclarativePosition::isHorizontalAccuracyValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedVerticalAccuracyValid,
- &QDeclarativePosition::isVerticalAccuracyValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedDirectionValid,
- &QDeclarativePosition::isDirectionValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, double, m_computedDirection,
- &QDeclarativePosition::directionActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedVerticalSpeedValid,
- &QDeclarativePosition::isVerticalSpeedValidActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, double, m_computedVerticalSpeed,
- &QDeclarativePosition::verticalSpeedActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, double, m_computedMagneticVariation,
- &QDeclarativePosition::magneticVariationActualCalculation)
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePosition, bool, m_computedMagneticVariationValid,
- &QDeclarativePosition::isMagneticVariationValidActualCalculation)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativePosition)
-
-#endif
diff --git a/src/positioningquick/qdeclarativepositionsource.cpp b/src/positioningquick/qdeclarativepositionsource.cpp
deleted file mode 100644
index 5a84c788..00000000
--- a/src/positioningquick/qdeclarativepositionsource.cpp
+++ /dev/null
@@ -1,913 +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$
-**
-****************************************************************************/
-
-#include "qdeclarativepositionsource_p.h"
-#include "qdeclarativeposition_p.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtQml/qqmlinfo.h>
-#include <QtQml/qqml.h>
-#include <qdeclarativepluginparameter_p.h>
-#include <QFile>
-#include <QtNetwork/QTcpSocket>
-#include <QTimer>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype PositionSource
- //! \instantiates QDeclarativePositionSource
- \inqmlmodule QtPositioning
- \since 5.2
-
- \brief The PositionSource type provides the device's current position.
-
- The PositionSource type provides information about the user device's
- current position. The position is available as a \l{Position} type, which
- contains all the standard parameters typically available from GPS and other
- similar systems, including longitude, latitude, speed and accuracy details.
-
- As different position sources are available on different platforms and
- devices, these are categorized by their basic type (Satellite, NonSatellite,
- and AllPositioningMethods). The available methods for the current platform
- can be enumerated in the \l{supportedPositioningMethods} property.
-
- To indicate which methods are suitable for your application, set the
- \l{preferredPositioningMethods} property. If the preferred methods are not
- available, the default source of location data for the platform will be
- chosen instead. If no default source is available (because none are installed
- for the runtime platform, or because it is disabled), the \l{valid} property
- will be set to false.
-
- The \l updateInterval property can then be used to indicate how often your
- application wishes to receive position updates. The \l{start}(),
- \l{stop}() and \l{update}() methods can be used to control the operation
- of the PositionSource, as well as the \l{active} property, which when set
- is equivalent to calling \l{start}() or \l{stop}().
-
- When the PositionSource is active, position updates can be retrieved
- either by simply using the \l{position} property in a binding (as the
- value of another item's property), or by providing an implementation of
- the \c {onPositionChanged} signal-handler.
-
- \section2 Example Usage
-
- The following example shows a simple PositionSource used to receive
- updates every second and print the longitude and latitude out to
- the console.
-
- \code
- PositionSource {
- id: src
- updateInterval: 1000
- active: true
-
- onPositionChanged: {
- var coord = src.position.coordinate;
- console.log("Coordinate:", coord.longitude, coord.latitude);
- }
- }
- \endcode
-
- The \l{geoflickr}{GeoFlickr} example application shows how to use
- a PositionSource in your application to retrieve local data for users
- from a REST web service.
-
- \section2 Controlling Operation State
-
- As it's mentioned above, PositionSource provides two ways to control its
- operation state:
-
- \list
- \li By using the \l active \l {Qt Bindable Properties}{bindable} property.
- \li By using \l start() and \l stop() methods.
- \endlist
-
- \note It's very important not to mix these approaches. If a bindable
- \l active property is used to control the PositionSource object, but later
- \l start() or \l stop() is called from the other part of the code, the
- binding is broken, which may result in, for example, a UI element that is
- not connected to any underlying object anymore.
-
- Consider the following example of \b {bad code} where the \c active property
- is bound to the CheckBox state, and calling \l stop() in the \c onClicked
- signal handler breaks that binding.
-
- \qml
- Window {
- width: 640
- height: 480
- visible: true
-
- PositionSource {
- id: posSource
- name: "geoclue2"
- active: cb.checked
- }
-
- Column {
- anchors.centerIn: parent
- spacing: 20
- CheckBox {
- id: cb
- }
- Button {
- id: btn
- text: "Stop"
- onClicked: {
- posSource.stop()
- }
- }
- }
- }
- \endqml
-
- Once the \e Stop button is clicked, \l stop() is executed, and the binding
- for the \l active property is broken. At this point the CheckBox UI element
- is no longer controlling the PositionSource object.
-
- A straightforward fix in this case is to update the CheckBox state from
- the \c onClicked handler. As soon as the CheckBox is unchecked, the
- \l active property will be notified, and the PositionSource object's state
- will update accordingly. The UI will also be in a consistent state.
-
- \qml
- Button {
- id: btn
- text: "Stop"
- onClicked: {
- cb.checked = false
- }
- }
- \endqml
-
- \note Using \l update() to request a single position update \e {does not}
- have any effect on the \l active property's bindings, so they can be used
- together without any problems.
-
- \sa {QtPositioning::Position}, {QGeoPositionInfoSource}, {PluginParameter},
- {Qt Bindable Properties}
-
-*/
-
-QDeclarativePositionSource::QDeclarativePositionSource()
-{
- m_position.setValueBypassingBindings(new QDeclarativePosition(this));
-}
-
-QDeclarativePositionSource::~QDeclarativePositionSource()
-{
- delete m_positionSource;
-}
-
-
-/*!
- \qmlproperty string PositionSource::name
-
- This property holds the unique internal name for the plugin currently
- providing position information.
-
- Setting the property causes the PositionSource to use a particular positioning provider. If
- the PositionSource is active at the time that the name property is changed, it will become
- inactive. If the specified positioning provider cannot be loaded the position source will
- become invalid.
-
- Changing the name property may cause the \l {updateInterval}, \l {supportedPositioningMethods}
- and \l {preferredPositioningMethods} properties to change as well.
-*/
-
-
-QString QDeclarativePositionSource::name() const
-{
- return m_sourceName;
-}
-
-void QDeclarativePositionSource::setName(const QString &newName)
-{
- m_sourceName.removeBindingUnlessInWrapper();
- if (m_positionSource && m_positionSource->sourceName() == newName)
- return;
-
- if (newName.isEmpty() && m_defaultSourceUsed)
- return; // previously attached to a default source, now requesting the same.
-
- const QString previousName = name();
-
- if (!m_componentComplete || !m_parametersInitialized) {
- if (previousName != newName) {
- m_sourceName.setValueBypassingBindings(newName);
- m_sourceName.notify();
- }
- return;
- }
-
- // tryAttach() will update the m_sourceName correctly
- tryAttach(newName, false);
-}
-
-QBindable<QString> QDeclarativePositionSource::bindableName()
-{
- return QBindable<QString>(&m_sourceName);
-}
-
-QBindable<QDeclarativePosition *> QDeclarativePositionSource::bindablePosition() const
-{
- return QBindable<QDeclarativePosition *>(&m_position);
-}
-
-/*!
- \internal
-*/
-void QDeclarativePositionSource::tryAttach(const QString &newName, bool useFallback)
-{
- const QString previousName = name();
- const bool sourceExisted = (m_positionSource != nullptr);
-
- int previousUpdateInterval = updateInterval();
- PositioningMethods previousPositioningMethods = supportedPositioningMethods();
- PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods();
-
- m_defaultSourceUsed = false;
-
- if (newName.isEmpty()) {
- setSource(QGeoPositionInfoSource::createDefaultSource(parameterMap(), this));
- m_defaultSourceUsed = true;
- } else {
- setSource(QGeoPositionInfoSource::createSource(newName, parameterMap(), this));
- if (!m_positionSource && useFallback) {
- setSource(QGeoPositionInfoSource::createDefaultSource(parameterMap(), this));
- m_defaultSourceUsed = true;
- }
- }
-
- if (m_positionSource) {
- m_sourceName.setValueBypassingBindings(m_positionSource->sourceName());
-
- connect(m_positionSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdateReceived(QGeoPositionInfo)));
- connect(m_positionSource, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(sourceErrorReceived(QGeoPositionInfoSource::Error)));
-
- m_positionSource->setUpdateInterval(m_updateInterval);
- m_positionSource->setPreferredPositioningMethods(
- static_cast<QGeoPositionInfoSource::PositioningMethods>(int(m_preferredPositioningMethods)));
-
- const QGeoPositionInfo &lastKnown = m_positionSource->lastKnownPosition();
- if (lastKnown.isValid())
- setPosition(lastKnown);
- } else {
- m_sourceName.setValueBypassingBindings(newName);
- m_defaultSourceUsed = false;
- if (m_active) {
- // We do not want to break the binding here, because we just want to
- // give the user an opportunity to select another plugin and keep
- // working.
- m_active.setValueBypassingBindings(false);
- m_active.notify();
- }
- }
-
- if (previousUpdateInterval != updateInterval())
- emit updateIntervalChanged();
-
- if (previousPreferredPositioningMethods != preferredPositioningMethods())
- emit preferredPositioningMethodsChanged();
-
- if (previousPositioningMethods != supportedPositioningMethods())
- notifySupportedPositioningMethodsChanged();
-
- const bool sourceCurrentlyExists = (m_positionSource != nullptr);
- if (sourceExisted != sourceCurrentlyExists) {
- m_isValid.notify();
- emit validityChanged();
- }
-
- if (m_active) { // implies m_positionSource
- if (!sourceExisted) {
- // delay ensures all properties have been set
- QTimer::singleShot(0, this, [this]() { executeStart(); });
- } else {
- // New source is set. It should be inactive by default.
- // But we do not want to break the binding.
- m_active.setValueBypassingBindings(false);
- m_active.notify();
- }
- }
-
- if (previousName != m_sourceName)
- m_sourceName.notify();
-}
-
-/*!
- \qmlproperty bool PositionSource::valid
-
- This property is true if the PositionSource object has acquired a valid
- backend plugin to provide data. If false, other methods on the PositionSource
- will have no effect.
-
- Applications should check this property to determine whether positioning is
- available and enabled on the runtime platform, and react accordingly.
-*/
-bool QDeclarativePositionSource::isValid() const
-{
- return m_isValid.value();
-}
-
-QBindable<bool> QDeclarativePositionSource::bindableIsValid() const
-{
- return QBindable<bool>(&m_isValid);
-}
-
-bool QDeclarativePositionSource::isValidActualComputation() const
-{
- return m_positionSource != nullptr;
-}
-
-void QDeclarativePositionSource::handleUpdateTimeout()
-{
- // notify will be called by the calling method
- m_sourceError.setValueBypassingBindings(QDeclarativePositionSource::UpdateTimeoutError);
-
- if (!m_active)
- return;
-
- if (m_singleUpdate) {
- m_singleUpdate = false;
-
- if (!m_regularUpdates) {
- // only singleUpdate based timeouts change activity
- // continuous updates may resume again
- // (see QGeoPositionInfoSource::startUpdates())
- m_active.setValueBypassingBindings(false);
- m_active.notify();
- }
- }
-}
-
-/*!
- \internal
-*/
-void QDeclarativePositionSource::onParameterInitialized()
-{
- m_parametersInitialized = true;
- for (QDeclarativePluginParameter *p: qAsConst(m_parameters)) {
- if (!p->isInitialized()) {
- m_parametersInitialized = false;
- break;
- }
- }
-
- // If here, componentComplete has been called.
- if (m_parametersInitialized)
- tryAttach(m_sourceName.value());
-}
-
-void QDeclarativePositionSource::notifySupportedPositioningMethodsChanged()
-{
- m_supportedPositioningMethods.notify();
- emit supportedPositioningMethodsChanged();
-}
-
-void QDeclarativePositionSource::setPosition(const QGeoPositionInfo &pi)
-{
- m_position.value()->setPosition(pi);
- m_position.notify();
- emit positionChanged();
-}
-
-void QDeclarativePositionSource::setSource(QGeoPositionInfoSource *source)
-{
- if (m_positionSource)
- delete m_positionSource;
-
- if (!source) {
- m_positionSource = nullptr;
- } else {
- m_positionSource = source;
- connect(m_positionSource, &QGeoPositionInfoSource::supportedPositioningMethodsChanged,
- this, &QDeclarativePositionSource::notifySupportedPositioningMethodsChanged);
- }
-}
-
-bool QDeclarativePositionSource::parametersReady()
-{
- for (const QDeclarativePluginParameter *p: qAsConst(m_parameters)) {
- if (!p->isInitialized())
- return false;
- }
- return true;
-}
-
-/*!
- \internal
-*/
-QVariantMap QDeclarativePositionSource::parameterMap() const
-{
- QVariantMap map;
-
- for (int i = 0; i < m_parameters.size(); ++i) {
- QDeclarativePluginParameter *parameter = m_parameters.at(i);
- map.insert(parameter->name(), parameter->value());
- }
-
- return map;
-}
-
-/*!
- \internal
-*/
-void QDeclarativePositionSource::setUpdateInterval(int updateInterval)
-{
- if (m_positionSource) {
- int previousUpdateInterval = m_positionSource->updateInterval();
-
- m_updateInterval = updateInterval;
-
- if (previousUpdateInterval != updateInterval) {
- m_positionSource->setUpdateInterval(updateInterval);
- if (previousUpdateInterval != m_positionSource->updateInterval())
- emit updateIntervalChanged();
- }
- } else {
- if (m_updateInterval != updateInterval) {
- m_updateInterval = updateInterval;
- emit updateIntervalChanged();
- }
- }
-}
-
-/*!
- \qmlproperty int PositionSource::updateInterval
-
- This property holds the desired interval between updates (milliseconds).
-
- \sa {QGeoPositionInfoSource::updateInterval()}
-*/
-
-int QDeclarativePositionSource::updateInterval() const
-{
- if (!m_positionSource)
- return m_updateInterval;
-
- return m_positionSource->updateInterval();
-}
-
-/*!
- \qmlproperty enumeration PositionSource::supportedPositioningMethods
-
- This property holds the supported positioning methods of the
- current source.
-
- \list
- \li PositionSource.NoPositioningMethods - No positioning methods supported (no source).
- \li PositionSource.SatellitePositioningMethods - Satellite-based positioning methods such as GPS are supported.
- \li PositionSource.NonSatellitePositioningMethods - Non-satellite-based methods are supported.
- \li PositionSource.AllPositioningMethods - Both satellite-based and non-satellite positioning methods are supported.
- \endlist
-
-*/
-
-QDeclarativePositionSource::PositioningMethods
-QDeclarativePositionSource::supportedPositioningMethods() const
-{
- return m_supportedPositioningMethods.value();
-}
-
-QDeclarativePositionSource::PositioningMethods
-QDeclarativePositionSource::supportedMethodsActualComputation() const
-{
- if (m_positionSource) {
- return static_cast<QDeclarativePositionSource::PositioningMethods>(
- int(m_positionSource->supportedPositioningMethods()));
- }
- return QDeclarativePositionSource::NoPositioningMethods;
-}
-
-QBindable<QDeclarativePositionSource::PositioningMethods>
-QDeclarativePositionSource::bindableSupportedPositioningMethods() const
-{
- return QBindable<PositioningMethods>(&m_supportedPositioningMethods);
-}
-
-/*!
- \qmlproperty enumeration PositionSource::preferredPositioningMethods
-
- This property holds the preferred positioning methods of the
- current source.
-
- \list
- \li PositionSource.NoPositioningMethods - No positioning method is preferred.
- \li PositionSource.SatellitePositioningMethods - Satellite-based positioning methods such as GPS should be preferred.
- \li PositionSource.NonSatellitePositioningMethods - Non-satellite-based methods should be preferred.
- \li PositionSource.AllPositioningMethods - Any positioning methods are acceptable.
- \endlist
-
-*/
-
-void QDeclarativePositionSource::setPreferredPositioningMethods(PositioningMethods methods)
-{
- if (m_positionSource) {
- PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods();
-
- m_preferredPositioningMethods = methods;
-
- if (previousPreferredPositioningMethods != methods) {
- m_positionSource->setPreferredPositioningMethods(
- static_cast<QGeoPositionInfoSource::PositioningMethods>(int(methods)));
- if (previousPreferredPositioningMethods != m_positionSource->preferredPositioningMethods())
- emit preferredPositioningMethodsChanged();
- }
- } else {
- if (m_preferredPositioningMethods != methods) {
- m_preferredPositioningMethods = methods;
- emit preferredPositioningMethodsChanged();
- }
- }
-}
-
-QDeclarativePositionSource::PositioningMethods QDeclarativePositionSource::preferredPositioningMethods() const
-{
- if (m_positionSource) {
- return static_cast<QDeclarativePositionSource::PositioningMethods>(
- int(m_positionSource->preferredPositioningMethods()));
- }
- return m_preferredPositioningMethods;
-}
-
-/*!
- \qmlmethod PositionSource::start()
-
- Requests updates from the location source.
- Uses \l updateInterval if set, default interval otherwise.
- If there is no source available, this method has no effect.
-
- \note Calling this method breaks the bindings of
- \l {PositionSource::}{active} property.
-
- \sa stop, update, active
-*/
-
-void QDeclarativePositionSource::start()
-{
- if (m_positionSource) {
- m_active.removeBindingUnlessInWrapper();
- executeStart();
- }
-}
-
-/*!
- \qmlmethod PositionSource::update(int timeout)
-
- A convenience method to request single update from the location source.
- If there is no source available, this method has no effect.
-
- If the position source is not active, it will be activated for as
- long as it takes to receive an update, or until the request times
- out. The request timeout period is source-specific.
-
- The \a timeout is specified in milliseconds. If the \a timeout is zero
- (the default value), it defaults to a reasonable timeout period as
- appropriate for the source.
-
- \sa start, stop, active
-*/
-
-void QDeclarativePositionSource::update(int timeout)
-{
- if (m_positionSource) {
- m_singleUpdate = true;
- if (!m_active) {
- // Questionable: we do not want this method to break the binding.
- // Mostly because it can be called while the updates are already
- // running.
- m_active.setValueBypassingBindings(true);
- m_active.notify();
- }
- // Use default timeout value. Set active before calling the
- // update request because on some platforms there may
- // be results immediately.
- m_positionSource->requestUpdate(timeout);
- }
-}
-
-/*!
- \qmlmethod PositionSource::stop()
-
- Stops updates from the location source.
- If there is no source available or it is not active,
- this method has no effect.
-
- \note Calling this method breaks the bindings of
- \l {PositionSource::}{active} property.
-
- \sa start, update, active
-*/
-
-void QDeclarativePositionSource::stop()
-{
- if (m_positionSource) {
- m_positionSource->stopUpdates();
- m_regularUpdates = false;
- // Try to break the binding even if we do not actually need to update
- // the active state. The m_active can be updated later, when the
- // single update request finishes.
- m_active.removeBindingUnlessInWrapper();
- if (m_active && !m_singleUpdate) {
- m_active.setValueBypassingBindings(false);
- m_active.notify();
- }
- }
-}
-
-/*!
- \qmlproperty bool PositionSource::active
-
- This property indicates whether the position source is active.
- Setting this property to false equals calling \l stop, and
- setting this property true equals calling \l start.
-
- \sa start, stop, update
-*/
-void QDeclarativePositionSource::setActive(bool active)
-{
- // We need to remove binding, if this method is called explicitly.
- // Other changes to m_active are done inside start() and stop() methods.
- m_active.removeBindingUnlessInWrapper();
- if (active == m_active)
- return;
-
- if (active) {
- // delay ensures all properties have been set
- QTimer::singleShot(0, this, [this]() { executeStart(); });
- } else {
- stop();
- }
-}
-
-bool QDeclarativePositionSource::isActive() const
-{
- return m_active;
-}
-
-/*!
- \qmlproperty Position PositionSource::position
-
- This property holds the last known positional data.
- It is a read-only property.
-
- The Position type has different positional member variables,
- whose validity can be checked with appropriate validity functions
- (for example sometimes an update does not have speed or altitude data).
-
- However, whenever a \c {positionChanged} signal has been received, at least
- position::coordinate::latitude, position::coordinate::longitude, and position::timestamp can
- be assumed to be valid.
-
- \sa start, stop, update
-*/
-
-QDeclarativePosition *QDeclarativePositionSource::position()
-{
- return m_position.value();
-}
-
-void QDeclarativePositionSource::positionUpdateReceived(const QGeoPositionInfo &update)
-{
- setPosition(update);
-
- if (m_singleUpdate && m_active) {
- // we need to reset m_singleUpdate because we got one
- m_singleUpdate = false;
- if (!m_regularUpdates) {
- // but we change the active state only if the regular updates are
- // also stopped
- m_active.setValueBypassingBindings(false);
- m_active.notify();
- }
- }
-}
-
-
-/*!
- \qmlproperty enumeration PositionSource::sourceError
-
- This property holds the error which last occurred with the PositionSource.
-
- \list
- \li PositionSource.AccessError - The connection setup to the remote positioning backend failed because the
- application lacked the required privileges.
- \li PositionSource.ClosedError - The 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.
- \li PositionSource.NoError - No error has occurred.
- \li PositionSource.UnknownSourceError - An unidentified error occurred.
- \li PositionSource.UpdateTimeoutError - The current position could not be
- retrieved within the specified timeout, or this PositionSource determined
- that it will not be able to provide further regular updates.
- \endlist
-
-*/
-
-QDeclarativePositionSource::SourceError QDeclarativePositionSource::sourceError() const
-{
- return m_sourceError;
-}
-
-QBindable<QDeclarativePositionSource::SourceError>
-QDeclarativePositionSource::bindableSourceError() const
-{
- return QBindable<QDeclarativePositionSource::SourceError>(&m_sourceError);
-}
-
-QGeoPositionInfoSource *QDeclarativePositionSource::positionSource() const
-{
- return m_positionSource;
-}
-
-/*!
- \qmlproperty list<PluginParameter> PositionSource::parameters
- \qmldefault
-
- This property holds the list of plugin parameters.
-
- \since QtPositioning 5.14
-*/
-QQmlListProperty<QDeclarativePluginParameter> QDeclarativePositionSource::parameters()
-{
- return QQmlListProperty<QDeclarativePluginParameter>(this,
- 0,
- parameter_append,
- parameter_count,
- parameter_at,
- parameter_clear);
-}
-
-/*!
- \internal
-*/
-void QDeclarativePositionSource::parameter_append(QQmlListProperty<QDeclarativePluginParameter> *prop, QDeclarativePluginParameter *parameter)
-{
- QDeclarativePositionSource *p = static_cast<QDeclarativePositionSource *>(prop->object);
- p->m_parameters.append(parameter);
-}
-
-/*!
- \internal
-*/
-qsizetype QDeclarativePositionSource::parameter_count(QQmlListProperty<QDeclarativePluginParameter> *prop)
-{
- return static_cast<QDeclarativePositionSource *>(prop->object)->m_parameters.count();
-}
-
-/*!
- \internal
-*/
-QDeclarativePluginParameter *QDeclarativePositionSource::parameter_at(QQmlListProperty<QDeclarativePluginParameter> *prop, qsizetype index)
-{
- return static_cast<QDeclarativePositionSource *>(prop->object)->m_parameters[index];
-}
-
-/*!
- \internal
-*/
-void QDeclarativePositionSource::parameter_clear(QQmlListProperty<QDeclarativePluginParameter> *prop)
-{
- QDeclarativePositionSource *p = static_cast<QDeclarativePositionSource *>(prop->object);
- p->m_parameters.clear();
-}
-
-void QDeclarativePositionSource::executeStart()
-{
- if (m_positionSource) {
- m_positionSource->startUpdates();
-
- // If this method is called directly from start(), the binding is
- // already broken there (for the consistency with stop()).
- // If this method is called by a timer, started in setActive(), we do
- // not need to break the binding, because it was already done (if
- // needed).
-
- m_regularUpdates = true;
- if (!m_active) {
- m_active.setValueBypassingBindings(true);
- m_active.notify();
- }
- }
-}
-
-void QDeclarativePositionSource::componentComplete()
-{
- m_componentComplete = true;
- m_parametersInitialized = true;
- for (QDeclarativePluginParameter *p: qAsConst(m_parameters)) {
- if (!p->isInitialized()) {
- m_parametersInitialized = false;
- connect(p, &QDeclarativePluginParameter::initialized,
- this, &QDeclarativePositionSource::onParameterInitialized);
- }
- }
-
- if (m_parametersInitialized)
- tryAttach(m_sourceName.value());
-}
-
-/*!
- \qmlmethod bool PositionSource::setBackendProperty(string name, Variant value)
-
- Sets the backend-specific property named \a name to \a value.
- Returns true on success, false otherwise, including if called on an uninitialized PositionSource.
- Supported backend-specific properties are listed and described in
- \l {Qt Positioning plugins#Default plugins}.
-
- \since Qt Positioning 5.14
-
- \sa backendProperty, QGeoPositionInfoSource::setBackendProperty
-*/
-bool QDeclarativePositionSource::setBackendProperty(const QString &name, const QVariant &value)
-{
- if (m_positionSource)
- return m_positionSource->setBackendProperty(name, value);
- return false;
-}
-
-/*!
- \qmlmethod Variant PositionSource::backendProperty(string name)
-
- Returns the value of the backend-specific property named \a name, if present.
- Otherwise, including if called on an uninitialized PositionSource, the return value will be invalid.
- Supported backend-specific properties are listed and described in
- \l {Qt Positioning plugins#Default plugins}.
-
- \since Qt Positioning 5.14
-
- \sa backendProperty, QGeoPositionInfoSource::setBackendProperty
-*/
-QVariant QDeclarativePositionSource::backendProperty(const QString &name) const
-{
- if (m_positionSource)
- return m_positionSource->backendProperty(name);
- return QVariant();
-}
-
-QBindable<bool> QDeclarativePositionSource::bindableActive()
-{
- return QBindable<bool>(&m_active);
-}
-
-/*!
- \internal
-*/
-void QDeclarativePositionSource::sourceErrorReceived(const QGeoPositionInfoSource::Error error)
-{
- if (error == QGeoPositionInfoSource::AccessError)
- m_sourceError.setValueBypassingBindings(QDeclarativePositionSource::AccessError);
- else if (error == QGeoPositionInfoSource::ClosedError)
- m_sourceError.setValueBypassingBindings(QDeclarativePositionSource::ClosedError);
- else if (error == QGeoPositionInfoSource::UpdateTimeoutError)
- handleUpdateTimeout(); // also sets m_sourceError
- else if (error == QGeoPositionInfoSource::NoError)
- return; //nothing to do
- else
- m_sourceError.setValueBypassingBindings(QDeclarativePositionSource::UnknownSourceError);
-
- m_sourceError.notify();
- emit sourceErrorChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioningquick/qdeclarativepositionsource_p.h b/src/positioningquick/qdeclarativepositionsource_p.h
deleted file mode 100644
index 5651a266..00000000
--- a/src/positioningquick/qdeclarativepositionsource_p.h
+++ /dev/null
@@ -1,222 +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 QDECLARATIVEPOSITIONSOURCE_H
-#define QDECLARATIVEPOSITIONSOURCE_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 <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-#include <QtPositioningQuick/private/qdeclarativeposition_p.h>
-#include <QtCore/QObject>
-#include <QtNetwork/QAbstractSocket>
-#include <QtQml/QQmlParserStatus>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
-#include <QtCore/private/qproperty_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QFile;
-class QTcpSocket;
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT QDeclarativePositionSource : public QObject, public QQmlParserStatus
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(PositionSource)
- QML_ADDED_IN_VERSION(5, 0)
-
- Q_PROPERTY(QDeclarativePosition *position READ position NOTIFY positionChanged
- BINDABLE bindablePosition)
- Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged
- BINDABLE bindableActive)
- Q_PROPERTY(bool valid READ isValid NOTIFY validityChanged BINDABLE bindableIsValid)
- Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval
- NOTIFY updateIntervalChanged)
- Q_PROPERTY(PositioningMethods supportedPositioningMethods READ supportedPositioningMethods
- NOTIFY supportedPositioningMethodsChanged
- BINDABLE bindableSupportedPositioningMethods)
- Q_PROPERTY(PositioningMethods preferredPositioningMethods READ preferredPositioningMethods
- WRITE setPreferredPositioningMethods NOTIFY preferredPositioningMethodsChanged)
- Q_PROPERTY(SourceError sourceError READ sourceError NOTIFY sourceErrorChanged
- BINDABLE bindableSourceError)
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged BINDABLE bindableName)
- Q_PROPERTY(QQmlListProperty<QDeclarativePluginParameter> parameters READ parameters REVISION(5, 14))
- Q_ENUMS(PositioningMethod)
-
- Q_CLASSINFO("DefaultProperty", "parameters")
- Q_INTERFACES(QQmlParserStatus)
-
-public:
- enum PositioningMethod {
- NoPositioningMethods = QGeoPositionInfoSource::NoPositioningMethods,
- SatellitePositioningMethods = QGeoPositionInfoSource::SatellitePositioningMethods,
- NonSatellitePositioningMethods = QGeoPositionInfoSource::NonSatellitePositioningMethods,
- AllPositioningMethods = QGeoPositionInfoSource::AllPositioningMethods
- };
-
- Q_DECLARE_FLAGS(PositioningMethods, PositioningMethod)
- Q_FLAGS(PositioningMethods)
-
- enum SourceError {
- AccessError = QGeoPositionInfoSource::AccessError,
- ClosedError = QGeoPositionInfoSource::ClosedError,
- UnknownSourceError = QGeoPositionInfoSource::UnknownSourceError,
- NoError = QGeoPositionInfoSource::NoError,
- UpdateTimeoutError = QGeoPositionInfoSource::UpdateTimeoutError,
- };
- Q_ENUMS(SourceError)
-
- QDeclarativePositionSource();
- ~QDeclarativePositionSource();
- void setUpdateInterval(int updateInterval);
- void setActive(bool active);
- void setPreferredPositioningMethods(PositioningMethods methods);
-
- QString name() const;
- void setName(const QString &name);
-
- int updateInterval() const;
- bool isActive() const;
- bool isValid() const;
- QDeclarativePosition *position();
- PositioningMethods supportedPositioningMethods() const;
- PositioningMethods preferredPositioningMethods() const;
- SourceError sourceError() const;
- QGeoPositionInfoSource *positionSource() const;
- QQmlListProperty<QDeclarativePluginParameter> parameters();
- QVariantMap parameterMap() const;
-
- // Virtuals from QQmlParserStatus
- void classBegin() override { }
- void componentComplete() override;
-
- Q_REVISION(5, 14) Q_INVOKABLE bool setBackendProperty(const QString &name, const QVariant &value);
- Q_REVISION(5, 14) Q_INVOKABLE QVariant backendProperty(const QString &name) const;
-
- QBindable<PositioningMethods> bindableSupportedPositioningMethods() const;
- QBindable<SourceError> bindableSourceError() const;
- QBindable<bool> bindableIsValid() const;
- QBindable<QString> bindableName();
- QBindable<QDeclarativePosition *> bindablePosition() const;
- QBindable<bool> bindableActive();
-
-public Q_SLOTS:
- void update(int timeout = 0);
- void start();
- void stop();
-
-Q_SIGNALS:
- void positionChanged();
- void activeChanged();
- void updateIntervalChanged();
- void supportedPositioningMethodsChanged();
- void preferredPositioningMethodsChanged();
- void sourceErrorChanged();
- void nameChanged();
- void validityChanged();
-
-private Q_SLOTS:
- void positionUpdateReceived(const QGeoPositionInfo &update);
- void sourceErrorReceived(const QGeoPositionInfoSource::Error error);
- void onParameterInitialized();
- void notifySupportedPositioningMethodsChanged();
-
-private:
- void handleUpdateTimeout();
- void setPosition(const QGeoPositionInfo &pi);
- void setSource(QGeoPositionInfoSource *source);
- bool parametersReady();
- void tryAttach(const QString &name, bool useFallback = true);
-
- static void parameter_append(QQmlListProperty<QDeclarativePluginParameter> *prop, QDeclarativePluginParameter *mapObject);
- static qsizetype parameter_count(QQmlListProperty<QDeclarativePluginParameter> *prop);
- static QDeclarativePluginParameter *parameter_at(QQmlListProperty<QDeclarativePluginParameter> *prop, qsizetype index);
- static void parameter_clear(QQmlListProperty<QDeclarativePluginParameter> *prop);
-
- bool isValidActualComputation() const;
- PositioningMethods supportedMethodsActualComputation() const;
-
- void executeStart();
-
- QGeoPositionInfoSource *m_positionSource = nullptr;
- PositioningMethods m_preferredPositioningMethods = AllPositioningMethods;
- bool m_singleUpdate = false;
- bool m_regularUpdates = false;
- int m_updateInterval = 0;
- QList<QDeclarativePluginParameter *> m_parameters;
- bool m_componentComplete = false;
- bool m_parametersInitialized = false;
-
- bool m_defaultSourceUsed = false;
- Q_OBJECT_COMPAT_PROPERTY(QDeclarativePositionSource, QString, m_sourceName,
- &QDeclarativePositionSource::setName,
- &QDeclarativePositionSource::nameChanged)
-
- Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QDeclarativePositionSource, bool, m_active,
- &QDeclarativePositionSource::setActive,
- &QDeclarativePositionSource::activeChanged, false)
-
- Q_OBJECT_BINDABLE_PROPERTY(QDeclarativePositionSource, QDeclarativePosition *, m_position)
-
- Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QDeclarativePositionSource, SourceError, m_sourceError,
- NoError)
-
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePositionSource, PositioningMethods,
- m_supportedPositioningMethods,
- &QDeclarativePositionSource::supportedMethodsActualComputation)
-
- Q_OBJECT_COMPUTED_PROPERTY(QDeclarativePositionSource, bool, m_isValid,
- &QDeclarativePositionSource::isValidActualComputation)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativePositionSource)
-
-#endif
diff --git a/src/positioningquick/qpositioningquickglobal.h b/src/positioningquick/qpositioningquickglobal.h
deleted file mode 100644
index 214e4628..00000000
--- a/src/positioningquick/qpositioningquickglobal.h
+++ /dev/null
@@ -1,69 +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 QPOSITIONINGQUICKGLOBAL_H
-#define QPOSITIONINGQUICKGLOBAL_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/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_POSITIONINGQUICK_LIB)
-# define Q_POSITIONINGQUICK_EXPORT Q_DECL_EXPORT
-# else
-# define Q_POSITIONINGQUICK_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_POSITIONINGQUICK_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QPOSITIONINGQUICKGLOBAL_H
diff --git a/src/positioningquick/qpositioningquickglobal_p.h b/src/positioningquick/qpositioningquickglobal_p.h
deleted file mode 100644
index ce284106..00000000
--- a/src/positioningquick/qpositioningquickglobal_p.h
+++ /dev/null
@@ -1,63 +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 QPOSITIONINGQUICKGLOBAL_P_H
-#define QPOSITIONINGQUICKGLOBAL_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 "qpositioningquickglobal.h"
-
-QT_BEGIN_NAMESPACE
-
-#define Q_POSITIONINGQUICK_PRIVATE_EXPORT Q_POSITIONINGQUICK_EXPORT
-
-QT_END_NAMESPACE
-
-void Q_POSITIONINGQUICK_PRIVATE_EXPORT qml_register_types_QtPositioning();
-
-#endif // QPOSITIONINGQUICKGLOBAL_P_H
diff --git a/src/positioningquick/qpositioningquickmodule_p.h b/src/positioningquick/qpositioningquickmodule_p.h
deleted file mode 100644
index 6d8aed91..00000000
--- a/src/positioningquick/qpositioningquickmodule_p.h
+++ /dev/null
@@ -1,151 +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 QT_POSITIONINGQUICKMODULE_P_H
-#define QT_POSITIONINGQUICKMODULE_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 <QtQml/qqml.h>
-#include "qpositioningquickglobal_p.h"
-
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoAddress>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoPath>
-#include <QtPositioning/QGeoPolygon>
-#include <QtPositioning/QGeoLocation>
-#include <QtPositioning/QGeoShape>
-#include <QtPositioning/QGeoPositionInfo>
-#include <QtPositioning/private/qgeocoordinateobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QGeoCoordinateForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoCoordinate)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoAddressForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoAddress)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoRectangleForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoRectangle)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoCircleForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoCircle)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoPathForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoPath)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoPolygonForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoPolygon)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoLocationForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoLocation)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoShapeForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoShape)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoCoordinateObjectForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoCoordinateObject)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-struct QGeoPositionInfoForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoPositionInfo)
- QML_ANONYMOUS
- QML_ADDED_IN_VERSION(5, 0)
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_POSITIONINGQUICKMODULE_P_H
diff --git a/src/positioningquick/qquickgeocoordinateanimation.cpp b/src/positioningquick/qquickgeocoordinateanimation.cpp
deleted file mode 100644
index 3f5cef8d..00000000
--- a/src/positioningquick/qquickgeocoordinateanimation.cpp
+++ /dev/null
@@ -1,297 +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 "qquickgeocoordinateanimation_p.h"
-#include "qquickgeocoordinateanimation_p_p.h"
-#include <QtQuick/private/qquickanimation_p_p.h>
-#include <QtPositioning/private/qdoublevector2d_p.h>
-#include <QtPositioning/private/qwebmercator_p.h>
-#include <QtPositioning/private/qgeocoordinate_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype CoordinateAnimation
- \inherits PropertyAnimation
- \inqmlmodule QtPositioning
- \since 5.3
-
- \brief A PropertyAnimation for geo coordinate properties.
-
- A specialized \l{PropertyAnimation} that defines an animation
- between two \l{coordinate}{coordinates}.
-
- By default, a \l{latitude} of the \l{coordinate} is animated in the direction of shortest
- (geodesic) distance between those coordinates. Since CoordinateAnimation uses Mercator
- map projection, the \l{latitude} animation is always between -90 and 90 degrees.
- The \l{longitude} animation path is not limited and can go over 180 degrees
- in both west and east directions.
-
- The \l{direction} property can be set to specify the direction in which the \l{longitude}
- animation should occur.
-
- \sa {Animation and Transitions in Qt Quick}
-*/
-
-QVariant q_coordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
-{
- if (from == to) {
- if (progress < 0.5) {
- return QVariant::fromValue(from);
- } else {
- return QVariant::fromValue(to);
- }
- }
-
- QGeoCoordinate result = QWebMercator::coordinateInterpolation(from, to, progress);
-
- return QVariant::fromValue(result);
-}
-
-QVariant q_coordinateShortestInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
-{
- const QGeoMercatorCoordinatePrivate* fromMercator =
- static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
- const QGeoMercatorCoordinatePrivate* toMercator =
- static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&to));
-
- double toX = toMercator->m_mercatorX;
- double toY = toMercator->m_mercatorY;
- double fromX = fromMercator->m_mercatorX;
- double fromY = fromMercator->m_mercatorY;
- double x;
- if (0.5 < qAbs(toX - fromX)) {
- // handle dateline crossing
- double ex = toX;
- double sx = fromX;
- if (ex < sx)
- sx -= 1.0;
- else if (sx < ex)
- ex -= 1.0;
-
- x = sx + (ex - sx) * progress;
-
- if (x < 0.0)
- x += 1.0;
-
- } else {
- x = fromX + (toX - fromX) * progress;
- }
-
- double y = fromY + (toY - fromY) * progress;
-
- QGeoCoordinate result = QWebMercator::mercatorToCoord(QDoubleVector2D(x, y));
- result.setAltitude(from.altitude() + (to.altitude() - from.altitude()) * progress);
- return QVariant::fromValue(result);
-}
-
-QVariant q_coordinateEastInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
-{
- const QGeoMercatorCoordinatePrivate* fromMercator =
- static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
- const QGeoMercatorCoordinatePrivate* toMercator =
- static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&to));
-
- double toX = toMercator->m_mercatorX;
- double toY = toMercator->m_mercatorY;
- double fromX = fromMercator->m_mercatorX;
- double fromY = fromMercator->m_mercatorY;
- double diff = toX - fromX;
-
- while (diff < 0.0) {
- toX += 1.0;
- diff += 1.0;
- }
-
- double x = fromX + (toX - fromX) * progress;
- double y = fromY + (toY - fromY) * progress;
-
- while (x > 1.0)
- x -= 1.0;
-
- QGeoCoordinate result = QWebMercator::mercatorToCoord(QDoubleVector2D(x, y));
- result.setAltitude(from.altitude() + (to.altitude() - from.altitude()) * progress);
-
- return QVariant::fromValue(result);
-}
-
-QVariant q_coordinateWestInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
-{
- const QGeoMercatorCoordinatePrivate* fromMercator =
- static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
- const QGeoMercatorCoordinatePrivate* toMercator =
- static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&to));
-
- double toX = toMercator->m_mercatorX;
- double toY = toMercator->m_mercatorY;
- double fromX = fromMercator->m_mercatorX;
- double fromY = fromMercator->m_mercatorY;
- double diff = toX - fromX;
-
- while (diff > 0.0) {
- toX -= 1.0;
- diff -= 1.0;
- }
-
- double x = fromX + (toX - fromX) * progress;
- double y = fromY + (toY - fromY) * progress;
-
- while (x < 0.0)
- x += 1.0;
-
- QGeoCoordinate result = QWebMercator::mercatorToCoord(QDoubleVector2D(x, y));
- result.setAltitude(from.altitude() + (to.altitude() - from.altitude()) * progress);
-
- return QVariant::fromValue(result);
-}
-
-QQuickGeoCoordinateAnimation::QQuickGeoCoordinateAnimation(QObject *parent)
- : QQuickPropertyAnimation(*(new QQuickGeoCoordinateAnimationPrivate), parent)
-
-{
- Q_D(QQuickGeoCoordinateAnimation);
- d->interpolatorType = qMetaTypeId<QGeoCoordinate>();
- d->defaultToInterpolatorType = true;
- d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
-}
-
-QQuickGeoCoordinateAnimation::~QQuickGeoCoordinateAnimation()
-{
-}
-
-/*!
- \qmlproperty coordinate CoordinateAnimation::from
- This property holds the coordinate where the animation should begin.
-*/
-QGeoCoordinate QQuickGeoCoordinateAnimation::from() const
-{
- Q_D(const QQuickGeoCoordinateAnimation);
- return d->from.value<QGeoCoordinate>();
-}
-
-void QQuickGeoCoordinateAnimation::setFrom(const QGeoCoordinate &f)
-{
- QGeoMercatorCoordinatePrivate *mercator = new QGeoMercatorCoordinatePrivate();
- QDoubleVector2D fromVector = QWebMercator::coordToMercator(f);
- mercator->lat = f.latitude();
- mercator->lng = f.longitude();
- mercator->alt = f.altitude();
- mercator->m_mercatorX = fromVector.x();
- mercator->m_mercatorY = fromVector.y();
- QGeoCoordinate from(*mercator);
- QQuickPropertyAnimation::setFrom(QVariant::fromValue(from));
-}
-
-/*!
- \qmlproperty coordinate CoordinateAnimation::to
- This property holds the coordinate where the animation should end.
-*/
-QGeoCoordinate QQuickGeoCoordinateAnimation::to() const
-{
- Q_D(const QQuickGeoCoordinateAnimation);
- return d->to.value<QGeoCoordinate>();
-}
-
-void QQuickGeoCoordinateAnimation::setTo(const QGeoCoordinate &t)
-{
- QGeoMercatorCoordinatePrivate *mercator = new QGeoMercatorCoordinatePrivate();
- QDoubleVector2D toVector = QWebMercator::coordToMercator(t);
- mercator->lat = t.latitude();
- mercator->lng = t.longitude();
- mercator->alt = t.altitude();
- mercator->m_mercatorX = toVector.x();
- mercator->m_mercatorY = toVector.y();
- QGeoCoordinate to(*mercator);
- QQuickPropertyAnimation::setTo(QVariant::fromValue(to));
-}
-
-/*!
- \qmlproperty enumeration CoordinateAnimation::direction
- This property holds the direction of the \l{longitude} animation of the \l{coordinate}.
-
- Possible values are:
-
- \list
- \li CoordinateAnimation.Shortest (default) - the longitude animation goes in the direction
- that produces the shortest animation path.
- \li CoordinateAnimation.West - the longitude animation always goes into western direction
- and may cross the date line.
- \li CoordinateAnimation.East - the longitude animation always goes into eastern direction
- and may cross the date line.
- \endlist
- \since 5.5
-*/
-
-
-QQuickGeoCoordinateAnimation::Direction QQuickGeoCoordinateAnimation::direction() const
-{
- Q_D(const QQuickGeoCoordinateAnimation);
- return d->m_direction.value();
-}
-
-void QQuickGeoCoordinateAnimation::setDirection(QQuickGeoCoordinateAnimation::Direction direction)
-{
- Q_D( QQuickGeoCoordinateAnimation);
- d->m_direction.removeBindingUnlessInWrapper();
- if (d->m_direction.value() == direction)
- return;
-
- d->m_direction.setValueBypassingBindings(direction);
- switch (direction) {
- case West:
- d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void *>(&q_coordinateWestInterpolator));
- break;
- case East:
- d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void *>(&q_coordinateEastInterpolator));
- break;
- case Shortest:
- default:
- d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void *>(&q_coordinateShortestInterpolator));
- break;
- }
- d->m_direction.notify();
-}
-
-QBindable<QQuickGeoCoordinateAnimation::Direction> QQuickGeoCoordinateAnimation::bindableDirection()
-{
- Q_D(QQuickGeoCoordinateAnimation);
- return QBindable<Direction>(&d->m_direction);
-}
-
-QT_END_NAMESPACE
diff --git a/src/positioningquick/qquickgeocoordinateanimation_p.h b/src/positioningquick/qquickgeocoordinateanimation_p.h
deleted file mode 100644
index 4cd8f567..00000000
--- a/src/positioningquick/qquickgeocoordinateanimation_p.h
+++ /dev/null
@@ -1,104 +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 QQUICKGEOCOORDINATEANIMATION_P_H
-#define QQUICKGEOCOORDINATEANIMATION_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 <QtPositioningQuick/private/qpositioningquickglobal_p.h>
-#include <QtQuick/private/qquickanimation_p.h>
-#include <QtPositioning/qgeocoordinate.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickGeoCoordinateAnimationPrivate;
-
-class Q_POSITIONINGQUICK_PRIVATE_EXPORT QQuickGeoCoordinateAnimation : public QQuickPropertyAnimation
-{
- Q_OBJECT
- QML_NAMED_ELEMENT(CoordinateAnimation)
- QML_ADDED_IN_VERSION(5, 3)
- Q_DECLARE_PRIVATE(QQuickGeoCoordinateAnimation)
- Q_PROPERTY(QGeoCoordinate from READ from WRITE setFrom)
- Q_PROPERTY(QGeoCoordinate to READ to WRITE setTo)
- Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged
- BINDABLE bindableDirection)
-
-public:
- enum Direction {
- Shortest,
- West,
- East
- };
- Q_ENUM(Direction)
-
- QQuickGeoCoordinateAnimation(QObject *parent=0);
- ~QQuickGeoCoordinateAnimation();
-
- QGeoCoordinate from() const;
- void setFrom(const QGeoCoordinate &);
-
- QGeoCoordinate to() const;
- void setTo(const QGeoCoordinate &);
-
- Direction direction() const;
- void setDirection(Direction direction);
- QBindable<Direction> bindableDirection();
-
-Q_SIGNALS:
- void directionChanged();
-};
-
-QVariant Q_POSITIONINGQUICK_PRIVATE_EXPORT q_coordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress);
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickGeoCoordinateAnimation)
-
-#endif // QQUICKCOORDINATEANIMATION_P_H
diff --git a/src/positioningquick/qquickgeocoordinateanimation_p_p.h b/src/positioningquick/qquickgeocoordinateanimation_p_p.h
deleted file mode 100644
index c2d714b1..00000000
--- a/src/positioningquick/qquickgeocoordinateanimation_p_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 QQUICKGEOCOORDINATEANIMATION_P_P_H
-#define QQUICKGEOCOORDINATEANIMATION_P_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 "qquickgeocoordinateanimation_p.h"
-#include <QtQuick/private/qquickanimation_p_p.h>
-#include <QtCore/private/qproperty_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickGeoCoordinateAnimationPrivate : public QQuickPropertyAnimationPrivate
-{
- Q_DECLARE_PUBLIC(QQuickGeoCoordinateAnimation)
-public:
- void setDirection(QQuickGeoCoordinateAnimation::Direction direction)
- {
- q_func()->setDirection(direction);
- }
- void directionChanged()
- {
- Q_EMIT q_func()->directionChanged();
- }
-
- Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QQuickGeoCoordinateAnimationPrivate,
- QQuickGeoCoordinateAnimation::Direction, m_direction,
- &QQuickGeoCoordinateAnimationPrivate::setDirection,
- &QQuickGeoCoordinateAnimationPrivate::directionChanged,
- QQuickGeoCoordinateAnimation::Shortest)
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKGEOCOORDINATEANIMATION_P_P_H
diff --git a/sync.profile b/sync.profile
index dcdc7296..4950e933 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,7 +1,5 @@
%modules = ( # path to module name map
- "QtLocation" => "$basedir/src/location",
- "QtPositioning" => "$basedir/src/positioning",
- "QtPositioningQuick" => "$basedir/src/positioningquick",
+ "QtLocation" => "$basedir/src/location"
);
%moduleheaders = ( # restrict the module headers to those found in relative path
);
diff --git a/tests/applications/positioning_backend/CMakeLists.txt b/tests/applications/positioning_backend/CMakeLists.txt
deleted file mode 100644
index 0591cf2b..00000000
--- a/tests/applications/positioning_backend/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# Generated from positioning_backend.pro.
-
-#####################################################################
-## posbackendtesting Binary:
-#####################################################################
-
-qt_internal_add_executable(posbackendtesting
- GUI
- SOURCES
- logwidget.cpp logwidget.h
- main.cpp
- widget.cpp widget.h widget.ui
- PUBLIC_LIBRARIES
- Qt::Gui
- Qt::Positioning
- Qt::Widgets
- ENABLE_AUTOGEN_TOOLS
- uic
-)
-
-#### Keys ignored in scope 1:.:.:positioning_backend.pro:<TRUE>:
-# TEMPLATE = "app"
-
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:positioning_backend.pro:WINRT:
-# WINRT_MANIFEST.capabilities_device = "location"
diff --git a/tests/applications/positioning_backend/logwidget.cpp b/tests/applications/positioning_backend/logwidget.cpp
deleted file mode 100644
index 5ec47230..00000000
--- a/tests/applications/positioning_backend/logwidget.cpp
+++ /dev/null
@@ -1,46 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "logwidget.h"
-#include <QVBoxLayout>
-
-LogWidget::LogWidget(QWidget *parent) : QWidget(parent)
-{
- QVBoxLayout *verticalLayout = new QVBoxLayout(this);
- verticalLayout->setSpacing(6);
- verticalLayout->setContentsMargins(11, 11, 11, 11);
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
-
- editor = new QPlainTextEdit(this);
- verticalLayout->addWidget(editor);
-}
-
-void LogWidget::appendLog(const QString &line)
-{
- editor->appendPlainText(line);
-}
diff --git a/tests/applications/positioning_backend/logwidget.h b/tests/applications/positioning_backend/logwidget.h
deleted file mode 100644
index f6a3eb44..00000000
--- a/tests/applications/positioning_backend/logwidget.h
+++ /dev/null
@@ -1,47 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LOGWIDGET_H
-#define LOGWIDGET_H
-
-#include <QtWidgets/qwidget.h>
-#include <QtWidgets/qplaintextedit.h>
-
-class LogWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit LogWidget(QWidget *parent = nullptr);
-
- void appendLog(const QString &line);
-
-private:
- QPlainTextEdit *editor;
-};
-
-#endif // LOGWIDGET_H
diff --git a/tests/applications/positioning_backend/main.cpp b/tests/applications/positioning_backend/main.cpp
deleted file mode 100644
index 2ed69cb6..00000000
--- a/tests/applications/positioning_backend/main.cpp
+++ /dev/null
@@ -1,54 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "widget.h"
-#include "logwidget.h"
-#include <QLabel>
-
-#include <QApplication>
-#include <QtWidgets>
-#include <QLoggingCategory>
-
-int main(int argc, char *argv[])
-{
- //QLoggingCategory::setFilterRules("qt.positioning.*=true");
- QApplication a(argc, argv);
-
- LogWidget *log = new LogWidget;
- Widget *w1 = new Widget(log);
- Widget *w2 = new Widget(log);
-
- QTabWidget tabWidget;
- tabWidget.setTabPosition(QTabWidget::South);
-
- tabWidget.addTab(w1, "Instance 1");
- tabWidget.addTab(w2, "Instance 2");
- tabWidget.addTab(log, "Logs");
-
- tabWidget.show();
- return a.exec();
-}
diff --git a/tests/applications/positioning_backend/positioning_backend.pro b/tests/applications/positioning_backend/positioning_backend.pro
deleted file mode 100644
index 4ba9e7c8..00000000
--- a/tests/applications/positioning_backend/positioning_backend.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-QT += core gui positioning widgets
-
-TARGET = posbackendtesting
-TEMPLATE = app
-
-
-SOURCES += main.cpp\
- widget.cpp \
- logwidget.cpp
-
-HEADERS += widget.h \
- logwidget.h
-
-FORMS += widget.ui
-
-winrt: WINRT_MANIFEST.capabilities_device += location
diff --git a/tests/applications/positioning_backend/widget.cpp b/tests/applications/positioning_backend/widget.cpp
deleted file mode 100644
index ea1739de..00000000
--- a/tests/applications/positioning_backend/widget.cpp
+++ /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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "widget.h"
-#include "ui_widget.h"
-#include <QGeoPositionInfoSource>
-#include <QDebug>
-
-Widget::Widget(LogWidget *logWidget, QWidget *parent) :
- QWidget(parent),
- log(logWidget),
- ui(new Ui::Widget)
-{
- ui->setupUi(this);
- qDebug() << "Available:" << QGeoPositionInfoSource::availableSources();
- m_posSource = QGeoPositionInfoSource::createDefaultSource(this);
- if (!m_posSource)
- qFatal("No Position Source created!");
- connect(m_posSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
-
- connect(ui->horizontalSlider, SIGNAL(valueChanged(int)),
- this, SLOT(setInterval(int)));
-
- ui->groupBox->setLayout(ui->gridLayout);
- ui->horizontalSlider->setMinimum(m_posSource->minimumUpdateInterval());
- ui->labelTimeOut->setVisible(false);
-
- connect(m_posSource, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(errorChanged(QGeoPositionInfoSource::Error)));
- connect(m_posSource, &QGeoPositionInfoSource::supportedPositioningMethodsChanged,
- this, [this]() {
- auto methods = m_posSource->supportedPositioningMethods();
- const QString status = QStringLiteral("Satellite: %1 ").arg(bool(methods & QGeoPositionInfoSource::SatellitePositioningMethods))
- + QStringLiteral("Non-Satellite: %1").arg(bool(methods & QGeoPositionInfoSource::NonSatellitePositioningMethods));
-
- qDebug() << "Available Positioning Methods Changed" << status;
- log->appendLog(status);
- });
-}
-
-void Widget::positionUpdated(QGeoPositionInfo gpsPos)
-{
- QGeoCoordinate coord = gpsPos.coordinate();
- ui->labelLatitude->setText(QString::number(coord.latitude()));
- ui->labelLongitude->setText(QString::number(coord.longitude()));
- ui->labelAltitude->setText(QString::number(coord.altitude()));
- ui->labelTimeStamp->setText(gpsPos.timestamp().toString());
- if (gpsPos.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- ui->labelHAccuracy->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::HorizontalAccuracy)));
- else
- ui->labelHAccuracy->setText(QStringLiteral("N/A"));
-
- if (gpsPos.hasAttribute(QGeoPositionInfo::VerticalAccuracy))
- ui->labelVAccuracy->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::VerticalAccuracy)));
- else
- ui->labelVAccuracy->setText(QStringLiteral("N/A"));
-
- if (gpsPos.hasAttribute(QGeoPositionInfo::Direction))
- ui->labelDirection->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::Direction)));
- else
- ui->labelDirection->setText(QStringLiteral("N/A"));
-
- if (gpsPos.hasAttribute(QGeoPositionInfo::GroundSpeed))
- ui->labelSpeed->setText(QString::number(gpsPos.attribute(QGeoPositionInfo::GroundSpeed)));
- else
- ui->labelSpeed->setText(QStringLiteral("N/A"));
-
- log->appendLog(coord.toString());
-}
-
-void Widget::positionTimedOut()
-{
- ui->labelTimeOut->setVisible(true);
-}
-
-void Widget::errorChanged(QGeoPositionInfoSource::Error err)
-{
- if (err == QGeoPositionInfoSource::UpdateTimeoutError) {
- // handle timeout
- positionTimedOut();
- } else {
- // handle other errors
- ui->labelErrorState->setText(QString::number(err));
- m_posSource->stopUpdates();
- ui->checkBox->setChecked(false);
- }
-}
-
-Widget::~Widget()
-{
- delete ui;
-}
-
-void Widget::setInterval(int msec)
-{
- m_posSource->setUpdateInterval(msec);
-}
-
-void Widget::on_buttonRetrieve_clicked()
-{
- // Requesting current position for _one_ time
- m_posSource->requestUpdate(10000);
-}
-
-void Widget::on_buttonStart_clicked()
-{
- // Either start or stop the current position info source
- bool running = ui->checkBox->isChecked();
- if (running) {
- ui->checkBox->setChecked(false);
- m_posSource->stopUpdates();
- } else {
- ui->checkBox->setChecked(true);
- m_posSource->startUpdates();
- }
-}
-
-void Widget::on_radioButton_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::NoPositioningMethods);
-}
-
-void Widget::on_radioButton_2_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
-}
-
-void Widget::on_radioButton_3_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods);
-}
-
-void Widget::on_radioButton_4_clicked()
-{
- m_posSource->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
-}
-
-void Widget::on_buttonUpdateSupported_clicked()
-{
- QGeoPositionInfoSource::PositioningMethods m = m_posSource->supportedPositioningMethods();
- QString text;
- switch (m) {
- case QGeoPositionInfoSource::NoPositioningMethods:
- text = QStringLiteral("None");
- break;
- case QGeoPositionInfoSource::SatellitePositioningMethods:
- text = QStringLiteral("Satellite");
- break;
- case QGeoPositionInfoSource::NonSatellitePositioningMethods:
- text = QStringLiteral("Non Satellite");
- break;
- case QGeoPositionInfoSource::AllPositioningMethods:
- text = QStringLiteral("All");
- break;
- }
-
- ui->labelSupported->setText(text);
-}
-
-void Widget::on_buttonResetError_clicked()
-{
- ui->labelErrorState->setText(QStringLiteral("N/A"));
-}
diff --git a/tests/applications/positioning_backend/widget.h b/tests/applications/positioning_backend/widget.h
deleted file mode 100644
index e0dc68fc..00000000
--- a/tests/applications/positioning_backend/widget.h
+++ /dev/null
@@ -1,70 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef WIDGET_H
-#define WIDGET_H
-
-#include "logwidget.h"
-
-#include <QWidget>
-#include <QGeoPositionInfoSource>
-
-namespace Ui {
- class Widget;
-}
-
-class Widget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit Widget(LogWidget *log, QWidget *parent = nullptr);
- ~Widget();
-
-public slots:
- void positionUpdated(QGeoPositionInfo gpsPos);
- void setInterval(int msec);
- void positionTimedOut();
- void errorChanged(QGeoPositionInfoSource::Error err);
-private slots:
- void on_buttonRetrieve_clicked();
- void on_buttonStart_clicked();
- void on_radioButton_2_clicked();
- void on_radioButton_clicked();
- void on_radioButton_3_clicked();
- void on_radioButton_4_clicked();
-
- void on_buttonUpdateSupported_clicked();
- void on_buttonResetError_clicked();
-
-private:
- LogWidget *log = nullptr;
- Ui::Widget *ui;
- QGeoPositionInfoSource *m_posSource;
-};
-
-#endif // WIDGET_H
diff --git a/tests/applications/positioning_backend/widget.ui b/tests/applications/positioning_backend/widget.ui
deleted file mode 100644
index 9cb1566d..00000000
--- a/tests/applications/positioning_backend/widget.ui
+++ /dev/null
@@ -1,334 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Widget</class>
- <widget class="QWidget" name="Widget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>276</width>
- <height>467</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Widget</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Latitude:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="labelLatitude">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Longitude:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="labelLongitude">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Altitude:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="labelAltitude">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>TimeStamp:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="labelTimeStamp">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Horizontal Accuracy:</string>
- </property>
- </widget>
- </item>
- <item row="7" column="1">
- <widget class="QLabel" name="labelHAccuracy">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Vertical Accuracy:</string>
- </property>
- </widget>
- </item>
- <item row="8" column="1">
- <widget class="QLabel" name="labelVAccuracy">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="9" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>TimeOut:</string>
- </property>
- </widget>
- </item>
- <item row="9" column="1">
- <widget class="QLabel" name="labelTimeOut">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>!!!!!TimeOut!!!!!</string>
- </property>
- </widget>
- </item>
- <item row="10" column="0">
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Supported Methods:</string>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Error State:</string>
- </property>
- </widget>
- </item>
- <item row="11" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLabel" name="labelErrorState">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonResetError">
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="10" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="labelSupported">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonUpdateSupported">
- <property name="text">
- <string>Update</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Direction:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="labelDirection">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_12">
- <property name="text">
- <string>Speed:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="labelSpeed">
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Method</string>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>43</x>
- <y>21</y>
- <width>254</width>
- <height>71</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QRadioButton" name="radioButton">
- <property name="text">
- <string>None</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="radioButton_2">
- <property name="text">
- <string>Satelite</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QRadioButton" name="radioButton_3">
- <property name="text">
- <string>Non-Satelite</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QRadioButton" name="radioButton_4">
- <property name="text">
- <string>All</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Interval:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="horizontalSlider">
- <property name="minimum">
- <number>50</number>
- </property>
- <property name="maximum">
- <number>10000</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelInterval">
- <property name="text">
- <string>0</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="checkBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Running</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QPushButton" name="buttonStart">
- <property name="text">
- <string>Start/Stop</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonRetrieve">
- <property name="text">
- <string>Retrieve</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections>
- <connection>
- <sender>horizontalSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>labelInterval</receiver>
- <slot>setNum(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>217</x>
- <y>137</y>
- </hint>
- <hint type="destinationlabel">
- <x>386</x>
- <y>138</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 9fd84dd9..742afe97 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -1,17 +1,5 @@
# Generated from auto.pro.
-add_subdirectory(doublevectors)
-add_subdirectory(qgeoaddress)
-add_subdirectory(qgeoshape)
-add_subdirectory(qgeorectangle)
-add_subdirectory(qgeocircle)
-add_subdirectory(qgeopath)
-add_subdirectory(qgeopolygon)
-add_subdirectory(qgeocoordinate)
-add_subdirectory(qgeocoordinateobject)
-add_subdirectory(qgeolocation)
-add_subdirectory(qgeopositioninfo)
-add_subdirectory(qgeosatelliteinfo)
# TODO: enable location tests later!
# if(TARGET Qt::Location)
# add_subdirectory(geotestplugin)
@@ -73,21 +61,3 @@ add_subdirectory(qgeosatelliteinfo)
# if(TARGET Qt::Location AND TARGET Qt::Quick AND NOT ANDROID AND NOT APPLE)
# add_subdirectory(declarative_ui)
# endif()
-if(TARGET Qt::Quick AND NOT ANDROID)
- add_subdirectory(dummypositionplugin)
- add_subdirectory(declarative_positioning_core)
- add_subdirectory(declarative_geolocation)
- add_subdirectory(qdeclarativegeolocation)
- add_subdirectory(qdeclarativeposition)
- add_subdirectory(qdeclarativepositionsource)
- add_subdirectory(qquickgeocoordinateanimation)
-endif()
-if(NOT ANDROID)
- add_subdirectory(positionplugin)
- add_subdirectory(positionplugintest)
- add_subdirectory(qgeoareamonitor)
- add_subdirectory(qgeopositioninfosource)
- add_subdirectory(qgeosatelliteinfosource)
- add_subdirectory(qnmeapositioninfosource)
- add_subdirectory(qnmeasatelliteinfosource)
-endif()
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 789c769d..034a1c75 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -80,29 +80,3 @@ qtHaveModule(location) {
}
}
}
-
-qtHaveModule(quick):!android {
- SUBDIRS += declarative_positioning_core \
- dummypositionplugin
-}
-
-SUBDIRS += \
- doublevectors \
- qgeoaddress \
- qgeoshape \
- qgeorectangle \
- qgeocircle \
- qgeopath \
- qgeopolygon \
- qgeocoordinate \
- qgeolocation \
- qgeopositioninfo \
- qgeosatelliteinfo
-
-!android: SUBDIRS += \
- positionplugin \
- positionplugintest \
- qgeoareamonitor \
- qgeopositioninfosource \
- qgeosatelliteinfosource \
- qnmeapositioninfosource
diff --git a/tests/auto/declarative_geolocation/CMakeLists.txt b/tests/auto/declarative_geolocation/CMakeLists.txt
deleted file mode 100644
index 366884c4..00000000
--- a/tests/auto/declarative_geolocation/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# special case begin
-
-# Collect test data
-
-qt_internal_add_test(tst_declarative_geolocation
- QMLTEST
- SOURCES
- main.cpp
- PUBLIC_LIBRARIES
- Qt::Positioning
- Qt::Quick
- TESTDATA
- tst_declarativegeolocation.qml
-)
-
-# special case end
diff --git a/tests/auto/declarative_geolocation/main.cpp b/tests/auto/declarative_geolocation/main.cpp
deleted file mode 100644
index 86521a45..00000000
--- a/tests/auto/declarative_geolocation/main.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QCoreApplication>
-#include <QtQuickTest/quicktest.h>
-
-static void initializeLibraryPath()
-{
-#if QT_CONFIG(library)
- // Set custom path since CI doesn't install test plugins
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-Q_COREAPP_STARTUP_FUNCTION(initializeLibraryPath)
-
-QUICK_TEST_MAIN(declarative_geolocation)
diff --git a/tests/auto/declarative_geolocation/tst_declarativegeolocation.qml b/tests/auto/declarative_geolocation/tst_declarativegeolocation.qml
deleted file mode 100644
index 47596304..00000000
--- a/tests/auto/declarative_geolocation/tst_declarativegeolocation.qml
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 6.2
-
-Item {
- id: testCase
-
- property var topLeft: QtPositioning.coordinate(1.0, 2.0)
- property var bottomRight: QtPositioning.coordinate(2.0, 1.0)
- property var centerPoint: QtPositioning.coordinate(1.5, 1.5)
-
- Location {
- id: defaultConstructed
- }
-
- Location {
- id: location
- }
-
- // Use property bindings insetead of signal spies
- property var addressObserver: location.address
- property int addressChangedCount: 0
- onAddressObserverChanged: {
- ++addressChangedCount
- }
-
- property var coordObserver: location.coordinate
- property int coordChangedCount: 0
- onCoordObserverChanged: {
- ++coordChangedCount
- }
-
- property var shapeObserver: location.boundingShape
- property int shapeChangedCount: 0
- onShapeObserverChanged: {
- ++shapeChangedCount
- }
-
- property var attrsObserver: location.extendedAttributes
- property int attrsChangedCount: 0
- onAttrsObserverChanged: {
- ++attrsChangedCount
- }
-
- Address {
- id: emptyAddress
- }
-
- Address {
- id: addr1
- country: "Germany"
- city: "Berlin"
- street: "Erich-Thilo-Str"
- streetNumber: "10"
- postalCode: "12489"
- }
-
- Location {
- id: completeLocation
- address: addr1
- coordinate: centerPoint
- boundingShape: QtPositioning.rectangle(topLeft, bottomRight)
- }
-
- Location {
- id: fromGeoLocation
- }
-
- TestCase {
- name: "DeclarativeGeoLocation"
-
- function test_default_construction() {
- compare(defaultConstructed.address.address, emptyAddress.address)
- compare(defaultConstructed.coordinate, QtPositioning.coordinate())
- compare(defaultConstructed.boundingShape, QtPositioning.shape())
- }
-
- function test_address_changed() {
- addressChangedCount = 0
- location.address = addr1
- compare(addressChangedCount, 1)
- compare(location.address.address, addr1.address)
- }
-
- function test_coordinate_changed() {
- var coord1 = QtPositioning.coordinate(1.0, 2.0)
- var emptyCoord = QtPositioning.coordinate()
- coordChangedCount = 0
- compare(location.coordinate, emptyCoord)
- location.coordinate = coord1
- compare(coordChangedCount, 1)
- compare(location.coordinate, coord1)
- }
-
- function test_bounding_box_changed() {
- var emptyShape = QtPositioning.shape()
- shapeChangedCount = 0
- compare(location.boundingShape, emptyShape)
-
- var box = QtPositioning.rectangle(topLeft, bottomRight)
- location.boundingShape = box
- compare(shapeChangedCount, 1)
- compare(QtPositioning.shapeToRectangle(location.boundingShape), box)
- // verify that shape's boundingGeoRectangle() matches the box.
- compare(location.boundingShape.boundingGeoRectangle(), box)
-
- var circle = QtPositioning.circle(centerPoint, 100)
- location.boundingShape = circle
- compare(shapeChangedCount, 2)
- compare(QtPositioning.shapeToCircle(location.boundingShape), circle)
- }
-
- function test_from_geolocation() {
- fromGeoLocation.location = completeLocation.location
- compare(fromGeoLocation.location, completeLocation.location)
- compare(fromGeoLocation.address.address, completeLocation.address.address)
- compare(fromGeoLocation.coordinate, completeLocation.coordinate)
- compare(fromGeoLocation.boundingShape, completeLocation.boundingShape)
- }
-
- function test_extended_attributes() {
- attrsChangedCount = 0
-
- var attributes = { "foo" : 42 }
- location.extendedAttributes = attributes;
- compare(location.extendedAttributes, attributes)
- compare(attrsChangedCount, 1)
-
- attributes["bar"] = 41
- verify(location.extendedAttributes !== attributes)
- }
- }
-}
diff --git a/tests/auto/declarative_positioning_core/BLACKLIST b/tests/auto/declarative_positioning_core/BLACKLIST
deleted file mode 100644
index f8752ac4..00000000
--- a/tests/auto/declarative_positioning_core/BLACKLIST
+++ /dev/null
@@ -1,6 +0,0 @@
-# QTBUG-59074 and QTBUG-93761: flaky test
-[CoordinateAnimation::test_west_direction_coordinate_animation]
-osx arm
-# QTBUG-59074 and QTBUG-93761: flaky test
-[CoordinateAnimation::test_east_direction_coordinate_animation]
-osx arm
diff --git a/tests/auto/declarative_positioning_core/CMakeLists.txt b/tests/auto/declarative_positioning_core/CMakeLists.txt
deleted file mode 100644
index 0afb3021..00000000
--- a/tests/auto/declarative_positioning_core/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from declarative_positioning_core.pro.
-
-#####################################################################
-## tst_declarative_positioning_core Test:
-#####################################################################
-
-# Collect test data
-file(GLOB_RECURSE test_data_glob
- RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- *.qml)
-list(APPEND test_data ${test_data_glob})
-
-qt_internal_add_test(tst_declarative_positioning_core
- QMLTEST
- SOURCES
- main.cpp
- factory.cpp
- factory.h
- PUBLIC_LIBRARIES
- Qt::Positioning
- Qt::Quick
- TESTDATA ${test_data}
-)
-
-qt_add_qml_module(tst_declarative_positioning_core
- URI TestFactory
- VERSION 1.0
- QML_FILES
- tst_address.qml
- tst_coordinate.qml
- tst_geoshape.qml
- tst_position.qml
- tst_positionsource.qml
- NO_RESOURCE_TARGET_PATH
-)
diff --git a/tests/auto/declarative_positioning_core/declarative_positioning_core.pro b/tests/auto/declarative_positioning_core/declarative_positioning_core.pro
deleted file mode 100644
index fbf82de0..00000000
--- a/tests/auto/declarative_positioning_core/declarative_positioning_core.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-# QML tests in this directory must not depend on an OpenGL context.
-# QML tests that do require an OpenGL context must go in ../../declarative_ui.
-
-TEMPLATE = app
-TARGET = tst_declarative_positioning_core
-CONFIG += qmltestcase
-SOURCES += main.cpp
-
-CONFIG -= app_bundle
-
-QT += positioning quick
-
-OTHER_FILES = *.qml
-TESTDATA = $$OTHER_FILES
diff --git a/tests/auto/declarative_positioning_core/factory.cpp b/tests/auto/declarative_positioning_core/factory.cpp
deleted file mode 100644
index 92a242c3..00000000
--- a/tests/auto/declarative_positioning_core/factory.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "factory.h"
-#include <QGeoRectangle>
-#include <QGeoCircle>
-
-QT_BEGIN_NAMESPACE
-
-Factory::Factory(QObject *parent) : QObject(parent)
-{
-
-}
-
-QGeoShape Factory::createShape(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight)
-{
- return QGeoRectangle(topLeft, bottomRight);
-}
-
-QGeoShape Factory::createShape(const QGeoCoordinate &center, qreal radius) const
-{
- return QGeoCircle(center, radius);
-}
-
-QT_END_NAMESPACE
diff --git a/tests/auto/declarative_positioning_core/factory.h b/tests/auto/declarative_positioning_core/factory.h
deleted file mode 100644
index 9fcfef53..00000000
--- a/tests/auto/declarative_positioning_core/factory.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef FACTORY_H
-#define FACTORY_H
-
-#include <QObject>
-#include <QGeoShape>
-#include <QGeoCoordinate>
-#include <qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGeoShape;
-class QGeoCoordinate;
-
-class Factory : public QObject
-{
- Q_OBJECT
- QML_ELEMENT
-
-public:
- explicit Factory(QObject *parent = nullptr);
-
- Q_INVOKABLE QGeoShape createShape(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight);
- Q_INVOKABLE QGeoShape createShape(const QGeoCoordinate &center, qreal radius) const;
-};
-
-QT_END_NAMESPACE
-
-#endif // FACTORY_H
diff --git a/tests/auto/declarative_positioning_core/main.cpp b/tests/auto/declarative_positioning_core/main.cpp
deleted file mode 100644
index d7cfb648..00000000
--- a/tests/auto/declarative_positioning_core/main.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QCoreApplication>
-#include <QtQuickTest/quicktest.h>
-#include <QtQml/qqml.h>
-
-static void initializeLibraryPath()
-{
-#if QT_CONFIG(library)
- // Set custom path since CI doesn't install test plugins
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-Q_COREAPP_STARTUP_FUNCTION(initializeLibraryPath)
-
-QUICK_TEST_MAIN(declarative_positioning_core)
diff --git a/tests/auto/declarative_positioning_core/tst_address.qml b/tests/auto/declarative_positioning_core/tst_address.qml
deleted file mode 100644
index bfbe1a63..00000000
--- a/tests/auto/declarative_positioning_core/tst_address.qml
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtTest 1.0
-import QtPositioning 6.2
-
-TestCase {
- id: testCase
-
- name: "Address"
-
- Address {
- id: address
-
- street: "Evergreen Tce"
- streetNumber: "742"
- district: "Pressboard Estates"
- city: "Springfield"
- state: "Oregon"
- postalCode: "8900"
- country: "United States"
- countryCode: "USA"
- }
-
- function test_qmlAddressText() {
- compare(address.isTextGenerated, true);
- compare(address.text, "742 Evergreen Tce<br/>Springfield, Oregon 8900<br/>United States");
- var textChangedSpy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', testCase, "SignalSpy");
- textChangedSpy.target = address;
- textChangedSpy.signalName = "textChanged"
-
- var isTextGeneratedSpy = Qt.createQmlObject('import QtTest 1.0; SignalSpy {}', testCase, "SignalSpy");
- isTextGeneratedSpy.target = address
- isTextGeneratedSpy.signalName = "isTextGeneratedChanged"
-
- address.countryCode = "FRA";
- compare(address.text, "742 Evergreen Tce<br/>8900 Springfield<br/>United States");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 0);
-
- address.countryCode = "DEU"; // the street number should go after the street name
- compare(address.text, "Evergreen Tce 742<br/>8900 Springfield<br/>United States");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 0);
-
- address.text = "address label";
- compare(address.isTextGenerated, false);
- compare(address.text, "address label");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 1);
- isTextGeneratedSpy.clear();
-
- address.countryCode = "USA";
- compare(address.text, "address label");
- compare(textChangedSpy.count, 0);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 0);
-
- address.text = "";
- compare(address.isTextGenerated, true);
- compare(address.text, "742 Evergreen Tce<br/>Springfield, Oregon 8900<br/>United States");
- compare(textChangedSpy.count, 1);
- textChangedSpy.clear();
- compare(isTextGeneratedSpy.count, 1);
- isTextGeneratedSpy.clear();
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_coordinate.qml b/tests/auto/declarative_positioning_core/tst_coordinate.qml
deleted file mode 100644
index eb5a2573..00000000
--- a/tests/auto/declarative_positioning_core/tst_coordinate.qml
+++ /dev/null
@@ -1,404 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 6.2
-
-Item {
- id: item
-
- property var empty: QtPositioning.coordinate()
- property var base: QtPositioning.coordinate(1.0, 1.0, 5.0)
- property var zero: QtPositioning.coordinate(0, 0)
- property var plusone: QtPositioning.coordinate(0, 1)
- property var minusone: QtPositioning.coordinate(0, -1)
- property var north: QtPositioning.coordinate(3, 0)
-
- SignalSpy { id: coordSpy; target: item; signalName: "baseChanged" }
-
- property var inside: QtPositioning.coordinate(0.5, 0.5)
- property var outside: QtPositioning.coordinate(2, 2)
- property var tl: QtPositioning.coordinate(1, 0)
- property var br: QtPositioning.coordinate(0, 1)
- property var box: QtPositioning.rectangle(tl, br)
-
-
- Address {
- id: validTestAddress
- street: "Brandl St"
- streetNumber: "53"
- city: "Eight Mile Plains"
- country: "Australia"
- countryCode: "AUS"
- }
-
- Location {
- id: testLocation
- coordinate: inside
- boundingShape: box
- address: validTestAddress
- }
-
- Location {
- id: invalidLocation
- }
-
-
- Item {
- id: coordinateItem
- property variant coordinate
- property int animationDuration: 100
- property var coordinateList: []
- property int coordinateCount: 0
-
- CoordinateAnimation {
- id: coordinateAnimation
- target: coordinateItem
- property: "coordinate"
- duration: coordinateItem.animationDuration
- }
- onCoordinateChanged: {
- if (!coordinateList) {
- coordinateList = []
- }
- coordinateList[coordinateCount] = QtPositioning.coordinate(coordinate.latitude,coordinate.longitude)
- coordinateCount++
- }
-
- SignalSpy { id: coordinateAnimationStartSpy; target: coordinateAnimation; signalName: "started" }
- SignalSpy { id: coordinateAnimationStopSpy; target: coordinateAnimation; signalName: "stopped" }
- SignalSpy { id: coordinateAnimationDirectionSpy; target: coordinateAnimation; signalName: "directionChanged" }
- }
-
- TestCase {
- name: "GeoLocation"
-
- function test_Location_complete()
- {
- compare (testLocation.coordinate.longitude, inside.longitude)
- compare (testLocation.coordinate.latitude, inside.latitude)
-
- compare (testLocation.boundingShape.contains(inside), true)
- compare (testLocation.boundingShape.contains(outside), false)
- var shapeRectangle = testLocation.boundingShape.boundingGeoRectangle()
- compare (shapeRectangle.bottomRight.longitude, br.longitude)
- compare (shapeRectangle.bottomRight.latitude, br.latitude)
- compare (shapeRectangle.topLeft.longitude, tl.longitude)
- compare (shapeRectangle.topLeft.latitude, tl.latitude)
-
- compare (testLocation.address.country, "Australia")
- compare (testLocation.address.countryCode, "AUS")
- compare (testLocation.address.city, "Eight Mile Plains")
- compare (testLocation.address.street, "Brandl St")
- compare (testLocation.address.streetNumber, "53")
- }
-
- function test_Location_invalid()
- {
- compare(invalidLocation.coordinate.isValid, false)
- compare(invalidLocation.boundingShape.isEmpty, true)
- compare(invalidLocation.boundingShape.isValid, false)
- compare(invalidLocation.address.city, "")
- }
- }
-
- TestCase {
- name: "Coordinate"
-
- function test_validity()
- {
- compare(empty.isValid, false)
-
- empty.longitude = 0.0;
- empty.latitude = 0.0;
-
- compare(empty.isValid, true)
- }
-
- function test_accessors()
- {
- compare(base.longitude, 1.0)
- compare(base.latitude, 1.0)
- compare(base.altitude, 5.0)
-
- coordSpy.clear()
-
- base.longitude = 2.0
- base.latitude = 3.0
- base.altitude = 6.0
-
- compare(base.longitude, 2.0)
- compare(base.latitude, 3.0)
- compare(base.altitude, 6.0)
- // changing individual properties does *not* trigger
- // change notification
- compare(coordSpy.count, 0)
-
- // updating the whole object *does* trigger change notification
- base = QtPositioning.coordinate(3.0, 4.0, 5.0)
- compare(base.latitude, 3.0)
- compare(base.longitude, 4.0)
- compare(base.altitude, 5.0)
- compare(coordSpy.count, 1)
- }
-
- function test_comparison_data()
- {
- return [
- { tag: "empty", coord1: empty, coord2: QtPositioning.coordinate(), result: true },
- { tag: "zero", coord1: zero, coord2: QtPositioning.coordinate(0, 0), result: true },
- { tag: "plusone", coord1: plusone, coord2: QtPositioning.coordinate(0, 1), result: true },
- { tag: "minusone", coord1: minusone, coord2: QtPositioning.coordinate(0, -1), result: true },
- { tag: "north", coord1: north, coord2: QtPositioning.coordinate(3, 0), result: true },
- { tag: "lat,long.alt", coord1: QtPositioning.coordinate(1.1, 2.2, 3.3), coord2: QtPositioning.coordinate(1.1, 2.2, 3.3), result: true },
- { tag: "not equal1", coord1: plusone, coord2: minusone, result: false },
- { tag: "not equal2", coord1: plusone, coord2: north, result: false }
- ]
- }
-
- function test_comparison(data)
- {
- compare(data.coord1 === data.coord2, data.result)
- compare(data.coord1 !== data.coord2, !data.result)
- compare(data.coord1 == data.coord2, data.result)
- compare(data.coord1 != data.coord2, !data.result)
- }
-
- function test_distance()
- {
- compare(zero.distanceTo(plusone), zero.distanceTo(minusone))
- compare(2*plusone.distanceTo(zero), plusone.distanceTo(minusone))
- compare(zero.distanceTo(plusone) > 0, true)
- }
-
- function test_azimuth()
- {
- compare(zero.azimuthTo(north), 0)
- compare(zero.azimuthTo(plusone), 90)
- compare(zero.azimuthTo(minusone), 270)
- compare(minusone.azimuthTo(plusone), 360 - plusone.azimuthTo(minusone))
- }
-
- function test_atDistanceAndAzimuth()
- {
- // 112km is approximately one degree of arc
-
- var coord_0d = zero.atDistanceAndAzimuth(112000, 0)
- compare(coord_0d.latitude > 0.95, true)
- compare(coord_0d.latitude < 1.05, true)
- compare(coord_0d.longitude < 0.05, true)
- compare(coord_0d.longitude > -0.05, true)
- compare(zero.distanceTo(coord_0d), 112000)
- compare(zero.azimuthTo(coord_0d), 0)
-
- var coord_90d = zero.atDistanceAndAzimuth(112000, 90)
- compare(coord_90d.longitude > 0.95, true)
- compare(coord_90d.longitude < 1.05, true)
- compare(coord_90d.latitude < 0.05, true)
- compare(coord_90d.latitude > -0.05, true)
- compare(zero.distanceTo(coord_90d), 112000)
- compare(zero.azimuthTo(coord_90d), 90)
-
- var coord_30d = zero.atDistanceAndAzimuth(20000, 30)
- compare(coord_30d.longitude > 0, true)
- compare(coord_30d.latitude > 0, true)
- compare(zero.distanceTo(coord_30d), 20000)
- compare(zero.azimuthTo(coord_30d), 30)
-
- var coord_30d2 = coord_30d.atDistanceAndAzimuth(200, 30)
- compare(zero.distanceTo(coord_30d2), 20200)
- }
- }
-
- TestCase {
- name: "CoordinateAnimation"
-
- function init()
- {
- coordinateAnimation.stop()
- coordinateAnimationStartSpy.clear()
- coordinateAnimationStopSpy.clear()
- coordinateAnimationDirectionSpy.clear()
- coordinateAnimation.from = QtPositioning.coordinate(50,50)
- coordinateAnimation.to = QtPositioning.coordinate(50,50)
- coordinateAnimation.direction = CoordinateAnimation.Shortest
- coordinateItem.coordinate = QtPositioning.coordinate(50,50)
- coordinateItem.coordinateList = []
- coordinateItem.coordinateCount = 0
- }
-
- function initTestCase()
- {
- compare(coordinateAnimation.direction, CoordinateAnimation.Shortest)
- compare(coordinateAnimationDirectionSpy.count,0)
- coordinateAnimation.direction = CoordinateAnimation.Shortest
- compare(coordinateAnimationDirectionSpy.count,0)
- coordinateAnimation.direction = CoordinateAnimation.West
- compare(coordinateAnimationDirectionSpy.count,1)
- coordinateAnimation.direction = CoordinateAnimation.East
- compare(coordinateAnimationDirectionSpy.count,2)
- }
-
- function toMercator(coord)
- {
- var p = QtPositioning.coordToMercator(coord)
- var lat = p.y
- var lon = p.x
- return {'latitude': lat, 'longitude': lon};
- }
-
- function coordinate_animation(from, to, movingEast)
- {
- var fromMerc = toMercator(from)
- var toMerc = toMercator(to)
- var delta = (toMerc.latitude - fromMerc.latitude) / (toMerc.longitude - fromMerc.longitude)
-
- compare(coordinateItem.coordinateList.length, 0);
- coordinateAnimation.from = from
- coordinateAnimation.to = to
- coordinateAnimation.start()
- tryCompare(coordinateAnimationStartSpy,"count",1)
- tryCompare(coordinateAnimationStopSpy,"count",1)
-
- //check correct start position
- verify(coordinateItem.coordinateList.length != 0)
- compare(coordinateItem.coordinateList[0], from)
- //check correct end position
- compare(coordinateItem.coordinateList[coordinateItem.coordinateList.length - 1],to)
-
- var i
- var lastLongitude
- for (i in coordinateItem.coordinateList) {
- var coordinate = coordinateItem.coordinateList[i]
- var mercCoordinate = toMercator(coordinate)
-
- //check that coordinates from the animation is along a straight line between from and to
- var estimatedLatitude = fromMerc.latitude + (mercCoordinate.longitude - fromMerc.longitude) * delta
- verify(mercCoordinate.latitude - estimatedLatitude < 0.00000000001);
-
- //check that each step has moved in the right direction
-
- if (lastLongitude) {
- var errorMessage = "movingEast: " + movingEast + "; From: " + from + "; To: " + to + "; i: " + i + "; crdList: " + coordinateItem.coordinateList
- if (movingEast) {
- if (coordinate.longitude < 0 && lastLongitude > 0)
- verify(coordinate.longitude + 360 > lastLongitude, errorMessage)
- else
- verify(coordinate.longitude > lastLongitude, errorMessage)
- } else {
- if (coordinate.longitude > 0 && lastLongitude < 0)
- verify(coordinate.longitude < lastLongitude + 360, errorMessage)
- else
- verify(coordinate.longitude < lastLongitude, errorMessage)
- }
- }
- lastLongitude = coordinate.longitude
- }
- }
-
- function test_default_coordinate_animation(data)
- {
- //shortest
- coordinate_animation(data.from, data.to, data.east)
- }
-
- function test_default_coordinate_animation_data()
- {
- return [
- {
- from: QtPositioning.coordinate(58.0, 12.0),
- to: QtPositioning.coordinate(62.0, 24.0),
- east: true
- },
- {
- from: QtPositioning.coordinate(58.0, 24.0),
- to: QtPositioning.coordinate(42.0, 12.0),
- east: false
- },
- // cross 0
- {
- from: QtPositioning.coordinate(30, 10),
- to: QtPositioning.coordinate(20, -10),
- east: false
- },
- {
- from: QtPositioning.coordinate(30, -20),
- to: QtPositioning.coordinate(20, 10),
- east: true
- },
- // cross 180
- {
- from: QtPositioning.coordinate(30, 170),
- to: QtPositioning.coordinate(30, -170),
- east: true
- },
- {
- from: QtPositioning.coordinate(30, -170),
- to: QtPositioning.coordinate(30, 170),
- east: false
- },
- ]
- }
-
- function test_east_direction_coordinate_animation(data)
- {
- coordinateAnimation.direction = CoordinateAnimation.East
- coordinate_animation(data.from,
- data.to,
- true)
- }
-
- function test_east_direction_coordinate_animation_data()
- {
- return [
- { from: QtPositioning.coordinate(58.0,24.0), to: QtPositioning.coordinate(58.0,12.0) },
- { from: QtPositioning.coordinate(58.0,12.0), to: QtPositioning.coordinate(58.0,24.0) },
- ]
- }
-
-
- function test_west_direction_coordinate_animation(data)
- {
- coordinateAnimation.direction = CoordinateAnimation.West
- coordinate_animation(data.from,
- data.to,
- false)
- }
-
- function test_west_direction_coordinate_animation_data()
- {
- return [
- { from: QtPositioning.coordinate(58.0,24.0),to: QtPositioning.coordinate(58.0,12.0) },
- { from: QtPositioning.coordinate(58.0,12.0),to: QtPositioning.coordinate(58.0,24.0) },
- ]
- }
-
-
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_geoshape.qml b/tests/auto/declarative_positioning_core/tst_geoshape.qml
deleted file mode 100644
index 6429fb26..00000000
--- a/tests/auto/declarative_positioning_core/tst_geoshape.qml
+++ /dev/null
@@ -1,300 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 5.2
-import TestFactory 1.0
-
-Item {
- id: testCase
-
- property var coordinate1: QtPositioning.coordinate(1, 1)
- property var coordinate2: QtPositioning.coordinate(2, 2)
- property var coordinate3: QtPositioning.coordinate(80, 80)
-
- property var emptyCircle: QtPositioning.circle()
- property var circle1: QtPositioning.circle(coordinate1, 200000)
-
- SignalSpy { id: circleChangedSpy; target: testCase; signalName: "emptyCircleChanged" }
-
- TestCase {
- name: "Bounding circle"
- function test_circle_defaults_and_setters() {
- circleChangedSpy.clear();
- compare (emptyCircle.radius, -1)
- compare (circle1.radius, 200000)
-
- emptyCircle.radius = 200
- compare(emptyCircle.radius, 200)
-
- emptyCircle.center = coordinate1
- compare(emptyCircle.center, coordinate1)
-
- emptyCircle.center = coordinate2
- compare(emptyCircle.center, coordinate2)
-
- emptyCircle = QtPositioning.circle(coordinate1, 200000)
- compare(emptyCircle.center, coordinate1)
- compare(emptyCircle.radius, 200000)
- // signal is triggered only when we update the whole object
- compare(circleChangedSpy.count, 1)
-
- compare(emptyCircle.contains(coordinate1), true);
- compare(emptyCircle.contains(coordinate2), true);
- compare(emptyCircle.contains(coordinate3), false);
- }
- }
-
- property var trace1 : [ QtPositioning.coordinate(43.773175, 11.255386),
- QtPositioning.coordinate(43.773546 , 11.255372) ]
- property var trace2 : [ QtPositioning.coordinate(43.773175, 11.255386),
- QtPositioning.coordinate(43.773546 , 11.255372),
- QtPositioning.coordinate(43.77453 , 11.255734) ]
-
-
- // coordinate unit square
- property var bl: QtPositioning.coordinate(0, 0)
- property var tl: QtPositioning.coordinate(1, 0)
- property var tr: QtPositioning.coordinate(1, 1)
- property var br: QtPositioning.coordinate(0, 1)
- property var ntr: QtPositioning.coordinate(3, 3)
-
- property var invalid: QtPositioning.coordinate(100, 190)
- property var inside: QtPositioning.coordinate(0.5, 0.5)
- property var outside: QtPositioning.coordinate(2, 2)
-
- property var box: QtPositioning.rectangle(tl, br)
-
- property var coordinates: [bl, tl, tr, br]
- property var coordinates2: [bl, tl, tr, br, ntr]
- property var coordinates3: [tr]
- property var coordinates4: [invalid]
- property var coordinates5: []
-
- property var listBox: QtPositioning.rectangle(coordinates)
- property var listBox2: QtPositioning.rectangle(coordinates2)
- property var listBox3: QtPositioning.rectangle(coordinates3)
- property var listBox4: QtPositioning.rectangle(coordinates4)
- property var listBox5: QtPositioning.rectangle(coordinates5)
-
- property var widthBox: QtPositioning.rectangle(inside, 1, 1);
-
- // C++ auto test exists for basics of bounding box, testing here
- // only added functionality
- TestCase {
- name: "Bounding box"
- function test_box_defaults_and_setters() {
- compare (box.bottomRight.longitude, br.longitude) // sanity
- compare (box.contains(bl), true)
- compare (box.contains(inside), true)
- compare (box.contains(outside), false)
- box.topRight = ntr
- compare (box.contains(outside), true)
-
- compare (listBox.isValid, true)
- compare (listBox.contains(outside), false)
- compare (listBox2.contains(outside), true)
- compare (listBox3.isValid, true)
- compare (listBox3.isEmpty, true)
- compare (listBox4.isValid, false)
- compare (listBox5.isValid, false)
-
- compare (widthBox.contains(inside), true)
- compare (widthBox.contains(outside), false)
- }
- }
-
- TestCase {
- name: "Shape"
-
- function test_shape_comparison_data() {
- return [
- { tag: "invalid shape", shape1: QtPositioning.shape(), shape2: QtPositioning.shape(), result: true },
- { tag: "box equal", shape1: box, shape2: QtPositioning.rectangle(tl, br), result: true },
- { tag: "box not equal", shape1: box, shape2: QtPositioning.rectangle([inside, outside]), result: false },
- { tag: "box invalid shape", rect1: box, shape2: QtPositioning.shape(), result: false },
- { tag: "invalid rectangle", shape1: QtPositioning.rectangle(), shape2: QtPositioning.rectangle(), result: true },
- { tag: "invalid rectangle2", shape1: QtPositioning.rectangle(), shape2: QtPositioning.shape(), result: false },
- { tag: "circle1 equal", shape1: circle1, shape2: QtPositioning.circle(coordinate1, 200000), result: true },
- { tag: "circle1 not equal", shape1: circle1, shape2: QtPositioning.circle(coordinate2, 2000), result: false },
- { tag: "circle1 invalid shape", shape1: circle1, shape2: QtPositioning.shape(), result: false },
- { tag: "invalid circle", shape1: QtPositioning.circle(), shape2: QtPositioning.circle(), result: true },
- { tag: "invalid circle2", shape1: QtPositioning.circle(), shape2: QtPositioning.shape(), result: false }
- ]
- }
-
- function test_shape_comparison(data) {
- compare(data.shape1 === data.shape2, data.result)
- compare(data.shape1 !== data.shape2, !data.result)
- compare(data.shape1 == data.shape2, data.result)
- compare(data.shape1 != data.shape2, !data.result)
- }
- }
-
- TestCase {
- name: "Conversions"
-
- function test_shape_circle_conversions() {
- var circle = QtPositioning.shapeToCircle(QtPositioning.shape())
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(QtPositioning.circle())
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(QtPositioning.circle(tl, 10000))
- verify(circle.isValid)
- compare(circle.center, tl)
- compare(circle.radius, 10000)
- circle = QtPositioning.shapeToCircle(QtPositioning.rectangle())
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(QtPositioning.rectangle(tl, br))
- verify(!circle.isValid)
- circle = QtPositioning.shapeToCircle(listBox)
- verify(!circle.isValid)
- }
-
- function test_shape_rectangle_conversions() {
- var rectangle = QtPositioning.shapeToRectangle(QtPositioning.shape())
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.circle())
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.circle(tl, 10000))
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.rectangle())
- verify(!rectangle.isValid)
- rectangle = QtPositioning.shapeToRectangle(QtPositioning.rectangle(tl, br))
- verify(rectangle.isValid)
- compare(rectangle.topLeft, tl)
- compare(rectangle.bottomRight, br)
- rectangle = QtPositioning.shapeToRectangle(listBox)
- verify(rectangle.isValid)
- }
-
- function test_shape_path_conversions() {
- var path = QtPositioning.shapeToPath(QtPositioning.shape())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.circle())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.circle(tl, 10000))
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.rectangle())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.rectangle(tl, br))
- verify(!path.isValid)
-
- path = QtPositioning.shapeToPath(QtPositioning.path())
- verify(!path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.path(trace1, 1))
- verify(path.isValid)
- path = QtPositioning.shapeToPath(QtPositioning.path(trace2, 2))
- verify(path.isValid)
- verify(path !== QtPositioning.shapeToPath(QtPositioning.path(trace1, 1)))
- compare(path, QtPositioning.shapeToPath(QtPositioning.path(trace2, 2)))
- }
-
- function test_shape_polygon_conversions() {
- var polygon = QtPositioning.shapeToPolygon(QtPositioning.shape())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.circle())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.circle(tl, 10000))
- verify(polygon.isValid) // fixed, polygon copy constructor can now initialize from a circle.
- polygon = QtPositioning.shapeToPolygon(QtPositioning.rectangle())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.rectangle(tl, br))
- verify(polygon.isValid) // fixed, polygon copy constructor can now initialize from a rectangle.
-
- polygon = QtPositioning.shapeToPolygon(QtPositioning.polygon())
- verify(!polygon.isValid)
- polygon = QtPositioning.shapeToPolygon(QtPositioning.polygon(trace1))
- verify(!polygon.isValid) // polygon needs 3 coords at least
- polygon = QtPositioning.shapeToPolygon(QtPositioning.polygon(trace2))
- verify(polygon.isValid)
- verify(polygon !== QtPositioning.shapeToPolygon(QtPositioning.polygon(trace1)))
- compare(polygon, QtPositioning.shapeToPolygon(QtPositioning.polygon(trace2)))
- }
- }
-
- TestCase {
- name: "GeoPath path"
- function test_qgeopath_path_operations() {
- var geopath = QtPositioning.path()
-
- geopath.path = trace2
- compare(geopath.path.length, trace2.length)
-
- geopath.path = trace2
- geopath.path[0].longitude = 11.0
- compare(geopath.path.length, trace2.length)
- compare(geopath.coordinateAt(0).latitude, trace2[0].latitude)
- expectFail("", "Longitude comparison fails")
- compare(geopath.coordinateAt(0).longitude, 11)
- }
- }
-
- TestCase {
- name: "GeoPolygon path"
- function test_qgeopolygon_path_operations() {
- var geopolygon = QtPositioning.polygon()
-
- geopolygon.perimeter = trace2
- compare(geopolygon.perimeter.length, trace2.length)
-
- geopolygon.perimeter = trace2
- compare(geopolygon.perimeter.length, trace2.length)
- compare(geopolygon.coordinateAt(0).latitude, trace2[0].latitude)
- compare(geopolygon.coordinateAt(0).longitude, trace2[0].longitude)
- }
- }
-
- Factory {
- id: factory
- }
-
- TestCase {
- name: "GeoShape factory"
- function test_geoshape_factory_construction() {
- // Both createShape() methods return QGeoShape. We check that
- // invokable methods and properties are called for correct
- // objects
- var c0 = QtPositioning.coordinate(1.0, 1.0)
- var c1 = QtPositioning.coordinate(1.0001, 1.0001)
- var c2 = QtPositioning.coordinate(0.5, 0.5)
- var circle = factory.createShape(c0, 100.0)
- verify(circle.contains(c1))
- verify(!circle.contains(c2))
- compare(circle.center, c0)
-
- var rectangle = factory.createShape(QtPositioning.coordinate(1.0, 0.0), QtPositioning.coordinate(0.0, 1.0))
- verify(rectangle.contains(c2))
- verify(!rectangle.contains(c1))
- compare(rectangle.center, c2)
-
- verify(rectangle.center !== circle.center)
- }
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_position.qml b/tests/auto/declarative_positioning_core/tst_position.qml
deleted file mode 100644
index 77e6b90c..00000000
--- a/tests/auto/declarative_positioning_core/tst_position.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 5.3
-
-TestCase {
- id: testCase
-
- name: "Position"
-
- Position { id: defaultPosition }
-
- function test_defaults() {
- compare(defaultPosition.latitudeValid, false);
- compare(defaultPosition.longitudeValid, false);
- compare(defaultPosition.altitudeValid, false);
- compare(defaultPosition.speedValid, false);
- compare(defaultPosition.horizontalAccuracyValid, false);
- compare(defaultPosition.verticalAccuracyValid, false);
- verify(!defaultPosition.directionValid);
- verify(isNaN(defaultPosition.direction));
- verify(!defaultPosition.verticalSpeedValid);
- verify(isNaN(defaultPosition.verticalSpeed));
- }
-}
diff --git a/tests/auto/declarative_positioning_core/tst_positionsource.qml b/tests/auto/declarative_positioning_core/tst_positionsource.qml
deleted file mode 100644
index 74233fcd..00000000
--- a/tests/auto/declarative_positioning_core/tst_positionsource.qml
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtTest 1.0
-import QtPositioning 5.14
-
-TestCase {
- id: testCase
-
- name: "PositionSource"
-
- PositionSource { id: defaultSource }
- PositionSource
- {
- id: activeDefaultSource
- active: true
- }
-
- SignalSpy { id: defaultSourceSpy; target: defaultSource; signalName: "positionChanged" }
-
- function test_activeDefaultSource() {
- wait(0);
- verify(activeDefaultSource.name !== "");
- compare(activeDefaultSource.active, true);
- }
-
- function test_invalidSource() {
- activeDefaultSource.name = "invalid_positioning_source";
- verify(!activeDefaultSource.active);
- verify(!activeDefaultSource.valid);
- }
-
- function test_defaults() {
- // at least the test.source plugin should be available
- verify(defaultSource.name != "");
- compare(defaultSource.active, false);
- }
-
- function test_inactive() {
- defaultSourceSpy.clear();
- compare(defaultSourceSpy.count, 0);
- wait(1000);
- compare(defaultSourceSpy.count, 0);
- }
-
- PositionSource { id: testSetSource; name: "nonexistent bogus plugin" }
- SignalSpy { id: testingSourcePluginSpy; target: testSetSource; signalName: "nameChanged" }
-
- function test_setplugin() {
- testingSourcePluginSpy.clear();
-
- // On construction, if the provided source name is invalid, the default source will be
- // used. Test that the source is valid as expected.
- verify(testSetSource.name !== "");
- //we don't really know what the default source is named.
- //It may not be "test.source"
- var defaultSourceName = testSetSource.name;
- verify(testSetSource.valid);
-
- // Test that setting name to "" will still use the default.
- testSetSource.name = "";
- compare(testingSourcePluginSpy.count, 0);
- compare(testSetSource.name, defaultSourceName);
- verify(testSetSource.valid);
-
- testSetSource.name = "test.source";
- if (defaultSourceName === "test.source")
- compare(testingSourcePluginSpy.count, 0);
- compare(testSetSource.name, "test.source");
- verify(testSetSource.valid);
- testingSourcePluginSpy.clear();
-
- testSetSource.name = "bogus";
- compare(testingSourcePluginSpy.count, 1);
- verify(!testSetSource.valid);
- }
-
- PositionSource { id: testingSource; name: "test.source"; updateInterval: 1000 }
-
- PositionSource {
- id: testingSourceWParams
- name: "test.source"
- updateInterval: 200
- PluginParameter {
- id: altitudeParameter
- name: "test.source.altitude"
- value: 42.42
- }
- }
-
- // use property bindings instead of SignalSpy
- property bool directionWParamsValid: testingSourceWParams.position.directionValid
- property int directionWParamsValidChangedCount: 0
- onDirectionWParamsValidChanged: {
- ++directionWParamsValidChangedCount
- }
-
- property real directionWParams: testingSourceWParams.position.direction
- property int directionWParamsChangedCount: 0
- onDirectionWParamsChanged: {
- ++directionWParamsChangedCount
- }
-
- SignalSpy { id: updateSpyWParams; target: testingSourceWParams; signalName: "positionChanged" }
-
- PositionSource { id: testingSourceV1; name: "test.source"; updateInterval: 200 }
-
- // use property bindings instead of SignalSpy
- property bool directionV1Valid: testingSourceV1.position.directionValid
- property int directionV1ValidChangedCount: 0
- onDirectionV1ValidChanged: {
- ++directionV1ValidChangedCount
- }
-
- property real directionV1: testingSourceV1.position.direction
- property int directionV1ChangedCount: 0
- onDirectionV1Changed: {
- ++directionV1ChangedCount
- }
-
- SignalSpy { id: updateSpyV1; target: testingSourceV1; signalName: "positionChanged" }
-
- function test_updateInterval() {
- testingSource.updateInterval = 200;
- compare(testingSource.updateInterval, 200);
- testingSource.updateInterval = 300;
- compare(testingSource.updateInterval, 300);
- testingSource.updateInterval = 100;
- compare(testingSource.updateInterval, 200);
- }
-
- function test_preferredPositioningMethods() {
- testingSource.preferredPositioningMethods = PositionSource.AllPositioningMethods;
- compare(testingSource.preferredPositioningMethods, PositionSource.AllPositioningMethods);
- testingSource.preferredPositioningMethods = PositionSource.SatellitePositioningMethods;
- compare(testingSource.preferredPositioningMethods, PositionSource.SatellitePositioningMethods);
- testingSource.preferredPositioningMethods = PositionSource.NonSatellitePositioningMethods;
- compare(testingSource.preferredPositioningMethods, PositionSource.NonSatellitePositioningMethods);
- }
-
- function test_updates() {
- updateSpyV1.clear();
-
- directionV1ChangedCount = 0
- directionV1ValidChangedCount = 0
-
- testingSourceV1.active = true;
-
- tryCompare(updateSpyV1, "count", 1, 300);
- compare(testingSourceV1.position.coordinate.longitude, 0.1);
- compare(testingSourceV1.position.coordinate.latitude, 0.1);
- compare(directionV1ValidChangedCount, 1)
- compare(directionV1ChangedCount, 1)
- fuzzyCompare(testingSourceV1.position.direction, 45, 0.1)
- verify(!testingSourceV1.position.speedValid)
- verify(isNaN(testingSourceV1.position.speed))
-
- tryCompare(updateSpyV1, "count", 2, 300);
- compare(testingSourceV1.position.coordinate.longitude, 0.2);
- compare(testingSourceV1.position.coordinate.latitude, 0.2);
- compare(directionV1ValidChangedCount, 1)
- compare(directionV1ChangedCount, 2)
- fuzzyCompare(testingSourceV1.position.direction, 45, 0.1)
- verify(testingSourceV1.position.speedValid)
- verify(testingSourceV1.position.speed > 10000)
-
- testingSourceV1.active = false;
- wait(300);
- compare(updateSpyV1.count, 2);
- compare(testingSourceV1.position.coordinate.longitude, 0.2);
- compare(testingSourceV1.position.coordinate.latitude, 0.2);
- compare(directionV1ValidChangedCount, 1)
- compare(directionV1ChangedCount, 2)
- fuzzyCompare(testingSourceV1.position.direction, 45, 0.1)
- verify(testingSourceV1.position.speedValid)
- verify(testingSourceV1.position.speed > 10000)
- }
-
- function test_updates_w_params() {
- updateSpyWParams.clear();
-
- directionWParamsChangedCount = 0
- directionWParamsValidChangedCount = 0
- compare(testingSourceWParams.backendProperty("altitude"), altitudeParameter.value)
- testingSourceWParams.active = true;
-
- tryCompare(updateSpyWParams, "count", 1, 300);
- compare(testingSourceWParams.position.coordinate.longitude, 0.1);
- compare(testingSourceWParams.position.coordinate.latitude, 0.1);
- compare(testingSourceWParams.position.coordinate.altitude, altitudeParameter.value);
- compare(directionWParamsValidChangedCount, 1)
- compare(directionWParamsChangedCount, 1)
- fuzzyCompare(testingSourceWParams.position.direction, 45, 0.1)
- verify(!testingSourceWParams.position.speedValid)
- verify(isNaN(testingSourceWParams.position.speed))
- testingSourceWParams.setBackendProperty("altitude", 24.24)
-
- tryCompare(updateSpyWParams, "count", 2, 300);
- compare(testingSourceWParams.position.coordinate.longitude, 0.2);
- compare(testingSourceWParams.position.coordinate.latitude, 0.2);
- compare(testingSourceWParams.position.coordinate.altitude, 24.24);
- compare(directionWParamsValidChangedCount, 1)
- compare(directionWParamsChangedCount, 2)
- fuzzyCompare(testingSourceWParams.position.direction, 45, 0.1)
- verify(testingSourceWParams.position.speedValid)
- verify(testingSourceWParams.position.speed > 10000)
- compare(testingSourceWParams.backendProperty("altitude"), 24.24)
-
- testingSourceWParams.active = false;
- wait(300);
- compare(updateSpyWParams.count, 2);
- compare(testingSourceWParams.position.coordinate.longitude, 0.2);
- compare(testingSourceWParams.position.coordinate.latitude, 0.2);
- compare(testingSourceWParams.position.coordinate.altitude, 24.24);
- compare(directionWParamsValidChangedCount, 1)
- compare(directionWParamsChangedCount, 2)
- fuzzyCompare(testingSourceWParams.position.direction, 45, 0.1)
- verify(testingSourceWParams.position.speedValid)
- verify(testingSourceWParams.position.speed > 10000)
- }
-
- // tests for bindings
- PositionSource {
- id: testSourceForBindings
- name: "test.source"
- }
-
- property var positionObserver: testSourceForBindings.position
- SignalSpy {
- id: positionObserverSpy; target: testSourceForBindings; signalName: "positionChanged"
- }
-
- property bool activeObserver: testSourceForBindings.active
- SignalSpy {
- id: activeObserverSpy; target: testSourceForBindings; signalName: "activeChanged"
- }
-
- property bool validObserver: testSourceForBindings.valid
- SignalSpy {
- id: validObserverSpy; target: testSourceForBindings; signalName: "validityChanged"
- }
-
- property int updateIntervalObserver: testSourceForBindings.updateInterval
- SignalSpy {
- id: updateIntervalObserverSpy; target: testSourceForBindings; signalName: "updateIntervalChanged"
- }
-
- property int supportedMethodsObserver: testSourceForBindings.supportedPositioningMethods
- SignalSpy {
- id: supportedMethodsObserverSpy; target: testSourceForBindings; signalName: "supportedPositioningMethodsChanged"
- }
-
- property int preferredMethodsObserver: testSourceForBindings.preferredPositioningMethods
- SignalSpy {
- id: preferredMethodsObserverSpy;
- target: testSourceForBindings;
- signalName: "preferredPositioningMethodsChanged"
- }
-
- property int errorObserver: testSourceForBindings.sourceError
- SignalSpy {
- id: errorObserverSpy; target: testSourceForBindings; signalName: "sourceErrorChanged"
- }
-
- property string nameObserver: testSourceForBindings.name
- SignalSpy {
- id: nameObserverSpy; target: testSourceForBindings; signalName: "nameChanged"
- }
-
- function test_bindingsToPositionSource() {
- positionObserverSpy.clear()
- activeObserverSpy.clear()
- validObserverSpy.clear()
- updateIntervalObserverSpy.clear()
- supportedMethodsObserverSpy.clear()
- preferredMethodsObserverSpy.clear()
- errorObserverSpy.clear()
- nameObserverSpy.clear()
-
- verify(testSourceForBindings.valid)
- compare(testSourceForBindings.supportedPositioningMethods, PositionSource.AllPositioningMethods)
-
- testSourceForBindings.preferredPositioningMethods = PositionSource.SatellitePositioningMethods
- compare(preferredMethodsObserver, PositionSource.SatellitePositioningMethods)
- compare(preferredMethodsObserverSpy.count, 1)
-
- testSourceForBindings.updateInterval = 210;
- compare(updateIntervalObserver, 210)
- compare(updateIntervalObserverSpy.count, 1)
-
- testSourceForBindings.start();
- compare(activeObserver, true)
- compare(activeObserverSpy.count, 1)
-
- tryCompare(positionObserverSpy, "count", 1, 300);
- verify(testSourceForBindings.position.coordinate !== QtPositioning.coordinate())
-
- testSourceForBindings.update(50) // small timeout will result in an error
- tryCompare(errorObserverSpy, "count", 1, 200)
- compare(errorObserver, PositionSource.UpdateTimeoutError)
-
- var newSourceName = "some invalid name"
- testSourceForBindings.name = newSourceName
-
- compare(validObserver, false)
- compare(validObserverSpy.count, 1)
-
- compare(nameObserver, newSourceName)
- compare(nameObserverSpy.count, 1)
-
- compare(supportedMethodsObserver, PositionSource.NoPositioningMethods)
- compare(supportedMethodsObserverSpy.count, 1)
- }
-
- property bool activeSetter: false
- property string nameSetter: "test.source"
- property int updateIntervalSetter: 200
- property int preferredMethodsSetter: PositionSource.NonSatellitePositioningMethods
-
- PositionSource {
- id: sourceWithBindings
- name: nameSetter
- active: activeSetter
- updateInterval: updateIntervalSetter
- preferredPositioningMethods: preferredMethodsSetter
- }
-
- function test_bindPositionSourceProperties() {
- compare(sourceWithBindings.name, "test.source")
- compare(sourceWithBindings.active, false)
- compare(sourceWithBindings.updateInterval, 200)
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.NonSatellitePositioningMethods)
-
- updateIntervalSetter = 210;
- preferredMethodsSetter = PositionSource.AllPositioningMethods
- activeSetter = true
-
- wait(0) // to trigger event processing
-
- compare(sourceWithBindings.active, true)
- compare(sourceWithBindings.updateInterval, 210)
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.AllPositioningMethods)
-
- activeSetter = false;
-
- compare(sourceWithBindings.active, false)
-
- // check how call to update() effects the binding
- sourceWithBindings.update(updateIntervalSetter)
- compare(sourceWithBindings.active, true)
-
- wait(300)
- compare(sourceWithBindings.active, false)
-
- activeSetter = true;
- wait(0) // to trigger event processing
- // the binding is *not* broken by calling update()
- compare(sourceWithBindings.active, true)
- }
-
- function test_updateIntervalBindings() {
- var updateIntervalSpy = Qt.createQmlObject('import QtTest; SignalSpy { }', testCase)
- updateIntervalSpy.target = sourceWithBindings
- updateIntervalSpy.signalName = "updateIntervalChanged"
- verify(updateIntervalSpy.valid)
-
- nameSetter = "invalid name"
- updateIntervalSetter = 100;
- compare(sourceWithBindings.updateInterval, 100)
- compare(updateIntervalSpy.count, 1)
-
- nameSetter = "test.source"
- // "test.source" has a minimum update interval of 200
- compare(sourceWithBindings.updateInterval, 200)
- compare(updateIntervalSpy.count, 2)
-
- nameSetter = "dummy.source"
- // "dummy.source" has a minimum udpate interval of 100, so we expect
- // the updateInterval to be set to 100
- compare(sourceWithBindings.updateInterval, 100)
- compare(updateIntervalSpy.count, 3)
-
- // The binding still works
- updateIntervalSetter = 110
- compare(sourceWithBindings.updateInterval, 110)
- compare(updateIntervalSpy.count, 4)
- }
-
- function test_preferredPositioningMethodsBindings() {
- var preferredMethodsSpy = Qt.createQmlObject('import QtTest; SignalSpy { }', testCase)
- preferredMethodsSpy.target = sourceWithBindings
- preferredMethodsSpy.signalName = "preferredPositioningMethodsChanged"
- verify(preferredMethodsSpy.valid)
-
- nameSetter = "invalid name"
- preferredMethodsSetter = PositionSource.SatellitePositioningMethods
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.SatellitePositioningMethods)
- compare(preferredMethodsSpy.count, 1)
-
- nameSetter = "dummy.source"
- // "dummy.source" has only NonSatellitePositioningMethods, so we expect
- // the value to be set to NonSatellitePositioningMethods (see
- // QGeoPositionInfoSource::setPreferredPositioningMethods for details)
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.NonSatellitePositioningMethods)
- compare(preferredMethodsSpy.count, 2)
-
- nameSetter = "test.source"
- // "test.source" has all positioning methods, so we expect the value to
- // be set to the desired SatellitePositioningMethods
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.SatellitePositioningMethods)
- compare(preferredMethodsSpy.count, 3)
-
- // The binding still works
- preferredMethodsSetter = PositionSource.AllPositioningMethods
- compare(sourceWithBindings.preferredPositioningMethods, PositionSource.AllPositioningMethods)
- compare(preferredMethodsSpy.count, 4)
- }
-
-}
diff --git a/tests/auto/doublevectors/CMakeLists.txt b/tests/auto/doublevectors/CMakeLists.txt
deleted file mode 100644
index 99aeef47..00000000
--- a/tests/auto/doublevectors/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from doublevectors.pro.
-
-#####################################################################
-## tst_doublevectors Test:
-#####################################################################
-
-qt_internal_add_test(tst_doublevectors
- SOURCES
- tst_doublevectors.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::PositioningPrivate
-)
-
-#### Keys ignored in scope 1:.:.:doublevectors.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/doublevectors/doublevectors.pro b/tests/auto/doublevectors/doublevectors.pro
deleted file mode 100644
index 841a19e2..00000000
--- a/tests/auto/doublevectors/doublevectors.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_doublevectors
-
-SOURCES += tst_doublevectors.cpp
-
-QT += positioning-private testlib
diff --git a/tests/auto/doublevectors/tst_doublevectors.cpp b/tests/auto/doublevectors/tst_doublevectors.cpp
deleted file mode 100644
index ae1b2ba9..00000000
--- a/tests/auto/doublevectors/tst_doublevectors.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QString>
-#include <QtTest/QtTest>
-
-#include <QtPositioning/private/qdoublevector2d_p.h>
-#include <QtPositioning/private/qdoublevector3d_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_doubleVectors : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- // 2D
- void constructor2dTest();
- void basicFunctions2dTest();
- void unaryOperator2dTest();
- void binaryOperator2dTest();
-
- // 3D
- void constructor3dTest();
- void basicFunctions3dTest();
- void unaryOperator3dTest();
- void binaryOperator3dTest();
-};
-
-// DoubleVector2D
-
-void tst_doubleVectors::constructor2dTest()
-{
- // empty constructor, since it sets to 0, we should check, in case people rely on it
- QDoubleVector2D v1;
- QCOMPARE(v1.x(), 0.0);
- QCOMPARE(v1.y(), 0.0);
- QCOMPARE(v1.isNull(), true);
- v1 = QDoubleVector2D(1.1, -2.5); // assignment and constructor
- QCOMPARE(v1.x(), 1.1);
- QCOMPARE(v1.y(), -2.5);
- QDoubleVector2D v2(v1); // copy constructor
- QCOMPARE(v2.x(), 1.1);
- QCOMPARE(v2.y(), -2.5);
- const QDoubleVector3D v3d(2.2, 3.3, 4.4);
- QDoubleVector2D v3(v3d); // constructor from 3d vector, just copies x and y
- QCOMPARE(v3.x(), 2.2);
- QCOMPARE(v3.y(), 3.3);
- QCOMPARE(v3.isNull(), false);
-}
-
-void tst_doubleVectors::basicFunctions2dTest()
-{
- QDoubleVector2D v1;
- v1.setX(3.0);
- v1.setY(4.0);
- QCOMPARE(v1.x(), 3.0);
- QCOMPARE(v1.y(), 4.0);
- QCOMPARE(v1.length(), 5.0);
- QDoubleVector2D v2 = v1.normalized();
- QCOMPARE(v1.lengthSquared(), 25.0);
- v1.normalize();
- QCOMPARE(v1.x(), 3.0/5.0);
- QCOMPARE(v1.y(), 4.0/5.0);
- QCOMPARE(v2.x(), 3.0/5.0);
- QCOMPARE(v2.y(), 4.0/5.0);
-
- QDoubleVector3D v3d = v1.toVector3D();
- QCOMPARE(v3d.x(), 3.0/5.0);
- QCOMPARE(v3d.y(), 4.0/5.0);
- QCOMPARE(v3d.z(), 0.0);
-}
-
-void tst_doubleVectors::unaryOperator2dTest()
-{
- QDoubleVector2D v1(1.1, 2.2);
- QDoubleVector2D v2 = -v1;
- QCOMPARE(v2.x(), -1.1);
- QCOMPARE(v2.y(), -2.2);
-
- v1 *= 2.0;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
-
- v2 /= 2.0;
- QCOMPARE(v2.x(), -0.55);
- QCOMPARE(v2.y(), -1.1);
-
- v1 += v2;
- QCOMPARE(v1.x(), 1.65);
- QCOMPARE(v1.y(), 3.3);
-
- v1 -= v2;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
-
- v1 *= v2;
- QCOMPARE(v1.x(), -1.21);
- QCOMPARE(v1.y(), -4.84);
-}
-
-void tst_doubleVectors::binaryOperator2dTest()
-{
- QDoubleVector2D v1(1.1, 2.2);
- QDoubleVector2D v2(3.4, 4.4);
- QDoubleVector2D v3 = v1 + v2;
- QCOMPARE(v3.x(), 4.5);
- QCOMPARE(v3.y(), 6.6);
-
- QDoubleVector2D v4 = v1 - v2;
- QCOMPARE(v4.x(), -2.3);
- QCOMPARE(v4.y(), -2.2);
-
- QDoubleVector2D v5 = v2 * 2;
- QCOMPARE(v5.x(), 6.8);
- QCOMPARE(v5.y(), 8.8);
-
- QDoubleVector2D v6 = 2 * v2;
- QCOMPARE(v6.x(), 6.8);
- QCOMPARE(v6.y(), 8.8);
-
- QDoubleVector2D v7 = v2 / 2;
- QCOMPARE(v7.x(), 1.7);
- QCOMPARE(v7.y(), 2.2);
-
- double d = QDoubleVector2D::dotProduct(v1, v2);
- QCOMPARE(d, 13.42);
-
- QCOMPARE(v5 == v6, true);
- QCOMPARE(v5 != v6, false);
- QCOMPARE(v6 == v7, false);
- QCOMPARE(v6 != v7, true);
-}
-
-
-
-// DoubleVector3D
-
-
-void tst_doubleVectors::constructor3dTest()
-{
- // empty constructor, since it sets to 0, we should check, in case people rely on it
- QDoubleVector3D v1;
- QCOMPARE(v1.x(), 0.0);
- QCOMPARE(v1.y(), 0.0);
- QCOMPARE(v1.z(), 0.0);
- QCOMPARE(v1.isNull(), true);
- v1 = QDoubleVector3D(1.1, -2.5, 3.2); // assignment and constructor
- QCOMPARE(v1.x(), 1.1);
- QCOMPARE(v1.y(), -2.5);
- QCOMPARE(v1.z(), 3.2);
- QDoubleVector3D v2(v1); // copy constructor
- QCOMPARE(v2.x(), 1.1);
- QCOMPARE(v2.y(), -2.5);
- QCOMPARE(v2.z(), 3.2);
- const QDoubleVector2D v2d(2.2, 3.3);
- QDoubleVector3D v3(v2d); // constructor from 3d vector, just copies x and y
- QCOMPARE(v3.x(), 2.2);
- QCOMPARE(v3.y(), 3.3);
- QCOMPARE(v3.z(), 0.0);
- QCOMPARE(v3.isNull(), false);
- const QDoubleVector2D v2d2(2.2, 3.3);
- QDoubleVector3D v4(v2d2, -13.6); // constructor from 2d vector
- QCOMPARE(v4.x(), 2.2);
- QCOMPARE(v4.y(), 3.3);
- QCOMPARE(v4.z(), -13.6);
-}
-
-void tst_doubleVectors::basicFunctions3dTest()
-{
- QDoubleVector3D v1;
- v1.setX(2.0);
- v1.setY(3.0);
- v1.setZ(6.0);
- QCOMPARE(v1.x(), 2.0);
- QCOMPARE(v1.y(), 3.0);
- QCOMPARE(v1.z(), 6.0);
- QCOMPARE(v1.length(), 7.0);
- QDoubleVector3D v2 = v1.normalized();
- QCOMPARE(v1.lengthSquared(), 49.0);
- v1.normalize();
- QCOMPARE(v1.x(), 2.0/7.0);
- QCOMPARE(v1.y(), 3.0/7.0);
- QCOMPARE(v1.z(), 6.0/7.0);
- QCOMPARE(v2.x(), 2.0/7.0);
- QCOMPARE(v2.y(), 3.0/7.0);
- QCOMPARE(v2.z(), 6.0/7.0);
-
- QDoubleVector2D v2d = v1.toVector2D();
- QCOMPARE(v2d.x(), 2.0/7.0);
- QCOMPARE(v2d.y(), 3.0/7.0);
-}
-
-void tst_doubleVectors::unaryOperator3dTest()
-{
- QDoubleVector3D v1(1.1, 2.2, 3.3);
- QDoubleVector3D v2 = -v1;
- QCOMPARE(v2.x(), -1.1);
- QCOMPARE(v2.y(), -2.2);
- QCOMPARE(v2.z(), -3.3);
-
- v1 *= 2.0;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
- QCOMPARE(v1.z(), 6.6);
-
- v2 /= 2.0;
- QCOMPARE(v2.x(), -0.55);
- QCOMPARE(v2.y(), -1.1);
- QCOMPARE(v2.z(), -1.65);
-
- v1 += v2;
- QCOMPARE(v1.x(), 1.65);
- QCOMPARE(v1.y(), 3.3);
- QCOMPARE(v1.z(), 4.95);
-
- v1 -= v2;
- QCOMPARE(v1.x(), 2.2);
- QCOMPARE(v1.y(), 4.4);
- QCOMPARE(v1.z(), 6.6);
-
- v1 *= v2;
- QCOMPARE(v1.x(), -1.21);
- QCOMPARE(v1.y(), -4.84);
- QCOMPARE(v1.z(), -10.89);
-}
-
-void tst_doubleVectors::binaryOperator3dTest()
-{
- QDoubleVector3D v1(1.1, 2.2, 3.3);
- QDoubleVector3D v2(3.4, 4.4, 5.5);
- QDoubleVector3D v3 = v1 + v2;
- QCOMPARE(v3.x(), 4.5);
- QCOMPARE(v3.y(), 6.6);
- QCOMPARE(v3.z(), 8.8);
-
- QDoubleVector3D v4 = v1 - v2;
- QCOMPARE(v4.x(), -2.3);
- QCOMPARE(v4.y(), -2.2);
- QCOMPARE(v4.z(), -2.2);
-
- QDoubleVector3D v5 = v2 * 2;
- QCOMPARE(v5.x(), 6.8);
- QCOMPARE(v5.y(), 8.8);
- QCOMPARE(v5.z(), 11.0);
-
- QDoubleVector3D v6 = 2 * v2;
- QCOMPARE(v6.x(), 6.8);
- QCOMPARE(v6.y(), 8.8);
- QCOMPARE(v6.z(), 11.0);
-
- QDoubleVector3D v7 = v2 / 2;
- QCOMPARE(v7.x(), 1.7);
- QCOMPARE(v7.y(), 2.2);
- QCOMPARE(v7.z(), 2.75);
-
- double d = QDoubleVector3D::dotProduct(v1, v2);
- QCOMPARE(d, 31.57);
-
- QCOMPARE(v5 == v6, true);
- QCOMPARE(v5 != v6, false);
- QCOMPARE(v6 == v7, false);
- QCOMPARE(v6 != v7, true);
-}
-
-QTEST_APPLESS_MAIN(tst_doubleVectors)
-
-#include "tst_doublevectors.moc"
diff --git a/tests/auto/dummypositionplugin/CMakeLists.txt b/tests/auto/dummypositionplugin/CMakeLists.txt
deleted file mode 100644
index 9c196f0e..00000000
--- a/tests/auto/dummypositionplugin/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from positionplugin.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryTest Plugin:
-#####################################################################
-
-qt_internal_add_plugin(DummyPluginForTestsFactoryPlugin
- OUTPUT_NAME qtposition_testplugin2
- CLASS_NAME DummyPluginForTestsFactory
- PLUGIN_TYPE position
- DEFAULT_IF FALSE
- SOURCES
- plugin.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionplugin.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/tests/auto/dummypositionplugin/dummypositionplugin.pro b/tests/auto/dummypositionplugin/dummypositionplugin.pro
deleted file mode 100644
index bdf4f7a2..00000000
--- a/tests/auto/dummypositionplugin/dummypositionplugin.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qtposition_testplugin2
-QT += positioning-private
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = DummyPluginForTests
-PLUGIN_EXTENDS = -
-load(qt_plugin)
-
-SOURCES += plugin.cpp
-
-OTHER_FILES += \
- plugin.json
diff --git a/tests/auto/dummypositionplugin/plugin.cpp b/tests/auto/dummypositionplugin/plugin.cpp
deleted file mode 100644
index a0a8f475..00000000
--- a/tests/auto/dummypositionplugin/plugin.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeopositioninfosourcefactory.h>
-#include <QObject>
-#include <QtPlugin>
-#include <QTimer>
-
-QT_USE_NAMESPACE
-
-// This is a dummy plugin that is created mostly to test some features of
-// QDeclarativePositionSource. It does not provide any position updates.
-// Use plugin from positionplugin subdirectory, if you need to simulate some
-// positioning updates.
-
-class DummyPluginSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummyPluginSource(const QVariantMap &parameters, QObject *parent = 0);
- ~DummyPluginSource();
-
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 5000) override;
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const override;
- PositioningMethods supportedPositioningMethods() const override;
-
- void setUpdateInterval(int msec) override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-private:
- Error lastError = QGeoPositionInfoSource::NoError;
-};
-
-DummyPluginSource::DummyPluginSource(const QVariantMap &parameters, QObject *parent)
- : QGeoPositionInfoSource(parent)
-{
- Q_UNUSED(parameters)
-}
-
-QGeoPositionInfoSource::Error DummyPluginSource::error() const
-{
- return lastError;
-}
-
-void DummyPluginSource::setUpdateInterval(int msec)
-{
- if (msec < minimumUpdateInterval())
- msec = minimumUpdateInterval();
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-}
-
-int DummyPluginSource::minimumUpdateInterval() const
-{
- return 100;
-}
-
-QGeoPositionInfo
-DummyPluginSource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
- return QGeoPositionInfo();
-}
-
-QGeoPositionInfoSource::PositioningMethods DummyPluginSource::supportedPositioningMethods() const
-{
- return QGeoPositionInfoSource::NonSatellitePositioningMethods;
-}
-
-void DummyPluginSource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
-}
-
-void DummyPluginSource::stopUpdates() { }
-
-void DummyPluginSource::requestUpdate(int timeout)
-{
- lastError = QGeoPositionInfoSource::NoError;
- if (timeout < minimumUpdateInterval()) {
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(lastError);
- }
-}
-
-DummyPluginSource::~DummyPluginSource() { }
-
-class DummyPluginForTestsFactory : 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;
-};
-
-QGeoPositionInfoSource *
-DummyPluginForTestsFactory::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- return new DummyPluginSource(parameters, parent);
-}
-
-QGeoSatelliteInfoSource *
-DummyPluginForTestsFactory::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-QGeoAreaMonitorSource *DummyPluginForTestsFactory::areaMonitor(QObject *parent,
- const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-#include "plugin.moc"
diff --git a/tests/auto/dummypositionplugin/plugin.json b/tests/auto/dummypositionplugin/plugin.json
deleted file mode 100644
index 61f2657b..00000000
--- a/tests/auto/dummypositionplugin/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["dummy.source"],
- "Provider": "dummy.source",
- "Position": true,
- "Satellite": false,
- "Monitor": false,
- "Priority": 1,
- "Testable": true
-}
diff --git a/tests/auto/positionplugin/CMakeLists.txt b/tests/auto/positionplugin/CMakeLists.txt
deleted file mode 100644
index 7e1f2ed8..00000000
--- a/tests/auto/positionplugin/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated from positionplugin.pro.
-
-#####################################################################
-## QGeoPositionInfoSourceFactoryTest Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGeoPositionInfoSourceFactoryTestPlugin
- OUTPUT_NAME qtposition_testplugin
- CLASS_NAME QGeoPositionInfoSourceFactoryTest
- PLUGIN_TYPE position
- DEFAULT_IF FALSE
- SOURCES
- plugin.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionplugin.pro:<TRUE>:
-# OTHER_FILES = "plugin.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/tests/auto/positionplugin/plugin.cpp b/tests/auto/positionplugin/plugin.cpp
deleted file mode 100644
index 32dc3dee..00000000
--- a/tests/auto/positionplugin/plugin.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeopositioninfosourcefactory.h>
-#include <QObject>
-#include <QtPlugin>
-#include <QTimer>
-
-QT_USE_NAMESPACE
-
-class DummySourcePrivate;
-class DummySource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummySource(const QVariantMap &parameters, QObject *parent=0);
- ~DummySource();
-
- void startUpdates() override;
- void stopUpdates() override;
- void requestUpdate(int timeout = 5000) override;
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const override;
- PositioningMethods supportedPositioningMethods() const override;
-
- 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;
-
-private:
- QTimer *timer;
- QTimer *timeoutTimer;
- QTimer *singleTimer;
- QGeoPositionInfo lastPosition;
- QDateTime lastUpdateTime;
- Error lastError = QGeoPositionInfoSource::NoError;
- qreal altitude = 0.0;
-
-private slots:
- void updatePosition();
- void doTimeout();
-};
-
-DummySource::DummySource(const QVariantMap &parameters, QObject *parent) :
- QGeoPositionInfoSource(parent),
- timer(new QTimer(this)),
- timeoutTimer(new QTimer(this)),
- singleTimer(new QTimer(this)),
- lastPosition(QGeoCoordinate(0,0), QDateTime::currentDateTime())
-{
- if (parameters.contains(QStringLiteral("test.source.altitude"))) {
- const qreal alti = parameters.value(QStringLiteral("test.source.altitude")).toReal();
- altitude = alti;
- QGeoCoordinate crd = lastPosition.coordinate();
- crd.setAltitude(alti);
- lastPosition.setCoordinate(crd);
- }
- timer->setInterval(200);
- connect(timer, SIGNAL(timeout()),
- this, SLOT(updatePosition()));
- connect(singleTimer, SIGNAL(timeout()),
- this, SLOT(updatePosition()));
- connect(timeoutTimer, SIGNAL(timeout()),
- this, SLOT(doTimeout()));
-}
-
-QGeoPositionInfoSource::Error DummySource::error() const
-{
- return lastError;
-}
-
-bool DummySource::setBackendProperty(const QString &name, const QVariant &value)
-{
- if (name == QStringLiteral("altitude")) {
- altitude = value.toReal();
- return true;
- }
- return false;
-}
-
-QVariant DummySource::backendProperty(const QString &name) const
-{
- if (name == QStringLiteral("altitude"))
- return altitude;
- return QVariant();
-}
-
-
-void DummySource::setUpdateInterval(int msec)
-{
- const int minInterval = minimumUpdateInterval();
- if (msec == 0) {
- timer->setInterval(minInterval);
- } else if (msec < minInterval) {
- msec = minInterval;
- timer->setInterval(msec);
- } else {
- timer->setInterval(msec);
- }
-
- QGeoPositionInfoSource::setUpdateInterval(msec);
-}
-
-int DummySource::minimumUpdateInterval() const
-{
- return 200;
-}
-
-QGeoPositionInfo DummySource::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_UNUSED(fromSatellitePositioningMethodsOnly);
- return lastPosition;
-}
-
-QGeoPositionInfoSource::PositioningMethods DummySource::supportedPositioningMethods() const
-{
- return QGeoPositionInfoSource::AllPositioningMethods;
-}
-
-void DummySource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
- timer->start();
-}
-
-void DummySource::stopUpdates()
-{
- timer->stop();
-}
-
-void DummySource::requestUpdate(int timeout)
-{
- lastError = QGeoPositionInfoSource::NoError;
- if (timeout == 0)
- timeout = 5000;
- if (timeout < 0)
- timeout = 0;
-
- timeoutTimer->setInterval(timeout);
- timeoutTimer->start();
-
- if (timer->isActive()) {
- timer->stop();
- timer->start();
- }
-
- singleTimer->setInterval(minimumUpdateInterval());
- singleTimer->start();
-}
-
-DummySource::~DummySource()
-{}
-
-void DummySource::updatePosition()
-{
- timeoutTimer->stop();
- singleTimer->stop();
-
- const QDateTime now = QDateTime::currentDateTime();
-
- QGeoCoordinate coord(lastPosition.coordinate().latitude() + 0.1,
- lastPosition.coordinate().longitude() + 0.1,
- altitude);
-
- QGeoPositionInfo info(coord, now);
- info.setAttribute(QGeoPositionInfo::Direction, lastPosition.coordinate().azimuthTo(coord));
- if (lastUpdateTime.isValid()) {
- double speed = lastPosition.coordinate().distanceTo(coord) / lastUpdateTime.msecsTo(now);
- info.setAttribute(QGeoPositionInfo::GroundSpeed, 1000 * speed);
- }
-
- lastUpdateTime = now;
- lastPosition = info;
- emit positionUpdated(info);
-}
-
-void DummySource::doTimeout()
-{
- timeoutTimer->stop();
- singleTimer->stop();
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit QGeoPositionInfoSource::errorOccurred(lastError);
-}
-
-
-class QGeoPositionInfoSourceFactoryTest : 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;
-};
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryTest::positionInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- return new DummySource(parameters, parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryTest::satelliteInfoSource(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryTest::areaMonitor(QObject *parent, const QVariantMap &parameters)
-{
- Q_UNUSED(parent);
- Q_UNUSED(parameters);
- return nullptr;
-}
-
-#include "plugin.moc"
diff --git a/tests/auto/positionplugin/plugin.json b/tests/auto/positionplugin/plugin.json
deleted file mode 100644
index 4e7df0e4..00000000
--- a/tests/auto/positionplugin/plugin.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Keys": ["test.source"],
- "Provider": "test.source",
- "Position": true,
- "Satellite": false,
- "Monitor": false,
- "Priority": 2,
- "Testable": true
-}
diff --git a/tests/auto/positionplugin/positionplugin.pro b/tests/auto/positionplugin/positionplugin.pro
deleted file mode 100644
index 84d08ac0..00000000
--- a/tests/auto/positionplugin/positionplugin.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET = qtposition_testplugin
-QT += positioning-private
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryTest
-PLUGIN_EXTENDS = -
-load(qt_plugin)
-
-SOURCES += plugin.cpp
-
-OTHER_FILES += \
- plugin.json
diff --git a/tests/auto/positionplugintest/CMakeLists.txt b/tests/auto/positionplugintest/CMakeLists.txt
deleted file mode 100644
index 619c471f..00000000
--- a/tests/auto/positionplugintest/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from positionplugintest.pro.
-
-#####################################################################
-## tst_positionplugin Test:
-#####################################################################
-
-qt_internal_add_test(tst_positionplugin
- SOURCES
- tst_positionplugin.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:positionplugintest.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/positionplugintest/positionplugintest.pro b/tests/auto/positionplugintest/positionplugintest.pro
deleted file mode 100644
index 4602be7f..00000000
--- a/tests/auto/positionplugintest/positionplugintest.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_positionplugin
-
-SOURCES += tst_positionplugin.cpp
-
-CONFIG -= app_bundle
-
-QT += positioning testlib
diff --git a/tests/auto/positionplugintest/tst_positionplugin.cpp b/tests/auto/positionplugintest/tst_positionplugin.cpp
deleted file mode 100644
index 4afcd662..00000000
--- a/tests/auto/positionplugintest/tst_positionplugin.cpp
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtTest/QtTest>
-#include <QSignalSpy>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeosatelliteinfosource.h>
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include <QtPositioning/qgeocoordinate.h>
-
-QT_USE_NAMESPACE
-
-class tst_PositionPlugin : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
-
- void availableSources();
- void create();
- void getUpdates();
-};
-
-void tst_PositionPlugin::initTestCase()
-{
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-void tst_PositionPlugin::availableSources()
-{
- QVERIFY(QGeoPositionInfoSource::availableSources().contains("test.source"));
- QVERIFY(!QGeoSatelliteInfoSource::availableSources().contains("test.source"));
- QVERIFY(!QGeoAreaMonitorSource::availableSources().contains("test.source"));
-}
-
-void tst_PositionPlugin::create()
-{
- std::unique_ptr<QGeoPositionInfoSource> src = nullptr;
- src.reset(QGeoPositionInfoSource::createSource("test.source", 0));
- QVERIFY(src != nullptr);
-
- QVERIFY(src->minimumUpdateInterval() == 200);
-
- src.reset(QGeoPositionInfoSource::createSource("invalid source that will never exist", 0));
- QVERIFY(src == 0);
-
- std::unique_ptr<QGeoSatelliteInfoSource> ssrc = nullptr;
- ssrc.reset(QGeoSatelliteInfoSource::createSource("test.source", 0));
- QVERIFY(ssrc == nullptr);
-}
-
-void tst_PositionPlugin::getUpdates()
-{
- std::unique_ptr<QGeoPositionInfoSource> src(QGeoPositionInfoSource::createSource("test.source", 0));
- src->setUpdateInterval(200);
-
- QSignalSpy spy(src.get(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- src->startUpdates();
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 5000);
- QCOMPARE(spy[0].size(), 1);
-
- QGeoPositionInfo info = qvariant_cast<QGeoPositionInfo>(spy[0][0]);
- QCOMPARE(info.coordinate().latitude(), 0.1);
- QCOMPARE(info.coordinate().longitude(), 0.1);
-}
-
-
-
-QTEST_GUILESS_MAIN(tst_PositionPlugin)
-#include "tst_positionplugin.moc"
diff --git a/tests/auto/qdeclarativegeolocation/CMakeLists.txt b/tests/auto/qdeclarativegeolocation/CMakeLists.txt
deleted file mode 100644
index ebf65896..00000000
--- a/tests/auto/qdeclarativegeolocation/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-qt_internal_add_test(tst_qdeclarativegeolocation
- SOURCES
- tst_qdeclarativegeolocation.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp b/tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp
deleted file mode 100644
index e6818209..00000000
--- a/tests/auto/qdeclarativegeolocation/tst_qdeclarativegeolocation.cpp
+++ /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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioningQuick/private/qdeclarativegeolocation_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_DeclarativeGeoLocation : public QObject
-{
- Q_OBJECT
-
-private slots:
- void locationProperty();
- void addressBinding();
- void coordinateBinding();
- void shapeBinding();
- void attributesBinding();
-};
-
-void tst_DeclarativeGeoLocation::locationProperty()
-{
- // This test calls setLocation() with different preconditions, providing
- // coverage for different branches of the setLocation() method.
-
- QGeoAddress addr;
- addr.setCountryCode("DEU");
- addr.setCountry("Germany");
- addr.setCity("Berlin");
- addr.setStreet("Erich-Thilo-Str");
- addr.setStreetNumber("10");
- addr.setPostalCode("12489");
-
- const QGeoCoordinate c(52.43, 13.53);
-
- const QVariantMap attrs { { "string_proprty", "value" }, { "int_property", 5 } };
-
- QGeoLocation loc1;
- loc1.setAddress(addr);
- loc1.setCoordinate(c);
- loc1.setBoundingShape(QGeoCircle(c, 100));
- loc1.setExtendedAttributes(attrs);
-
- QDeclarativeGeoLocation location;
- qsizetype addrChangedCount = 0;
- qsizetype coordChangedCount = 0;
- qsizetype shapeChangedCount = 0;
- qsizetype attrChangedCount = 0;
-
- auto addrChangedHandler = location.bindableAddress().onValueChanged(
- [&addrChangedCount]() { ++addrChangedCount; });
- Q_UNUSED(addrChangedHandler)
- auto coordChangedHandler = location.bindableCoordinate().onValueChanged(
- [&coordChangedCount]() { ++coordChangedCount; });
- Q_UNUSED(coordChangedHandler)
- auto shapeChangedHandler = location.bindableBoundingShape().onValueChanged(
- [&shapeChangedCount]() { ++shapeChangedCount; });
- Q_UNUSED(shapeChangedHandler)
- auto attrChangedHandler = location.bindableExtendedAttributes().onValueChanged(
- [&attrChangedCount]() { ++attrChangedCount; });
- Q_UNUSED(attrChangedHandler)
-
- // By default an empty m_address is created in the default constructor.
- // So m_address contains a valid pointer, m_address->parent() == this.
- location.setLocation(loc1);
- QCOMPARE(addrChangedCount, 0); // the pointer didn't change
- QCOMPARE(coordChangedCount, 1);
- QCOMPARE(shapeChangedCount, 1);
- QCOMPARE(attrChangedCount, 1);
- QCOMPARE(location.location(), loc1);
- QCOMPARE(location.address()->parent(), &location);
-
- // m_address contains a nullptr
- location.setAddress(nullptr);
- QVERIFY(!location.address());
- addrChangedCount = 0;
- coordChangedCount = 0;
- shapeChangedCount = 0;
- attrChangedCount = 0;
-
- location.setLocation(loc1);
- QCOMPARE(addrChangedCount, 1); // only the pointer has changed
- QCOMPARE(coordChangedCount, 0);
- QCOMPARE(shapeChangedCount, 0);
- QCOMPARE(attrChangedCount, 0);
- QCOMPARE(location.location(), loc1);
- QCOMPARE(location.address()->parent(), &location);
-
- // m_address contains a valid pointer, m_address->parent() != this
- QGeoAddress addr1;
- addr1.setCountryCode("USA");
- addr1.setCountry("United States");
- addr1.setPostalCode("8900");
- addr1.setState("Oregon");
- addr1.setCity("Springfield");
- addr1.setDistrict("Pressboard Estates");
- addr1.setStreet("Evergreen Tce");
- addr1.setStreetNumber("742");
-
- QDeclarativeGeoAddress geoAddr(addr1);
-
- location.setAddress(&geoAddr);
- QVERIFY(location.address());
- QCOMPARE(location.address()->parent(), nullptr);
- addrChangedCount = 0;
-
- location.setLocation(loc1);
- QCOMPARE(addrChangedCount, 1); // only the pointer has changed
- QCOMPARE(coordChangedCount, 0);
- QCOMPARE(shapeChangedCount, 0);
- QCOMPARE(attrChangedCount, 0);
- QCOMPARE(location.location(), loc1);
- QCOMPARE(location.address()->parent(), &location);
-}
-
-void tst_DeclarativeGeoLocation::addressBinding()
-{
- QDeclarativeGeoLocation location;
- QDeclarativeGeoAddress addr1;
- QDeclarativeGeoAddress addr2;
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QDeclarativeGeoAddress *>(
- location, &addr1, &addr2, "address");
-}
-
-void tst_DeclarativeGeoLocation::coordinateBinding()
-{
- QDeclarativeGeoLocation location;
- const QGeoCoordinate c1(2.0, 1.0);
- const QGeoCoordinate c2(1.0, 2.0);
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QGeoCoordinate>(
- location, c1, c2, "coordinate");
-}
-
-void tst_DeclarativeGeoLocation::shapeBinding()
-{
- QDeclarativeGeoLocation location;
- const QGeoCircle circle(QGeoCoordinate(2.0, 1.0), 10);
- const QGeoRectangle rectangle(QGeoCoordinate(2.0, 1.0), QGeoCoordinate(1.0, 2.0));
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QGeoShape>(
- location, circle, rectangle, "boundingShape");
-}
-
-void tst_DeclarativeGeoLocation::attributesBinding()
-{
- QDeclarativeGeoLocation location;
- const QVariantMap m1 { { "string_proprty", "value" }, { "int_property", 5 } };
- const QVariantMap m2 { { "int_property", 10 }, { "double_property", 15.5 } };
- QTestPrivate::testReadWritePropertyBasics<QDeclarativeGeoLocation, QVariantMap>(
- location, m1, m2, "extendedAttributes");
-}
-
-QTEST_APPLESS_MAIN(tst_DeclarativeGeoLocation)
-
-#include "tst_qdeclarativegeolocation.moc"
diff --git a/tests/auto/qdeclarativeposition/CMakeLists.txt b/tests/auto/qdeclarativeposition/CMakeLists.txt
deleted file mode 100644
index f5c132c2..00000000
--- a/tests/auto/qdeclarativeposition/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-qt_internal_add_test(tst_qdeclarativeposition
- SOURCES
- tst_qdeclarativeposition.cpp
- LIBRARIES
- Qt::Core
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp b/tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp
deleted file mode 100644
index 2e396475..00000000
--- a/tests/auto/qdeclarativeposition/tst_qdeclarativeposition.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioningQuick/private/qdeclarativeposition_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_QDeclarativePosition : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void init();
-
- void latitudeValidBinding();
- void longitudeValidBinding();
- void altitudeValidBinding();
- void coordinateBinding();
- void timestampBinding();
- void speedBinding();
- void speedValidBinding();
- void horizontalAccuracyValidBinding();
- void horizontalAccuracyBinding();
- void verticalAccuracyValidBinding();
- void verticalAccuracyBinding();
- void directionValidBinding();
- void directionBinding();
- void verticalSpeedValidBinding();
- void verticalSpeedBinding();
- void magneticVariationValidBinding();
- void magneticVariationBinding();
-
-private:
- QDeclarativePosition m_declarativePosition;
- QGeoPositionInfo m_positionInfo;
- std::function<void()> m_mutatorFunc = nullptr;
- std::function<bool(const double &, const double &)> m_doubleComparator = nullptr;
-};
-
-void tst_QDeclarativePosition::initTestCase()
-{
- m_mutatorFunc = [&]() { m_declarativePosition.setPosition(m_positionInfo); };
- m_doubleComparator = [](const double &lhs, const double &rhs) {
- return (qIsNaN(lhs) && qIsNaN(rhs)) || qFuzzyCompare(lhs, rhs);
- };
-}
-
-void tst_QDeclarativePosition::init()
-{
- // reset position before each test
- m_declarativePosition.setPosition(QGeoPositionInfo());
-}
-
-void tst_QDeclarativePosition::latitudeValidBinding()
-{
- QCOMPARE(m_declarativePosition.isLatitudeValid(), false);
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "latitudeValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::longitudeValidBinding()
-{
- QCOMPARE(m_declarativePosition.isLongitudeValid(), false);
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "longitudeValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::altitudeValidBinding()
-{
- QCOMPARE(m_declarativePosition.isAltitudeValid(), false);
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0, 3.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "altitudeValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::coordinateBinding()
-{
- QCOMPARE(m_declarativePosition.coordinate(), QGeoCoordinate());
- m_positionInfo.setCoordinate(QGeoCoordinate(1.0, 2.0, 3.0));
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, QGeoCoordinate>(
- m_declarativePosition, QGeoCoordinate(), QGeoCoordinate(1.0, 2.0, 3.0), "coordinate",
- m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::timestampBinding()
-{
- QCOMPARE(m_declarativePosition.timestamp(), QDateTime());
- const auto timestamp = QDateTime::currentDateTimeUtc();
- m_positionInfo.setTimestamp(timestamp);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, QDateTime>(
- m_declarativePosition, QDateTime(), timestamp, "timestamp", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::speedBinding()
-{
- QCOMPARE(m_declarativePosition.speed(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::GroundSpeed, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "speed", m_mutatorFunc, m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::speedValidBinding()
-{
- QCOMPARE(m_declarativePosition.isSpeedValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::GroundSpeed, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "speedValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::horizontalAccuracyValidBinding()
-{
- QCOMPARE(m_declarativePosition.isHorizontalAccuracyValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "horizontalAccuracyValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::horizontalAccuracyBinding()
-{
- QCOMPARE(m_declarativePosition.horizontalAccuracy(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "horizontalAccuracy", m_mutatorFunc,
- m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::verticalAccuracyValidBinding()
-{
- QCOMPARE(m_declarativePosition.isVerticalAccuracyValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "verticalAccuracyValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::verticalAccuracyBinding()
-{
- QCOMPARE(m_declarativePosition.verticalAccuracy(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "verticalAccuracy", m_mutatorFunc,
- m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::directionValidBinding()
-{
- QCOMPARE(m_declarativePosition.isDirectionValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::Direction, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "directionValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::directionBinding()
-{
- QCOMPARE(m_declarativePosition.direction(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::Direction, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "direction", m_mutatorFunc, m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::verticalSpeedValidBinding()
-{
- QCOMPARE(m_declarativePosition.isVerticalSpeedValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "verticalSpeedValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::verticalSpeedBinding()
-{
- QCOMPARE(m_declarativePosition.verticalSpeed(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "verticalSpeed", m_mutatorFunc,
- m_doubleComparator);
-}
-
-void tst_QDeclarativePosition::magneticVariationValidBinding()
-{
- QCOMPARE(m_declarativePosition.isMagneticVariationValid(), false);
- m_positionInfo.setAttribute(QGeoPositionInfo::MagneticVariation, 1.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, bool>(
- m_declarativePosition, false, true, "magneticVariationValid", m_mutatorFunc);
-}
-
-void tst_QDeclarativePosition::magneticVariationBinding()
-{
- QCOMPARE(m_declarativePosition.magneticVariation(), qQNaN());
- m_positionInfo.setAttribute(QGeoPositionInfo::MagneticVariation, 10.0);
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePosition, double>(
- m_declarativePosition, qQNaN(), 10.0, "magneticVariation", m_mutatorFunc,
- m_doubleComparator);
-}
-
-QTEST_GUILESS_MAIN(tst_QDeclarativePosition)
-#include "tst_qdeclarativeposition.moc"
diff --git a/tests/auto/qdeclarativepositionsource/CMakeLists.txt b/tests/auto/qdeclarativepositionsource/CMakeLists.txt
deleted file mode 100644
index 8d1d4653..00000000
--- a/tests/auto/qdeclarativepositionsource/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-qt_internal_add_test(tst_qdeclarativepositionsource
- SOURCES
- tst_qdeclarativepositionsource.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp b/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp
deleted file mode 100644
index cd556ab4..00000000
--- a/tests/auto/qdeclarativepositionsource/tst_qdeclarativepositionsource.cpp
+++ /dev/null
@@ -1,533 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioningQuick/private/qdeclarativepositionsource_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_DeclarativePositionSource : public QObject
-{
- Q_OBJECT
-
-private slots:
- void init();
-
- void nameBinding();
- void supportedMethodsBinding();
- void sourceErrorBinding();
- void validBinding();
- void positionBinding();
- void activeBinding();
- void startBreaksActiveBinding();
- void activeBindingBreak();
-
- void intervalOnSourceDependency();
- void preferredMethodsOnSourceDependency();
-
- void updateAfterStart();
- void startAfterUpdate();
- void stopAfterUpdate();
- void startStopAfterUpdate();
- void updateTimedOut();
- void updateWithStartTimedOut();
- void startUpdateStopWithNoIntervals();
-
-private:
- std::unique_ptr<QDeclarativePositionSource> m_positionSource = nullptr;
-};
-
-void tst_DeclarativePositionSource::init()
-{
- // create a fresh instance of QDeclarativePositionSource before each test
- m_positionSource.reset(new QDeclarativePositionSource);
- m_positionSource->componentComplete(); // simulate QML loading
-}
-
-void tst_DeclarativePositionSource::nameBinding()
-{
- m_positionSource->setName("test.source");
- QTestPrivate::testReadWritePropertyBasics<QDeclarativePositionSource, QString>(
- *m_positionSource.get(), "invalid source", "test.source", "name");
-}
-
-void tst_DeclarativePositionSource::supportedMethodsBinding()
-{
- // Invalid source has no positioning methods.
- // "test.source" has all positioning methods.
- m_positionSource->setName("invalid name");
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource,
- QDeclarativePositionSource::PositioningMethods>(
- *m_positionSource.get(), QDeclarativePositionSource::NoPositioningMethods,
- QDeclarativePositionSource::AllPositioningMethods, "supportedPositioningMethods",
- [&]() { m_positionSource->setName("test.source"); });
-}
-
-void tst_DeclarativePositionSource::sourceErrorBinding()
-{
- // "dummy.source" has a minimum update interval of 100, and calling
- // update() with a smaller timeout immediately result in a timeout error
- m_positionSource->setName("dummy.source");
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource,
- QDeclarativePositionSource::SourceError>(
- *m_positionSource.get(), QDeclarativePositionSource::NoError,
- QDeclarativePositionSource::UpdateTimeoutError, "sourceError",
- [&]() { m_positionSource->update(10); });
- if (QTest::currentTestFailed())
- return;
-
- // Test that we can't bind sourceError to smth, as it's read-only
- QProperty<QDeclarativePositionSource::SourceError> errorSetter;
- m_positionSource->bindableSourceError().setBinding(Qt::makePropertyBinding(errorSetter));
- QCOMPARE(m_positionSource->bindableSourceError().hasBinding(), false);
-}
-
-void tst_DeclarativePositionSource::validBinding()
-{
- // Invalid source name results in no position source -> invalid object.
- // Setting the name to "test.source" results in creating a new position
- // source -> valid object
- m_positionSource->setName("invalid name");
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource, bool>(
- *m_positionSource.get(), false, true, "valid",
- [&]() { m_positionSource->setName("test.source"); });
-}
-
-static char *printPosition(const QDeclarativePosition *position)
-{
- // For this test we need to print only coordinate, so that we get a nice
- // error message if the below test fails.
- QString str;
- QDebug dbg(&str);
- dbg << position->coordinate();
- const auto dataArray = str.toLatin1();
- const auto msgSize = dataArray.size() + 1;
- char *msg = new char[msgSize];
- memset(msg, 0, msgSize);
- qsnprintf(msg, msgSize, "%s", dataArray.constData());
- return msg;
-}
-
-void tst_DeclarativePositionSource::positionBinding()
-{
- // "test.source" udpates its position, starting from (0, 0) coordinate, and
- // adding 0.1 lat and 0.1 log at every step
- m_positionSource->setName("test.source");
- m_positionSource->setUpdateInterval(200);
- const QGeoCoordinate c1(0, 0);
- const QGeoCoordinate c2(0.1, 0.1, 0);
- QCOMPARE(m_positionSource->position()->coordinate(), c1);
-
- QGeoPositionInfo posInfo;
- posInfo.setCoordinate(c1);
- QDeclarativePosition pos1;
- pos1.setPosition(posInfo);
-
- posInfo.setCoordinate(c2);
- QDeclarativePosition pos2;
- pos2.setPosition(posInfo);
-
- QTestPrivate::testReadOnlyPropertyBasics<QDeclarativePositionSource, QDeclarativePosition *>(
- *m_positionSource.get(), &pos1, &pos2, "position",
- [&]() {
- QSignalSpy spy(m_positionSource.get(),
- &QDeclarativePositionSource::positionChanged);
- m_positionSource->update();
- // Wait for the update to happen. It should take around 200 ms,
- // but we want to be on a safe side in case of high CI load.
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 5000);
- },
- [](const QDeclarativePosition *p1, const QDeclarativePosition *p2) {
- return p1->coordinate() == p2->coordinate();
- },
- printPosition);
- if (QTest::currentTestFailed())
- return;
-
- QProperty<QDeclarativePosition *> prop(nullptr);
- m_positionSource->bindablePosition().setBinding(Qt::makePropertyBinding(prop));
- // We can't have bindings on read-only properties
- QCOMPARE(m_positionSource->bindablePosition().hasBinding(), false);
-}
-
-void tst_DeclarativePositionSource::activeBinding()
-{
- // we can't use a common templated method to test active property, because
- // setActive() uses QTimer::singleShot() to actually update the property
- // state.
- m_positionSource->setName("test.source");
-
- QProperty<bool> activeObserver;
- activeObserver.setBinding(m_positionSource->bindableActive().makeBinding());
-
- QProperty<bool> activeLambdaObserver;
- activeLambdaObserver.setBinding([&]() { return m_positionSource->isActive(); });
-
- QSignalSpy activeSpy(m_positionSource.get(), &QDeclarativePositionSource::activeChanged);
-
- QCOMPARE(activeSpy.count(), 0);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- QProperty<bool> activeSetter(false);
- m_positionSource->bindableActive().setBinding(Qt::makePropertyBinding(activeSetter));
-
- activeSetter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(activeSpy.count(), 1);
- QCOMPARE(activeObserver.value(), true);
- QCOMPARE(activeLambdaObserver.value(), true);
-
- activeSetter = false;
-
- QCOMPARE(activeSpy.count(), 2);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- // calling update() does not break the binding
- m_positionSource->update(50);
- QCOMPARE(activeSpy.count(), 3);
- QCOMPARE(activeObserver.value(), true);
- QCOMPARE(activeLambdaObserver.value(), true);
-
- QTRY_COMPARE_WITH_TIMEOUT(m_positionSource->sourceError(),
- QDeclarativePositionSource::UpdateTimeoutError, 5000);
-
- QCOMPARE(activeSpy.count(), 4);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- activeSetter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(activeSpy.count(), 5);
- QCOMPARE(activeObserver.value(), true);
- QCOMPARE(activeLambdaObserver.value(), true);
-
- // calling stop() will break the binding
- m_positionSource->stop();
-
- QCOMPARE(activeSpy.count(), 6);
- QCOMPARE(m_positionSource->isActive(), false);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-
- activeSetter = false;
- activeSetter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- // nothing changed, as the binding is broken
- QCOMPARE(activeSpy.count(), 6);
- QCOMPARE(m_positionSource->isActive(), false);
- QCOMPARE(activeObserver.value(), false);
- QCOMPARE(activeLambdaObserver.value(), false);
-}
-
-void tst_DeclarativePositionSource::startBreaksActiveBinding()
-{
- m_positionSource->setName("test.source");
- QSignalSpy activeSpy(m_positionSource.get(), &QDeclarativePositionSource::activeChanged);
-
- QProperty<bool> activeSetter(true);
- m_positionSource->bindableActive().setBinding(Qt::makePropertyBinding(activeSetter));
-
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(m_positionSource->isActive(), true);
- QCOMPARE(activeSpy.count(), 1);
- QVERIFY(m_positionSource->bindableActive().hasBinding());
-
- // Call start() explicitly, which should break the binding for 'active'
- // property.
- m_positionSource->start();
- activeSetter = false; // this should have no effect
- QTest::qWait(0); // to trigger singleShot timer in setActive
-
- QCOMPARE(m_positionSource->isActive(), true);
- QCOMPARE(activeSpy.count(), 1);
- QVERIFY(!m_positionSource->bindableActive().hasBinding());
-}
-
-void tst_DeclarativePositionSource::activeBindingBreak()
-{
- // This test checks a tricky scenario of breaking the binding for
- // 'active' property.
- // 0. active has a binding to some property Prop.
- // 1. Prop is set to true => active = true => start getting position info.
- // 2. Calling update() for a single update => the binding of active is not
- // broken.
- // 3. Calling stop() explicitly before the update() call is finished =>
- // the active binding is supposed to be broken, but the active state
- // should still be true, because we have a pending update.
- // 4. The pending update finishes => the active is set to false.
-
- m_positionSource->setName("test.source");
-
- QProperty<bool> setter(false);
- m_positionSource->bindableActive().setBinding(Qt::makePropertyBinding(setter));
- QVERIFY(m_positionSource->bindableActive().hasBinding());
-
- setter = true;
- QTest::qWait(0); // to trigger singleShot timer in setActive
- QCOMPARE(m_positionSource->isActive(), true);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
-
- m_positionSource->stop();
- QVERIFY(!m_positionSource->bindableActive().hasBinding());
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
-
- QCOMPARE(m_positionSource->isActive(), false);
- QVERIFY(!m_positionSource->bindableActive().hasBinding());
-}
-
-void tst_DeclarativePositionSource::intervalOnSourceDependency()
-{
- // updateInterval can be modified if the new source does not support that
- // large one, or implements some calculation
- m_positionSource->setName("invalid_source"); // reset the source
-
- QSignalSpy intervalSpy(m_positionSource.get(),
- &QDeclarativePositionSource::updateIntervalChanged);
-
- m_positionSource->setUpdateInterval(100);
- QCOMPARE(m_positionSource->updateInterval(), 100);
- QCOMPARE(intervalSpy.count(), 1);
-
- // "test.source" has a minimum update interval of 200
- m_positionSource->setName("test.source");
- QCOMPARE(m_positionSource->updateInterval(), 200);
- QCOMPARE(intervalSpy.count(), 2);
-
- // "dummy.source" has a minimum update interval of 100, so we expect our
- // desired interval to be applied
- m_positionSource->setName("dummy.source");
- QCOMPARE(m_positionSource->updateInterval(), 100);
- QCOMPARE(intervalSpy.count(), 3);
-}
-
-void tst_DeclarativePositionSource::preferredMethodsOnSourceDependency()
-{
- m_positionSource->setName("invalid_source"); // reset the source
-
- QSignalSpy methodsSpy(m_positionSource.get(),
- &QDeclarativePositionSource::preferredPositioningMethodsChanged);
-
- m_positionSource->setPreferredPositioningMethods(
- QDeclarativePositionSource::SatellitePositioningMethods);
- QCOMPARE(m_positionSource->preferredPositioningMethods(),
- QDeclarativePositionSource::SatellitePositioningMethods);
- QCOMPARE(methodsSpy.count(), 1);
-
- // "dummy.source" has only non-satellite methods, so they will be used
- m_positionSource->setName("dummy.source");
- QCOMPARE(m_positionSource->preferredPositioningMethods(),
- QDeclarativePositionSource::NonSatellitePositioningMethods);
- QCOMPARE(methodsSpy.count(), 2);
-
- // "test.source" has all positioning methods, so satellite will be used,
- // as we initially wanted
- m_positionSource->setName("test.source");
- QCOMPARE(m_positionSource->preferredPositioningMethods(),
- QDeclarativePositionSource::SatellitePositioningMethods);
- QCOMPARE(methodsSpy.count(), 3);
-}
-
-void tst_DeclarativePositionSource::updateAfterStart()
-{
- // When update() is called after start(), it should not invalidate any
- // state. The active state must still be true when the single update() is
- // completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->start();
- QCOMPARE(m_positionSource->isActive(), true);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::startAfterUpdate()
-{
- // When start() is called after update(), the position source should remain
- // active even when the signle update is completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->start();
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::stopAfterUpdate()
-{
- // When stop() is called after update(), and the update() is still in
- // progress, the position source should remain active until the update()
- // is completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::startStopAfterUpdate()
-{
- // Quite artificial example. Calling start() and stop() after update(),
- // while still waiting for the update() to complete, should still result in
- // the position source to be active until the update() is completed.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->start();
- m_positionSource->stop();
-
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::updateTimedOut()
-{
- // This test checks that we reset to inactive state when the single update()
- // request times out without providing the position info
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->update(50); // too small timeout -> will return an error
- QCOMPARE(m_positionSource->isActive(), true);
-
- QTRY_COMPARE_WITH_TIMEOUT(m_positionSource->sourceError(),
- QDeclarativePositionSource::UpdateTimeoutError, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::updateWithStartTimedOut()
-{
- // This test checks that if single update() times out, but the regular
- // updates are running, we still remain in active state.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->start();
-
- m_positionSource->update(50); // too small timeout -> will return an error
- QCOMPARE(m_positionSource->isActive(), true);
-
- QTRY_COMPARE_WITH_TIMEOUT(m_positionSource->sourceError(),
- QDeclarativePositionSource::UpdateTimeoutError, 5000);
- QCOMPARE(m_positionSource->isActive(), true);
-
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-void tst_DeclarativePositionSource::startUpdateStopWithNoIntervals()
-{
- // This test checks that a sequence of calls start() -> update() -> stop()
- // without any waits between them will result in expected behavior.
- // Specifically, the position source should remain active until it gets
- // the position response.
-
- m_positionSource->setName("test.source");
-
- QCOMPARE(m_positionSource->isActive(), false);
-
- m_positionSource->start();
- QSignalSpy posSpy(m_positionSource.get(), &QDeclarativePositionSource::positionChanged);
- QSignalSpy errSpy(m_positionSource.get(), &QDeclarativePositionSource::sourceErrorChanged);
- m_positionSource->update(210);
- QCOMPARE(m_positionSource->isActive(), true);
- m_positionSource->stop();
- QCOMPARE(m_positionSource->isActive(), true);
-
- // Wait for the single update to complete. It can be either position update
- // or timeout.
- QTRY_VERIFY_WITH_TIMEOUT(posSpy.count() > 0 || errSpy.count() > 0, 5000);
- QCOMPARE(m_positionSource->isActive(), false);
-}
-
-QTEST_MAIN(tst_DeclarativePositionSource)
-
-#include "tst_qdeclarativepositionsource.moc"
diff --git a/tests/auto/qgeoaddress/CMakeLists.txt b/tests/auto/qgeoaddress/CMakeLists.txt
deleted file mode 100644
index 48969d5f..00000000
--- a/tests/auto/qgeoaddress/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeoaddress.pro.
-
-#####################################################################
-## tst_qgeoaddress Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeoaddress
- SOURCES
- tst_qgeoaddress.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeoaddress.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeoaddress/qgeoaddress.pro b/tests/auto/qgeoaddress/qgeoaddress.pro
deleted file mode 100644
index e12b9e18..00000000
--- a/tests/auto/qgeoaddress/qgeoaddress.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeoaddress
-
-SOURCES += tst_qgeoaddress.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeoaddress/tst_qgeoaddress.cpp b/tests/auto/qgeoaddress/tst_qgeoaddress.cpp
deleted file mode 100644
index 0dd06e97..00000000
--- a/tests/auto/qgeoaddress/tst_qgeoaddress.cpp
+++ /dev/null
@@ -1,647 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QString>
-#include <QtTest/QtTest>
-
-#include <QtPositioning/qgeoaddress.h>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoAddress : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QGeoAddress();
-
-private Q_SLOTS:
- void constructorTest();
- void moveConstructTest();
- void moveAssignTest();
- void textTest();
- void cityTest();
- void countryCodeTest();
- void countryTest();
- void countyTest();
- void districtTest();
- void postalCodeTest();
- void stateTest();
- void streetTest();
- void streetNumberTest();
- void generatedText();
- void generatedText_data();
- void operatorsTest();
- void emptyClearTest();
- void hashingTest();
- void hashingTest_data();
-};
-
-tst_QGeoAddress::tst_QGeoAddress()
-{
-}
-
-void tst_QGeoAddress::constructorTest()
-{
- QGeoAddress testObj;
-
- testObj.setStreet("testId");
- auto testObjPtr = std::make_unique<QGeoAddress>(testObj);
- QVERIFY2(testObjPtr != NULL, "Copy constructor - null");
- QVERIFY2(*testObjPtr == testObj, "Copy constructor - compare");
-}
-
-void tst_QGeoAddress::moveConstructTest()
-{
- QGeoAddress address;
- address.setCountry("country");
- address.setCity("city");
- address.setPostalCode("postcode");
- address.setStreet("street");
- address.setStreetNumber("number");
-
- const QGeoAddress addressCopy = address;
- QCOMPARE(QGeoAddress(std::move(address)), addressCopy);
-}
-
-void tst_QGeoAddress::moveAssignTest()
-{
- QGeoAddress address;
- address.setCountry("country");
- address.setCity("city");
- address.setPostalCode("postcode");
- address.setStreet("street");
- address.setStreetNumber("number");
-
- QGeoAddress addressCopy = address;
-
- QGeoAddress otherAddress;
- otherAddress = std::move(address);
- QCOMPARE(otherAddress, addressCopy);
-
- // Check that (move)assigning to a moved-from object is fine
- address = std::move(addressCopy);
- QCOMPARE(address, otherAddress);
-}
-
-void tst_QGeoAddress::textTest()
-{
- QGeoAddress address;
- QVERIFY(address.text().isEmpty());
- address.setText(QStringLiteral("123 Fake Street\nSpringfield"));
- QCOMPARE(address.text(), QStringLiteral("123 Fake Street\nSpringfield"));
-}
-
-void tst_QGeoAddress::cityTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.city() == QString(), "Wrong default value");
- testObj.setCity("testText");
- QVERIFY2(testObj.city() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::countryCodeTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.countryCode() == QString(), "Wrong default value");
- testObj.setCountryCode("testText");
- QVERIFY2(testObj.countryCode() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::countryTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.country() == QString(), "Wrong default value");
- testObj.setCountry("testText");
- QVERIFY2(testObj.country() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::countyTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.county() == QString(), "Wrong default value");
- testObj.setCounty("testText");
- QVERIFY2(testObj.county() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::districtTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.district() == QString(), "Wrong default value");
- testObj.setDistrict("testText");
- QVERIFY2(testObj.district() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::postalCodeTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.postalCode() == QString(), "Wrong default value");
- testObj.setPostalCode("testText");
- QVERIFY2(testObj.postalCode() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::stateTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.state() == QString(), "Wrong default value");
- testObj.setState("testText");
- QVERIFY2(testObj.state() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::streetTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.street() == QString(), "Wrong default value");
- testObj.setStreet("testText");
- QVERIFY2(testObj.street() == "testText", "Wrong value returned");
-}
-
-void tst_QGeoAddress::streetNumberTest()
-{
- QGeoAddress testObj;
- QVERIFY2(testObj.streetNumber() == QString(), "Wrong default value");
- const auto streetNumber = QStringLiteral("some street number");
- testObj.setStreetNumber(streetNumber);
- QVERIFY2(testObj.streetNumber() == streetNumber, "Wrong value returned");
-}
-
-void tst_QGeoAddress::generatedText()
-{
- QFETCH(QString, countryCode);
- QFETCH(QString, expectedPostalCodeOnly);
- QFETCH(QString, expectedFullAddress);
-
- QGeoAddress streetOnly;
- streetOnly.setStreet("street");
- streetOnly.setCountryCode(countryCode);
-
- QCOMPARE(streetOnly.text(), QStringLiteral("street"));
-
- QGeoAddress cityOnly;
- cityOnly.setCity("city");
- cityOnly.setCountryCode(countryCode);
- if (countryCode == QLatin1String("CYM") || countryCode == QLatin1String("IRL"))
- QCOMPARE(cityOnly.text(), QString());
- else
- QCOMPARE(cityOnly.text(), QStringLiteral("city"));
-
- QGeoAddress postalCodeOnly;
- postalCodeOnly.setPostalCode("postcode");
- postalCodeOnly.setCountryCode(countryCode);
- QCOMPARE(postalCodeOnly.text(), expectedPostalCodeOnly);
-
- QGeoAddress fullAddress;
- fullAddress.setStreet("street");
- fullAddress.setStreetNumber("number");
- fullAddress.setDistrict("district");
- fullAddress.setPostalCode("postcode");
- fullAddress.setCity("city");
- fullAddress.setState("state");
- fullAddress.setCountry("country");
- fullAddress.setCountryCode(countryCode);
-
- QCOMPARE(fullAddress.text(), expectedFullAddress);
-}
-
-void tst_QGeoAddress::generatedText_data()
-{
- QTest::addColumn<QString>("countryCode");
- QTest::addColumn<QString>("expectedPostalCodeOnly");
- QTest::addColumn<QString>("expectedFullAddress");
-
- QTest::newRow("Albania") << QString::fromLatin1("ALB")
- << QString::fromLatin1("postcode") /* postal code only */
- << QString::fromLatin1("street number<br/>" /* full address */
- "postcode, city<br/>"
- "country");
-
- QTest::newRow("Andorra") << QString::fromLatin1("AND")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("United Arab Emirates") << QString::fromLatin1("ARE")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district city<br/>"
- "country");
- QTest::newRow("Australia") << QString::fromLatin1("AUS")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district state postcode<br/>"
- "country");
- QTest::newRow("Austria") << QString::fromLatin1("AUT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Bahamas") << QString::fromLatin1("BHS")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district city<br/>"
- "country");
- QTest::newRow("Bahrain") << QString::fromLatin1("BHR")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district, city, state<br/>"
- "country");
- QTest::newRow("Brazil") << QString::fromLatin1("BRA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "district city-state postcode<br/>"
- "country");
- QTest::newRow("Brunei Darussalam") << QString::fromLatin1("BRN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Canada") << QString::fromLatin1("CAN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city, state postcode<br/>"
- "country");
- QTest::newRow("China") << QString::fromLatin1("CHN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number, city<br/>"
- "postcode state<br/>"
- "country");
- QTest::newRow("Chile") << QString::fromLatin1("CHL")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode district, city, state<br/>"
- "country");
- QTest::newRow("Cayman Islands") << QString::fromLatin1("CYM")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "state postcode<br/>"
- "country");
- QTest::newRow("France") << QString::fromLatin1("FRA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
-
- QTest::newRow("United Kingdom") << QString::fromLatin1("GBR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district, city, postcode<br/>"
- "country");
- QTest::newRow("Gibraltar") << QString::fromLatin1("GIB")
- << QString()
- << QString::fromLatin1("number street<br/>"
- "city<br/>"
- "country");
- QTest::newRow("Guadeloupe") << QString::fromLatin1("GLP")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("French Guiana") << QString::fromLatin1("GUF")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Hong Kong") << QString::fromLatin1("HKG")
- << QString()
- << QString::fromLatin1("number street<br/>"
- "district<br/>"
- "city");
- QTest::newRow("India") << QString::fromLatin1("IND")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city postcode state<br/>"
- "country");
- QTest::newRow("Indonesia") << QString::fromLatin1("IDN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city, postcode<br/>"
- "country");
- QTest::newRow("Ireland") << QString::fromLatin1("IRL")
- << QString()
- << QString::fromLatin1("number street<br/>"
- "district, state<br/>"
- "country");
- QTest::newRow("Italy") << QString::fromLatin1("ITA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Jersey") << QString::fromLatin1("JEY")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city, postcode<br/>"
- "country");
- QTest::newRow("Jordan") << QString::fromLatin1("JOR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Kuwait") << QString::fromLatin1("KWT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode, district, city<br/>"
- "country");
- QTest::newRow("Latvia") << QString::fromLatin1("LVA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city, postcode<br/>"
- "country");
- QTest::newRow("Lebanon") << QString::fromLatin1("LBN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Luxembourg") << QString::fromLatin1("LUX")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Malta") << QString::fromLatin1("MLT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("Monaco") << QString::fromLatin1("MCO")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Mexico") << QString::fromLatin1("MEX")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "district<br/>"
- "postcode city, state<br/>"
- "country");
- QTest::newRow("Martinique") << QString::fromLatin1("MTQ")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode, city<br/>"
- "country");
- QTest::newRow("Malaysia") << QString::fromLatin1("MYS")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "state<br/>"
- "country");
- QTest::newRow("New Zealand") << QString::fromLatin1("NZL")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district city postcode<br/>"
- "country");
- QTest::newRow("Oman") << QString::fromLatin1("OMN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "district, postcode, city, country");
- QTest::newRow("Puerto Rico") << QString::fromLatin1("PRI")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "district, city, state, postcode<br/>"
- "country");
- QTest::newRow("Qatar") << QString::fromLatin1("QAT")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district city, country");
- QTest::newRow("Reunion") << QString::fromLatin1("REU")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Russian Federation") << QString::fromLatin1("RUS")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Saudi Arabia") << QString::fromLatin1("SAU")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street district<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("Singapore") << QString::fromLatin1("SGP")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("Marino") << QString::fromLatin1("SMR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Taiwan") << QString::fromLatin1("TWN")
- << QString()
- << QString::fromLatin1("street number, district, city<br/>"
- "country");
- QTest::newRow("Thailand") << QString::fromLatin1("THA")
- << QString("postcode")
- << QString::fromLatin1("street number<br/>"
- "district, city postcode<br/>"
- "country");
- QTest::newRow("Turkey") << QString::fromLatin1("TUR")
- << QString("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode district, city<br/>"
- "country");
- QTest::newRow("Ukraine") << QString::fromLatin1("UKR")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city postcode<br/>"
- "country");
- QTest::newRow("United States") << QString::fromLatin1("USA")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("number street<br/>"
- "city, state postcode<br/>"
- "country");
- QTest::newRow("Virgin Islands, US") << QString::fromLatin1("VIR")
- << QString("postcode")
- << QString::fromLatin1("number street<br/>"
- "city, state postcode<br/>"
- "country");
- QTest::newRow("Vatican City State") << QString::fromLatin1("VAT")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
- QTest::newRow("Venezuela") << QString::fromLatin1("VEN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "city postcode, state<br/>"
- "country");
- QTest::newRow("South Africa") << QString::fromLatin1("ZAF")
- << QString()
- << QString::fromLatin1("street number<br/>"
- "district, city<br/>"
- "country");
- QTest::newRow("Finland") << QString::fromLatin1("FIN")
- << QString::fromLatin1("postcode")
- << QString::fromLatin1("street number<br/>"
- "postcode city<br/>"
- "country");
-}
-
-void tst_QGeoAddress::operatorsTest()
-{
- QGeoAddress testObj;
- testObj.setStreet("testValue");
- QGeoAddress testObj2;
- testObj2 = testObj;
- QVERIFY2(testObj == testObj2, "Not copied correctly");
- testObj2.setCountry("testValue2");
- QVERIFY2(testObj != testObj2, "Object should be different");
-}
-
-void tst_QGeoAddress::emptyClearTest()
-{
- QGeoAddress testObj;
- QVERIFY(testObj.isEmpty());
-
- testObj.setCountry(QStringLiteral("country"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setCountryCode(QStringLiteral("countryCode"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setState(QStringLiteral("state"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setCounty(QStringLiteral("county"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setCity(QStringLiteral("city"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setDistrict(QStringLiteral("district"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setPostalCode(QStringLiteral("postalCode"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setStreet(QStringLiteral("street"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setStreetNumber(QStringLiteral("street number"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- testObj.setText(QStringLiteral("formatted address"));
- QVERIFY(!testObj.isEmpty());
- testObj.clear();
-
- QVERIFY(testObj.isEmpty());
-}
-
-void tst_QGeoAddress::hashingTest()
-{
- QFETCH(QGeoAddress, leftAddress);
- QFETCH(QGeoAddress, rightAddress);
- QFETCH(bool, result);
-
- const size_t leftHash = qHash(leftAddress);
- const size_t rightHash = qHash(rightAddress);
- QCOMPARE(leftHash == rightHash, result);
-}
-
-void tst_QGeoAddress::hashingTest_data()
-{
- QTest::addColumn<QGeoAddress>("leftAddress");
- QTest::addColumn<QGeoAddress>("rightAddress");
- QTest::addColumn<bool>("result");
-
- QGeoAddress leftAddress;
- QGeoAddress rightAddress;
-
- QTest::newRow("empty") << leftAddress << rightAddress << true;
- // country
- leftAddress.setCountry("country");
- QTest::newRow("different country") << leftAddress << rightAddress << false;
- rightAddress.setCountry("country");
- QTest::newRow("same country") << leftAddress << rightAddress << true;
- // country code
- leftAddress.setCountryCode("country code");
- QTest::newRow("different code") << leftAddress << rightAddress << false;
- rightAddress.setCountryCode("country code");
- QTest::newRow("same code") << leftAddress << rightAddress << true;
- // state
- leftAddress.setState("state");
- QTest::newRow("different state") << leftAddress << rightAddress << false;
- rightAddress.setState("state");
- QTest::newRow("same state") << leftAddress << rightAddress << true;
- // county
- leftAddress.setCounty("county");
- QTest::newRow("different county") << leftAddress << rightAddress << false;
- rightAddress.setCounty("county");
- QTest::newRow("same county") << leftAddress << rightAddress << true;
- // city
- leftAddress.setCity("city");
- QTest::newRow("different city") << leftAddress << rightAddress << false;
- rightAddress.setCity("city");
- QTest::newRow("same city") << leftAddress << rightAddress << true;
- // district
- leftAddress.setDistrict("district");
- QTest::newRow("different district") << leftAddress << rightAddress << false;
- rightAddress.setDistrict("district");
- QTest::newRow("same district") << leftAddress << rightAddress << true;
- // street
- leftAddress.setStreet("street");
- QTest::newRow("different street") << leftAddress << rightAddress << false;
- rightAddress.setStreet("street");
- QTest::newRow("same street") << leftAddress << rightAddress << true;
- // street number
- leftAddress.setStreetNumber("number");
- QTest::newRow("different number") << leftAddress << rightAddress << false;
- rightAddress.setStreetNumber("number");
- QTest::newRow("same number") << leftAddress << rightAddress << true;
- // postal code
- leftAddress.setPostalCode("postal code");
- QTest::newRow("different postcode") << leftAddress << rightAddress << false;
- rightAddress.setPostalCode("postal code");
- QTest::newRow("same postcode") << leftAddress << rightAddress << true;
- // custom text
- leftAddress.setText("some custom text");
- QTest::newRow("different custom text") << leftAddress << rightAddress << false;
- rightAddress.setText("some custom text");
- QTest::newRow("same custom text") << leftAddress << rightAddress << true;
-
- // empty with custom text
- leftAddress.clear();
- leftAddress.setText("some custom text");
- rightAddress.clear();
- QTest::newRow("empty with different custom text") << leftAddress << rightAddress << false;
- rightAddress.setText("some custom text");
- QTest::newRow("empty with same custom text") << leftAddress << rightAddress << true;
-}
-
-QTEST_APPLESS_MAIN(tst_QGeoAddress)
-
-#include "tst_qgeoaddress.moc"
diff --git a/tests/auto/qgeoareamonitor/CMakeLists.txt b/tests/auto/qgeoareamonitor/CMakeLists.txt
deleted file mode 100644
index de39e942..00000000
--- a/tests/auto/qgeoareamonitor/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated from qgeoareamonitor.pro.
-
-#####################################################################
-## tst_qgeoareamonitor Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeoareamonitor
- SOURCES
- logfilepositionsource.cpp logfilepositionsource.h
- positionconsumerthread.cpp positionconsumerthread.h
- tst_qgeoareamonitor.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeoareamonitor.pro:<TRUE>:
-# OTHER_FILES = "*.txt"
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeoareamonitor/logfilepositionsource.cpp b/tests/auto/qgeoareamonitor/logfilepositionsource.cpp
deleted file mode 100644
index c7cdc93c..00000000
--- a/tests/auto/qgeoareamonitor/logfilepositionsource.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTimer>
-#include "logfilepositionsource.h"
-
-LogFilePositionSource::LogFilePositionSource(const QList<QByteArray> &data, QObject *parent)
- : QGeoPositionInfoSource(parent),
- timer(new QTimer(this)),
- lines(data)
-{
- connect(timer, SIGNAL(timeout()), this, SLOT(readNextPosition()));
-
- if (lines.isEmpty())
- qWarning() << "Error: the input data is empty!";
- else
- index = 0; // ready to read
-}
-
-QGeoPositionInfo LogFilePositionSource::lastKnownPosition(bool /*fromSatellitePositioningMethodsOnly*/) const
-{
- return lastPosition;
-}
-
-LogFilePositionSource::PositioningMethods LogFilePositionSource::supportedPositioningMethods() const
-{
- return AllPositioningMethods;
-}
-
-int LogFilePositionSource::minimumUpdateInterval() const
-{
- return 50;
-}
-
-void LogFilePositionSource::startUpdates()
-{
- lastError = QGeoPositionInfoSource::NoError;
- int interval = updateInterval();
- if (interval < minimumUpdateInterval())
- interval = minimumUpdateInterval();
-
- if (!timer->isActive()) {
- if (QMetaObject::invokeMethod(timer, "start", Q_ARG(int, interval)))
- emit updatesStarted();
- }
-}
-
-void LogFilePositionSource::stopUpdates()
-{
- if (timer->isActive()) {
- if (QMetaObject::invokeMethod(timer, "stop"))
- emit updatesStopped();
- }
-}
-
-void LogFilePositionSource::requestUpdate(int /*timeout*/)
-{
- // For simplicity, ignore timeout - assume that if data is not available
- // now, no data will be added to the file later
- lastError = QGeoPositionInfoSource::NoError;
- if (canReadLine()) {
- readNextPosition();
- } else {
- lastError = QGeoPositionInfoSource::UpdateTimeoutError;
- emit errorOccurred(lastError);
- }
-}
-
-void LogFilePositionSource::readNextPosition()
-{
- if (canReadLine()) {
- const QByteArray line = lines.at(index);
- if (!line.isEmpty()) {
- QList<QByteArray> data = line.split(' ');
- double latitude;
- double longitude;
- bool hasLatitude = false;
- bool hasLongitude = false;
- QDateTime timestamp = QDateTime::fromString(QString(data.value(0)), Qt::ISODate);
- latitude = data.value(1).toDouble(&hasLatitude);
- longitude = data.value(2).toDouble(&hasLongitude);
-
- if (hasLatitude && hasLongitude && timestamp.isValid()) {
- QGeoCoordinate coordinate(latitude, longitude);
- QGeoPositionInfo info(coordinate, timestamp);
- if (info.isValid()) {
- lastPosition = info;
- emit positionUpdated(info);
- }
- }
- }
- index++;
- } else if (!noDataEmitted) {
- emit noDataLeft();
- noDataEmitted = true;
- }
-}
-
-bool LogFilePositionSource::canReadLine() const
-{
- return (index >= 0) && (index < lines.size());
-}
-
-QGeoPositionInfoSource::Error LogFilePositionSource::error() const
-{
- return lastError;
-}
diff --git a/tests/auto/qgeoareamonitor/logfilepositionsource.h b/tests/auto/qgeoareamonitor/logfilepositionsource.h
deleted file mode 100644
index b175f7e9..00000000
--- a/tests/auto/qgeoareamonitor/logfilepositionsource.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LOGFILEPOSITIONSOURCE_H
-#define LOGFILEPOSITIONSOURCE_H
-
-#include <QtPositioning/qgeopositioninfosource.h>
-
-QT_BEGIN_NAMESPACE
-class QTimer;
-QT_END_NAMESPACE
-
-class LogFilePositionSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- // This class is optimized to reduce the file IO.
- // Initially it was reading the file line-by-line.
- // It does not modify the data, so it was optimized to just hold the
- // const reference to the pre-existing data, that can now be read once
- // for all the instances of this class (for example, during the
- // initTestCase() call).
- LogFilePositionSource(const QList<QByteArray> &data, QObject *parent = 0);
-
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override;
-
- PositioningMethods supportedPositioningMethods() const override;
- int minimumUpdateInterval() const override;
- Error error() const override;
-
-signals:
- void noDataLeft();
- void updatesStarted();
- void updatesStopped();
-
-public slots:
- virtual void startUpdates() override;
- virtual void stopUpdates() override;
-
- virtual void requestUpdate(int timeout = 5000) override;
-
-private slots:
- void readNextPosition();
-
-private:
- bool canReadLine() const;
-
- QTimer *timer;
- QGeoPositionInfo lastPosition;
- Error lastError = QGeoPositionInfoSource::NoError;
- const QList<QByteArray> &lines;
- qsizetype index = -1;
- bool noDataEmitted = false;
-};
-
-#endif
diff --git a/tests/auto/qgeoareamonitor/positionconsumerthread.cpp b/tests/auto/qgeoareamonitor/positionconsumerthread.cpp
deleted file mode 100644
index 094e4488..00000000
--- a/tests/auto/qgeoareamonitor/positionconsumerthread.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QSignalSpy>
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include "positionconsumerthread.h"
-
-PositionConsumerThread::PositionConsumerThread(QGeoAreaMonitorSource *source, QObject *parent)
- : QThread(parent), m_source(source)
-{
-}
-
-PositionConsumerThread::~PositionConsumerThread()
-{
- stopProcessing();
- wait();
-}
-
-int PositionConsumerThread::detectedEnterCount() const
-{
- QMutexLocker locker(&m_mutex);
- return m_detectedEnterCount;
-}
-
-int PositionConsumerThread::detectedExitCount() const
-{
- QMutexLocker locker(&m_mutex);
- return m_detectedExitCount;
-}
-
-void PositionConsumerThread::stopProcessing()
-{
- m_mutex.lock();
- m_waitCondition.wakeOne();
- m_mutex.unlock();
-}
-
-void PositionConsumerThread::run()
-{
- QSignalSpy enterSpy(m_source, &QGeoAreaMonitorSource::areaEntered);
- QSignalSpy exitSpy(m_source, &QGeoAreaMonitorSource::areaExited);
-
- m_mutex.lock();
- m_waitCondition.wait(&m_mutex);
- m_detectedEnterCount = enterSpy.count();
- m_detectedExitCount = exitSpy.count();
- m_mutex.unlock();
-}
diff --git a/tests/auto/qgeoareamonitor/positionconsumerthread.h b/tests/auto/qgeoareamonitor/positionconsumerthread.h
deleted file mode 100644
index acf5a933..00000000
--- a/tests/auto/qgeoareamonitor/positionconsumerthread.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef POSITIONCONSUMERTHREAD_H
-#define POSITIONCONSUMERTHREAD_H
-
-#include <QThread>
-#include <QMutex>
-#include <QWaitCondition>
-
-QT_BEGIN_NAMESPACE
-class QGeoAreaMonitorSource;
-QT_END_NAMESPACE
-
-// This class is created to test the behavior of QGeoAreaMonitorPolling class,
-// that reimplements the connectNotify() and disconnetNotify() methods, by
-// triggering these methods from multiple threads.
-// The thread creates two QSignalSpy instances, that connect to the signals of
-// QGeoAreaMonitorSource. Once constructed, they trigger connectNotify().
-// Once destroyed, they trigger disconnectNotify.
-// With the previous implementation of these overridden methods, that could lead
-// to a deadlock in a rare case.
-class PositionConsumerThread : public QThread
-{
- Q_OBJECT
-public:
- explicit PositionConsumerThread(QGeoAreaMonitorSource *source, QObject *parent = nullptr);
- ~PositionConsumerThread();
-
- int detectedEnterCount() const;
- int detectedExitCount() const;
-
-public slots:
- void stopProcessing();
-
-protected:
- void run() override;
-
-private:
- QGeoAreaMonitorSource *m_source;
-
- int m_detectedEnterCount = 0;
- int m_detectedExitCount = 0;
-
- mutable QMutex m_mutex;
- QWaitCondition m_waitCondition;
-};
-
-#endif // POSITIONCONSUMERTHREAD_H
diff --git a/tests/auto/qgeoareamonitor/qgeoareamonitor.pro b/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
deleted file mode 100644
index d084df6e..00000000
--- a/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_qgeoareamonitor
-
-SOURCES += tst_qgeoareamonitor.cpp \
- logfilepositionsource.cpp
-
-HEADERS += logfilepositionsource.h
-
-OTHER_FILES += *.txt
-
-CONFIG -= app_bundle
-
-QT += positioning testlib
diff --git a/tests/auto/qgeoareamonitor/simplelog.txt b/tests/auto/qgeoareamonitor/simplelog.txt
deleted file mode 100644
index 5a14fb80..00000000
--- a/tests/auto/qgeoareamonitor/simplelog.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-2009-08-24T22:24:34 -27.54 153.090718
-2009-08-24T22:24:35 -27.55 153.090718
-2009-08-24T22:24:36 -27.56 153.090718
-2009-08-24T22:24:37 -27.57 153.090718
-2009-08-24T22:24:38 -27.58 153.090783
-2009-08-24T22:24:39 -27.59 153.090845
-2009-08-24T22:24:40 -27.60 153.090908
-2009-08-24T22:24:41 -27.61 153.090971
-2009-08-24T22:24:42 -27.62 153.091036
-2009-08-24T22:24:43 -27.63 153.091102
-2009-08-24T22:24:44 -27.64 153.091167
-2009-08-24T22:24:45 -27.65 153.091232
-2009-08-24T22:24:46 -27.65 153.091298
-2009-08-24T22:24:47 -27.65 153.091366
-2009-08-24T22:24:48 -27.65 153.091435
-2009-08-24T22:24:49 -27.66 153.091507
-2009-08-24T22:24:50 -27.67 153.091581
-2009-08-24T22:24:51 -27.68 153.091654
-2009-08-24T22:24:52 -27.69 153.091729
-2009-08-24T22:24:53 -27.70 153.091800
-2009-08-24T22:24:54 -27.71 153.091870
-2009-08-24T22:24:55 -27.72 153.091940
-2009-08-24T22:24:56 -27.73 153.092010
-2009-08-24T22:24:57 -27.74 153.092078
-2009-08-24T22:24:58 -27.75 153.092144
-2009-08-24T22:24:59 -27.78 153.092218
-2009-08-24T22:25:00 -27.79 153.092308
-2009-08-24T22:25:01 -27.80 153.092415
-2009-08-24T22:25:02 -27.81 153.092530
-2009-08-24T22:25:03 -27.82 153.092648
-2009-08-24T22:25:04 -27.83 153.092763
-2009-08-24T22:25:05 -27.84 153.092879
-2009-08-24T22:25:06 -27.85 153.092990
-2009-08-24T22:25:07 -27.84 153.093099
-2009-08-24T22:25:08 -27.83 153.093204
-2009-08-24T22:25:09 -27.82 153.093303
-2009-08-24T22:25:10 -27.81 153.093396
-2009-08-24T22:25:11 -27.80 153.093484
-2009-08-24T22:25:12 -27.79 153.093568
-2009-08-24T22:25:13 -27.78 153.093647
-2009-08-24T22:25:14 -27.77 153.093727
-2009-08-24T22:25:15 -27.76 153.093810
-2009-08-24T22:25:16 -27.75 153.093896
-2009-08-24T22:25:17 -27.74 153.093984
-2009-08-24T22:25:18 -27.72 153.094074
-2009-08-24T22:25:19 -27.70 153.094168
-2009-08-24T22:25:20 -27.71 153.094267
-2009-08-24T22:25:21 -27.69 153.094370
-2009-08-24T22:25:22 -27.68 153.094474
-2009-08-24T22:25:23 -27.67 153.094581
-2009-08-24T22:25:24 -27.66 153.094688
-2009-08-24T22:25:25 -27.65 153.094796
-2009-08-24T22:25:26 -27.64 153.094905
-2009-08-24T22:25:27 -27.63 153.095012
-2009-08-24T22:25:28 -27.62 153.095121
-2009-08-24T22:25:29 -27.61 153.095231
-2009-08-24T22:25:30 -27.60 153.095340
-2009-08-24T22:25:31 -27.59 153.095449
-2009-08-24T22:25:32 -27.58 153.095558
-2009-08-24T22:25:33 -27.57 153.095667
-2009-08-24T22:25:34 -27.56 153.095776
-2009-08-24T22:25:35 -27.55 153.095885
-2009-08-24T22:25:36 -27.54 153.095995
-2009-08-24T22:25:37 -27.53 153.096109
-2009-08-24T22:25:38 -27.52 153.096226
-2009-08-24T22:25:39 -27.51 153.096337
-2009-08-24T22:25:40 -27.50 153.096441
-2009-08-24T22:25:41 -27.49 153.096537
-2009-08-24T22:25:42 -27.48 153.096628
-2009-08-24T22:25:43 -27.47 153.096714
-2009-08-24T22:25:44 -27.46 153.096795
-2009-08-24T22:25:45 -27.45 153.096847
-2009-08-24T22:25:46 -27.44 153.096855
-2009-08-24T22:25:47 -27.43 153.096873
-2009-08-24T22:25:48 -27.42 153.096875
-2009-08-24T22:25:49 -27.41 153.096878
-2009-08-24T22:25:50 -27.40 153.096880
-2009-08-24T22:25:51 -27.39 153.096880
-2009-08-24T22:25:52 -27.38 153.096881
-2009-08-24T22:25:53 -27.37 153.096882
-2009-08-24T22:25:54 -27.36 153.096883
-2009-08-24T22:25:55 -27.35 153.096883
-2009-08-24T22:25:56 -27.34 153.096883
-2009-08-24T22:25:57 -27.33 153.096890
-2009-08-24T22:25:58 -27.32 153.096919
-2009-08-24T22:25:59 -27.31 153.096985
-2009-08-24T22:26:00 -27.30 153.097060
diff --git a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp b/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
deleted file mode 100644
index 77d433fd..00000000
--- a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
+++ /dev/null
@@ -1,977 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QTest>
-#include <QMetaType>
-#include <QSignalSpy>
-
-#include <limits.h>
-#include <float.h>
-
-#include <QDebug>
-#include <QDataStream>
-#include <QFile>
-
-#include <QtPositioning/qgeoareamonitorinfo.h>
-#include <QtPositioning/qgeoareamonitorsource.h>
-#include <QtPositioning/qgeopositioninfo.h>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qnmeapositioninfosource.h>
-#include <QtPositioning/qgeocircle.h>
-#include <QtPositioning/qgeorectangle.h>
-
-#include "logfilepositionsource.h"
-#include "positionconsumerthread.h"
-
-QT_USE_NAMESPACE
-#define UPDATE_INTERVAL 50
-
-QString tst_qgeoareamonitorinfo_debug;
-
-void tst_qgeoareamonitorinfo_messageHandler(QtMsgType type,
- const QMessageLogContext &,
- const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeoareamonitorinfo_debug = msg;
- break;
- default:
- break;
- }
-}
-
-static QList<QByteArray> readFileData(const QString &fileName)
-{
- QList<QByteArray> data;
- QFile logFile(fileName);
- if (logFile.open(QIODevice::ReadOnly)) {
- data = logFile.readAll().split('\n');
- logFile.close();
- } else {
- qWarning() << "Error: cannot open source file" << logFile.fileName();
- }
- return data;
-}
-
-class DummyMonitorSource : public QGeoAreaMonitorSource
-{
- Q_OBJECT
-public:
- static const QString kTestProperty;
-
- DummyMonitorSource(QObject *parent = nullptr) : QGeoAreaMonitorSource(parent)
- {}
-
- Error error() const override
- {
- return NoError;
- }
- AreaMonitorFeatures supportedAreaMonitorFeatures() const override
- {
- return AnyAreaMonitorFeature;
- }
-
- bool startMonitoring(const QGeoAreaMonitorInfo &monitor) override
- {
- Q_UNUSED(monitor);
- return false;
- }
- bool stopMonitoring(const QGeoAreaMonitorInfo &monitor) override
- {
- Q_UNUSED(monitor);
- return false;
- }
- bool requestUpdate(const QGeoAreaMonitorInfo &monitor, const char *signal) override
- {
- Q_UNUSED(monitor);
- Q_UNUSED(signal);
- return false;
- }
-
- QList<QGeoAreaMonitorInfo> activeMonitors() const override
- {
- return {};
- }
- QList<QGeoAreaMonitorInfo> activeMonitors(const QGeoShape &lookupArea) const override
- {
- Q_UNUSED(lookupArea);
- return {};
- }
-
- bool setBackendProperty(const QString &name, const QVariant &value) override
- {
- if (name == kTestProperty) {
- m_testPropertyValue = value.toInt();
- return true;
- }
- return false;
- }
- QVariant backendProperty(const QString &name) const override
- {
- if (name == kTestProperty)
- return m_testPropertyValue;
- return QVariant();
- }
-
-private:
- int m_testPropertyValue = 0;
-};
-
-const QString DummyMonitorSource::kTestProperty = "TestProperty";
-
-class tst_QGeoAreaMonitorSource : public QObject
-{
- Q_OBJECT
-
-private:
- QList<QByteArray> m_fileData;
-
-private slots:
- void initTestCase()
- {
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../plugins"));
-#endif
-#endif
- qRegisterMetaType<QGeoAreaMonitorInfo>();
- m_fileData = readFileData(QFINDTESTDATA("simplelog.txt"));
- }
-
- void init()
- {
- }
-
- void cleanup()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- QList<QGeoAreaMonitorInfo> list = obj->activeMonitors();
- if (list.count() > 0) {
- //cleanup installed monitors
- foreach (const QGeoAreaMonitorInfo& info, list) {
- QVERIFY(obj->stopMonitoring(info));
- }
- }
- QVERIFY(obj->activeMonitors().count() == 0);
- }
-
- void cleanupTestCase()
- {
- }
-
- void tst_monitor()
- {
- QGeoAreaMonitorInfo defaultMonitor;
- QVERIFY(defaultMonitor.name().isEmpty());
- QVERIFY(!defaultMonitor.identifier().isEmpty());
- QCOMPARE(defaultMonitor.isPersistent(), false);
- QVERIFY(!defaultMonitor.area().isValid());
- QVERIFY(!defaultMonitor.isValid());
- QCOMPARE(defaultMonitor.expiration(), QDateTime());
- QCOMPARE(defaultMonitor.notificationParameters(), QVariantMap());
-
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- QVERIFY(!obj->startMonitoring(defaultMonitor));
- QCOMPARE(obj->activeMonitors().count(), 0);
- QVERIFY(!obj->requestUpdate(defaultMonitor,
- SIGNAL(areaEntered(QGeoMonitorInfo,QGeoAreaPositionInfo))));
-
- //copy constructor based
- QGeoAreaMonitorInfo copy(defaultMonitor);
- QVERIFY(copy.name().isEmpty());
- QCOMPARE(copy.identifier(), defaultMonitor.identifier());
- QVERIFY(copy == defaultMonitor);
- QVERIFY(!(copy != defaultMonitor));
- QCOMPARE(copy.isPersistent(), false);
-
- copy.setName(QString("my name"));
- QCOMPARE(copy.name(), QString("my name"));
-
-
- QDateTime now = QDateTime::currentDateTime().addSecs(1000); //little bit in the future
- copy.setExpiration(now);
- QVERIFY(copy != defaultMonitor);
- QCOMPARE(copy.expiration(), now);
-
- QCOMPARE(copy.isPersistent(), defaultMonitor.isPersistent());
- copy.setPersistent(true);
- QCOMPARE(copy.isPersistent(), true);
- QCOMPARE(defaultMonitor.isPersistent(), false);
- copy.setPersistent(false);
-
- QVERIFY(copy.area() == defaultMonitor.area());
- QVERIFY(!copy.area().isValid());
- copy.setArea(QGeoCircle(QGeoCoordinate(1, 2), 4));
- QVERIFY(copy.area().isValid());
- QVERIFY(copy.area() != defaultMonitor.area());
- QVERIFY(copy.area().contains(QGeoCoordinate(1, 2)));
-
- QVERIFY(copy.notificationParameters().isEmpty());
- QVariantMap map;
- map.insert(QString("MyKey"), QVariant(123));
- copy.setNotificationParameters(map);
- QVERIFY(!copy.notificationParameters().isEmpty());
- QCOMPARE(copy.notificationParameters().value(QString("MyKey")).toInt(), 123);
- QCOMPARE(defaultMonitor.notificationParameters().value(QString("MyKey")).toInt(), 0);
-
- QCOMPARE(defaultMonitor.identifier(), copy.identifier());
-
- //assignment operator based
- QGeoAreaMonitorInfo assignmentCopy;
- assignmentCopy = copy;
- QVERIFY(copy == assignmentCopy);
- QVERIFY(assignmentCopy != defaultMonitor);
-
- QVERIFY(assignmentCopy.area().contains(QGeoCoordinate(1, 2)));
- QCOMPARE(assignmentCopy.expiration(), now);
- QCOMPARE(assignmentCopy.isPersistent(), false);
- QCOMPARE(assignmentCopy.notificationParameters().value(QString("MyKey")).toInt(), 123);
- QCOMPARE(defaultMonitor.identifier(), assignmentCopy.identifier());
- QCOMPARE(assignmentCopy.name(), QString("my name"));
-
- //validity checks for requestUpdate()
- obj.reset(QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- QCOMPARE(obj->activeMonitors().count(), 0);
- //reference -> should work
- QVERIFY(obj->requestUpdate(copy, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), 1);
- //replaces areaEntered single shot
- QVERIFY(obj->requestUpdate(copy, SIGNAL(areaExited(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), 1);
- //replaces areaExited single shot
- QVERIFY(obj->startMonitoring(copy));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
-
- //invalid signal
- QVERIFY(!obj->requestUpdate(copy, 0));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- //signal that doesn't exist
- QVERIFY(!obj->requestUpdate(copy, SIGNAL(areaEntered(QGeoMonitor))));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- QVERIFY(!obj->requestUpdate(copy, "SIGNAL(areaEntered(QGeoMonitor))"));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- //ensure that we cannot add a persistent monitor to a source
- //that doesn't support persistence
- QGeoAreaMonitorInfo persistenceMonitor(copy);
- persistenceMonitor.setPersistent(obj->supportedAreaMonitorFeatures() & QGeoAreaMonitorSource::PersistentAreaMonitorFeature);
- persistenceMonitor.setPersistent(!persistenceMonitor.isPersistent());
-
- QVERIFY(!obj->requestUpdate(persistenceMonitor, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), 1);
- QVERIFY(!obj->startMonitoring(persistenceMonitor));
- QCOMPARE(obj->activeMonitors().count(), 1);
-
- //ensure that persistence was only reason for rejection
- persistenceMonitor.setPersistent(!persistenceMonitor.isPersistent());
- QVERIFY(obj->startMonitoring(persistenceMonitor));
- //persistenceMonitor is copy of already added monitor
- //the last call was an update
- QCOMPARE(obj->activeMonitors().count(), 1);
- }
-
- void tst_monitor_move_semantics()
- {
- QGeoAreaMonitorInfo info1("test");
- info1.setArea(QGeoCircle(QGeoCoordinate(1.0, 1.0), 100));
- info1.setExpiration(QDateTime::currentDateTimeUtc());
- QGeoAreaMonitorInfo infoCopy(info1);
-
- QGeoAreaMonitorInfo info2(std::move(info1));
- QCOMPARE(info2, infoCopy);
-
- QGeoAreaMonitorInfo info3;
- info3.setName("name");
- info3.setArea(QGeoRectangle(QGeoCoordinate(1, 2), QGeoCoordinate(2, 1)));
- info3.setPersistent(true);
- infoCopy = info3;
-
- // check that (move)assigning to the moved-from object is ok
- info1 = std::move(info3);
- QCOMPARE(info1, infoCopy);
-
- // The moved-from object info3 will go out of scope and will be
- // destroyed here, so we also implicitly check that moved-from object's
- // destructor is called without any issues.
- }
-
- void tst_monitorValid()
- {
- QGeoAreaMonitorInfo mon;
- QVERIFY(!mon.isValid());
- QCOMPARE(mon.name(), QString());
- QCOMPARE(mon.area().isValid(), false);
-
- QGeoAreaMonitorInfo mon2 = mon;
- QVERIFY(!mon2.isValid());
-
- QGeoShape invalidShape;
- QGeoCircle emptyCircle(QGeoCoordinate(0,1), 0);
- QGeoCircle validCircle(QGeoCoordinate(0,1), 1);
-
- //all invalid since no name set yet
- mon2.setArea(invalidShape);
- QVERIFY(mon2.area() == invalidShape);
- QVERIFY(!mon2.isValid());
-
- mon2.setArea(emptyCircle);
- QVERIFY(mon2.area() == emptyCircle);
- QVERIFY(!mon2.isValid());
-
- mon2.setArea(validCircle);
- QVERIFY(mon2.area() == validCircle);
- QVERIFY(!mon2.isValid());
-
- //valid since name and non-empy shape has been set
- QGeoAreaMonitorInfo validMonitor("TestMonitor");
- QVERIFY(validMonitor.name() == QString("TestMonitor"));
- QVERIFY(!validMonitor.isValid());
-
- validMonitor.setArea(invalidShape);
- QVERIFY(validMonitor.area() == invalidShape);
- QVERIFY(!validMonitor.isValid());
-
- validMonitor.setArea(emptyCircle);
- QVERIFY(validMonitor.area() == emptyCircle);
- QVERIFY(!validMonitor.isValid());
-
- validMonitor.setArea(validCircle);
- QVERIFY(validCircle == validMonitor.area());
- QVERIFY(validMonitor.isValid());
- }
-
- void tst_monitorStreaming()
- {
- QByteArray container;
- QDataStream stream(&container, QIODevice::ReadWrite);
-
- QGeoAreaMonitorInfo monitor("someName");
- monitor.setArea(QGeoCircle(QGeoCoordinate(1,3), 5.4));
- const QDateTime expirationTime = QDateTime::currentDateTime().addSecs(60);
- monitor.setExpiration(expirationTime);
- monitor.setPersistent(true);
- const QVariantMap params { {"string_param", "some string"},
- {"int_param", 1}, {"double_param", 3.5} };
- monitor.setNotificationParameters(params);
- QVERIFY(monitor.isValid());
- QCOMPARE(monitor.name(), QString("someName"));
- QCOMPARE(monitor.expiration(), expirationTime);
- QVERIFY(monitor.isPersistent());
- QCOMPARE(monitor.notificationParameters(), params);
-
- QGeoAreaMonitorInfo target;
- QVERIFY(!target.isValid());
- QVERIFY(target.name().isEmpty());
-
- QVERIFY(target != monitor);
-
- stream << monitor;
- stream.device()->seek(0);
- stream >> target;
-
- QVERIFY(target == monitor);
- QVERIFY(target.isValid());
- QCOMPARE(target.name(), QString("someName"));
- QVERIFY(target.area() == QGeoCircle(QGeoCoordinate(1,3), 5.4));
- QCOMPARE(target.expiration(), expirationTime);
- QVERIFY(target.isPersistent());
- QCOMPARE(target.notificationParameters(), params);
- }
-
- void tst_createDefaultSource()
- {
- std::unique_ptr<QObject> parent(new QObject);
-
- // Have to use a raw pointer here, because otherwise we'd end up
- // deleting the obj twice when deleting the parent
- QGeoAreaMonitorSource *obj = QGeoAreaMonitorSource::createDefaultSource(parent.get());
- QVERIFY(obj != nullptr);
- QVERIFY(obj->parent() == parent.get());
- delete obj;
-
- const QStringList monitors = QGeoAreaMonitorSource::availableSources();
- QVERIFY(!monitors.isEmpty());
- QVERIFY(monitors.contains(QStringLiteral("positionpoll")));
-
- obj = QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), parent.get());
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- parent.reset();
-
- // using a smart pointer will cause a double delete here
- obj = QGeoAreaMonitorSource::createSource(QStringLiteral("randomNonExistingName"), 0);
- QVERIFY(obj == nullptr);
- }
-
- void tst_activeMonitors()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), source);
-
-
- QVERIFY(obj->activeMonitors().isEmpty());
-
- QGeoAreaMonitorInfo mon("Monitor_Circle");
- mon.setArea(QGeoCircle(QGeoCoordinate(1,1), 1000));
- QVERIFY(obj->startMonitoring(mon));
-
- QGeoAreaMonitorInfo mon2("Monitor_rectangle_below");
- QGeoRectangle r_below(QGeoCoordinate(1,1),2,2);
- mon2.setArea(r_below);
- QVERIFY(obj->startMonitoring(mon2));
-
- QGeoAreaMonitorInfo mon3("Monitor_rectangle_above");
- QGeoRectangle r_above(QGeoCoordinate(2,1),2,2);
- mon3.setArea(r_above);
- QVERIFY(obj->startMonitoring(mon3));
-
- QList<QGeoAreaMonitorInfo> results = obj->activeMonitors();
- QCOMPARE(results.count(), 3);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2 || info == mon3);
- }
-
- results = obj->activeMonitors(QGeoShape());
- QCOMPARE(results.count(), 0);
-
- results = obj->activeMonitors(QGeoRectangle(QGeoCoordinate(1,1),0.2, 0.2));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = obj->activeMonitors(QGeoCircle(QGeoCoordinate(1,1),1000));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = obj->activeMonitors(QGeoCircle(QGeoCoordinate(2,1),1000));
- QCOMPARE(results.count(), 1);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon3);
- }
-
- //same as above except that we use a different monitor source object instance
- //all monitor objects of same type share same active monitors
- std::unique_ptr<QGeoAreaMonitorSource> secondObj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(secondObj != nullptr);
- QCOMPARE(secondObj->sourceName(), QStringLiteral("positionpoll"));
-
- results = secondObj->activeMonitors();
- QCOMPARE(results.count(), 3);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2 || info == mon3);
- }
-
- results = secondObj->activeMonitors(QGeoShape());
- QCOMPARE(results.count(), 0);
-
- results = secondObj->activeMonitors(QGeoRectangle(QGeoCoordinate(1,1),0.2, 0.2));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = secondObj->activeMonitors(QGeoCircle(QGeoCoordinate(1,1),1000));
- QCOMPARE(results.count(), 2);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon || info == mon2);
- }
-
- results = secondObj->activeMonitors(QGeoCircle(QGeoCoordinate(2,1),1000));
- QCOMPARE(results.count(), 1);
- foreach (const QGeoAreaMonitorInfo& info, results) {
- QVERIFY(info == mon3);
- }
- }
-
- void tst_testExpiryTimeout()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- std::unique_ptr<QGeoAreaMonitorSource> secondObj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(secondObj != nullptr);
- QCOMPARE(secondObj->sourceName(), QStringLiteral("positionpoll"));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
-
- //Singleton pattern behind QGeoAreaMonitorSource ensures same position info source
- QCOMPARE(obj->positionInfoSource(), source);
- QCOMPARE(secondObj->positionInfoSource(), source);
-
- QSignalSpy expirySpy(obj.get(), SIGNAL(monitorExpired(QGeoAreaMonitorInfo)));
- QSignalSpy expirySpy2(secondObj.get(), SIGNAL(monitorExpired(QGeoAreaMonitorInfo)));
-
- QDateTime now = QDateTime::currentDateTime();
-
- const int monitorCount = 4;
- for (int i = 1; i <= monitorCount; i++) {
- QGeoAreaMonitorInfo mon(QString::number(i));
- mon.setArea(QGeoRectangle(QGeoCoordinate(i,i), i, i));
- mon.setExpiration(now.addSecs(i*2));
- QVERIFY(mon.isValid());
- QVERIFY(obj->startMonitoring(mon));
- }
-
-
-
- QCOMPARE(obj->activeMonitors().count(), monitorCount);
- QCOMPARE(secondObj->activeMonitors().count(), monitorCount);
-
- QGeoAreaMonitorInfo info("InvalidExpiry");
- info.setArea(QGeoRectangle(QGeoCoordinate(10,10), 1, 1 ));
- QVERIFY(info.isValid());
- info.setExpiration(now.addSecs(-1000));
- QVERIFY(info.expiration() < now);
- QVERIFY(!obj->startMonitoring(info));
- QCOMPARE(obj->activeMonitors().count(), monitorCount);
- QVERIFY(!obj->requestUpdate(info, SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
- QCOMPARE(obj->activeMonitors().count(), monitorCount);
-
- for (int i = 1; i <= monitorCount; i++) {
- QTRY_VERIFY_WITH_TIMEOUT(expirySpy.count() == 1, 3000); //each expiry within 2 s
- QGeoAreaMonitorInfo mon = expirySpy.takeFirst().at(0).value<QGeoAreaMonitorInfo>();
- QCOMPARE(obj->activeMonitors().count(), monitorCount-i);
- QCOMPARE(mon.name(), QString::number(i));
- }
-
- QCOMPARE(expirySpy2.count(), monitorCount);
- QCOMPARE(secondObj->activeMonitors().count(), 0); //all monitors expired
- for (int i = 1; i <= monitorCount; i++) {
- QGeoAreaMonitorInfo mon = expirySpy2.takeFirst().at(0).value<QGeoAreaMonitorInfo>();
- QCOMPARE(mon.name(), QString::number(i));
- }
- }
-
- void tst_enteredExitedSignal()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- obj->setObjectName("firstObject");
- QSignalSpy enteredSpy(obj.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy(obj.get(), SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), source);
-
- std::unique_ptr<QGeoAreaMonitorSource> secondObj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(secondObj != nullptr);
- QCOMPARE(secondObj->sourceName(), QStringLiteral("positionpoll"));
- QSignalSpy enteredSpy2(secondObj.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy2(secondObj.get(),
- SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- secondObj->setObjectName("secondObject");
-
- QGeoAreaMonitorInfo infoRectangle("Rectangle");
- infoRectangle.setArea(QGeoRectangle(QGeoCoordinate(-27.65, 153.093), 0.2, 0.2));
- QVERIFY(infoRectangle.isValid());
- QVERIFY(obj->startMonitoring(infoRectangle));
-
- QGeoAreaMonitorInfo infoCircle("Circle");
- infoCircle.setArea(QGeoCircle(QGeoCoordinate(-27.70, 153.093),10000));
- QVERIFY(infoCircle.isValid());
- QVERIFY(obj->startMonitoring(infoCircle));
-
- QGeoAreaMonitorInfo singleShot_enter("SingleShot_on_Entered");
- singleShot_enter.setArea(QGeoRectangle(QGeoCoordinate(-27.67, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_enter.isValid());
- QVERIFY(obj->requestUpdate(singleShot_enter,
- SIGNAL(areaEntered(QGeoAreaMonitorInfo,QGeoPositionInfo))));
-
- QGeoAreaMonitorInfo singleShot_exit("SingleShot_on_Exited");
- singleShot_exit.setArea(QGeoRectangle(QGeoCoordinate(-27.70, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_exit.isValid());
- QVERIFY(obj->requestUpdate(singleShot_exit,
- SIGNAL(areaExited(QGeoAreaMonitorInfo,QGeoPositionInfo))));
-
- QVERIFY(obj->activeMonitors().count() == 4); //all monitors active
- QVERIFY(secondObj->activeMonitors().count() == 4); //all monitors active
-
- static const int Number_Of_Entered_Events = 6;
- static const int Number_Of_Exited_Events = 5;
- //takes 87 (lines)*50(timeout)/1000 seconds to finish
- QTRY_VERIFY_WITH_TIMEOUT(enteredSpy.count() == Number_Of_Entered_Events, 5000);
- QTRY_VERIFY_WITH_TIMEOUT(exitedSpy.count() == Number_Of_Exited_Events, 5000);
- QCOMPARE(enteredSpy.count(), Number_Of_Entered_Events);
- QCOMPARE(exitedSpy.count(), Number_Of_Exited_Events);
-
- QList<QGeoAreaMonitorInfo> monitorsInExpectedEnteredEventOrder;
- monitorsInExpectedEnteredEventOrder << infoRectangle << singleShot_enter << singleShot_exit
- << infoCircle << infoCircle << infoRectangle;
-
- QList<QGeoAreaMonitorInfo> monitorsInExpectedExitedEventOrder;
- monitorsInExpectedExitedEventOrder << infoRectangle << infoCircle
- << singleShot_exit << infoCircle << infoRectangle;
-
- QList<QGeoCoordinate> enteredEventCoordinateOrder;
- enteredEventCoordinateOrder << QGeoCoordinate(-27.55, 153.090718) //infoRectangle
- << QGeoCoordinate(-27.57, 153.090718) //singleshot_enter
- << QGeoCoordinate(-27.60, 153.090908) //singleshot_exit
- << QGeoCoordinate(-27.62, 153.091036) //infoCircle
- << QGeoCoordinate(-27.78, 153.093647) //infoCircle
- << QGeoCoordinate(-27.75, 153.093896);//infoRectangle
- QCOMPARE(enteredEventCoordinateOrder.count(), Number_Of_Entered_Events);
- QCOMPARE(monitorsInExpectedEnteredEventOrder.count(), Number_Of_Entered_Events);
-
- QList<QGeoCoordinate> exitedEventCoordinateOrder;
- exitedEventCoordinateOrder << QGeoCoordinate(-27.78, 153.092218) //infoRectangle
- << QGeoCoordinate(-27.79, 153.092308) //infoCircle
- << QGeoCoordinate(-27.81, 153.092530) //singleshot_exit
- << QGeoCoordinate(-27.61, 153.095231) //infoCircle
- << QGeoCoordinate(-27.54, 153.095995);//infoCircle
- QCOMPARE(exitedEventCoordinateOrder.count(), Number_Of_Exited_Events);
- QCOMPARE(monitorsInExpectedExitedEventOrder.count(), Number_Of_Exited_Events);
-
- //verify that both sources got the same signals
- for (int i = 0; i < Number_Of_Entered_Events; i++) {
- //first source
- QGeoAreaMonitorInfo monInfo = enteredSpy.first().at(0).value<QGeoAreaMonitorInfo>();
- QGeoPositionInfo posInfo = enteredSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedEnteredEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == enteredEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
-
- //reset info objects to avoid comparing the same
- monInfo = QGeoAreaMonitorInfo();
- posInfo = QGeoPositionInfo();
-
- //second source
- monInfo = enteredSpy2.first().at(0).value<QGeoAreaMonitorInfo>();
- posInfo = enteredSpy2.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedEnteredEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == enteredEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
- }
-
- for (int i = 0; i < Number_Of_Exited_Events; i++) {
- //first source
- QGeoAreaMonitorInfo monInfo = exitedSpy.first().at(0).value<QGeoAreaMonitorInfo>();
- QGeoPositionInfo posInfo = exitedSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedExitedEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == exitedEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
-
- //reset info objects to avoid comparing the same
- monInfo = QGeoAreaMonitorInfo();
- posInfo = QGeoPositionInfo();
-
- //second source
- monInfo = exitedSpy2.first().at(0).value<QGeoAreaMonitorInfo>();
- posInfo = exitedSpy2.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY2(monInfo == monitorsInExpectedExitedEventOrder.at(i),
- qPrintable(QString::number(i) + ": " + monInfo.name()));
- QVERIFY2(posInfo.coordinate() == exitedEventCoordinateOrder.at(i),
- qPrintable(QString::number(i) + ". posInfo"));
- }
-
- QCOMPARE(obj->activeMonitors().count(), 2); //single shot monitors have been removed
- QCOMPARE(secondObj->activeMonitors().count(), 2);
- }
-
- void tst_swapOfPositionSource()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
- obj->setObjectName("firstObject");
- QSignalSpy enteredSpy(obj.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy(obj.get(), SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
-
- std::unique_ptr<QGeoAreaMonitorSource> obj2(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj2 != nullptr);
- QCOMPARE(obj2->sourceName(), QStringLiteral("positionpoll"));
- obj2->setObjectName("secondObject");
- QSignalSpy enteredSpy2(obj2.get(),
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo)));
- QSignalSpy exitedSpy2(obj2.get(),
- SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo)));
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- source->setObjectName("FirstLogFileSource");
-
- // using this -> no need for smart pointer
- LogFilePositionSource *source2 = new LogFilePositionSource(m_fileData, this);
- source2->setUpdateInterval(UPDATE_INTERVAL);
- source2->setObjectName("SecondLogFileSource");
-
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), obj2->positionInfoSource());
- QCOMPARE(obj2->positionInfoSource(), source);
-
- QGeoAreaMonitorInfo infoRectangle("Rectangle");
- infoRectangle.setArea(QGeoRectangle(QGeoCoordinate(-27.70, 153.092), 0.2, 0.2));
- QVERIFY(infoRectangle.isValid());
- QVERIFY(obj->startMonitoring(infoRectangle));
-
- QCOMPARE(obj->activeMonitors().count(), 1);
- QCOMPARE(obj2->activeMonitors().count(), 1);
-
- QGeoCoordinate firstBorder(-27.6, 153.090908);
- QGeoCoordinate secondBorder(-27.81, 153.092530);
-
- /***********************************/
- //1. trigger events on source (until areaExit
- QTRY_VERIFY_WITH_TIMEOUT(exitedSpy.count() == 1, 5000);
- QCOMPARE(enteredSpy.count(), enteredSpy2.count());
- QCOMPARE(exitedSpy.count(), exitedSpy2.count());
-
- //compare entered event
- QVERIFY(enteredSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- enteredSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- QGeoPositionInfo info = enteredSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == enteredSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == firstBorder);
- //compare exit event
- QVERIFY(exitedSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- exitedSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- info = exitedSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == exitedSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == secondBorder);
-
- QCOMPARE(exitedSpy.count(), 0);
- QCOMPARE(enteredSpy.count(), 0);
- QCOMPARE(exitedSpy2.count(), 0);
- QCOMPARE(enteredSpy2.count(), 0);
-
- /***********************************/
- //2. change position source -> which restarts at beginning again
- obj2->setPositionInfoSource(source2);
- QCOMPARE(obj->positionInfoSource(), obj2->positionInfoSource());
- QCOMPARE(obj2->positionInfoSource(), source2);
-
- QTRY_VERIFY_WITH_TIMEOUT(exitedSpy.count() == 1, 5000);
- QCOMPARE(enteredSpy.count(), enteredSpy2.count());
- QCOMPARE(exitedSpy.count(), exitedSpy2.count());
-
- //compare entered event
- QVERIFY(enteredSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- enteredSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- info = enteredSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == enteredSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == firstBorder);
- //compare exit event
- QVERIFY(exitedSpy.first().at(0).value<QGeoAreaMonitorInfo>() ==
- exitedSpy2.first().at(0).value<QGeoAreaMonitorInfo>());
- info = exitedSpy.takeFirst().at(1).value<QGeoPositionInfo>();
- QVERIFY(info == exitedSpy2.takeFirst().at(1).value<QGeoPositionInfo>());
- QVERIFY(info.coordinate() == secondBorder);
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoAreaMonitorInfo>("info");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QString>("debugString");
-
- QGeoAreaMonitorInfo info;
- QTest::newRow("uninitialized") << info << 45
- << QString("QGeoAreaMonitorInfo(\"\", QGeoShape(Unknown), "
- "persistent: false, expiry: QDateTime(Invalid)) 45");
-
- info.setArea(QGeoRectangle());
- info.setPersistent(true);
- info.setName("RectangleAreaMonitor");
- QTest::newRow("Rectangle Test") << info << 45
- << QString("QGeoAreaMonitorInfo(\"RectangleAreaMonitor\", QGeoShape(Rectangle), "
- "persistent: true, expiry: QDateTime(Invalid)) 45");
-
- info = QGeoAreaMonitorInfo();
- info.setArea(QGeoCircle());
- info.setPersistent(false);
- info.setName("CircleAreaMonitor");
- QVariantMap map;
- map.insert(QString("foobarKey"), QVariant(45)); //should be ignored
- info.setNotificationParameters(map);
- QTest::newRow("Circle Test") << info << 45
- << QString("QGeoAreaMonitorInfo(\"CircleAreaMonitor\", QGeoShape(Circle), "
- "persistent: false, expiry: QDateTime(Invalid)) 45");
-
- // we ignore any further QDateTime related changes to avoid depending on QDateTime related
- // failures in case its QDebug string changes
- }
-
- void debug()
- {
- QFETCH(QGeoAreaMonitorInfo, info);
- QFETCH(int, nextValue);
- QFETCH(QString, debugString);
-
- qInstallMessageHandler(tst_qgeoareamonitorinfo_messageHandler);
- qDebug() << info << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(tst_qgeoareamonitorinfo_debug, debugString);
- }
-
- void multipleThreads()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj(
- QGeoAreaMonitorSource::createSource(QStringLiteral("positionpoll"), 0));
- QVERIFY(obj != nullptr);
- QCOMPARE(obj->sourceName(), QStringLiteral("positionpoll"));
-
- QVERIFY(obj->activeMonitors().isEmpty());
-
- LogFilePositionSource *source = new LogFilePositionSource(m_fileData, this);
- source->setUpdateInterval(UPDATE_INTERVAL);
- obj->setPositionInfoSource(source);
- QCOMPARE(obj->positionInfoSource(), source);
-
- QSignalSpy noDataSpy(source, &LogFilePositionSource::noDataLeft);
- QSignalSpy updatesStartedSpy(source, &LogFilePositionSource::updatesStarted);
- QSignalSpy updatesStoppedSpy(source, &LogFilePositionSource::updatesStopped);
-
- // generate threads
- const int threadCount = 10;
- QList<PositionConsumerThread *> threads;
- for (int i = 0; i < threadCount; ++i) {
- auto threadObj = new PositionConsumerThread(obj.get(), this);
- threadObj->start();
- threads.push_back(threadObj);
- }
-
- // generate objects to monitor
- QGeoAreaMonitorInfo infoRectangle("Rectangle");
- infoRectangle.setArea(QGeoRectangle(QGeoCoordinate(-27.65, 153.093), 0.2, 0.2));
- QVERIFY(infoRectangle.isValid());
- QVERIFY(obj->startMonitoring(infoRectangle));
-
- QGeoAreaMonitorInfo infoCircle("Circle");
- infoCircle.setArea(QGeoCircle(QGeoCoordinate(-27.70, 153.093), 10000));
- QVERIFY(infoCircle.isValid());
- QVERIFY(obj->startMonitoring(infoCircle));
-
- QGeoAreaMonitorInfo singleShot_enter("SingleShot_on_Entered");
- singleShot_enter.setArea(QGeoRectangle(QGeoCoordinate(-27.67, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_enter.isValid());
- QVERIFY(obj->requestUpdate(singleShot_enter,
- SIGNAL(areaEntered(QGeoAreaMonitorInfo, QGeoPositionInfo))));
-
- QGeoAreaMonitorInfo singleShot_exit("SingleShot_on_Exited");
- singleShot_exit.setArea(QGeoRectangle(QGeoCoordinate(-27.70, 153.093), 0.2, 0.2));
- QVERIFY(singleShot_exit.isValid());
- QVERIFY(obj->requestUpdate(singleShot_exit,
- SIGNAL(areaExited(QGeoAreaMonitorInfo, QGeoPositionInfo))));
-
- // wait until we read all data
- QTRY_COMPARE_WITH_TIMEOUT(noDataSpy.count(), 1, 5000);
-
- // first request all the threads to terminate
- for (int i = 0; i < threadCount; ++i)
- threads[i]->stopProcessing();
-
- static const int Number_Of_Entered_Events = 6;
- static const int Number_Of_Exited_Events = 5;
- // wait until each thread is stopped, and compare the result values
- for (int i = 0; i < threadCount; ++i) {
- threads[i]->wait();
- QCOMPARE(threads[i]->detectedEnterCount(), Number_Of_Entered_Events);
- QCOMPARE(threads[i]->detectedExitCount(), Number_Of_Exited_Events);
- }
-
- // Verify that the source started and stopped updates only once.
- // This is needed to check that the connection tracking logic in
- // connectNotify()/disconnectNotify() is working properly.
- QCOMPARE(updatesStartedSpy.count(), 1);
- QCOMPARE(updatesStoppedSpy.count(), 1);
- }
-
- void backendProperties()
- {
- std::unique_ptr<QGeoAreaMonitorSource> obj = std::make_unique<DummyMonitorSource>();
-
- const QString invalidProperty = "SomePropertyName";
-
- QCOMPARE(obj->backendProperty(DummyMonitorSource::kTestProperty), 0);
- QCOMPARE(obj->backendProperty(invalidProperty), QVariant());
-
- QVERIFY(obj->setBackendProperty(DummyMonitorSource::kTestProperty, 10));
- QVERIFY(!obj->setBackendProperty(invalidProperty, 15));
-
- QCOMPARE(obj->backendProperty(DummyMonitorSource::kTestProperty), 10);
- QCOMPARE(obj->backendProperty(invalidProperty), QVariant());
- }
-};
-
-
-QTEST_GUILESS_MAIN(tst_QGeoAreaMonitorSource)
-#include "tst_qgeoareamonitor.moc"
diff --git a/tests/auto/qgeocircle/CMakeLists.txt b/tests/auto/qgeocircle/CMakeLists.txt
deleted file mode 100644
index 18b1266b..00000000
--- a/tests/auto/qgeocircle/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeocircle.pro.
-
-#####################################################################
-## tst_qgeocircle Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeocircle
- SOURCES
- tst_qgeocircle.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeocircle.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeocircle/qgeocircle.pro b/tests/auto/qgeocircle/qgeocircle.pro
deleted file mode 100644
index eb56a7fc..00000000
--- a/tests/auto/qgeocircle/qgeocircle.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeocircle
-
-SOURCES += \
- tst_qgeocircle.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeocircle/tst_qgeocircle.cpp b/tests/auto/qgeocircle/tst_qgeocircle.cpp
deleted file mode 100644
index f3ff436f..00000000
--- a/tests/auto/qgeocircle/tst_qgeocircle.cpp
+++ /dev/null
@@ -1,473 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoRectangle>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoCircle : public QObject
-{
- Q_OBJECT
-
-private slots:
- void defaultConstructor();
- void centerRadiusConstructor();
- void assignment();
-
- void comparison();
- void type();
-
- void radius();
- void center();
-
- void translate_data();
- void translate();
-
- void valid_data();
- void valid();
-
- void empty_data();
- void empty();
-
- void contains_data();
- void contains();
-
- void boundingGeoRectangle_data();
- void boundingGeoRectangle();
-
- void extendCircle();
- void extendCircle_data();
-
- void areaComparison();
- void areaComparison_data();
-
- void boxComparison();
- void boxComparison_data();
-
- void hashing();
-};
-
-void tst_QGeoCircle::defaultConstructor()
-{
- QGeoCircle c;
- QVERIFY(!c.center().isValid());
- QCOMPARE(c.radius(), qreal(-1.0));
-}
-
-void tst_QGeoCircle::centerRadiusConstructor()
-{
- QGeoCircle c(QGeoCoordinate(1,1), qreal(50.0));
- QCOMPARE(c.center(), QGeoCoordinate(1,1));
- QCOMPARE(c.radius(), qreal(50.0));
-}
-
-void tst_QGeoCircle::assignment()
-{
- QGeoCircle c1 = QGeoCircle(QGeoCoordinate(10.0, 0.0), 20.0);
- QGeoCircle c2 = QGeoCircle(QGeoCoordinate(20.0, 0.0), 30.0);
-
- QVERIFY(c1 != c2);
-
- c2 = c1;
- QCOMPARE(c2.center(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(c2.radius(), 20.0);
- QCOMPARE(c1, c2);
-
- c2.setCenter(QGeoCoordinate(30.0, 0.0));
- c2.setRadius(15.0);
- QCOMPARE(c1.center(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(c1.radius(), 20.0);
-
- // Assign c1 to an area
- QGeoShape area = c1;
- QCOMPARE(area.type(), c1.type());
- QVERIFY(area == c1);
-
- // Assign the area back to a bounding circle
- QGeoCircle ca = area;
- QCOMPARE(ca.center(), c1.center());
- QCOMPARE(ca.radius(), c1.radius());
-
- // Check that the copy is not modified when modifying the original.
- c1.setCenter(QGeoCoordinate(15.0, 15.0));
- QVERIFY(ca.center() != c1.center());
- QVERIFY(ca != c1);
-}
-
-void tst_QGeoCircle::comparison()
-{
- QGeoCircle c1(QGeoCoordinate(1,1), qreal(50.0));
- QGeoCircle c2(QGeoCoordinate(1,1), qreal(50.0));
- QGeoCircle c3(QGeoCoordinate(1,1), qreal(35.0));
- QGeoCircle c4(QGeoCoordinate(1,2), qreal(50.0));
-
- QVERIFY(c1 == c2);
- QVERIFY(!(c1 != c2));
-
- QVERIFY(!(c1 == c3));
- QVERIFY(c1 != c3);
-
- QVERIFY(!(c1 == c4));
- QVERIFY(c1 != c4);
-
- QVERIFY(!(c2 == c3));
- QVERIFY(c2 != c3);
-
- QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
- QVERIFY(!(c1 == b1));
- QVERIFY(c1 != b1);
-
- QGeoShape *c2Ptr = &c2;
- QVERIFY(c1 == *c2Ptr);
- QVERIFY(!(c1 != *c2Ptr));
-
- QGeoShape *c3Ptr = &c3;
- QVERIFY(!(c1 == *c3Ptr));
- QVERIFY(c1 != *c3Ptr);
-}
-
-void tst_QGeoCircle::type()
-{
- QGeoCircle c;
- QCOMPARE(c.type(), QGeoShape::CircleType);
-}
-
-void tst_QGeoCircle::radius()
-{
- QGeoCircle c;
- c.setRadius(1.0);
- QCOMPARE(c.radius(), qreal(1.0));
- c.setRadius(5.0);
- QCOMPARE(c.radius(), qreal(5.0));
-}
-
-void tst_QGeoCircle::center()
-{
- QGeoCircle c;
- c.setCenter(QGeoCoordinate(1,1));
- QCOMPARE(c.center(), QGeoCoordinate(1,1));
-
- QGeoShape shape = c;
- QCOMPARE(shape.center(), c.center());
-
- c.setCenter(QGeoCoordinate(5,10));
- QCOMPARE(c.center(), QGeoCoordinate(5,10));
-}
-
-void tst_QGeoCircle::translate_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<double>("lat");
- QTest::addColumn<double>("lon");
- QTest::addColumn<QGeoCoordinate>("newCenter");
-
- QTest::newRow("from 0,0") << QGeoCoordinate(0,0) << qreal(10.0) <<
- 5.0 << 5.0 << QGeoCoordinate(5.0, 5.0);
- QTest::newRow("across 0,0") << QGeoCoordinate(-2, -2) << qreal(20.0) <<
- 5.0 << 5.0 << QGeoCoordinate(3.0, 3.0);
- QTest::newRow("backwards across 0,0") << QGeoCoordinate(5,5) << qreal(50.0)
- << -13.0 << 5.0
- << QGeoCoordinate(-8.0, 10.0);
-}
-
-void tst_QGeoCircle::translate()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(double, lat);
- QFETCH(double, lon);
- QFETCH(QGeoCoordinate, newCenter);
-
- QGeoCircle c(center, radius);
- QGeoCircle d = c;
-
- c.translate(lat, lon);
-
- QCOMPARE(c.radius(), radius);
- QCOMPARE(c.center(), newCenter);
-
- c = d.translated(lat, lon);
- d.setRadius(1.0);
-
- QCOMPARE(c.radius(), radius);
- QCOMPARE(d.center(), center);
- QCOMPARE(c.center(), newCenter);
-}
-
-void tst_QGeoCircle::valid_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("default") << QGeoCoordinate() << qreal(-1.0) << false;
- QTest::newRow("empty coord") << QGeoCoordinate() << qreal(5.0) << false;
- QTest::newRow("NaN coord") << QGeoCoordinate(500, 500) << qreal(5.0) << false;
- QTest::newRow("bad radius") << QGeoCoordinate(10, 10) << qreal(-5.0) << false;
- QTest::newRow("NaN radius") << QGeoCoordinate(10, 10) << qreal(qQNaN()) << false;
- QTest::newRow("zero radius") << QGeoCoordinate(10, 10) << qreal(0.0) << true;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << qreal(5.0) << true;
-}
-
-void tst_QGeoCircle::valid()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(bool, valid);
-
- QGeoCircle c(center, radius);
- QCOMPARE(c.isValid(), valid);
-
- QGeoShape area = c;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoCircle::empty_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<bool>("empty");
-
- QTest::newRow("default") << QGeoCoordinate() << qreal(-1.0) << true;
- QTest::newRow("empty coord") << QGeoCoordinate() << qreal(5.0) << true;
- QTest::newRow("NaN coord") << QGeoCoordinate(500, 500) << qreal(5.0) << true;
- QTest::newRow("bad radius") << QGeoCoordinate(10, 10) << qreal(-5.0) << true;
- QTest::newRow("NaN radius") << QGeoCoordinate(10, 10) << qreal(qQNaN()) << true;
- QTest::newRow("zero radius") << QGeoCoordinate(10, 10) << qreal(0.0) << true;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << qreal(5.0) << false;
-}
-
-void tst_QGeoCircle::empty()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(bool, empty);
-
- QGeoCircle c(center, radius);
- QCOMPARE(c.isEmpty(), empty);
-
- QGeoShape area = c;
- QCOMPARE(area.isEmpty(), empty);
-}
-
-void tst_QGeoCircle::contains_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("own center") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1,1) << true;
- QTest::newRow("over the hills") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(30, 40) << false;
- QTest::newRow("at 0.5*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00015374,1.00015274) << true;
- QTest::newRow("at 0.99*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00077538, 0.99955527) << true;
- QTest::newRow("at 1.01*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00071413, 0.99943423) << false;
- // TODO: add tests for edge circle cases: cross 1 pole, cross both poles
-}
-
-void tst_QGeoCircle::contains()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QGeoCircle c(center, radius);
- QCOMPARE(c.contains(probe), result);
-
- QGeoShape area = c;
- QCOMPARE(area.contains(probe), result);
-}
-
-void tst_QGeoCircle::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoCoordinate>("center");
- QTest::addColumn<qreal>("radius");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("own center") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1,1) << true;
- QTest::newRow("over the hills") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(30, 40) << false;
- QTest::newRow("at 0.5*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00015374,1.00015274) << true;
- QTest::newRow("at 0.99*radius") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00077538, 0.99955527) << true;
- QTest::newRow("Outside the box") << QGeoCoordinate(1,1) << qreal(100.0) <<
- QGeoCoordinate(1.00071413, 0.99903423) << false;
- // TODO: add tests for edge circle cases: cross 1 pole, cross both poles
-}
-
-void tst_QGeoCircle::boundingGeoRectangle()
-{
- QFETCH(QGeoCoordinate, center);
- QFETCH(qreal, radius);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QGeoCircle c(center, radius);
- QGeoRectangle box = c.boundingGeoRectangle();
- QCOMPARE(box.contains(probe), result);
-}
-
-void tst_QGeoCircle::extendCircle()
-{
- QFETCH(QGeoCircle, circle);
- QFETCH(QGeoCoordinate, coord);
- QFETCH(bool, containsFirst);
- QFETCH(bool, containsExtended);
-
- QCOMPARE(circle.contains(coord), containsFirst);
- circle.extendCircle(coord);
- QCOMPARE(circle.contains(coord), containsExtended);
-
-}
-
-void tst_QGeoCircle::extendCircle_data()
-{
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<bool>("containsFirst");
- QTest::addColumn<bool>("containsExtended");
-
- QGeoCoordinate co1(20.0, 20.0);
-
- QTest::newRow("own center")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(20.0, 20.0)
- << true
- << true;
- QTest::newRow("inside")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(20.0001, 20.0001)
- << true
- << true;
- QTest::newRow("far away")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(50.0001, 50.0001)
- << false
- << true;
- QTest::newRow("invalid circle")
- << QGeoCircle()
- << QGeoCoordinate(20.0, 20.0)
- << false
- << false;
- QTest::newRow("invalid coordinate")
- << QGeoCircle(co1, 100)
- << QGeoCoordinate(99.0, 190.0)
- << false
- << false;
-}
-
-void tst_QGeoCircle::areaComparison_data()
-{
- QTest::addColumn<QGeoShape>("area");
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<bool>("equal");
-
- QGeoCircle c1(QGeoCoordinate(10.0, 0.0), 10.0);
- QGeoCircle c2(QGeoCoordinate(20.0, 10.0), 20.0);
- QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
-
- QTest::newRow("default constructed") << QGeoShape() << QGeoCircle() << false;
- QTest::newRow("c1 c1") << QGeoShape(c1) << c1 << true;
- QTest::newRow("c1 c2") << QGeoShape(c1) << c2 << false;
- QTest::newRow("c2 c1") << QGeoShape(c2) << c1 << false;
- QTest::newRow("c2 c2") << QGeoShape(c2) << c2 << true;
- QTest::newRow("b c1") << QGeoShape(b) << c1 << false;
-}
-
-void tst_QGeoCircle::areaComparison()
-{
- QFETCH(QGeoShape, area);
- QFETCH(QGeoCircle, circle);
- QFETCH(bool, equal);
-
- QCOMPARE((area == circle), equal);
- QCOMPARE((area != circle), !equal);
-
- QCOMPARE((circle == area), equal);
- QCOMPARE((circle != area), !equal);
-}
-
-void tst_QGeoCircle::boxComparison_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<bool>("equal");
-
- QGeoCircle c(QGeoCoordinate(10.0, 0.0), 10.0);
- QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
-
- QTest::newRow("default constructed") << QGeoRectangle() << QGeoCircle() << false;
- QTest::newRow("b c") << b << c << false;
-}
-
-void tst_QGeoCircle::boxComparison()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCircle, circle);
- QFETCH(bool, equal);
-
- QCOMPARE((box == circle), equal);
- QCOMPARE((box != circle), !equal);
-
- QCOMPARE((circle == box), equal);
- QCOMPARE((circle != box), !equal);
-}
-
-void tst_QGeoCircle::hashing()
-{
- const QGeoCircle circle(QGeoCoordinate(1, 1), 10);
- const size_t circleHash = qHash(circle);
-
- QGeoCircle otherCenterCircle = circle;
- otherCenterCircle.setCenter(QGeoCoordinate(1, 2));
- QVERIFY(qHash(otherCenterCircle) != circleHash);
-
- QGeoCircle otherRadiusCircle = circle;
- otherRadiusCircle.setRadius(100);
- QVERIFY(qHash(otherRadiusCircle) != circleHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoCircle similarCircle(QGeoCoordinate(1, 1), 10);
- QCOMPARE(qHash(similarCircle), circleHash);
-}
-
-QTEST_MAIN(tst_QGeoCircle)
-#include "tst_qgeocircle.moc"
diff --git a/tests/auto/qgeocoordinate/CMakeLists.txt b/tests/auto/qgeocoordinate/CMakeLists.txt
deleted file mode 100644
index dd216a05..00000000
--- a/tests/auto/qgeocoordinate/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qgeocoordinate.pro.
-
-#####################################################################
-## tst_qgeocoordinate Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeocoordinate
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- tst_qgeocoordinate.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
diff --git a/tests/auto/qgeocoordinate/qgeocoordinate.pro b/tests/auto/qgeocoordinate/qgeocoordinate.pro
deleted file mode 100644
index 52795e16..00000000
--- a/tests/auto/qgeocoordinate/qgeocoordinate.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qgeocoordinate
-
-HEADERS += ../utils/qlocationtestutils_p.h
-SOURCES += tst_qgeocoordinate.cpp \
- ../utils/qlocationtestutils.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
deleted file mode 100644
index 828b2ef4..00000000
--- a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp
+++ /dev/null
@@ -1,1000 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "../utils/qlocationtestutils_p.h"
-
-#include <QtPositioning/qgeocoordinate.h>
-#include <qtest.h>
-
-#include <QMetaType>
-#include <QDebug>
-
-#include <float.h>
-
-QT_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoCoordinate::CoordinateFormat)
-Q_DECLARE_METATYPE(QGeoCoordinate::CoordinateType)
-
-static const QGeoCoordinate BRISBANE(-27.46758, 153.027892);
-static const QGeoCoordinate MELBOURNE(-37.814251, 144.963169);
-static const QGeoCoordinate LONDON(51.500152, -0.126236);
-static const QGeoCoordinate NEW_YORK(40.71453, -74.00713);
-static const QGeoCoordinate NORTH_POLE(90, 0);
-static const QGeoCoordinate SOUTH_POLE(-90, 0);
-
-static const QChar DEGREES_SYMB(0x00B0);
-
-
-QByteArray tst_qgeocoordinate_debug;
-
-void tst_qgeocoordinate_messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeocoordinate_debug = msg.toLocal8Bit();
- break;
- default:
- break;
- }
-}
-
-
-class tst_QGeoCoordinate : public QObject
-{
- Q_OBJECT
-
-private:
- enum TestDataType {
- Latitude,
- Longitude,
- Altitude
- };
-
-private slots:
- void initTestcase()
- {
- qRegisterMetaType<QGeoCoordinate>();
- }
-
- void constructor()
- {
- QGeoCoordinate c;
- QVERIFY(!c.isValid());
- QCOMPARE(c, QGeoCoordinate());
- }
-
- void constructor_lat_long()
- {
- QFETCH(double, latitude);
- QFETCH(double, longitude);
- QFETCH(QGeoCoordinate::CoordinateType, type);
-
- QGeoCoordinate c(latitude, longitude);
- QCOMPARE(c.type(), type);
- if (type != QGeoCoordinate::InvalidCoordinate) {
- QVERIFY(c.isValid());
- QCOMPARE(c.latitude(), latitude);
- QCOMPARE(c.longitude(), longitude);
- } else {
- QVERIFY(!c.isValid());
- QVERIFY(c.latitude() != latitude);
- QVERIFY(c.longitude() != longitude);
- }
- }
-
- void constructor_lat_long_data()
- {
- QTest::addColumn<double>("latitude");
- QTest::addColumn<double>("longitude");
- QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
-
- QTest::newRow("both zero") << 0.0 << 0.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("both negative") << -1.0 << -1.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("both positive") << 1.0 << 1.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("latitude negative") << -1.0 << 1.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("longitude negative") << 1.0 << -1.0 << QGeoCoordinate::Coordinate2D;
-
- QTest::newRow("both too high") << 90.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("latitude too high") << 90.1 << 0.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("longitude too high") << 0.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
-
- QTest::newRow("both too low") << -90.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("latitude too low") << -90.1 << 0.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("longitude too low") << 0.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
-
- QTest::newRow("both not too high") << 90.0 << 180.0 << QGeoCoordinate::Coordinate2D;
- QTest::newRow("both not too low") << -90.0 << -180.0 << QGeoCoordinate::Coordinate2D;
-
- QTest::newRow("latitude too high and longitude too low") << 90.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("latitude too low and longitude too high") << -90.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
- }
-
- void constructor_lat_long_alt()
- {
- QFETCH(double, latitude);
- QFETCH(double, longitude);
- QFETCH(double, altitude);
- QFETCH(QGeoCoordinate::CoordinateType, type);
-
- QGeoCoordinate c(latitude, longitude, altitude);
- QCOMPARE(c.type(), type);
- if (type != QGeoCoordinate::InvalidCoordinate) {
- QCOMPARE(c.latitude(), latitude);
- QCOMPARE(c.longitude(), longitude);
- QCOMPARE(c.altitude(), altitude);
- } else {
- QVERIFY(!c.isValid());
- QVERIFY(c.latitude() != latitude);
- QVERIFY(c.longitude() != longitude);
- QVERIFY(c.altitude() != altitude);
- }
- }
-
- void constructor_lat_long_alt_data()
- {
- QTest::addColumn<double>("latitude");
- QTest::addColumn<double>("longitude");
- QTest::addColumn<double>("altitude");
- QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
-
- QTest::newRow("all zero") << 0.0 << 0.0 << 0.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("all negative") << -1.0 << -1.0 << -2.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("all positive") << 1.0 << 1.0 << 4.0 << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("latitude negative") << -1.0 << 1.0 << 1.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("longitude negative") << 1.0 << -1.0 << 1.0 << QGeoCoordinate::Coordinate3D;
- QTest::newRow("altitude negative") << 1.0 << 1.0 << -1.0 << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("altitude not too high") << 1.0 << 1.0 << DBL_MAX << QGeoCoordinate::Coordinate3D;
- QTest::newRow("altitude not too low") << 1.0 << 1.0 << DBL_MIN << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("all not too high") << 90.0 << 180.0 << DBL_MAX << QGeoCoordinate::Coordinate3D;
- QTest::newRow("all not too low") << -90.0 << -180.0 << DBL_MIN << QGeoCoordinate::Coordinate3D;
-
- QTest::newRow("all too high") << 90.1 << 180.1 << DBL_MAX << QGeoCoordinate::InvalidCoordinate;
- QTest::newRow("all too low") << -90.1 << -180.1 << DBL_MIN << QGeoCoordinate::InvalidCoordinate;
- }
-
- void copy_constructor()
- {
- QFETCH(QGeoCoordinate, c);
-
- QGeoCoordinate copy(c);
- QCOMPARE(copy.type(), c.type());
- if (c.type() != QGeoCoordinate::InvalidCoordinate) {
- QCOMPARE(copy.latitude(), c.latitude());
- QCOMPARE(copy.longitude(), c.longitude());
- if (c.type() == QGeoCoordinate::Coordinate3D)
- QCOMPARE(copy.altitude(), c.altitude());
- }
- }
-
- void copy_constructor_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
-
- QTest::newRow("no argument") << QGeoCoordinate();
- QTest::newRow("latitude, longitude arguments all zero") << QGeoCoordinate(0.0, 0.0);
-
- QTest::newRow("latitude, longitude arguments not too high") << QGeoCoordinate(90.0, 180.0);
- QTest::newRow("latitude, longitude arguments not too low") << QGeoCoordinate(-90.0, -180.0);
- QTest::newRow("latitude, longitude arguments too high") << QGeoCoordinate(90.1, 180.1);
- QTest::newRow("latitude, longitude arguments too low") << QGeoCoordinate(-90.1, -180.1);
-
- QTest::newRow("latitude, longitude, altitude arguments all zero") << QGeoCoordinate(0.0, 0.0, 0.0);
- QTest::newRow("latitude, longitude, altitude arguments not too high values") << QGeoCoordinate(90.0, 180.0, DBL_MAX);
- QTest::newRow("latitude, longitude, altitude arguments not too low values") << QGeoCoordinate(-90.0, -180.0, DBL_MIN);
-
- QTest::newRow("latitude, longitude, altitude arguments too high latitude & longitude") << QGeoCoordinate(90.1, 180.1, DBL_MAX);
- QTest::newRow("latitude, longitude, altitude arguments too low latitude & longitude") << QGeoCoordinate(-90.1, -180.1, DBL_MAX);
- }
-
- void move_constructor()
- {
- QFETCH(QGeoCoordinate, c);
-
- const QGeoCoordinate coordinateCopy = c;
- QCOMPARE(std::move(c), coordinateCopy);
- }
-
- void move_constructor_data()
- {
- copy_constructor_data();
- }
-
- void destructor()
- {
- QGeoCoordinate *coordinate;
-
- coordinate = new QGeoCoordinate();
- delete coordinate;
-
- coordinate = new QGeoCoordinate(0.0, 0.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(0.0, 0.0, 0.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(90.0, 180.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(-90.0, -180.0);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(90.1, 180.1);
- delete coordinate;
-
- coordinate = new QGeoCoordinate(-90.1, -180.1);
- delete coordinate;
- }
-
- void destructor2()
- {
- QFETCH(QGeoCoordinate, c);
- QGeoCoordinate *coordinate = new QGeoCoordinate(c);
- delete coordinate;
- }
-
- void destructor2_data()
- {
- copy_constructor_data();
- }
-
- void assign()
- {
- QFETCH(QGeoCoordinate, c);
-
- QGeoCoordinate c1 = c;
- QCOMPARE(c.type(), c1.type());
- if (c.isValid()) {
- QCOMPARE(c.latitude(), c.latitude());
- QCOMPARE(c.longitude(), c.longitude());
- if (c.type() == QGeoCoordinate::Coordinate3D)
- QCOMPARE(c.altitude(), c.altitude());
- }
- }
-
- void assign_data()
- {
- copy_constructor_data();
- }
-
- void move_assign()
- {
- QFETCH(QGeoCoordinate, c);
-
- QGeoCoordinate copy = c;
-
- QGeoCoordinate otherCoordinate;
- otherCoordinate = std::move(c);
- QCOMPARE(otherCoordinate, copy);
-
- // check that (move)assinging to a moved-from object is fine
- c = std::move(copy);
- QCOMPARE(c, otherCoordinate);
- }
-
- void move_assign_data()
- {
- copy_constructor_data();
- }
-
- void comparison()
- {
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(bool, result);
-
- QCOMPARE(c1 == c2, result);
- QVariant v1 = QVariant::fromValue(c1);
- QVariant v2 = QVariant::fromValue(c2);
- QCOMPARE(v2 == v1, result);
- }
-
- void comparison_data()
- {
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("Invalid != BRISBANE")
- << QGeoCoordinate(-190,-1000) << BRISBANE << false;
- QTest::newRow("BRISBANE != MELBOURNE")
- << BRISBANE << MELBOURNE << false;
- QTest::newRow("equal")
- << BRISBANE << BRISBANE << true;
- QTest::newRow("LONDON != uninitialized data")
- << LONDON << QGeoCoordinate() << false;
- QTest::newRow("uninitialized data == uninitialized data")
- << QGeoCoordinate() << QGeoCoordinate() << true;
- QTest::newRow("invalid == same invalid")
- << QGeoCoordinate(-190,-1000) << QGeoCoordinate(-190,-1000) << true;
- QTest::newRow("invalid == different invalid")
- << QGeoCoordinate(-190,-1000) << QGeoCoordinate(190,1000) << true;
- QTest::newRow("valid != another valid")
- << QGeoCoordinate(-90,-180) << QGeoCoordinate(-45,+45) << false;
- QTest::newRow("valid == same valid")
- << QGeoCoordinate(-90,-180) << QGeoCoordinate(-90,-180) << true;
- QTest::newRow("different longitudes at north pole are equal")
- << QGeoCoordinate(90, 0) << QGeoCoordinate(90, 45) << true;
- QTest::newRow("different longitudes at south pole are equal")
- << QGeoCoordinate(-90, 0) << QGeoCoordinate(-90, 45) << true;
- }
-
- void type()
- {
- QFETCH(QGeoCoordinate, c);
- QFETCH(QGeoCoordinate::CoordinateType, type);
-
- QCOMPARE(c.type(), type);
- }
-
- void type_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
- QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
-
- QGeoCoordinate c;
-
- QTest::newRow("no values set") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setAltitude(1.0);
- QTest::newRow("only altitude is set") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLongitude(1.0);
- QTest::newRow("only latitude and altitude is set") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLatitude(-1.0);
- QTest::newRow("all valid: 3D Coordinate") << c << QGeoCoordinate::Coordinate3D;
-
- c.setLatitude(-90.1);
- QTest::newRow("too low latitude and valid longitude") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLongitude(-180.1);
- c.setLatitude(90.0);
- QTest::newRow("valid latitude and too low longitude") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLatitude(90.1);
- c.setLongitude(-180.0);
- QTest::newRow("too high latitude and valid longitude") << c << QGeoCoordinate::InvalidCoordinate;
-
- c.setLatitude(-90.0);
- c.setLongitude(180.1);
- QTest::newRow("valid latitude and too high longitude") << c << QGeoCoordinate::InvalidCoordinate;
- }
-
- void valid()
- {
- QFETCH(QGeoCoordinate, c);
- QCOMPARE(c.isValid(), c.type() != QGeoCoordinate::InvalidCoordinate);
- }
-
- void valid_data()
- {
- type_data();
- }
-
- void addDataValues(TestDataType type)
- {
- QTest::addColumn<double>("value");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("negative") << -1.0 << true;
- QTest::newRow("zero") << 0.0 << true;
- QTest::newRow("positive") << 1.0 << true;
-
- switch (type) {
- case Latitude:
- QTest::newRow("too low") << -90.1 << false;
- QTest::newRow("not too low") << -90.0 << true;
- QTest::newRow("not too hight") << 90.0 << true;
- QTest::newRow("too high") << 90.1;
- break;
- case Longitude:
- QTest::newRow("too low") << -180.1 << false;
- QTest::newRow("not too low") << -180.0 << true;
- QTest::newRow("not too hight") << 180.0 << true;
- QTest::newRow("too high") << 180.1;
- break;
- case Altitude:
- break;
- }
- }
-
- void latitude()
- {
- QFETCH(double, value);
- QGeoCoordinate c;
- c.setLatitude(value);
- QCOMPARE(c.latitude(), value);
-
- QGeoCoordinate c2 = c;
- QCOMPARE(c.latitude(), value);
- QCOMPARE(c2, c);
- }
- void latitude_data() { addDataValues(Latitude); }
-
- void longitude()
- {
- QFETCH(double, value);
- QGeoCoordinate c;
- c.setLongitude(value);
- QCOMPARE(c.longitude(), value);
-
- QGeoCoordinate c2 = c;
- QCOMPARE(c.longitude(), value);
- QCOMPARE(c2, c);
- }
- void longitude_data() { addDataValues(Longitude); }
-
- void altitude()
- {
- QFETCH(double, value);
- QGeoCoordinate c;
- c.setAltitude(value);
- QCOMPARE(c.altitude(), value);
-
- QGeoCoordinate c2 = c;
- QCOMPARE(c.altitude(), value);
- QCOMPARE(c2, c);
- }
- void altitude_data() { addDataValues(Altitude); }
-
- void distanceTo()
- {
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(qreal, distance);
-
- QCOMPARE(QString::number(c1.distanceTo(c2)), QString::number(distance));
- }
-
- void distanceTo_data()
- {
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<qreal>("distance");
-
- QTest::newRow("invalid coord 1")
- << QGeoCoordinate() << BRISBANE << qreal(0.0);
- QTest::newRow("invalid coord 2")
- << BRISBANE << QGeoCoordinate() << qreal(0.0);
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE << MELBOURNE << qreal(1374820.1618767744);
- QTest::newRow("london -> new york")
- << LONDON << NEW_YORK << qreal(5570538.4987236429);
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE << SOUTH_POLE << qreal(20015109.4154876769);
- }
-
- void azimuthTo()
- {
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(qreal, azimuth);
-
- qreal result = c1.azimuthTo(c2);
- QVERIFY(result >= 0.0);
- QVERIFY(result < 360.0);
- QCOMPARE(QString::number(result), QString::number(azimuth));
- }
-
- void azimuthTo_data()
- {
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<qreal>("azimuth");
-
- QTest::newRow("invalid coord 1")
- << QGeoCoordinate() << BRISBANE << qreal(0.0);
- QTest::newRow("invalid coord 2")
- << BRISBANE << QGeoCoordinate() << qreal(0.0);
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE << MELBOURNE << qreal(211.1717286649);
- QTest::newRow("london -> new york")
- << LONDON << NEW_YORK << qreal(288.3388804508);
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE << SOUTH_POLE << qreal(180.0);
- QTest::newRow("Almost 360degrees bearing")
- << QGeoCoordinate(0.5,45.0,0.0) << QGeoCoordinate(0.5,-134.9999651,0.0) << qreal(359.998);
- }
-
- void atDistanceAndAzimuth()
- {
- QFETCH(QGeoCoordinate, origin);
- QFETCH(qreal, distance);
- QFETCH(qreal, azimuth);
- QFETCH(QGeoCoordinate, result);
-
- QCOMPARE(result, origin.atDistanceAndAzimuth(distance, azimuth));
- }
-
- void atDistanceAndAzimuth_data()
- {
- QTest::addColumn<QGeoCoordinate>("origin");
- QTest::addColumn<qreal>("distance");
- QTest::addColumn<qreal>("azimuth");
- QTest::addColumn<QGeoCoordinate>("result");
-
- QTest::newRow("invalid coord")
- << QGeoCoordinate()
- << qreal(1000.0)
- << qreal(10.0)
- << QGeoCoordinate();
- if (sizeof(qreal) == sizeof(double)) {
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE
- << qreal(1374820.1618767744)
- << qreal(211.1717286649)
- << MELBOURNE;
- QTest::newRow("london -> new york")
- << LONDON
- << qreal(5570538.4987236429)
- << qreal(288.3388804508)
- << NEW_YORK;
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE
- << qreal(20015109.4154876769)
- << qreal(180.0)
- << SOUTH_POLE;
- } else {
- QTest::newRow("brisbane -> melbourne")
- << BRISBANE
- << qreal(1374820.1618767744)
- << qreal(211.1717286649)
- << QGeoCoordinate(-37.8142515084775, 144.963170622944);
- QTest::newRow("london -> new york")
- << LONDON
- << qreal(5570538.4987236429)
- << qreal(288.3388804508)
- << QGeoCoordinate(40.7145220608416, -74.0071216045375);
- QTest::newRow("north pole -> south pole")
- << NORTH_POLE
- << qreal(20015109.4154876769)
- << qreal(180.0)
- << QGeoCoordinate(-89.9999947369857, -90.0);
- }
- }
-
- void degreesToString()
- {
- QFETCH(QGeoCoordinate, coord);
- QFETCH(QGeoCoordinate::CoordinateFormat, format);
- QFETCH(QString, string);
-
- QCOMPARE(coord.toString(format), string);
- }
-
- void degreesToString_data()
- {
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<QGeoCoordinate::CoordinateFormat>("format");
- QTest::addColumn<QString>("string");
-
- QGeoCoordinate northEast(27.46758, 153.027892);
- QGeoCoordinate northEastWithAlt(27.46758, 153.027892, 28.23411);
- QGeoCoordinate southEast(-27.46758, 153.027892);
- QGeoCoordinate southEastWithAlt(-27.46758, 153.027892, 28.23411);
- QGeoCoordinate northWest(27.46758, -153.027892);
- QGeoCoordinate northWestWithAlt(27.46758, -153.027892, 28.23411);
- QGeoCoordinate southWest(-27.46758, -153.027892);
- QGeoCoordinate southWestWithAlt(-27.46758, -153.027892, 28.23411);
-
- QGeoCoordinate empty;
- QGeoCoordinate toohigh(90.1, 180.1);
- QGeoCoordinate toolow(-90.1, -180.1);
- QGeoCoordinate zeroLatLong(0.0, 0.0);
- QGeoCoordinate allZero(0.0, 0.0, 0.0);
-
- QTest::newRow("empty, dd, no hemisphere")
- << empty << QGeoCoordinate::Degrees
- << QString();
- QTest::newRow("empty, dd, hemisphere")
- << empty << QGeoCoordinate::DegreesWithHemisphere
- << QString();
- QTest::newRow("empty, dm, no hemisphere")
- << empty << QGeoCoordinate::DegreesMinutes
- << QString();
- QTest::newRow("empty, dm, hemisphere")
- << empty << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString();
- QTest::newRow("empty, dms, no hemisphere")
- << empty << QGeoCoordinate::DegreesMinutesSeconds
- << QString();
- QTest::newRow("empty, dms, hemisphere")
- << empty << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString();
-
- QTest::newRow("too low, dd, no hemisphere")
- << toolow << QGeoCoordinate::Degrees
- << QString();
- QTest::newRow("too low, dd, hemisphere")
- << toolow << QGeoCoordinate::DegreesWithHemisphere
- << QString();
- QTest::newRow("too low, dm, no hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutes
- << QString();
- QTest::newRow("too low, dm, hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString();
- QTest::newRow("too low, dms, no hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutesSeconds
- << QString();
- QTest::newRow("too low, dms, hemisphere")
- << toolow << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString();
-
- QTest::newRow("too high, dd, no hemisphere")
- << toohigh << QGeoCoordinate::Degrees
- << QString();
- QTest::newRow("too high, dd, hemisphere")
- << toohigh << QGeoCoordinate::DegreesWithHemisphere
- << QString();
- QTest::newRow("too high, dm, no hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutes
- << QString();
- QTest::newRow("too high, dm, hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString();
- QTest::newRow("too high, dms, no hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutesSeconds
- << QString();
- QTest::newRow("too high, dms, hemisphere")
- << toohigh << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString();
-
- QTest::newRow("zeroLatLong, dd, no hemisphere")
- << zeroLatLong << QGeoCoordinate::Degrees
- << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dd, hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesWithHemisphere
- << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dm, no hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutes
- << QString("0%1 0.000', 0%1 0.000'").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dm, hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("0%1 0.000', 0%1 0.000'").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dms, no hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutesSeconds
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB);
- QTest::newRow("zeroLatLong, dms, hemisphere")
- << zeroLatLong << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB);
-
- QTest::newRow("allZero, dd, no hemisphere")
- << allZero << QGeoCoordinate::Degrees
- << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dd, hemisphere")
- << allZero << QGeoCoordinate::DegreesWithHemisphere
- << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dm, no hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutes
- << QString("0%1 0.000', 0%1 0.000', 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dm, hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("0%1 0.000', 0%1 0.000', 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dms, no hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutesSeconds
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB);
- QTest::newRow("allZero, dms, hemisphere")
- << allZero << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB);
-
- QTest::newRow("NE, dd, no hemisphere")
- << northEast << QGeoCoordinate::Degrees
- << QString("27.46758%1, 153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("NE, dd, hemisphere")
- << northEast << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 E").arg(DEGREES_SYMB);
- QTest::newRow("NE, dm, no hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', 153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("NE, dm, hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' E").arg(DEGREES_SYMB);
- QTest::newRow("NE, dms, no hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", 153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("NE, dms, hemisphere")
- << northEast << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E").arg(DEGREES_SYMB);
-
- QTest::newRow("NE with alt, dd, no hemisphere")
- << northEastWithAlt << QGeoCoordinate::Degrees
- << QString("27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dd, hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dm, no hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', 153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dm, hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dms, no hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", 153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NE with alt, dms, hemisphere")
- << northEastWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);
-
- QTest::newRow("SE, dd, no hemisphere")
- << southEast << QGeoCoordinate::Degrees
- << QString("-27.46758%1, 153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("SE, dd, hemisphere")
- << southEast << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 E").arg(DEGREES_SYMB);
- QTest::newRow("SE, dm, no hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', 153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("SE, dm, hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' E").arg(DEGREES_SYMB);
- QTest::newRow("SE, dms, no hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", 153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("SE, dms, hemisphere")
- << southEast << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E").arg(DEGREES_SYMB);
-
- QTest::newRow("SE with alt, dd, no hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::Degrees
- << QString("-27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dd, hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dm, no hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', 153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dm, hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' E, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dms, no hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", 153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SE with alt, dms, hemisphere, 28.2341m")
- << southEastWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);;
-
- QTest::newRow("NW, dd, no hemisphere")
- << northWest << QGeoCoordinate::Degrees
- << QString("27.46758%1, -153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("NW, dd, hemisphere")
- << northWest << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 W").arg(DEGREES_SYMB);
- QTest::newRow("NW, dm, no hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', -153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("NW, dm, hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' W").arg(DEGREES_SYMB);
- QTest::newRow("NW, dms, no hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", -153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("NW, dms, hemisphere")
- << northWest << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W").arg(DEGREES_SYMB);
-
- QTest::newRow("NW with alt, dd, no hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::Degrees
- << QString("27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dd, hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 N, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dm, no hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("27%1 28.055', -153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dm, hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' N, 153%1 1.674' W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dms, no hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("27%1 28' 3.3\", -153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("NW with alt, dms, hemisphere, 28.2341m")
- << northWestWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB);
-
- QTest::newRow("SW, dd, no hemisphere")
- << southWest << QGeoCoordinate::Degrees
- << QString("-27.46758%1, -153.02789%1").arg(DEGREES_SYMB);
- QTest::newRow("SW, dd, hemisphere")
- << southWest << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 W").arg(DEGREES_SYMB);
- QTest::newRow("SW, dm, no hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', -153%1 1.674'").arg(DEGREES_SYMB);
- QTest::newRow("SW, dm, hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' W").arg(DEGREES_SYMB);
- QTest::newRow("SW, dms, no hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", -153%1 1' 40.4\"").arg(DEGREES_SYMB);
- QTest::newRow("SW, dms, hemisphere")
- << southWest << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W").arg(DEGREES_SYMB);
-
- QTest::newRow("SW with alt, dd, no hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::Degrees
- << QString("-27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dd, hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesWithHemisphere
- << QString("27.46758%1 S, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dm, no hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutes
- << QString("-27%1 28.055', -153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dm, hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString("27%1 28.055' S, 153%1 1.674' W, 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dms, no hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutesSeconds
- << QString("-27%1 28' 3.3\", -153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
- QTest::newRow("SW with alt, dms, hemisphere, 28.2341m")
- << southWestWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB);
-
- QTest::newRow("Wrap seconds to Minutes DMSH")
- << QGeoCoordinate(1.1333333, 1.1333333) << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
- << QString( "1%1 8' 0.0\" N, 1%1 8' 0.0\" E").arg(DEGREES_SYMB);
- QTest::newRow("Wrap seconds to Minutes DMS")
- << QGeoCoordinate(1.1333333, 1.1333333) << QGeoCoordinate::DegreesMinutesSeconds
- << QString( "1%1 8' 0.0\", 1%1 8' 0.0\"").arg(DEGREES_SYMB);
- QTest::newRow("Wrap minutes to Degrees DMH")
- << QGeoCoordinate(1.999999, 1.999999) << QGeoCoordinate::DegreesMinutesWithHemisphere
- << QString( "2%1 0.000' N, 2%1 0.000' E").arg(DEGREES_SYMB);
- QTest::newRow("Wrap minutes to Degrees DM")
- << QGeoCoordinate(1.999999, 1.999999) << QGeoCoordinate::DegreesMinutes
- << QString( "2%1 0.000', 2%1 0.000'").arg(DEGREES_SYMB);
-
- QTest::newRow("Wrap seconds to minutes to Degrees DM -> above valid long/lat values")
- << QGeoCoordinate(89.999999, 179.999999) << QGeoCoordinate::DegreesMinutesSeconds
- << QString( "90%1 0' 0.0\", 180%1 0' 0.0\"").arg(DEGREES_SYMB);
-
- QTest::newRow("Seconds and minutes near valid long/lat values border")
- << QGeoCoordinate(89.9999, 179.9999) << QGeoCoordinate::DegreesMinutesSeconds
- << QString("89%1 59' 59.6\", 179%1 59' 59.6\"").arg(DEGREES_SYMB);
-
- QTest::newRow("Wrap minutes to Degrees DM ->above valid long/lat values")
- << QGeoCoordinate(89.999999, 179.999999) << QGeoCoordinate::DegreesMinutes
- << QString( "90%1 0.000', 180%1 0.000'").arg(DEGREES_SYMB);
-
- QTest::newRow("Minutes near valid long/lat values border")
- << QGeoCoordinate(89.9999, 179.9999) << QGeoCoordinate::DegreesMinutes
- << QString("89%1 59.994', 179%1 59.994'").arg(DEGREES_SYMB);
-
- QTest::newRow("Fix incorrect wrap minutes to degrees")
- << QGeoCoordinate(0.995833, 0.995833) << QGeoCoordinate::DegreesMinutes
- << QString("0%1 59.750', 0%1 59.750'").arg(DEGREES_SYMB);
-
- QTest::newRow("Fix incorrect wrap seconds to minutes")
- << QGeoCoordinate(0.9832222, 0.9832222) << QGeoCoordinate::DegreesMinutesSeconds
- << QString("0%1 58' 59.6\", 0%1 58' 59.6\"").arg(DEGREES_SYMB);
-
- }
-
- void datastream()
- {
- QFETCH(QGeoCoordinate, c);
-
- QByteArray ba;
- QDataStream out(&ba, QIODevice::WriteOnly);
- out << c;
-
- QDataStream in(&ba, QIODevice::ReadOnly);
- QGeoCoordinate inCoord;
- in >> inCoord;
- QCOMPARE(inCoord, c);
- }
-
- void datastream_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
-
- QTest::newRow("invalid") << QGeoCoordinate();
- QTest::newRow("valid lat, long") << BRISBANE;
- QTest::newRow("valid lat, long, alt") << QGeoCoordinate(-1, -1, -1);
- QTest::newRow("valid lat, long, alt again") << QGeoCoordinate(1, 1, 1);
- }
-
- void debug()
- {
- QFETCH(QGeoCoordinate, c);
- QFETCH(int, nextValue);
- QFETCH(QByteArray, debugString);
-
- qInstallMessageHandler(tst_qgeocoordinate_messageHandler);
- qDebug() << c << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(tst_qgeocoordinate_debug, debugString);
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoCoordinate>("c");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QByteArray>("debugString");
-
- QTest::newRow("uninitialized") << QGeoCoordinate() << 45
- << QByteArray("QGeoCoordinate(?, ?) 45");
- QTest::newRow("initialized without altitude") << BRISBANE << 45
- << (QString("QGeoCoordinate(%1, %2) 45").arg(BRISBANE.latitude(), 0, 'g', 9)
- .arg(BRISBANE.longitude(), 0, 'g', 9)).toLatin1();
- QTest::newRow("invalid initialization") << QGeoCoordinate(-100,-200) << 45
- << QByteArray("QGeoCoordinate(?, ?) 45");
- QTest::newRow("initialized with altitude") << QGeoCoordinate(1,2,3) << 45
- << QByteArray("QGeoCoordinate(1, 2, 3) 45");
- QTest::newRow("extra long coordinates") << QGeoCoordinate(89.123412341, 179.123412341)
- << 45 << QByteArray("QGeoCoordinate(89.123412341, 179.12341234) 45");
- }
-
- void hash()
- {
- uint s1 = qHash(QGeoCoordinate(1, 1, 2));
- uint s2 = qHash(QGeoCoordinate(2, 1, 1));
- uint s3 = qHash(QGeoCoordinate(1, 2, 1));
- uint s10 = qHash(QGeoCoordinate(0, 0, 2));
- uint s20 = qHash(QGeoCoordinate(2, 0, 0));
- uint s30 = qHash(QGeoCoordinate(0, 2, 0));
- uint s30NoAlt = qHash(QGeoCoordinate(0, 2));
- uint s30WithSeed = qHash(QGeoCoordinate(0, 2, 0), 1);
- uint nullCoordinate = qHash(QGeoCoordinate());
-
- uint north1 = qHash(QGeoCoordinate(90.0, 34.7, 0));
- uint north2 = qHash(QGeoCoordinate(90.0, 180, 0));
-
- uint south1 = qHash(QGeoCoordinate(90.0, 67.7, 34.0));
- uint south2 = qHash(QGeoCoordinate(90.0, 111, 34.0));
-
- QVERIFY(s1 != s2);
- QVERIFY(s2 != s3);
- QVERIFY(s1 != s3);
- QVERIFY(s10 != s20);
- QVERIFY(s20 != s30);
- QVERIFY(s10 != s30);
- QVERIFY(s30NoAlt != s30);
- QVERIFY(s30WithSeed != s30);
-
- QVERIFY(nullCoordinate != s1);
- QVERIFY(nullCoordinate != s2);
- QVERIFY(nullCoordinate != s3);
- QVERIFY(nullCoordinate != s10);
- QVERIFY(nullCoordinate != s20);
- QVERIFY(nullCoordinate != s30);
- QVERIFY(nullCoordinate != s30NoAlt);
- QVERIFY(nullCoordinate != s30WithSeed);
-
- QVERIFY(north1 == north2);
- QVERIFY(south1 == south2);
- }
-};
-
-QTEST_GUILESS_MAIN(tst_QGeoCoordinate)
-#include "tst_qgeocoordinate.moc"
diff --git a/tests/auto/qgeocoordinateobject/CMakeLists.txt b/tests/auto/qgeocoordinateobject/CMakeLists.txt
deleted file mode 100644
index b8af5b9b..00000000
--- a/tests/auto/qgeocoordinateobject/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-qt_internal_add_test(tst_qgeocoordinateobject
- SOURCES
- tst_qgeocoordinateobject.cpp
- LIBRARIES
- Qt::Core
- Qt::PositioningPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp b/tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp
deleted file mode 100644
index aaf1920d..00000000
--- a/tests/auto/qgeocoordinateobject/tst_qgeocoordinateobject.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioning/private/qgeocoordinateobject_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoCoordinateObject : public QObject
-{
- Q_OBJECT
-private slots:
- void constructor();
- void equality();
- void equality_data();
- void coordinateBinding();
-};
-
-void tst_QGeoCoordinateObject::constructor()
-{
- QGeoCoordinateObject defaultConstructed;
- QCOMPARE(defaultConstructed.coordinate(), QGeoCoordinate());
-
- QGeoCoordinate c(1.0, 2.0, 3.0);
- QGeoCoordinateObject co(c);
- QCOMPARE(co.coordinate(), c);
-}
-
-void tst_QGeoCoordinateObject::equality()
-{
- QFETCH(QGeoCoordinate, lhs);
- QFETCH(QGeoCoordinate, rhs);
- QFETCH(bool, expectedResult);
-
- QGeoCoordinateObject leftObj(lhs);
- QGeoCoordinateObject rightObj(rhs);
-
- QVERIFY(leftObj == lhs);
- QVERIFY(rightObj == rhs);
-
- QCOMPARE(leftObj == rhs, expectedResult);
- QCOMPARE(leftObj != rhs, !expectedResult);
- QCOMPARE(rightObj == lhs, expectedResult);
- QCOMPARE(rightObj != lhs, !expectedResult);
- QCOMPARE(leftObj == rightObj, expectedResult);
- QCOMPARE(leftObj != rightObj, !expectedResult);
-}
-
-void tst_QGeoCoordinateObject::equality_data()
-{
- QTest::addColumn<QGeoCoordinate>("lhs");
- QTest::addColumn<QGeoCoordinate>("rhs");
- QTest::addColumn<bool>("expectedResult");
-
- QTest::newRow("two invalid") << QGeoCoordinate() << QGeoCoordinate() << true;
- QTest::newRow("same valid") << QGeoCoordinate(1.0, 2.0, 3.0) << QGeoCoordinate(1.0, 2.0, 3.0)
- << true;
- QTest::newRow("invalid vs valid") << QGeoCoordinate() << QGeoCoordinate(1.0, 2.0, 3.0) << false;
- QTest::newRow("different valid")
- << QGeoCoordinate(1.0, 2.0, 3.0) << QGeoCoordinate(2.0, 3.0, 4.0) << false;
-}
-
-void tst_QGeoCoordinateObject::coordinateBinding()
-{
- QGeoCoordinateObject obj;
- const QGeoCoordinate initial(1, 2, 3);
- const QGeoCoordinate changed(4, 5, 6);
- QTestPrivate::testReadWritePropertyBasics<QGeoCoordinateObject, QGeoCoordinate>(
- obj, initial, changed, "coordinate");
-}
-
-QTEST_GUILESS_MAIN(tst_QGeoCoordinateObject)
-#include "tst_qgeocoordinateobject.moc"
diff --git a/tests/auto/qgeolocation/CMakeLists.txt b/tests/auto/qgeolocation/CMakeLists.txt
deleted file mode 100644
index bb551612..00000000
--- a/tests/auto/qgeolocation/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qgeolocation.pro.
-
-#####################################################################
-## tst_qgeolocation Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeolocation
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- tst_qgeolocation.cpp tst_qgeolocation.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
diff --git a/tests/auto/qgeolocation/qgeolocation.pro b/tests/auto/qgeolocation/qgeolocation.pro
deleted file mode 100644
index 3b5b3a32..00000000
--- a/tests/auto/qgeolocation/qgeolocation.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qgeolocation
-
-HEADERS += ../utils/qlocationtestutils_p.h \
- tst_qgeolocation.h
-SOURCES += tst_qgeolocation.cpp \
- ../utils/qlocationtestutils.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeolocation/tst_qgeolocation.cpp b/tests/auto/qgeolocation/tst_qgeolocation.cpp
deleted file mode 100644
index 553d32cd..00000000
--- a/tests/auto/qgeolocation/tst_qgeolocation.cpp
+++ /dev/null
@@ -1,412 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tst_qgeolocation.h"
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoPolygon>
-
-QT_USE_NAMESPACE
-
-tst_QGeoLocation::tst_QGeoLocation()
-{
-}
-
-void tst_QGeoLocation::initTestCase()
-{
-
-}
-
-void tst_QGeoLocation::cleanupTestCase()
-{
-
-}
-
-void tst_QGeoLocation::init()
-{
-}
-
-void tst_QGeoLocation::cleanup()
-{
-}
-
-void tst_QGeoLocation::constructor()
-{
- QCOMPARE(m_location.address(), m_address);
- QCOMPARE(m_location.coordinate(), m_coordinate);
- QCOMPARE(m_location.boundingShape(), m_viewport);
- QCOMPARE(m_location.extendedAttributes(), m_extendedAttributes);
-}
-
-void tst_QGeoLocation::copy_constructor()
-{
- auto qgeolocationcopy = std::make_unique<QGeoLocation>(m_location);
- QCOMPARE(m_location, *qgeolocationcopy);
-}
-
-void tst_QGeoLocation::move_constructor()
-{
- QGeoAddress address;
- address.setCity("Berlin");
- address.setCountry("Germany");
- address.setCountryCode("DEU");
- address.setDistrict("Adlershof");
- address.setPostalCode("12489");
- address.setStreet("Erich-Thilo-Strasse");
-
- QGeoLocation location;
- location.setAddress(address);
- location.setCoordinate(QGeoCoordinate(1.3, 2.4, 3.1));
- location.setBoundingShape(QGeoCircle(QGeoCoordinate(1.3, 2.4), 100));
-
- QGeoLocation locationCopy = location;
- QCOMPARE(std::move(location), locationCopy);
-}
-
-void tst_QGeoLocation::move_assignment()
-{
- QGeoAddress address;
- address.setCity("Berlin");
- address.setCountry("Germany");
- address.setCountryCode("DEU");
- address.setDistrict("Adlershof");
- address.setPostalCode("12489");
- address.setStreet("Erich-Thilo-Strasse");
-
- QGeoLocation location;
- location.setAddress(address);
- location.setCoordinate(QGeoCoordinate(1.3, 2.4, 3.1));
- location.setBoundingShape(QGeoCircle(QGeoCoordinate(1.3, 2.4), 100));
-
- QGeoLocation locationCopy = location;
-
- QGeoLocation otherLocation;
- otherLocation = std::move(location);
- QCOMPARE(otherLocation, locationCopy);
-
- // Check that (move)assignment to a moved-from object is fine
- location = std::move(locationCopy);
- QCOMPARE(location, otherLocation);
-}
-
-void tst_QGeoLocation::destructor()
-{
- QGeoLocation *qgeolocationcopy;
-
- qgeolocationcopy = new QGeoLocation();
- delete qgeolocationcopy;
-
- qgeolocationcopy = new QGeoLocation(m_location);
- delete qgeolocationcopy;
-}
-
-void tst_QGeoLocation::address()
-{
- m_address.setCity("Berlin");
- m_address.setCountry("Germany");
- m_address.setCountryCode("DEU");
- m_address.setDistrict("Mitte");
- m_address.setPostalCode("10115");
- m_address.setStreet("Invalidenstrasse");
-
- m_location.setAddress(m_address);
-
- QCOMPARE(m_location.address(),m_address);
-
- m_address.setPostalCode("10125");
- QVERIFY(m_location.address() != m_address);
-}
-
-void tst_QGeoLocation::coordinate()
-{
- m_coordinate.setLatitude(13.3851);
- m_coordinate.setLongitude(52.5312);
- m_coordinate.setAltitude(134.23);
-
- m_location.setCoordinate(m_coordinate);
-
- QCOMPARE(m_location.coordinate(), m_coordinate);
-
- m_coordinate.setAltitude(0);
- QVERIFY(m_location.coordinate() != m_coordinate);
-}
-
-void tst_QGeoLocation::viewport()
-{
- m_coordinate.setLatitude(13.3851);
- m_coordinate.setLongitude(52.5312);
-
- // rectangle bounding box
- QGeoRectangle qgeoboundingboxcopy(m_coordinate, 0.4, 0.4);
- m_location.setBoundingShape(qgeoboundingboxcopy);
-
- QCOMPARE(m_location.boundingShape(), qgeoboundingboxcopy);
- // test that QGeoShape::boundingGeoRectangle() matches with
- // the qgeoboundingboxcopy. It simplifies code porting
- QCOMPARE(m_location.boundingShape().boundingGeoRectangle(), qgeoboundingboxcopy);
-
- qgeoboundingboxcopy.setHeight(1);
-
- QVERIFY(m_location.boundingShape() != qgeoboundingboxcopy);
-
- // circle bounding box
- QGeoCircle circle(m_coordinate, 10);
- m_location.setBoundingShape(circle);
-
- QCOMPARE(m_location.boundingShape(), circle);
-
- auto point = QGeoCoordinate(0.5, 0.5);
- QVERIFY(!circle.contains(point));
- circle.extendCircle(point);
-
- QVERIFY(m_location.boundingShape() != circle);
- QVERIFY(!m_location.boundingShape().contains(point));
-
- // polygon bounding box
- const QList<QGeoCoordinate> points = {QGeoCoordinate(1.0, 1.0), QGeoCoordinate(1.0, 2.0), QGeoCoordinate(2.0, 2.0)};
- QGeoPolygon polygon(points);
-
- point = QGeoCoordinate(1.75, 1.25);
- QVERIFY(!polygon.contains(point));
-
- m_location.setBoundingShape(polygon);
- QCOMPARE(m_location.boundingShape(), polygon);
-
- polygon.addCoordinate(QGeoCoordinate(2.0, 1.0));
- QVERIFY(m_location.boundingShape() != polygon);
- QVERIFY(polygon.contains(point));
- QVERIFY(!m_location.boundingShape().contains(point));
-}
-
-void tst_QGeoLocation::extendedAttributes()
-{
- m_extendedAttributes = QVariantMap({{ "foo" , 42 }});
- m_location.setExtendedAttributes(m_extendedAttributes);
- QCOMPARE(m_location.extendedAttributes(), m_extendedAttributes);
-
- m_extendedAttributes["foo"] = 41;
- QVERIFY(m_location.extendedAttributes() != m_extendedAttributes);
-}
-
-void tst_QGeoLocation::operators()
-{
- QGeoAddress qgeoaddresscopy;
- qgeoaddresscopy.setCity("Berlin");
- qgeoaddresscopy.setCountry("Germany");
- qgeoaddresscopy.setCountryCode("DEU");
-
- QGeoCoordinate qgeocoordinatecopy (32.324 , 41.324 , 24.55);
- QVariantMap extendedAttributesCopy {{ "foo" , 42 }};
-
- m_address.setCity("Madrid");
- m_address.setCountry("Spain");
- m_address.setCountryCode("SPA");
-
- m_coordinate.setLatitude(21.3434);
- m_coordinate.setLongitude(38.43443);
- m_coordinate.setAltitude(634.21);
-
- m_extendedAttributes["foo"] = 43;
-
- m_location.setAddress(m_address);
- m_location.setCoordinate(m_coordinate);
- m_location.setExtendedAttributes(m_extendedAttributes);
-
- //Create a copy and see that they are the same
- QGeoLocation qgeolocationcopy(m_location);
- QVERIFY(m_location == qgeolocationcopy);
- QVERIFY(!(m_location != qgeolocationcopy));
-
- //Modify one and test if they are different
- qgeolocationcopy.setAddress(qgeoaddresscopy);
- QVERIFY(!(m_location == qgeolocationcopy));
- QVERIFY(m_location != qgeolocationcopy);
- qgeolocationcopy.setAddress(m_address);
- qgeolocationcopy.setCoordinate(qgeocoordinatecopy);
- QVERIFY(!(m_location == qgeolocationcopy));
- QVERIFY(m_location != qgeolocationcopy);
- qgeolocationcopy.setCoordinate(m_coordinate);
- qgeolocationcopy.setExtendedAttributes(extendedAttributesCopy);
- QVERIFY(!(m_location == qgeolocationcopy));
- QVERIFY(m_location != qgeolocationcopy);
-
-
- //delete qgeolocationcopy;
- //Asign and test that they are the same
- qgeolocationcopy = m_location;
- QVERIFY(m_location ==qgeolocationcopy);
- QVERIFY(!(m_location != qgeolocationcopy));
-}
-
-void tst_QGeoLocation::comparison()
-{
- QFETCH(QString, dataField);
-
- QGeoLocation location;
-
- //set address
- QGeoAddress address;
- address.setStreet("21 jump st");
- address.setCountry("USA");
- location.setAddress(address);
-
- //set coordinate
- location.setCoordinate(QGeoCoordinate(5,10));
-
- //set viewport
- location.setBoundingShape(QGeoRectangle(QGeoCoordinate(5,5),0.4,0.4));
-
- QGeoLocation otherLocation(location);
-
- if (dataField == "no change") {
- QCOMPARE(location, otherLocation);
- } else {
- if (dataField == "address") {
- QGeoAddress otherAddress;
- otherAddress.setStreet("42 evergreen tce");
- otherAddress.setCountry("USA");
- otherLocation.setAddress(otherAddress);
- } else if (dataField == "coordinate") {
- otherLocation.setCoordinate(QGeoCoordinate(12,13));
- } else if (dataField == "viewport"){
- otherLocation.setBoundingShape(QGeoRectangle(QGeoCoordinate(1,2), 0.5,0.5));
- } else if (dataField == "extendedAttributes"){
- otherLocation.setExtendedAttributes(QVariantMap({{"foo", 44}}));
- } else {
- qFatal("Unknown data field to test");
- }
-
- QVERIFY(location != otherLocation);
- }
-}
-
-void tst_QGeoLocation::comparison_data()
-{
- QTest::addColumn<QString> ("dataField");
- QTest::newRow("no change") << "no change";
- QTest::newRow("address") << "address";
- QTest::newRow("coordinate") << "coordinate";
- QTest::newRow("extendedAttributes") << "extendedAttributes";
-}
-
-void tst_QGeoLocation::isEmpty()
-{
- QGeoAddress address;
- address.setCity(QStringLiteral("Braunschweig"));
- QVERIFY(!address.isEmpty());
-
- QGeoRectangle boundingBox;
- boundingBox.setTopLeft(QGeoCoordinate(1, -1));
- boundingBox.setBottomRight(QGeoCoordinate(-1, 1));
- QVERIFY(!boundingBox.isEmpty());
-
- QVariantMap extendedAttributes({{"foo", 11}});
-
- QGeoLocation location;
-
- QVERIFY(location.isEmpty());
-
- // address
- location.setAddress(address);
- QVERIFY(!location.isEmpty());
- location.setAddress(QGeoAddress());
- QVERIFY(location.isEmpty());
-
- // coordinate
- location.setCoordinate(QGeoCoordinate(1, 2));
- QVERIFY(!location.isEmpty());
- location.setCoordinate(QGeoCoordinate());
- QVERIFY(location.isEmpty());
-
- // bounding box
- location.setBoundingShape(boundingBox);
- QVERIFY(!location.isEmpty());
- location.setBoundingShape(QGeoRectangle());
- QVERIFY(location.isEmpty());
-
- // extended attributes
- location.setExtendedAttributes(extendedAttributes);
- QVERIFY(!location.isEmpty());
- location.setExtendedAttributes(QVariantMap());
- QVERIFY(location.isEmpty());
-}
-
-void tst_QGeoLocation::hashing()
-{
- QFETCH(QGeoLocation, leftLocation);
- QFETCH(QGeoLocation, rightLocation);
- QFETCH(bool, result);
-
- const size_t leftHash = qHash(leftLocation);
- const size_t rightHash = qHash(rightLocation);
- QCOMPARE(leftHash == rightHash, result);
-}
-
-void tst_QGeoLocation::hashing_data()
-{
- QTest::addColumn<QGeoLocation>("leftLocation");
- QTest::addColumn<QGeoLocation>("rightLocation");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("empty") << QGeoLocation() << QGeoLocation() << true;
-
- QGeoAddress address;
- address.setCity("city");
- address.setPostalCode("1234");
- address.setDistrict("district");
- address.setStreet("street");
- address.setStreetNumber("12");
-
- QGeoLocation leftLocation;
- leftLocation.setAddress(address);
- leftLocation.setCoordinate(QGeoCoordinate(1, 1));
- leftLocation.setBoundingShape(QGeoCircle(QGeoCoordinate(1, 1), 10));
-
- // do not copy, so that they have different d_ptr's
- QGeoLocation rightLocation;
- rightLocation.setAddress(address);
- rightLocation.setCoordinate(QGeoCoordinate(1, 1));
- rightLocation.setBoundingShape(QGeoCircle(QGeoCoordinate(1, 1), 10));
-
- QTest::newRow("same locations") << leftLocation << rightLocation << true;
-
- QGeoLocation rightLocationCopy = rightLocation;
- rightLocationCopy.setBoundingShape(QGeoRectangle(QGeoCoordinate(2, 0), QGeoCoordinate(0, 2)));
- QTest::newRow("different shapes") << leftLocation << rightLocationCopy << false;
-
- rightLocationCopy = rightLocation;
- rightLocationCopy.setCoordinate(QGeoCoordinate(2, 1));
- QTest::newRow("different coordinates") << leftLocation << rightLocationCopy << false;
-
- rightLocationCopy = rightLocation;
- address.setState("state");
- rightLocationCopy.setAddress(address);
- QTest::newRow("different addresses") << leftLocation << rightLocationCopy << false;
-}
-
-QTEST_APPLESS_MAIN(tst_QGeoLocation);
-
diff --git a/tests/auto/qgeolocation/tst_qgeolocation.h b/tests/auto/qgeolocation/tst_qgeolocation.h
deleted file mode 100644
index 28fae766..00000000
--- a/tests/auto/qgeolocation/tst_qgeolocation.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TST_QGEOLOCATION_H
-#define TST_QGEOLOCATION_H
-
-#include <QtCore/QString>
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-#include <QMetaType>
-
-#include "../utils/qlocationtestutils_p.h"
-#include <QtPositioning/qgeoaddress.h>
-#include <QtPositioning/qgeocoordinate.h>
-#include <QtPositioning/qgeolocation.h>
-#include <QtPositioning/QGeoRectangle>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoLocation : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QGeoLocation();
-
-private Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
- //Start Unit Tests for qgeolocation.h
- void constructor();
- void copy_constructor();
- void move_constructor();
- void move_assignment();
- void destructor();
- void address();
- void coordinate();
- void viewport();
- void extendedAttributes();
- void operators();
- void comparison();
- void comparison_data();
- void isEmpty();
- void hashing();
- void hashing_data();
- //End Unit Tests for qgeolocation.h
-
-private:
- QGeoLocation m_location;
-
- QGeoAddress m_address;
- QGeoCoordinate m_coordinate;
- QGeoShape m_viewport;
- QVariantMap m_extendedAttributes;
-};
-
-Q_DECLARE_METATYPE( QGeoCoordinate::CoordinateFormat);
-Q_DECLARE_METATYPE( QGeoCoordinate::CoordinateType);
-Q_DECLARE_METATYPE( QList<double>);
-
-#endif
-
diff --git a/tests/auto/qgeopath/CMakeLists.txt b/tests/auto/qgeopath/CMakeLists.txt
deleted file mode 100644
index b301c140..00000000
--- a/tests/auto/qgeopath/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeopath.pro.
-
-#####################################################################
-## tst_qgeopath Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopath
- SOURCES
- tst_qgeopath.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeopath.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeopath/qgeopath.pro b/tests/auto/qgeopath/qgeopath.pro
deleted file mode 100644
index eec05974..00000000
--- a/tests/auto/qgeopath/qgeopath.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeopath
-
-SOURCES += \
- tst_qgeopath.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopath/tst_qgeopath.cpp b/tests/auto/qgeopath/tst_qgeopath.cpp
deleted file mode 100644
index ccaef0d7..00000000
--- a/tests/auto/qgeopath/tst_qgeopath.cpp
+++ /dev/null
@@ -1,392 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoPath>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoPath : public QObject
-{
- Q_OBJECT
-
-private slots:
- void defaultConstructor();
- void listConstructor();
- void assignment();
-
- void comparison();
- void type();
-
- void path();
- void width();
- void size();
-
- void translate_data();
- void translate();
-
- void valid_data();
- void valid();
-
- void contains_data();
- void contains();
-
- void boundingGeoRectangle_data();
- void boundingGeoRectangle();
-
- void hashing();
-};
-
-void tst_QGeoPath::defaultConstructor()
-{
- QGeoPath p;
- QVERIFY(!p.path().size());
- QCOMPARE(p.width(), qreal(0.0));
- QCOMPARE(p.length(), double(0.0));
-}
-
-void tst_QGeoPath::listConstructor()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPath p(coords, 1.0);
- QCOMPARE(p.width(), qreal(1.0));
- QCOMPARE(p.path().size(), 3);
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.path().contains(c), true);
- }
-}
-
-void tst_QGeoPath::assignment()
-{
- QGeoPath p1;
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QGeoPath p2(coords, 1.0);
-
- QVERIFY(p1 != p2);
-
- p1 = p2;
- QCOMPARE(p1.path(), coords);
- QCOMPARE(p1.width(), 1.0);
- QCOMPARE(p1, p2);
-
- // Assign c1 to an area
- QGeoShape area = p1;
- QCOMPARE(area.type(), p1.type());
- QVERIFY(area == p1);
-
- // Assign the area back to a bounding circle
- QGeoPath p3 = area;
- QCOMPARE(p3.path(), coords);
- QCOMPARE(p3.width(), 1.0);
-
- // Check that the copy is not modified when modifying the original.
- p1.setWidth(2.0);
- QVERIFY(p3.width() != p1.width());
- QVERIFY(p3 != p1);
-}
-
-void tst_QGeoPath::comparison()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QList<QGeoCoordinate> coords2;
- coords2.append(QGeoCoordinate(3,1));
- coords2.append(QGeoCoordinate(4,2));
- coords2.append(QGeoCoordinate(3,0));
- QGeoPath c1(coords, qreal(50.0));
- QGeoPath c2(coords, qreal(50.0));
- QGeoPath c3(coords, qreal(35.0));
- QGeoPath c4(coords2, qreal(50.0));
-
- QVERIFY(c1 == c2);
- QVERIFY(!(c1 != c2));
-
- QVERIFY(!(c1 == c3));
- QVERIFY(c1 != c3);
-
- QVERIFY(!(c1 == c4));
- QVERIFY(c1 != c4);
-
- QVERIFY(!(c2 == c3));
- QVERIFY(c2 != c3);
-
- QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
- QVERIFY(!(c1 == b1));
- QVERIFY(c1 != b1);
-
- QGeoShape *c2Ptr = &c2;
- QVERIFY(c1 == *c2Ptr);
- QVERIFY(!(c1 != *c2Ptr));
-
- QGeoShape *c3Ptr = &c3;
- QVERIFY(!(c1 == *c3Ptr));
- QVERIFY(c1 != *c3Ptr);
-}
-
-void tst_QGeoPath::type()
-{
- QGeoPath c;
- QCOMPARE(c.type(), QGeoShape::PathType);
-}
-
-void tst_QGeoPath::path()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPath p;
- p.setPath(coords);
- QCOMPARE(p.path().size(), 3);
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.path().contains(c), true);
- }
-
- p.clearPath();
- QCOMPARE(p.path().size(), 0);
- QVERIFY(p.boundingGeoRectangle().isEmpty());
-}
-
-void tst_QGeoPath::width()
-{
- QGeoPath p;
- p.setWidth(10.0);
- QCOMPARE(p.width(), qreal(10.0));
-}
-
-void tst_QGeoPath::size()
-{
- QList<QGeoCoordinate> coords;
-
- QGeoPath p1(coords, 3);
- QCOMPARE(p1.size(), coords.size());
-
- coords.append(QGeoCoordinate(1,1));
- QGeoPath p2(coords, 3);
- QCOMPARE(p2.size(), coords.size());
-
- coords.append(QGeoCoordinate(2,2));
- QGeoPath p3(coords, 3);
- QCOMPARE(p3.size(), coords.size());
-
- coords.append(QGeoCoordinate(3,0));
- QGeoPath p4(coords, 3);
- QCOMPARE(p4.size(), coords.size());
-
- p4.removeCoordinate(2);
- QCOMPARE(p4.size(), coords.size() - 1);
-
- p4.removeCoordinate(coords.first());
- QCOMPARE(p4.size(), coords.size() - 2);
-}
-
-void tst_QGeoPath::translate_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<double>("lat");
- QTest::addColumn<double>("lon");
-
- QTest::newRow("Simple") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << 5.0 << 4.0;
- QTest::newRow("Backward") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << -5.0 << -4.0;
-}
-
-void tst_QGeoPath::translate()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(double, lat);
- QFETCH(double, lon);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords);
-
- p.translate(lat, lon);
-
- for (int i = 0; i < p.path().size(); i++) {
- QCOMPARE(coords[i].latitude(), p.path()[i].latitude() - lat );
- QCOMPARE(coords[i].longitude(), p.path()[i].longitude() - lon );
- }
-}
-
-void tst_QGeoPath::valid_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("empty coords") << QGeoCoordinate() << QGeoCoordinate() << QGeoCoordinate() << qreal(5.0) << false;
- QTest::newRow("invalid coord") << QGeoCoordinate(50, 50) << QGeoCoordinate(60, 60) << QGeoCoordinate(700, 700) << qreal(5.0) << false;
- QTest::newRow("bad width") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(-5.0) << true;
- QTest::newRow("NaN width") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(qQNaN()) << true;
- QTest::newRow("zero width") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(0) << true;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << qreal(5) << true;
-}
-
-void tst_QGeoPath::valid()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(bool, valid);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
- QCOMPARE(p.isValid(), valid);
-
- QGeoShape area = p;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoPath::contains_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0.8, 0.8) << false;
- QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0.8, 0.8) << true;
-}
-
-void tst_QGeoPath::contains()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
- QCOMPARE(p.contains(probe), result);
-
- QGeoShape area = p;
- QCOMPARE(area.contains(probe), result);
-}
-
-void tst_QGeoPath::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0, 0) << false;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << 100.0 << QGeoCoordinate(1, 0) << true;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << 100.0 << QGeoCoordinate(1.1, 0.1) << true;
-}
-
-void tst_QGeoPath::boundingGeoRectangle()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
- QGeoRectangle box = p.boundingGeoRectangle();
- QCOMPARE(box.contains(probe), result);
-}
-
-void tst_QGeoPath::hashing()
-{
- const QGeoPath path({ QGeoCoordinate(1, 1), QGeoCoordinate(1, 2), QGeoCoordinate(2, 5) }, 1.0);
- const size_t pathHash = qHash(path);
-
- QGeoPath otherCoordsPath = path;
- otherCoordsPath.addCoordinate(QGeoCoordinate(3, 5));
- QVERIFY(qHash(otherCoordsPath) != pathHash);
-
- QGeoPath otherWidthPath = path;
- otherWidthPath.setWidth(1.5);
- QVERIFY(qHash(otherWidthPath) != pathHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoPath similarPath({ QGeoCoordinate(1, 1), QGeoCoordinate(1, 2), QGeoCoordinate(2, 5) }, 1.0);
- QCOMPARE(qHash(similarPath), pathHash);
-}
-
-QTEST_MAIN(tst_QGeoPath)
-#include "tst_qgeopath.moc"
diff --git a/tests/auto/qgeopolygon/CMakeLists.txt b/tests/auto/qgeopolygon/CMakeLists.txt
deleted file mode 100644
index e38e2cab..00000000
--- a/tests/auto/qgeopolygon/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeopolygon.pro.
-
-#####################################################################
-## tst_qgeopolygon Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopolygon
- SOURCES
- tst_qgeopolygon.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeopolygon.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeopolygon/qgeopolygon.pro b/tests/auto/qgeopolygon/qgeopolygon.pro
deleted file mode 100644
index f6314ca4..00000000
--- a/tests/auto/qgeopolygon/qgeopolygon.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeopolygon
-
-SOURCES += \
- tst_qgeopolygon.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopolygon/tst_qgeopolygon.cpp b/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
deleted file mode 100644
index 8a8a8fd7..00000000
--- a/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoPolygon>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoPolygon : public QObject
-{
- Q_OBJECT
-
-private slots:
- void defaultConstructor();
- void listConstructor();
- void assignment();
-
- void comparison();
- void type();
-
- void path();
- void size();
-
- void translate_data();
- void translate();
-
- void valid_data();
- void valid();
-
- void contains_data();
- void contains();
-
- void boundingGeoRectangle_data();
- void boundingGeoRectangle();
-
- void hashing();
-};
-
-void tst_QGeoPolygon::defaultConstructor()
-{
- QGeoPolygon p;
- QVERIFY(!p.perimeter().size());
- QVERIFY(!p.size());
- QVERIFY(!p.isValid());
- QVERIFY(p.isEmpty());
-}
-
-void tst_QGeoPolygon::listConstructor()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- QGeoPolygon p2(coords);
- QCOMPARE(p2.perimeter().size(), 2);
- QCOMPARE(p2.size(), 2);
- QVERIFY(!p2.isValid()); // a polygon can't have only 2 coords
- QVERIFY(!p2.isEmpty());
-
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPolygon p(coords);
- QCOMPARE(p.perimeter().size(), 3);
- QCOMPARE(p.size(), 3);
- QVERIFY(p.isValid());
- QVERIFY(!p.isEmpty());
-
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.perimeter().contains(c), true);
- QCOMPARE(p.containsCoordinate(c), true);
- }
-}
-
-void tst_QGeoPolygon::assignment()
-{
- QGeoPolygon p1;
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QGeoPolygon p2(coords);
-
- QVERIFY(p1 != p2);
-
- p1 = p2;
- QCOMPARE(p1.perimeter(), coords);
- QCOMPARE(p1, p2);
-
- // Assign c1 to an area
- QGeoShape area = p1;
- QCOMPARE(area.type(), p1.type());
- QVERIFY(area == p1);
-
- // Assign the area back to a polygon
- QGeoPolygon p3 = area;
- QCOMPARE(p3.perimeter(), coords);
- QVERIFY(p3 == p1);
-
- // Check that the copy is not modified when modifying the original.
- p1.addCoordinate(QGeoCoordinate(4,0));
- QVERIFY(p3 != p1);
-}
-
-void tst_QGeoPolygon::comparison()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
- QList<QGeoCoordinate> coords2;
- coords2.append(QGeoCoordinate(3,1));
- coords2.append(QGeoCoordinate(4,2));
- coords2.append(QGeoCoordinate(3,0));
- QGeoPolygon c1(coords);
- QGeoPolygon c2(coords);
- QGeoPolygon c3(coords2);
-
- QVERIFY(c1 == c2);
- QVERIFY(!(c1 != c2));
-
- QVERIFY(!(c1 == c3));
- QVERIFY(c1 != c3);
-
- QVERIFY(!(c2 == c3));
- QVERIFY(c2 != c3);
-
- QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
- QVERIFY(!(c1 == b1));
- QVERIFY(c1 != b1);
-
- QGeoShape *c2Ptr = &c2;
- QVERIFY(c1 == *c2Ptr);
- QVERIFY(!(c1 != *c2Ptr));
-
- QGeoShape *c3Ptr = &c3;
- QVERIFY(!(c1 == *c3Ptr));
- QVERIFY(c1 != *c3Ptr);
-}
-
-void tst_QGeoPolygon::type()
-{
- QGeoPolygon c;
- QCOMPARE(c.type(), QGeoShape::PolygonType);
-}
-
-void tst_QGeoPolygon::path()
-{
- QList<QGeoCoordinate> coords;
- coords.append(QGeoCoordinate(1,1));
- coords.append(QGeoCoordinate(2,2));
- coords.append(QGeoCoordinate(3,0));
-
- QGeoPolygon p;
- p.setPerimeter(coords);
- QCOMPARE(p.perimeter().size(), 3);
- QCOMPARE(p.size(), 3);
-
- for (const QGeoCoordinate &c : coords) {
- QCOMPARE(p.perimeter().contains(c), true);
- QCOMPARE(p.containsCoordinate(c), true);
- }
-}
-
-void tst_QGeoPolygon::size()
-{
- QList<QGeoCoordinate> coords;
-
- QGeoPolygon p1(coords);
- QCOMPARE(p1.size(), coords.size());
-
- coords.append(QGeoCoordinate(1,1));
- QGeoPolygon p2(coords);
- QCOMPARE(p2.size(), coords.size());
-
- coords.append(QGeoCoordinate(2,2));
- QGeoPolygon p3(coords);
- QCOMPARE(p3.size(), coords.size());
-
- coords.append(QGeoCoordinate(3,0));
- QGeoPolygon p4(coords);
- QCOMPARE(p4.size(), coords.size());
-
- p4.removeCoordinate(2);
- QCOMPARE(p4.size(), coords.size() - 1);
-
- p4.removeCoordinate(coords.first());
- QCOMPARE(p4.size(), coords.size() - 2);
-}
-
-void tst_QGeoPolygon::translate_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<double>("lat");
- QTest::addColumn<double>("lon");
-
- QTest::newRow("Simple") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << 5.0 << 4.0;
- QTest::newRow("Backward") << QGeoCoordinate(1,1) << QGeoCoordinate(2,2) <<
- QGeoCoordinate(3,0) << -5.0 << -4.0;
-}
-
-void tst_QGeoPolygon::translate()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(double, lat);
- QFETCH(double, lon);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- p.translate(lat, lon);
-
- for (int i = 0; i < p.perimeter().size(); i++) {
- QCOMPARE(coords[i].latitude(), p.perimeter()[i].latitude() - lat );
- QCOMPARE(coords[i].longitude(), p.perimeter()[i].longitude() - lon );
- }
-}
-
-void tst_QGeoPolygon::valid_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("empty coords") << QGeoCoordinate() << QGeoCoordinate() << QGeoCoordinate() << false;
- QTest::newRow("invalid coord") << QGeoCoordinate(50, 50) << QGeoCoordinate(60, 60) << QGeoCoordinate(700, 700) << false;
- QTest::newRow("good") << QGeoCoordinate(10, 10) << QGeoCoordinate(11, 11) << QGeoCoordinate(10, 12) << true;
-}
-
-void tst_QGeoPolygon::valid()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(bool, valid);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- QCOMPARE(p.isValid(), valid);
-
- QGeoShape area = p;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoPolygon::contains_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << QGeoCoordinate(0.8, 0.8) << false;
- QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << QGeoCoordinate(0.8, 0.8) << false;
- QTest::newRow("Inside") << c[0] << c[1] << c[2] << QGeoCoordinate(2.0, 1.0) << true;
-}
-
-void tst_QGeoPolygon::contains()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- QCOMPARE(p.contains(probe), result);
-
- QGeoShape area = p;
- QCOMPARE(area.contains(probe), result);
-}
-
-void tst_QGeoPolygon::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("result");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << QGeoCoordinate(2, 2) << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << QGeoCoordinate(0, 0) << false;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << QGeoCoordinate(1, 0) << true;
- QTest::newRow("Inside the bounds") << c[0] << c[1] << c[2] << QGeoCoordinate(1.1, 0.1) << true;
-}
-
-void tst_QGeoPolygon::boundingGeoRectangle()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, result);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
- QGeoRectangle box = p.boundingGeoRectangle();
- QCOMPARE(box.contains(probe), result);
-}
-
-void tst_QGeoPolygon::hashing()
-{
- const QGeoPolygon polygon({ QGeoCoordinate(1, 1), QGeoCoordinate(2, 2),
- QGeoCoordinate(3, 0) });
- const size_t polygonHash = qHash(polygon);
-
- QGeoPolygon otherCoordsPolygon = polygon;
- otherCoordsPolygon.addCoordinate(QGeoCoordinate(4, 1));
- QVERIFY(qHash(otherCoordsPolygon) != polygonHash);
-
- QGeoPolygon otherHolesPolygon = polygon;
- otherHolesPolygon.addHole({ QGeoCoordinate(1.1, 1), QGeoCoordinate(2, 1.8),
- QGeoCoordinate(2, 1) });
- QVERIFY(qHash(otherHolesPolygon) != polygonHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoPolygon similarPolygon({ QGeoCoordinate(1, 1), QGeoCoordinate(2, 2),
- QGeoCoordinate(3, 0) });
- QCOMPARE(qHash(similarPolygon), polygonHash);
-}
-
-QTEST_MAIN(tst_QGeoPolygon)
-#include "tst_qgeopolygon.moc"
diff --git a/tests/auto/qgeopositioninfo/CMakeLists.txt b/tests/auto/qgeopositioninfo/CMakeLists.txt
deleted file mode 100644
index 3ce93cff..00000000
--- a/tests/auto/qgeopositioninfo/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeopositioninfo.pro.
-
-#####################################################################
-## tst_qgeopositioninfo Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopositioninfo
- SOURCES
- tst_qgeopositioninfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeopositioninfo.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeopositioninfo/qgeopositioninfo.pro b/tests/auto/qgeopositioninfo/qgeopositioninfo.pro
deleted file mode 100644
index f928c8bc..00000000
--- a/tests/auto/qgeopositioninfo/qgeopositioninfo.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_qgeopositioninfo
-
-SOURCES += tst_qgeopositioninfo.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
deleted file mode 100644
index 572359e2..00000000
--- a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtPositioning/qgeopositioninfo.h>
-
-#include <QMetaType>
-#include <QObject>
-#include <QDebug>
-#include <QTest>
-#include <QtCore/QtNumeric>
-
-#include <float.h>
-
-QT_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QGeoPositionInfo::Attribute)
-
-QByteArray tst_qgeopositioninfo_debug;
-
-void tst_qgeopositioninfo_messageHandler(QtMsgType type, const QMessageLogContext&, const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeopositioninfo_debug = msg.toLocal8Bit();
- break;
- default:
- break;
- }
-}
-
-QList<qreal> tst_qgeopositioninfo_qrealTestValues()
-{
- QList<qreal> values;
-
- if (qreal(DBL_MIN) == DBL_MIN)
- values << DBL_MIN;
-
- values << FLT_MIN;
- values << -1.0 << 0.0 << 1.0;
- values << FLT_MAX;
-
- if (qreal(DBL_MAX) == DBL_MAX)
- values << DBL_MAX;
-
- return values;
-}
-
-QList<QGeoPositionInfo::Attribute> tst_qgeopositioninfo_getAttributes()
-{
- QList<QGeoPositionInfo::Attribute> attributes;
- attributes << QGeoPositionInfo::Direction
- << QGeoPositionInfo::GroundSpeed
- << QGeoPositionInfo::VerticalSpeed
- << QGeoPositionInfo::MagneticVariation
- << QGeoPositionInfo::HorizontalAccuracy
- << QGeoPositionInfo::VerticalAccuracy;
- return attributes;
-}
-
-
-class tst_QGeoPositionInfo : public QObject
-{
- Q_OBJECT
-
-private:
- QGeoPositionInfo infoWithAttribute(QGeoPositionInfo::Attribute attribute, qreal value)
- {
- QGeoPositionInfo info;
- info.setAttribute(attribute, value);
- return info;
- }
-
- void addTestData_info()
- {
- QTest::addColumn<QGeoPositionInfo>("info");
-
- QTest::newRow("invalid") << QGeoPositionInfo();
-
- QTest::newRow("coord") << QGeoPositionInfo(QGeoCoordinate(-27.3422,150.2342), QDateTime());
- QTest::newRow("datetime") << QGeoPositionInfo(QGeoCoordinate(), QDateTime::currentDateTime());
-
- QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes();
- QList<qreal> values = tst_qgeopositioninfo_qrealTestValues();
- for (int i=0; i<attributes.count(); i++) {
- for (int j=0; j<values.count(); j++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j])))
- << infoWithAttribute(attributes[i], values[j]);
- }
- }
- }
-
-private slots:
- void constructor()
- {
- QGeoPositionInfo info;
- QVERIFY(!info.isValid());
- QVERIFY(!info.coordinate().isValid());
- QVERIFY(info.timestamp().isNull());
- }
-
- void constructor_coord_dateTime()
- {
- QFETCH(QGeoCoordinate, coord);
- QFETCH(QDateTime, dateTime);
- QFETCH(bool, valid);
-
- QGeoPositionInfo info(coord, dateTime);
- QCOMPARE(info.coordinate(), coord);
- QCOMPARE(info.timestamp(), dateTime);
- QCOMPARE(info.isValid(), valid);
- }
-
- void constructor_coord_dateTime_data()
- {
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<QDateTime>("dateTime");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("both null") << QGeoCoordinate() << QDateTime() << false;
- QTest::newRow("both valid") << QGeoCoordinate(1,1) << QDateTime::currentDateTime() << true;
- QTest::newRow("valid coord") << QGeoCoordinate(1,1) << QDateTime() << false;
- QTest::newRow("valid datetime") << QGeoCoordinate() << QDateTime::currentDateTime() << false;
- QTest::newRow("valid time but not date == invalid")
- << QGeoCoordinate() << QDateTime(QDate(), QTime::currentTime()) << false;
- QTest::newRow("valid date but not time == valid due to QDateTime constructor")
- << QGeoCoordinate() << QDateTime(QDate::currentDate(), QTime()) << false;
- }
-
- void constructor_copy()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QCOMPARE(QGeoPositionInfo(info), info);
- }
-
- void constructor_copy_data()
- {
- addTestData_info();
- }
-
- void constructor_move()
- {
- QFETCH(QGeoPositionInfo, info);
- QGeoPositionInfo infoCopy = info;
- QCOMPARE(QGeoPositionInfo(std::move(info)), infoCopy);
- // The moved-from object will go out of scope and will be destroyed
- // here, so we also implicitly check that moved-from object's destructor
- // is called without any issues.
- }
-
- void constructor_move_data()
- {
- addTestData_info();
- }
-
- void operator_assign()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QGeoPositionInfo info2;
- info2 = info;
- QCOMPARE(info2, info);
- }
-
- void operator_assign_data()
- {
- addTestData_info();
- }
-
- void operator_move_assign()
- {
- QFETCH(QGeoPositionInfo, info);
- QGeoPositionInfo infoCopy = info;
-
- QGeoPositionInfo obj;
- obj = std::move(info);
- QCOMPARE(obj, infoCopy);
-
- // check that (move)assigning to the moved-from object is ok
- info = std::move(infoCopy);
- QCOMPARE(info, obj);
- }
-
- void operator_move_assign_data()
- {
- addTestData_info();
- }
-
- void operator_equals()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QVERIFY(info == info);
- if (info.isValid())
- QCOMPARE(info == QGeoPositionInfo(), false);
- }
-
- void operator_equals_data()
- {
- addTestData_info();
- }
-
- void operator_notEquals()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QCOMPARE(info != info, false);
- if (info.isValid())
- QCOMPARE(info != QGeoPositionInfo(), true);
- }
-
- void operator_notEquals_data()
- {
- addTestData_info();
- }
-
- void setDateTime()
- {
- QFETCH(QDateTime, dateTime);
-
- QGeoPositionInfo info;
- info.setTimestamp(dateTime);
- QCOMPARE(info.timestamp(), dateTime);
- }
-
- void setDateTime_data()
- {
- QTest::addColumn<QDateTime>("dateTime");
- QTest::newRow("invalid") << QDateTime();
- QTest::newRow("now") << QDateTime::currentDateTime();
- }
-
- void dateTime()
- {
- QGeoPositionInfo info;
- QVERIFY(info.timestamp().isNull());
- }
-
- void setCoordinate()
- {
-
- QFETCH(QGeoCoordinate, coord);
-
- QGeoPositionInfo info;
- info.setCoordinate(coord);
- QCOMPARE(info.coordinate(), coord);
- }
-
- void setCoordinate_data()
- {
- QTest::addColumn<QGeoCoordinate>("coord");
-
- QTest::newRow("invalid") << QGeoCoordinate();
- QTest::newRow("valid") << QGeoCoordinate(30,30);
- }
-
- void attribute()
- {
- QFETCH(QGeoPositionInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoPositionInfo info;
- QVERIFY(qIsNaN(info.attribute(attribute)));
-
- info.setAttribute(attribute, value);
- QCOMPARE(info.attribute(attribute), value);
-
- info.removeAttribute(attribute);
- QVERIFY(qIsNaN(info.attribute(attribute)));
- }
-
- void attribute_data()
- {
- QTest::addColumn<QGeoPositionInfo::Attribute>("attribute");
- QTest::addColumn<qreal>("value");
-
- QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes();
- QList<qreal> values = tst_qgeopositioninfo_qrealTestValues();
- for (int i=0; i<attributes.count(); i++) {
- for (int j=0; j<values.count(); j++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j])))
- << attributes[i] << values[j];
- }
- }
- }
-
- void hasAttribute()
- {
- QFETCH(QGeoPositionInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoPositionInfo info;
- QVERIFY(!info.hasAttribute(attribute));
-
- info.setAttribute(attribute, value);
- QVERIFY(info.hasAttribute(attribute));
-
- info.removeAttribute(attribute);
- QVERIFY(!info.hasAttribute(attribute));
- }
-
- void hasAttribute_data()
- {
- attribute_data();
- }
-
- void removeAttribute()
- {
- QFETCH(QGeoPositionInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoPositionInfo info;
- QVERIFY(!info.hasAttribute(attribute));
-
- info.setAttribute(attribute, value);
- QVERIFY(info.hasAttribute(attribute));
-
- info.removeAttribute(attribute);
- QVERIFY(!info.hasAttribute(attribute));
-
- info.setAttribute(attribute, value);
- QVERIFY(info.hasAttribute(attribute));
- }
-
- void removeAttribute_data()
- {
- attribute_data();
- }
-
- void datastream()
- {
- QFETCH(QGeoPositionInfo, info);
-
- QByteArray ba;
- QDataStream out(&ba, QIODevice::WriteOnly);
- out << info;
-
- QDataStream in(&ba, QIODevice::ReadOnly);
- QGeoPositionInfo inInfo;
- in >> inInfo;
- QCOMPARE(inInfo, info);
- }
-
- void datastream_data()
- {
- addTestData_info();
- }
-
- void debug()
- {
- QFETCH(QGeoPositionInfo, info);
- QFETCH(int, nextValue);
- QFETCH(QByteArray, debugStringEnd);
-
- qInstallMessageHandler(tst_qgeopositioninfo_messageHandler);
- qDebug() << info << nextValue;
- qInstallMessageHandler(0);
-
- // use endsWith() so we don't depend on QDateTime's debug() implementation
- QVERIFY2(tst_qgeopositioninfo_debug.endsWith(debugStringEnd),
- qPrintable(QString::fromLatin1("'%1' does not end with '%2'").
- arg(QLatin1String(tst_qgeopositioninfo_debug),
- QLatin1String(debugStringEnd))));
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoPositionInfo>("info");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QByteArray>("debugStringEnd");
-
- QTest::newRow("no values") << QGeoPositionInfo() << 40
- << QString("QGeoCoordinate(?, ?)) 40").toLatin1();
-
- QGeoCoordinate coord(1, 1);
- QTest::newRow("coord, time") << QGeoPositionInfo(coord, QDateTime::currentDateTime())
- << 40 << QByteArray("QGeoCoordinate(1, 1)) 40");
-
- QGeoPositionInfo info;
- info.setAttribute(QGeoPositionInfo::Direction, 1.1);
- info.setAttribute(QGeoPositionInfo::GroundSpeed, 2.1);
- info.setAttribute(QGeoPositionInfo::VerticalSpeed, 3.1);
- info.setAttribute(QGeoPositionInfo::MagneticVariation, 4.1);
- info.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 5.1);
- info.setAttribute(QGeoPositionInfo::VerticalAccuracy, 6.1);
- QTest::newRow("all attributes") << info << 40
- << QByteArray("QGeoCoordinate(?, ?), Direction=1.1, GroundSpeed=2.1, VerticalSpeed=3.1, MagneticVariation=4.1, HorizontalAccuracy=5.1, VerticalAccuracy=6.1) 40");
- }
-};
-
-
-QTEST_APPLESS_MAIN(tst_QGeoPositionInfo)
-#include "tst_qgeopositioninfo.moc"
diff --git a/tests/auto/qgeopositioninfosource/CMakeLists.txt b/tests/auto/qgeopositioninfosource/CMakeLists.txt
deleted file mode 100644
index 361b69e7..00000000
--- a/tests/auto/qgeopositioninfosource/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Generated from qgeopositioninfosource.pro.
-
-#####################################################################
-## tst_qgeopositioninfosource Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeopositioninfosource
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- testqgeopositioninfosource.cpp testqgeopositioninfosource_p.h
- tst_qgeopositioninfosource.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qgeopositioninfosource.pro:<TRUE>:
-# TEMPLATE = "app"
-# testcase.timeout = "400"
diff --git a/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro b/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
deleted file mode 100644
index ee494251..00000000
--- a/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-testcase.timeout = 400 # this test is slow
-TARGET=tst_qgeopositioninfosource
-
-HEADERS += ../utils/qlocationtestutils_p.h \
- testqgeopositioninfosource_p.h
-
-SOURCES += ../utils/qlocationtestutils.cpp \
- testqgeopositioninfosource.cpp \
- tst_qgeopositioninfosource.cpp
-
-CONFIG -= app_bundle
-
-QT += positioning testlib
diff --git a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
deleted file mode 100644
index 2ddcc9a0..00000000
--- a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
+++ /dev/null
@@ -1,807 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QMetaType>
-#include <QSignalSpy>
-#include <QDebug>
-#include <QTimer>
-
-#include <limits.h>
-
-#include <qnumeric.h>
-#include <QtPositioning/qgeopositioninfosource.h>
-#include <QtPositioning/qgeopositioninfo.h>
-
-#include "testqgeopositioninfosource_p.h"
-#include "../utils/qlocationtestutils_p.h"
-
-Q_DECLARE_METATYPE(QGeoPositionInfoSource::PositioningMethod)
-Q_DECLARE_METATYPE(QGeoPositionInfoSource::PositioningMethods)
-
-#define MAX_WAITING_TIME 50000
-
-// Must provide a valid source, unless testing the source
-// returned by QGeoPositionInfoSource::createDefaultSource() on a system
-// that has no default source
-#define CHECK_SOURCE_VALID { \
- if (!m_source) { \
- if (m_testingDefaultSource && QGeoPositionInfoSource::createDefaultSource(0) == 0) \
- QSKIP("No default position source on this system"); \
- else \
- QFAIL("createTestSource() must return a valid source!"); \
- } \
- }
-
-class MyPositionSource : public QGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- MyPositionSource(QObject *parent = 0)
- : QGeoPositionInfoSource(parent) {
- }
-
- QGeoPositionInfo lastKnownPosition(bool /*fromSatellitePositioningMethodsOnly = false*/) const override {
- return QGeoPositionInfo();
- }
-
- void setSupportedPositioningMethods(PositioningMethods methods) {
- m_methods = methods;
- }
-
- virtual PositioningMethods supportedPositioningMethods() const override {
- return m_methods;
- }
- virtual int minimumUpdateInterval() const override {
- return 0;
- }
-
- virtual void startUpdates() override {}
- virtual void stopUpdates() override {}
-
- virtual void requestUpdate(int) override {}
-
- Error error() const override { return QGeoPositionInfoSource::NoError; }
-
-private:
- PositioningMethods m_methods;
-};
-
-class DefaultSourceTest : public TestQGeoPositionInfoSource
-{
- Q_OBJECT
-protected:
- QGeoPositionInfoSource *createTestSource() override {
- return QGeoPositionInfoSource::createSource(QStringLiteral("test.source"), 0);
- }
-};
-
-
-TestQGeoPositionInfoSource::TestQGeoPositionInfoSource(QObject *parent)
- : QObject(parent)
-{
- m_testingDefaultSource = false;
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../plugins"));
-#endif
-#endif
-}
-
-TestQGeoPositionInfoSource *TestQGeoPositionInfoSource::createDefaultSourceTest()
-{
- DefaultSourceTest *test = new DefaultSourceTest;
- test->m_testingDefaultSource = true;
- return test;
-}
-
-void TestQGeoPositionInfoSource::test_slot1()
-{
-}
-
-void TestQGeoPositionInfoSource::test_slot2()
-{
- m_testSlot2Called = true;
-}
-
-void TestQGeoPositionInfoSource::base_initTestCase()
-{
-
-}
-
-void TestQGeoPositionInfoSource::base_init()
-{
- m_source = createTestSource();
- m_testSlot2Called = false;
-}
-
-void TestQGeoPositionInfoSource::base_cleanup()
-{
- delete m_source;
- m_source = 0;
-}
-
-void TestQGeoPositionInfoSource::base_cleanupTestCase()
-{
-}
-
-void TestQGeoPositionInfoSource::initTestCase()
-{
- base_initTestCase();
-}
-
-void TestQGeoPositionInfoSource::init()
-{
- base_init();
-}
-
-void TestQGeoPositionInfoSource::cleanup()
-{
- base_cleanup();
-}
-
-void TestQGeoPositionInfoSource::cleanupTestCase()
-{
- base_cleanupTestCase();
-}
-
-// TC_ID_3_x_1
-void TestQGeoPositionInfoSource::constructor_withParent()
-{
- auto parent = std::make_unique<QObject>();
- new MyPositionSource(parent.get());
-}
-
-// TC_ID_3_x_2
-void TestQGeoPositionInfoSource::constructor_noParent()
-{
- MyPositionSource *obj = new MyPositionSource();
- delete obj;
-}
-
-void TestQGeoPositionInfoSource::updateInterval()
-{
- MyPositionSource s;
- QCOMPARE(s.updateInterval(), 0);
-}
-
-void TestQGeoPositionInfoSource::setPreferredPositioningMethods()
-{
- QFETCH(QGeoPositionInfoSource::PositioningMethod, supported);
- QFETCH(QGeoPositionInfoSource::PositioningMethod, preferred);
- QFETCH(QGeoPositionInfoSource::PositioningMethod, resulting);
-
- MyPositionSource s;
- s.setSupportedPositioningMethods(supported);
- s.setPreferredPositioningMethods(preferred);
- QCOMPARE(s.preferredPositioningMethods(), resulting);
-}
-
-void TestQGeoPositionInfoSource::setPreferredPositioningMethods_data()
-{
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("supported");
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("preferred");
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("resulting");
-
- QTest::newRow("Sat supported, Sat preferred")
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
- QTest::newRow("Sat supported, Non-Sat preferred")
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
- QTest::newRow("Sat supported, All preferred")
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
-
- QTest::newRow("Non-Sat supported, Sat preferred")
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
- QTest::newRow("Non-Sat supported, Non-Sat preferred")
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
- QTest::newRow("Non-Sat supported, All preferred")
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
-
- QTest::newRow("All supported, Sat preferred")
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods
- << QGeoPositionInfoSource::SatellitePositioningMethods;
- QTest::newRow("All supported, Non-Sat preferred")
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods
- << QGeoPositionInfoSource::NonSatellitePositioningMethods;
- QTest::newRow("All supported, All preferred")
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods
- << QGeoPositionInfoSource::AllPositioningMethods;
-}
-
-void TestQGeoPositionInfoSource::preferredPositioningMethods()
-{
- MyPositionSource s;
- QCOMPARE(s.preferredPositioningMethods(), 0);
-}
-
-//TC_ID_3_x_1 : Create a position source with the given parent that reads from the system's default
-// sources of location data
-void TestQGeoPositionInfoSource::createDefaultSource()
-{
- auto parent = std::make_unique<QObject>();
-
- // source will be deleted when parent goes out of scope
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(parent.get());
- // now all platforms have the dummy plugin at least
- QVERIFY(source != nullptr);
-}
-
-void TestQGeoPositionInfoSource::setUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QFETCH(int, interval);
- QFETCH(int, expectedInterval);
-
- m_source->setUpdateInterval(interval);
- QCOMPARE(m_source->updateInterval(), expectedInterval);
-}
-
-void TestQGeoPositionInfoSource::setUpdateInterval_data()
-{
- QTest::addColumn<int>("interval");
- QTest::addColumn<int>("expectedInterval");
- QGeoPositionInfoSource *source = createTestSource();
- int minUpdateInterval = source ? source->minimumUpdateInterval() : -1;
- if (source)
- delete source;
-
- QTest::newRow("0") << 0 << 0;
-
- if (minUpdateInterval > -1) {
- QTest::newRow("INT_MIN") << INT_MIN << minUpdateInterval;
- QTest::newRow("-1") << -1 << minUpdateInterval;
- }
-
- if (minUpdateInterval > 0) {
- QTest::newRow("more than minInterval") << minUpdateInterval + 1 << minUpdateInterval + 1;
- QTest::newRow("equal to minInterval") << minUpdateInterval << minUpdateInterval;
- }
-
- if (minUpdateInterval > 1) {
- QTest::newRow("less then minInterval") << minUpdateInterval - 1 << minUpdateInterval;
- QTest::newRow("in btw zero and minInterval") << 1 << minUpdateInterval;
- }
-}
-
-void TestQGeoPositionInfoSource::lastKnownPosition()
-{
- CHECK_SOURCE_VALID;
- QFETCH(QGeoPositionInfoSource::PositioningMethod, positioningMethod);
- QFETCH(bool, lastKnownPositionArgument);
-
- if ((m_source->supportedPositioningMethods() & positioningMethod) == 0)
- QSKIP("Not a supported positioning method for this position source");
-
- m_source->setPreferredPositioningMethods(positioningMethod);
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(1000);
- m_source->startUpdates();
-
- // Use QEventLoop instead of qWait() to ensure we stop as soon as a
- // position is emitted (otherwise the lastKnownPosition() may have
- // changed by the time it is checked)
- QEventLoop loop;
- QTimer timer;
- //simulated CI tests will quickly return -> real GPS tests take 2 minutes for satellite systems
- //use a 5 min timeout
- timer.setInterval(300000);
- connect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)),
- &loop, SLOT(quit()));
- connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- timer.start();
- loop.exec();
-
- QVERIFY((spy.count() > 0) && (timeout.count() == 0));
-
- QList<QVariant> list = spy.takeFirst();
- QGeoPositionInfo info = list.at(0).value<QGeoPositionInfo>();
- QGeoPositionInfo lastPositioninfo = m_source->lastKnownPosition(lastKnownPositionArgument);
-
- // lastPositioninfo is only gauranteed to be valid in all cases when only using satelite
- // positioning methods or when lastKnownPositionArgument is false
- if (!lastKnownPositionArgument ||
- positioningMethod == QGeoPositionInfoSource::SatellitePositioningMethods) {
- QVERIFY(lastPositioninfo.isValid());
- }
-
- if (lastPositioninfo.isValid()) {
- QCOMPARE(info.coordinate(), lastPositioninfo.coordinate());
- // On some CI machines the above evenloop code is not sufficient as positionUpdated
- // still fires causing last know position and last update to be out of sync.
- // To accommodate we check that the time stamps are no more than 1s apart
- // ideally they should be the same
- // doesn't work: QCOMPARE(info.timestamp(), lastPositioninfo.timestamp());
- const qint64 diff = qAbs(info.timestamp().msecsTo(lastPositioninfo.timestamp()));
- QCOMPARE(diff < 1000, true);
-
- QCOMPARE(info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy),
- lastPositioninfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy));
-
- if (info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) {
- bool isNaN1 = qIsNaN(info.attribute(QGeoPositionInfo::HorizontalAccuracy));
- bool isNaN2 = qIsNaN(lastPositioninfo.attribute(QGeoPositionInfo::HorizontalAccuracy));
- QCOMPARE(isNaN1, isNaN2);
- if (!isNaN1) {
- QCOMPARE(qFuzzyCompare(info.attribute(QGeoPositionInfo::HorizontalAccuracy),
- lastPositioninfo.attribute(QGeoPositionInfo::HorizontalAccuracy)), true);
- }
- }
-
- QCOMPARE(info.hasAttribute(QGeoPositionInfo::VerticalAccuracy),
- lastPositioninfo.hasAttribute(QGeoPositionInfo::VerticalAccuracy));
-
- if (info.hasAttribute(QGeoPositionInfo::VerticalAccuracy)) {
- bool isNaN1 = qIsNaN(info.attribute(QGeoPositionInfo::VerticalAccuracy));
- bool isNaN2 = qIsNaN(lastPositioninfo.attribute(QGeoPositionInfo::VerticalAccuracy));
- QCOMPARE(isNaN1, isNaN2);
- if (!isNaN1) {
- QCOMPARE(qFuzzyCompare(info.attribute(QGeoPositionInfo::VerticalAccuracy),
- lastPositioninfo.attribute(QGeoPositionInfo::VerticalAccuracy)), true);
- }
- }
- }
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::lastKnownPosition_data()
-{
- QTest::addColumn<QGeoPositionInfoSource::PositioningMethod>("positioningMethod");
- QTest::addColumn<bool>("lastKnownPositionArgument");
-
- // no good way to determine on MeeGo what are supported. If we ask for all or non-satellites, we
- // typically get geoclue-example provider, which is not suitable for this test.
- QTest::newRow("all - false") << QGeoPositionInfoSource::AllPositioningMethods << false;
- QTest::newRow("all - true") << QGeoPositionInfoSource::AllPositioningMethods << true;
- QTest::newRow("satellite - false") << QGeoPositionInfoSource::SatellitePositioningMethods << false;
- QTest::newRow("satellite - true") << QGeoPositionInfoSource::SatellitePositioningMethods << true;
-}
-
-void TestQGeoPositionInfoSource::minimumUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QVERIFY(m_source->minimumUpdateInterval() > 0);
-}
-
-//TC_ID_3_x_1
-void TestQGeoPositionInfoSource::startUpdates_testIntervals()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(1000);
- const int interval = 15000;
-
- m_source->startUpdates();
-
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, interval);
- for (int i = 0; i < 6; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1) && (timeout.count() == 0), interval);
- spy.clear();
- }
-
- m_source->stopUpdates();
-}
-
-
-void TestQGeoPositionInfoSource::startUpdates_testIntervalChangesWhileRunning()
-{
- // There are two ways of dealing with an interval change, and we have left it system dependent.
- // The interval can be changed will running or after the next update.
- // WinCE uses the first method, S60 uses the second method.
-
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 3000);
- QCOMPARE(timeout.count(), 0);
- spy.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
- spy.clear();
-
- m_source->setUpdateInterval(2000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 30000);
- spy.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
- spy.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
- spy.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
-
- m_source->stopUpdates();
-}
-
-//TC_ID_3_x_2
-void TestQGeoPositionInfoSource::startUpdates_testDefaultInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->startUpdates();
- for (int i = 0; i < 3; i++) {
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
- }
- m_source->stopUpdates();
-}
-
-//TC_ID_3_x_3
-void TestQGeoPositionInfoSource::startUpdates_testZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- for (int i = 0; i < 3; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
- spy.clear();
- }
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::startUpdates_moreThanOnce()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- m_source->startUpdates(); // check there is no crash
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 7000);
-
- m_source->startUpdates(); // check there is no crash
-
- m_source->stopUpdates();
-}
-
-//TC_ID_3_x_1
-void TestQGeoPositionInfoSource::stopUpdates()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(1000);
- m_source->startUpdates();
- for (int i = 0; i < 2; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 9500);
- spy.clear();
- }
- m_source->stopUpdates();
- QTest::qWait(2000);
- QCOMPARE(spy.count(), 0);
- spy.clear();
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- m_source->stopUpdates();
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 0, 9500);
-}
-
-//TC_ID_3_x_2
-void TestQGeoPositionInfoSource::stopUpdates_withoutStart()
-{
- CHECK_SOURCE_VALID;
- m_source->stopUpdates(); // check there is no crash
-}
-
-void TestQGeoPositionInfoSource::requestUpdate()
-{
- CHECK_SOURCE_VALID;
- QFETCH(int, timeout);
- QSignalSpy spy(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(timeout);
- QTRY_COMPARE(spy.count(), 1);
- const QList<QVariant> arguments = spy.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
-}
-
-void TestQGeoPositionInfoSource::requestUpdate_data()
-{
- QTest::addColumn<int>("timeout");
- QTest::newRow("less than zero") << -1; //TC_ID_3_x_7
-}
-
-// TC_ID_3_x_1 : Create position source and call requestUpdate with valid timeout value
-void TestQGeoPositionInfoSource::requestUpdate_validTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // currently all the sources have a minimumUpdateInterval <= 1000
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-void TestQGeoPositionInfoSource::requestUpdate_defaultTimeout()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->requestUpdate(0);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-// TC_ID_3_x_2 : Create position source and call requestUpdate with a timeout less than
-// minimumupdateInterval
-void TestQGeoPositionInfoSource::requestUpdate_timeoutLessThanMinimumInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(1);
-
- QTRY_COMPARE_WITH_TIMEOUT(spyTimeout.count(), 1, 1000);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
-}
-
-// TC_ID_3_x_3 : Call requestUpdate() with same value repeatedly
-void TestQGeoPositionInfoSource::requestUpdate_repeatedCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // currently all the sources have a minimumUpdateInterval <= 1000
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-void TestQGeoPositionInfoSource::requestUpdate_overlappingCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // currently all the sources have a minimumUpdateInterval <= 1000
- m_source->requestUpdate(1500);
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
-}
-
-//TC_ID_3_x_4
-void TestQGeoPositionInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
-
- m_source->requestUpdate(1500);
- QTest::qWait(7000);
-
- QVERIFY((spyUpdate.count() > 0) && (spyTimeout.count() == 0));
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), MAX_WAITING_TIME);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->setUpdateInterval(2000);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 20000);
- spyUpdate.clear();
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 20000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() >= 2) && (spyTimeout.count() == 0), 14000);
- spyUpdate.clear();
-
- QTest::qWait(1500);
-
- QCOMPARE(spyTimeout.count(), 0);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- m_source->setUpdateInterval(3000);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 20000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoPositionInfoSource::removeSlotForRequestTimeout()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(-1);
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 1000);
-}
-
-void TestQGeoPositionInfoSource::removeSlotForPositionUpdated()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
-}
-
-void TestQGeoPositionInfoSource::updateIntervalBinding()
-{
- auto parent = std::make_unique<QObject>();
- // source will be deleted when parent goes out of scope
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(parent.get());
- QVERIFY(source != nullptr);
-
- QTestPrivate::testReadWritePropertyBasics<QGeoPositionInfoSource, int>(*source, 1000, 2000,
- "updateInterval");
-}
-
-void TestQGeoPositionInfoSource::preferredMethodsBinding()
-{
- auto parent = std::make_unique<QObject>();
- // source will be deleted when parent goes out of scope
- QGeoPositionInfoSource *source =
- QGeoPositionInfoSource::createSource("test.source", parent.get());
- QVERIFY(source != nullptr);
-
- QTestPrivate::testReadWritePropertyBasics<QGeoPositionInfoSource,
- QGeoPositionInfoSource::PositioningMethods>(
- *source, QGeoPositionInfoSource::SatellitePositioningMethods,
- QGeoPositionInfoSource::AllPositioningMethods, "preferredPositioningMethods");
-}
-
-#include "testqgeopositioninfosource.moc"
diff --git a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.h
deleted file mode 100644
index 382971fa..00000000
--- a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource_p.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TESTQGEOPOSITIONINFOSOURCE_P_H
-#define TESTQGEOPOSITIONINFOSOURCE_P_H
-
-#ifdef TST_GEOCLUEMOCK_ENABLED
-#include "geocluemock.h"
-#include <QThread>
-#endif
-
-#include <QTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QGeoPositionInfoSource;
-QT_END_NAMESPACE
-
-class TestQGeoPositionInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- TestQGeoPositionInfoSource(QObject *parent = 0);
-
- static TestQGeoPositionInfoSource *createDefaultSourceTest();
-
-public slots:
- void test_slot1();
- void test_slot2();
-
-protected:
- virtual QGeoPositionInfoSource *createTestSource() = 0;
-
- // MUST be called by subclasses if they override respective test slots
- void base_initTestCase();
- void base_init();
- void base_cleanup();
- void base_cleanupTestCase();
-
-private slots:
- void initTestCase();
- void init();
- void cleanup();
- void cleanupTestCase();
-
- void constructor_withParent();
-
- void constructor_noParent();
-
- void updateInterval();
-
- void setPreferredPositioningMethods();
- void setPreferredPositioningMethods_data();
-
- void preferredPositioningMethods();
-
- void createDefaultSource();
-
- void setUpdateInterval();
- void setUpdateInterval_data();
-
- void lastKnownPosition();
- void lastKnownPosition_data();
-
- void minimumUpdateInterval();
-
- void startUpdates_testIntervals();
- void startUpdates_testIntervalChangesWhileRunning();
- void startUpdates_testDefaultInterval();
- void startUpdates_testZeroInterval();
- void startUpdates_moreThanOnce();
-
- void stopUpdates();
- void stopUpdates_withoutStart();
-
- void requestUpdate();
- void requestUpdate_data();
-
- void requestUpdate_validTimeout();
- void requestUpdate_defaultTimeout();
- void requestUpdate_timeoutLessThanMinimumInterval();
- void requestUpdate_repeatedCalls();
- void requestUpdate_overlappingCalls();
-
- void requestUpdateAfterStartUpdates_ZeroInterval();
- void requestUpdateAfterStartUpdates_SmallInterval();
- void requestUpdateBeforeStartUpdates_ZeroInterval();
- void requestUpdateBeforeStartUpdates_SmallInterval();
-
- void removeSlotForRequestTimeout();
- void removeSlotForPositionUpdated();
-
- void updateIntervalBinding();
- void preferredMethodsBinding();
-
-private:
- QGeoPositionInfoSource *m_source;
- bool m_testingDefaultSource;
- bool m_testSlot2Called;
-};
-
-#endif
diff --git a/tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp b/tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp
deleted file mode 100644
index 943eb65a..00000000
--- a/tests/auto/qgeopositioninfosource/tst_qgeopositioninfosource.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "testqgeopositioninfosource_p.h"
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- std::unique_ptr<TestQGeoPositionInfoSource> test(
- TestQGeoPositionInfoSource::createDefaultSourceTest());
- return QTest::qExec(test.get(), argc, argv);
-}
diff --git a/tests/auto/qgeorectangle/CMakeLists.txt b/tests/auto/qgeorectangle/CMakeLists.txt
deleted file mode 100644
index 22c660bd..00000000
--- a/tests/auto/qgeorectangle/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeorectangle.pro.
-
-#####################################################################
-## tst_qgeorectangle Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeorectangle
- SOURCES
- tst_qgeorectangle.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeorectangle.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeorectangle/qgeorectangle.pro b/tests/auto/qgeorectangle/qgeorectangle.pro
deleted file mode 100644
index 9cb635ef..00000000
--- a/tests/auto/qgeorectangle/qgeorectangle.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-CONFIG += testcase
-TARGET = tst_qgeorectangle
-
-SOURCES += \
- tst_qgeorectangle.cpp
-
-QT += positioning testlib
diff --git a/tests/auto/qgeorectangle/tst_qgeorectangle.cpp b/tests/auto/qgeorectangle/tst_qgeorectangle.cpp
deleted file mode 100644
index 696ac6b1..00000000
--- a/tests/auto/qgeorectangle/tst_qgeorectangle.cpp
+++ /dev/null
@@ -1,2414 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtTest/QtTest>
-#include <QtPositioning/QGeoCoordinate>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoRectangle>
-
-QT_USE_NAMESPACE
-
-class tst_QGeoRectangle : public QObject
-{
- Q_OBJECT
-
-private slots:
- void default_constructor();
- void center_constructor();
- void corner_constructor();
- void list_constructor();
- void copy_constructor();
- void assignment();
- void destructor();
-
- void equality();
- void equality_data();
-
- void isValid();
- void isValid_data();
-
- void isEmpty();
- void isEmpty_data();
-
- void corners();
- void corners_data();
-
- void setCorners();
-
- void width();
- void width_data();
-
- void height();
- void height_data();
-
- void center();
- void center_data();
-
- void boundingGeoRectangle();
- void boundingGeoRectangle_data();
-
- void containsCoord();
- void containsCoord_data();
-
- void containsBoxAndIntersects();
- void containsBoxAndIntersects_data();
-
- void translate();
- void translate_data();
-
- void unite();
- void unite_data();
-
- void extendRectangle();
- void extendRectangle_data();
-
- void areaComparison();
- void areaComparison_data();
-
- void circleComparison();
- void circleComparison_data();
-
- void hashing();
-};
-
-void tst_QGeoRectangle::default_constructor()
-{
- QGeoRectangle box;
- QCOMPARE(box.topLeft().isValid(), false);
- QCOMPARE(box.bottomRight().isValid(), false);
-}
-
-void tst_QGeoRectangle::center_constructor()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(5.0, 5.0), 10.0, 10.0);
-
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-}
-
-void tst_QGeoRectangle::corner_constructor()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
-
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-}
-
-void tst_QGeoRectangle::list_constructor()
-{
- QList<QGeoCoordinate> coordinates;
- QGeoRectangle b1 = QGeoRectangle(coordinates);
- QCOMPARE(b1.isValid(), false);
-
- coordinates << QGeoCoordinate(10.0, 0.0);
- b1 = QGeoRectangle(coordinates);
- QCOMPARE(b1.isValid(), true);
- QCOMPARE(b1.isEmpty(), true);
-
- coordinates << QGeoCoordinate(0.0, 10.0) << QGeoCoordinate(0.0, 5.0);
- b1 = QGeoRectangle(coordinates);
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0,0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-}
-
-void tst_QGeoRectangle::copy_constructor()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
- QGeoRectangle b2 = QGeoRectangle(b1);
-
- QCOMPARE(b2.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b2.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- b2.setTopLeft(QGeoCoordinate(30.0, 0.0));
- b2.setBottomRight(QGeoCoordinate(0.0, 30.0));
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- QGeoShape area;
- QGeoRectangle areaBox(area);
- QVERIFY(!areaBox.isValid());
- QVERIFY(areaBox.isEmpty());
-
- QGeoCircle circle;
- QGeoRectangle circleBox(circle);
- QVERIFY(!circleBox.isValid());
- QVERIFY(circleBox.isEmpty());
-}
-
-void tst_QGeoRectangle::destructor()
-{
- QGeoRectangle *box = new QGeoRectangle();
- delete box;
- // checking for a crash
-}
-
-void tst_QGeoRectangle::assignment()
-{
- QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
- QGeoRectangle b2 = QGeoRectangle(QGeoCoordinate(20.0, 0.0),
- QGeoCoordinate(0.0, 20.0));
-
- QVERIFY(b1 != b2);
-
- b2 = b1;
- QCOMPARE(b2.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b2.bottomRight(), QGeoCoordinate(0.0, 10.0));
- QCOMPARE(b1, b2);
-
- b2.setTopLeft(QGeoCoordinate(30.0, 0.0));
- b2.setBottomRight(QGeoCoordinate(0.0, 30.0));
- QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0));
- QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- // Assign b1 to an area
- QGeoShape area = b1;
- QCOMPARE(area.type(), b1.type());
- QVERIFY(area == b1);
-
- // Assign the area back to a bounding box
- QGeoRectangle ba = area;
- QCOMPARE(ba.topLeft(), b1.topLeft());
- QCOMPARE(ba.bottomRight(), b1.bottomRight());
-
- // Check that the copy is not modified when modifying the original.
- b1.setTopLeft(QGeoCoordinate(80, 30));
- QVERIFY(ba.topLeft() != b1.topLeft());
- QVERIFY(ba != b1);
-}
-
-void tst_QGeoRectangle::equality()
-{
- QFETCH(QGeoRectangle, box1);
- QFETCH(QGeoRectangle, box2);
- QFETCH(QGeoShape, area1);
- QFETCH(QGeoShape, area2);
- QFETCH(bool, equal);
-
- // compare boxes
- QCOMPARE((box1 == box2), equal);
- QCOMPARE((box1 != box2), !equal);
-
- // compare areas
- QCOMPARE((area1 == area2), equal);
- QCOMPARE((area1 != area2), !equal);
-
- // compare area to box
- QCOMPARE((area1 == box2), equal);
- QCOMPARE((area1 != box2), !equal);
-
- // compare box to area
- QCOMPARE((box1 == area2), equal);
- QCOMPARE((box1 != area2), !equal);
-}
-
-void tst_QGeoRectangle::equality_data()
-{
- QTest::addColumn<QGeoRectangle>("box1");
- QTest::addColumn<QGeoRectangle>("box2");
- QTest::addColumn<QGeoShape>("area1");
- QTest::addColumn<QGeoShape>("area2");
- QTest::addColumn<bool>("equal");
-
- QGeoCoordinate c1(10, 5);
- QGeoCoordinate c2(5, 10);
- QGeoCoordinate c3(20, 15);
- QGeoCoordinate c4(15, 20);
-
- QGeoRectangle b1(c1, c2);
- QGeoRectangle b2(c3, c4);
- QGeoRectangle b3(c3, c2);
- QGeoRectangle b4(c1, c3);
- QGeoRectangle b5(c1, c2);
-
- QGeoShape a1(b1);
- QGeoShape a2(b2);
- QGeoShape a3(b3);
- QGeoShape a4(b4);
- QGeoShape a5(b5);
-
- QTest::newRow("all unequal")
- << b1 << b2 << a1 << a2 << false;
- QTest::newRow("top left unequal")
- << b1 << b3 << a1 << a3 << false;
- QTest::newRow("bottom right unequal")
- << b1 << b4 << a1 << a4 << false;
- QTest::newRow("equal")
- << b1 << b5 << a1 << a5 << true;
-}
-
-void tst_QGeoRectangle::isValid()
-{
- QFETCH(QGeoRectangle, input);
- QFETCH(bool, valid);
-
- QCOMPARE(input.isValid(), valid);
-
- QGeoShape area = input;
- QCOMPARE(area.isValid(), valid);
-}
-
-void tst_QGeoRectangle::isValid_data()
-{
- QTest::addColumn<QGeoRectangle>("input");
- QTest::addColumn<bool>("valid");
-
- QGeoCoordinate c0;
- QGeoCoordinate c1(10, 5);
- QGeoCoordinate c2(5, 10);
-
- QTest::newRow("both corners invalid")
- << QGeoRectangle(c0, c0) << false;
- QTest::newRow("top left corner invalid")
- << QGeoRectangle(c0, c2) << false;
- QTest::newRow("bottom right corner invalid")
- << QGeoRectangle(c1, c0) << false;
- QTest::newRow("height in wrong order")
- << QGeoRectangle(c2, c1) << false;
- QTest::newRow("both corners valid")
- << QGeoRectangle(c1, c2) << true;
-}
-
-void tst_QGeoRectangle::isEmpty()
-{
- QFETCH(QGeoRectangle, input);
- QFETCH(bool, empty);
-
- QCOMPARE(input.isEmpty(), empty);
-
- QGeoShape area = input;
- QCOMPARE(area.isEmpty(), empty);
-}
-
-void tst_QGeoRectangle::isEmpty_data()
-{
- QTest::addColumn<QGeoRectangle>("input");
- QTest::addColumn<bool>("empty");
-
- QGeoCoordinate c0;
- QGeoCoordinate c1(10, 5);
- QGeoCoordinate c2(5, 10);
- QGeoCoordinate c3(10, 10);
-
- QTest::newRow("both corners invalid")
- << QGeoRectangle(c0, c0) << true;
- QTest::newRow("top left corner invalid")
- << QGeoRectangle(c0, c2) << true;
- QTest::newRow("bottom right corner invalid")
- << QGeoRectangle(c1, c0) << true;
- QTest::newRow("zero width")
- << QGeoRectangle(c1, c3) << true;
- QTest::newRow("zero height")
- << QGeoRectangle(c3, c2) << true;
- QTest::newRow("zero width and height")
- << QGeoRectangle(c1, c1) << true;
- QTest::newRow("non-zero width and height")
- << QGeoRectangle(c1, c2) << false;
-}
-
-void tst_QGeoRectangle::corners()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, topLeft);
- QFETCH(QGeoCoordinate, topRight);
- QFETCH(QGeoCoordinate, bottomLeft);
- QFETCH(QGeoCoordinate, bottomRight);
-
- QCOMPARE(box.topLeft(), topLeft);
- QCOMPARE(box.topRight(), topRight);
- QCOMPARE(box.bottomLeft(), bottomLeft);
- QCOMPARE(box.bottomRight(), bottomRight);
-}
-
-void tst_QGeoRectangle::corners_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("topLeft");
- QTest::addColumn<QGeoCoordinate>("topRight");
- QTest::addColumn<QGeoCoordinate>("bottomLeft");
- QTest::addColumn<QGeoCoordinate>("bottomRight");
-
- QGeoCoordinate c0;
- QGeoCoordinate tl(10, 5);
- QGeoCoordinate br(5, 10);
- QGeoCoordinate tr(10, 10);
- QGeoCoordinate bl(5, 5);
-
- QTest::newRow("both invalid")
- << QGeoRectangle(c0, c0)
- << c0
- << c0
- << c0
- << c0;
- QTest::newRow("top left invalid")
- << QGeoRectangle(c0, br)
- << c0
- << c0
- << c0
- << br;
- QTest::newRow("bottom right invalid")
- << QGeoRectangle(tl, c0)
- << tl
- << c0
- << c0
- << c0;
- QTest::newRow("both valid")
- << QGeoRectangle(tl, br)
- << tl
- << tr
- << bl
- << br;
-}
-
-void tst_QGeoRectangle::setCorners()
-{
- QGeoRectangle box(QGeoCoordinate(10.0, 0.0),
- QGeoCoordinate(0.0, 10.0));
-
- box.setTopLeft(QGeoCoordinate(20.0, -10.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(20.0, -10.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(20.0, 10.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(0.0, -10.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(0.0, 10.0));
-
- box.setTopRight(QGeoCoordinate(30.0, 20.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(30.0, -10.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(30.0, 20.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(0.0, -10.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(0.0, 20.0));
-
- box.setBottomRight(QGeoCoordinate(-10.0, 30.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(30.0, -10.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(30.0, 30.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(-10.0, -10.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(-10.0, 30.0));
-
- box.setBottomLeft(QGeoCoordinate(-20.0, -20.0));
-
- QCOMPARE(box.topLeft(), QGeoCoordinate(30.0, -20.0));
- QCOMPARE(box.topRight(), QGeoCoordinate(30.0, 30.0));
- QCOMPARE(box.bottomLeft(), QGeoCoordinate(-20.0, -20.0));
- QCOMPARE(box.bottomRight(), QGeoCoordinate(-20.0, 30.0));
-
-
-}
-
-void tst_QGeoRectangle::width()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(double, oldWidth);
- QFETCH(double, newWidth);
- QFETCH(QGeoRectangle, newBox);
-
- if (qIsNaN(oldWidth))
- QVERIFY(qIsNaN(box.width()));
- else
- QCOMPARE(box.width(), oldWidth);
-
- box.setWidth(newWidth);
-
- QCOMPARE(box, newBox);
-}
-
-void tst_QGeoRectangle::width_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<double>("oldWidth");
- QTest::addColumn<double>("newWidth");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid box")
- << QGeoRectangle()
- << qQNaN()
- << 100.0
- << QGeoRectangle();
-
- QTest::newRow("0 width -> negative width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0));
-
- QTest::newRow("0 width -> 0 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0));
-
- QTest::newRow("0 width -> non wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 10.0
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0));
-
- QTest::newRow("0 width -> wrapping width positive")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, -5.0),
- QGeoCoordinate(5.0, -175.0));
-
- QTest::newRow("0 width -> wrapping width negative")
- << QGeoRectangle(QGeoCoordinate(10.0, -90.0),
- QGeoCoordinate(5.0, -90.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, 5.0));
-
- QTest::newRow("0 width -> 360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 360.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("0 width -> 360+ width")
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0))
- << 0.0
- << 370.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("non wrapping width -> negative width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0));
-
- QTest::newRow("non wrapping width -> 0 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, 90.0),
- QGeoCoordinate(5.0, 90.0));
-
- QTest::newRow("non wrapping width -> non wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(10.0, 80.0),
- QGeoCoordinate(5.0, 100.0));
-
- QTest::newRow("non wrapping width -> wrapping width positive")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, -5.0),
- QGeoCoordinate(5.0, -175.0));
-
- QTest::newRow("non wrapping width -> wrapping width negative")
- << QGeoRectangle(QGeoCoordinate(10.0, -95.0),
- QGeoCoordinate(5.0, -85.0))
- << 10.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, 5.0));
-
- QTest::newRow("non wrapping width -> 360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 360.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("non wrapping width width -> 360+ width")
- << QGeoRectangle(QGeoCoordinate(10.0, 85.0),
- QGeoCoordinate(5.0, 95.0))
- << 10.0
- << 370.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("wrapping width -> negative width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0));
-
- QTest::newRow("wrapping width -> 0 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, -135.0),
- QGeoCoordinate(5.0, -135.0));
-
- QTest::newRow("wrapping width -> non wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 80.0
- << QGeoRectangle(QGeoCoordinate(10.0, -175.0),
- QGeoCoordinate(5.0, -95.0));
-
- QTest::newRow("wrapping width -> wrapping width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 120.0
- << QGeoRectangle(QGeoCoordinate(10.0, 165.0),
- QGeoCoordinate(5.0, -75.0));
-
- QTest::newRow("wrapping width -> 360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 360.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-
- QTest::newRow("wrapping width width -> 360+ width")
- << QGeoRectangle(QGeoCoordinate(10.0, 175.0),
- QGeoCoordinate(5.0, -85.0))
- << 100.0
- << 370.0
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0));
-}
-
-void tst_QGeoRectangle::height()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(double, oldHeight);
- QFETCH(double, newHeight);
- QFETCH(QGeoRectangle, newBox);
-
- if (qIsNaN(oldHeight))
- QVERIFY(qIsNaN(box.height()));
- else
- QCOMPARE(box.height(), oldHeight);
-
- box.setHeight(newHeight);
- QCOMPARE(box, newBox);
-}
-
-void tst_QGeoRectangle::height_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<double>("oldHeight");
- QTest::addColumn<double>("newHeight");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid box")
- << QGeoRectangle()
- << qQNaN()
- << 100.0
- << QGeoRectangle();
-
- QTest::newRow("0 height -> negative height")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0))
- << 0.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0));
-
- QTest::newRow("0 height -> 0 height")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0))
- << 0.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0));
-
- QTest::newRow("0 height -> non zero height")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(10.0, 10.0))
- << 0.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(20.0, 5.0),
- QGeoCoordinate(0.0, 10.0));
-
- QTest::newRow("0 height -> squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(70.0, 70.0))
- << 0.0
- << 60.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(50.0, 70.0));
-
- QTest::newRow("0 height -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(-70.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 0.0
- << 60.0
- << QGeoRectangle(QGeoCoordinate(-50.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("0 height -> 180")
- << QGeoRectangle(QGeoCoordinate(0.0, 5.0),
- QGeoCoordinate(0.0, 10.0))
- << 0.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("0 height -> 180 squash top")
- << QGeoRectangle(QGeoCoordinate(20.0, 5.0),
- QGeoCoordinate(20.0, 10.0))
- << 0.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-50.0, 10.0));
-
- QTest::newRow("0 height -> 180 squash bottom")
- << QGeoRectangle(QGeoCoordinate(-20.0, 5.0),
- QGeoCoordinate(-20.0, 10.0))
- << 0.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(50.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("0 height -> 180+")
- << QGeoRectangle(QGeoCoordinate(0.0, 5.0),
- QGeoCoordinate(0.0, 10.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("0 height -> 180+ squash top")
- << QGeoRectangle(QGeoCoordinate(20.0, 5.0),
- QGeoCoordinate(20.0, 10.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-50.0, 10.0));
-
- QTest::newRow("0 height -> 180+ squash bottom")
- << QGeoRectangle(QGeoCoordinate(-20.0, 5.0),
- QGeoCoordinate(-20.0, 10.0))
- << 0.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(50.0, 5.0),
- QGeoCoordinate(-90.0, 10.0));
-
- QTest::newRow("non zero height -> negative height")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << -1.0
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0));
-
- QTest::newRow("non zero height -> 0 height")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 0.0
- << QGeoRectangle(QGeoCoordinate(50.0, 30.0),
- QGeoCoordinate(50.0, 70.0));
-
- QTest::newRow("non zero height -> non zero height")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(60.0, 30.0),
- QGeoCoordinate(40.0, 70.0));
-
- QTest::newRow("non zero height -> squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 100.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(10.0, 70.0));
-
- QTest::newRow("non zero height -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 40.0
- << 100.0
- << QGeoRectangle(QGeoCoordinate(-10.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180")
- << QGeoRectangle(QGeoCoordinate(20.0, 30.0),
- QGeoCoordinate(-20.0, 70.0))
- << 40.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180 squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(10.0, 70.0));
-
- QTest::newRow("non zero height -> 180 squash bottom")
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 40.0
- << 180.0
- << QGeoRectangle(QGeoCoordinate(-10.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180+")
- << QGeoRectangle(QGeoCoordinate(20.0, 30.0),
- QGeoCoordinate(-20.0, 70.0))
- << 40.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("non zero height -> 180+ squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << 40.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(10.0, 70.0));
-
- QTest::newRow("non zero height -> 180+ squash bottom")
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-70.0, 70.0))
- << 40.0
- << 190.0
- << QGeoRectangle(QGeoCoordinate(-10.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-}
-
-void tst_QGeoRectangle::center()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, oldCenter);
- QFETCH(QGeoCoordinate, newCenter);
- QFETCH(QGeoRectangle, newBox);
-
- QGeoShape shape = box;
- QCOMPARE(box.center(), oldCenter);
- QCOMPARE(shape.center(), oldCenter);
- box.setCenter(newCenter);
- QCOMPARE(box, newBox);
-}
-
-void tst_QGeoRectangle::center_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("oldCenter");
- QTest::addColumn<QGeoCoordinate>("newCenter");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid")
- << QGeoRectangle()
- << QGeoCoordinate()
- << QGeoCoordinate(0.0, 0.0)
- << QGeoRectangle(QGeoCoordinate(0.0, 0.0), 0.0, 0.0);
-
- QTest::newRow("zero width")
- << QGeoRectangle(QGeoCoordinate(10.0, 5.0),
- QGeoCoordinate(5.0, 5.0))
- << QGeoCoordinate(7.5, 5.0)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(22.5, 20.0),
- QGeoCoordinate(17.5, 20.0));
-
- QTest::newRow("360 width")
- << QGeoRectangle(QGeoCoordinate(10.0, -180.0),
- QGeoCoordinate(5.0, 180.0))
- << QGeoCoordinate(7.5, 0.0)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(22.5, -180.0),
- QGeoCoordinate(17.5, 180.0));
-
- QTest::newRow("zero height")
- << QGeoRectangle(QGeoCoordinate(5.0, 5.0),
- QGeoCoordinate(5.0, 10.0))
- << QGeoCoordinate(5.0, 7.5)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(20.0, 17.5),
- QGeoCoordinate(20.0, 22.5));
-
- QTest::newRow("180 height -> move")
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0))
- << QGeoCoordinate(0.0, 7.5)
- << QGeoCoordinate(0.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 17.5),
- QGeoCoordinate(-90.0, 22.5));
-
- QTest::newRow("180 height -> squash top")
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0))
- << QGeoCoordinate(0.0, 7.5)
- << QGeoCoordinate(-20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(50.0, 17.5),
- QGeoCoordinate(-90.0, 22.5));
-
- QTest::newRow("180 height -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(90.0, 5.0),
- QGeoCoordinate(-90.0, 10.0))
- << QGeoCoordinate(0.0, 7.5)
- << QGeoCoordinate(20.0, 20.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 17.5),
- QGeoCoordinate(-50.0, 22.5));
-
- QTest::newRow("non wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(10.0, 10.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -10.0),
- QGeoCoordinate(-10.0, 30.0));
-
- QTest::newRow("non wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(10.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0));
-
- QTest::newRow("non wrapping -> squash top")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(80.0, 50.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 30.0),
- QGeoCoordinate(70.0, 70.0));
-
- QTest::newRow("non wrapping -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0))
- << QGeoCoordinate(50.0, 50.0)
- << QGeoCoordinate(-80.0, 50.0)
- << QGeoRectangle(QGeoCoordinate(-70.0, 30.0),
- QGeoCoordinate(-90.0, 70.0));
-
- QTest::newRow("wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(50.0, 50.0)
- << QGeoRectangle(QGeoCoordinate(70.0, 30.0),
- QGeoCoordinate(30.0, 70.0));
-
- QTest::newRow("wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(10.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 170.0),
- QGeoCoordinate(-10.0, -150.0));
-
- QTest::newRow("wrapping -> squash top")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(80.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(90.0, 150.0),
- QGeoCoordinate(70.0, -170.0));
-
- QTest::newRow("wrapping -> squash bottom")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-10.0, -170.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoCoordinate(-80.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(-70.0, 150.0),
- QGeoCoordinate(-90.0, -170.0));
-}
-
-void tst_QGeoRectangle::boundingGeoRectangle_data()
-{
- QTest::addColumn<QGeoRectangle>("rectangle");
-
- QGeoRectangle b1(QGeoCoordinate(70, 30), QGeoCoordinate(30, 70));
- QGeoRectangle b2(QGeoCoordinate(70, 150), QGeoCoordinate(30, -170));
- QGeoRectangle b3(QGeoCoordinate(90, 30), QGeoCoordinate(50, 70));
- QGeoRectangle b4(QGeoCoordinate(-50, 30), QGeoCoordinate(-90, 70));
-
- QTest::newRow("Box 1") << b1;
- QTest::newRow("Box 2") << b2;
- QTest::newRow("Box 3") << b3;
- QTest::newRow("Box 4") << b4;
-}
-
-void tst_QGeoRectangle::boundingGeoRectangle()
-{
- QFETCH(QGeoRectangle, rectangle);
-
- QGeoRectangle box = rectangle.boundingGeoRectangle();
- QCOMPARE(box, rectangle);
-}
-
-void tst_QGeoRectangle::containsCoord()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, coord);
- QFETCH(bool, contains);
-
- QCOMPARE(box.contains(coord), contains);
-
- QGeoShape area = box;
- QCOMPARE(area.contains(coord), contains);
-}
-
-void tst_QGeoRectangle::containsCoord_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<bool>("contains");
-
- QGeoRectangle b1(QGeoCoordinate(70, 30), QGeoCoordinate(30, 70));
-
- double lonLO1 = 20.0;
- double lonL1 = 30.0;
- double lonLI1 = 40.0;
- double lonC1 = 50.0;
- double lonRI1 = 60.0;
- double lonR1 = 70.0;
- double lonRO1 = 80.0;
-
- double latTO1 = 80.0;
- double latT1 = 70.0;
- double latTI1 = 60.0;
- double latC1 = 50.0;
- double latBI1 = 40.0;
- double latB1 = 30.0;
- double latBO1 = 20.0;
-
- QTest::newRow("non wrapped - in center")
- << b1 << QGeoCoordinate(latC1, lonC1) << true;
- QTest::newRow("non wrapped - left edge - inside")
- << b1 << QGeoCoordinate(latC1, lonLI1) << true;
- QTest::newRow("non wrapped - left edge")
- << b1 << QGeoCoordinate(latC1, lonL1) << true;
- QTest::newRow("non wrapped - left edge - outside")
- << b1 << QGeoCoordinate(latC1, lonLO1) << false;
- QTest::newRow("non wrapped - right edge - inside")
- << b1 << QGeoCoordinate(latC1, lonRI1) << true;
- QTest::newRow("non wrapped - right edge")
- << b1 << QGeoCoordinate(latC1, lonR1) << true;
- QTest::newRow("non wrapped - right edge - outside")
- << b1 << QGeoCoordinate(latC1, lonRO1) << false;
- QTest::newRow("non wrapped - top edge - inside")
- << b1 << QGeoCoordinate(latTI1, lonC1) << true;
- QTest::newRow("non wrapped - top edge")
- << b1 << QGeoCoordinate(latT1, lonC1) << true;
- QTest::newRow("non wrapped - top edge - outside")
- << b1 << QGeoCoordinate(latTO1, lonC1) << false;
- QTest::newRow("non wrapped - bottom edge - inside")
- << b1 << QGeoCoordinate(latBI1, lonC1) << true;
- QTest::newRow("non wrapped - bottom edge")
- << b1 << QGeoCoordinate(latB1, lonC1) << true;
- QTest::newRow("non wrapped - bottom edge - outside")
- << b1 << QGeoCoordinate(latBO1, lonC1) << false;
- QTest::newRow("non wrapped - top left - inside")
- << b1 << QGeoCoordinate(latTI1, lonLI1) << true;
- QTest::newRow("non wrapped - top left")
- << b1 << QGeoCoordinate(latT1, lonL1) << true;
- QTest::newRow("non wrapped - top left - outside")
- << b1 << QGeoCoordinate(latTO1, lonLO1) << false;
- QTest::newRow("non wrapped - top right - inside")
- << b1 << QGeoCoordinate(latTI1, lonRI1) << true;
- QTest::newRow("non wrapped - top right")
- << b1 << QGeoCoordinate(latT1, lonR1) << true;
- QTest::newRow("non wrapped - top right - outside")
- << b1 << QGeoCoordinate(latTO1, lonRO1) << false;
- QTest::newRow("non wrapped - bottom left - inside")
- << b1 << QGeoCoordinate(latBI1, lonLI1) << true;
- QTest::newRow("non wrapped - bottom left")
- << b1 << QGeoCoordinate(latB1, lonL1) << true;
- QTest::newRow("non wrapped - bottom left - outside")
- << b1 << QGeoCoordinate(latBO1, lonLO1) << false;
- QTest::newRow("non wrapped - bottom right - inside")
- << b1 << QGeoCoordinate(latBI1, lonRI1) << true;
- QTest::newRow("non wrapped - bottom right")
- << b1 << QGeoCoordinate(latB1, lonR1) << true;
- QTest::newRow("non wrapped - bottom right - outside")
- << b1 << QGeoCoordinate(latBO1, lonRO1) << false;
-
- QGeoRectangle b2(QGeoCoordinate(70, 150), QGeoCoordinate(30, -170));
-
- double lonLO2 = 140.0;
- double lonL2 = 150.0;
- double lonLI2 = 160.0;
- double lonC2 = 170.0;
- double lonRI2 = 180.0;
- double lonR2 = -170.0;
- double lonRO2 = -160.0;
-
- double latTO2 = 80.0;
- double latT2 = 70.0;
- double latTI2 = 60.0;
- double latC2 = 50.0;
- double latBI2 = 40.0;
- double latB2 = 30.0;
- double latBO2 = 20.0;
-
- QTest::newRow("wrapped - in center")
- << b2 << QGeoCoordinate(latC2, lonC2) << true;
- QTest::newRow("wrapped - left edge - inside")
- << b2 << QGeoCoordinate(latC2, lonLI2) << true;
- QTest::newRow("wrapped - left edge")
- << b2 << QGeoCoordinate(latC2, lonL2) << true;
- QTest::newRow("wrapped - left edge - outside")
- << b2 << QGeoCoordinate(latC2, lonLO2) << false;
- QTest::newRow("wrapped - right edge - inside")
- << b2 << QGeoCoordinate(latC2, lonRI2) << true;
- QTest::newRow("wrapped - right edge")
- << b2 << QGeoCoordinate(latC2, lonR2) << true;
- QTest::newRow("wrapped - right edge - outside")
- << b2 << QGeoCoordinate(latC2, lonRO2) << false;
- QTest::newRow("wrapped - top edge - inside")
- << b2 << QGeoCoordinate(latTI2, lonC2) << true;
- QTest::newRow("wrapped - top edge")
- << b2 << QGeoCoordinate(latT2, lonC2) << true;
- QTest::newRow("wrapped - top edge - outside")
- << b2 << QGeoCoordinate(latTO2, lonC2) << false;
- QTest::newRow("wrapped - bottom edge - inside")
- << b2 << QGeoCoordinate(latBI2, lonC2) << true;
- QTest::newRow("wrapped - bottom edge")
- << b2 << QGeoCoordinate(latB2, lonC2) << true;
- QTest::newRow("wrapped - bottom edge - outside")
- << b2 << QGeoCoordinate(latBO2, lonC2) << false;
- QTest::newRow("wrapped - top left - inside")
- << b2 << QGeoCoordinate(latTI2, lonLI2) << true;
- QTest::newRow("wrapped - top left")
- << b2 << QGeoCoordinate(latT2, lonL2) << true;
- QTest::newRow("wrapped - top left - outside")
- << b2 << QGeoCoordinate(latTO2, lonLO2) << false;
- QTest::newRow("wrapped - top right - inside")
- << b2 << QGeoCoordinate(latTI2, lonRI2) << true;
- QTest::newRow("wrapped - top right")
- << b2 << QGeoCoordinate(latT2, lonR2) << true;
- QTest::newRow("wrapped - top right - outside")
- << b2 << QGeoCoordinate(latTO2, lonRO2) << false;
- QTest::newRow("wrapped - bottom left - inside")
- << b2 << QGeoCoordinate(latBI2, lonLI2) << true;
- QTest::newRow("wrapped - bottom left")
- << b2 << QGeoCoordinate(latB2, lonL2) << true;
- QTest::newRow("wrapped - bottom left - outside")
- << b2 << QGeoCoordinate(latBO2, lonLO2) << false;
- QTest::newRow("wrapped - bottom right - inside")
- << b2 << QGeoCoordinate(latBI2, lonRI2) << true;
- QTest::newRow("wrapped - bottom right")
- << b2 << QGeoCoordinate(latB2, lonR2) << true;
- QTest::newRow("wrapped - bottom right - outside")
- << b2 << QGeoCoordinate(latBO2, lonRO2) << false;
-
- QGeoRectangle b3(QGeoCoordinate(90, 30), QGeoCoordinate(50, 70));
-
- double lonLO3 = 20.0;
- double lonL3 = 30.0;
- double lonLI3 = 40.0;
- double lonC3 = 50.0;
- double lonRI3 = 60.0;
- double lonR3 = 70.0;
- double lonRO3 = 80.0;
-
- double latT3 = 90.0;
- double latTI3 = 80.0;
- double latC3 = 70.0;
- /* current unused:
- double latBI3 = 60.0;
- double latB3 = 50.0;
- double latBO3 = 40.0;
- */
-
- QTest::newRow("north pole - in center")
- << b3 << QGeoCoordinate(latC3, lonC3) << true;
- QTest::newRow("north pole - left edge - inside")
- << b3 << QGeoCoordinate(latC3, lonLI3) << true;
- QTest::newRow("north pole - left edge")
- << b3 << QGeoCoordinate(latC3, lonL3) << true;
- QTest::newRow("north pole - left edge - outside")
- << b3 << QGeoCoordinate(latC3, lonLO3) << false;
- QTest::newRow("north pole - right edge - inside")
- << b3 << QGeoCoordinate(latC3, lonRI3) << true;
- QTest::newRow("north pole - right edge")
- << b3 << QGeoCoordinate(latC3, lonR3) << true;
- QTest::newRow("north pole - right edge - outside")
- << b3 << QGeoCoordinate(latC3, lonRO3) << false;
- QTest::newRow("north pole - top edge - inside")
- << b3 << QGeoCoordinate(latTI3, lonC3) << true;
- QTest::newRow("north pole - top edge")
- << b3 << QGeoCoordinate(latT3, lonC3) << true;
- QTest::newRow("north pole - top left - inside")
- << b3 << QGeoCoordinate(latTI3, lonLI3) << true;
- QTest::newRow("north pole - top left")
- << b3 << QGeoCoordinate(latT3, lonL3) << true;
- QTest::newRow("north pole - top left - outside")
- << b3 << QGeoCoordinate(latT3, lonLO3) << true;
- QTest::newRow("north pole - top right - inside")
- << b3 << QGeoCoordinate(latTI3, lonRI3) << true;
- QTest::newRow("north pole - top right")
- << b3 << QGeoCoordinate(latT3, lonR3) << true;
- QTest::newRow("north pole - top right - outside")
- << b3 << QGeoCoordinate(latT3, lonRO3) << true;
-
- QGeoRectangle b4(QGeoCoordinate(-50, 30), QGeoCoordinate(-90, 70));
-
- double lonLO4 = 20.0;
- double lonL4 = 30.0;
- double lonLI4 = 40.0;
- double lonC4 = 50.0;
- double lonRI4 = 60.0;
- double lonR4 = 70.0;
- double lonRO4 = 80.0;
-
- /* currently unused:
- double latTO4 = -40.0;
- double latT4 = -50.0;
- double latTI4 = -60.0;
- */
- double latC4 = -70.0;
- double latBI4 = -80.0;
- double latB4 = -90.0;
-
- QTest::newRow("south pole - in center")
- << b4 << QGeoCoordinate(latC4, lonC4) << true;
- QTest::newRow("south pole - left edge - inside")
- << b4 << QGeoCoordinate(latC4, lonLI4) << true;
- QTest::newRow("south pole - left edge")
- << b4 << QGeoCoordinate(latC4, lonL4) << true;
- QTest::newRow("south pole - left edge - outside")
- << b4 << QGeoCoordinate(latC4, lonLO4) << false;
- QTest::newRow("south pole - right edge - inside")
- << b4 << QGeoCoordinate(latC4, lonRI4) << true;
- QTest::newRow("south pole - right edge")
- << b4 << QGeoCoordinate(latC4, lonR4) << true;
- QTest::newRow("south pole - right edge - outside")
- << b4 << QGeoCoordinate(latC4, lonRO4) << false;
- QTest::newRow("south pole - bottom edge - inside")
- << b4 << QGeoCoordinate(latBI4, lonC4) << true;
- QTest::newRow("south pole - bottom edge")
- << b4 << QGeoCoordinate(latB4, lonC4) << true;
- QTest::newRow("south pole - bottom left - inside")
- << b4 << QGeoCoordinate(latBI4, lonLI4) << true;
- QTest::newRow("south pole - bottom left")
- << b4 << QGeoCoordinate(latB4, lonL4) << true;
- QTest::newRow("south pole - bottom left - outside")
- << b4 << QGeoCoordinate(latB4, lonLO4) << true;
- QTest::newRow("south pole - bottom right - inside")
- << b4 << QGeoCoordinate(latBI4, lonRI4) << true;
- QTest::newRow("south pole - bottom right")
- << b4 << QGeoCoordinate(latB4, lonR4) << true;
- QTest::newRow("south pole - bottom right - outside")
- << b4 << QGeoCoordinate(latB4, lonRO4) << true;
-}
-
-void tst_QGeoRectangle::containsBoxAndIntersects()
-{
- QFETCH(QGeoRectangle, box1);
- QFETCH(QGeoRectangle, box2);
- QFETCH(bool, contains);
- QFETCH(bool, intersects);
-
- QCOMPARE(box1.contains(box2), contains);
- QCOMPARE(box1.intersects(box2), intersects);
-}
-
-void tst_QGeoRectangle::containsBoxAndIntersects_data()
-{
- QTest::addColumn<QGeoRectangle>("box1");
- QTest::addColumn<QGeoRectangle>("box2");
- QTest::addColumn<bool>("contains");
- QTest::addColumn<bool>("intersects");
-
- QGeoRectangle b1(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapped same")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped smaller")
- << b1
- << QGeoRectangle(QGeoCoordinate(20.0, -20.0),
- QGeoCoordinate(-20.0, 20.0))
- << true << true;
-
- QTest::newRow("non wrapped larger")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped outside top")
- << b1
- << QGeoRectangle(QGeoCoordinate(80.0, -30.0),
- QGeoCoordinate(50.0, 30.0))
- << false << false;
-
- QTest::newRow("non wrapped outside bottom")
- << b1
- << QGeoRectangle(QGeoCoordinate(-50.0, -30.0),
- QGeoCoordinate(-80.0, 30.0))
- << false << false;
-
- QTest::newRow("non wrapped outside left")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -80.0),
- QGeoCoordinate(-30.0, -50.0))
- << false << false;
-
- QTest::newRow("non wrapped outside wrapped")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << false << false;
-
- QTest::newRow("non wrapped outside right")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 80.0))
- << false << false;
-
- QTest::newRow("non wrapped top left cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(20.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped top cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -10.0),
- QGeoCoordinate(20.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped top right cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, 20.0),
- QGeoCoordinate(20.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped left cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -40.0),
- QGeoCoordinate(-10.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped right cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, 20.0),
- QGeoCoordinate(-10.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom left cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, -40.0),
- QGeoCoordinate(-40.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, -10.0),
- QGeoCoordinate(-40.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom right cross")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, 20.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped top left touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(50.0, -50.0),
- QGeoCoordinate(30.0, -30.0))
- << false << true;
-
- QTest::newRow("non wrapped top touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(50.0, -10.0),
- QGeoCoordinate(30.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped top right touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(50.0, 30.0),
- QGeoCoordinate(30.0, 50.0))
- << false << true;
-
- QTest::newRow("non wrapped left touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -50.0),
- QGeoCoordinate(-10.0, -30.0))
- << false << true;
-
- QTest::newRow("non wrapped right touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, 30.0),
- QGeoCoordinate(-10.0, 50.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom left touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-30.0, -30.0),
- QGeoCoordinate(-50.0, -50.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-30.0, -10.0),
- QGeoCoordinate(-50.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom right touch outside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-30.0, 30.0),
- QGeoCoordinate(-50.0, 50.0))
- << false << true;
-
- QTest::newRow("non wrapped top left touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(10.0, -10.0))
- << true << true;
-
- QTest::newRow("non wrapped top touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, -10.0),
- QGeoCoordinate(10.0, 10.0))
- << true << true;
-
- QTest::newRow("non wrapped top right touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(10.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped left touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -30.0),
- QGeoCoordinate(-10.0, -10.0))
- << true << true;
-
- QTest::newRow("non wrapped right touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, 10.0),
- QGeoCoordinate(-10.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped bottom left touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-10.0, -30.0),
- QGeoCoordinate(-30.0, -10.0))
- << true << true;
-
- QTest::newRow("non wrapped bottom touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-10.0, -10.0),
- QGeoCoordinate(-30.0, 10.0))
- << true << true;
-
- QTest::newRow("non wrapped bottom right touch inside")
- << b1
- << QGeoRectangle(QGeoCoordinate(-10.0, 10.0),
- QGeoCoordinate(-30.0, 30.0))
- << true << true;
-
- QTest::newRow("non wrapped top lon strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(20.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped center lon strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(10.0, -40.0),
- QGeoCoordinate(-10.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped bottom lon strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(-20.0, -40.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QTest::newRow("non wrapped left lat strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -40.0),
- QGeoCoordinate(-40.0, -20.0))
- << false << true;
-
- QTest::newRow("non wrapped center lat strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, -10.0),
- QGeoCoordinate(-40.0, 10.0))
- << false << true;
-
- QTest::newRow("non wrapped right lat strip")
- << b1
- << QGeoRectangle(QGeoCoordinate(40.0, 20.0),
- QGeoCoordinate(-40.0, 40.0))
- << false << true;
-
- QGeoRectangle b2(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapped same")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped smaller")
- << b2
- << QGeoRectangle(QGeoCoordinate(20.0, 160.0),
- QGeoCoordinate(-20.0, -160.0))
- << true << true;
-
- QTest::newRow("wrapped larger")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped outside top")
- << b2
- << QGeoRectangle(QGeoCoordinate(80.0, 150.0),
- QGeoCoordinate(50.0, -150.0))
- << false << false;
-
- QTest::newRow("wrapped outside bottom")
- << b2
- << QGeoRectangle(QGeoCoordinate(-50.0, 150.0),
- QGeoCoordinate(-80.0, -150.0))
- << false << false;
-
- QTest::newRow("wrapped outside left")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 70.0),
- QGeoCoordinate(-30.0, 130.0))
- << false << false;
-
- QTest::newRow("wrapped outside right")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, -130.0),
- QGeoCoordinate(-30.0, -70.0))
- << false << false;
-
- QTest::newRow("wrapped top left cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(20.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped top cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 170.0),
- QGeoCoordinate(20.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped top right cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, -160.0),
- QGeoCoordinate(20.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped left cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 140.0),
- QGeoCoordinate(-10.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped right cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, -160.0),
- QGeoCoordinate(-10.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped bottom left cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, 140.0),
- QGeoCoordinate(-40.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped bottom cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, 170.0),
- QGeoCoordinate(-40.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped bottom right cross")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, -160.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped top left touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(50.0, 130.0),
- QGeoCoordinate(30.0, 150.0))
- << false << true;
-
- QTest::newRow("wrapped top touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(50.0, 170.0),
- QGeoCoordinate(30.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped top right touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(50.0, -150.0),
- QGeoCoordinate(30.0, -130.0))
- << false << true;
-
- QTest::newRow("wrapped left touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 130.0),
- QGeoCoordinate(-10.0, 150.0))
- << false << true;
-
- QTest::newRow("wrapped right touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, -150.0),
- QGeoCoordinate(-10.0, -130.0))
- << false << true;
-
- QTest::newRow("wrapped bottom left touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-30.0, 150.0),
- QGeoCoordinate(-50.0, 130.0))
- << false << true;
-
- QTest::newRow("wrapped bottom touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-30.0, 170.0),
- QGeoCoordinate(-50.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped bottom right touch outside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-30.0, -150.0),
- QGeoCoordinate(-50.0, -130.0))
- << false << true;
-
- QTest::newRow("wrapped top left touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(10.0, 170.0))
- << true << true;
-
- QTest::newRow("wrapped top touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, 170.0),
- QGeoCoordinate(10.0, -170.0))
- << true << true;
-
- QTest::newRow("wrapped top right touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(10.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped left touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 150.0),
- QGeoCoordinate(-10.0, 170.0))
- << true << true;
-
- QTest::newRow("wrapped right touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, -170.0),
- QGeoCoordinate(-10.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped bottom left touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-10.0, 150.0),
- QGeoCoordinate(-30.0, 170.0))
- << true << true;
-
- QTest::newRow("wrapped bottom touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-10.0, 170.0),
- QGeoCoordinate(-30.0, -170.0))
- << true << true;
-
- QTest::newRow("wrapped bottom right touch inside")
- << b2
- << QGeoRectangle(QGeoCoordinate(-10.0, -170.0),
- QGeoCoordinate(-30.0, -150.0))
- << true << true;
-
- QTest::newRow("wrapped top lon strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(20.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped center lon strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(10.0, 140.0),
- QGeoCoordinate(-10.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped bottom lon strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(-20.0, 140.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("wrapped left lat strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 140.0),
- QGeoCoordinate(-40.0, 160.0))
- << false << true;
-
- QTest::newRow("wrapped center lat strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, 170.0),
- QGeoCoordinate(-40.0, -170.0))
- << false << true;
-
- QTest::newRow("wrapped right lat strip")
- << b2
- << QGeoRectangle(QGeoCoordinate(40.0, -160.0),
- QGeoCoordinate(-40.0, -140.0))
- << false << true;
-
- QTest::newRow("north pole touching")
- << QGeoRectangle(QGeoCoordinate(90.0, 20.0),
- QGeoCoordinate(40.0, 40.0))
- << QGeoRectangle(QGeoCoordinate(90.0, 60.0),
- QGeoCoordinate(30.0, 80.0))
- << false << true;
-
- QTest::newRow("south pole touching")
- << QGeoRectangle(QGeoCoordinate(40.0, 20.0),
- QGeoCoordinate(-90.0, 40.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 60.0),
- QGeoCoordinate(-90.0, 80.0))
- << false << true;
-}
-
-void tst_QGeoRectangle::translate()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(double, degreesLatitude);
- QFETCH(double, degreesLongitude);
- QFETCH(QGeoRectangle, newBox);
-
- QGeoRectangle test = box.translated(degreesLatitude, degreesLongitude);
- QCOMPARE(test, newBox);
- box.translate(degreesLatitude, degreesLongitude);
- QCOMPARE(box, newBox);
-
-}
-
-void tst_QGeoRectangle::translate_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<double>("degreesLatitude");
- QTest::addColumn<double>("degreesLongitude");
- QTest::addColumn<QGeoRectangle>("newBox");
-
- QTest::newRow("invalid")
- << QGeoRectangle()
- << 20.0
- << 20.0
- << QGeoRectangle();
-
- QTest::newRow("360 width")
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, -180.0),
- QGeoCoordinate(-10.0, 180.0));
-
- QTest::newRow("180 height")
- << QGeoRectangle(QGeoCoordinate(90.0, -30.0),
- QGeoCoordinate(-90.0, 30.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(90.0, -10.0),
- QGeoCoordinate(-90.0, 50.0));
-
- QTest::newRow("non wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, -10.0),
- QGeoCoordinate(-10.0, 50.0));
-
- QTest::newRow("non wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 110.0),
- QGeoCoordinate(-30.0, 170.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, 130.0),
- QGeoCoordinate(-10.0, -170.0));
-
- QTest::newRow("non wrapping -> north clip")
- << QGeoRectangle(QGeoCoordinate(80.0, -30.0),
- QGeoCoordinate(20.0, 30.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(90.0, -10.0),
- QGeoCoordinate(30.0, 50.0));
-
- QTest::newRow("non wrapping -> south clip")
- << QGeoRectangle(QGeoCoordinate(-20.0, -30.0),
- QGeoCoordinate(-80.0, 30.0))
- << -20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(-30.0, -10.0),
- QGeoCoordinate(-90.0, 50.0));
-
- QTest::newRow("wrapping -> non wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -170.0))
- << 20.0
- << -20.0
- << QGeoRectangle(QGeoCoordinate(50.0, 110.0),
- QGeoCoordinate(-10.0, 170.0));
-
- QTest::newRow("wrapping -> wrapping")
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -170.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(50.0, 150.0),
- QGeoCoordinate(-10.0, -150.0));
-
- QTest::newRow("wrapping -> north clip")
- << QGeoRectangle(QGeoCoordinate(80.0, 130.0),
- QGeoCoordinate(20.0, -170.0))
- << 20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(90.0, 150.0),
- QGeoCoordinate(30.0, -150.0));
-
- QTest::newRow("wrapping -> south clip")
- << QGeoRectangle(QGeoCoordinate(-20.0, 130.0),
- QGeoCoordinate(-80.0, -170.0))
- << -20.0
- << 20.0
- << QGeoRectangle(QGeoCoordinate(-30.0, 150.0),
- QGeoCoordinate(-90.0, -150.0));
-}
-
-void tst_QGeoRectangle::unite()
-{
- QFETCH(QGeoRectangle, in1);
- QFETCH(QGeoRectangle, in2);
- QFETCH(QGeoRectangle, out);
-
- QCOMPARE(in1.united(in2), out);
- QCOMPARE(in2.united(in1), out);
-
- QCOMPARE(in1 | in2, out);
- QCOMPARE(in2 | in1, out);
-
- QGeoRectangle united1 = QGeoRectangle(in1);
- united1 |= in2;
- QCOMPARE(united1, out);
-
- QGeoRectangle united2 = QGeoRectangle(in2);
- united2 |= in1;
- QCOMPARE(united2, out);
-}
-
-void tst_QGeoRectangle::unite_data()
-{
- QTest::addColumn<QGeoRectangle>("in1");
- QTest::addColumn<QGeoRectangle>("in2");
- QTest::addColumn<QGeoRectangle>("out");
-
- QTest::newRow("central and taller")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(50.0, -30.0),
- QGeoCoordinate(-50.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(50.0, -30.0),
- QGeoCoordinate(-50.0, 30.0));
-
- QTest::newRow("central and 180 high")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(90.0, -30.0),
- QGeoCoordinate(-90.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(90.0, -30.0),
- QGeoCoordinate(-90.0, 30.0));
-
- QTest::newRow("central and non overlapping higher")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(50.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("central and overlapping higher")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(0.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("central and touching higher")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(60.0, -30.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("central and non overlapping lower")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(-50.0, -30.0),
- QGeoCoordinate(-60.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0));
-
- QTest::newRow("central and overlapping lower")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(0.0, -30.0),
- QGeoCoordinate(-60.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0));
-
- QTest::newRow("central and touching lower")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(-30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-60.0, 30.0));
-
- QTest::newRow("non wrapping central and wider")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -50.0),
- QGeoCoordinate(-30.0, 50.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -50.0),
- QGeoCoordinate(-30.0, 50.0));
-
- QTest::newRow("non wrapping central and 360 width")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("non wrapping central and non overlapping non wrapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -110.0),
- QGeoCoordinate(-30.0, -50.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -110.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapping central and overlapping non wrapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -80.0),
- QGeoCoordinate(-30.0, -20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -80.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapping central and touching non wrapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, -30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, 30.0));
-
- QTest::newRow("non wrapping central and non overlapping non wrapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 110.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 110.0));
-
- QTest::newRow("non wrapping central and overlapping non wrapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 20.0),
- QGeoCoordinate(-30.0, 80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 80.0));
-
- QTest::newRow("non wrapping central and touching non wrapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 30.0),
- QGeoCoordinate(-30.0, 90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 90.0));
-
- QTest::newRow("wrapping and wider")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -130.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -130.0));
-
- QTest::newRow("wrapping and 360 width")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and non overlapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -130.0),
- QGeoCoordinate(-30.0, -70.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -70.0));
-
- QTest::newRow("wrapping and overlapping right")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -160.0),
- QGeoCoordinate(-30.0, -70.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -70.0));
-
- QTest::newRow("wrapping and touching right")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -150.0),
- QGeoCoordinate(-30.0, -90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -90.0));
-
- QTest::newRow("wrapping and non overlapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 70.0),
- QGeoCoordinate(-30.0, 130.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 70.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapping and overlapping left")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 100.0),
- QGeoCoordinate(-30.0, 160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 100.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapping and touching left")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, 150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, -150.0));
-
- QTest::newRow("wrapping and non overlapping center")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -30.0),
- QGeoCoordinate(-30.0, 30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and overlapping center")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -160.0),
- QGeoCoordinate(-30.0, 160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and touching center")
- << QGeoRectangle(QGeoCoordinate(30.0, 150.0),
- QGeoCoordinate(-30.0, -150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -150.0),
- QGeoCoordinate(-30.0, 150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("wrapping and one containing other")
- << QGeoRectangle(QGeoCoordinate(30.0, 40.0),
- QGeoCoordinate(-30.0, -40.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 40.0),
- QGeoCoordinate(-30.0, -40.0));
-
- QTest::newRow("small gap over zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, -10.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0));
-
- QTest::newRow("small gap before zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -40.0),
- QGeoCoordinate(-30.0, -30.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, -10.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -40.0),
- QGeoCoordinate(-30.0, -10.0));
-
- QTest::newRow("small gap after zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 30.0),
- QGeoCoordinate(-30.0, 40.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 40.0));
-
- QTest::newRow("small gap over dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0));
-
- QTest::newRow("small gap before dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 140.0),
- QGeoCoordinate(-30.0, 150.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 140.0),
- QGeoCoordinate(-30.0, 170.0));
-
- QTest::newRow("small gap after dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -150.0),
- QGeoCoordinate(-30.0, -140.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -140.0));
-
- QTest::newRow("90-degree inner gap over zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -55.0),
- QGeoCoordinate(-30.0, -45.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 45.0),
- QGeoCoordinate(-30.0, 55.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -55.0),
- QGeoCoordinate(-30.0, 55.0));
-
- QTest::newRow("90-degree inner gap before zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, -10.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -65.0),
- QGeoCoordinate(-30.0, -55.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -65.0),
- QGeoCoordinate(-30.0, -10.0));
-
- QTest::newRow("90-degree inner gap after zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, 65.0),
- QGeoCoordinate(-30.0, 75.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 10.0),
- QGeoCoordinate(-30.0, 75.0));
-
- QTest::newRow("90-degree inner gap over dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 125.0),
- QGeoCoordinate(-30.0, 135.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -135.0),
- QGeoCoordinate(-30.0, -125.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 125.0),
- QGeoCoordinate(-30.0, -125.0));
-
- QTest::newRow("90-degree inner gap before dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, 170.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 60.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 50.0),
- QGeoCoordinate(-30.0, 170.0));
-
- QTest::newRow("90-degree inner gap after dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -60.0),
- QGeoCoordinate(-30.0, -50.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -170.0),
- QGeoCoordinate(-30.0, -50.0));
-
- QTest::newRow("180-degree inner gap centered on zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, -90.0));
-
- QTest::newRow("180-degree outer gap cenetered on zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, 90.0));
-
- QTest::newRow("180-degree shift centered on zero line")
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("180-degree inner gap centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -90.0),
- QGeoCoordinate(-30.0, 90.0));
-
- QTest::newRow("180-degree outer gap centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -90.0))
- << QGeoRectangle(QGeoCoordinate(30.0, 90.0),
- QGeoCoordinate(-30.0, -90.0));
-
- QTest::newRow("180-degree shift centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30.0, 80.0),
- QGeoCoordinate(-30.0, 100.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -100.0),
- QGeoCoordinate(-30.0, -80.0))
- << QGeoRectangle(QGeoCoordinate(30.0, -180.0),
- QGeoCoordinate(-30.0, 180.0));
-
- QTest::newRow("Small outer gap centered on dateline")
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170))
- << QGeoRectangle(QGeoCoordinate(30, -170), QGeoCoordinate(-30, 160))
- << QGeoRectangle(QGeoCoordinate(30, -170), QGeoCoordinate(-30, 170));
-
- QTest::newRow("Overlapping over the dateline")
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170))
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, -170))
- << QGeoRectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, -170));
-}
-
-
-void tst_QGeoRectangle::extendRectangle()
-{
- QFETCH(QGeoRectangle, box);
- QFETCH(QGeoCoordinate, coord);
- QFETCH(QGeoRectangle, out);
-
- box.extendRectangle(coord);
- QCOMPARE(box, out);
-}
-
-void tst_QGeoRectangle::extendRectangle_data()
-{
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<QGeoCoordinate>("coord");
- QTest::addColumn<QGeoRectangle>("out");
-
- QTest::newRow("valid rect - invalid coordinate")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(100.0, 190.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20));
- QTest::newRow("invalid rect - valid coordinate")
- << QGeoRectangle()
- << QGeoCoordinate(10.0, 10.0)
- << QGeoRectangle();
- QTest::newRow("inside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(10.0, 10.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20));
- QTest::newRow("lat outside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(40.0, 10.0)
- << QGeoRectangle(QGeoCoordinate(40.0, -20.0),
- QGeoCoordinate(-30.0, 20));
- QTest::newRow("positive lon outside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(10.0, 40.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 40));
- QTest::newRow("negative lon outside rect - not wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, -20.0),
- QGeoCoordinate(-30.0, 20.0))
- << QGeoCoordinate(10.0, -40.0)
- << QGeoRectangle(QGeoCoordinate(30.0, -40.0),
- QGeoCoordinate(-30.0, 20.0));
- QTest::newRow("inside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(10.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0));
- QTest::newRow("lat outside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(-40.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-40.0, -160.0));
- QTest::newRow("positive lon outside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(10.0, 140.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 140.0),
- QGeoCoordinate(-30.0, -160.0));
- QTest::newRow("negative lon outside rect - wrapped")
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -160.0))
- << QGeoCoordinate(10.0, -140.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 160.0),
- QGeoCoordinate(-30.0, -140.0));
- QTest::newRow("extending over 180 degree line eastward")
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, 160.0))
- << QGeoCoordinate(10.0, -170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 130.0),
- QGeoCoordinate(-30.0, -170));
- QTest::newRow("extending over -180 degree line westward")
- << QGeoRectangle(QGeoCoordinate(30.0, -160.0),
- QGeoCoordinate(-30.0, -130.0))
- << QGeoCoordinate(10.0, 170.0)
- << QGeoRectangle(QGeoCoordinate(30.0, 170.0),
- QGeoCoordinate(-30.0, -130));
-}
-
-void tst_QGeoRectangle::areaComparison_data()
-{
- QTest::addColumn<QGeoShape>("area");
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<bool>("equal");
-
- QGeoRectangle b1(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- QGeoRectangle b2(QGeoCoordinate(20.0, 0.0), QGeoCoordinate(0.0, 20.0));
- QGeoCircle c(QGeoCoordinate(0.0, 0.0), 10);
-
- QTest::newRow("default constructed") << QGeoShape() << QGeoRectangle() << false;
- QTest::newRow("b1 b1") << QGeoShape(b1) << b1 << true;
- QTest::newRow("b1 b2") << QGeoShape(b1) << b2 << false;
- QTest::newRow("b2 b1") << QGeoShape(b2) << b1 << false;
- QTest::newRow("b2 b2") << QGeoShape(b2) << b2 << true;
- QTest::newRow("c b1") << QGeoShape(c) << b1 << false;
-}
-
-void tst_QGeoRectangle::areaComparison()
-{
- QFETCH(QGeoShape, area);
- QFETCH(QGeoRectangle, box);
- QFETCH(bool, equal);
-
- QCOMPARE((area == box), equal);
- QCOMPARE((area != box), !equal);
-
- QCOMPARE((box == area), equal);
- QCOMPARE((box != area), !equal);
-}
-
-void tst_QGeoRectangle::circleComparison_data()
-{
- QTest::addColumn<QGeoCircle>("circle");
- QTest::addColumn<QGeoRectangle>("box");
- QTest::addColumn<bool>("equal");
-
- QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- QGeoCircle c(QGeoCoordinate(0.0, 0.0), 10);
-
- QTest::newRow("default constructed") << QGeoCircle() << QGeoRectangle() << false;
- QTest::newRow("c b") << c << b << false;
-}
-
-void tst_QGeoRectangle::circleComparison()
-{
- QFETCH(QGeoCircle, circle);
- QFETCH(QGeoRectangle, box);
- QFETCH(bool, equal);
-
- QCOMPARE((circle == box), equal);
- QCOMPARE((circle != box), !equal);
-
- QCOMPARE((box == circle), equal);
- QCOMPARE((box != circle), !equal);
-}
-
-void tst_QGeoRectangle::hashing()
-{
- const QGeoRectangle rectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- const size_t rectangleHash = qHash(rectangle);
-
- QGeoRectangle otherTopLeftRectangle = rectangle;
- otherTopLeftRectangle.setTopLeft(QGeoCoordinate(20.0, 0.0));
- QVERIFY(qHash(otherTopLeftRectangle) != rectangleHash);
-
- QGeoRectangle otherBottomRightRectangle = rectangle;
- otherBottomRightRectangle.setBottomRight(QGeoCoordinate(0.0, 5.0));
- QVERIFY(qHash(otherBottomRightRectangle) != rectangleHash);
-
- // Do not assign, so that they do not share same d_ptr
- QGeoRectangle similarRectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0));
- QCOMPARE(qHash(similarRectangle), rectangleHash);
-}
-
-QTEST_MAIN(tst_QGeoRectangle)
-#include "tst_qgeorectangle.moc"
-
diff --git a/tests/auto/qgeosatelliteinfo/CMakeLists.txt b/tests/auto/qgeosatelliteinfo/CMakeLists.txt
deleted file mode 100644
index b4400557..00000000
--- a/tests/auto/qgeosatelliteinfo/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Generated from qgeosatelliteinfo.pro.
-
-#####################################################################
-## tst_qgeosatelliteinfo Test:
-#####################################################################
-
-qt_internal_add_test(tst_qgeosatelliteinfo
- SOURCES
- tst_qgeosatelliteinfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:qgeosatelliteinfo.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro b/tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro
deleted file mode 100644
index 447ebdc4..00000000
--- a/tests/auto/qgeosatelliteinfo/qgeosatelliteinfo.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-TARGET=tst_qgeosatelliteinfo
-
-SOURCES += tst_qgeosatelliteinfo.cpp
-
-QT += testlib positioning
diff --git a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp b/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
deleted file mode 100644
index c99e222f..00000000
--- a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include <QtPositioning/qgeosatelliteinfo.h>
-
-#include <QMetaType>
-#include <QObject>
-#include <QDebug>
-#include <QTest>
-
-#include <float.h>
-#include <limits.h>
-
-QT_USE_NAMESPACE
-Q_DECLARE_METATYPE(QGeoSatelliteInfo::Attribute)
-
-QByteArray tst_qgeosatelliteinfo_debug;
-
-void tst_qgeosatelliteinfo_messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeosatelliteinfo_debug = msg.toLocal8Bit();
- break;
- default:
- break;
- }
-}
-
-
-QList<qreal> tst_qgeosatelliteinfo_qrealTestValues()
-{
- QList<qreal> values;
-
- if (qreal(DBL_MIN) == DBL_MIN)
- values << DBL_MIN;
-
- values << FLT_MIN;
- values << -1.0 << 0.0 << 1.0;
- values << FLT_MAX;
-
- if (qreal(DBL_MAX) == DBL_MAX)
- values << DBL_MAX;
-
- return values;
-}
-
-QList<int> tst_qgeosatelliteinfo_intTestValues()
-{
- QList<int> values;
- values << INT_MIN << -100 << 0 << 100 << INT_MAX;
- return values;
-}
-
-QList<QGeoSatelliteInfo::Attribute> tst_qgeosatelliteinfo_getAttributes()
-{
- QList<QGeoSatelliteInfo::Attribute> attributes;
- attributes << QGeoSatelliteInfo::Elevation
- << QGeoSatelliteInfo::Azimuth;
- return attributes;
-}
-
-
-class tst_QGeoSatelliteInfo : public QObject
-{
- Q_OBJECT
-
-private:
- QGeoSatelliteInfo updateWithAttribute(QGeoSatelliteInfo::Attribute attribute, qreal value)
- {
- QGeoSatelliteInfo info;
- info.setAttribute(attribute, value);
- return info;
- }
-
- void addTestData_update()
- {
- QTest::addColumn<QGeoSatelliteInfo>("info");
-
- QList<int> intValues = tst_qgeosatelliteinfo_intTestValues();
-
- for (int i=0; i<intValues.count(); i++) {
- QGeoSatelliteInfo info;
- info.setSignalStrength(intValues[i]);
- QTest::newRow("signal strength") << info;
- }
-
- for (int i=0; i<intValues.count(); i++) {
- QGeoSatelliteInfo info;
- info.setSatelliteIdentifier(intValues[i]);
- QTest::newRow("satellite identifier") << info;
- }
-
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- QTest::newRow("satellite system") << info;
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- QTest::newRow("satellite system") << info;
-
- QList<QGeoSatelliteInfo::Attribute> attributes = tst_qgeosatelliteinfo_getAttributes();
- QList<qreal> qrealValues = tst_qgeosatelliteinfo_qrealTestValues();
- for (int i=0; i<attributes.count(); i++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(qrealValues[i])))
- << updateWithAttribute(attributes[i], qrealValues[i]);
- }
- }
-
-private slots:
- void constructor()
- {
- QGeoSatelliteInfo info;
- QCOMPARE(info.signalStrength(), -1);
- QCOMPARE(info.satelliteIdentifier(), -1);
- QCOMPARE(info.satelliteSystem(), QGeoSatelliteInfo::Undefined);
- QList<QGeoSatelliteInfo::Attribute> attributes = tst_qgeosatelliteinfo_getAttributes();
- for (int i=0; i<attributes.count(); i++)
- QCOMPARE(info.attribute(attributes[i]), qreal(-1.0));
- }
- void constructor_copy()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QCOMPARE(QGeoSatelliteInfo(info), info);
- }
-
- void constructor_copy_data()
- {
- addTestData_update();
- }
-
- void constructor_move()
- {
- QFETCH(QGeoSatelliteInfo, info);
- QGeoSatelliteInfo infoCopy = info;
- QCOMPARE(QGeoSatelliteInfo(std::move(info)), infoCopy);
- // The moved-from object will go out of scope and will be destroyed
- // here, so we also implicitly check that moved-from object's destructor
- // is called without any issues.
- }
-
- void constructor_move_data()
- {
- addTestData_update();
- }
-
- void operator_comparison()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QVERIFY(info == info);
- QCOMPARE(info != info, false);
- QCOMPARE(info == QGeoSatelliteInfo(), false);
- QCOMPARE(info != QGeoSatelliteInfo(), true);
-
- QVERIFY(QGeoSatelliteInfo() == QGeoSatelliteInfo());
- }
-
- void operator_comparison_data()
- {
- addTestData_update();
- }
-
- void operator_assign()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QGeoSatelliteInfo info2 = info;
- QCOMPARE(info2, info);
- }
-
- void operator_assign_data()
- {
- addTestData_update();
- }
-
- void operator_move_assign()
- {
- QFETCH(QGeoSatelliteInfo, info);
- QGeoSatelliteInfo infoCopy = info;
-
- QGeoSatelliteInfo obj;
- obj = std::move(info);
- QCOMPARE(obj, infoCopy);
-
- // check that (move)assigning to the moved-from object is ok
- info = std::move(infoCopy);
- QCOMPARE(info, obj);
- }
-
- void operator_move_assign_data()
- {
- addTestData_update();
- }
-
- void setSignalStrength()
- {
- QFETCH(int, signal);
-
- QGeoSatelliteInfo info;
- QCOMPARE(info.signalStrength(), -1);
-
- info.setSignalStrength(signal);
- QCOMPARE(info.signalStrength(), signal);
- }
-
- void setSignalStrength_data()
- {
- QTest::addColumn<int>("signal");
-
- QList<int> intValues = tst_qgeosatelliteinfo_intTestValues();
- for (int i=0; i<intValues.count(); i++)
- QTest::newRow(qPrintable(QString("%1").arg(intValues[i]))) << intValues[i];
- }
- void setSatelliteIdentifier()
- {
- QFETCH(int, satId);
-
- QGeoSatelliteInfo info;
- QCOMPARE(info.satelliteIdentifier(), -1);
-
- info.setSatelliteIdentifier(satId);
- QCOMPARE(info.satelliteIdentifier(), satId);
- }
-
- void setSatelliteIdentifier_data()
- {
- QTest::addColumn<int>("satId");
-
- QList<int> intValues = tst_qgeosatelliteinfo_intTestValues();
- for (int i=0; i<intValues.count(); i++)
- QTest::newRow(qPrintable(QString("%1").arg(intValues[i]))) << intValues[i];
- }
-
- void setSatelliteSystem()
- {
- QFETCH(int, system);
-
- QGeoSatelliteInfo info;
- QCOMPARE(info.satelliteSystem(), QGeoSatelliteInfo::Undefined);
-
- info.setSatelliteSystem(static_cast<QGeoSatelliteInfo::SatelliteSystem>(system));
- QCOMPARE(info.satelliteSystem(), static_cast<QGeoSatelliteInfo::SatelliteSystem>(system));
- }
-
- void setSatelliteSystem_data()
- {
- QTest::addColumn<int>("system");
-
- QTest::newRow("Sat system undefined")
- << int(QGeoSatelliteInfo::Undefined);
- QTest::newRow("Sat system GPS")
- << int(QGeoSatelliteInfo::GPS);
- QTest::newRow("Sat system GLONASS")
- << int(QGeoSatelliteInfo::GLONASS);
- }
-
- void attribute()
- {
- QFETCH(QGeoSatelliteInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoSatelliteInfo u;
- QCOMPARE(u.attribute(attribute), qreal(-1.0));
-
- u.setAttribute(attribute, value);
- QCOMPARE(u.attribute(attribute), value);
- u.removeAttribute(attribute);
- QCOMPARE(u.attribute(attribute), qreal(-1.0));
- }
-
- void attribute_data()
- {
- QTest::addColumn<QGeoSatelliteInfo::Attribute>("attribute");
- QTest::addColumn<qreal>("value");
-
- QList<QGeoSatelliteInfo::Attribute> props;
- props << QGeoSatelliteInfo::Elevation
- << QGeoSatelliteInfo::Azimuth;
- for (int i=0; i<props.count(); i++) {
- QTest::newRow(qPrintable(QString("Attribute %1 = -1.0").arg(props[i])))
- << props[i]
- << qreal(-1.0);
- QTest::newRow(qPrintable(QString("Attribute %1 = 0.0").arg(props[i])))
- << props[i]
- << qreal(0.0);
- QTest::newRow(qPrintable(QString("Attribute %1 = 1.0").arg(props[i])))
- << props[i]
- << qreal(1.0);
- }
- }
-
- void hasAttribute()
- {
- QFETCH(QGeoSatelliteInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoSatelliteInfo u;
- QVERIFY(!u.hasAttribute(attribute));
-
- u.setAttribute(attribute, value);
- QVERIFY(u.hasAttribute(attribute));
-
- u.removeAttribute(attribute);
- QVERIFY(!u.hasAttribute(attribute));
- }
-
- void hasAttribute_data()
- {
- attribute_data();
- }
-
- void removeAttribute()
- {
- QFETCH(QGeoSatelliteInfo::Attribute, attribute);
- QFETCH(qreal, value);
-
- QGeoSatelliteInfo u;
- QVERIFY(!u.hasAttribute(attribute));
-
- u.setAttribute(attribute, value);
- QVERIFY(u.hasAttribute(attribute));
-
- u.removeAttribute(attribute);
- QVERIFY(!u.hasAttribute(attribute));
-
- u.setAttribute(attribute, value);
- QVERIFY(u.hasAttribute(attribute));
- }
-
- void removeAttribute_data()
- {
- attribute_data();
- }
-
- void datastream()
- {
- QFETCH(QGeoSatelliteInfo, info);
-
- QByteArray ba;
- QDataStream out(&ba, QIODevice::WriteOnly);
- out << info;
-
- QDataStream in(&ba, QIODevice::ReadOnly);
- QGeoSatelliteInfo inInfo;
- in >> inInfo;
- QCOMPARE(inInfo, info);
- }
-
- void datastream_data()
- {
- addTestData_update();
- }
-
- void debug()
- {
- QFETCH(QGeoSatelliteInfo, info);
- QFETCH(int, nextValue);
- QFETCH(QByteArray, debugString);
-
- qInstallMessageHandler(tst_qgeosatelliteinfo_messageHandler);
- qDebug() << info << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(QString(tst_qgeosatelliteinfo_debug), QString(debugString));
- }
-
- void debug_data()
- {
- QTest::addColumn<QGeoSatelliteInfo>("info");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QByteArray>("debugString");
-
- QGeoSatelliteInfo info;
-
- QTest::newRow("uninitialized") << info << 45
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=-1) 45");
-
- info = QGeoSatelliteInfo();
- info.setSignalStrength(1);
- QTest::newRow("with SignalStrength") << info << 60
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=1) 60");
-
- info = QGeoSatelliteInfo();
- info.setSatelliteIdentifier(1);
- QTest::newRow("with SatelliteIdentifier") << info << -1
- << QByteArray("QGeoSatelliteInfo(system=0, satId=1, signal-strength=-1) -1");
-
- info = QGeoSatelliteInfo();
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- QTest::newRow("with System GPS") << info << 1
- << QByteArray("QGeoSatelliteInfo(system=1, satId=-1, signal-strength=-1) 1");
-
- info = QGeoSatelliteInfo();
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- QTest::newRow("with System GLONASS") << info << 56
- << QByteArray("QGeoSatelliteInfo(system=2, satId=-1, signal-strength=-1) 56");
-
- info = QGeoSatelliteInfo();
- info.setAttribute(QGeoSatelliteInfo::Elevation, 1.1);
- QTest::newRow("with Elevation") << info << 0
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=-1, Elevation=1.1) 0");
-
- info = QGeoSatelliteInfo();
- info.setAttribute(QGeoSatelliteInfo::Azimuth, 1.1);
- QTest::newRow("with Azimuth") << info << 45
- << QByteArray("QGeoSatelliteInfo(system=0, satId=-1, signal-strength=-1, Azimuth=1.1) 45");
- }
-};
-
-
-QTEST_APPLESS_MAIN(tst_QGeoSatelliteInfo)
-#include "tst_qgeosatelliteinfo.moc"
diff --git a/tests/auto/qgeosatelliteinfosource/CMakeLists.txt b/tests/auto/qgeosatelliteinfosource/CMakeLists.txt
deleted file mode 100644
index 3e2c64fb..00000000
--- a/tests/auto/qgeosatelliteinfosource/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from qgeosatelliteinfosource.pro.
-
-#####################################################################
-## tst_qgeosatelliteinfosource Binary:
-#####################################################################
-
-qt_internal_add_test(tst_qgeosatelliteinfosource
- SOURCES
- ../utils/qlocationtestutils.cpp ../utils/qlocationtestutils_p.h
- testqgeosatelliteinfosource.cpp testqgeosatelliteinfosource_p.h
- tst_qgeosatelliteinfosource.cpp
- LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qgeosatelliteinfosource.pro:<TRUE>:
-# TEMPLATE = "app"
-
-## Scopes:
-#####################################################################
diff --git a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
deleted file mode 100644
index 4ca0f214..00000000
--- a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-!no_system_tests:CONFIG += testcase
-TARGET=tst_qgeosatelliteinfosource
-
-SOURCES += tst_qgeosatelliteinfosource.cpp \
- testqgeosatelliteinfosource.cpp \
- ../utils/qlocationtestutils.cpp
-
-HEADERS += testqgeosatelliteinfosource_p.h \
- ../utils/qlocationtestutils_p.h
-
-QT += positioning testlib
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
deleted file mode 100644
index f4a5c6ee..00000000
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
+++ /dev/null
@@ -1,766 +0,0 @@
-/*****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QMetaType>
-#include <QSignalSpy>
-#include <QDebug>
-#include <QTimer>
-
-#include <QtPositioning/qgeosatelliteinfosource.h>
-#include <QtPositioning/qgeosatelliteinfo.h>
-
-#include "testqgeosatelliteinfosource_p.h"
-#include "../utils/qlocationtestutils_p.h"
-
-Q_DECLARE_METATYPE(QList<QGeoSatelliteInfo>)
-Q_DECLARE_METATYPE(QGeoSatelliteInfoSource::Error)
-
-#define MAX_WAITING_TIME 50000
-
-// Must provide a valid source, unless testing the source
-// returned by QGeoSatelliteInfoSource::createDefaultSource() on a system
-// that has no default source
-#define CHECK_SOURCE_VALID { \
- if (!m_source) { \
- if (m_testingDefaultSource && QGeoSatelliteInfoSource::createDefaultSource(0) == 0) \
- QSKIP("No default satellite source on this system"); \
- else \
- QFAIL("createTestSource() must return a valid source!"); \
- } \
- }
-
-class MySatelliteSource : public QGeoSatelliteInfoSource
-{
- Q_OBJECT
-public:
- MySatelliteSource(QObject *parent = 0)
- : QGeoSatelliteInfoSource(parent) {
- }
- virtual void startUpdates() override {}
- virtual void stopUpdates() override {}
- virtual void requestUpdate(int) override {}
- virtual int minimumUpdateInterval() const override {
- return 0;
- }
- Error error() const override { return QGeoSatelliteInfoSource::NoError; }
-};
-
-
-class DefaultSourceTest : public TestQGeoSatelliteInfoSource
-{
- Q_OBJECT
-protected:
- QGeoSatelliteInfoSource *createTestSource() override {
- return QGeoSatelliteInfoSource::createDefaultSource(0);
- }
-};
-
-TestQGeoSatelliteInfoSource::TestQGeoSatelliteInfoSource(QObject *parent)
- : QObject(parent)
-{
- qRegisterMetaType<QGeoSatelliteInfoSource::Error>();
-
- m_testingDefaultSource = false;
-}
-
-TestQGeoSatelliteInfoSource *TestQGeoSatelliteInfoSource::createDefaultSourceTest()
-{
- DefaultSourceTest *test = new DefaultSourceTest;
- test->m_testingDefaultSource = true;
- return test;
-}
-
-void TestQGeoSatelliteInfoSource::base_initTestCase()
-{
- qRegisterMetaType<QList<QGeoSatelliteInfo> >();
-}
-
-void TestQGeoSatelliteInfoSource::base_init()
-{
- m_source = createTestSource();
- m_testSlot2Called = false;
-}
-
-void TestQGeoSatelliteInfoSource::base_cleanup()
-{
- delete m_source;
- m_source = 0;
-}
-
-void TestQGeoSatelliteInfoSource::base_cleanupTestCase()
-{
-}
-
-void TestQGeoSatelliteInfoSource::initTestCase()
-{
- base_initTestCase();
-}
-
-void TestQGeoSatelliteInfoSource::init()
-{
- base_init();
-}
-
-void TestQGeoSatelliteInfoSource::cleanup()
-{
- base_cleanup();
-}
-
-void TestQGeoSatelliteInfoSource::cleanupTestCase()
-{
- base_cleanupTestCase();
-}
-
-void TestQGeoSatelliteInfoSource::test_slot1()
-{
-}
-
-void TestQGeoSatelliteInfoSource::test_slot2()
-{
- m_testSlot2Called = true;
-}
-
-void TestQGeoSatelliteInfoSource::constructor_withParent()
-{
- auto parent = std::make_unique<QObject>();
- new MySatelliteSource(parent.get());
-}
-
-void TestQGeoSatelliteInfoSource::constructor_noParent()
-{
- MySatelliteSource *obj = new MySatelliteSource();
- delete obj;
-}
-
-void TestQGeoSatelliteInfoSource::createDefaultSource()
-{
- auto parent = std::make_unique<QObject>();
- // source will be deleted by parent
- QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(parent.get());
-
- // Check that default satellite source is successfully created.
- if (!QGeoSatelliteInfoSource::availableSources().isEmpty())
- QVERIFY(source);
- else
- QVERIFY(!source);
-}
-
-void TestQGeoSatelliteInfoSource::createDefaultSource_noParent()
-{
- std::unique_ptr<QGeoSatelliteInfoSource> source(
- QGeoSatelliteInfoSource::createDefaultSource(0));
-
- // Check that default satellite source is successfully created.
- if (!QGeoSatelliteInfoSource::availableSources().isEmpty())
- QVERIFY(source);
- else
- QVERIFY(!source);
-}
-
-void TestQGeoSatelliteInfoSource::updateInterval()
-{
- MySatelliteSource s;
- QCOMPARE(s.updateInterval(), 0);
-}
-
-void TestQGeoSatelliteInfoSource::setUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QFETCH(int, interval);
- QFETCH(int, expectedInterval);
-
- m_source->setUpdateInterval(interval);
- QCOMPARE(m_source->updateInterval(), expectedInterval);
-}
-
-void TestQGeoSatelliteInfoSource::setUpdateInterval_data()
-{
- QTest::addColumn<int>("interval");
- QTest::addColumn<int>("expectedInterval");
- QGeoSatelliteInfoSource *source = createTestSource();
- int minUpdateInterval = source ? source->minimumUpdateInterval() : -1;
- if (source)
- delete source;
-
- QTest::newRow("0") << 0 << 0;
-
- if (minUpdateInterval > -1) {
- QTest::newRow("INT_MIN") << INT_MIN << minUpdateInterval;
- QTest::newRow("-1") << -1 << minUpdateInterval;
- }
-
- if (minUpdateInterval > 0) {
- QTest::newRow("more than minInterval") << minUpdateInterval + 1 << minUpdateInterval + 1;
- QTest::newRow("equal to minInterval") << minUpdateInterval << minUpdateInterval;
- }
-
- if (minUpdateInterval > 1) {
- QTest::newRow("less then minInterval") << minUpdateInterval - 1 << minUpdateInterval;
- QTest::newRow("in btw zero and minInterval") << 1 << minUpdateInterval;
- }
-}
-
-void TestQGeoSatelliteInfoSource::minimumUpdateInterval()
-{
- CHECK_SOURCE_VALID;
-
- QVERIFY(m_source->minimumUpdateInterval() > 0);
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_testIntervals()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(1000);
- const int interval = 10000;
-
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), interval);
- for (int i = 0; i < 6; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1) && (errorSpy.count() == 0), interval);
- spyView.clear();
- spyUse.clear();
- }
- m_source->stopUpdates();
-}
-
-
-void TestQGeoSatelliteInfoSource::startUpdates_testIntervalChangesWhileRunning()
-{
- // There are two ways of dealing with an interval change, and we have left it system dependent.
- // The interval can be changed will running or after the next update.
- // WinCE uses the first method, S60 uses the second method.
-
- // The minimum interval on the symbian emulator is 5000 msecs, which is why the times in
- // this test are as high as they are.
-
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
- m_source->setUpdateInterval(0);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0), 7000);
- QCOMPARE(errorSpy.count(), 0);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(2000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 30000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(1000);
-
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
-
- m_source->setUpdateInterval(0);
-
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_testDefaultInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- for (int i = 0; i < 3; i++) {
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
- }
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_testZeroInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- for (int i = 0; i < 3; i++) {
- QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
- }
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::startUpdates_moreThanOnce()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->startUpdates(); // check there is no crash
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0), MAX_WAITING_TIME);
-
- m_source->startUpdates(); // check there is no crash
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::stopUpdates()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(1000);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- for (int i = 0; i < 2; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 12000);
- spyView.clear();
- spyUse.clear();
- }
-
- m_source->stopUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 0) && (spyUse.count() == 0), 12000);
-}
-
-void TestQGeoSatelliteInfoSource::stopUpdates_withoutStart()
-{
- CHECK_SOURCE_VALID;
-
- m_source->stopUpdates(); // check there is no crash
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate()
-{
- CHECK_SOURCE_VALID;
-
- QFETCH(int, timeout);
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(timeout);
-
- if (!errorSpy.isEmpty()) {
- // make sure that it's the UpdateTimeoutError
- const auto error = errorSpy[0][0].value<QGeoSatelliteInfoSource::Error>();
- QCOMPARE(error, QGeoSatelliteInfoSource::UpdateTimeoutError);
- // errorSpy.clear(); // no need to clear the error, as we are expecting it
- }
-
- // Geoclue may deliver update instantly if there is a satellite fix
- QTRY_VERIFY_WITH_TIMEOUT(!errorSpy.isEmpty() || !spyView.isEmpty(), 10);
- if (!errorSpy.isEmpty()) {
- // make sure that it's the UpdateTimeoutError
- const auto error = errorSpy[0][0].value<QGeoSatelliteInfoSource::Error>();
- QCOMPARE(error, QGeoSatelliteInfoSource::UpdateTimeoutError);
- }
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_data()
-{
- QTest::addColumn<int>("timeout");
- QTest::newRow("less than zero") << -1;
- QTest::newRow("very small timeout") << 1;
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_validTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT(
- (spyView.count() == 1) && (spyUse.count() == 1 && (errorSpy.count()) == 0), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_defaultTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(0);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT(
- (spyView.count() == 1) && (spyUse.count() == 1 && (errorSpy.count()) == 0),
- MAX_WAITING_TIME);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_timeoutLessThanMinimumInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1);
-
- QTRY_COMPARE_WITH_TIMEOUT(errorSpy.count(), 1, 1000);
- const auto error = errorSpy[0][0].value<QGeoSatelliteInfoSource::Error>();
- QCOMPARE(error, QGeoSatelliteInfoSource::UpdateTimeoutError);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_repeatedCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
- spyView.clear();
- spyUse.clear();
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCalls()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCallsWithTimeout()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(0);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->requestUpdate(1);
-
- QTRY_COMPARE_WITH_TIMEOUT(errorSpy.count(), 0, 7000);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1), MAX_WAITING_TIME);
- spyView.clear();
- spyUse.clear();
-
- m_source->requestUpdate(1500);
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1)
- && (errorSpy.count() == 0), 7000);
-
- spyView.clear();
- spyUse.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1), 12000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
-
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->setUpdateInterval(3000);
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0)
- && (errorSpy.count() == 0), 7000);
-
- spyView.clear();
- spyUse.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 12000);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->setUpdateInterval(0);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 2) && (spyUse.count() >= 2) && (errorSpy.count() == 0), 14000);
- spyView.clear();
- spyUse.clear();
-
- QTest::qWait(1500);
-
- QCOMPARE(errorSpy.count(), 0);
-
- m_source->stopUpdates();
-}
-
-void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_SmallInterval()
-{
- CHECK_SOURCE_VALID;
- QSignalSpy spyView(m_source,
- SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy spyUse(m_source,
- SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
- QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
-
- m_source->requestUpdate(1500);
-
- if (!errorSpy.isEmpty())
- QSKIP("Error starting satellite updates.");
-
- m_source->setUpdateInterval(2000);
- m_source->startUpdates();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
- spyView.clear();
- spyUse.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0) && (errorSpy.count() == 0), 20000);
-
- m_source->stopUpdates();
-}
-
-
-
-void TestQGeoSatelliteInfoSource::removeSlotForRequestTimeout()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i==true);
- i = connect(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)), \
- this, SLOT(test_slot2()));
- QVERIFY(i==true);
- i = disconnect(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)),
- this, SLOT(test_slot1()));
- QVERIFY(i==true);
-
- m_source->requestUpdate(-1);
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 1000);
-}
-
-void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInUseUpdated()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(1500);
-
- if (m_source->error() != QGeoSatelliteInfoSource::NoError)
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInViewUpdated()
-{
- CHECK_SOURCE_VALID;
-
- bool i = connect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
- i = connect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot2()));
- QVERIFY(i == true);
- i = disconnect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
- QVERIFY(i == true);
-
- m_source->requestUpdate(1500);
-
- if (m_source->error() != QGeoSatelliteInfoSource::NoError)
- QSKIP("Error starting satellite updates.");
-
- QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
-}
-
-void TestQGeoSatelliteInfoSource::bindings()
-{
- CHECK_SOURCE_VALID;
-
- QTestPrivate::testReadWritePropertyBasics<QGeoSatelliteInfoSource, int>(*m_source, 1000, 2000,
- "updateInterval");
-}
-
-#include "testqgeosatelliteinfosource.moc"
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
deleted file mode 100644
index 48b45536..00000000
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TESTQGEOSATELLITEINFOSOURCE_H
-#define TESTQGEOSATELLITEINFOSOURCE_H
-
-#include <QObject>
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-
-QT_BEGIN_NAMESPACE
-class QGeoSatelliteInfoSource;
-QT_END_NAMESPACE
-
-
-class TestQGeoSatelliteInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- TestQGeoSatelliteInfoSource(QObject *parent = 0);
-
- static TestQGeoSatelliteInfoSource *createDefaultSourceTest();
-
-protected:
- virtual QGeoSatelliteInfoSource *createTestSource() = 0;
-
- // MUST be called by subclasses if they override respective test slots
- void base_initTestCase();
- void base_init();
- void base_cleanup();
- void base_cleanupTestCase();
-
-public slots:
- void test_slot1();
- void test_slot2();
-
-private slots:
- void initTestCase();
- void init();
- void cleanup();
- void cleanupTestCase();
-
- void constructor_withParent();
- void constructor_noParent();
-
- void updateInterval();
-
- void setUpdateInterval();
- void setUpdateInterval_data();
-
- void minimumUpdateInterval();
-
- void createDefaultSource();
- void createDefaultSource_noParent();
-
- void startUpdates_testIntervals();
- void startUpdates_testIntervalChangesWhileRunning();
- void startUpdates_testDefaultInterval();
- void startUpdates_testZeroInterval();
- void startUpdates_moreThanOnce();
- void stopUpdates();
- void stopUpdates_withoutStart();
-
- void requestUpdate();
- void requestUpdate_data();
-
- void requestUpdate_validTimeout();
- void requestUpdate_defaultTimeout();
- void requestUpdate_timeoutLessThanMinimumInterval();
- void requestUpdate_repeatedCalls();
- void requestUpdate_overlappingCalls();
- void requestUpdate_overlappingCallsWithTimeout();
-
- void requestUpdateAfterStartUpdates_ZeroInterval();
- void requestUpdateAfterStartUpdates_SmallInterval();
- void requestUpdateBeforeStartUpdates_ZeroInterval();
- void requestUpdateBeforeStartUpdates_SmallInterval();
-
- void removeSlotForRequestTimeout();
- void removeSlotForSatellitesInUseUpdated();
- void removeSlotForSatellitesInViewUpdated();
-
- void bindings();
-
-private:
- QGeoSatelliteInfoSource *m_source;
- bool m_testingDefaultSource;
- bool m_testSlot2Called;
-};
-
-#endif // #ifndef TESTQGEOSATELLITEINFOSOURCE_H
diff --git a/tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp b/tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp
deleted file mode 100644
index ae97d703..00000000
--- a/tests/auto/qgeosatelliteinfosource/tst_qgeosatelliteinfosource.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "testqgeosatelliteinfosource_p.h"
-#include <QDebug>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- std::unique_ptr<TestQGeoSatelliteInfoSource> test(TestQGeoSatelliteInfoSource::createDefaultSourceTest());
- return QTest::qExec(test.get(), argc, argv);
-}
diff --git a/tests/auto/qgeoshape/CMakeLists.txt b/tests/auto/qgeoshape/CMakeLists.txt
deleted file mode 100644
index a07a7e1d..00000000
--- a/tests/auto/qgeoshape/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generated from qgeoshape.pro.
-
-#####################################################################
-## tst_qgeoshape Binary:
-#####################################################################
-
-qt_internal_add_test(tst_qgeoshape
- SOURCES
- tst_qgeoshape.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
diff --git a/tests/auto/qgeoshape/qgeoshape.pro b/tests/auto/qgeoshape/qgeoshape.pro
deleted file mode 100644
index dd551382..00000000
--- a/tests/auto/qgeoshape/qgeoshape.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-load(testcase)
-TARGET = tst_qgeoshape
-QT += testlib positioning
-SOURCES = \
- tst_qgeoshape.cpp
diff --git a/tests/auto/qgeoshape/tst_qgeoshape.cpp b/tests/auto/qgeoshape/tst_qgeoshape.cpp
deleted file mode 100644
index d7badb0f..00000000
--- a/tests/auto/qgeoshape/tst_qgeoshape.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtPositioning/QGeoShape>
-#include <QtCore/QDebug>
-#include <QtPositioning/QGeoRectangle>
-#include <QtPositioning/QGeoCircle>
-#include <QtPositioning/QGeoPath>
-#include <QtPositioning/QGeoPolygon>
-
-QString tst_qgeoshape_debug;
-
-void tst_qgeoshape_messageHandler(QtMsgType type, const QMessageLogContext&,
- const QString &msg)
-{
- switch (type) {
- case QtDebugMsg :
- tst_qgeoshape_debug = msg;
- break;
- default:
- break;
- }
-}
-
-class tst_qgeoshape : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testArea();
- void debug_data();
- void debug();
- void conversions();
- void serialization();
- void hashing();
-};
-
-void tst_qgeoshape::testArea()
-{
- QGeoShape area;
- QVERIFY(!area.isValid());
- QVERIFY(area.isEmpty());
- QCOMPARE(area.type(), QGeoShape::UnknownType);
- QVERIFY(!area.contains(QGeoCoordinate()));
-
- // QGeoShape never constructs a QGeoShapePrivate. Hence d_ptr is always 0.
-
- QGeoShape area2;
-
- QCOMPARE(area, area2);
-
- area = area2;
-
- QCOMPARE(area, area2);
-
- QGeoShape area3(area2);
-
- QCOMPARE(area2, area3);
-}
-
-void tst_qgeoshape::debug_data()
-{
- QTest::addColumn<QGeoShape>("shape");
- QTest::addColumn<int>("nextValue");
- QTest::addColumn<QString>("debugString");
-
- QTest::newRow("uninitialized") << QGeoShape() << 45
- << QString("QGeoShape(Unknown) 45");
- QTest::newRow("rectangle") << QGeoShape(QGeoRectangle()) << 45
- << QString("QGeoShape(Rectangle) 45");
- QTest::newRow("circle") << QGeoShape(QGeoCircle()) << 45
- << QString("QGeoShape(Circle) 45");
- QTest::newRow("polygon") << QGeoShape(QGeoPolygon()) << 45
- << QString("QGeoShape(Polygon) 45");
- QTest::newRow("path") << QGeoShape(QGeoPath()) << 45
- << QString("QGeoShape(Path) 45");
-}
-
-
-void tst_qgeoshape::debug()
-{
- QFETCH(QGeoShape, shape);
- QFETCH(int, nextValue);
- QFETCH(QString, debugString);
-
- qInstallMessageHandler(tst_qgeoshape_messageHandler);
- qDebug() << shape << nextValue;
- qInstallMessageHandler(0);
- QCOMPARE(tst_qgeoshape_debug, debugString);
-}
-
-void tst_qgeoshape::conversions()
-{
- QVariant varShape = QVariant::fromValue(QGeoShape());
- QVariant varRect = QVariant::fromValue(QGeoRectangle(
- QGeoCoordinate(1, 1),
- QGeoCoordinate(2, 2)));
- QVariant varCircle = QVariant::fromValue(QGeoCircle(QGeoCoordinate(3, 3), 1000));
-
- QVERIFY(varShape.canConvert<QGeoShape>());
- QVERIFY(varShape.canConvert<QGeoCircle>());
- QVERIFY(varShape.canConvert<QGeoRectangle>());
- QVERIFY(!varRect.canConvert<QGeoCircle>());
- QVERIFY(varRect.canConvert<QGeoRectangle>());
- QVERIFY(varRect.canConvert<QGeoShape>());
- QVERIFY(varCircle.canConvert<QGeoCircle>());
- QVERIFY(!varCircle.canConvert<QGeoRectangle>());
- QVERIFY(varCircle.canConvert<QGeoShape>());
-}
-
-void tst_qgeoshape::serialization()
-{
- QByteArray data;
- // empty shape
- {
- QGeoShape shape;
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << shape;
-
- QGeoShape otherShape;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherShape;
-
- QCOMPARE(otherShape, shape);
- }
- // circle
- {
- QGeoCircle circle(QGeoCoordinate(1.1, 2.2), 10.5);
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << circle;
-
- QGeoShape otherCircle;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherCircle;
-
- QCOMPARE(otherCircle, circle);
- }
- // rectangle
- {
- QGeoRectangle rectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170));
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << rectangle;
-
- QGeoShape otherRectangle;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherRectangle;
-
- QCOMPARE(otherRectangle, rectangle);
- }
- // polygon
- {
- QGeoPolygon polygon({ QGeoCoordinate(30, 160),
- QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 160) });
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << polygon;
-
- QGeoShape otherPolygon;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherPolygon;
-
- QCOMPARE(otherPolygon, polygon);
- }
- // path
- {
- QGeoPath path({ QGeoCoordinate(30, 160), QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 180) }, 0.5);
- QDataStream writeStream(&data, QDataStream::WriteOnly);
- writeStream << path;
-
- QGeoShape otherPath;
- QDataStream readStream(&data, QDataStream::ReadOnly);
- readStream >> otherPath;
-
- QCOMPARE(otherPath, path);
- }
-}
-
-void tst_qgeoshape::hashing()
-{
- const size_t defaultShapeHash = qHash(QGeoShape());
-
- const QGeoCircle circle(QGeoCoordinate(1, 2), 10);
- const QGeoShape circleShape = circle;
- const size_t circleShapeHash = qHash(circleShape);
- QVERIFY(defaultShapeHash != circleShapeHash);
- QCOMPARE(qHash(circle), circleShapeHash);
-
- const QGeoRectangle rectangle(QGeoCoordinate(30, 160), QGeoCoordinate(-30, 170));
- const QGeoShape rectangleShape = rectangle;
- const size_t rectangleShapeHash = qHash(rectangleShape);
- QVERIFY(defaultShapeHash != rectangleShapeHash);
- QVERIFY(circleShapeHash != rectangleShapeHash);
- QCOMPARE(qHash(rectangle), rectangleShapeHash);
-
- const QGeoPolygon polygon({ QGeoCoordinate(30, 160), QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 160) });
- const QGeoShape polygonShape = polygon;
- const size_t polygonShapeHash = qHash(polygonShape);
- QVERIFY(defaultShapeHash != polygonShapeHash);
- QVERIFY(circleShapeHash != polygonShapeHash);
- QVERIFY(rectangleShapeHash != polygonShapeHash);
- QCOMPARE(qHash(polygon), polygonShapeHash);
-
- const QGeoPath path({ QGeoCoordinate(30, 160), QGeoCoordinate(0, 170),
- QGeoCoordinate(-30, 180) }, 0.5);
- const QGeoShape pathShape = path;
- const size_t pathShapeHash = qHash(pathShape);
- QVERIFY(defaultShapeHash != pathShapeHash);
- QVERIFY(circleShapeHash != pathShapeHash);
- QVERIFY(rectangleShapeHash != pathShapeHash);
- QVERIFY(polygonShapeHash != pathShapeHash);
- QCOMPARE(qHash(path), pathShapeHash);
-}
-
-QTEST_MAIN(tst_qgeoshape)
-#include "tst_qgeoshape.moc"
diff --git a/tests/auto/qnmeapositioninfosource/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/CMakeLists.txt
deleted file mode 100644
index 6ac0e05c..00000000
--- a/tests/auto/qnmeapositioninfosource/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from qnmeapositioninfosource.pro.
-
-add_subdirectory(dummynmeapositioninfosource)
-add_subdirectory(qnmeapositioninfosource_realtime)
-add_subdirectory(qnmeapositioninfosource_simulation)
-add_subdirectory(qnmeapositioninfosource_realtime_generic)
-add_subdirectory(qnmeapositioninfosource_simulation_generic)
diff --git a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt
deleted file mode 100644
index d152dc72..00000000
--- a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated from dummynmeapositioninfosource.pro.
-
-#####################################################################
-## tst_dummynmeapositioninfosource Test:
-#####################################################################
-
-qt_internal_add_test(tst_dummynmeapositioninfosource
- SOURCES
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_dummynmeapositioninfosource.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
-)
-
-#### Keys ignored in scope 1:.:.:dummynmeapositioninfosource.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro b/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro
deleted file mode 100644
index d32e2e31..00000000
--- a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/dummynmeapositioninfosource.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-QT += network positioning testlib
-TARGET = tst_dummynmeapositioninfosource
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- tst_dummynmeapositioninfosource.cpp
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp b/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp
deleted file mode 100644
index 70059550..00000000
--- a/tests/auto/qnmeapositioninfosource/dummynmeapositioninfosource/tst_dummynmeapositioninfosource.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "../utils/qnmeaproxyfactory.h"
-#include "../utils/qlocationtestutils_p.h"
-
-#include <QtPositioning/qnmeapositioninfosource.h>
-#include <QSignalSpy>
-#include <QTest>
-
-Q_DECLARE_METATYPE(QNmeaPositionInfoSource::UpdateMode)
-
-class DummyNmeaPositionInfoSource : public QNmeaPositionInfoSource
-{
- Q_OBJECT
-
-public:
- DummyNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent = 0);
-
-protected:
- bool parsePosInfoFromNmeaData(const char *data,
- int size,
- QGeoPositionInfo *posInfo,
- bool *hasFix) override;
-
-private:
- int callCount;
-};
-
-DummyNmeaPositionInfoSource::DummyNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent) :
- QNmeaPositionInfoSource(mode, parent),
- callCount(0)
-{
-}
-
-bool DummyNmeaPositionInfoSource::parsePosInfoFromNmeaData(const char* data,
- int size,
- QGeoPositionInfo *posInfo,
- bool *hasFix)
-{
- Q_UNUSED(data);
- Q_UNUSED(size);
-
- posInfo->setCoordinate(QGeoCoordinate(callCount * 1.0, callCount * 1.0, callCount * 1.0));
- posInfo->setTimestamp(QDateTime::currentDateTimeUtc());
- *hasFix = true;
- ++callCount;
-
- return true;
-}
-
-class tst_DummyNmeaPositionInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- tst_DummyNmeaPositionInfoSource();
-
-private slots:
- void initTestCase();
- void testOverloadedParseFunction();
-};
-
-
-tst_DummyNmeaPositionInfoSource::tst_DummyNmeaPositionInfoSource() {}
-
-void tst_DummyNmeaPositionInfoSource::initTestCase()
-{
-
-}
-
-void tst_DummyNmeaPositionInfoSource::testOverloadedParseFunction()
-{
- DummyNmeaPositionInfoSource source(QNmeaPositionInfoSource::RealTimeMode);
- QNmeaProxyFactory factory;
- // proxy is deleted by the source
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
-
- QGeoPositionInfo pos;
-
- proxy->source()->startUpdates();
-
- proxy->feedBytes(QString("The parser converts\n").toLatin1());
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1), 10000);
- pos = spy.at(0).at(0).value<QGeoPositionInfo>();
-
- QVERIFY((pos.coordinate().latitude() == 0.0)
- && (pos.coordinate().longitude() == 0.0)
- && (pos.coordinate().altitude() == 0.0));
-
- spy.clear();
-
- proxy->feedBytes(QString("any data it receives\n").toLatin1());
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1), 10000);
- pos = spy.at(0).at(0).value<QGeoPositionInfo>();
-
- QVERIFY((pos.coordinate().latitude() == 1.0)
- && (pos.coordinate().longitude() == 1.0)
- && (pos.coordinate().altitude() == 1.0));
-
- spy.clear();
-
- proxy->feedBytes(QString("into positions\n").toLatin1());
-
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1), 10000);
- pos = spy.at(0).at(0).value<QGeoPositionInfo>();
-
- QVERIFY((pos.coordinate().latitude() == 2.0)
- && (pos.coordinate().longitude() == 2.0)
- && (pos.coordinate().altitude() == 2.0));
-
- spy.clear();
-}
-
-#include "tst_dummynmeapositioninfosource.moc"
-
-QTEST_GUILESS_MAIN(tst_DummyNmeaPositionInfoSource);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro
deleted file mode 100644
index 8c168d52..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += \
- dummynmeapositioninfosource \
- qnmeapositioninfosource_realtime \
- qnmeapositioninfosource_simulation \
- qnmeapositioninfosource_realtime_generic \
- qnmeapositioninfosource_simulation_generic
-
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt
deleted file mode 100644
index 4ca5f9a2..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from qnmeapositioninfosource_realtime.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_realtime Test:
-#####################################################################
-
-qt_internal_add_test(tst_qnmeapositioninfosource_realtime
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_realtime.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_realtime.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro
deleted file mode 100644
index fcff3d7a..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/qnmeapositioninfosource_realtime.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_realtime
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_realtime.cpp
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp
deleted file mode 100644
index 423f6573..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime/tst_qnmeapositioninfosource_realtime.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_RealTime : public tst_QNmeaPositionInfoSource
-{
- Q_OBJECT
-
-public:
- tst_QNmeaPositionInfoSource_RealTime()
- : tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode) {}
-};
-
-#include "tst_qnmeapositioninfosource_realtime.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_RealTime);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt
deleted file mode 100644
index d7f2bfdd..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated from qnmeapositioninfosource_realtime_generic.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_realtime_generic Test:
-#####################################################################
-
-qt_internal_add_test(tst_qnmeapositioninfosource_realtime_generic
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_realtime_generic.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_realtime_generic.pro:<TRUE>:
-# TEMPLATE = "app"
-# testcase.timeout = "400"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
deleted file mode 100644
index 0fbbd76e..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-testcase.timeout = 400 # this test is slow
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_realtime_generic
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_realtime_generic.cpp
-
-CONFIG -= app_bundle
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
deleted file mode 100644
index abb5e9ae..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_RealTime_Generic : public TestQGeoPositionInfoSource
-{
- Q_OBJECT
-
-public:
- tst_QNmeaPositionInfoSource_RealTime_Generic()
- {
- m_factory = new QNmeaProxyFactory;
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../../plugins"));
-#endif
-#endif
- }
-
- ~tst_QNmeaPositionInfoSource_RealTime_Generic()
- {
- delete m_factory;
- }
-
-protected:
- QGeoPositionInfoSource *createTestSource() override
- {
- QNmeaPositionInfoSource *source = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode);
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- m_factory->createPositionInfoSourceProxy(source));
- Feeder *feeder = new Feeder(source);
- feeder->start(proxy);
- return source;
- }
-
-private:
- QNmeaProxyFactory *m_factory;
-};
-
-#include "tst_qnmeapositioninfosource_realtime_generic.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_RealTime_Generic);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt
deleted file mode 100644
index f0ea5cec..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from qnmeapositioninfosource_simulation.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_simulation Test:
-#####################################################################
-
-qt_internal_add_test(tst_qnmeapositioninfosource_simulation
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_simulation.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_simulation.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro
deleted file mode 100644
index 88bb18f9..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/qnmeapositioninfosource_simulation.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_simulation
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_simulation.cpp
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp
deleted file mode 100644
index ffe5e1d0..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation/tst_qnmeapositioninfosource_simulation.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_Simulation : public tst_QNmeaPositionInfoSource
-{
- Q_OBJECT
-public:
- tst_QNmeaPositionInfoSource_Simulation()
- : tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode) {}
-};
-
-#include "tst_qnmeapositioninfosource_simulation.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_Simulation);
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt
deleted file mode 100644
index 9232f9a8..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Generated from qnmeapositioninfosource_simulation_generic.pro.
-
-#####################################################################
-## tst_qnmeapositioninfosource_simulation_generic Test:
-#####################################################################
-
-# special case begin
-
-# Renamed the target due to problems with the maximum full path on
-# Windows systems (which is 250 characters only)
-qt_internal_add_test(tst_qnmeaposinfosource_sim_generic
-# special case end
- SOURCES
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp ../../qgeopositioninfosource/testqgeopositioninfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- ../tst_qnmeapositioninfosource.cpp ../tst_qnmeapositioninfosource.h
- tst_qnmeapositioninfosource_simulation_generic.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-
-#### Keys ignored in scope 1:.:.:qnmeapositioninfosource_simulation_generic.pro:<TRUE>:
-# TEMPLATE = "app"
-# testcase.timeout = "400"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
deleted file mode 100644
index b198bf7c..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TEMPLATE = app
-CONFIG+=testcase
-testcase.timeout = 400 # this test is slow
-QT += network positioning testlib
-TARGET = tst_qnmeapositioninfosource_simulation_generic
-
-INCLUDEPATH += ..
-
-HEADERS += ../../utils/qlocationtestutils_p.h \
- ../../qgeopositioninfosource/testqgeopositioninfosource_p.h \
- ../../utils/qnmeaproxyfactory.h \
- ../tst_qnmeapositioninfosource.h
-
-SOURCES += ../../utils/qlocationtestutils.cpp \
- ../../qgeopositioninfosource/testqgeopositioninfosource.cpp \
- ../../utils/qnmeaproxyfactory.cpp \
- ../tst_qnmeapositioninfosource.cpp \
- tst_qnmeapositioninfosource_simulation_generic.cpp
-
-CONFIG -= app_bundle
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
deleted file mode 100644
index 2f2827de..00000000
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-class tst_QNmeaPositionInfoSource_Simulation_Generic : public TestQGeoPositionInfoSource
-{
- Q_OBJECT
-public:
- tst_QNmeaPositionInfoSource_Simulation_Generic()
- {
-#if QT_CONFIG(library)
- /*
- * Set custom path since CI doesn't install test plugins
- */
-#ifdef Q_OS_WIN
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
- QStringLiteral("/../../../../plugins"));
-#else
- QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
- + QStringLiteral("/../../../../plugins"));
-#endif
-#endif
- }
-
-protected:
- QGeoPositionInfoSource *createTestSource() override
- {
- QNmeaPositionInfoSource *source = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode);
- source->setDevice(new UnlimitedNmeaStream(source));
- return source;
- }
-};
-
-#include "tst_qnmeapositioninfosource_simulation_generic.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaPositionInfoSource_Simulation_Generic);
diff --git a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp b/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp
deleted file mode 100644
index e99faa6d..00000000
--- a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.cpp
+++ /dev/null
@@ -1,605 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/location
-
-#include "tst_qnmeapositioninfosource.h"
-
-#include <QtCore/QDateTime>
-#include <QtCore/QElapsedTimer>
-#include <QtCore/QtNumeric>
-
-#ifdef Q_OS_WIN
-
-// Windows seems to require longer timeouts and step length
-// We override the standard QTestCase related macros
-
-#ifdef QTRY_COMPARE_WITH_TIMEOUT
-#undef QTRY_COMPARE_WITH_TIMEOUT
-#endif
-#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
-do { \
- const int __step = 100; \
- const int __timeoutValue = __timeout; \
- if ((__expr) != (__expected)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeoutValue && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
-} while (0)
-
-#ifdef QTRY_COMPARE
-#undef QTRY_COMPARE
-#endif
-#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, 10000)
-
-#endif
-
-tst_QNmeaPositionInfoSource::tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent)
- : QObject(parent),
- m_mode(mode)
-{
-}
-
-void tst_QNmeaPositionInfoSource::initTestCase()
-{
- qRegisterMetaType<QNmeaPositionInfoSource::UpdateMode>();
-}
-
-void tst_QNmeaPositionInfoSource::constructor()
-{
- QObject o;
- QNmeaPositionInfoSource source(m_mode, &o);
- QCOMPARE(source.updateMode(), m_mode);
- QCOMPARE(source.parent(), &o);
-}
-
-void tst_QNmeaPositionInfoSource::supportedPositioningMethods()
-{
- QNmeaPositionInfoSource source(m_mode);
- QCOMPARE(source.supportedPositioningMethods(), QNmeaPositionInfoSource::SatellitePositioningMethods);
-}
-
-void tst_QNmeaPositionInfoSource::minimumUpdateInterval()
-{
- QNmeaPositionInfoSource source(m_mode);
- QCOMPARE(source.minimumUpdateInterval(), 2);
-}
-
-void tst_QNmeaPositionInfoSource::userEquivalentRangeError()
-{
- QNmeaPositionInfoSource source(m_mode);
- QVERIFY(qIsNaN(source.userEquivalentRangeError()));
- source.setUserEquivalentRangeError(5.1);
- QVERIFY(qFuzzyCompare(source.userEquivalentRangeError(), 5.1));
-}
-
-void tst_QNmeaPositionInfoSource::setUpdateInterval_delayedUpdate()
-{
- // If an update interval is set, and an update is not available at a
- // particular interval, the source should emit the next update as soon
- // as it becomes available
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->setUpdateInterval(500);
- proxy->source()->startUpdates();
-
- QTest::qWait(600);
- QDateTime now = QDateTime::currentDateTime();
- proxy->feedUpdate(now);
- QTRY_COMPARE(spyUpdate.count(), 1);
-
- // should have gotten the update immediately, and not have needed to
- // wait until the next interval
- QVERIFY(now.time().msecsTo(QDateTime::currentDateTime().time()) < 400);
-}
-
-void tst_QNmeaPositionInfoSource::lastKnownPosition()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QCOMPARE(proxy->source()->lastKnownPosition(), QGeoPositionInfo());
-
- // source may need requestUpdate() or startUpdates() to be called to
- // trigger reading of data channel
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- proxy->source()->requestUpdate(proxy->source()->minimumUpdateInterval());
- QTRY_COMPARE(spyTimeout.count(), 1);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
-
- // If an update is received and startUpdates() or requestUpdate() hasn't
- // been called, it should still be available through lastKnownPosition()
- QDateTime dt = QDateTime::currentDateTimeUtc();
- proxy->feedUpdate(dt);
- QTRY_COMPARE(proxy->source()->lastKnownPosition().timestamp(), dt);
-
- QList<QDateTime> dateTimes = createDateTimes(5);
- for (int i=0; i<dateTimes.count(); i++) {
- proxy->source()->requestUpdate(); // Irrelevant for this test
- proxy->feedUpdate(dateTimes[i]);
- QTRY_COMPARE(proxy->source()->lastKnownPosition().timestamp(), dateTimes[i]);
- }
-
- proxy->source()->startUpdates();
- // if dateTimes are older than before, they will be ignored.
- dateTimes = createDateTimes(dateTimes.last().addMSecs(100), 5);
- for (int i=0; i<dateTimes.count(); i++) {
- proxy->feedUpdate(dateTimes[i]);
- QTRY_COMPARE(proxy->source()->lastKnownPosition().timestamp(), dateTimes[i]);
- }
-}
-
-void tst_QNmeaPositionInfoSource::beginWithBufferedData()
-{
- // In SimulationMode, data stored in the QIODevice is read when
- // startUpdates() or requestUpdate() is called.
- // In RealTimeMode, all existing data in the QIODevice is ignored -
- // only new data will be read.
-
- QFETCH(QList<QDateTime>, dateTimes);
- QFETCH(UpdateTriggerMethod, trigger);
-
- QByteArray bytes;
- for (int i=0; i<dateTimes.count(); i++)
- bytes += QLocationTestUtils::createRmcSentence(dateTimes[i]).toLatin1();
- QBuffer buffer;
- buffer.setData(bytes);
-
- QNmeaPositionInfoSource source(m_mode);
- QSignalSpy spy(&source, SIGNAL(positionUpdated(QGeoPositionInfo)));
- source.setDevice(&buffer);
-
- if (trigger == StartUpdatesMethod)
- source.startUpdates();
- else if (trigger == RequestUpdatesMethod)
- source.requestUpdate();
-
- if (m_mode == QNmeaPositionInfoSource::RealTimeMode) {
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 0, 300);
- } else {
- if (trigger == StartUpdatesMethod) {
- QTRY_COMPARE(spy.count(), dateTimes.count());
- for (int i=0; i<dateTimes.count(); i++)
- QCOMPARE(spy.at(i).at(0).value<QGeoPositionInfo>().timestamp(), dateTimes[i]);
- } else if (trigger == RequestUpdatesMethod) {
- QTRY_COMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).value<QGeoPositionInfo>().timestamp(), dateTimes.first());
- }
- }
-}
-
-void tst_QNmeaPositionInfoSource::beginWithBufferedData_data()
-{
- QTest::addColumn<QList<QDateTime> >("dateTimes");
- QTest::addColumn<UpdateTriggerMethod>("trigger");
-
- QList<QDateTime> dateTimes;
- dateTimes << QDateTime::currentDateTime().toUTC();
-
- QTest::newRow("startUpdates(), 1 update in buffer") << dateTimes << StartUpdatesMethod;
- QTest::newRow("requestUpdate(), 1 update in buffer") << dateTimes << RequestUpdatesMethod;
-
- for (int i=1; i<3; i++)
- dateTimes << dateTimes[0].addMSecs(i * 100);
- QTest::newRow("startUpdates(), multiple updates in buffer") << dateTimes << StartUpdatesMethod;
- QTest::newRow("requestUpdate(), multiple updates in buffer") << dateTimes << RequestUpdatesMethod;
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates()
-{
- QFETCH(QList<QDateTime>, dateTimes);
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->startUpdates();
-
- for (int i=0; i<dateTimes.count(); i++)
- proxy->feedUpdate(dateTimes[i]);
- QTRY_COMPARE(spyUpdate.count(), dateTimes.count());
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_data()
-{
- QTest::addColumn<QList<QDateTime> >("dateTimes");
-
- QTest::newRow("1 update") << createDateTimes(1);
- QTest::newRow("2 updates") << createDateTimes(2);
- QTest::newRow("10 updates") << createDateTimes(10);
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_withTimeout()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- proxy->source()->setUpdateInterval(1000);
- proxy->source()->startUpdates();
-
- QDateTime dt = QDateTime::currentDateTimeUtc();
-
- if (m_mode == QNmeaPositionInfoSource::SimulationMode) {
- // the first sentence primes the simulation
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addMSecs(10)).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addMSecs(1100)).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addMSecs(2200)).toLatin1());
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(9)).toLatin1());
-
- QElapsedTimer t;
- t.start();
-
- for (int j = 1; j < 4; ++j) {
- QTRY_COMPARE(spyUpdate.count(), j);
- QCOMPARE(spyTimeout.count(), 0);
- int time = t.elapsed();
- QVERIFY((time > j*1000 - 300) && (time < j*1000 + 300));
- }
-
- spyUpdate.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 0) && (spyTimeout.count() == 1), 7500);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- spyTimeout.clear();
-
- QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 7500);
-
- } else {
- // dt + 900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 0);
-
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(1)).toLatin1());
- // dt + 1200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
-
- // dt + 1900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 0);
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(2)).toLatin1());
-
- // dt + 2200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
-
- // dt + 2900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 0);
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(3)).toLatin1());
-
- // dt + 3200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
-
- // dt + 6900
- QTRY_VERIFY(spyUpdate.count() == 0 && spyTimeout.count() == 1);
- const QList<QVariant> arguments = spyTimeout.takeFirst();
- const auto error = arguments.at(0).value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- spyTimeout.clear();
- proxy->feedBytes(QLocationTestUtils::createRmcSentence(dt.addSecs(7)).toLatin1());
-
- // dt + 7200
- QTRY_VERIFY(spyUpdate.count() == 1 && spyTimeout.count() == 0);
- spyUpdate.clear();
- }
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_expectLatestUpdateOnly()
-{
- // If startUpdates() is called and an interval has been set, if multiple'
- // updates are in the buffer, only the latest update should be emitted
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->setUpdateInterval(500);
- proxy->source()->startUpdates();
-
- QList<QDateTime> dateTimes = createDateTimes(3);
- for (int i=0; i<dateTimes.count(); i++)
- proxy->feedUpdate(dateTimes[i]);
-
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dateTimes.last());
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_waitForValidDateTime()
-{
- // Tests that the class does not emit an update until it receives a
- // sentences with a valid date *and* time. All sentences before this
- // should be ignored, and any sentences received after this that do
- // not have a date should use the known date.
-
- QFETCH(QByteArray, bytes);
- QFETCH(QList<QDateTime>, dateTimes);
- QFETCH(QList<bool>, expectHorizontalAccuracy);
- QFETCH(QList<bool>, expectVerticalAccuracy);
-
- QNmeaPositionInfoSource source(m_mode);
- source.setUserEquivalentRangeError(5.1);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QObject::connect(proxy->source(), &QNmeaPositionInfoSource::positionUpdated, [](const QGeoPositionInfo &info) {
- qDebug() << info.timestamp();
- });
-
- proxy->source()->startUpdates();
- proxy->feedBytes(bytes);
- QTest::qWait(1000); // default push delay is 20ms
- QTRY_COMPARE(spy.count(), dateTimes.count());
-
- for (int i=0; i<spy.count(); i++) {
- QGeoPositionInfo pInfo = spy[i][0].value<QGeoPositionInfo>();
-
- QCOMPARE(pInfo.timestamp(), dateTimes[i]);
-
- // Generated GGA/GSA sentences have hard coded HDOP of 3.5, which corrisponds to a
- // horizontal accuracy of 35.7, for the user equivalent range error of 5.1 set above.
- QCOMPARE(pInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy),
- expectHorizontalAccuracy[i]);
- if (pInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
- QVERIFY(qFuzzyCompare(pInfo.attribute(QGeoPositionInfo::HorizontalAccuracy), 35.7));
-
- // Generated GSA sentences have hard coded VDOP of 4.0, which corrisponds to a vertical
- // accuracy of 40.8, for the user equivalent range error of 5.1 set above.
- QCOMPARE(pInfo.hasAttribute(QGeoPositionInfo::VerticalAccuracy),
- expectVerticalAccuracy[i]);
- if (pInfo.hasAttribute(QGeoPositionInfo::VerticalAccuracy))
- QVERIFY(qFuzzyCompare(pInfo.attribute(QGeoPositionInfo::VerticalAccuracy), 40.8));
- }
-}
-
-void tst_QNmeaPositionInfoSource::startUpdates_waitForValidDateTime_data()
-{
- QTest::addColumn<QByteArray>("bytes");
- QTest::addColumn<QList<QDateTime> >("dateTimes");
- QTest::addColumn<QList<bool> >("expectHorizontalAccuracy");
- QTest::addColumn<QList<bool> >("expectVerticalAccuracy");
-
- QDateTime dt = QDateTime::currentDateTime().toUTC();
- QByteArray bytes;
-
- // should only receive RMC sentence and the GGA sentence *after* it
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(100).time()).toLatin1();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(200)).toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(300).time()).toLatin1();
- // The first GGA does not have date, and there's no cached date to inject, so that update will be invalid
- QTest::newRow("Feed GGA,RMC,GGA; expect RMC, second GGA only")
- << bytes << (QList<QDateTime>() << dt.addMSecs(200) << dt.addMSecs(300))
- << (QList<bool>() << true << true) // accuracies are currently cached and injected in QGeoPositionInfos that do not have it
- << (QList<bool>() << false << false);
-
- // should not receive ZDA (has no coordinates) but should get the GGA
- // sentence after it since it got the date/time from ZDA
- bytes.clear();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(100).time()).toLatin1();
- bytes += QLocationTestUtils::createZdaSentence(dt.addMSecs(200)).toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(300).time()).toLatin1();
- QTest::newRow("Feed GGA,ZDA,GGA; expect second GGA only")
- << bytes << (QList<QDateTime>() << dt.addMSecs(300))
- << (QList<bool>() << true)
- << (QList<bool>() << false);
-
- // Feed ZDA,GGA,GSA,GGA; expect vertical accuracy from second GGA.
- bytes.clear();
- bytes += QLocationTestUtils::createZdaSentence(dt.addMSecs(100)).toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(200).time()).toLatin1();
- bytes += QLocationTestUtils::createGsaSentence().toLatin1();
- bytes += QLocationTestUtils::createGgaSentence(dt.addMSecs(300).time()).toLatin1();
- if (m_mode == QNmeaPositionInfoSource::SimulationMode) {
- QTest::newRow("Feed ZDA,GGA,GSA,GGA; expect vertical accuracy from second GGA")
- << bytes << (QList<QDateTime>() << dt.addMSecs(200) << dt.addMSecs(300))
- << (QList<bool>() << true << true)
- << (QList<bool>() << true << true); // First GGA gets VDOP from GSA bundled into previous, as it has no timestamp, second GGA gets the cached value.
- }
-
- if (m_mode == QNmeaPositionInfoSource::SimulationMode) {
- // In sim m_mode, should ignore sentence with a date/time before the known date/time
- // (in real time m_mode, everything is passed on regardless)
- bytes.clear();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(100)).toLatin1();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(-200)).toLatin1();
- bytes += QLocationTestUtils::createRmcSentence(dt.addMSecs(200)).toLatin1();
- QTest::newRow("Feed good RMC, RMC with bad date/time, good RMC; expect first and third RMC only")
- << bytes << (QList<QDateTime>() << dt.addMSecs(100) << dt.addMSecs(200))
- << (QList<bool>() << false << false)
- << (QList<bool>() << false << false);
- }
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate_waitForValidDateTime()
-{
- QFETCH(QByteArray, bytes);
- QFETCH(QList<QDateTime>, dateTimes);
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- proxy->source()->requestUpdate();
-
- proxy->feedBytes(bytes);
- QTRY_COMPARE(spy.count(), 1);
- QCOMPARE(spy[0][0].value<QGeoPositionInfo>().timestamp(), dateTimes[0]);
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate_waitForValidDateTime_data()
-{
- startUpdates_waitForValidDateTime_data();
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- QDateTime dt;
-
- proxy->source()->requestUpdate(100);
- QTRY_COMPARE(spyTimeout.count(), 1);
- auto error = spyTimeout[0][0].value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- spyTimeout.clear();
-
- dt = QDateTime::currentDateTimeUtc();
- proxy->feedUpdate(dt);
- proxy->source()->requestUpdate();
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
- QCOMPARE(spyTimeout.count(), 0);
- spyUpdate.clear();
-
- // delay the update and expect it to be emitted after 300ms
- dt = QDateTime::currentDateTimeUtc();
- proxy->source()->requestUpdate(1000);
- QTest::qWait(300);
- proxy->feedUpdate(dt);
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
- QCOMPARE(spyTimeout.count(), 0);
- spyUpdate.clear();
-
- // delay the update and expect errorOccurred() to be emitted
- dt = QDateTime::currentDateTimeUtc();
- proxy->source()->requestUpdate(500);
- QTest::qWait(1000);
- proxy->feedUpdate(dt);
- QCOMPARE(spyTimeout.count(), 1);
- error = spyTimeout[0][0].value<QGeoPositionInfoSource::Error>();
- QCOMPARE(error, QGeoPositionInfoSource::UpdateTimeoutError);
- QCOMPARE(spyUpdate.count(), 0);
- spyUpdate.clear();
-}
-
-void tst_QNmeaPositionInfoSource::requestUpdate_after_start()
-{
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- QSignalSpy spyTimeout(proxy->source(), SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
-
- // Start updates with 500ms interval and requestUpdate() with 100ms
- // timeout. Feed an update, and it should be emitted immediately due to
- // the requestUpdate(). The update should not be emitted again after that
- // (i.e. the startUpdates() interval should not cause it to be re-emitted).
-
- QDateTime dt = QDateTime::currentDateTimeUtc();
- proxy->source()->setUpdateInterval(500);
- proxy->source()->startUpdates();
- proxy->source()->requestUpdate(100);
- proxy->feedUpdate(dt);
- QTRY_COMPARE(spyUpdate.count(), 1);
- QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
- QCOMPARE(spyTimeout.count(), 0);
- spyUpdate.clear();
-
- // Update has been emitted for requestUpdate(), shouldn't be emitted for startUpdates()
- QTRY_COMPARE_WITH_TIMEOUT(spyUpdate.count(), 0, 1000);
-}
-
-void tst_QNmeaPositionInfoSource::testWithBadNmea()
-{
- QFETCH(QByteArray, bytes);
- QFETCH(QList<QDateTime>, dateTimes);
- QFETCH(UpdateTriggerMethod, trigger);
-
- QNmeaPositionInfoSource source(m_mode);
- QNmeaProxyFactory factory;
- QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy *>(
- factory.createPositionInfoSourceProxy(&source));
-
- QSignalSpy spy(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
- if (trigger == StartUpdatesMethod)
- proxy->source()->startUpdates();
- else
- proxy->source()->requestUpdate();
-
- proxy->feedBytes(bytes);
- QTRY_COMPARE(spy.count(), dateTimes.count());
- for (int i=0; i<dateTimes.count(); i++)
- QCOMPARE(spy[i][0].value<QGeoPositionInfo>().timestamp(), dateTimes[i]);
-}
-
-void tst_QNmeaPositionInfoSource::testWithBadNmea_data()
-{
- QTest::addColumn<QByteArray>("bytes");
- QTest::addColumn<QList<QDateTime> >("dateTimes");
- QTest::addColumn<UpdateTriggerMethod>("trigger");
-
- QDateTime firstDateTime = QDateTime::currentDateTimeUtc();
- QByteArray bad = QLocationTestUtils::createRmcSentence(firstDateTime.addSecs(1)).toLatin1();
- bad = bad.mid(bad.length()/2);
- QDateTime lastDateTime = firstDateTime.addSecs(2);
-
- QByteArray bytes;
- bytes += QLocationTestUtils::createRmcSentence(firstDateTime).toLatin1();
- bytes += bad;
- bytes += QLocationTestUtils::createRmcSentence(lastDateTime).toLatin1();
- QTest::newRow("requestUpdate(), bad second sentence") << bytes
- << (QList<QDateTime>() << firstDateTime) << RequestUpdatesMethod;
- QTest::newRow("startUpdates(), bad second sentence") << bytes
- << (QList<QDateTime>() << firstDateTime << lastDateTime) << StartUpdatesMethod;
-}
diff --git a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h b/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h
deleted file mode 100644
index 83cd284d..00000000
--- a/tests/auto/qnmeapositioninfosource/tst_qnmeapositioninfosource.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../qgeopositioninfosource/testqgeopositioninfosource_p.h"
-#include "../utils/qnmeaproxyfactory.h"
-#include "../utils/qlocationtestutils_p.h"
-
-#include <QtPositioning/qnmeapositioninfosource.h>
-
-#include <QTest>
-#include <QDir>
-#include <QDebug>
-#include <QBuffer>
-#include <QSignalSpy>
-#include <QMetaType>
-#include <QFile>
-#include <QTemporaryFile>
-#include <QHash>
-#include <QTimer>
-
-QT_USE_NAMESPACE
-Q_DECLARE_METATYPE(QNmeaPositionInfoSource::UpdateMode)
-Q_DECLARE_METATYPE(QList<QDateTime>)
-
-class tst_QNmeaPositionInfoSource : public QObject
-{
- Q_OBJECT
-
-public:
- enum UpdateTriggerMethod
- {
- StartUpdatesMethod,
- RequestUpdatesMethod
- };
-
- tst_QNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode mode, QObject *parent = 0);
-
-private:
- QList<QDateTime> createDateTimes(const QDateTime &dt, int count) const
- {
- QList<QDateTime> dateTimes;
- int interval = 100;
- for (int i=0; i<count; i++) {
- dateTimes << dt.addMSecs(interval);
- interval += 100;
- }
- return dateTimes;
- }
-
- QList<QDateTime> createDateTimes(int count) const
- {
- return createDateTimes(QDateTime::currentDateTime().toUTC(), count);
- }
-
-private slots:
- void initTestCase();
-
- void constructor();
-
- void supportedPositioningMethods();
-
- void minimumUpdateInterval();
-
- void userEquivalentRangeError();
-
- void setUpdateInterval_delayedUpdate();
-
- void lastKnownPosition();
-
- void beginWithBufferedData();
- void beginWithBufferedData_data();
-
- void startUpdates();
- void startUpdates_data();
-
- void startUpdates_withTimeout();
-
- void startUpdates_expectLatestUpdateOnly();
-
- void startUpdates_waitForValidDateTime();
- void startUpdates_waitForValidDateTime_data();
-
- void requestUpdate_waitForValidDateTime();
- void requestUpdate_waitForValidDateTime_data();
-
- void requestUpdate();
- void requestUpdate_after_start();
-
- void testWithBadNmea();
- void testWithBadNmea_data();
-
-private:
- QNmeaPositionInfoSource::UpdateMode m_mode;
-};
-
-Q_DECLARE_METATYPE(tst_QNmeaPositionInfoSource::UpdateTriggerMethod)
-
-//---------------------------------------------------
-
-class Feeder : public QObject
-{
- Q_OBJECT
-
-public:
- Feeder(QObject *parent)
- : QObject(parent)
- {
- }
-
- void start(QNmeaPositionInfoSourceProxy *proxy)
- {
- m_proxy = proxy;
- QTimer *timer = new QTimer(this);
- QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
- timer->setInterval(proxy->source()->minimumUpdateInterval()*2);
- timer->start();
- }
-
-public slots:
- void timeout()
- {
- m_proxy->feedBytes(QLocationTestUtils::createRmcSentence(QDateTime::currentDateTime()).toLatin1());
- }
-
-private:
- QNmeaPositionInfoSourceProxy *m_proxy;
-};
-
-//---------------------------------------------------
-
-
-class UnlimitedNmeaStream : public QIODevice
-{
- Q_OBJECT
-
-public:
- UnlimitedNmeaStream(QObject *parent) : QIODevice(parent) {}
-
-protected:
- qint64 readData(char *data, qint64 maxSize) override
- {
- QByteArray bytes = QLocationTestUtils::createRmcSentence(QDateTime::currentDateTime()).toLatin1();
- qint64 sz = qMin(qint64(bytes.size()), maxSize);
- memcpy(data, bytes.constData(), sz);
- return sz;
- }
-
- qint64 writeData(const char *, qint64) override
- {
- return -1;
- }
-
- qint64 bytesAvailable() const override
- {
- return 1024 + QIODevice::bytesAvailable();
- }
-};
diff --git a/tests/auto/qnmeasatelliteinfosource/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/CMakeLists.txt
deleted file mode 100644
index 865b782e..00000000
--- a/tests/auto/qnmeasatelliteinfosource/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_subdirectory(dummy)
-add_subdirectory(generic_realtime)
-add_subdirectory(generic_simulation)
-add_subdirectory(nmea)
diff --git a/tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt
deleted file mode 100644
index f4a323e0..00000000
--- a/tests/auto/qnmeasatelliteinfosource/dummy/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_dummynmeasatelliteinfosource
- SOURCES
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_dummynmeasatelliteinfosource.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp b/tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp
deleted file mode 100644
index 432f60fe..00000000
--- a/tests/auto/qnmeasatelliteinfosource/dummy/tst_dummynmeasatelliteinfosource.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTest>
-#include <QSignalSpy>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../utils/qnmeaproxyfactory.h"
-
-class DummyNmeaSatelliteInfoSource : public QNmeaSatelliteInfoSource
-{
- Q_OBJECT
-
-public:
- DummyNmeaSatelliteInfoSource(QObject *parent = 0);
-
-protected:
- QGeoSatelliteInfo::SatelliteSystem parseSatellitesInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse) override;
- SatelliteInfoParseStatus parseSatelliteInfoFromNmea(const char *data, int size,
- QList<QGeoSatelliteInfo> &infos,
- QGeoSatelliteInfo::SatelliteSystem &system) override;
-};
-
-DummyNmeaSatelliteInfoSource::DummyNmeaSatelliteInfoSource(QObject *parent)
- : QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode, parent)
-{
-}
-
-QGeoSatelliteInfo::SatelliteSystem
-DummyNmeaSatelliteInfoSource::parseSatellitesInUseFromNmea(const char *data, int size,
- QList<int> &pnrsInUse)
-{
- // expected format: "USE:num1;num2;num3\n"
- // example: "USE:1;3;4;7\n"
- if (!data || !size)
- return QGeoSatelliteInfo::Undefined;
-
- QString str = QLatin1String(data, size).toString();
- if (!str.startsWith("USE:"))
- return QGeoSatelliteInfo::Undefined;
-
- const QStringList sl = str.mid(4).split(";", Qt::SkipEmptyParts);
-
- if (sl.empty())
- return QGeoSatelliteInfo::Undefined;
-
- for (const auto &str : sl) {
- bool ok = false;
- int value = str.toInt(&ok);
- if (ok) {
- pnrsInUse.push_back(value);
- }
- }
- return QGeoSatelliteInfo::GPS;
-}
-
-QNmeaSatelliteInfoSource::SatelliteInfoParseStatus
-DummyNmeaSatelliteInfoSource::parseSatelliteInfoFromNmea(const char *data, int size,
- QList<QGeoSatelliteInfo> &infos,
- QGeoSatelliteInfo::SatelliteSystem &system)
-{
- // expected format: "INFO:system,identifier;system,identifier;system,identifier\n"
- // example: "INFO:1,5;1,7;1,15\n"
- if (!data || !size)
- return NotParsed;
-
- QString str = QLatin1String(data, size).toString();
- if (!str.startsWith("INFO:"))
- return NotParsed;
-
- QStringList sat_infos = str.mid(5).split(";", Qt::SkipEmptyParts);
-
- if (sat_infos.empty())
- return NotParsed;
-
- for (const auto &sat_info : sat_infos) {
- QStringList parameters = sat_info.split(",", Qt::SkipEmptyParts);
- if (parameters.size() == 2) {
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(
- static_cast<QGeoSatelliteInfo::SatelliteSystem>(parameters[0].toInt()));
- info.setSatelliteIdentifier(parameters[1].toInt());
- infos.push_back(info);
- }
- }
-
- system = infos.isEmpty() ? QGeoSatelliteInfo::Undefined : infos.front().satelliteSystem();
-
- return FullyParsed;
-}
-
-class tst_DummyNmeaSatelliteInfoSource : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testOverloadedParseFunction();
-};
-
-void tst_DummyNmeaSatelliteInfoSource::testOverloadedParseFunction()
-{
- DummyNmeaSatelliteInfoSource source;
- QNmeaProxyFactory factory;
- QScopedPointer<QNmeaSatelliteInfoSourceProxy> proxy(
- factory.createSatelliteInfoSourceProxy(&source));
-
- QSignalSpy inUseSpy(proxy->source(), &QNmeaSatelliteInfoSource::satellitesInUseUpdated);
- QSignalSpy inViewSpy(proxy->source(), &QNmeaSatelliteInfoSource::satellitesInViewUpdated);
-
- proxy->source()->startUpdates();
-
- // first we need to send all satellites
- proxy->feedBytes("INFO:1,5;1,7;1,15\n");
- // then - used ones
- proxy->feedBytes("USE:5;15\n");
-
- QTRY_VERIFY_WITH_TIMEOUT(inUseSpy.count() == 1, 10000);
- QTRY_VERIFY_WITH_TIMEOUT(inViewSpy.count() == 1, 10000);
-
- QGeoSatelliteInfo info_1_5;
- info_1_5.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- info_1_5.setSatelliteIdentifier(5);
-
- QGeoSatelliteInfo info_1_7;
- info_1_7.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- info_1_7.setSatelliteIdentifier(7);
-
- QGeoSatelliteInfo info_1_15;
- info_1_15.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- info_1_15.setSatelliteIdentifier(15);
-
- const QList<QGeoSatelliteInfo> desiredInView = { info_1_5, info_1_7, info_1_15 };
- const QList<QGeoSatelliteInfo> desiredInUse = { info_1_5, info_1_15 };
-
- const QList<QGeoSatelliteInfo> inViewList =
- inViewSpy.at(0).at(0).value<QList<QGeoSatelliteInfo>>();
- const QList<QGeoSatelliteInfo> inUseList =
- inUseSpy.at(0).at(0).value<QList<QGeoSatelliteInfo>>();
-
- QCOMPARE(inViewList, desiredInView);
- QCOMPARE(inUseList, desiredInUse);
-}
-
-#include "tst_dummynmeasatelliteinfosource.moc"
-
-QTEST_GUILESS_MAIN(tst_DummyNmeaSatelliteInfoSource);
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt
deleted file mode 100644
index f465bc17..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_realtime/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_nmeasatelliteinfosource_generic_rt
- SOURCES
- ../../qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp ../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_nmeasatelliteinfosource_generic_rt.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp b/tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp
deleted file mode 100644
index 807187fe..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_realtime/tst_nmeasatelliteinfosource_generic_rt.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTest>
-#include <QTimer>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h"
-#include "../../utils/qnmeaproxyfactory.h"
-#include "../../utils/qlocationtestutils_p.h"
-
-class Feeder : public QObject
-{
- Q_OBJECT
-public:
- Feeder(QObject *parent) : QObject(parent)
- {
- }
-
- void start(QNmeaSatelliteInfoSourceProxy *proxy)
- {
- m_proxy = proxy;
- QTimer *timer = new QTimer(this);
- QObject::connect(timer, &QTimer::timeout, this, &Feeder::timeout);
- timer->setInterval(proxy->source()->minimumUpdateInterval() * 2);
- timer->start();
- }
-
-public slots:
- void timeout()
- {
- // Here we need to provide different chunks of data, because the signals
- // are emitted only when data changes.
- if (has_data) {
- m_proxy->feedBytes(QLocationTestUtils::createGsvLongSentence().toLatin1());
- m_proxy->feedBytes(QLocationTestUtils::createGsaLongSentence().toLatin1());
- } else {
- m_proxy->feedBytes(QLocationTestUtils::createGsvSentence().toLatin1());
- m_proxy->feedBytes(QLocationTestUtils::createGsaSentence().toLatin1());
- }
- has_data = !has_data;
- }
-
-private:
- QNmeaSatelliteInfoSourceProxy *m_proxy;
- bool has_data = true;
-};
-
-class tst_QNmeaSatelliteInfoSource_Generic_Realtime : public TestQGeoSatelliteInfoSource
-{
- Q_OBJECT
-protected:
- QGeoSatelliteInfoSource *createTestSource() override
- {
- QNmeaSatelliteInfoSource *source =
- new QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode);
- QNmeaSatelliteInfoSourceProxy *proxy = m_factory.createSatelliteInfoSourceProxy(source);
- Feeder *feeder = new Feeder(source);
- feeder->start(proxy);
- return source;
- }
-
-private:
- QNmeaProxyFactory m_factory;
-};
-
-#include "tst_nmeasatelliteinfosource_generic_rt.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaSatelliteInfoSource_Generic_Realtime)
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt
deleted file mode 100644
index d86d5066..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_simulation/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_nmeasatelliteinfosource_generic_sim
- SOURCES
- ../../qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp ../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- ../../utils/qnmeaproxyfactory.cpp ../../utils/qnmeaproxyfactory.h
- tst_nmeasatelliteinfosource_generic_sim.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- LIBRARIES
- Qt::Core
- Qt::Network
- Qt::Positioning
- Qt::TestPrivate
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp b/tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp
deleted file mode 100644
index 3b80bf05..00000000
--- a/tests/auto/qnmeasatelliteinfosource/generic_simulation/tst_nmeasatelliteinfosource_generic_sim.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTest>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h"
-#include "../../utils/qlocationtestutils_p.h"
-
-class UnlimitedNmeaStream : public QIODevice
-{
- Q_OBJECT
-
-public:
- UnlimitedNmeaStream(QObject *parent) : QIODevice(parent) {}
-
-protected:
- qint64 readData(char *data, qint64 maxSize) override
- {
- if (maxSize == 0)
- return 0;
- QByteArray bytes;
- if (genSatInView) {
- increaseSatId();
- bytes = QLocationTestUtils::createGsvVariableSentence(satId).toLatin1();
- } else {
- bytes = QLocationTestUtils::createGsaVariableSentence(satId).toLatin1();
- }
- genSatInView = !genSatInView;
- qint64 sz = qMin(qint64(bytes.size()), maxSize);
- memcpy(data, bytes.constData(), sz);
- return sz;
- }
-
- qint64 writeData(const char *, qint64) override
- {
- return -1;
- }
-
- qint64 bytesAvailable() const override
- {
- return 1024 + QIODevice::bytesAvailable();
- }
-
-private:
- void increaseSatId()
- {
- if (++satId == 0)
- satId = 1;
- }
-
- quint8 satId = 0;
- bool genSatInView = true;
-};
-
-class tst_QNmeaSatelliteInfoSource_Generic_Simulation : public TestQGeoSatelliteInfoSource
-{
- Q_OBJECT
-protected:
- QGeoSatelliteInfoSource *createTestSource() override
- {
- QNmeaSatelliteInfoSource *source =
- new QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode::SimulationMode);
- source->setDevice(new UnlimitedNmeaStream(source));
- return source;
- }
-};
-
-#include "tst_nmeasatelliteinfosource_generic_sim.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaSatelliteInfoSource_Generic_Simulation)
diff --git a/tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt b/tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt
deleted file mode 100644
index 28eafc91..00000000
--- a/tests/auto/qnmeasatelliteinfosource/nmea/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# special case begin
-qt_internal_add_test(tst_nmeasatelliteinfosource
- SOURCES
- ../../utils/qlocationtestutils.cpp ../../utils/qlocationtestutils_p.h
- tst_nmeasatelliteinfosource.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ..
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
-)
-# special case end
diff --git a/tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp b/tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp
deleted file mode 100644
index a19b3f6f..00000000
--- a/tests/auto/qnmeasatelliteinfosource/nmea/tst_nmeasatelliteinfosource.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTest>
-#include <QTimer>
-#include <QSignalSpy>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-#include "../../utils/qlocationtestutils_p.h"
-
-class DataFeeder : public QIODevice
-{
- Q_OBJECT
-public:
- DataFeeder(QNmeaSatelliteInfoSource *parent)
- : QIODevice(parent), m_parentMode(parent->updateMode())
- {
- }
-
- void setMessages(const QList<QByteArray> &messages)
- {
- m_messages = messages;
- m_canReadLine = true;
- m_messageIndex = 0;
- if (m_parentMode == QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode)
- emit readyRead();
- }
-
-signals:
- void messageSent();
-
-protected:
- qint64 readData(char *data, qint64 maxSize) override
- {
- if (maxSize == 0 || m_messageIndex < 0 || m_messageIndex >= m_messages.size())
- return 0;
-
- m_canReadLine = false;
-
- QByteArray bytes = m_messages.at(m_messageIndex);
- qint64 sz = qMin(qint64(bytes.size()), maxSize);
- memcpy(data, bytes.constData(), sz);
-
- m_messageIndex++;
-
- emit messageSent();
- QTimer::singleShot(10, this, &DataFeeder::onTimer);
-
- return sz;
- }
-
- qint64 writeData(const char *, qint64) override { return -1; }
-
- qint64 bytesAvailable() const override { return 1024 + QIODevice::bytesAvailable(); }
-
- bool canReadLine() const override
- {
- return m_canReadLine && (m_messageIndex >= 0) && (m_messageIndex < m_messages.size());
- }
-
-private slots:
- void onTimer()
- {
- m_canReadLine = true;
- if (m_parentMode == QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode)
- emit readyRead();
- }
-
-private:
- QNmeaSatelliteInfoSource::UpdateMode m_parentMode;
- QList<QByteArray> m_messages;
- qsizetype m_messageIndex = 0;
- bool m_canReadLine = true; // To read each line separately
-};
-
-class tst_QNmeaSatelliteInfoSource : public QObject
-{
- Q_OBJECT
-private slots:
- void backendProperty();
- void backendProperty_data();
-
- void parseDataStream();
- void parseDataStream_data();
-
-private:
- QGeoSatelliteInfo createSatelliteInfo(QGeoSatelliteInfo::SatelliteSystem system, int id,
- int snr);
-};
-
-void tst_QNmeaSatelliteInfoSource::backendProperty()
-{
- QFETCH(int, simulationRate);
- QFETCH(int, updateInterval);
- QFETCH(QList<QByteArray>, messages);
- QFETCH(int, timeout);
- QFETCH(int, desiredMessagesSent);
-
- QNmeaSatelliteInfoSource source(QNmeaSatelliteInfoSource::UpdateMode::SimulationMode);
- auto feeder = new DataFeeder(&source);
- source.setDevice(feeder);
-
- QSignalSpy messageSentSpy(feeder, &DataFeeder::messageSent);
- QSignalSpy inViewSpy(&source, &QNmeaSatelliteInfoSource::satellitesInViewUpdated);
-
- source.setBackendProperty(QNmeaSatelliteInfoSource::SimulationUpdateInterval, simulationRate);
- source.setUpdateInterval(updateInterval);
-
- source.startUpdates();
- feeder->setMessages(messages);
-
- QTRY_VERIFY_WITH_TIMEOUT(inViewSpy.count() == 1, timeout);
-
- QCOMPARE(source.backendProperty(QNmeaSatelliteInfoSource::SimulationUpdateInterval).toInt(),
- simulationRate);
- QCOMPARE(source.updateInterval(), updateInterval);
-
- QCOMPARE(messageSentSpy.count(), desiredMessagesSent);
-}
-
-void tst_QNmeaSatelliteInfoSource::backendProperty_data()
-{
- QTest::addColumn<int>("simulationRate");
- QTest::addColumn<int>("updateInterval");
- QTest::addColumn<QList<QByteArray>>("messages");
- QTest::addColumn<int>("timeout");
- QTest::addColumn<int>("desiredMessagesSent");
-
- const auto simpleGpsGsvMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSV,1,1,4,05,,,25,07,,,,08,,,,13,,,36*")
- .toLatin1();
-
- const QList<QByteArray> msgs(10, simpleGpsGsvMessage);
-
- // here updateInterval should not be a multiple of simulationRate because
- // this will make the test flacky due to timer precision.
- QTest::addRow("Simulation rate smaller than updateInterval") << 200 << 500 << msgs << 550 << 2;
-
- QTest::addRow("Simulation rate larger than updateInterval") << 200 << 100 << msgs << 300 << 1;
-
- // Here we do not really have problems with timer precision, because even if
- // the updateInterval() timer expires earlier, we will not get any update
- // until the real data comes.
- QTest::addRow("Simulation rate equals updateInterval") << 200 << 200 << msgs << 300 << 1;
-}
-
-void tst_QNmeaSatelliteInfoSource::parseDataStream()
-{
- QFETCH(QNmeaSatelliteInfoSource::UpdateMode, mode);
- QFETCH(QList<QByteArray>, messages);
- QFETCH(QList<QGeoSatelliteInfo>, desiredInView);
- QFETCH(QList<QGeoSatelliteInfo>, desiredInUse);
-
- QNmeaSatelliteInfoSource source(mode);
- auto feeder = new DataFeeder(&source);
- source.setDevice(feeder);
-
- QSignalSpy messageSentSpy(feeder, &DataFeeder::messageSent);
- QSignalSpy inViewSpy(&source, &QNmeaSatelliteInfoSource::satellitesInViewUpdated);
- QSignalSpy inUseSpy(&source, &QNmeaSatelliteInfoSource::satellitesInUseUpdated);
-
- source.startUpdates();
- feeder->setMessages(messages);
-
- QTRY_VERIFY_WITH_TIMEOUT(messageSentSpy.count() == messages.count(), 2000);
- QVERIFY(!inViewSpy.isEmpty());
- QVERIFY(!inUseSpy.isEmpty());
-
- const auto inView = inViewSpy.back().at(0).value<QList<QGeoSatelliteInfo>>();
- QCOMPARE(inView, desiredInView);
-
- const auto inUse = inUseSpy.back().at(0).value<QList<QGeoSatelliteInfo>>();
- QCOMPARE(inUse, desiredInUse);
-}
-
-void tst_QNmeaSatelliteInfoSource::parseDataStream_data()
-{
- QTest::addColumn<QNmeaSatelliteInfoSource::UpdateMode>("mode");
- QTest::addColumn<QList<QByteArray>>("messages");
- QTest::addColumn<QList<QGeoSatelliteInfo>>("desiredInView");
- QTest::addColumn<QList<QGeoSatelliteInfo>>("desiredInUse");
-
- // We will use only satId and SNR, to simplify objects for comparison
-
- // one line GPS
- const auto simpleGpsGsvMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSV,1,1,4,05,,,25,07,,,,08,,,,13,,,36*")
- .toLatin1();
- const auto simpleGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSA,A,3,05,13,,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto simpleGpsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 25),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 7, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 8, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 36) };
- const auto simpleGpsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 25),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 36) };
-
- QTest::newRow("realtime GPS") << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGpsGsaMessage }
- << simpleGpsInView << simpleGpsInUse;
-
- QTest::newRow("simulation GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGpsGsaMessage } << simpleGpsInView
- << simpleGpsInUse;
-
- // multi line GPS
- const auto complexGpsGsvMessage1 = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSV,2,1,8,05,,,22,07,,,,08,,,,13,,,18*")
- .toLatin1();
- const auto complexGpsGsvMessage2 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GPGSV,2,2,8,14,,,,15,,,18,18,,,,20,,,*")
- .toLatin1();
- const auto complexGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GPGSA,A,3,05,13,15,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto complexGpsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 22),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 7, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 8, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 18),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 14, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 15, 18),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 18, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 20, -1) };
- const auto complexGpsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GPS, 5, 22),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 13, 18),
- createSatelliteInfo(QGeoSatelliteInfo::GPS, 15, 18) };
-
- QTest::newRow("realtime multi-line GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGpsGsaMessage }
- << complexGpsInView << complexGpsInUse;
-
- QTest::newRow("simulation multi-line GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGpsGsaMessage }
- << complexGpsInView << complexGpsInUse;
-
- // one line GPS & GLONASS
- const auto simpleGlnsGsvMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GLGSV,1,1,4,65,,,,66,,,,71,,,20,72,,,28*")
- .toLatin1();
- const auto gnSimpleGlnsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,71,72,,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
- const auto gnSimpleGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,05,13,,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto simpleGlnsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 65, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 66, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28) };
- const auto simpleGlnsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28) };
-
- const auto simpleGpsGlnsInView = simpleGpsInView + simpleGlnsInView;
- const auto simpleGpsGlnsInUse = simpleGpsInUse + simpleGlnsInUse;
-
- QTest::newRow("realtime GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGpsGsaMessage,
- gnSimpleGlnsGsaMessage }
- << simpleGpsGlnsInView << simpleGpsGlnsInUse;
-
- QTest::newRow("simulation GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGpsGsaMessage,
- gnSimpleGlnsGsaMessage }
- << simpleGpsGlnsInView << simpleGpsGlnsInUse;
-
- // multi line GPS & GLONASS
- const auto complexGlnsGsvMessage1 = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GLGSV,3,1,10,65,,,,66,,,,71,,,20,72,,,28*")
- .toLatin1();
- const auto complexGlnsGsvMessage2 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GLGSV,3,2,10,73,,,,74,,,,75,,,33,81,,,*")
- .toLatin1();
- const auto complexGlnsGsvMessage3 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GLGSV,3,3,10,82,,,,83,,,*").toLatin1();
- const auto gnComplexGlnsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,71,72,75,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
- const auto gnComplexGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,05,13,15,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
-
- const auto complexGlnsInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 65, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 66, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 73, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 74, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 75, 33),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 81, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 82, -1),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 83, -1) };
- const auto complexGlnsInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 71, 20),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 72, 28),
- createSatelliteInfo(QGeoSatelliteInfo::GLONASS, 75, 33) };
-
- const auto complexGpsGlnsInView = complexGpsInView + complexGlnsInView;
- const auto complexGpsGlnsInUse = complexGpsInUse + complexGlnsInUse;
-
- QTest::newRow("realtime multi-line GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- QTest::newRow("simulation multi-line GPS & GLONASS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- // multi-line GPS & GLONASS: GSA before GSV
- QTest::newRow("realtime multi-line GPS & GLONASS reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, gnComplexGpsGsaMessage,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexGpsGsvMessage1,
- complexGpsGsvMessage2 }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- QTest::newRow("simulation multi-line GPS & GLONASS reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, gnComplexGpsGsaMessage,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexGpsGsvMessage1,
- complexGpsGsvMessage2 }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- // multi-line GSP & GLONASS: mixed order
- QTest::newRow("realtime multi-line GPS & GLONASS mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexGpsGsvMessage1, complexGpsGsvMessage2,
- gnComplexGpsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- QTest::newRow("realtime multi-line GPS & GLONASS mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGlnsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexGpsGsvMessage1, complexGpsGsvMessage2,
- gnComplexGpsGsaMessage }
- << complexGpsGlnsInView << complexGpsGlnsInUse;
-
- // one line GPS & GLONASS: empty GNGSA for GPS
- const auto gnEmptyGpsGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*")
- .toLatin1();
-
- QTest::newRow("realtime GSP & GLONASS: empty GSA for GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGlnsGsaMessage, gnEmptyGpsGsaMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- QTest::newRow("simulation GSP & GLONASS: empty GSA for GPS")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGlnsGsaMessage, gnEmptyGpsGsaMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- // one line GPS & GLONASS: empty $GPGSV
- const auto emptyGpsGsvMessage =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GPGSV,1,1,0,,,,,,,,,,,,,,,,*")
- .toLatin1();
-
- QTest::newRow("realtime GPS & GLONASS: empty $GPGSV")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { emptyGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGlnsGsaMessage,
- gnSimpleGpsGsaMessage }
- << simpleGlnsInView << simpleGlnsInUse;
-
- QTest::newRow("simulation GPS & GLONASS: empty $GPGSV")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { emptyGpsGsvMessage, simpleGlnsGsvMessage, gnSimpleGlnsGsaMessage,
- gnSimpleGpsGsaMessage }
- << simpleGlnsInView << simpleGlnsInUse;
-
- // one line GPS & GLONASS: empty GNGSA in the middle
- // In this test we send the following sequence:
- // 1. $GPGSV - valid GPS in view
- // 2. $GLGSV - valid GLONASS in view
- // 3. $GNGSA - valid GPS in use
- // 4. $GNGSA - valid GLONASS in use
- // 5. $GPGSV - valid GPS in view
- // 6. $GNGSA - empty GNGSA (meaning empty GPS)
- // 7. $GPGSV - valid GPS in view: at this point GPS in use will be cleared
- // As a result, we will see valid GPS & GLONASS in view, but only GLONASS
- // in use.
-
- QTest::newRow("realtime GPS & GLONASS: empty $GNGSA in the middle")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGpsGsaMessage, gnSimpleGlnsGsaMessage,
- simpleGpsGsvMessage, gnEmptyGpsGsaMessage,
- simpleGpsGsvMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- QTest::newRow("simulation GPS & GLONASS: empty $GNGSA in the middle")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { simpleGpsGsvMessage, simpleGlnsGsvMessage,
- gnSimpleGpsGsaMessage, gnSimpleGlnsGsaMessage,
- simpleGpsGsvMessage, gnEmptyGpsGsaMessage,
- simpleGpsGsvMessage }
- << simpleGpsGlnsInView << simpleGlnsInUse;
-
- // BEIDOU signals for below test cases are just synthesized based on the
- // NMEA protocol description. They were NEVER checked on real hardware,
- // as we do not have one.
-
- // multi-line GPS, GLONASS & BEIDOU
- const auto complexBduGsvMessage1 = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GBGSV,2,1,7,201,,,,202,,,,203,,,20,204,,,28*")
- .toLatin1();
- const auto complexBduGsvMessage2 =
- QLocationTestUtils::addNmeaChecksumAndBreaks("$GBGSV,2,2,7,205,,,,206,,,,207,,,33,,,,*")
- .toLatin1();
- const auto gnComplexBduGsaMessage = QLocationTestUtils::addNmeaChecksumAndBreaks(
- "$GNGSA,A,3,203,204,207,,,,,,,,,,50.95,50.94,1.00*")
- .toLatin1();
- const auto complexBduInView =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 201, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 202, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 203, 20),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 204, 28),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 205, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 206, -1),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 207, 33) };
- const auto complexBduInUse =
- QList<QGeoSatelliteInfo> { createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 203, 20),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 204, 28),
- createSatelliteInfo(QGeoSatelliteInfo::BEIDOU, 207, 33) };
-
- const auto complexGpsGlnsBduInView = complexGpsInView + complexGlnsInView + complexBduInView;
- const auto complexGpsGlnsBduInUse = complexGpsInUse + complexGlnsInUse + complexBduInUse;
-
- QTest::newRow("realtime GPS, GLONASS & BEIDOU")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexBduGsvMessage1,
- complexBduGsvMessage2, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- QTest::newRow("simulation GPS, GLONASS & BEIDOU")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { complexGpsGsvMessage1, complexGpsGsvMessage2,
- complexGlnsGsvMessage1, complexGlnsGsvMessage2,
- complexGlnsGsvMessage3, complexBduGsvMessage1,
- complexBduGsvMessage2, gnComplexGpsGsaMessage,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- // multi-line GPS, GLONASS & BEIDOU: GSA before GSV
- QTest::newRow("realtime GPS, GLONASS & BEIDOU reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, gnComplexGlnsGsaMessage,
- gnComplexBduGsaMessage, complexGpsGsvMessage1,
- complexGpsGsvMessage2, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- QTest::newRow("simulation GPS, GLONASS & BEIDOU reverse")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, gnComplexGlnsGsaMessage,
- gnComplexBduGsaMessage, complexGpsGsvMessage1,
- complexGpsGsvMessage2, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- // multi-line GPS, GLONASS & BEIDOU: mixed order
- QTest::newRow("realtime GPS, GLONASS & BEIDOU mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::RealTimeMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage,
- complexGpsGsvMessage1, complexGpsGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-
- QTest::newRow("simulation GPS, GLONASS & BEIDOU mixed")
- << QNmeaSatelliteInfoSource::UpdateMode::SimulationMode
- << QList<QByteArray> { gnComplexGpsGsaMessage, complexGlnsGsvMessage1,
- complexGlnsGsvMessage2, complexGlnsGsvMessage3,
- complexBduGsvMessage1, complexBduGsvMessage2,
- gnComplexGlnsGsaMessage, gnComplexBduGsaMessage,
- complexGpsGsvMessage1, complexGpsGsvMessage2 }
- << complexGpsGlnsBduInView << complexGpsGlnsBduInUse;
-}
-
-QGeoSatelliteInfo
-tst_QNmeaSatelliteInfoSource::createSatelliteInfo(QGeoSatelliteInfo::SatelliteSystem system, int id,
- int snr)
-{
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(system);
- info.setSatelliteIdentifier(id);
- info.setSignalStrength(snr);
- info.setAttribute(QGeoSatelliteInfo::Azimuth, 0.0);
- info.setAttribute(QGeoSatelliteInfo::Elevation, 0.0);
- return info;
-}
-
-#include "tst_nmeasatelliteinfosource.moc"
-
-QTEST_GUILESS_MAIN(tst_QNmeaSatelliteInfoSource)
diff --git a/tests/auto/qquickgeocoordinateanimation/CMakeLists.txt b/tests/auto/qquickgeocoordinateanimation/CMakeLists.txt
deleted file mode 100644
index 81342b61..00000000
--- a/tests/auto/qquickgeocoordinateanimation/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-qt_internal_add_test(tst_qquickgeocoordinateanimation
- SOURCES
- tst_qquickgeocoordinateanimation.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::PositioningQuickPrivate
- Qt::TestPrivate
-)
diff --git a/tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp b/tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp
deleted file mode 100644
index 6c6abbcc..00000000
--- a/tests/auto/qquickgeocoordinateanimation/tst_qquickgeocoordinateanimation.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtTest/QtTest>
-#include <QtTest/private/qpropertytesthelper_p.h>
-#include <QtPositioningQuick/private/qquickgeocoordinateanimation_p.h>
-
-QT_USE_NAMESPACE
-
-class tst_QuickGeoCoordinateAnimation : public QObject
-{
- Q_OBJECT
-
-private slots:
- void bindings();
-};
-
-void tst_QuickGeoCoordinateAnimation::bindings()
-{
- QQuickGeoCoordinateAnimation animation;
- QTestPrivate::testReadWritePropertyBasics<QQuickGeoCoordinateAnimation,
- QQuickGeoCoordinateAnimation::Direction>(
- animation, QQuickGeoCoordinateAnimation::East, QQuickGeoCoordinateAnimation::West,
- "direction");
-}
-
-QTEST_APPLESS_MAIN(tst_QuickGeoCoordinateAnimation)
-
-#include "tst_qquickgeocoordinateanimation.moc"
diff --git a/tests/auto/utils/qlocationtestutils.cpp b/tests/auto/utils/qlocationtestutils.cpp
deleted file mode 100644
index c587a8bc..00000000
--- a/tests/auto/utils/qlocationtestutils.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlocationtestutils_p.h"
-
-bool QLocationTestUtils::hasDefaultSource()
-{
- return false;
-}
-
-bool QLocationTestUtils::hasDefaultMonitor()
-{
- return false;
-}
-
-QString QLocationTestUtils::addNmeaChecksumAndBreaks(const QString &sentence)
-{
- Q_ASSERT(sentence[0] == '$' && sentence[sentence.length()-1] == '*');
-
- // XOR byte value of all characters between '$' and '*'
- int result = 0;
- for (int i=1; i<sentence.length()-1; i++)
- result ^= sentence[i].toLatin1();
- const QString sum = QString::asprintf("%02x", result);
- return sentence + sum + "\r\n";
-}
-
-QString QLocationTestUtils::createRmcSentence(const QDateTime &dt)
-{
- QString time = dt.toString("hhmmss.zzz");
- QString date = dt.toString("ddMMyy");
- QString nmea = QString("$GPRMC,%1,A,2730.83609,S,15301.87844,E,0.7,9.0,%2,11.2,W,A*")
- .arg(time).arg(date);
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGgaSentence(const QTime &time)
-{
- QString nmea = QString("$GPGGA,%1,2734.76859,S,15305.99361,E,1,04,3.5,49.4,M,39.2,M,,*")
- .arg(time.toString("hhmmss.zzz"));
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGgaSentence(int lat, int lng, const QTime &time) {
- QString nmea = QString("$GPGGA,%1,%200.00000,S,%300.,E,1,04,3.5,49.4,M,39.2,M,,*")
- .arg(time.toString("hhmmss.zzz")).arg(lat).arg(lng);
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createZdaSentence(const QDateTime &dt)
-{
- QString time = dt.toString("hhmmss.zzz");
- QString nmea = QString("$GPZDA,%1,%2,%3,%4,,*")
- .arg(time).arg(dt.toString("dd")).arg(dt.toString("MM")).arg(dt.toString("yyyy"));
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGsaSentence()
-{
- return addNmeaChecksumAndBreaks(QStringLiteral("$GPGSA,A,3,,,,,,,,,,,,,3.0,3.5,4.0*"));
-}
-
-QString QLocationTestUtils::createGsvSentence()
-{
- return addNmeaChecksumAndBreaks(QStringLiteral("$GPGSV,1,1,0,,,,,,,,,,,,,,,,*"));
-}
-
-QString QLocationTestUtils::createGsaLongSentence()
-{
- return addNmeaChecksumAndBreaks(QStringLiteral("$GPGSA,A,3,16,25,,,,,,,,,,,2.3,1.3,1.9*"));
-}
-
-QString QLocationTestUtils::createGsvLongSentence()
-{
- return addNmeaChecksumAndBreaks(
- QStringLiteral("$GPGSV,1,1,4,16,49,115,42,25,39,269,36,23,58,176,29,20,72,335,35*"));
-}
-
-QString QLocationTestUtils::createGsaVariableSentence(quint8 satId)
-{
- const QString nmea = QString("$GPGSA,A,3,%1,,,,,,,,,,,,2.3,1.3,1.9*").arg(static_cast<int>(satId));
- return addNmeaChecksumAndBreaks(nmea);
-}
-
-QString QLocationTestUtils::createGsvVariableSentence(quint8 satId)
-{
- const QString nmea = QString("$GPGSV,1,1,1,%1,49,115,42,,,,,,,,,,,,*").arg(static_cast<int>(satId));
- return addNmeaChecksumAndBreaks(nmea);
-}
diff --git a/tests/auto/utils/qlocationtestutils_p.h b/tests/auto/utils/qlocationtestutils_p.h
deleted file mode 100644
index 77c3a394..00000000
--- a/tests/auto/utils/qlocationtestutils_p.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCATIONTESTUTILS_P_H
-#define QLOCATIONTESTUTILS_P_H
-
-#include <QDebug>
-#include <QString>
-#include <QTest>
-
-namespace QLocationTestUtils
-{
- bool hasDefaultSource();
- bool hasDefaultMonitor();
-
- QString addNmeaChecksumAndBreaks(const QString &sentence);
-
- QString createRmcSentence(const QDateTime &dt);
- QString createGgaSentence(const QTime &time);
- QString createGgaSentence(int lat, int lng, const QTime &time);
- QString createZdaSentence(const QDateTime &dt);
- QString createGsaSentence();
- QString createGsvSentence();
- QString createGsaLongSentence();
- QString createGsvLongSentence();
- QString createGsaVariableSentence(quint8 satId);
- QString createGsvVariableSentence(quint8 satId);
-
- //The purpose of compareEquality() is to test equality
- //operators where it is expected that A == B.
- template<typename A, typename B>
- bool compareEquality(const A &first, const B &second) {
- if (first != second) {
- qWarning() << "compareEquality() failed: first != second";
- return false;
- }
-
- if (second != first) {
- qWarning() << "compareEquality() failed: second != first";
- return false;
- }
-
- if (!(first == second)) {
- qWarning() << "compareEquality() failed: !(first == second)";
- return false;
- }
-
- if (!(second == first)) {
- qWarning() << "compareEquality() failed: !(second == first)";
- return false;
- }
-
- return true;
- }
-
- //The purpose of compareInequality() is to test equality
- //operators where it is expected that A != B.
- //Using !compareEquality(...) is not sufficient because
- //only the first operator checked would end up being tested.
- template<typename A, typename B>
- bool compareInequality(const A &first, const B &second) {
- if (!(first != second)){
- qWarning() << "compareInequality() failed: !(first != second)";
- return false;
- }
-
- if (!(second != first)) {
- qWarning() << "compareInequality() failed: !(second != first)";
- return false;
- }
-
- if (first == second) {
- qWarning() << "compareInequality() failed: first == second)";
- return false;
- }
-
- if (second == first) {
- qWarning() << "compareInequality() failed: second == first";
- return false;
- }
- return true;
- }
-
- // Tests conversions between sub and base classes
- // TC (test case) must implement:
- // SubClass initialSubObject();
- // bool checkType(const BaseClass &)
- // void detach(BaseClass *) - calls a mutator method, but doesn't actually modify the
- // property to something different.
- // void setSubClassProperty(SubClass *) - sets a property in the subclass instance
- template<typename TC, typename BaseClass, typename SubClass>
- void testConversion(TC *tc) {
- SubClass sub = tc->initialSubObject();
- //check conversion from SubClass -> BaseClass
- //using assignment operator
- BaseClass base;
- base = sub;
- QVERIFY(QLocationTestUtils::compareEquality(base, sub));
- QVERIFY(tc->checkType(base));
-
- //check comparing base classes
- BaseClass base2;
- base2 = sub;
- QVERIFY(QLocationTestUtils::compareEquality(base, base2));
-
- //check conversion from BaseClass -> SubClass
- //using assignment operator
- SubClass sub2;
- sub2 = base;
- QVERIFY(QLocationTestUtils::compareEquality(sub, sub2));
- QVERIFY(tc->checkType(sub2));
-
- //check that equality still holds with detachment of underlying data pointer
- tc->detach(&base);
- sub2 = base;
- QVERIFY(QLocationTestUtils::compareEquality(sub, sub2));
- QVERIFY(QLocationTestUtils::compareEquality(sub, base));
- QVERIFY(QLocationTestUtils::compareEquality(base, base2));
-
- //check that comparing objects are not the same
- //when an underlying subclass field has been modified
- tc->setSubClassProperty(&sub2);
- base2 = sub2;
- QVERIFY(QLocationTestUtils::compareInequality(sub, sub2));
- QVERIFY(QLocationTestUtils::compareInequality(sub, base2));
- QVERIFY(QLocationTestUtils::compareInequality(base, base2));
-
- //check conversion from SubClass -> BaseClass
- //using copy constructor
- BaseClass base3(sub);
- QVERIFY(QLocationTestUtils::compareEquality(sub, base3));
- QVERIFY(QLocationTestUtils::compareEquality(base, base3));
-
- //check conversion from BaseClass -> SubClass
- //using copy constructor
- SubClass sub3(base3);
- QVERIFY(QLocationTestUtils::compareEquality(sub, sub3));
-
- //check conversion to subclass using a default base class instance
- BaseClass baseDefault;
- SubClass subDefault;
- SubClass sub4(baseDefault);
- QVERIFY(QLocationTestUtils::compareEquality(sub4, subDefault));
-
- SubClass sub5 = baseDefault;
- QVERIFY(QLocationTestUtils::compareEquality(sub5, subDefault));
- }
-};
-
-#endif
diff --git a/tests/auto/utils/qnmeaproxyfactory.cpp b/tests/auto/utils/qnmeaproxyfactory.cpp
deleted file mode 100644
index 8ad07adf..00000000
--- a/tests/auto/utils/qnmeaproxyfactory.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnmeaproxyfactory.h"
-#include "qlocationtestutils_p.h"
-#include <QtPositioning/QNmeaPositionInfoSource>
-#include <QtPositioning/QNmeaSatelliteInfoSource>
-
-#include <QIODevice>
-#include <QTcpServer>
-#include <QTcpSocket>
-
-QNmeaPositionInfoSourceProxy::QNmeaPositionInfoSourceProxy(QNmeaPositionInfoSource *source,
- QIODevice *outDevice)
- : m_source(source), m_outDevice(outDevice)
-{
-}
-
-QNmeaPositionInfoSourceProxy::~QNmeaPositionInfoSourceProxy()
-{
- m_outDevice->close();
- delete m_outDevice;
-}
-
-QGeoPositionInfoSource *QNmeaPositionInfoSourceProxy::source() const
-{
- return m_source;
-}
-
-void QNmeaPositionInfoSourceProxy::feedUpdate(const QDateTime &dt)
-{
- m_outDevice->write(QLocationTestUtils::createRmcSentence(dt).toLatin1());
-}
-
-void QNmeaPositionInfoSourceProxy::feedBytes(const QByteArray &bytes)
-{
- m_outDevice->write(bytes);
-}
-
-QNmeaProxyFactory::QNmeaProxyFactory() : m_server(new QTcpServer(this))
-{
- bool b = m_server->listen(QHostAddress::LocalHost);
- Q_ASSERT(b);
-}
-
-QNmeaPositionInfoSourceProxy *
-QNmeaProxyFactory::createPositionInfoSourceProxy(QNmeaPositionInfoSource *source)
-{
- QTcpSocket *client = new QTcpSocket;
- QIODevice *device = createServerConnection(client);
- source->setDevice(device);
- Q_ASSERT(source->device() != 0);
- QNmeaPositionInfoSourceProxy *proxy = new QNmeaPositionInfoSourceProxy(source, client);
- proxy->setParent(source);
- return proxy;
-}
-
-QNmeaSatelliteInfoSourceProxy *
-QNmeaProxyFactory::createSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source)
-{
- QTcpSocket *client = new QTcpSocket;
- QIODevice *device = createServerConnection(client);
- source->setDevice(device);
- Q_ASSERT(source->device() != 0);
- QNmeaSatelliteInfoSourceProxy *proxy = new QNmeaSatelliteInfoSourceProxy(source, client);
- proxy->setParent(source);
- return proxy;
-}
-
-QIODevice *QNmeaProxyFactory::createServerConnection(QTcpSocket *client)
-{
- client->connectToHost(m_server->serverAddress(), m_server->serverPort());
- qDebug() << "listening on" << m_server->serverAddress() << m_server->serverPort();
- bool b = m_server->waitForNewConnection(15000);
- if (!b)
- qWarning() << "Server didin't receive new connection";
- b = client->waitForConnected();
- if (!b)
- qWarning() << "Client could not connect to server";
-
- QIODevice *device = m_server->nextPendingConnection();
- return device;
-}
-
-QNmeaSatelliteInfoSourceProxy::QNmeaSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source,
- QIODevice *outDevice)
- : m_source(source), m_outDevice(outDevice)
-{
-}
-
-QNmeaSatelliteInfoSourceProxy::~QNmeaSatelliteInfoSourceProxy()
-{
- m_outDevice->close();
- delete m_outDevice;
-}
-
-QGeoSatelliteInfoSource *QNmeaSatelliteInfoSourceProxy::source() const
-{
- return m_source;
-}
-
-void QNmeaSatelliteInfoSourceProxy::feedBytes(const QByteArray &bytes)
-{
- m_outDevice->write(bytes);
-}
diff --git a/tests/auto/utils/qnmeaproxyfactory.h b/tests/auto/utils/qnmeaproxyfactory.h
deleted file mode 100644
index 2cd2e262..00000000
--- a/tests/auto/utils/qnmeaproxyfactory.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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNMEAPROXYFACTORY_H
-#define QNMEAPROXYFACTORY_H
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QTcpServer;
-class QTcpSocket;
-class QIODevice;
-class QNmeaPositionInfoSource;
-class QNmeaSatelliteInfoSource;
-class QGeoPositionInfoSource;
-class QGeoSatelliteInfoSource;
-QT_END_NAMESPACE
-
-class QNmeaPositionInfoSourceProxy : public QObject
-{
- Q_OBJECT
-public:
- QNmeaPositionInfoSourceProxy(QNmeaPositionInfoSource *source, QIODevice *outDevice);
- ~QNmeaPositionInfoSourceProxy();
-
- QGeoPositionInfoSource *source() const;
-
- void feedUpdate(const QDateTime &dt);
-
- void feedBytes(const QByteArray &bytes);
-
- int updateIntervalErrorMargin() const { return 50; }
-
-private:
- QNmeaPositionInfoSource *m_source;
- QIODevice *m_outDevice;
-};
-
-class QNmeaSatelliteInfoSourceProxy : public QObject
-{
- Q_OBJECT
-public:
- QNmeaSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source, QIODevice *outDevice);
- ~QNmeaSatelliteInfoSourceProxy();
-
- QGeoSatelliteInfoSource *source() const;
-
- void feedBytes(const QByteArray &bytes);
-
-private:
- QNmeaSatelliteInfoSource *m_source;
- QIODevice *m_outDevice;
-};
-
-class QNmeaProxyFactory : public QObject
-{
- Q_OBJECT
-public:
- QNmeaProxyFactory();
-
- // proxy is created as child of source
- QNmeaPositionInfoSourceProxy *createPositionInfoSourceProxy(QNmeaPositionInfoSource *source);
- QNmeaSatelliteInfoSourceProxy *createSatelliteInfoSourceProxy(QNmeaSatelliteInfoSource *source);
-
-private:
- QIODevice *createServerConnection(QTcpSocket *client);
-
- QTcpServer *m_server;
-};
-
-#endif
diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt
deleted file mode 100644
index 941ba9da..00000000
--- a/tests/benchmarks/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# special case begin
-
-add_subdirectory(qgeoareamonitorinfo)
-add_subdirectory(qgeopositioninfo)
-add_subdirectory(qgeosatelliteinfo)
-
-# special case end
diff --git a/tests/benchmarks/README b/tests/benchmarks/README
deleted file mode 100644
index 8d017cd9..00000000
--- a/tests/benchmarks/README
+++ /dev/null
@@ -1,81 +0,0 @@
-The most reliable way of running benchmarks is to do it in an otherwise idle
-system. On a busy system, the results will vary according to the other tasks
-demanding attention in the system.
-
-We have managed to obtain quite reliable results by doing the following on
-Linux (and you need root):
-
- - switching the scheduler to a Real-Time mode
- - setting the processor affinity to one single processor
- - disabling the other thread of the same core
-
-This should work rather well for CPU-intensive tasks. A task that is in Real-
-Time mode will simply not be preempted by the OS. But if you make OS syscalls,
-especially I/O ones, your task will be de-scheduled. Note that this includes
-page faults, so if you can, make sure your benchmark's warmup code paths touch
-most of the data.
-
-To do this you need a tool called schedtool (package schedtool), from
-http://freequaos.host.sk/schedtool/
-
-From this point on, we are using CPU0 for all tasks:
-
-If you have a Hyperthreaded multi-core processor (Core-i5 and Core-i7), you
-have to disable the other thread of the same core as CPU0. To discover which
-one it is:
-
-$ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list
-
-This will print something like 0,4, meaning that CPUs 0 and 4 are sibling
-threads on the same core. So we'll turn CPU 4 off:
-
-(as root)
-# echo 0 > /sys/devices/system/cpu/cpu4/online
-
-To turn it back on, echo 1 into the same file.
-
-To run a task on CPU 0 exclusively, using FIFO RT priority 10, you run the
-following:
-
-(as root)
-# schedtool -F -p 10 -a 1 -e ./taskname
-
-For example:
-# schedtool -F -p 10 -a 1 -e ./tst_bench_qstring -tickcounter
-
-Warning: if your task livelocks or takes far too long to complete, your system
-may be unusable for a long time, especially if you don't have other cores to
-run stuff on. To prevent that, run it before schedtool and time it.
-
-You can also limit the CPU time that the task is allowed to take. Run in the
-same shell as you'll run schedtool:
-
-$ ulimit -s 300
-To limit to 300 seconds (5 minutes)
-
-If your task runs away, it will get a SIGXCPU after consuming 5 minutes of CPU
-time (5 minutes running at 100%).
-
-If your app is multithreaded, you may want to give it more CPUs, like CPU0 and
-CPU1 with -a 3 (it's a bitmask).
-
-For best results, you should disable ALL other cores and threads of the same
-processor. The new Core-i7 have one processor with 4 cores,
-each core can run 2 threads; the older Mac Pros have two processors with 4
-cores each. So on those Mac Pros, you'd disable cores 1, 2 and 3, while on the
-Core-i7, you'll need to disable all other CPUs.
-
-However, disabling just the sibling thread seems to produce very reliable
-results for me already, with variance often below 0.5% (even though there are
-some measurable spikes).
-
-Other things to try:
-
-Running the benchmark with highest priority, i.e. "sudo nice -19"
-usually produces stable results on some machines. If the benchmark also
-involves displaying something on the screen (on X11), running it with
-"-sync" is a must. Though, in that case the "real" cost is not correct,
-but it is useful to discover regressions.
-
-Also; not many people know about ionice (1)
- ionice - get/set program io scheduling class and priority
diff --git a/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt b/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt
deleted file mode 100644
index f384baaf..00000000
--- a/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# special case begin
-
-qt_internal_add_benchmark(tst_bench_qgeoareamonitorinfo
- SOURCES
- tst_bench_qgeoareamonitorinfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
-
-# special case end
diff --git a/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp b/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp
deleted file mode 100644
index 0e332ea7..00000000
--- a/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtPositioning/QGeoAreaMonitorInfo>
-#include <QtPositioning/QGeoCircle>
-#include <QTest>
-
-static const QDateTime expirationTime = QDateTime::currentDateTimeUtc().addSecs(60);
-static const QGeoCircle area = QGeoCircle(QGeoCoordinate(1.0, 1.0), 100);
-
-class tst_QGeoAreaMonitorInfoBenchmark : public QObject
-{
- Q_OBJECT
-private slots:
- void construct();
- void constructCopy();
- void constructMove();
-
- void assign();
- void assignMove();
-
- void checkEquality();
-
- void setName();
- void queryName();
-
- void queryIdentifier();
- void isValid();
-
- void setArea();
- void queryArea();
-
- void setExpiration();
- void queryExpiration();
-
- void setPersistent();
- void queryPersistent();
-
- void setNotificationParameters();
- void queryNotificationParameters();
-};
-
-
-
-void tst_QGeoAreaMonitorInfoBenchmark::construct()
-{
- QBENCHMARK {
- QGeoAreaMonitorInfo info("test");
- Q_UNUSED(info)
- }
-}
-
-static QGeoAreaMonitorInfo createAreaMonitorInfo()
-{
- QGeoAreaMonitorInfo info("test");
- info.setExpiration(expirationTime);
- info.setArea(area);
- QVariantMap parameters;
- parameters["key"] = "value";
- parameters["another_key"] = true;
- info.setNotificationParameters(parameters);
- return info;
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::constructCopy()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- QGeoAreaMonitorInfo newInfo(info);
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::constructMove()
-{
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of construct()
- // benchmark.
- QGeoAreaMonitorInfo info("test");
- QGeoAreaMonitorInfo newInfo(std::move(info));
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::assign()
-{
- const auto info = createAreaMonitorInfo();
- QGeoAreaMonitorInfo newInfo;
- QBENCHMARK {
- newInfo = info;
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::assignMove()
-{
- QGeoAreaMonitorInfo newInfo;
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of construct()
- // benchmark.
- QGeoAreaMonitorInfo info("test");
- newInfo = std::move(info);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::checkEquality()
-{
- const auto info1 = createAreaMonitorInfo();
- const auto info2 = createAreaMonitorInfo();
- QBENCHMARK {
- const bool equal = info1 == info2;
- Q_UNUSED(equal)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setName()
-{
- auto info = createAreaMonitorInfo();
- // Setting the name twice, as there is a check for same name.
- // Ideally need to divide the result of the benchmark by 2.
- QBENCHMARK {
- info.setName("name1");
- info.setName("name2");
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryName()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.name();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryIdentifier()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.identifier();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::isValid()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.isValid();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setArea()
-{
- auto info = createAreaMonitorInfo();
- QBENCHMARK {
- info.setArea(area);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryArea()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.area();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setExpiration()
-{
- auto info = createAreaMonitorInfo();
- QBENCHMARK {
- info.setExpiration(expirationTime);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryExpiration()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.expiration();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setPersistent()
-{
- auto info = createAreaMonitorInfo();
- QBENCHMARK {
- info.setPersistent(true);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryPersistent()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.isPersistent();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::setNotificationParameters()
-{
- auto info = createAreaMonitorInfo();
- QVariantMap newParameters;
- newParameters["key"] = "value1";
- newParameters["another_key"] = false;
- QBENCHMARK {
- info.setNotificationParameters(newParameters);
- }
-}
-
-void tst_QGeoAreaMonitorInfoBenchmark::queryNotificationParameters()
-{
- const auto info = createAreaMonitorInfo();
- QBENCHMARK {
- const auto val = info.notificationParameters();
- Q_UNUSED(val)
- }
-}
-
-QTEST_MAIN(tst_QGeoAreaMonitorInfoBenchmark)
-
-#include "tst_bench_qgeoareamonitorinfo.moc"
diff --git a/tests/benchmarks/qgeopositioninfo/CMakeLists.txt b/tests/benchmarks/qgeopositioninfo/CMakeLists.txt
deleted file mode 100644
index 40ba0246..00000000
--- a/tests/benchmarks/qgeopositioninfo/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# special case begin
-
-qt_internal_add_benchmark(tst_bench_qgeopositioninfo
- SOURCES
- tst_bench_qgeopositioninfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
-
-# special case end
diff --git a/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp b/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp
deleted file mode 100644
index eabc6b62..00000000
--- a/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtPositioning/QGeoPositionInfo>
-#include <QTest>
-
-static const QGeoCoordinate coordinate(1.0, 2.0);
-static const QDateTime dateTime = QDateTime::currentDateTimeUtc();
-
-class tst_QGeoPositionInfoBenchmark : public QObject
-{
- Q_OBJECT
-private slots:
- void constructDefault();
- void constructWithParameters();
- void constructCopy();
- void constructMove();
-
- void assign();
- void assignMove();
-
- void checkEquality();
-
- void isValid();
-
- void setTimestamp();
- void queryTimestamp();
-
- void setCoordinate();
- void queryCoordinate();
-
- void setAttribute();
- void queryAttributeExisting();
- void queryAttributeNonExisting();
- void removeAttributeExisting();
- void removeAttributeNonExisting();
- void hasAttributeExisting();
- void hasAttributeNonExisting();
-};
-
-void tst_QGeoPositionInfoBenchmark::constructDefault()
-{
- QBENCHMARK {
- QGeoPositionInfo info;
- Q_UNUSED(info)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::constructWithParameters()
-{
- QBENCHMARK {
- QGeoPositionInfo info(coordinate, dateTime);
- Q_UNUSED(info)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::constructCopy()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- QGeoPositionInfo newInfo(info);
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::constructMove()
-{
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoPositionInfo info;
- QGeoPositionInfo newInfo(std::move(info));
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::assign()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QGeoPositionInfo newInfo;
- QBENCHMARK {
- newInfo = info;
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::assignMove()
-{
- QGeoPositionInfo newInfo;
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoPositionInfo info;
- newInfo = std::move(info);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::checkEquality()
-{
- // We will benchmark equal objects, because unequal objects will normally
- // take less time to compare (as the comparison will fail at some stage).
- const QGeoPositionInfo info1(coordinate, dateTime);
- const QGeoPositionInfo info2(coordinate, dateTime);
- QBENCHMARK {
- const bool equal = info1 == info2;
- Q_UNUSED(equal)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::isValid()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- const bool valid = info.isValid();
- Q_UNUSED(valid)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::setTimestamp()
-{
- QGeoPositionInfo info;
- QBENCHMARK {
- info.setTimestamp(dateTime);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::queryTimestamp()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- const auto dt = info.timestamp();
- Q_UNUSED(dt)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::setCoordinate()
-{
- QGeoPositionInfo info;
- QBENCHMARK {
- info.setCoordinate(coordinate);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::queryCoordinate()
-{
- const QGeoPositionInfo info(coordinate, dateTime);
- QBENCHMARK {
- const auto coord = info.coordinate();
- Q_UNUSED(coord)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::setAttribute()
-{
- QGeoPositionInfo info;
- QBENCHMARK {
- info.setAttribute(QGeoPositionInfo::Direction, 1.0);
- }
-}
-
-static QGeoPositionInfo generateInfoWithAttributes()
-{
- QGeoPositionInfo info;
- info.setAttribute(QGeoPositionInfo::Direction, 1.0);
- info.setAttribute(QGeoPositionInfo::GroundSpeed, 2.0);
- info.setAttribute(QGeoPositionInfo::VerticalSpeed, 3.0);
- info.setAttribute(QGeoPositionInfo::MagneticVariation, 4.0);
- return info;
-}
-
-void tst_QGeoPositionInfoBenchmark::queryAttributeExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.attribute(QGeoPositionInfo::GroundSpeed);
- Q_UNUSED(value)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::queryAttributeNonExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.attribute(QGeoPositionInfo::HorizontalAccuracy);
- Q_UNUSED(value)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::removeAttributeExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- info.removeAttribute(QGeoPositionInfo::GroundSpeed);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::removeAttributeNonExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- info.removeAttribute(QGeoPositionInfo::HorizontalAccuracy);
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::hasAttributeExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.hasAttribute(QGeoPositionInfo::GroundSpeed);
- Q_UNUSED(value)
- }
-}
-
-void tst_QGeoPositionInfoBenchmark::hasAttributeNonExisting()
-{
- QGeoPositionInfo info = generateInfoWithAttributes();
- QBENCHMARK {
- const auto value = info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy);
- Q_UNUSED(value)
- }
-}
-
-QTEST_MAIN(tst_QGeoPositionInfoBenchmark)
-
-#include "tst_bench_qgeopositioninfo.moc"
diff --git a/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt b/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt
deleted file mode 100644
index 461bcf66..00000000
--- a/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# special case begin
-
-qt_internal_add_benchmark(tst_bench_qgeosatelliteinfo
- SOURCES
- tst_bench_qgeosatelliteinfo.cpp
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Test
-)
-
-# special case end
diff --git a/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp b/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp
deleted file mode 100644
index acff7a7b..00000000
--- a/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtPositioning/QGeoSatelliteInfo>
-#include <QTest>
-
-class tst_QGeoSatelliteInfoBenchmark : public QObject
-{
- Q_OBJECT
-private slots:
- void constructDefault();
- void constructCopy();
- void constructMove();
-
- void assign();
- void assignMove();
-
- void checkEquality();
-
- void setSatelliteSystem();
- void querySatelliteSystem();
-
- void setSatelliteIdentifier();
- void querySatelliteIdentifier();
-
- void setSignalStrength();
- void querySignalStrength();
-
- void setAttribute();
- void queryAttributeExisting();
- void queryAttributeNonExisting();
- void removeAttributeExisting();
- void removeAttributeNonExisting();
- void hasAttributeExisting();
- void hasAttributeNonExisting();
-};
-
-void tst_QGeoSatelliteInfoBenchmark::constructDefault()
-{
- QBENCHMARK {
- QGeoSatelliteInfo info;
- Q_UNUSED(info)
- }
-}
-
-static QGeoSatelliteInfo createSatelliteInfo()
-{
- QGeoSatelliteInfo info;
- info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS);
- info.setSatelliteIdentifier(1);
- info.setSignalStrength(-30);
- info.setAttribute(QGeoSatelliteInfo::Elevation, 10.0);
- return info;
-}
-
-void tst_QGeoSatelliteInfoBenchmark::constructCopy()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- QGeoSatelliteInfo newInfo(info);
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::constructMove()
-{
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoSatelliteInfo info;
- QGeoSatelliteInfo newInfo(std::move(info));
- Q_UNUSED(newInfo)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::assign()
-{
- const auto info = createSatelliteInfo();
- QGeoSatelliteInfo newInfo;
- QBENCHMARK {
- newInfo = info;
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::assignMove()
-{
- QGeoSatelliteInfo newInfo;
- QBENCHMARK {
- // We need to create a new object at each iteration, so that we don't
- // end up moving an already moved-from object. So the real value for
- // move can be calculated using the results of constructDefault()
- // benchmark.
- QGeoSatelliteInfo info;
- newInfo = std::move(info);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::checkEquality()
-{
- const auto info1 = createSatelliteInfo();
- const auto info2 = createSatelliteInfo();
- QBENCHMARK {
- const bool equal = info1 == info2;
- Q_UNUSED(equal)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setSatelliteSystem()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setSatelliteSystem(QGeoSatelliteInfo::GPS);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::querySatelliteSystem()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.satelliteSystem();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setSatelliteIdentifier()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setSatelliteIdentifier(10);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::querySatelliteIdentifier()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.satelliteIdentifier();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setSignalStrength()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setSignalStrength(-50);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::querySignalStrength()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.signalStrength();
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::setAttribute()
-{
- QGeoSatelliteInfo info;
- QBENCHMARK {
- info.setAttribute(QGeoSatelliteInfo::Elevation, 10.0);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::queryAttributeExisting()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.attribute(QGeoSatelliteInfo::Elevation);
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::queryAttributeNonExisting()
-{
- const auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.attribute(QGeoSatelliteInfo::Azimuth);
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::removeAttributeExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- info.removeAttribute(QGeoSatelliteInfo::Elevation);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::removeAttributeNonExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- info.removeAttribute(QGeoSatelliteInfo::Azimuth);
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::hasAttributeExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.hasAttribute(QGeoSatelliteInfo::Elevation);
- Q_UNUSED(val)
- }
-}
-
-void tst_QGeoSatelliteInfoBenchmark::hasAttributeNonExisting()
-{
- auto info = createSatelliteInfo();
- QBENCHMARK {
- const auto val = info.hasAttribute(QGeoSatelliteInfo::Azimuth);
- Q_UNUSED(val)
- }
-}
-
-QTEST_MAIN(tst_QGeoSatelliteInfoBenchmark)
-
-#include "tst_bench_qgeosatelliteinfo.moc"