diff --git a/libs/QtLocationGoogle/QtLocationGoogle.pro b/libs/QtLocationGoogle/QtLocationGoogle.pro deleted file mode 100644 index b156c864153be4b7bfa9c20999e910504aed0bc8..0000000000000000000000000000000000000000 --- a/libs/QtLocationGoogle/QtLocationGoogle.pro +++ /dev/null @@ -1,31 +0,0 @@ -TARGET = qtgeoservices_google -CONFIG += static -QT += location-private positioning-private network -PLUGIN_TYPE = geoservices - -PLUGIN_CLASS_NAME = QGeoServiceProviderFactoryGoogle - -load(qt_plugin) - -INCLUDEPATH += $$QT.location.includes - -HEADERS += \ - $$PWD/src/qgeoserviceproviderplugingoogle.h \ - $$PWD/src/qgeotiledmappingmanagerenginegoogle.h \ - $$PWD/src/qgeotilefetchergoogle.h \ - $$PWD/src/qgeomapreplygoogle.h \ - $$PWD/src/qgeocodingmanagerenginegoogle.h \ - $$PWD/src/qgeocodereplygoogle.h - - -SOURCES += \ - $$PWD/src/qgeoserviceproviderplugingoogle.cpp \ - $$PWD/src/qgeotiledmappingmanagerenginegoogle.cpp \ - $$PWD/src/qgeotilefetchergoogle.cpp \ - $$PWD/src/qgeomapreplygoogle.cpp \ - $$PWD/src/qgeocodingmanagerenginegoogle.cpp \ - $$PWD/src/qgeocodereplygoogle.cpp - -OTHER_FILES += \ - $$PWD/google_maps_plugin.json - diff --git a/libs/QtLocationGoogle/.qmake.conf b/libs/QtLocationQGC/.qmake.conf similarity index 100% rename from libs/QtLocationGoogle/.qmake.conf rename to libs/QtLocationQGC/.qmake.conf diff --git a/libs/QtLocationQGC/QtLocationQGC.pro b/libs/QtLocationQGC/QtLocationQGC.pro new file mode 100644 index 0000000000000000000000000000000000000000..7704868464abdbbf58c45c321046f069f79a9209 --- /dev/null +++ b/libs/QtLocationQGC/QtLocationQGC.pro @@ -0,0 +1,32 @@ +TARGET = qtgeoservices_qgc +CONFIG += static +QT += location-private positioning-private network +PLUGIN_TYPE = geoservices + +PLUGIN_CLASS_NAME = QGeoServiceProviderFactoryQGC + +load(qt_plugin) + +INCLUDEPATH += $$QT.location.includes + +HEADERS += \ + $$PWD/src/qgeoserviceproviderpluginqgc.h \ + $$PWD/src/qgeotiledmappingmanagerengineqgc.h \ + $$PWD/src/qgeotilefetcherqgc.h \ + $$PWD/src/qgeomapreplyqgc.h \ + $$PWD/src/qgeocodingmanagerengineqgc.h \ + $$PWD/src/qgeocodereplyqgc.h \ + $$PWD/src/OpenPilotMaps.h + +SOURCES += \ + $$PWD/src/qgeoserviceproviderpluginqgc.cpp \ + $$PWD/src/qgeotiledmappingmanagerengineqgc.cpp \ + $$PWD/src/qgeotilefetcherqgc.cpp \ + $$PWD/src/qgeomapreplyqgc.cpp \ + $$PWD/src/qgeocodingmanagerengineqgc.cpp \ + $$PWD/src/qgeocodereplyqgc.cpp \ + $$PWD/src/OpenPilotMaps.cc + +OTHER_FILES += \ + $$PWD/qgc_maps_plugin.json + diff --git a/libs/QtLocationGoogle/google_maps_plugin.json b/libs/QtLocationQGC/qgc_maps_plugin.json similarity index 65% rename from libs/QtLocationGoogle/google_maps_plugin.json rename to libs/QtLocationQGC/qgc_maps_plugin.json index 89d5b36fc0abf1befab4c9d6010d83d21f9ecaed..dd52d9feede3a77ff58625511e7f901758338153 100644 --- a/libs/QtLocationGoogle/google_maps_plugin.json +++ b/libs/QtLocationQGC/qgc_maps_plugin.json @@ -1,7 +1,7 @@ { - "Keys": ["google-maps"], - "Provider": "google", - "Version": 100, + "Keys": ["qgc-maps"], + "Provider": "QGroundControl", + "Version": 101, "Experimental": false, "Features": [ "OnlineMappingFeature", diff --git a/libs/QtLocationQGC/src/OpenPilotMaps.cc b/libs/QtLocationQGC/src/OpenPilotMaps.cc new file mode 100644 index 0000000000000000000000000000000000000000..5945e47f4405e1dda3624da95d2dcfddd42f4a4f --- /dev/null +++ b/libs/QtLocationQGC/src/OpenPilotMaps.cc @@ -0,0 +1,490 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2015 QGROUNDCONTROL PROJECT + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +/** + * @file + * @brief QGC Open Pilot Mapping Tools + * @author Gus Grubba + * Original work: The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + */ + +#include +#include +#include +#include + +#include "OpenPilotMaps.h" + +namespace OpenPilot { + +const QString ProviderStrings::levelsForSigPacSpainMap[] = + { "0", "1", "2", "3", "4", + "MTNSIGPAC", + "MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN2000", + "MTN200", "MTN200", "MTN200", + "MTN25", "MTN25", + "ORTOFOTOS", "ORTOFOTOS", "ORTOFOTOS", "ORTOFOTOS" }; + +const double UrlFactory::EarthRadiusKm = 6378.137; // WGS-84 + +ProviderStrings::ProviderStrings() +{ + // Google version strings + VersionGoogleMap = "m@113"; + VersionGoogleSatellite = "s"; + VersionGoogleLabels = "h@221000000"; + VersionGoogleTerrain = "t@132,r@249000000"; + SecGoogleWord = "Galileo"; + + // Google (China) version strings + VersionGoogleMapChina = "m@132"; + VersionGoogleSatelliteChina = "s@71"; + VersionGoogleLabelsChina = "h@132"; + VersionGoogleTerrainChina = "t@125,r@132"; + + // Google (Korea) version strings + VersionGoogleMapKorea = "kr1.12"; + VersionGoogleSatelliteKorea = "66"; + VersionGoogleLabelsKorea = "kr1t.12"; + + /// + /// Google Maps API generated using http://greatmaps.codeplex.com/ + /// from http://code.google.com/intl/en-us/apis/maps/signup.html + /// + GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA"; + + // Yahoo version strings + VersionYahooMap = "4.3"; + VersionYahooSatellite = "1.9"; + VersionYahooLabels = "4.3"; + + // BingMaps + VersionBingMaps = "563"; + + // YandexMap + VersionYandexMap = "2.16.0"; + + /// + /// Bing Maps Customer Identification, more info here + /// http://msdn.microsoft.com/en-us/library/bb924353.aspx + /// + BingMapsClientToken = ""; +} + +UrlFactory::UrlFactory() + : _isCorrectedGoogleVersions(false) + , _correctGoogleVersions(false) + , _timeout(5 * 1000) +{ + Proxy.setType(QNetworkProxy::NoProxy); + UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"; +} + +UrlFactory::~UrlFactory() +{ + +} + +QString UrlFactory::_tileXYToQuadKey(const int& tileX, const int& tileY, const int& levelOfDetail) const +{ + QString quadKey; + for (int i = levelOfDetail; i > 0; i--) { + char digit = '0'; + int mask = 1 << (i - 1); + if ((tileX & mask) != 0) { + digit++; + } + if ((tileY & mask) != 0) { + digit++; + digit++; + } + quadKey.append(digit); + } + return quadKey; +} + +int UrlFactory::_getServerNum(const QPoint &pos, const int &max) const +{ + return (pos.x() + 2 * pos.y()) % max; +} + +void UrlFactory::_tryCorrectGoogleVersions() +{ + static bool _kVersionRetrieved = false; + if (_kVersionRetrieved) { + return; + } + QMutexLocker locker(&mutex); + if (_correctGoogleVersions && !_isCorrectedGoogleVersions) { + QNetworkReply* reply; + QNetworkRequest qheader; + QNetworkAccessManager network; + QEventLoop q; + QTimer tT; + tT.setSingleShot(true); + connect(&network, SIGNAL(finished(QNetworkReply *)), &q, SLOT(quit())); + connect(&tT, SIGNAL(timeout()), &q, SLOT(quit())); + network.setProxy(Proxy); + _isCorrectedGoogleVersions = true; + QString url = "https://maps.google.com/maps?output=classic"; + qheader.setUrl(QUrl(url)); + qheader.setRawHeader("User-Agent", UserAgent); + reply = network.get(qheader); + tT.start(_timeout); + q.exec(); + if (!tT.isActive()) { + return; + } + tT.stop(); + if ((reply->error() != QNetworkReply::NoError)) { + return; + } + QString html = QString(reply->readAll()); + QRegExp reg("\"*https://mts0.google.com/vt/lyrs=m@(\\d*)", Qt::CaseInsensitive); + if (reg.indexIn(html) != -1) { + QStringList gc = reg.capturedTexts(); + VersionGoogleMap = QString("m@%1").arg(gc[1]); + VersionGoogleMapChina = VersionGoogleMap; + VersionGoogleMapKorea = VersionGoogleMap; + } + reg = QRegExp("\"*https://mts0.google.com/vt/lyrs=h@(\\d*)", Qt::CaseInsensitive); + if (reg.indexIn(html) != -1) { + QStringList gc = reg.capturedTexts(); + VersionGoogleLabels = QString("h@%1").arg(gc[1]); + VersionGoogleLabelsChina = VersionGoogleLabels; + VersionGoogleLabelsKorea = VersionGoogleLabels; + } + reg = QRegExp("\"*https://khms0.google.com/kh/v=(\\d*)", Qt::CaseInsensitive); + if (reg.indexIn(html) != -1) { + QStringList gc = reg.capturedTexts(); + VersionGoogleSatellite = gc[1]; + VersionGoogleSatelliteKorea = VersionGoogleSatellite; + VersionGoogleSatelliteChina = "s@" + VersionGoogleSatellite; + } + reg = QRegExp("\"*https://mts0.google.com/vt/lyrs=t@(\\d*),r@(\\d*)", Qt::CaseInsensitive); + if (reg.indexIn(html) != -1) { + QStringList gc = reg.capturedTexts(); + VersionGoogleTerrain = QString("t@%1,r@%2").arg(gc[1]).arg(gc[2]); + VersionGoogleTerrainChina = VersionGoogleTerrain; + VersionGoogleTerrainChina = VersionGoogleTerrain; + } + reply->deleteLater(); + _kVersionRetrieved = true; + } +} + +QString UrlFactory::makeImageUrl(const MapType &type, const QPoint& pos, const int &zoom, const QString &language) +{ + switch (type) { + case GoogleMap: + { + // http://mt1.google.com/vt/lyrs=m + QString server = "mt"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10&scale=2").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleMap).arg(language).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleSatellite: + { + // http://mt1.google.com/vt/lyrs=s + QString server = "mt"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10&scale=2").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleSatellite).arg(language).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleLabels: + { + QString server = "mts"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleLabels).arg(language).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleTerrain: + { + QString server = "mts"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + return QString("http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10&scale=2").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleTerrain).arg(language).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleMapChina: + { + QString server = "mt"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // http://mt0.google.cn/vt/v=w2.101&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga + return QString("http://%1%2.google.cn/%3/lyrs=%4&hl=%5&gl=cn&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleMapChina).arg("zh-CN").arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleSatelliteChina: + { + QString server = "mt"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // http://khm0.google.cn/kh/v=46&x=12&y=6&z=4&s=Ga + return QString("http://%1%2.google.cn/%3/lyrs=%4&gl=cn&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleSatelliteChina).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleLabelsChina: + { + QString server = "mt"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // http://mt0.google.cn/vt/v=w2t.110&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga + return QString("http://%1%2.google.cn/%3/imgtp=png32&lyrs=%4&hl=%5&gl=cn&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsChina).arg("zh-CN").arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleTerrainChina: + { + QString server = "mt"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // http://mt0.google.cn/vt/v=w2p.110&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga + return QString("http://%1%2.google.com/%3/lyrs=%4&hl=%5&gl=cn&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleTerrainChina).arg("zh-CN").arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleMapKorea: + { + QString server = "mts"; + QString request = "vt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // https://mts0.google.com/vt/lyrs=m@224000000&hl=ko&gl=KR&src=app&x=107&y=50&z=7&s=Gal + // https://mts0.google.com/mt/v=kr1.11&hl=ko&x=109&y=49&z=7&s= + QString ret = QString("https://%1%2.google.com/%3/lyrs=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleMapKorea).arg(language).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + return ret; + } + break; + case GoogleSatelliteKorea: + { + QString server = "khms"; + QString request = "kh"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // http://khm1.google.co.kr/kh/v=54&x=109&y=49&z=7&s= + return QString("https://%1%2.google.co.kr/%3/v=%4&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleSatelliteKorea).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case GoogleLabelsKorea: + { + QString server = "mts"; + QString request = "mt"; + QString sec1 = ""; // after &x=... + QString sec2 = ""; // after &zoom=... + _getSecGoogleWords(pos, sec1, sec2); + _tryCorrectGoogleVersions(); + // https://mts1.gmaptiles.co.kr/mt/v=kr1t.11&hl=lt&x=109&y=50&z=7&s=G + return QString("https://%1%2.gmaptiles.co.kr/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(_getServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(language).arg(pos.x()).arg(sec1).arg(pos.y()).arg(zoom).arg(sec2); + } + break; + case YahooMap: + { + return QString("http://maps%1.yimg.com/hx/tl?v=%2&.intl=%3&x=%4&y=%5&z=%6&r=1").arg(((_getServerNum(pos, 2)) + 1)).arg(VersionYahooMap).arg(language).arg(pos.x()).arg((((1 << zoom) >> 1) - 1 - pos.y())).arg((zoom + 1)); + } + case YahooSatellite: + { + return QString("http://maps%1.yimg.com/ae/ximg?v=%2&t=a&s=256&.intl=%3&x=%4&y=%5&z=%6&r=1").arg("3").arg(VersionYahooSatellite).arg(language).arg(pos.x()).arg(((1 << zoom) >> 1) - 1 - pos.y()).arg(zoom + 1); + } + break; + case YahooLabels: + { + return QString("http://maps%1.yimg.com/hx/tl?v=%2&t=h&.intl=%3&x=%4&y=%5&z=%6&r=1").arg("1").arg(VersionYahooLabels).arg(language).arg(pos.x()).arg(((1 << zoom) >> 1) - 1 - pos.y()).arg(zoom + 1); + } + break; + case OpenStreetMap: + { + char letter = "abc"[_getServerNum(pos, 3)]; + return QString("http://%1.tile.openstreetmap.org/%2/%3/%4.png").arg(letter).arg(zoom).arg(pos.x()).arg(pos.y()); + } + break; + case OpenStreetOsm: + { + char letter = "abc"[_getServerNum(pos, 3)]; + return QString("http://%1.tah.openstreetmap.org/Tiles/tile/%2/%3/%4.png").arg(letter).arg(zoom).arg(pos.x()).arg(pos.y()); + } + break; + case OpenStreetMapSurfer: + { + // http://tiles1.mapsurfer.net/tms_r.ashx?x=37378&y=20826&z=16 + return QString("http://tiles1.mapsurfer.net/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.x()).arg(pos.y()).arg(zoom); + } + break; + case OpenStreetMapSurferTerrain: + { + // http://tiles2.mapsurfer.net/tms_t.ashx?x=9346&y=5209&z=14 + return QString("http://tiles2.mapsurfer.net/tms_t.ashx?x=%1&y=%2&z=%3").arg(pos.x()).arg(pos.y()).arg(zoom); + } + break; + case BingMap: + { + QString key = _tileXYToQuadKey(pos.x(), pos.y(), zoom); + return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/r%2.png?g=%3&mkt=%4%5").arg(_getServerNum(pos, 4)).arg(key).arg(VersionBingMaps).arg(language).arg(!(BingMapsClientToken.isNull() | BingMapsClientToken.isEmpty()) ? "&token=" + BingMapsClientToken : QString("")); + } + break; + case BingSatellite: + { + QString key = _tileXYToQuadKey(pos.x(), pos.y(), zoom); + return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/a%2.jpeg?g=%3&mkt=%4%5").arg(_getServerNum(pos, 4)).arg(key).arg(VersionBingMaps).arg(language).arg(!(BingMapsClientToken.isNull() | BingMapsClientToken.isEmpty()) ? "&token=" + BingMapsClientToken : QString("")); + } + break; + case BingHybrid: + { + QString key = _tileXYToQuadKey(pos.x(), pos.y(), zoom); + return QString("http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4%5").arg(_getServerNum(pos, 4)).arg(key).arg(VersionBingMaps).arg(language).arg(!(BingMapsClientToken.isNull() | BingMapsClientToken.isEmpty()) ? "&token=" + BingMapsClientToken : QString("")); + } + case ArcGIS_Map: + { + // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/tile/0/0/0.jpg + return QString("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.y()).arg(pos.x()); + } + break; + case ArcGIS_Satellite: + { + // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/1/0/1.jpg + return QString("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.y()).arg(pos.x()); + } + break; + case ArcGIS_ShadedRelief: + { + // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer/tile/1/0/1.jpg + return QString("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.y()).arg(pos.x()); + } + break; + case ArcGIS_Terrain: + { + // http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer/tile/4/3/15 + return QString("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.y()).arg(pos.x()); + } + break; + case ArcGIS_MapsLT_OrtoFoto: + { + // http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L02/R0000001b/C00000028.jpg + // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/0/9/13 + // return string.Format("http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg", zoom, pos.y(), pos.x()); + // http://dc1.maps.lt/cache/mapslt_ortofoto_512/map/_alllayers/L03/R0000001c/C00000029.jpg + // return string.Format("http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/{0}/{1}/{2}", zoom, pos.y(), pos.x()); + // http://dc1.maps.lt/cache/mapslt_ortofoto_512/map/_alllayers/L03/R0000001d/C0000002a.jpg + // TODO verificar + return QString("http://dc1.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L%1/R%2/C%3.jpg").arg(zoom, 2, 10, (QChar)'0').arg(pos.y(), 8, 16, (QChar)'0').arg(pos.x(), 8, 16, (QChar)'0'); + } + break; + case ArcGIS_MapsLT_Map: + { + // http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L02/R0000001b/C00000028.jpg + // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto/MapServer/tile/0/9/13 + // return string.Format("http://www.maps.lt/ortofoto/mapslt_ortofoto_vector_512/map/_alllayers/L{0:00}/R{1:x8}/C{2:x8}.jpg", zoom, pos.y(), pos.x()); + // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt/MapServer/tile/7/1162/1684.png + // http://dc1.maps.lt/cache/mapslt_512/map/_alllayers/L03/R0000001b/C00000029.png + // TODO verificar + // http://dc1.maps.lt/cache/mapslt/map/_alllayers/L02/R0000001c/C00000029.png + return QString("http://dc1.maps.lt/cache/mapslt/map/_alllayers/L%1/R%2/C%3.png").arg(zoom, 2, 10, (QChar)'0').arg(pos.y(), 8, 16, (QChar)'0').arg(pos.x(), 8, 16, (QChar)'0'); + } + break; + case ArcGIS_MapsLT_Map_Labels: + { + // http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto_overlay/MapServer/tile/0/9/13 + // return string.Format("http://arcgis.maps.lt/ArcGIS/rest/services/mapslt_ortofoto_overlay/MapServer/tile/{0}/{1}/{2}", zoom, pos.y(), pos.x()); + // http://dc1.maps.lt/cache/mapslt_ortofoto_overlay_512/map/_alllayers/L03/R0000001d/C00000029.png + // TODO verificar + return QString("http://dc1.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L%1/R%2/C%3.png").arg(zoom, 2, 10, (QChar)'0').arg(pos.y(), 8, 16, (QChar)'0').arg(pos.x(), 8, 16, (QChar)'0'); + } + break; + case PergoTurkeyMap: + { + // http://{domain}/{layerName}/{zoomLevel}/{first3LetterOfTileX}/{second3LetterOfTileX}/{third3LetterOfTileX}/{first3LetterOfTileY}/{second3LetterOfTileY}/{third3LetterOfTileXY}.png + // http://map3.pergo.com.tr/tile/00/000/000/001/000/000/000.png + // That means: Zoom Level: 0 TileX: 1 TileY: 0 + // http://domain/tile/14/000/019/371/000/011/825.png + // That means: Zoom Level: 14 TileX: 19371 TileY:11825 + // string x = pos.x().ToString("000000000").Insert(3, "/").Insert(7, "/"); // - 000/000/001 + // string y = pos.y().ToString("000000000").Insert(3, "/").Insert(7, "/"); // - 000/000/000 + QString x = QString("%1").arg(QString::number(pos.x()), 9, (QChar)'0'); + x.insert(3, "/").insert(7, "/"); + QString y = QString("%1").arg(QString::number(pos.y()), 9, (QChar)'0'); + y.insert(3, "/").insert(7, "/"); + // "http://map03.pergo.com.tr/tile/2/000/000/003/000/000/002.png" + return QString("http://map%1.pergo.com.tr/tile/%2/%3/%4.png").arg(_getServerNum(pos, 4)).arg(zoom, 2, 10, (QChar)'0').arg(x).arg(y); + } + break; + case SigPacSpainMap: + { + return QString("http://sigpac.mapa.es/kmlserver/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.x()).arg((2 << (zoom - 1)) - pos.y() - 1); + } + break; + case YandexMapRu: + { + QString server = "vec"; + // http://vec01.maps.yandex.ru/tiles?l=map&v=2.10.2&x=1494&y=650&z=11 + return QString("http://%1").arg(server) + QString("0%2.maps.yandex.ru/tiles?l=map&v=%3&x=%4&y=%5&z=%6").arg(_getServerNum(pos, 4) + 1).arg(VersionYandexMap).arg(pos.x()).arg(pos.y()).arg(zoom); + } + break; + default: + qWarning("Unknown map id %d\n", type); + break; + } + return QString::null; +} + +void UrlFactory::_getSecGoogleWords(const QPoint &pos, QString &sec1, QString &sec2) +{ + sec1 = ""; // after &x=... + sec2 = ""; // after &zoom=... + int seclen = ((pos.x() * 3) + pos.y()) % 8; + sec2 = SecGoogleWord.left(seclen); + if (pos.y() >= 10000 && pos.y() < 100000) { + sec1 = "&s="; + } +} + +} diff --git a/libs/QtLocationQGC/src/OpenPilotMaps.h b/libs/QtLocationQGC/src/OpenPilotMaps.h new file mode 100644 index 0000000000000000000000000000000000000000..29cd060b1c90acc4b6cddae12adc762c92ca6046 --- /dev/null +++ b/libs/QtLocationQGC/src/OpenPilotMaps.h @@ -0,0 +1,156 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2015 QGROUNDCONTROL PROJECT + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +/** + * @file + * @brief QGC Open Pilot Mapping Tools + * @author Gus Grubba + * Original work: The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + */ + +#ifndef OPENPILOTTOOLS_H +#define OPENPILOTTOOLS_H + +#include +#include +#include +#include + +namespace OpenPilot { + +enum MapType +{ + GoogleMap = 1, + GoogleSatellite = 4, + GoogleLabels = 8, + GoogleTerrain = 16, + GoogleHybrid = 20, + + GoogleMapChina = 22, + GoogleSatelliteChina = 24, + GoogleLabelsChina = 26, + GoogleTerrainChina = 28, + GoogleHybridChina = 29, + + OpenStreetMap = 32, + OpenStreetOsm = 33, + OpenStreetMapSurfer = 34, + OpenStreetMapSurferTerrain=35, + + YahooMap = 64, + YahooSatellite = 128, + YahooLabels = 256, + YahooHybrid = 333, + + BingMap = 444, + BingSatellite = 555, + BingHybrid = 666, + + ArcGIS_Map = 777, + ArcGIS_Satellite = 788, + ArcGIS_ShadedRelief = 799, + ArcGIS_Terrain = 811, + + ArcGIS_MapsLT_Map = 1000, + ArcGIS_MapsLT_OrtoFoto = 1001, + ArcGIS_MapsLT_Map_Labels= 1002, + ArcGIS_MapsLT_Map_Hybrid= 1003, + + PergoTurkeyMap = 2001, + SigPacSpainMap = 3001, + + GoogleMapKorea = 4001, + GoogleSatelliteKorea = 4002, + GoogleLabelsKorea = 4003, + GoogleHybridKorea = 4005, + + YandexMapRu = 5000 +}; + +class ProviderStrings { +public: + ProviderStrings(); + static const QString levelsForSigPacSpainMap[]; + QString GoogleMapsAPIKey; + // Google version strings + QString VersionGoogleMap; + QString VersionGoogleSatellite; + QString VersionGoogleLabels; + QString VersionGoogleTerrain; + QString SecGoogleWord; + // Google (China) version strings + QString VersionGoogleMapChina; + QString VersionGoogleSatelliteChina; + QString VersionGoogleLabelsChina; + QString VersionGoogleTerrainChina; + // Google (Korea) version strings + QString VersionGoogleMapKorea; + QString VersionGoogleSatelliteKorea; + QString VersionGoogleLabelsKorea; + /// + /// Google Maps API generated using http://greatmaps.codeplex.com/ + /// from http://code.google.com/intl/en-us/apis/maps/signup.html + /// + // Yahoo version strings + QString VersionYahooMap; + QString VersionYahooSatellite; + QString VersionYahooLabels; + // BingMaps + QString VersionBingMaps; + // YandexMap + QString VersionYandexMap; + /// + /// Bing Maps Customer Identification, more info here + /// http://msdn.microsoft.com/en-us/library/bb924353.aspx + /// + QString BingMapsClientToken; +}; + +class UrlFactory : public QObject, public ProviderStrings { + Q_OBJECT +public: + QByteArray UserAgent; + QNetworkProxy Proxy; + + UrlFactory(); + ~UrlFactory(); + + QString makeImageUrl (const MapType &type, const QPoint &pos, const int &zoom, const QString &language); + +private: + void _getSecGoogleWords (const QPoint &pos, QString &sec1, QString &sec2); + int _getServerNum (const QPoint& pos, const int &max) const; + void _tryCorrectGoogleVersions (); + QString _tileXYToQuadKey (const int &tileX, const int &tileY, const int &levelOfDetail) const; + + bool _isCorrectedGoogleVersions; + bool _correctGoogleVersions; + int _timeout; + + QMutex mutex; + static const double EarthRadiusKm; +}; + +} + +#endif // FOO_H diff --git a/libs/QtLocationGoogle/src/qgeocodereplygoogle.cpp b/libs/QtLocationQGC/src/qgeocodereplyqgc.cpp similarity index 97% rename from libs/QtLocationGoogle/src/qgeocodereplygoogle.cpp rename to libs/QtLocationQGC/src/qgeocodereplyqgc.cpp index b7df5824e5be481a346fea374cbc3d13145f9e44..de948eeeae7f2652b58ccfb583590a68641a0c2a 100644 --- a/libs/QtLocationGoogle/src/qgeocodereplygoogle.cpp +++ b/libs/QtLocationQGC/src/qgeocodereplyqgc.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -53,7 +53,7 @@ #include #include -#include "qgeocodereplygoogle.h" +#include "qgeocodereplyqgc.h" QT_BEGIN_NAMESPACE @@ -156,7 +156,7 @@ QSet JasonMonger::json2QGeoCodeTypeGoogle(const QJsonArray &types) { JasonMonger kMonger; -QGeoCodeReplyGoogle::QGeoCodeReplyGoogle(QNetworkReply *reply, QObject *parent) +QGeoCodeReplyQGC::QGeoCodeReplyQGC(QNetworkReply *reply, QObject *parent) : QGeoCodeReply(parent), m_reply(reply) { connect(m_reply, SIGNAL(finished()), this, SLOT(networkReplyFinished())); @@ -167,13 +167,13 @@ QGeoCodeReplyGoogle::QGeoCodeReplyGoogle(QNetworkReply *reply, QObject *parent) setOffset(0); } -QGeoCodeReplyGoogle::~QGeoCodeReplyGoogle() +QGeoCodeReplyQGC::~QGeoCodeReplyQGC() { if (m_reply) m_reply->deleteLater(); } -void QGeoCodeReplyGoogle::abort() +void QGeoCodeReplyQGC::abort() { if (!m_reply) return; @@ -184,7 +184,7 @@ void QGeoCodeReplyGoogle::abort() m_reply = 0; } -void QGeoCodeReplyGoogle::networkReplyFinished() +void QGeoCodeReplyQGC::networkReplyFinished() { if (!m_reply) return; @@ -288,7 +288,7 @@ void QGeoCodeReplyGoogle::networkReplyFinished() m_reply = 0; } -void QGeoCodeReplyGoogle::networkReplyError(QNetworkReply::NetworkError error) +void QGeoCodeReplyQGC::networkReplyError(QNetworkReply::NetworkError error) { Q_UNUSED(error) if (!m_reply) diff --git a/libs/QtLocationGoogle/src/qgeocodereplygoogle.h b/libs/QtLocationQGC/src/qgeocodereplyqgc.h similarity index 91% rename from libs/QtLocationGoogle/src/qgeocodereplygoogle.h rename to libs/QtLocationQGC/src/qgeocodereplyqgc.h index 78167ac70c0d5e37909ec65a1981d2977f6651ab..1c4d483a99c579e3906ab14776db3e00d2a778ea 100644 --- a/libs/QtLocationGoogle/src/qgeocodereplygoogle.h +++ b/libs/QtLocationQGC/src/qgeocodereplyqgc.h @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -52,13 +52,13 @@ QT_BEGIN_NAMESPACE -class QGeoCodeReplyGoogle : public QGeoCodeReply +class QGeoCodeReplyQGC : public QGeoCodeReply { Q_OBJECT public: - explicit QGeoCodeReplyGoogle(QNetworkReply *reply, QObject *parent = 0); - ~QGeoCodeReplyGoogle(); + explicit QGeoCodeReplyQGC(QNetworkReply *reply, QObject *parent = 0); + ~QGeoCodeReplyQGC(); void abort(); diff --git a/libs/QtLocationGoogle/src/qgeocodingmanagerenginegoogle.cpp b/libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.cpp similarity index 86% rename from libs/QtLocationGoogle/src/qgeocodingmanagerenginegoogle.cpp rename to libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.cpp index 2c34042998bf24330706140d66befca519149bbf..568804309c0b08aa8df51040fa9b36362cbf1b9e 100644 --- a/libs/QtLocationGoogle/src/qgeocodingmanagerenginegoogle.cpp +++ b/libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -55,8 +55,8 @@ #include #include -#include "qgeocodingmanagerenginegoogle.h" -#include "qgeocodereplygoogle.h" +#include "qgeocodingmanagerengineqgc.h" +#include "qgeocodereplyqgc.h" QT_BEGIN_NAMESPACE @@ -77,7 +77,7 @@ static QString boundingBoxToLtrb(const QGeoRectangle &rect) QString::number(rect.bottomRight().latitude()); } -QGeoCodingManagerEngineGoogle::QGeoCodingManagerEngineGoogle( +QGeoCodingManagerEngineQGC::QGeoCodingManagerEngineQGC( const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) @@ -91,16 +91,16 @@ QGeoCodingManagerEngineGoogle::QGeoCodingManagerEngineGoogle( errorString->clear(); } -QGeoCodingManagerEngineGoogle::~QGeoCodingManagerEngineGoogle() +QGeoCodingManagerEngineQGC::~QGeoCodingManagerEngineQGC() { } -QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QGeoAddress &address, const QGeoShape &bounds) +QGeoCodeReply *QGeoCodingManagerEngineQGC::geocode(const QGeoAddress &address, const QGeoShape &bounds) { return geocode(addressToQuery(address), -1, -1, bounds); } -QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, int limit, int offset, const QGeoShape &bounds) +QGeoCodeReply *QGeoCodingManagerEngineQGC::geocode(const QString &address, int limit, int offset, const QGeoShape &bounds) { Q_UNUSED(limit); Q_UNUSED(offset); @@ -124,7 +124,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, in QNetworkReply *reply = m_networkManager->get(request); reply->setParent(0); - QGeoCodeReplyGoogle *geocodeReply = new QGeoCodeReplyGoogle(reply); + QGeoCodeReplyQGC *geocodeReply = new QGeoCodeReplyQGC(reply); connect(geocodeReply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(geocodeReply, SIGNAL(error(QGeoCodeReply::Error,QString)), @@ -133,7 +133,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::geocode(const QString &address, in return geocodeReply; } -QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinate &coordinate, const QGeoShape &bounds) +QGeoCodeReply *QGeoCodingManagerEngineQGC::reverseGeocode(const QGeoCoordinate &coordinate, const QGeoShape &bounds) { Q_UNUSED(bounds) @@ -155,7 +155,7 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinat QNetworkReply *reply = m_networkManager->get(request); reply->setParent(0); - QGeoCodeReplyGoogle *geocodeReply = new QGeoCodeReplyGoogle(reply); + QGeoCodeReplyQGC *geocodeReply = new QGeoCodeReplyQGC(reply); connect(geocodeReply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(geocodeReply, SIGNAL(error(QGeoCodeReply::Error,QString)), @@ -164,14 +164,14 @@ QGeoCodeReply *QGeoCodingManagerEngineGoogle::reverseGeocode(const QGeoCoordinat return geocodeReply; } -void QGeoCodingManagerEngineGoogle::replyFinished() +void QGeoCodingManagerEngineQGC::replyFinished() { QGeoCodeReply *reply = qobject_cast(sender()); if (reply) emit finished(reply); } -void QGeoCodingManagerEngineGoogle::replyError(QGeoCodeReply::Error errorCode, const QString &errorString) +void QGeoCodingManagerEngineQGC::replyError(QGeoCodeReply::Error errorCode, const QString &errorString) { QGeoCodeReply *reply = qobject_cast(sender()); if (reply) diff --git a/libs/QtLocationGoogle/src/qgeocodingmanagerenginegoogle.h b/libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.h similarity index 90% rename from libs/QtLocationGoogle/src/qgeocodingmanagerenginegoogle.h rename to libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.h index 2d9fed5a8338a56fd88e5d57189f6448587bf736..56040f4cdbf5eaf360573f10aed755c6cbe48023 100644 --- a/libs/QtLocationGoogle/src/qgeocodingmanagerenginegoogle.h +++ b/libs/QtLocationQGC/src/qgeocodingmanagerengineqgc.h @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -55,13 +55,13 @@ QT_BEGIN_NAMESPACE class QNetworkAccessManager; -class QGeoCodingManagerEngineGoogle : public QGeoCodingManagerEngine +class QGeoCodingManagerEngineQGC : public QGeoCodingManagerEngine { Q_OBJECT public: - QGeoCodingManagerEngineGoogle(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString); - ~QGeoCodingManagerEngineGoogle(); + QGeoCodingManagerEngineQGC(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString); + ~QGeoCodingManagerEngineQGC(); QGeoCodeReply* geocode (const QGeoAddress &address, const QGeoShape &bounds) Q_DECL_OVERRIDE; QGeoCodeReply* geocode (const QString &address, int limit, int offset, const QGeoShape &bounds) Q_DECL_OVERRIDE; diff --git a/libs/QtLocationGoogle/src/qgeomapreplygoogle.cpp b/libs/QtLocationQGC/src/qgeomapreplyqgc.cpp similarity index 73% rename from libs/QtLocationGoogle/src/qgeomapreplygoogle.cpp rename to libs/QtLocationQGC/src/qgeomapreplyqgc.cpp index 5fdda153d3c7fca9a822cbc63ee8d9e67b02477b..4c0d193840e59912a18dfddb71b367b20e4cf31e 100644 --- a/libs/QtLocationGoogle/src/qgeomapreplygoogle.cpp +++ b/libs/QtLocationQGC/src/qgeomapreplyqgc.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -46,9 +46,10 @@ #include -#include "qgeomapreplygoogle.h" +#include "qgeomapreplyqgc.h" +#include "OpenPilotMaps.h" -QGeoMapReplyGoogle::QGeoMapReplyGoogle(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent) +QGeoMapReplyQGC::QGeoMapReplyQGC(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent) : QGeoTiledMapReply(spec, parent) , m_reply(reply) { @@ -57,7 +58,7 @@ QGeoMapReplyGoogle::QGeoMapReplyGoogle(QNetworkReply *reply, const QGeoTileSpec connect(m_reply, SIGNAL(destroyed()), this, SLOT(replyDestroyed())); } -QGeoMapReplyGoogle::~QGeoMapReplyGoogle() +QGeoMapReplyQGC::~QGeoMapReplyQGC() { if (m_reply) { m_reply->deleteLater(); @@ -65,24 +66,24 @@ QGeoMapReplyGoogle::~QGeoMapReplyGoogle() } } -void QGeoMapReplyGoogle::abort() +void QGeoMapReplyQGC::abort() { if (!m_reply) return; m_reply->abort(); } -QNetworkReply *QGeoMapReplyGoogle::networkReply() const +QNetworkReply *QGeoMapReplyQGC::networkReply() const { return m_reply; } -void QGeoMapReplyGoogle::replyDestroyed() +void QGeoMapReplyQGC::replyDestroyed() { m_reply = 0; } -void QGeoMapReplyGoogle::networkReplyFinished() +void QGeoMapReplyQGC::networkReplyFinished() { if (!m_reply) return; @@ -90,24 +91,39 @@ void QGeoMapReplyGoogle::networkReplyFinished() if (m_reply->error() != QNetworkReply::NoError) return; + // qDebug() << "Map OK: " << m_reply->url().toString(); QByteArray a = m_reply->readAll(); setMapImageData(a); - if(tileSpec().mapId() > 0 && tileSpec().mapId() < 5) - setMapImageFormat("png"); - else - qWarning("Unknown map id %d", tileSpec().mapId()); + switch ((OpenPilot::MapType)tileSpec().mapId()) { + case OpenPilot::GoogleMap: + case OpenPilot::GoogleSatellite: + case OpenPilot::GoogleLabels: + case OpenPilot::GoogleTerrain: + case OpenPilot::GoogleHybrid: + case OpenPilot::BingMap: + setMapImageFormat("png"); + break; + case OpenPilot::BingSatellite: + setMapImageFormat("jpeg"); + break; + default: + qWarning("Unknown map id %d", tileSpec().mapId()); + break; + } setFinished(true); m_reply->deleteLater(); m_reply = 0; } -void QGeoMapReplyGoogle::networkReplyError(QNetworkReply::NetworkError error) +void QGeoMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error) { if (!m_reply) return; + // qDebug() << "Map error: " << m_reply->url().toString(); + if (error != QNetworkReply::OperationCanceledError) setError(QGeoTiledMapReply::CommunicationError, m_reply->errorString()); diff --git a/libs/QtLocationGoogle/src/qgeomapreplygoogle.h b/libs/QtLocationQGC/src/qgeomapreplyqgc.h similarity index 91% rename from libs/QtLocationGoogle/src/qgeomapreplygoogle.h rename to libs/QtLocationQGC/src/qgeomapreplyqgc.h index 9077387a410fc1af0e9011eaef8b645ec763c09e..33364ee398aa2728a21776a07d7b38c708520f95 100644 --- a/libs/QtLocationGoogle/src/qgeomapreplygoogle.h +++ b/libs/QtLocationQGC/src/qgeomapreplyqgc.h @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -52,13 +52,13 @@ QT_BEGIN_NAMESPACE -class QGeoMapReplyGoogle : public QGeoTiledMapReply +class QGeoMapReplyQGC : public QGeoTiledMapReply { Q_OBJECT public: - explicit QGeoMapReplyGoogle(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent = 0); - ~QGeoMapReplyGoogle(); + explicit QGeoMapReplyQGC(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent = 0); + ~QGeoMapReplyQGC(); void abort(); diff --git a/libs/QtLocationGoogle/src/qgeoserviceproviderplugingoogle.cpp b/libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.cpp similarity index 78% rename from libs/QtLocationGoogle/src/qgeoserviceproviderplugingoogle.cpp rename to libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.cpp index 9afa3629bcdf51f287840bc669eea0026d3cf0e4..19aacae51107c07864340b2dc1cfec9b5e6f2971 100644 --- a/libs/QtLocationGoogle/src/qgeoserviceproviderplugingoogle.cpp +++ b/libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -47,32 +47,32 @@ #include #include "qdebug.h" -#include "qgeoserviceproviderplugingoogle.h" -#include "qgeotiledmappingmanagerenginegoogle.h" -#include "qgeocodingmanagerenginegoogle.h" +#include "qgeoserviceproviderpluginqgc.h" +#include "qgeotiledmappingmanagerengineqgc.h" +#include "qgeocodingmanagerengineqgc.h" QT_BEGIN_NAMESPACE -QGeoCodingManagerEngine *QGeoServiceProviderFactoryGoogle::createGeocodingManagerEngine( +QGeoCodingManagerEngine *QGeoServiceProviderFactoryQGC::createGeocodingManagerEngine( const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { - return new QGeoCodingManagerEngineGoogle(parameters, error, errorString); + return new QGeoCodingManagerEngineQGC(parameters, error, errorString); } -QGeoMappingManagerEngine *QGeoServiceProviderFactoryGoogle::createMappingManagerEngine( +QGeoMappingManagerEngine *QGeoServiceProviderFactoryQGC::createMappingManagerEngine( const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { - return new QGeoTiledMappingManagerEngineGoogle(parameters, error, errorString); + return new QGeoTiledMappingManagerEngineQGC(parameters, error, errorString); } -QGeoRoutingManagerEngine *QGeoServiceProviderFactoryGoogle::createRoutingManagerEngine( +QGeoRoutingManagerEngine *QGeoServiceProviderFactoryQGC::createRoutingManagerEngine( const QVariantMap &, QGeoServiceProvider::Error *, QString *) const { // Not implemented for QGC return NULL; } -QPlaceManagerEngine *QGeoServiceProviderFactoryGoogle::createPlaceManagerEngine( +QPlaceManagerEngine *QGeoServiceProviderFactoryQGC::createPlaceManagerEngine( const QVariantMap &, QGeoServiceProvider::Error *, QString *) const { // Not implemented for QGC diff --git a/libs/QtLocationGoogle/src/qgeoserviceproviderplugingoogle.h b/libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.h similarity index 93% rename from libs/QtLocationGoogle/src/qgeoserviceproviderplugingoogle.h rename to libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.h index cbf5a587909b8ca1ee6fc5cb508ba82a3e069971..b4548dc37c9822a76800d1b2bf04e0e7d17b7db3 100644 --- a/libs/QtLocationGoogle/src/qgeoserviceproviderplugingoogle.h +++ b/libs/QtLocationQGC/src/qgeoserviceproviderpluginqgc.h @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -52,11 +52,11 @@ QT_BEGIN_NAMESPACE -class QGeoServiceProviderFactoryGoogle: public QObject, public QGeoServiceProviderFactory +class QGeoServiceProviderFactoryQGC: public QObject, public QGeoServiceProviderFactory { Q_OBJECT Q_INTERFACES(QGeoServiceProviderFactory) - Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0" FILE "google_maps_plugin.json") + Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0" FILE "qgc_maps_plugin.json") public: QGeoCodingManagerEngine* createGeocodingManagerEngine(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const; diff --git a/libs/QtLocationGoogle/src/qgeotiledmappingmanagerenginegoogle.cpp b/libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.cpp similarity index 78% rename from libs/QtLocationGoogle/src/qgeotiledmappingmanagerenginegoogle.cpp rename to libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.cpp index ffb687fc3ffc38db88ae0a642f6294006c1ed49d..7f9d81531b4b6cd8fe180a546071aad46238adb3 100644 --- a/libs/QtLocationGoogle/src/qgeotiledmappingmanagerenginegoogle.cpp +++ b/libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -50,12 +50,13 @@ #include #include -#include "qgeotiledmappingmanagerenginegoogle.h" -#include "qgeotilefetchergoogle.h" +#include "qgeotiledmappingmanagerengineqgc.h" +#include "qgeotilefetcherqgc.h" +#include "OpenPilotMaps.h" QT_BEGIN_NAMESPACE -QGeoTiledMappingManagerEngineGoogle::QGeoTiledMappingManagerEngineGoogle(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) +QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) : QGeoTiledMappingManagerEngine() { QGeoCameraCapabilities cameraCaps; @@ -66,19 +67,24 @@ QGeoTiledMappingManagerEngineGoogle::QGeoTiledMappingManagerEngineGoogle(const Q setTileSize(QSize(256, 256)); QList mapTypes; - mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("Street Map"), tr("Google street map"), false, false, 1); - mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite Map"),tr("Google satellite map"), false, false, 2); - mapTypes << QGeoMapType(QGeoMapType::TerrainMap, tr("Terrain Map"), tr("Google terrain map"), false, false, 3); - // mapTypes << QGeoMapType(QGeoMapType::HybridMap, tr("Hybrid Map"), tr("Google hybrid map"), false, false, 4); + mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("Google Street Map"), tr("Google street map"), false, false, OpenPilot::GoogleMap); + mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Google Satellite Map"),tr("Google satellite map"), false, false, OpenPilot::GoogleSatellite); + mapTypes << QGeoMapType(QGeoMapType::TerrainMap, tr("Google Terrain Map"), tr("Google terrain map"), false, false, OpenPilot::GoogleTerrain); + // TODO: + // Proper hybrid maps requires collecting two separate bimaps and overlaying them. + //mapTypes << QGeoMapType(QGeoMapType::HybridMap, tr("Google Hybrid Map"), tr("Google hybrid map"), false, false, OpenPilot::GoogleHybrid); + // Bing + mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("Bing Street Map"), tr("Bing street map"), false, false, OpenPilot::BingMap); + mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Bing Satellite Map"), tr("Bing satellite map"), false, false, OpenPilot::BingSatellite); setSupportedMapTypes(mapTypes); - QGeoTileFetcherGoogle *tileFetcher = new QGeoTileFetcherGoogle(this); + QGeoTileFetcherQGC *tileFetcher = new QGeoTileFetcherQGC(this); if (parameters.contains(QStringLiteral("useragent"))) { const QByteArray ua = parameters.value(QStringLiteral("useragent")).toString().toLatin1(); tileFetcher->setUserAgent(ua); } else // QGC Default - tileFetcher->setUserAgent("qgroundcontrol.org"); + tileFetcher->setUserAgent("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"); setTileFetcher(tileFetcher); @@ -146,11 +152,11 @@ QGeoTiledMappingManagerEngineGoogle::QGeoTiledMappingManagerEngineGoogle(const Q errorString->clear(); } -QGeoTiledMappingManagerEngineGoogle::~QGeoTiledMappingManagerEngineGoogle() +QGeoTiledMappingManagerEngineQGC::~QGeoTiledMappingManagerEngineQGC() { } -QGeoMapData *QGeoTiledMappingManagerEngineGoogle::createMapData() +QGeoMapData *QGeoTiledMappingManagerEngineQGC::createMapData() { return new QGeoTiledMapData(this, 0); } diff --git a/libs/QtLocationGoogle/src/qgeotiledmappingmanagerenginegoogle.h b/libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.h similarity index 88% rename from libs/QtLocationGoogle/src/qgeotiledmappingmanagerenginegoogle.h rename to libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.h index 3fe982fcc12eb53a504b623c2c558a6adf65361a..7e07bd996b81e547603e422dc792f35986de4514 100644 --- a/libs/QtLocationGoogle/src/qgeotiledmappingmanagerenginegoogle.h +++ b/libs/QtLocationQGC/src/qgeotiledmappingmanagerengineqgc.h @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE -class QGeoTiledMappingManagerEngineGoogle : public QGeoTiledMappingManagerEngine +class QGeoTiledMappingManagerEngineQGC : public QGeoTiledMappingManagerEngine { Q_OBJECT public: - QGeoTiledMappingManagerEngineGoogle(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString); - ~QGeoTiledMappingManagerEngineGoogle(); + QGeoTiledMappingManagerEngineQGC(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString); + ~QGeoTiledMappingManagerEngineQGC(); QGeoMapData *createMapData(); }; diff --git a/libs/QtLocationGoogle/src/qgeotilefetchergoogle.cpp b/libs/QtLocationQGC/src/qgeotilefetcherqgc.cpp similarity index 51% rename from libs/QtLocationGoogle/src/qgeotilefetchergoogle.cpp rename to libs/QtLocationQGC/src/qgeotilefetcherqgc.cpp index a2566c6b1f57202cfaa65e3bcf1156f96777f406..ab9d8ffa74298d322ce4ffc8cc14d455a0e95cdd 100644 --- a/libs/QtLocationGoogle/src/qgeotilefetchergoogle.cpp +++ b/libs/QtLocationQGC/src/qgeotilefetcherqgc.cpp @@ -38,71 +38,115 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** ****************************************************************************/ -#include "qgeotilefetchergoogle.h" -#include "qgeomapreplygoogle.h" - #include #include #include #include +#include "qgeotilefetcherqgc.h" +#include "qgeomapreplyqgc.h" + QT_BEGIN_NAMESPACE -QGeoTileFetcherGoogle::QGeoTileFetcherGoogle(QGeoTiledMappingManagerEngine *parent) +QGeoTileFetcherQGC::QGeoTileFetcherQGC(QGeoTiledMappingManagerEngine *parent) : QGeoTileFetcher(parent) , m_networkManager(new QNetworkAccessManager(this)) , m_userAgent("Qt Application") { + QStringList langs = QLocale::system().uiLanguages(); + if (langs.length() > 0) { + m_Language = langs[0]; + } } -void QGeoTileFetcherGoogle::setUserAgent(const QByteArray &userAgent) +void QGeoTileFetcherQGC::setUserAgent(const QByteArray &userAgent) { m_userAgent = userAgent; } -QGeoTiledMapReply *QGeoTileFetcherGoogle::getTileImage(const QGeoTileSpec &spec) +QGeoTiledMapReply *QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec) { QNetworkRequest request; - request.setRawHeader("User-Agent", m_userAgent); - - QString url; - if (spec.mapId() == 1) { - url = QStringLiteral("http://mt1.google.com/vt/lyrs=m"); - } else if (spec.mapId() == 2) { - url = QStringLiteral("http://mt1.google.com/vt/lyrs=s"); - } else if (spec.mapId() == 3) { - url = QStringLiteral("http://mt1.google.com/vt/lyrs=p"); - } else if (spec.mapId() == 4) { - url = QStringLiteral(" http://mt1.google.com/vt/lyrs=h"); - } else { - qWarning("Unknown map id %d\n", spec.mapId()); - url = QStringLiteral("http://mt1.google.com/vt/lyrs=m"); - } + QString url = m_UrlFactory.makeImageUrl((OpenPilot::MapType)spec.mapId(), QPoint(spec.x(), spec.y()), spec.zoom(), m_Language); - url += QStringLiteral("&x=%1&y=%2&z=%3") - .arg(spec.x()) - .arg(spec.y()) - .arg(spec.zoom()); + // qDebug() << "Request x" << spec.x() << "y" << spec.y() << "URL:" << url; - QStringList langs = QLocale::system().uiLanguages(); - if (langs.length() > 0) { - url += QStringLiteral("&hl=%1").arg(langs[0]); + request.setUrl(QUrl(url)); + request.setRawHeader("User-Agent", m_userAgent); + request.setRawHeader("Accept", "*/*"); + switch ((OpenPilot::MapType)spec.mapId()) { + case OpenPilot::GoogleMap: + case OpenPilot::GoogleSatellite: + case OpenPilot::GoogleLabels: + case OpenPilot::GoogleTerrain: + case OpenPilot::GoogleHybrid: + { + request.setRawHeader("Referrer", "http://maps.google.com/"); + } + break; + case OpenPilot::GoogleMapChina: + case OpenPilot::GoogleSatelliteChina: + case OpenPilot::GoogleLabelsChina: + case OpenPilot::GoogleTerrainChina: + case OpenPilot::GoogleHybridChina: + { + request.setRawHeader("Referrer", "http://ditu.google.cn/"); + } + break; + case OpenPilot::BingHybrid: + case OpenPilot::BingMap: + case OpenPilot::BingSatellite: + { + request.setRawHeader("Referrer", "http://www.bing.com/maps/"); + } + break; + case OpenPilot::YahooHybrid: + case OpenPilot::YahooLabels: + case OpenPilot::YahooMap: + case OpenPilot::YahooSatellite: + { + request.setRawHeader("Referrer", "http://maps.yahoo.com/"); + } + break; + case OpenPilot::ArcGIS_MapsLT_Map_Labels: + case OpenPilot::ArcGIS_MapsLT_Map: + case OpenPilot::ArcGIS_MapsLT_OrtoFoto: + case OpenPilot::ArcGIS_MapsLT_Map_Hybrid: + { + request.setRawHeader("Referrer", "http://www.maps.lt/map_beta/"); + } + break; + case OpenPilot::OpenStreetMapSurfer: + case OpenPilot::OpenStreetMapSurferTerrain: + { + request.setRawHeader("Referrer", "http://www.mapsurfer.net/"); + } + break; + case OpenPilot::OpenStreetMap: + case OpenPilot::OpenStreetOsm: + { + request.setRawHeader("Referrer", "http://www.openstreetmap.org/"); + } + break; + case OpenPilot::YandexMapRu: + { + request.setRawHeader("Referrer", "http://maps.yandex.ru/"); + } + break; + default: + break; } - - url += QStringLiteral("&scale=2"); - QUrl qurl(url); - request.setUrl(qurl); QNetworkReply *reply = m_networkManager->get(request); reply->setParent(0); + return new QGeoMapReplyQGC(reply, spec); - return new QGeoMapReplyGoogle(reply, spec); } QT_END_NAMESPACE diff --git a/libs/QtLocationGoogle/src/qgeotilefetchergoogle.h b/libs/QtLocationQGC/src/qgeotilefetcherqgc.h similarity index 87% rename from libs/QtLocationGoogle/src/qgeotilefetchergoogle.h rename to libs/QtLocationQGC/src/qgeotilefetcherqgc.h index fe81e788153176a26ada6206b9d6fc4e5e45e17c..98094b93ce2daa9296cc619351267cf2ca034663 100644 --- a/libs/QtLocationGoogle/src/qgeotilefetchergoogle.h +++ b/libs/QtLocationQGC/src/qgeotilefetcherqgc.h @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ** 2015.4.4 -** Adapted for google maps with the intent of use for QGroundControl +** Adapted for use with QGroundControl ** ** Gus Grubba ** @@ -49,25 +49,28 @@ #include #include +#include "OpenPilotMaps.h" QT_BEGIN_NAMESPACE class QGeoTiledMappingManagerEngine; class QNetworkAccessManager; -class QGeoTileFetcherGoogle : public QGeoTileFetcher +class QGeoTileFetcherQGC : public QGeoTileFetcher { Q_OBJECT public: - explicit QGeoTileFetcherGoogle(QGeoTiledMappingManagerEngine *parent = 0); + explicit QGeoTileFetcherQGC(QGeoTiledMappingManagerEngine *parent = 0); void setUserAgent(const QByteArray &userAgent); private: QGeoTiledMapReply* getTileImage(const QGeoTileSpec &spec); - QNetworkAccessManager *m_networkManager; - QByteArray m_userAgent; + QNetworkAccessManager* m_networkManager; + QByteArray m_userAgent; + OpenPilot::UrlFactory m_UrlFactory; + QString m_Language; }; QT_END_NAMESPACE diff --git a/qgcsystem.pro b/qgcsystem.pro index 073470261d3dbafc1505397e6a44afc5aaf8aba6..e144e776b7be72d815f11ebf5419562400edcda9 100644 --- a/qgcsystem.pro +++ b/qgcsystem.pro @@ -109,34 +109,34 @@ LANGUAGE = C++ message(BASEDIR $$BASEDIR DESTDIR $$DESTDIR TARGET $$TARGET) -# Google Maps QtLocation +# QGC QtLocation -GOOGLEDIR = $${OUT_PWD}/libs/QtLocationGoogle/plugins/geoservices +QGCMAPDIR = $${OUT_PWD}/libs/QtLocationQGC/plugins/geoservices LinuxBuild { - LIBS += -L$$GOOGLEDIR -lqtgeoservices_google - PRE_TARGETDEPS += $$GOOGLEDIR/libqtgeoservices_google.a + LIBS += -L$$QGCMAPDIR -lqtgeoservices_qgc + PRE_TARGETDEPS += $$QGCMAPDIR/libqtgeoservices_qgc.a } WindowsBuild { DebugBuild { - LIBS += -L$$GOOGLEDIR -lqtgeoservices_googled - PRE_TARGETDEPS += $$GOOGLEDIR/qtgeoservices_googled.lib + LIBS += -L$$QGCMAPDIR -lqtgeoservices_qgcd + PRE_TARGETDEPS += $$QGCMAPDIR/qtgeoservices_qgcd.lib } ReleaseBuild { - LIBS += -L$$GOOGLEDIR -lqtgeoservices_google - PRE_TARGETDEPS += $$GOOGLEDIR/qtgeoservices_google.lib + LIBS += -L$$QGCMAPDIR -lqtgeoservices_qgc + PRE_TARGETDEPS += $$QGCMAPDIR/qtgeoservices_qgc.lib } } MacBuild { DebugBuild { - LIBS += -L$$GOOGLEDIR -lqtgeoservices_google_debug - PRE_TARGETDEPS += $$GOOGLEDIR/libqtgeoservices_google_debug.a + LIBS += -L$$QGCMAPDIR -lqtgeoservices_qgc_debug + PRE_TARGETDEPS += $$QGCMAPDIR/libqtgeoservices_qgc_debug.a } ReleaseBuild { - LIBS += -L$$GOOGLEDIR -lqtgeoservices_google - PRE_TARGETDEPS += $$GOOGLEDIR/libqtgeoservices_google.a + LIBS += -L$$QGCMAPDIR -lqtgeoservices_qgc + PRE_TARGETDEPS += $$QGCMAPDIR/libqtgeoservices_qgc.a } } diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index ed6f355e79d83ceff486fa844a8614f7896ea8e7..aad09965edecdd0b0dcc7d0a0e6caa73d46e9607 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -19,8 +19,8 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = libs/QtLocationGoogle +SUBDIRS = libs/QtLocationQGC SUBDIRS += ./qgcsystem.pro -qgcsystem.depends = QtLocationGoogle +qgcsystem.depends = QtLocationQGC diff --git a/src/main.cc b/src/main.cc index a348b32dee529ed160635bfee0dec621a1a77cdb..0f1615dec9eeea202e1c3e826c96cb888c2659ec 100644 --- a/src/main.cc +++ b/src/main.cc @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) #pragma warning( disable : 4930 4101 ) #endif - Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGoogle) + Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryQGC) bool runUnitTests = false; // Run unit tests diff --git a/src/ui/flightdisplay/components/QGCMapBackground.qml b/src/ui/flightdisplay/components/QGCMapBackground.qml index 9d6403125b0f5c422334956d7bd3987478ed9300..13231740c5c535c868801b0ec4f72355503804e4 100644 --- a/src/ui/flightdisplay/components/QGCMapBackground.qml +++ b/src/ui/flightdisplay/components/QGCMapBackground.qml @@ -62,7 +62,7 @@ Rectangle { Plugin { id: mapPlugin - name: "google" + name: "QGroundControl" } Map {