Browse Source

Change VWorld URL and Add API Key

QGC4.4
WTPENGUIN 4 years ago committed by Don Gagne
parent
commit
50e32ade20
  1. 8
      src/QtLocationPlugin/GenericMapProvider.cpp
  2. 2
      src/QtLocationPlugin/GenericMapProvider.h
  3. 18
      src/QtLocationPlugin/QMLControl/OfflineMap.qml
  4. 7
      src/Settings/App.SettingsGroup.json
  5. 1
      src/Settings/AppSettings.cc
  6. 1
      src/Settings/AppSettings.h

8
src/QtLocationPlugin/GenericMapProvider.cpp

@ -94,10 +94,12 @@ QString VWorldStreetMapProvider::_getURL(const int x, const int y, const int zoo @@ -94,10 +94,12 @@ QString VWorldStreetMapProvider::_getURL(const int x, const int y, const int zoo
const int y_min = int(22 * pow(2, gap));
const int y_max = int(26 * pow(2, gap) + (2 * gap - 1));
const QString VWorldMapToken = qgcApp()->toolbox()->settingsManager()->appSettings()->vworldToken()->rawValue().toString();
if (zoom > 19) {
return QString();
} else if (zoom > 5 && x >= x_min && x <= x_max && y >= y_min && y <= y_max) {
return QString(QStringLiteral("http://xdworld.vworld.kr:8080/2d/Base/service/%1/%2/%3.png")).arg(zoom, x, y);
return QString("http://api.vworld.kr/req/wmts/1.0.0/%1/Base/%2/%3/%4.png").arg(VWorldMapToken).arg(zoom).arg(y).arg(x);
} else {
const QString key = _tileXYToQuadKey(x, y, zoom);
return QString(QStringLiteral("http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4"))
@ -113,10 +115,12 @@ QString VWorldSatMapProvider::_getURL(const int x, const int y, const int zoom, @@ -113,10 +115,12 @@ QString VWorldSatMapProvider::_getURL(const int x, const int y, const int zoom,
const int y_min = int(22 * pow(2, gap));
const int y_max = int(26 * pow(2, gap) + (2 * gap - 1));
const QString VWorldMapToken = qgcApp()->toolbox()->settingsManager()->appSettings()->vworldToken()->rawValue().toString();
if (zoom > 19) {
return QString();
} else if (zoom > 5 && x >= x_min && x <= x_max && y >= y_min && y <= y_max) {
return QString("http://xdworld.vworld.kr:8080/2d/Satellite/service/%1/%2/%3.jpeg").arg(zoom, x, y);
return QString("http://api.vworld.kr/req/wmts/1.0.0/%1/Satellite/%2/%3/%4.jpeg").arg(VWorldMapToken).arg(zoom).arg(y).arg(x);
} else {
const QString key = _tileXYToQuadKey(x, y, zoom);
return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4")

2
src/QtLocationPlugin/GenericMapProvider.h

@ -138,7 +138,7 @@ class VWorldSatMapProvider : public MapProvider { @@ -138,7 +138,7 @@ class VWorldSatMapProvider : public MapProvider {
Q_OBJECT
public:
VWorldSatMapProvider(QObject* parent = nullptr)
: MapProvider(QStringLiteral("www.vworld.kr"), QStringLiteral("jpg"),
: MapProvider(QStringLiteral("www.vworld.kr"), QStringLiteral("jpeg"),
AVERAGE_TILE_SIZE, QGeoMapType::SatelliteMapDay, parent) {}
QString _getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) override;

18
src/QtLocationPlugin/QMLControl/OfflineMap.qml

@ -40,6 +40,7 @@ Item { @@ -40,6 +40,7 @@ Item {
property Fact _mapboxStyleFact: _settingsManager ? _settingsManager.appSettings.mapboxStyle : null
property Fact _esriFact: _settingsManager ? _settingsManager.appSettings.esriToken : null
property Fact _customURLFact: _settingsManager ? _settingsManager.appSettings.customURL : null
property Fact _vworldFact: _settingsManager ? _settingsManager.appSettings.vworldToken : null
property string mapType: _fmSettings ? (_fmSettings.mapProvider.value + " " + _fmSettings.mapType.value) : ""
property bool isMapInteractive: false
@ -370,6 +371,23 @@ Item { @@ -370,6 +371,23 @@ Item {
font.pointSize: _adjustableFontPointSize
}
Item { width: 1; height: 1; visible: _vworldFact ? _vworldFact.visible : false }
QGCLabel { text: qsTr("VWorld Access Token"); visible: _vworldFact ? _vworldFact.visible : false }
FactTextField {
fact: _vworldFact
visible: _vworldFact ? _vworldFact.visible : false
maximumLength: 256
width: ScreenTools.defaultFontPixelWidth * 30
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("To enable VWorld maps, enter your access token.")
visible: _vworldFact ? _vworldFact.visible : false
font.pointSize: _adjustableFontPointSize
}
Item { width: 1; height: 1; visible: _customURLFact ? _customURLFact.visible : false }
QGCLabel { text: qsTr("Custom Map URL"); visible: _customURLFact ? _customURLFact.visible : false }
FactTextField {

7
src/Settings/App.SettingsGroup.json

@ -228,6 +228,13 @@ @@ -228,6 +228,13 @@
"default": ""
},
{
"name": "vworldToken",
"shortDesc": "VWorld Token",
"longDesc": "Your personal access token for VWorld maps",
"type": "string",
"default": ""
},
{
"name": "defaultFirmwareType",
"shortDesc": "Default firmware type for flashing",
"type": "uint32",

1
src/Settings/AppSettings.cc

@ -123,6 +123,7 @@ DECLARE_SETTINGSFACT(AppSettings, mapboxAccount) @@ -123,6 +123,7 @@ DECLARE_SETTINGSFACT(AppSettings, mapboxAccount)
DECLARE_SETTINGSFACT(AppSettings, mapboxStyle)
DECLARE_SETTINGSFACT(AppSettings, esriToken)
DECLARE_SETTINGSFACT(AppSettings, customURL)
DECLARE_SETTINGSFACT(AppSettings, vworldToken)
DECLARE_SETTINGSFACT(AppSettings, defaultFirmwareType)
DECLARE_SETTINGSFACT(AppSettings, gstDebugLevel)
DECLARE_SETTINGSFACT(AppSettings, followTarget)

1
src/Settings/AppSettings.h

@ -51,6 +51,7 @@ public: @@ -51,6 +51,7 @@ public:
DEFINE_SETTINGFACT(mapboxStyle)
DEFINE_SETTINGFACT(esriToken)
DEFINE_SETTINGFACT(customURL)
DEFINE_SETTINGFACT(vworldToken)
DEFINE_SETTINGFACT(defaultFirmwareType)
DEFINE_SETTINGFACT(gstDebugLevel)
DEFINE_SETTINGFACT(followTarget)

Loading…
Cancel
Save