QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGeoServiceProviderPluginQGC.cpp
Go to the documentation of this file.
2
3#include <QtCore/QThread>
4#include <QtQml/QQmlEngine>
5
8
9QGC_LOGGING_CATEGORY(QGeoServiceProviderFactoryQGCLog, "QtLocationPlugin.QGeoServiceProviderFactoryQGC")
10
12 : QObject(parent)
13{
14 qCDebug(QGeoServiceProviderFactoryQGCLog) << this;
15}
16
18{
19 qCDebug(QGeoServiceProviderFactoryQGCLog) << this;
20}
21
23 const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
24{
25 Q_UNUSED(parameters);
26 if (error) {
27 *error = QGeoServiceProvider::NotSupportedError;
28 }
29 if (errorString) {
30 *errorString = QStringLiteral("Geocoding Not Supported");
31 }
32
33 return nullptr;
34}
35
37 const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
38{
39 if (error) {
40 *error = QGeoServiceProvider::NoError;
41 }
42 if (errorString) {
43 *errorString = "";
44 }
45
46 // The tile fetcher shares the QML engine's network access manager, which belongs to the engine's thread
47 if (!m_engine || (m_engine->thread() != QThread::currentThread())) {
48 qCCritical(QGeoServiceProviderFactoryQGCLog)
49 << "Internal Error: QML engine" << (m_engine ? "lives on another thread" : "not set");
50 if (error) {
51 *error = QGeoServiceProvider::LoaderError;
52 }
53 if (errorString) {
54 *errorString = QStringLiteral("QML engine not available on the calling thread");
55 }
56 return nullptr;
57 }
58
59 QNetworkAccessManager *networkManager = m_engine->networkAccessManager();
60
61 return new QGeoTiledMappingManagerEngineQGC(parameters, error, errorString, networkManager, nullptr);
62}
63
65 const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
66{
67 Q_UNUSED(parameters);
68 if (error) {
69 *error = QGeoServiceProvider::NotSupportedError;
70 }
71 if (errorString) {
72 *errorString = QStringLiteral("Routing Not Supported");
73 }
74
75 return nullptr;
76}
77
79 const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const
80{
81 Q_UNUSED(parameters);
82 if (error) {
83 *error = QGeoServiceProvider::NotSupportedError;
84 }
85 if (errorString) {
86 *errorString = QStringLiteral("Place Not Supported");
87 }
88
89 return nullptr;
90}
#define QGC_LOGGING_CATEGORY(name, categoryStr)
QGeoRoutingManagerEngine * createRoutingManagerEngine(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const final
QGeoServiceProviderFactoryQGC(QObject *parent=nullptr)
QPlaceManagerEngine * createPlaceManagerEngine(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const final
QGeoMappingManagerEngine * createMappingManagerEngine(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const final
QGeoCodingManagerEngine * createGeocodingManagerEngine(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString) const final