From 9dcd6990d3032e06d321394366bdd99554d2fd4a Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 3 May 2015 23:13:53 +0200 Subject: [PATCH 01/15] OP-1874 - Add notification for Critical alarms, add Attitude, modify alarm repetition rates. reduce rate for Magnetometer, Receiver. Include Attitude. --- flight/modules/Notify/inc/sequences.h | 24 +++++++++++++++++++++--- flight/modules/Notify/notify.c | 10 ++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/flight/modules/Notify/inc/sequences.h b/flight/modules/Notify/inc/sequences.h index c8b8dca75..3d2d34327 100644 --- a/flight/modules/Notify/inc/sequences.h +++ b/flight/modules/Notify/inc/sequences.h @@ -52,7 +52,8 @@ typedef enum { NOTIFY_SEQUENCE_ALM_CONFIG = 17, NOTIFY_SEQUENCE_ALM_RECEIVER = 18, NOTIFY_SEQUENCE_DISARMED = 19, - NOTIFY_SEQUENCE_NULL = 255, // skips any signalling for this condition + NOTIFY_SEQUENCE_ALM_ATTITUDE = 20, + NOTIFY_SEQUENCE_NULL = 255, // skips any signalling for this condition } NotifySequences; // This structure determine sequences attached to an alarm @@ -60,6 +61,7 @@ typedef struct { uint32_t timeBetweenNotifications; // time in milliseconds to wait between each notification iteration uint8_t alarmIndex; // Index of the alarm, use one of the SYSTEMALARMS_ALARM_XXXXX defines uint8_t warnNotification; // index of the sequence to be used when alarm is in warning status(pick one from NotifySequences enum) + uint8_t criticalNotification; // index of the sequence to be used when alarm is in critical status(pick one from NotifySequences enum) uint8_t errorNotification; // index of the sequence to be used when alarm is in error status(pick one from NotifySequences enum) } AlarmDefinition_t; @@ -156,6 +158,10 @@ const LedSequence_t notifications[] = { { .time_off = 50, .time_on = 50, .color = COLOR_ORANGE, .repeats = 9, }, { .time_off = 500, .time_on = 50, .color = COLOR_ORANGE, .repeats = 1, }, }, }, + [NOTIFY_SEQUENCE_ALM_ATTITUDE] = { .repeats = 10, .steps = { + { .time_off = 0, .time_on = 50, .color = COLOR_RED, .repeats = 1, }, + { .time_off = 0, .time_on = 50, .color = COLOR_BLUE, .repeats = 1, }, + }, }, }; // List of background sequences attached to each flight mode @@ -185,32 +191,44 @@ const AlarmDefinition_t alarmsMap[] = { .timeBetweenNotifications = 10000, .alarmIndex = SYSTEMALARMS_ALARM_GPS, .warnNotification = NOTIFY_SEQUENCE_ALM_WARN_GPS, + .criticalNotification = NOTIFY_SEQUENCE_ALM_ERROR_GPS, .errorNotification = NOTIFY_SEQUENCE_ALM_ERROR_GPS, }, { - .timeBetweenNotifications = 15000, + .timeBetweenNotifications = 5000, .alarmIndex = SYSTEMALARMS_ALARM_MAGNETOMETER, .warnNotification = NOTIFY_SEQUENCE_NULL, + .criticalNotification = NOTIFY_SEQUENCE_ALM_MAG, .errorNotification = NOTIFY_SEQUENCE_ALM_MAG, }, { .timeBetweenNotifications = 15000, .alarmIndex = SYSTEMALARMS_ALARM_BATTERY, .warnNotification = NOTIFY_SEQUENCE_ALM_WARN_BATTERY, + .criticalNotification = NOTIFY_SEQUENCE_ALM_ERROR_BATTERY, .errorNotification = NOTIFY_SEQUENCE_ALM_ERROR_BATTERY, }, { .timeBetweenNotifications = 5000, .alarmIndex = SYSTEMALARMS_ALARM_SYSTEMCONFIGURATION, .warnNotification = NOTIFY_SEQUENCE_NULL, + .criticalNotification = NOTIFY_SEQUENCE_ALM_CONFIG, .errorNotification = NOTIFY_SEQUENCE_ALM_CONFIG, }, { - .timeBetweenNotifications = 5000, + .timeBetweenNotifications = 2000, .alarmIndex = SYSTEMALARMS_ALARM_RECEIVER, .warnNotification = NOTIFY_SEQUENCE_ALM_RECEIVER, + .criticalNotification = NOTIFY_SEQUENCE_ALM_RECEIVER, .errorNotification = NOTIFY_SEQUENCE_ALM_RECEIVER, }, + { + .timeBetweenNotifications = 1000, + .alarmIndex = SYSTEMALARMS_ALARM_ATTITUDE, + .warnNotification = NOTIFY_SEQUENCE_ALM_ATTITUDE, + .criticalNotification = NOTIFY_SEQUENCE_NULL, + .errorNotification = NOTIFY_SEQUENCE_ALM_ATTITUDE, + }, }; const uint8_t alarmsMapSize = NELEMENTS(alarmsMap); diff --git a/flight/modules/Notify/notify.c b/flight/modules/Notify/notify.c index aeb7526bf..ef6aee552 100644 --- a/flight/modules/Notify/notify.c +++ b/flight/modules/Notify/notify.c @@ -49,7 +49,7 @@ typedef struct { static void updatedCb(UAVObjEvent *ev); static void onTimerCb(UAVObjEvent *ev); static void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_time, - uint8_t warn_sequence, uint8_t error_sequence, + uint8_t warn_sequence, uint8_t critical_sequence, uint8_t error_sequence, uint32_t timeBetweenNotifications); static AlarmStatus_t *alarmStatus; int32_t NotifyInitialize(void) @@ -111,17 +111,19 @@ void onTimerCb(__attribute__((unused)) UAVObjEvent *ev) &alarmStatus[i].lastAlarm, &alarmStatus[i].lastAlarmTime, alarmsMap[i].warnNotification, + alarmsMap[i].criticalNotification, alarmsMap[i].errorNotification, alarmsMap[i].timeBetweenNotifications); } } -void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_time, uint8_t warn_sequence, uint8_t error_sequence, uint32_t timeBetweenNotifications) +void checkAlarm(uint8_t alarm, uint8_t *last_alarm, uint32_t *last_alm_time, uint8_t warn_sequence, uint8_t critical_sequence, uint8_t error_sequence, uint32_t timeBetweenNotifications) { if (alarm > SYSTEMALARMS_ALARM_OK) { uint32_t current_time = PIOS_DELAY_GetuS(); - if (*last_alarm < alarm || *last_alm_time + timeBetweenNotifications * 1000 < current_time) { - uint8_t sequence = (alarm == SYSTEMALARMS_ALARM_WARNING) ? warn_sequence : error_sequence; + if (*last_alarm < alarm || *last_alm_time + timeBetweenNotifications * 1000 > current_time) { + uint8_t sequence = (alarm == SYSTEMALARMS_ALARM_WARNING) ? warn_sequence : + ((alarm == SYSTEMALARMS_ALARM_CRITICAL) ? critical_sequence : error_sequence); if (sequence != NOTIFY_SEQUENCE_NULL) { PIOS_NOTIFICATION_Default_Ext_Led_Play( ¬ifications[sequence], From 3eef68c017ba83e396af57a5adbf2da5277707f8 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 18 May 2015 00:19:53 +0200 Subject: [PATCH 02/15] OP-1893 Deadband scale --- flight/modules/Receiver/receiver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flight/modules/Receiver/receiver.c b/flight/modules/Receiver/receiver.c index 9772d393e..95eed3223 100644 --- a/flight/modules/Receiver/receiver.c +++ b/flight/modules/Receiver/receiver.c @@ -795,9 +795,9 @@ static void applyDeadband(float *value, float deadband) if (fabsf(*value) < deadband) { *value = 0.0f; } else if (*value > 0.0f) { - *value -= deadband; + *value = (*value - deadband) / (1.0f - deadband); } else { - *value += deadband; + *value = (*value + deadband) / (1.0f - deadband); } } From 01a00ccafd6a632386acf94c9ccd99b93a189c33 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Wed, 13 May 2015 10:35:46 -0400 Subject: [PATCH 03/15] Continue debugging troublesome maps... remove the Dragons from the map!!! https://progress.openpilot.org/browse/OP-392 was more annoying than useful. Attempt to change HTTP request method to debug failed tile downloads. --- .../libs/opmapcontrol/src/core/debugheader.h | 16 +++---- .../src/libs/opmapcontrol/src/core/opmaps.cpp | 48 ++++++++++--------- .../libs/opmapcontrol/src/core/urlfactory.cpp | 11 +++-- .../src/mapwidget/mapgraphicitem.cpp | 6 +-- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h index d4590fb59..893ba7350 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h @@ -1,13 +1,13 @@ #ifndef DEBUGHEADER_H #define DEBUGHEADER_H -// #define DEBUG_MEMORY_CACHE -// #define DEBUG_CACHE -// #define DEBUG_GMAPS -// #define DEBUG_PUREIMAGECACHE -// #define DEBUG_TILECACHEQUEUE + #define DEBUG_MEMORY_CACHE + #define DEBUG_CACHE + #define DEBUG_GMAPS + #define DEBUG_PUREIMAGECACHE + #define DEBUG_TILECACHEQUEUE // #define DEBUG_URLFACTORY -// #define DEBUG_MEMORY_CACHE -// #define DEBUG_GetGeocoderFromCache - + #define DEBUG_MEMORY_CACHE + #define DEBUG_GetGeocoderFromCache + #define DEBUG_TIMINGS #endif // DEBUGHEADER_H diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index a39cf8b01..648615ff9 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -100,15 +100,9 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co } } if (accessmode != AccessMode::CacheOnly) { - QEventLoop q; QNetworkReply *reply; QNetworkRequest qheader; QNetworkAccessManager network; - QTimer tT; - tT.setSingleShot(true); - connect(&network, SIGNAL(finished(QNetworkReply *)), - &q, SLOT(quit())); - connect(&tT, SIGNAL(timeout()), &q, SLOT(quit())); network.setProxy(Proxy); #ifdef DEBUG_GMAPS qDebug() << "Try Tile from the Internet"; @@ -145,6 +139,14 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co } break; + case MapType::GoogleMapKorea: + case MapType::GoogleSatelliteKorea: + case MapType::GoogleLabelsKorea: + { + qheader.setRawHeader("Referrer", "http://maps.google.co.kr/"); + } + break; + case MapType::BingHybrid: case MapType::BingMap: case MapType::BingSatellite: @@ -184,26 +186,28 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co default: break; } + qDebug() << "Timeout is " << Timeout; reply = network.get(qheader); - tT.start(Timeout); - q.exec(); + qDebug() << "reply " << reply; - if (!tT.isActive()) { - errorvars.lock(); - ++diag.timeouts; - errorvars.unlock(); - return ret; - } - tT.stop(); - if ((reply->error() != QNetworkReply::NoError)) { - errorvars.lock(); - ++diag.networkerrors; - errorvars.unlock(); - reply->deleteLater(); - return ret; - } + QTime time; + while ((!(reply->isFinished()) || (time.elapsed() > (6 * Timeout)))) { + QCoreApplication::processEvents(QEventLoop::AllEvents); + } + + qDebug() << "Finished?" << reply->error() << " abort?" << (time.elapsed() > Timeout * 6); + + if ((reply->error() != QNetworkReply::NoError) | (time.elapsed() > Timeout * 6)) { + return ret; + } + else + { + qDebug() << "QNetworkReply Errors!"; + } ret = reply->readAll(); + qDebug() << "ret " << ret; reply->deleteLater(); // TODO can't this be global?? + if (ret.isEmpty()) { #ifdef DEBUG_GMAPS qDebug() << "Invalid Tile"; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index a0ebd84d6..569a79e24 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -320,6 +320,7 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c TryCorrectGoogleVersions(); // http://khm1.google.co.kr/kh/v=54&x=109&y=49&z=7&s= + qDebug() << 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); 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; @@ -331,9 +332,10 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c 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 + // https://mts1.google.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); + qDebug() << QString("https://%1%2.google.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); + return QString("https://%1%2.google.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; // *.yimg.com has been depreciated. "Here" is what Yahoo uses now. https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/request-constructing.html @@ -468,14 +470,15 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c y.insert(3, "/").insert(7, "/"); // "http://map03.pergo.com.tr/tile/2/000/000/003/000/000/002.png" // This has changed map03 does not exist. (neither does map3) Servers have changed to map1 and map2? + qDebug() << 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); 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 MapType::SigPacSpainMap: { // http://sigpac.magrama.es/fega/h5visor/ is new server location - qDebug() << 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); - return QString("http://sigpac.magrama.es/SDG/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); + qDebug() << QString("http://sigpac.magrama.es/SDG/raster/MTN2000@3785/%2.%3.%4.img").arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); + return QString("http://sigpac.magrama.es/SDG/raster/MTN2000@3785/%2.%3.%4.img").arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); } break; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp index cc338fc75..78781d580 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp @@ -34,8 +34,8 @@ namespace mapcontrol { MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration) : core(core), config(configuration), MapRenderTransform(1), maxZoom(17), minZoom(2), zoomReal(0), zoomDigi(0), isSelected(false), rotation(0) { - dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg")); - showTileGridLines = false; + //dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg")); + showTileGridLines = true; isMouseOverMarker = false; maprect = QRectF(0, 0, 1022, 680); core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); @@ -296,7 +296,7 @@ void MapGraphicItem::wheelEvent(QGraphicsSceneWheelEvent *event) } void MapGraphicItem::DrawMap2D(QPainter *painter) { - painter->drawImage(this->boundingRect(), dragons.toImage()); + //painter->drawImage(this->boundingRect(), dragons.toImage()); if (!lastimage.isNull()) { painter->drawImage(core->GetrenderOffset().X() - lastimagepoint.X(), core->GetrenderOffset().Y() - lastimagepoint.Y(), lastimage); } From 3a95dd9b7807d22125d06744511fbce8ed59c526 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Wed, 13 May 2015 11:04:13 -0400 Subject: [PATCH 04/15] Fix GoogleMapsKorea, GoogleMapsKoreaHybrid & GoogleMapsKoreaSatellite, Still need to fix the Labels mapset SSL bug in QT, workaround used in url generation code as well --- .../src/libs/opmapcontrol/src/core/opmaps.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index 648615ff9..c4f9a0743 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -103,6 +103,12 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co QNetworkReply *reply; QNetworkRequest qheader; QNetworkAccessManager network; + // This SSL Hack is half assed... technically bad *security* joojoo. + // Required due to a QT5 bug on linux and Mac + // + QSslConfiguration conf = qheader.sslConfiguration(); + conf.setPeerVerifyMode(QSslSocket::VerifyNone); + qheader.setSslConfiguration(conf); network.setProxy(Proxy); #ifdef DEBUG_GMAPS qDebug() << "Try Tile from the Internet"; @@ -196,8 +202,10 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co } qDebug() << "Finished?" << reply->error() << " abort?" << (time.elapsed() > Timeout * 6); + // If you are seeing Error 6 here you are dealing with a QT SSL Bug!!! if ((reply->error() != QNetworkReply::NoError) | (time.elapsed() > Timeout * 6)) { + qDebug() << "reply error: " << reply->error(); return ret; } else From c1cc21da940fe013d81e853e6362c08533abb528 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Wed, 13 May 2015 13:57:15 -0400 Subject: [PATCH 05/15] Fix SigPacSpainMap & Google*Korea map types --- .../src/libs/opmapcontrol/src/core/opmaps.cpp | 7 ++----- .../opmapcontrol/src/core/providerstrings.cpp | 3 ++- .../libs/opmapcontrol/src/core/urlfactory.cpp | 20 +++++++++---------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index c4f9a0743..5fa9c6a1e 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -40,6 +40,7 @@ OPMaps *OPMaps::Instance() OPMaps::OPMaps() : RetryLoadTile(2), useMemoryCache(true) { accessmode = AccessMode::ServerAndCache; + // Need to figure out why this is *fixed* to Portugese. This casues pt-PT to be sent with every Google request Language = LanguageType::PortuguesePortugal; LanguageStr = LanguageType().toShortString(Language); Cache::Instance(); @@ -205,13 +206,9 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co // If you are seeing Error 6 here you are dealing with a QT SSL Bug!!! if ((reply->error() != QNetworkReply::NoError) | (time.elapsed() > Timeout * 6)) { - qDebug() << "reply error: " << reply->error(); + qDebug() << "reply error: " << reply->error() << " see table at - http://doc.qt.io/qt-5/qnetworkreply.html"; return ret; } - else - { - qDebug() << "QNetworkReply Errors!"; - } ret = reply->readAll(); qDebug() << "ret " << ret; reply->deleteLater(); // TODO can't this be global?? diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp index 5e1f1f0c8..5edaf488f 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp @@ -28,7 +28,8 @@ namespace core { -const QString ProviderStrings::levelsForSigPacSpainMap[] = { "0", "1", "2", "3", "4", +const QString ProviderStrings::levelsForSigPacSpainMap[] = { +//"0", "1", "2", "3", "4", "MTNSIGPAC", "MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN200", "MTN200", "MTN200", diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index 569a79e24..68ba2a999 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -290,7 +290,7 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c 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); + 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(VersionGoogleTerrainChina).arg("zh-CN").arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); } break; case MapType::GoogleMapKorea: @@ -304,10 +304,8 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c // 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= - qDebug() << 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); - - 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; + qDebug() << QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMapKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); + return QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMapKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); } break; case MapType::GoogleSatelliteKorea: @@ -327,15 +325,14 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c case MapType::GoogleLabelsKorea: { QString server = "mts"; - QString request = "mt"; + QString request = "vt"; QString sec1 = ""; // after &x=... QString sec2 = ""; // after &zoom=... GetSecGoogleWords(pos, sec1, sec2); TryCorrectGoogleVersions(); - // https://mts1.google.co.kr/mt/v=kr1t.11&hl=lt&x=109&y=50&z=7&s=G - qDebug() << QString("https://%1%2.google.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); - return QString("https://%1%2.google.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); + qDebug() << QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); + return QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); } break; // *.yimg.com has been depreciated. "Here" is what Yahoo uses now. https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/request-constructing.html @@ -477,8 +474,8 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c case MapType::SigPacSpainMap: { // http://sigpac.magrama.es/fega/h5visor/ is new server location - qDebug() << QString("http://sigpac.magrama.es/SDG/raster/MTN2000@3785/%2.%3.%4.img").arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); - return QString("http://sigpac.magrama.es/SDG/raster/MTN2000@3785/%2.%3.%4.img").arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); + qDebug() << QString("http://sigpac.magrama.es/SDG/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); + return QString("http://sigpac.magrama.es/SDG/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); } break; @@ -523,6 +520,7 @@ QString UrlFactory::MakeGeocoderUrl(QString keywords) } QString UrlFactory::MakeReverseGeocoderUrl(internals::PointLatLng &pt, const QString &language) { + qDebug() << "Language: " << language; // CSV output has been depreciated. API key is no longer needed. return QString("https://maps.googleapis.com/maps/api/geocode/xml?latlng=%1,%2").arg(QString::number(pt.Lat())).arg(QString::number(pt.Lng())); } From 666b63c1d77338cec7a06c60efa90ac38074c893 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Wed, 13 May 2015 14:28:57 -0400 Subject: [PATCH 06/15] Update old mapsurfer interface... mapsurfer.net changed to mapsurfernet.com and was depreciated all together. Use GIScience (Geoinformatics) Research Group, Heidelberg University mirror --- .../opmapcontrol/src/core/alllayersoftype.cpp | 7 +++++++ .../libs/opmapcontrol/src/core/urlfactory.cpp | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp index ad3033bd0..727fbbc77 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp @@ -55,6 +55,13 @@ QVector AllLayersOfType::GetAllLayersOfType(const MapType::Types } break; + case MapType::OpenStreetMapSurferTerrain: + { + types.append(MapType::OpenStreetMapSurfer); + types.append(MapType::OpenStreetMapSurferTerrain); + } + break; + case MapType::ArcGIS_MapsLT_Map_Hybrid: { types.append(MapType::ArcGIS_MapsLT_OrtoFoto); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index 68ba2a999..9d05dc179 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -352,18 +352,22 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c break; case MapType::OpenStreetMapSurfer: { - // http://tiles1.mapsurfer.net/tms_r.ashx?x=37378&y=20826&z=16 + // http://wiki.openstreetmap.org/wiki/MapSurfer.NET -> Mapsurfernet.com -> dead + // http://wiki.openstreetmap.org/wiki/OpenMapSurfer mentions: http://korona.geog.uni-heidelberg.de - qDebug() << QString("http://tiles1.mapsurfer.net/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); - return QString("http://tiles1.mapsurfer.net/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); + // Searched Google for tms_r.ashx and found korona.geog.uni-heidelberg.de has a service on port 8001 + // http://129.206.74.245:8001/tms_r.ashx?x=37378&y=20826&z=16 + + qDebug() << QString("http://129.206.74.245:8001/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); + return QString("http://129.206.74.245:8001/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); } break; case MapType::OpenStreetMapSurferTerrain: { - // http://tiles2.mapsurfer.net/tms_t.ashx?x=9346&y=5209&z=14 + // http://korona.geog.uni-heidelberg.de/tiles/asterh/x=501&y=388&z=10 - qDebug() << QString("http://tiles2.mapsurfer.net/tms_t.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); - return QString("http://tiles2.mapsurfer.net/tms_t.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); + qDebug() << QString("http://korona.geog.uni-heidelberg.de/tiles/asterh/x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); + return QString("http://korona.geog.uni-heidelberg.de/tiles/asterh/x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); } break; case MapType::BingMap: From 2c3f3f6a49e33a7b0c78f3e307769932955491eb Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Wed, 13 May 2015 23:06:37 -0400 Subject: [PATCH 07/15] Attempt to fix ArcGIS_MapsLT_* map types, Successfully fix ArcGIS_ShadedRelief by limiting the max tiles. Tiles 11, 12 and 13 are invalid here http://server.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer Set maxtiles to 10 for ArcGIS_ShadedRelief map type --- .../libs/opmapcontrol/src/core/debugheader.h | 1 + .../src/libs/opmapcontrol/src/core/opmaps.cpp | 2 +- .../libs/opmapcontrol/src/core/urlfactory.cpp | 17 +++++++++++------ .../libs/opmapcontrol/src/internals/core.cpp | 6 ++++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h index 893ba7350..2395f5e64 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h @@ -10,4 +10,5 @@ #define DEBUG_MEMORY_CACHE #define DEBUG_GetGeocoderFromCache #define DEBUG_TIMINGS + #define DEBUG_CORE #endif // DEBUGHEADER_H diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index 5fa9c6a1e..f421355cd 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -167,7 +167,7 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co case MapType::ArcGIS_MapsLT_OrtoFoto: case MapType::ArcGIS_MapsLT_Map_Hybrid: { - qheader.setRawHeader("Referrer", "http://www.maps.lt/map_beta/"); + qheader.setRawHeader("Referrer", "http://www.maps.lt/map/default.aspx?lang=en"); } break; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index 9d05dc179..a1c2867eb 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -426,8 +426,10 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c // 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 - qDebug() << 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'); - 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'); + qDebug() << QString("http://dc5.maps.lt/cache/mapslt_ortofoto/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'); + return QString("http://dc5.maps.lt/cache/mapslt_ortofoto/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'); + //http://dc5.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L01/R00000012/C0000001c.png + } break; case MapType::ArcGIS_MapsLT_Map: @@ -439,8 +441,10 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c // 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 - qDebug() << 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'); - 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'); + qDebug() << QString("http://dc5.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'); + return QString("http://dc5.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'); + //http://dc5.maps.lt/cache/mapslt/map/_alllayers/L01/R00000012/C0000001c.png + } break; case MapType::ArcGIS_MapsLT_Map_Labels: @@ -449,8 +453,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c // 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 - qDebug() << 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'); - 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'); + qDebug() << QString("http://dc5.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'); + return QString("http://dc5.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'); + //http://dc5.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L01/R00000013/C0000001d.png } break; case MapType::PergoTurkeyMap: diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index f85b17958..b3d48c00a 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -113,6 +113,7 @@ void Core::run() // tile number inversion(BottomLeft -> TopLeft) for pergo maps if (tl == MapType::PergoTurkeyMap) { + qDebug() << "inverting tiles for Pergo"; img = OPMaps::Instance()->GetImageFrom(tl, Point(task.Pos.X(), maxOfTiles.Height() - task.Pos.Y()), task.Zoom); } else { // ok #ifdef DEBUG_CORE @@ -264,6 +265,11 @@ void Core::SetMapType(const MapType::Types &value) case MapType::ArcGIS_Map: case MapType::ArcGIS_Satellite: case MapType::ArcGIS_ShadedRelief: + { + maxzoom = 10; + } + break; + case MapType::ArcGIS_Terrain: { if (Projection()->Type() != "PlateCarreeProjection") { From 361bb262127eb17e41841a5d694a8c6f16106f68 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Thu, 14 May 2015 01:47:55 -0400 Subject: [PATCH 08/15] attempt to get Pergo Turkish maps working. Still buggy. Unable to search and auto zoom. Initial map render works mostly --- .../src/libs/opmapcontrol/src/core/urlfactory.cpp | 10 +++++++--- .../src/libs/opmapcontrol/src/internals/core.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index a1c2867eb..8bcb5101b 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -73,6 +73,8 @@ QString UrlFactory::TileXYToQuadKey(const int &tileX, const int &tileY, const in } int UrlFactory::GetServerNum(const Point &pos, const int &max) const { + qDebug() << QString("%1").arg(pos.X()); + qDebug() << QString("%1").arg(pos.Y()); return (pos.X() + 2 * pos.Y()) % max; } void UrlFactory::setIsCorrectGoogleVersions(bool value) @@ -475,9 +477,11 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c 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" - // This has changed map03 does not exist. (neither does map3) Servers have changed to map1 and map2? - qDebug() << 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); - 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); + // This has changed map03 does not exist. (neither does map3) Servers have changed to map1 and map2 or maps? + + qDebug() << QString("http://maps.pergo.com.tr/tile/%1/%2/%3.png").arg(zoom, 2, 10, (QChar)'0').arg(x).arg(y); + return QString("http://maps.pergo.com.tr/tile/%1/%2/%3.png").arg(zoom, 2, 10, (QChar)'0').arg(x).arg(y); + } break; case MapType::SigPacSpainMap: diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index b3d48c00a..ea0e98d84 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -295,7 +295,7 @@ void Core::SetMapType(const MapType::Types &value) { if (Projection()->Type() != "PlateCarreeProjectionPergo") { SetProjection(new PlateCarreeProjectionPergo()); - maxzoom = 17; + maxzoom = 18; } } break; From 13b0eac79f8716b77eac2420168d57008b37ee39 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Fri, 15 May 2015 13:27:27 -0400 Subject: [PATCH 09/15] Depreciate Pergo maps --- .../src/libs/opmapcontrol/src/core/maptype.h | 1 - .../src/libs/opmapcontrol/src/core/opmaps.cpp | 1 - .../libs/opmapcontrol/src/core/urlfactory.cpp | 24 ------------------- .../libs/opmapcontrol/src/internals/core.cpp | 21 +++------------- .../libs/opmapcontrol/src/internals/core.h | 1 - .../opmapcontrol/src/internals/internals.pro | 4 +--- 6 files changed, 4 insertions(+), 48 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h index 8e5569764..1218e5547 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h @@ -80,7 +80,6 @@ public: ArcGIS_MapsLT_Map_Labels = 1002, ArcGIS_MapsLT_Map_Hybrid = 1003, - PergoTurkeyMap = 2001, SigPacSpainMap = 3001, GoogleMapKorea = 4001, diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index f421355cd..2dc3c0525 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -121,7 +121,6 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co #ifdef DEBUG_TIMINGS qDebug() << "opmaps after make image url" << time.elapsed(); #endif // url "http://vec02.maps.yandex.ru/tiles?l=map&v=2.10.2&x=7&y=5&z=3" string - // "http://map3.pergo.com.tr/tile/02/000/000/007/000/000/002.png" qheader.setUrl(QUrl(url)); qheader.setRawHeader("User-Agent", UserAgent); qheader.setRawHeader("Accept", "*/*"); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index 8bcb5101b..c6d2fa16f 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -460,30 +460,6 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c //http://dc5.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L01/R00000013/C0000001d.png } break; - case MapType::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" - // This has changed map03 does not exist. (neither does map3) Servers have changed to map1 and map2 or maps? - - qDebug() << QString("http://maps.pergo.com.tr/tile/%1/%2/%3.png").arg(zoom, 2, 10, (QChar)'0').arg(x).arg(y); - return QString("http://maps.pergo.com.tr/tile/%1/%2/%3.png").arg(zoom, 2, 10, (QChar)'0').arg(x).arg(y); - - } - break; case MapType::SigPacSpainMap: { // http://sigpac.magrama.es/fega/h5visor/ is new server location diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index ea0e98d84..708d0ea77 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -111,19 +111,13 @@ void Core::run() do { QByteArray img; - // tile number inversion(BottomLeft -> TopLeft) for pergo maps - if (tl == MapType::PergoTurkeyMap) { - qDebug() << "inverting tiles for Pergo"; - img = OPMaps::Instance()->GetImageFrom(tl, Point(task.Pos.X(), maxOfTiles.Height() - task.Pos.Y()), task.Zoom); - } else { // ok #ifdef DEBUG_CORE - qDebug() << "start getting image" << " ID=" << debug; + qDebug() << "start getting image" << " ID=" << debug; #endif // DEBUG_CORE - img = OPMaps::Instance()->GetImageFrom(tl, task.Pos, task.Zoom); + img = OPMaps::Instance()->GetImageFrom(tl, task.Pos, task.Zoom); #ifdef DEBUG_CORE - qDebug() << "Core::run:gotimage size:" << img.count() << " ID=" << debug << " time=" << t.elapsed(); + qDebug() << "Core::run:gotimage size:" << img.count() << " ID=" << debug << " time=" << t.elapsed(); #endif // DEBUG_CORE - } if (img.length() != 0) { Moverlays.lock(); @@ -291,15 +285,6 @@ void Core::SetMapType(const MapType::Types &value) } break; - case MapType::PergoTurkeyMap: - { - if (Projection()->Type() != "PlateCarreeProjectionPergo") { - SetProjection(new PlateCarreeProjectionPergo()); - maxzoom = 18; - } - } - break; - case MapType::YandexMapRu: { if (Projection()->Type() != "MercatorProjectionYandex") { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h index 7bcae973b..76937e07c 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h @@ -46,7 +46,6 @@ #include "../internals/projections/mercatorprojection.h" #include "../internals/projections/mercatorprojectionyandex.h" #include "../internals/projections/platecarreeprojection.h" -#include "../internals/projections/platecarreeprojectionpergo.h" #include "../core/geodecoderstatus.h" #include "../core/opmaps.h" #include "../core/diagnostics.h" diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro index 787e6ca5c..8c2ad53e9 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro @@ -25,11 +25,9 @@ HEADERS += ./projections/lks94projection.h \ ./projections/mercatorprojection.h \ ./projections/mercatorprojectionyandex.h \ ./projections/platecarreeprojection.h \ - ./projections/platecarreeprojectionpergo.h SOURCES += ./projections/lks94projection.cpp \ ./projections/mercatorprojection.cpp \ ./projections/mercatorprojectionyandex.cpp \ - ./projections/platecarreeprojection.cpp \ - ./projections/platecarreeprojectionpergo.cpp + ./projections/platecarreeprojection.cpp LIBS += -L../build \ -lcore From 17fa6341c313d22b868556ce3130f6e76be90d49 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Fri, 15 May 2015 13:32:19 -0400 Subject: [PATCH 10/15] Depreciate Yandex maps --- .../src/libs/opmapcontrol/src/core/maptype.h | 1 - .../src/libs/opmapcontrol/src/core/opmaps.cpp | 7 +------ .../opmapcontrol/src/core/providerstrings.cpp | 3 --- .../libs/opmapcontrol/src/core/providerstrings.h | 4 ---- .../libs/opmapcontrol/src/core/urlfactory.cpp | 16 ---------------- .../src/libs/opmapcontrol/src/internals/core.cpp | 9 --------- .../src/libs/opmapcontrol/src/internals/core.h | 1 - .../opmapcontrol/src/internals/internals.pro | 2 -- 8 files changed, 1 insertion(+), 42 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h index 1218e5547..7839f2629 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h @@ -87,7 +87,6 @@ public: GoogleLabelsKorea = 4003, GoogleHybridKorea = 4005, - YandexMapRu = 5000 }; static QString StrByType(Types const & value) { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index 2dc3c0525..2a6955f1d 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -120,7 +120,7 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co QString url = MakeImageUrl(type, pos, zoom, LanguageStr); #ifdef DEBUG_TIMINGS qDebug() << "opmaps after make image url" << time.elapsed(); -#endif // url "http://vec02.maps.yandex.ru/tiles?l=map&v=2.10.2&x=7&y=5&z=3" string +#endif // url can be hard coded for debugging purposes qheader.setUrl(QUrl(url)); qheader.setRawHeader("User-Agent", UserAgent); qheader.setRawHeader("Accept", "*/*"); @@ -184,11 +184,6 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co } break; - case MapType::YandexMapRu: - { - qheader.setRawHeader("Referrer", "http://maps.yandex.ru/"); - } - break; default: break; } diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp index 5edaf488f..bde10b5ec 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp @@ -65,9 +65,6 @@ ProviderStrings::ProviderStrings() // BingMaps VersionBingMaps = "563"; - // YandexMap - VersionYandexMap = "2.16.0"; - // VersionYandexSatellite = "1.19.0"; //////////////////// /// diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.h index b0d2389d9..d406539e6 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.h @@ -63,10 +63,6 @@ public: // BingMaps QString VersionBingMaps; - // YandexMap - QString VersionYandexMap; - - /// /// Bing Maps Customer Identification, more info here /// http://msdn.microsoft.com/en-us/library/bb924353.aspx diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index c6d2fa16f..8d9956b29 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -468,22 +468,6 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c } break; - case MapType::YandexMapRu: - { - /* - Used "oldmaps" to determine map types - https://old.maps.yandex.ru/?ll=-83.110960%2C40.091250&spn=7.745361%2C6.015476&z=7&l=map - map: 'https:\/\/vec0%d.maps.yandex.net\/tiles?l=map&%c&%l', - sat: 'https:\/\/sat0%d.maps.yandex.net\/tiles?l=sat&%c&%l', - skl: 'https:\/\/vec0%d.maps.yandex.net\/tiles?l=skl&%c&%l', - */ - - QString server = "vec"; - return QString("http://%1").arg(server) + QString("0%2.maps.yandex.net/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); - -// Satllite maps are poor quality, but available. -// QString server = "sat"; -// return QString("http://%1").arg(server) + QString("0%2.maps.yandex.net/tiles?l=sat&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: break; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index 708d0ea77..ba1fb1708 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -285,15 +285,6 @@ void Core::SetMapType(const MapType::Types &value) } break; - case MapType::YandexMapRu: - { - if (Projection()->Type() != "MercatorProjectionYandex") { - SetProjection(new MercatorProjectionYandex()); - maxzoom = 13; - } - } - break; - default: { if (Projection()->Type() != "MercatorProjection") { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h index 76937e07c..25b7e58b9 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.h @@ -44,7 +44,6 @@ #include "rectlatlng.h" #include "../internals/projections/lks94projection.h" #include "../internals/projections/mercatorprojection.h" -#include "../internals/projections/mercatorprojectionyandex.h" #include "../internals/projections/platecarreeprojection.h" #include "../core/geodecoderstatus.h" #include "../core/opmaps.h" diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro index 8c2ad53e9..c94fcca7e 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro @@ -23,11 +23,9 @@ SOURCES += core.cpp \ mousewheelzoomtype.cpp HEADERS += ./projections/lks94projection.h \ ./projections/mercatorprojection.h \ - ./projections/mercatorprojectionyandex.h \ ./projections/platecarreeprojection.h \ SOURCES += ./projections/lks94projection.cpp \ ./projections/mercatorprojection.cpp \ - ./projections/mercatorprojectionyandex.cpp \ ./projections/platecarreeprojection.cpp LIBS += -L../build \ -lcore From f98a9e63198c8ebc86fa70dc637b64b0ad39df83 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Fri, 15 May 2015 14:22:05 -0400 Subject: [PATCH 11/15] Depreciate MapsLT map source --- .../opmapcontrol/src/core/alllayersoftype.cpp | 7 ---- .../src/libs/opmapcontrol/src/core/maptype.h | 19 --------- .../src/libs/opmapcontrol/src/core/opmaps.cpp | 9 ---- .../libs/opmapcontrol/src/core/urlfactory.cpp | 41 ------------------- .../libs/opmapcontrol/src/internals/core.cpp | 12 ------ .../opmapcontrol/src/internals/internals.pro | 2 +- 6 files changed, 1 insertion(+), 89 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp index 727fbbc77..47fff1c02 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/alllayersoftype.cpp @@ -62,13 +62,6 @@ QVector AllLayersOfType::GetAllLayersOfType(const MapType::Types } break; - case MapType::ArcGIS_MapsLT_Map_Hybrid: - { - types.append(MapType::ArcGIS_MapsLT_OrtoFoto); - types.append(MapType::ArcGIS_MapsLT_Map_Labels); - } - break; - default: { types.append(type); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h index 7839f2629..2f35f5257 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h @@ -61,25 +61,6 @@ public: ArcGIS_ShadedRelief = 799, ArcGIS_Terrain = 811, - // use these numbers to clean up old stuff - // ArcGIS_MapsLT_Map_Old= 877, - // ArcGIS_MapsLT_OrtoFoto_Old = 888, - // ArcGIS_MapsLT_Map_Labels_Old = 890, - // ArcGIS_MapsLT_Map_Hybrid_Old = 899, - // ArcGIS_MapsLT_Map=977, - // ArcGIS_MapsLT_OrtoFoto=988, - // ArcGIS_MapsLT_Map_Labels=990, - // ArcGIS_MapsLT_Map_Hybrid=999, - // ArcGIS_MapsLT_Map=978, - // ArcGIS_MapsLT_OrtoFoto=989, - // ArcGIS_MapsLT_Map_Labels=991, - // ArcGIS_MapsLT_Map_Hybrid=998, - - ArcGIS_MapsLT_Map = 1000, - ArcGIS_MapsLT_OrtoFoto = 1001, - ArcGIS_MapsLT_Map_Labels = 1002, - ArcGIS_MapsLT_Map_Hybrid = 1003, - SigPacSpainMap = 3001, GoogleMapKorea = 4001, diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index 2a6955f1d..f2563be31 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -161,15 +161,6 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co } break; - case MapType::ArcGIS_MapsLT_Map_Labels: - case MapType::ArcGIS_MapsLT_Map: - case MapType::ArcGIS_MapsLT_OrtoFoto: - case MapType::ArcGIS_MapsLT_Map_Hybrid: - { - qheader.setRawHeader("Referrer", "http://www.maps.lt/map/default.aspx?lang=en"); - } - break; - case MapType::OpenStreetMapSurfer: case MapType::OpenStreetMapSurferTerrain: { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index 8d9956b29..b427d8da8 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -419,47 +419,6 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c 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 MapType::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 - qDebug() << QString("http://dc5.maps.lt/cache/mapslt_ortofoto/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'); - return QString("http://dc5.maps.lt/cache/mapslt_ortofoto/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'); - //http://dc5.maps.lt/cache/mapslt_ortofoto/map/_alllayers/L01/R00000012/C0000001c.png - - } - break; - case MapType::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 - qDebug() << QString("http://dc5.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'); - return QString("http://dc5.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'); - //http://dc5.maps.lt/cache/mapslt/map/_alllayers/L01/R00000012/C0000001c.png - - } - break; - case MapType::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 - qDebug() << QString("http://dc5.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'); - return QString("http://dc5.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'); - //http://dc5.maps.lt/cache/mapslt_ortofoto_overlay/map/_alllayers/L01/R00000013/C0000001d.png - } - break; case MapType::SigPacSpainMap: { // http://sigpac.magrama.es/fega/h5visor/ is new server location diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index ba1fb1708..c31ff67c4 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -273,18 +273,6 @@ void Core::SetMapType(const MapType::Types &value) } break; - case MapType::ArcGIS_MapsLT_Map_Hybrid: - case MapType::ArcGIS_MapsLT_Map_Labels: - case MapType::ArcGIS_MapsLT_Map: - case MapType::ArcGIS_MapsLT_OrtoFoto: - { - if (Projection()->Type() != "LKS94Projection") { - SetProjection(new LKS94Projection()); - maxzoom = 11; - } - } - break; - default: { if (Projection()->Type() != "MercatorProjection") { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro index c94fcca7e..6b5083801 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/internals.pro @@ -23,7 +23,7 @@ SOURCES += core.cpp \ mousewheelzoomtype.cpp HEADERS += ./projections/lks94projection.h \ ./projections/mercatorprojection.h \ - ./projections/platecarreeprojection.h \ + ./projections/platecarreeprojection.h SOURCES += ./projections/lks94projection.cpp \ ./projections/mercatorprojection.cpp \ ./projections/platecarreeprojection.cpp From d7fef72b4dcbc564d5713b8be0a0d06afc1c420c Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Fri, 15 May 2015 14:25:03 -0400 Subject: [PATCH 12/15] disable printing of the image header, was used for debugging only --- ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index f2563be31..8d63e30a1 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -195,7 +195,7 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co return ret; } ret = reply->readAll(); - qDebug() << "ret " << ret; + //qDebug() << "ret " << ret; reply->deleteLater(); // TODO can't this be global?? if (ret.isEmpty()) { From 8f8b2fccfc14ba8710e3e459e3254ae6a0cb310d Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Sun, 17 May 2015 01:48:08 -0400 Subject: [PATCH 13/15] Add Statkart Topo2 aka... I scratch YOUR back, you scratch mine! https://github.com/diydrones/apm_planner/commit/17f68c3be6f757fba66e044e95ca26f1496d49e2 --- .../src/libs/opmapcontrol/src/core/maptype.h | 1 + .../src/libs/opmapcontrol/src/core/opmaps.cpp | 10 ++++++++++ .../src/libs/opmapcontrol/src/core/urlfactory.cpp | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h index 2f35f5257..478ae2ae7 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h @@ -68,6 +68,7 @@ public: GoogleLabelsKorea = 4003, GoogleHybridKorea = 4005, + Statkart_Topo2 = 5500 }; static QString StrByType(Types const & value) { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index 8d63e30a1..7ac569c00 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -174,6 +174,16 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co qheader.setRawHeader("Referrer", "http://www.openstreetmap.org/"); } break; + case MapType::Statkart_Topo2: + { + qheader.setRawHeader("Referrer", "http://www.norgeskart.no/"); + } + break; + case MapType::Statkart_Topo2: + { + qheader.setRawHeader("Referrer", "http://www.norgeskart.no/"); + } + break; default: break; diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index b427d8da8..9f60361c8 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -426,6 +426,12 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c return QString("http://sigpac.magrama.es/SDG/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); } break; + case MapType::Statkart_Topo2: + { + + qDebug() << QString("http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom=%1&x=%2&y=%3").arg(zoom).arg(pos.X()).arg(pos.Y()); + return QString("http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom=%1&x=%2&y=%3").arg(zoom).arg(pos.X()).arg(pos.Y()); + } break; default: From bf96bfac74ea04b779c47e3222b034d1180e69b5 Mon Sep 17 00:00:00 2001 From: Kevin Finisterre Date: Sun, 17 May 2015 02:26:38 -0400 Subject: [PATCH 14/15] Remove redundant entry --- .../openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index 7ac569c00..a035b12ed 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -179,11 +179,6 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co qheader.setRawHeader("Referrer", "http://www.norgeskart.no/"); } break; - case MapType::Statkart_Topo2: - { - qheader.setRawHeader("Referrer", "http://www.norgeskart.no/"); - } - break; default: break; From 053bd9ebb79022a5cde5c5d3a072389e63b22e5f Mon Sep 17 00:00:00 2001 From: abeck70 Date: Mon, 18 May 2015 22:43:22 +1000 Subject: [PATCH 15/15] Map update code review comments --- .../libs/opmapcontrol/src/core/debugheader.h | 18 +- .../src/libs/opmapcontrol/src/core/maptype.h | 16 +- .../src/libs/opmapcontrol/src/core/opmaps.cpp | 28 +- .../opmapcontrol/src/core/providerstrings.cpp | 19 +- .../libs/opmapcontrol/src/core/urlfactory.cpp | 242 ++++++++++-------- .../libs/opmapcontrol/src/internals/core.cpp | 10 +- .../src/mapwidget/mapgraphicitem.cpp | 4 +- .../src/plugins/hitl/xplanesimulator10.h | 57 ++--- .../src/plugins/opmap/opmapgadgetwidget.cpp | 5 +- 9 files changed, 207 insertions(+), 192 deletions(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h index 2395f5e64..0cb55a1ea 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/debugheader.h @@ -1,14 +1,14 @@ #ifndef DEBUGHEADER_H #define DEBUGHEADER_H - #define DEBUG_MEMORY_CACHE - #define DEBUG_CACHE - #define DEBUG_GMAPS - #define DEBUG_PUREIMAGECACHE - #define DEBUG_TILECACHEQUEUE +// #define DEBUG_MEMORY_CACHE +// #define DEBUG_CACHE +// #define DEBUG_GMAPS +// #define DEBUG_PUREIMAGECACHE +// #define DEBUG_TILECACHEQUEUE // #define DEBUG_URLFACTORY - #define DEBUG_MEMORY_CACHE - #define DEBUG_GetGeocoderFromCache - #define DEBUG_TIMINGS - #define DEBUG_CORE +// #define DEBUG_MEMORY_CACHE +// #define DEBUG_GetGeocoderFromCache +// #define DEBUG_TIMINGS +// #define DEBUG_CORE #endif // DEBUGHEADER_H diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h index 478ae2ae7..a9e1dab6d 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/maptype.h @@ -52,14 +52,14 @@ public: OpenStreetMapSurfer = 34, OpenStreetMapSurferTerrain = 35, - BingMap = 444, - BingSatellite = 555, - BingHybrid = 666, + BingMap = 444, + BingSatellite = 555, + BingHybrid = 666, - ArcGIS_Map = 777, - ArcGIS_Satellite = 788, - ArcGIS_ShadedRelief = 799, - ArcGIS_Terrain = 811, + ArcGIS_Map = 777, + ArcGIS_Satellite = 788, + ArcGIS_ShadedRelief = 799, + ArcGIS_Terrain = 811, SigPacSpainMap = 3001, @@ -68,7 +68,7 @@ public: GoogleLabelsKorea = 4003, GoogleHybridKorea = 4005, - Statkart_Topo2 = 5500 + Statkart_Topo2 = 5500 }; static QString StrByType(Types const & value) { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp index a035b12ed..eeb4f5203 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -174,7 +174,7 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co qheader.setRawHeader("Referrer", "http://www.openstreetmap.org/"); } break; - case MapType::Statkart_Topo2: + case MapType::Statkart_Topo2: { qheader.setRawHeader("Referrer", "http://www.norgeskart.no/"); } @@ -183,24 +183,24 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co default: break; } - qDebug() << "Timeout is " << Timeout; + qDebug() << "Timeout is " << Timeout; reply = network.get(qheader); - qDebug() << "reply " << reply; + qDebug() << "reply " << reply; - QTime time; - while ((!(reply->isFinished()) || (time.elapsed() > (6 * Timeout)))) { - QCoreApplication::processEvents(QEventLoop::AllEvents); - } + QTime time; + while ((!(reply->isFinished()) || (time.elapsed() > (6 * Timeout)))) { + QCoreApplication::processEvents(QEventLoop::AllEvents); + } - qDebug() << "Finished?" << reply->error() << " abort?" << (time.elapsed() > Timeout * 6); - // If you are seeing Error 6 here you are dealing with a QT SSL Bug!!! + qDebug() << "Finished?" << reply->error() << " abort?" << (time.elapsed() > Timeout * 6); + // If you are seeing Error 6 here you are dealing with a QT SSL Bug!!! - if ((reply->error() != QNetworkReply::NoError) | (time.elapsed() > Timeout * 6)) { - qDebug() << "reply error: " << reply->error() << " see table at - http://doc.qt.io/qt-5/qnetworkreply.html"; - return ret; - } + if ((reply->error() != QNetworkReply::NoError) | (time.elapsed() > Timeout * 6)) { + qDebug() << "reply error: " << reply->error() << " see table at - http://doc.qt.io/qt-5/qnetworkreply.html"; + return ret; + } ret = reply->readAll(); - //qDebug() << "ret " << ret; + // qDebug() << "ret " << ret; reply->deleteLater(); // TODO can't this be global?? if (ret.isEmpty()) { diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp index bde10b5ec..8b246e348 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/providerstrings.cpp @@ -28,13 +28,14 @@ namespace core { -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 QString ProviderStrings::levelsForSigPacSpainMap[] = { +// "0", "1", "2", "3", "4", + "MTNSIGPAC", + "MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN2000", + "MTN200", "MTN200", "MTN200", + "MTN25", "MTN25", + "ORTOFOTOS","ORTOFOTOS", "ORTOFOTOS", "ORTOFOTOS" +}; ProviderStrings::ProviderStrings() { @@ -60,10 +61,10 @@ ProviderStrings::ProviderStrings() /// Google Maps API generated using http://greatmaps.codeplex.com/ /// from http://code.google.com/intl/en-us/apis/maps/signup.html /// - GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA"; + GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA"; // BingMaps - VersionBingMaps = "563"; + VersionBingMaps = "563"; //////////////////// diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp index 9f60361c8..bcb6e167d 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -73,8 +73,10 @@ QString UrlFactory::TileXYToQuadKey(const int &tileX, const int &tileY, const in } int UrlFactory::GetServerNum(const Point &pos, const int &max) const { +#ifdef DEBUG_URLFACTORY qDebug() << QString("%1").arg(pos.X()); qDebug() << QString("%1").arg(pos.Y()); +#endif return (pos.X() + 2 * pos.Y()) % max; } void UrlFactory::setIsCorrectGoogleVersions(bool value) @@ -100,12 +102,12 @@ void UrlFactory::TryCorrectGoogleVersions() if (CorrectGoogleVersions && !IsCorrectGoogleVersions()) { QNetworkReply *reply; QNetworkRequest qheader; - // This SSL Hack is half assed... technically bad *security* joojoo. - // Required due to a QT5 bug on linux and Mac - // - QSslConfiguration conf = qheader.sslConfiguration(); - conf.setPeerVerifyMode(QSslSocket::VerifyNone); - qheader.setSslConfiguration(conf); + // This SSL Hack is half assed... technically bad *security* joojoo. + // Required due to a QT5 bug on linux and Mac + // + QSslConfiguration conf = qheader.sslConfiguration(); + conf.setPeerVerifyMode(QSslSocket::VerifyNone); + qheader.setSslConfiguration(conf); QNetworkAccessManager network; QEventLoop q; QTimer tT; @@ -118,9 +120,9 @@ void UrlFactory::TryCorrectGoogleVersions() qDebug() << "Correct GoogleVersion"; #endif // DEBUG_URLFACTORY // setIsCorrectGoogleVersions(true); - // QString url = "https://www.google.com/maps/@0,-0,7z?dg=dbrw&newdg=1"; - // We need to switch to the Above url... the /lochp method will be depreciated soon - // https://productforums.google.com/forum/#!category-topic/maps/navigation/k6EFrp7J7Jk + // QString url = "https://www.google.com/maps/@0,-0,7z?dg=dbrw&newdg=1"; + // We need to switch to the Above url... the /lochp method will be depreciated soon + // https://productforums.google.com/forum/#!category-topic/maps/navigation/k6EFrp7J7Jk QString url = "https://www.google.com/lochp"; qheader.setUrl(QUrl(url)); @@ -141,7 +143,7 @@ void UrlFactory::TryCorrectGoogleVersions() QString html = QString(reply->readAll()); #ifdef DEBUG_URLFACTORY - qDebug() << html; + qDebug() << html; #endif // DEBUG_URLFACTORY QRegExp reg("\"*https://mts0.google.com/vt/lyrs=m@(\\d*)", Qt::CaseInsensitive); @@ -173,7 +175,9 @@ void UrlFactory::TryCorrectGoogleVersions() VersionGoogleSatelliteKorea = VersionGoogleSatellite; VersionGoogleSatelliteChina = "s@" + VersionGoogleSatellite; +#ifdef DEBUG_URLFACTORY qDebug() << "TryCorrectGoogleVersions, VersionGoogleSatellite: " << VersionGoogleSatellite; +#endif // DEBUG_URLFACTORY } reg = QRegExp("\"*https://mts0.google.com/vt/lyrs=t@(\\d*),r@(\\d*)", Qt::CaseInsensitive); @@ -227,7 +231,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c QString sec2 = ""; // after &zoom=... GetSecGoogleWords(pos, sec1, sec2); TryCorrectGoogleVersions(); +#ifdef DEBUG_URLFACTORY qDebug() << 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); +#endif 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; @@ -278,7 +284,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c TryCorrectGoogleVersions(); // http://mt0.google.cn/vt/v=w2t.110&hl=zh-CN&gl=cn&x=12&y=6&z=4&s=Ga +#ifdef DEBUG_URLFACTORY qDebug() << 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); +#endif 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; @@ -306,7 +314,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c // 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= +#ifdef DEBUG_URLFACTORY qDebug() << QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMapKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); +#endif return QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleMapKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); } break; @@ -320,7 +330,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c TryCorrectGoogleVersions(); // http://khm1.google.co.kr/kh/v=54&x=109&y=49&z=7&s= +#ifdef DEBUG_URLFACTORY qDebug() << 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); +#endif 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; @@ -333,7 +345,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c GetSecGoogleWords(pos, sec1, sec2); TryCorrectGoogleVersions(); +#ifdef DEBUG_URLFACTORY qDebug() << QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); +#endif return QString("https://%1%2.google.com/%3/v=%4&hl=ko&gl=KR&x=%5%6&y=%7&z=%8&s=%9").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2); } break; @@ -348,19 +362,23 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c case MapType::OpenStreetOsm: { char letter = "abc"[GetServerNum(pos, 3)]; +#ifdef DEBUG_URLFACTORY qDebug() << QString("http://%1.tile.openstreetmap.org/%2/%3/%4.png").arg(letter).arg(zoom).arg(pos.X()).arg(pos.Y()); +#endif return QString("http://%1.tile.openstreetmap.org/%2/%3/%4.png").arg(letter).arg(zoom).arg(pos.X()).arg(pos.Y()); } break; case MapType::OpenStreetMapSurfer: { // http://wiki.openstreetmap.org/wiki/MapSurfer.NET -> Mapsurfernet.com -> dead - // http://wiki.openstreetmap.org/wiki/OpenMapSurfer mentions: http://korona.geog.uni-heidelberg.de + // http://wiki.openstreetmap.org/wiki/OpenMapSurfer mentions: http://korona.geog.uni-heidelberg.de - // Searched Google for tms_r.ashx and found korona.geog.uni-heidelberg.de has a service on port 8001 - // http://129.206.74.245:8001/tms_r.ashx?x=37378&y=20826&z=16 + // Searched Google for tms_r.ashx and found korona.geog.uni-heidelberg.de has a service on port 8001 + // http://129.206.74.245:8001/tms_r.ashx?x=37378&y=20826&z=16 +#ifdef DEBUG_URLFACTORY qDebug() << QString("http://129.206.74.245:8001/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); +#endif return QString("http://129.206.74.245:8001/tms_r.ashx?x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); } break; @@ -368,7 +386,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c { // http://korona.geog.uni-heidelberg.de/tiles/asterh/x=501&y=388&z=10 +#ifdef DEBUG_URLFACTORY qDebug() << QString("http://korona.geog.uni-heidelberg.de/tiles/asterh/x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); +#endif return QString("http://korona.geog.uni-heidelberg.de/tiles/asterh/x=%1&y=%2&z=%3").arg(pos.X()).arg(pos.Y()).arg(zoom); } break; @@ -408,7 +428,9 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c { // http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer/tile/1/0/1.jpg +#ifdef DEBUG_URLFACTORY qDebug() << QString("http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.Y()).arg(pos.X()); +#endif return QString("http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/%1/%2/%3").arg(zoom).arg(pos.Y()).arg(pos.X()); } break; @@ -421,15 +443,18 @@ QString UrlFactory::MakeImageUrl(const MapType::Types &type, const Point &pos, c break; case MapType::SigPacSpainMap: { - // http://sigpac.magrama.es/fega/h5visor/ is new server location + // http://sigpac.magrama.es/fega/h5visor/ is new server location +#ifdef DEBUG_URLFACTORY qDebug() << QString("http://sigpac.magrama.es/SDG/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); +#endif return QString("http://sigpac.magrama.es/SDG/raster/%1@3785/%2.%3.%4.img").arg(levelsForSigPacSpainMap[zoom]).arg(zoom).arg(pos.X()).arg((2 << (zoom - 1)) - pos.Y() - 1); } break; case MapType::Statkart_Topo2: { - +#ifdef DEBUG_URLFACTORY qDebug() << QString("http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom=%1&x=%2&y=%3").arg(zoom).arg(pos.X()).arg(pos.Y()); +#endif return QString("http://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=topo2&zoom=%1&x=%2&y=%3").arg(zoom).arg(pos.X()).arg(pos.Y()); } @@ -453,13 +478,16 @@ void UrlFactory::GetSecGoogleWords(const Point &pos, QString &sec1, QString &sec QString UrlFactory::MakeGeocoderUrl(QString keywords) { QString key = keywords.replace(' ', '+'); - // CSV output has been depreciated. API key is no longer needed. + + // CSV output has been depreciated. API key is no longer needed. return QString("https://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=%1").arg(key); } QString UrlFactory::MakeReverseGeocoderUrl(internals::PointLatLng &pt, const QString &language) { +#ifdef DEBUG_URLFACTORY qDebug() << "Language: " << language; - // CSV output has been depreciated. API key is no longer needed. +#endif + // CSV output has been depreciated. API key is no longer needed. return QString("https://maps.googleapis.com/maps/api/geocode/xml?latlng=%1,%2").arg(QString::number(pt.Lat())).arg(QString::number(pt.Lng())); } internals::PointLatLng UrlFactory::GetLatLngFromGeodecoder(const QString &keywords, QString &status) @@ -469,7 +497,7 @@ internals::PointLatLng UrlFactory::GetLatLngFromGeodecoder(const QString &keywor QString latxml; QString lonxml; -//QString status; +// QString status; internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, const bool &useCache, QString &status) { @@ -527,83 +555,77 @@ internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, geo = reply->readAll(); #ifdef DEBUG_URLFACTORY qDebug() << "GetLatLngFromGeocoderUrl:Reply ok"; - qDebug() << geo; // This is the response from the geocode request (no longer in CSV) + qDebug() << geo; // This is the response from the geocode request (no longer in CSV) #endif // DEBUG_URLFACTORY - // This is SOOOO horribly hackish, code duplication needs to go. Needed a quick fix. - QXmlStreamReader reader(geo); - while(!reader.atEnd()) - { - reader.readNext(); + // This is SOOOO horribly hackish, code duplication needs to go. Needed a quick fix. + QXmlStreamReader reader(geo); + while (!reader.atEnd()) { + reader.readNext(); - if(reader.isStartElement()) - { - if(reader.name() == "lat") - { - reader.readNext(); - if(reader.atEnd()) - break; + if (reader.isStartElement()) { + if (reader.name() == "lat") { + reader.readNext(); + if (reader.atEnd()) { + break; + } - if(reader.isCharacters()) - { - QString text = reader.text().toString(); - qDebug() << text; - latxml = text; - break; - } - } - } + if (reader.isCharacters()) { + QString text = reader.text().toString(); +#ifdef DEBUG_URLFACTORY + qDebug() << text; +#endif + latxml = text; + break; + } + } + } + } - } + while (!reader.atEnd()) { + reader.readNext(); - while(!reader.atEnd()) - { - reader.readNext(); + if (reader.isStartElement()) { + if (reader.name() == "lng") { + reader.readNext(); + if (reader.atEnd()) { + break; + } - if(reader.isStartElement()) - { - if(reader.name() == "lng") - { - reader.readNext(); - if(reader.atEnd()) - break; + if (reader.isCharacters()) { + QString text = reader.text().toString(); +#ifdef DEBUG_URLFACTORY + qDebug() << text; +#endif + lonxml = text; + break; + } + } + } + } - if(reader.isCharacters()) - { - QString text = reader.text().toString(); - qDebug() << text; - lonxml = text; - break; - } - } - } + QXmlStreamReader reader2(geo); + while (!reader2.atEnd()) { + reader2.readNext(); - } + if (reader2.isStartElement()) { + if (reader2.name() == "status") { + reader2.readNext(); + if (reader2.atEnd()) { + break; + } - QXmlStreamReader reader2(geo); - while(!reader2.atEnd()) - { - reader2.readNext(); - - if(reader2.isStartElement()) - { - if(reader2.name() == "status") - { - reader2.readNext(); - if(reader2.atEnd()) - break; - - if(reader2.isCharacters()) - { - QString text = reader2.text().toString(); - qDebug() << text; - status = text; - break; - } - } - } - - } + if (reader2.isCharacters()) { + QString text = reader2.text().toString(); +#ifdef DEBUG_URLFACTORY + qDebug() << text; +#endif + status = text; + break; + } + } + } + } // cache geocoding if (useCache && geo.startsWith("200")) { @@ -615,35 +637,31 @@ internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, { - if (status == "OK") { - double lat = QString(latxml).toDouble(); - double lng = QString(lonxml).toDouble(); + if (status == "OK") { + double lat = QString(latxml).toDouble(); + double lng = QString(lonxml).toDouble(); - ret = internals::PointLatLng(lat, lng); + ret = internals::PointLatLng(lat, lng); #ifdef DEBUG_URLFACTORY - qDebug() << "Status is: " << status; - qDebug() << "Lat=" << lat << " Lng=" << lng; -#endif // DEBUG_URLFACTORY - } - else if (status == "ZERO_RESULTS") { - qDebug() << "No results"; - } - else if (status == "OVER_QUERY_LIMIT") { - qDebug() << "You are over quota on queries"; - } - else if (status == "REQUEST_DENIED") { - qDebug() << "Request was denied"; - } - else if (status == "INVALID_REQUEST") { - qDebug() << "Invalid request, missing address, lat long or location"; - } - else if (status == "UNKNOWN_ERROR") { - qDebug() << "Some sort of server error."; - } - else - { - qDebug() << "UrlFactory loop error"; - } + qDebug() << "Status is: " << status; + qDebug() << "Lat=" << lat << " Lng=" << lng; +#endif + } +#ifdef DEBUG_URLFACTORY + else if (status == "ZERO_RESULTS") { + qDebug() << "No results"; + } else if (status == "OVER_QUERY_LIMIT") { + qDebug() << "You are over quota on queries"; + } else if (status == "REQUEST_DENIED") { + qDebug() << "Request was denied"; + } else if (status == "INVALID_REQUEST") { + qDebug() << "Invalid request, missing address, lat long or location"; + } else if (status == "UNKNOWN_ERROR") { + qDebug() << "Some sort of server error."; + } else { + qDebug() << "UrlFactory loop error"; + } +#endif } return ret; } diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp index c31ff67c4..0f0517f9d 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/internals/core.cpp @@ -260,7 +260,7 @@ void Core::SetMapType(const MapType::Types &value) case MapType::ArcGIS_Satellite: case MapType::ArcGIS_ShadedRelief: { - maxzoom = 10; + maxzoom = 10; } break; @@ -349,15 +349,13 @@ void Core::OnMapClose() } QString Core::SetCurrentPositionByKeywords(QString const & keys) { - QString status = "ZERO_RESULTS"; + QString status = "ZERO_RESULTS"; PointLatLng pos = OPMaps::Instance()->GetLatLngFromGeodecoder(keys, status); if (!pos.IsEmpty() && (status == "OK")) { SetCurrentPosition(pos); - } - else - { - qDebug() << "Status is not OK: " << status; + } else { + qDebug() << "Status is not OK: " << status; } return status; } diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp index 78781d580..d5ca171df 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp @@ -34,7 +34,7 @@ namespace mapcontrol { MapGraphicItem::MapGraphicItem(internals::Core *core, Configuration *configuration) : core(core), config(configuration), MapRenderTransform(1), maxZoom(17), minZoom(2), zoomReal(0), zoomDigi(0), isSelected(false), rotation(0) { - //dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg")); + // dragons.load(QString::fromUtf8(":/markers/images/dragons1.jpg")); showTileGridLines = true; isMouseOverMarker = false; maprect = QRectF(0, 0, 1022, 680); @@ -296,7 +296,7 @@ void MapGraphicItem::wheelEvent(QGraphicsSceneWheelEvent *event) } void MapGraphicItem::DrawMap2D(QPainter *painter) { - //painter->drawImage(this->boundingRect(), dragons.toImage()); + // painter->drawImage(this->boundingRect(), dragons.toImage()); if (!lastimage.isNull()) { painter->drawImage(core->GetrenderOffset().X() - lastimagepoint.X(), core->GetrenderOffset().Y() - lastimagepoint.Y(), lastimage); } diff --git a/ground/openpilotgcs/src/plugins/hitl/xplanesimulator10.h b/ground/openpilotgcs/src/plugins/hitl/xplanesimulator10.h index 7a7632296..2a350b5fe 100644 --- a/ground/openpilotgcs/src/plugins/hitl/xplanesimulator10.h +++ b/ground/openpilotgcs/src/plugins/hitl/xplanesimulator10.h @@ -46,35 +46,34 @@ private slots: private: enum XplaneOutputData // ***WARNING***: Elements in this enum are in a precise order, do { // not change. Cf. http://www.nuclearprojects.com/xplane/info.shtml (outdated version 9 info) - // These fields have been updated for X-Plane version 10.x - /* 0 */ FramRate, - /* 1 */ Times, - /* 2 */ SimStats, - /* 3 */ Speed, - /* 4 */ Gload, - /* 5 */ AtmosphereWeather, - /* 6 */ AtmosphereAircraft, - /* 7 */ SystemPressures, - /* 8 */ Joystick1, - /* 9 */ Joystick2, - /* 10 */ ArtStab, - /* 11 */ FlightCon, - /* 12 */ WingSweep, - /* 13 */ Trim, - /* 14 */ Brakes, - /* 15 */ AngularMoments, - /* 16 */ AngularVelocities, - /* 17 */ PitchRollHeading, - /* 18 */ AoA, - /* 19 */ MagCompass, - /* 20 */ LatitudeLongitude, - /* 21 */ LocVelDistTraveled, - /* 22 */ AllPlanesLat, - /* 23 */ AllPlanesLon, - /* 24 */ AllPlanesAlt, - /* 25 */ ThrottleCommand - /* .. */ - + // These fields have been updated for X-Plane version 10.x + /* 0 */ FramRate, + /* 1 */ Times, + /* 2 */ SimStats, + /* 3 */ Speed, + /* 4 */ Gload, + /* 5 */ AtmosphereWeather, + /* 6 */ AtmosphereAircraft, + /* 7 */ SystemPressures, + /* 8 */ Joystick1, + /* 9 */ Joystick2, + /* 10 */ ArtStab, + /* 11 */ FlightCon, + /* 12 */ WingSweep, + /* 13 */ Trim, + /* 14 */ Brakes, + /* 15 */ AngularMoments, + /* 16 */ AngularVelocities, + /* 17 */ PitchRollHeading, + /* 18 */ AoA, + /* 19 */ MagCompass, + /* 20 */ LatitudeLongitude, + /* 21 */ LocVelDistTraveled, + /* 22 */ AllPlanesLat, + /* 23 */ AllPlanesLon, + /* 24 */ AllPlanesAlt, + /* 25 */ ThrottleCommand + /* .. */ }; void processUpdate(const QByteArray & data); diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp index 98d0a267a..a498784fc 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp @@ -2318,9 +2318,9 @@ void OPMapGadgetWidget::SetUavPic(QString UAVPic) void OPMapGadgetWidget::on_tbFind_clicked() { - QPalette pal = m_widget->leFind->palette(); + QPalette pal = m_widget->leFind->palette(); - QString status = m_map->SetCurrentPositionByKeywords(m_widget->leFind->text()); + QString status = m_map->SetCurrentPositionByKeywords(m_widget->leFind->text()); if (status == "OK") { pal.setColor(m_widget->leFind->backgroundRole(), Qt::green); @@ -2351,7 +2351,6 @@ void OPMapGadgetWidget::on_tbFind_clicked() m_widget->leFind->setPalette(pal); qDebug() << "Some sort of code error!"; } - } void OPMapGadgetWidget::onHomeDoubleClick(HomeItem *)