diff options
-rw-r--r-- | platform/qt/include/qmapboxgl.hpp | 4 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp index c3a83610be..c957ce586b 100644 --- a/platform/qt/include/qmapboxgl.hpp +++ b/platform/qt/include/qmapboxgl.hpp @@ -60,6 +60,9 @@ public: QString accessToken() const; void setAccessToken(const QString &); + QString apiBaseUrl() const; + void setApiBaseUrl(const QString &); + private: GLContextMode m_contextMode; ConstrainMode m_constrainMode; @@ -69,6 +72,7 @@ private: QString m_cacheDatabasePath; QString m_assetPath; QString m_accessToken; + QString m_apiBaseUrl; }; struct Q_DECL_EXPORT QMapboxGLCameraOptions { diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 1f5638337f..398b31684a 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -196,6 +196,7 @@ QMapboxGLSettings::QMapboxGLSettings() , m_cacheDatabasePath(":memory:") , m_assetPath(QCoreApplication::applicationDirPath()) , m_accessToken(qgetenv("MAPBOX_ACCESS_TOKEN")) + , m_apiBaseUrl(mbgl::util::API_BASE_URL) { } @@ -349,6 +350,26 @@ void QMapboxGLSettings::setAccessToken(const QString &token) } /*! + Returns the API base URL. +*/ +QString QMapboxGLSettings::apiBaseUrl() const +{ + return m_apiBaseUrl; +} + +/*! + Sets the API base \a url. + + The API base URL is the URL that the \b "mapbox://" protocol will + be resolved to. It defaults to "https://api.mapbox.com" but can be + changed, for instance, to a tile cache server address. +*/ +void QMapboxGLSettings::setApiBaseUrl(const QString& url) +{ + m_apiBaseUrl = url; +} + +/*! \class QMapboxGL \brief The QMapboxGL class is a Qt wrapper for the Mapbox GL Native engine. @@ -1125,6 +1146,8 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin qRegisterMetaType<QMapboxGL::MapChange>("QMapboxGL::MapChange"); fileSourceObj->setAccessToken(settings.accessToken().toStdString()); + fileSourceObj->setAPIBaseURL(settings.apiBaseUrl().toStdString()); + connect(this, SIGNAL(needsRendering()), q_ptr, SIGNAL(needsRendering()), Qt::QueuedConnection); connect(this, SIGNAL(mapChanged(QMapboxGL::MapChange)), q_ptr, SIGNAL(mapChanged(QMapboxGL::MapChange)), Qt::QueuedConnection); connect(this, SIGNAL(copyrightsChanged(QString)), q_ptr, SIGNAL(copyrightsChanged(QString)), Qt::QueuedConnection); |