1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

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.
This commit is contained in:
Kevin Finisterre 2015-05-13 10:35:46 -04:00 committed by abeck70
parent 3eef68c017
commit 01a00ccafd
4 changed files with 44 additions and 37 deletions

View File

@ -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

View File

@ -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";

View File

@ -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;

View File

@ -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);
}