mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Merge branch 'rel-15.05' into next
This commit is contained in:
commit
869bfaaee5
@ -52,6 +52,7 @@ typedef enum {
|
||||
NOTIFY_SEQUENCE_ALM_CONFIG = 17,
|
||||
NOTIFY_SEQUENCE_ALM_RECEIVER = 18,
|
||||
NOTIFY_SEQUENCE_DISARMED = 19,
|
||||
NOTIFY_SEQUENCE_ALM_ATTITUDE = 20,
|
||||
NOTIFY_SEQUENCE_NULL = 255, // skips any signalling for this condition
|
||||
} NotifySequences;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -112,7 +114,7 @@ const LedSequence_t notifications[] = {
|
||||
}, },
|
||||
[NOTIFY_SEQUENCE_ARMED_FM_STABILIZED6] = { .repeats = -1, .steps = {
|
||||
{ .time_off = 100, .time_on = 100, .color = COLOR_PURPLE, .repeats = 1, },
|
||||
{ .time_off = 100, .time_on = 100, .color = COLOR_PURPLE, .repeats = 1, },
|
||||
{ .time_off = 100, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, },
|
||||
{ .time_off = 500, .time_on = 100, .color = COLOR_BLUE, .repeats = 1, },
|
||||
}, },
|
||||
[NOTIFY_SEQUENCE_ARMED_FM_GPS] = { .repeats = -1, .steps = {
|
||||
@ -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);
|
||||
|
@ -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],
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,10 @@ QVector<MapType::Types> AllLayersOfType::GetAllLayersOfType(const MapType::Types
|
||||
}
|
||||
break;
|
||||
|
||||
case MapType::ArcGIS_MapsLT_Map_Hybrid:
|
||||
case MapType::OpenStreetMapSurferTerrain:
|
||||
{
|
||||
types.append(MapType::ArcGIS_MapsLT_OrtoFoto);
|
||||
types.append(MapType::ArcGIS_MapsLT_Map_Labels);
|
||||
types.append(MapType::OpenStreetMapSurfer);
|
||||
types.append(MapType::OpenStreetMapSurferTerrain);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -9,5 +9,6 @@
|
||||
// #define DEBUG_URLFACTORY
|
||||
// #define DEBUG_MEMORY_CACHE
|
||||
// #define DEBUG_GetGeocoderFromCache
|
||||
|
||||
// #define DEBUG_TIMINGS
|
||||
// #define DEBUG_CORE
|
||||
#endif // DEBUGHEADER_H
|
||||
|
@ -61,26 +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,
|
||||
|
||||
PergoTurkeyMap = 2001,
|
||||
SigPacSpainMap = 3001,
|
||||
|
||||
GoogleMapKorea = 4001,
|
||||
@ -88,7 +68,7 @@ public:
|
||||
GoogleLabelsKorea = 4003,
|
||||
GoogleHybridKorea = 4005,
|
||||
|
||||
YandexMapRu = 5000
|
||||
Statkart_Topo2 = 5500
|
||||
};
|
||||
static QString StrByType(Types const & value)
|
||||
{
|
||||
|
@ -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();
|
||||
@ -100,15 +101,15 @@ 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()));
|
||||
// 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";
|
||||
@ -119,8 +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
|
||||
// "http://map3.pergo.com.tr/tile/02/000/000/007/000/000/002.png"
|
||||
#endif // url can be hard coded for debugging purposes
|
||||
qheader.setUrl(QUrl(url));
|
||||
qheader.setRawHeader("User-Agent", UserAgent);
|
||||
qheader.setRawHeader("Accept", "*/*");
|
||||
@ -145,6 +145,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:
|
||||
@ -153,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_beta/");
|
||||
}
|
||||
break;
|
||||
|
||||
case MapType::OpenStreetMapSurfer:
|
||||
case MapType::OpenStreetMapSurferTerrain:
|
||||
{
|
||||
@ -175,35 +174,35 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co
|
||||
qheader.setRawHeader("Referrer", "http://www.openstreetmap.org/");
|
||||
}
|
||||
break;
|
||||
|
||||
case MapType::YandexMapRu:
|
||||
case MapType::Statkart_Topo2:
|
||||
{
|
||||
qheader.setRawHeader("Referrer", "http://maps.yandex.ru/");
|
||||
qheader.setRawHeader("Referrer", "http://www.norgeskart.no/");
|
||||
}
|
||||
break;
|
||||
|
||||
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;
|
||||
QTime time;
|
||||
while ((!(reply->isFinished()) || (time.elapsed() > (6 * Timeout)))) {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents);
|
||||
}
|
||||
tT.stop();
|
||||
if ((reply->error() != QNetworkReply::NoError)) {
|
||||
errorvars.lock();
|
||||
++diag.networkerrors;
|
||||
errorvars.unlock();
|
||||
reply->deleteLater();
|
||||
|
||||
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;
|
||||
}
|
||||
ret = reply->readAll();
|
||||
// qDebug() << "ret " << ret;
|
||||
reply->deleteLater(); // TODO can't this be global??
|
||||
|
||||
if (ret.isEmpty()) {
|
||||
#ifdef DEBUG_GMAPS
|
||||
qDebug() << "Invalid Tile";
|
||||
|
@ -28,12 +28,14 @@
|
||||
|
||||
|
||||
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",
|
||||
"MTN25", "MTN25",
|
||||
"ORTOFOTOS", "ORTOFOTOS", "ORTOFOTOS", "ORTOFOTOS" };
|
||||
"ORTOFOTOS","ORTOFOTOS", "ORTOFOTOS", "ORTOFOTOS"
|
||||
};
|
||||
|
||||
ProviderStrings::ProviderStrings()
|
||||
{
|
||||
@ -64,9 +66,6 @@ ProviderStrings::ProviderStrings()
|
||||
// BingMaps
|
||||
VersionBingMaps = "563";
|
||||
|
||||
// YandexMap
|
||||
VersionYandexMap = "2.16.0";
|
||||
// VersionYandexSatellite = "1.19.0";
|
||||
////////////////////
|
||||
|
||||
/// <summary>
|
||||
|
@ -63,10 +63,6 @@ public:
|
||||
// BingMaps
|
||||
QString VersionBingMaps;
|
||||
|
||||
// YandexMap
|
||||
QString VersionYandexMap;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Bing Maps Customer Identification, more info here
|
||||
/// http://msdn.microsoft.com/en-us/library/bb924353.aspx
|
||||
|
@ -73,6 +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)
|
||||
@ -171,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);
|
||||
@ -225,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;
|
||||
@ -276,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;
|
||||
@ -290,7 +300,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 +314,10 @@ 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;
|
||||
#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;
|
||||
case MapType::GoogleSatelliteKorea:
|
||||
@ -320,20 +330,25 @@ 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;
|
||||
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.gmaptiles.co.kr/mt/v=kr1t.11&hl=lt&x=109&y=50&z=7&s=G
|
||||
|
||||
return QString("https://%1%2.gmaptiles.co.kr/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10").arg(server).arg(GetServerNum(pos, 4)).arg(request).arg(VersionGoogleLabelsKorea).arg(language).arg(pos.X()).arg(sec1).arg(pos.Y()).arg(zoom).arg(sec2);
|
||||
#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;
|
||||
// *.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
|
||||
@ -347,24 +362,34 @@ 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://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
|
||||
|
||||
#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;
|
||||
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);
|
||||
#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;
|
||||
case MapType::BingMap:
|
||||
@ -403,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;
|
||||
@ -414,87 +441,23 @@ 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://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');
|
||||
}
|
||||
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://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');
|
||||
}
|
||||
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://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');
|
||||
}
|
||||
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?
|
||||
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);
|
||||
#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::YandexMapRu:
|
||||
case MapType::Statkart_Topo2:
|
||||
{
|
||||
/*
|
||||
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);
|
||||
#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());
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -515,11 +478,15 @@ 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.
|
||||
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;
|
||||
#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()));
|
||||
}
|
||||
@ -530,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)
|
||||
{
|
||||
@ -593,77 +560,71 @@ internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url,
|
||||
|
||||
// This is SOOOO horribly hackish, code duplication needs to go. Needed a quick fix.
|
||||
QXmlStreamReader reader(geo);
|
||||
while(!reader.atEnd())
|
||||
{
|
||||
while (!reader.atEnd()) {
|
||||
reader.readNext();
|
||||
|
||||
if(reader.isStartElement())
|
||||
{
|
||||
if(reader.name() == "lat")
|
||||
{
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == "lat") {
|
||||
reader.readNext();
|
||||
if(reader.atEnd())
|
||||
if (reader.atEnd()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(reader.isCharacters())
|
||||
{
|
||||
if (reader.isCharacters()) {
|
||||
QString text = reader.text().toString();
|
||||
#ifdef DEBUG_URLFACTORY
|
||||
qDebug() << text;
|
||||
#endif
|
||||
latxml = text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
while(!reader.atEnd())
|
||||
{
|
||||
while (!reader.atEnd()) {
|
||||
reader.readNext();
|
||||
|
||||
if(reader.isStartElement())
|
||||
{
|
||||
if(reader.name() == "lng")
|
||||
{
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == "lng") {
|
||||
reader.readNext();
|
||||
if(reader.atEnd())
|
||||
if (reader.atEnd()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(reader.isCharacters())
|
||||
{
|
||||
if (reader.isCharacters()) {
|
||||
QString text = reader.text().toString();
|
||||
#ifdef DEBUG_URLFACTORY
|
||||
qDebug() << text;
|
||||
#endif
|
||||
lonxml = text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QXmlStreamReader reader2(geo);
|
||||
while(!reader2.atEnd())
|
||||
{
|
||||
while (!reader2.atEnd()) {
|
||||
reader2.readNext();
|
||||
|
||||
if(reader2.isStartElement())
|
||||
{
|
||||
if(reader2.name() == "status")
|
||||
{
|
||||
if (reader2.isStartElement()) {
|
||||
if (reader2.name() == "status") {
|
||||
reader2.readNext();
|
||||
if(reader2.atEnd())
|
||||
if (reader2.atEnd()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(reader2.isCharacters())
|
||||
{
|
||||
if (reader2.isCharacters()) {
|
||||
QString text = reader2.text().toString();
|
||||
#ifdef DEBUG_URLFACTORY
|
||||
qDebug() << text;
|
||||
#endif
|
||||
status = text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// cache geocoding
|
||||
@ -684,27 +645,23 @@ internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url,
|
||||
#ifdef DEBUG_URLFACTORY
|
||||
qDebug() << "Status is: " << status;
|
||||
qDebug() << "Lat=" << lat << " Lng=" << lng;
|
||||
#endif // DEBUG_URLFACTORY
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG_URLFACTORY
|
||||
else if (status == "ZERO_RESULTS") {
|
||||
qDebug() << "No results";
|
||||
}
|
||||
else if (status == "OVER_QUERY_LIMIT") {
|
||||
} else if (status == "OVER_QUERY_LIMIT") {
|
||||
qDebug() << "You are over quota on queries";
|
||||
}
|
||||
else if (status == "REQUEST_DENIED") {
|
||||
} else if (status == "REQUEST_DENIED") {
|
||||
qDebug() << "Request was denied";
|
||||
}
|
||||
else if (status == "INVALID_REQUEST") {
|
||||
} else if (status == "INVALID_REQUEST") {
|
||||
qDebug() << "Invalid request, missing address, lat long or location";
|
||||
}
|
||||
else if (status == "UNKNOWN_ERROR") {
|
||||
} else if (status == "UNKNOWN_ERROR") {
|
||||
qDebug() << "Some sort of server error.";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
qDebug() << "UrlFactory loop error";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -111,10 +111,6 @@ void Core::run()
|
||||
do {
|
||||
QByteArray img;
|
||||
|
||||
// tile number inversion(BottomLeft -> TopLeft) for pergo maps
|
||||
if (tl == MapType::PergoTurkeyMap) {
|
||||
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;
|
||||
#endif // DEBUG_CORE
|
||||
@ -122,7 +118,6 @@ void Core::run()
|
||||
#ifdef DEBUG_CORE
|
||||
qDebug() << "Core::run:gotimage size:" << img.count() << " ID=" << debug << " time=" << t.elapsed();
|
||||
#endif // DEBUG_CORE
|
||||
}
|
||||
|
||||
if (img.length() != 0) {
|
||||
Moverlays.lock();
|
||||
@ -264,6 +259,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") {
|
||||
@ -273,36 +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;
|
||||
|
||||
case MapType::PergoTurkeyMap:
|
||||
{
|
||||
if (Projection()->Type() != "PlateCarreeProjectionPergo") {
|
||||
SetProjection(new PlateCarreeProjectionPergo());
|
||||
maxzoom = 17;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MapType::YandexMapRu:
|
||||
{
|
||||
if (Projection()->Type() != "MercatorProjectionYandex") {
|
||||
SetProjection(new MercatorProjectionYandex());
|
||||
maxzoom = 13;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (Projection()->Type() != "MercatorProjection") {
|
||||
@ -384,9 +354,7 @@ QString Core::SetCurrentPositionByKeywords(QString const & keys)
|
||||
|
||||
if (!pos.IsEmpty() && (status == "OK")) {
|
||||
SetCurrentPosition(pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
qDebug() << "Status is not OK: " << status;
|
||||
}
|
||||
return status;
|
||||
|
@ -44,9 +44,7 @@
|
||||
#include "rectlatlng.h"
|
||||
#include "../internals/projections/lks94projection.h"
|
||||
#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"
|
||||
|
@ -23,13 +23,9 @@ SOURCES += core.cpp \
|
||||
mousewheelzoomtype.cpp
|
||||
HEADERS += ./projections/lks94projection.h \
|
||||
./projections/mercatorprojection.h \
|
||||
./projections/mercatorprojectionyandex.h \
|
||||
./projections/platecarreeprojection.h \
|
||||
./projections/platecarreeprojectionpergo.h
|
||||
./projections/platecarreeprojection.h
|
||||
SOURCES += ./projections/lks94projection.cpp \
|
||||
./projections/mercatorprojection.cpp \
|
||||
./projections/mercatorprojectionyandex.cpp \
|
||||
./projections/platecarreeprojection.cpp \
|
||||
./projections/platecarreeprojectionpergo.cpp
|
||||
./projections/platecarreeprojection.cpp
|
||||
LIBS += -L../build \
|
||||
-lcore
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ private:
|
||||
/* 24 */ AllPlanesAlt,
|
||||
/* 25 */ ThrottleCommand
|
||||
/* .. */
|
||||
|
||||
};
|
||||
|
||||
void processUpdate(const QByteArray & data);
|
||||
|
@ -2351,7 +2351,6 @@ void OPMapGadgetWidget::on_tbFind_clicked()
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "Some sort of code error!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::onHomeDoubleClick(HomeItem *)
|
||||
|
Loading…
Reference in New Issue
Block a user