1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Map update code review comments

This commit is contained in:
abeck70 2015-05-18 22:43:22 +10:00
parent bf96bfac74
commit 053bd9ebb7
9 changed files with 207 additions and 192 deletions

View File

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

View File

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

View File

@ -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()) {

View File

@ -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
/// </summary>
GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA";
GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA";
// BingMaps
VersionBingMaps = "563";
VersionBingMaps = "563";
////////////////////

View File

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

View File

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

View File

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

View File

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

View File

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