提交 ec854bbe 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Add %4 option in url, to enhance multi-source downloading

for a.tile.openstreetmap.org\b.tile.openstreetmap.org
c.tile.openstreetmap.org
using Y % 3 == 0,1,2 ->a,b,c
上级 190b739e
......@@ -26,7 +26,7 @@ namespace QTVOSM{
m_downloadThread->start();
//!2,init basic cache and server site.if user does not give address, default set to "http://localhost/osm/%1/%2/%3.png"
this->m_strLocalCache = "/OSMCache";
this->m_strServerURL = "http://c.tile.openstreetmap.org/%1/%2/%3.png";
this->m_strServerURL = "http://%4.tile.openstreetmap.org/%1/%2/%3.png";
m_bconnected = false;
m_propPage = 0;
//!3, init the Drag position, for mouse drag and explore.
......@@ -137,7 +137,7 @@ namespace QTVOSM{
{
this->m_nStartPosX = event->pos().x();
this->m_nStartPosY = event->pos().y();
}
}
return res;
}
......@@ -212,7 +212,7 @@ namespace QTVOSM{
connect(m_downloader,SIGNAL(evt_all_taskFinished()),this,SLOT(updateViewer()));
//Get Cache Address
QSettings settings(QCoreApplication::applicationFilePath()+".ini",QSettings::IniFormat);
m_strServerURL = settings.value(QString("settings/ServerURL_%1").arg(m_name),"http://c.tile.openstreetmap.org/%1/%2/%3.png").toString();
m_strServerURL = settings.value(QString("settings/ServerURL_%1").arg(m_name),"http://%4.tile.openstreetmap.org/%1/%2/%3.png").toString();
m_strLocalCache = settings.value(QString("settings/LocalCache_%1").arg(m_name), QCoreApplication::applicationDirPath() +"/OSMCache").toString();
m_nCacheExpireDays = settings.value(QString("settings/CacheExpireDays_%1").arg(m_name), 30).toInt();
return this;
......@@ -350,7 +350,11 @@ namespace QTVOSM{
LFix += ".png";
strFileName = QString::number(nY,10);
strFileName += ".png";
strSourceUrl = m_strServerURL.arg(nLevel).arg(nX).arg(nY);
QChar mirr[3] = {QChar('a'),QChar('b'),QChar('c')};
if (m_strServerURL.contains("%4"))
strSourceUrl = m_strServerURL.arg(nLevel).arg(nX).arg(nY).arg(mirr[nY%3]);
else
strSourceUrl = m_strServerURL.arg(nLevel).arg(nX).arg(nY);
this->m_downloader->addDownloadUrl(strSourceUrl,strDestinDir,strFileName);
return true;
......
......@@ -15,7 +15,7 @@ namespace QTVOSM{
ui->setupUi(this);
//Get Cache Address
QSettings settings(QCoreApplication::applicationFilePath()+".ini",QSettings::IniFormat);
QString strServerURL = settings.value(QString("settings/ServerURL_%1").arg(layer->get_name()),"http://c.tile.openstreetmap.org/%1/%2/%3.png").toString();
QString strServerURL = settings.value(QString("settings/ServerURL_%1").arg(layer->get_name()),"http://%4.tile.openstreetmap.org/%1/%2/%3.png").toString();
QString strLocalCache = settings.value(QString("settings/LocalCache_%1").arg(layer->get_name()), QCoreApplication::applicationDirPath() +"/OSMCache").toString();
int nCacheExpireDays = settings.value(QString("settings/CacheExpireDays_%1").arg(layer->get_name()), 30).toInt();
int nAutoDownload = settings.value(QString("settings/nAutoDownload_%1").arg(layer->get_name()), 0).toInt();
......
......@@ -73,7 +73,7 @@ void qtaxviewer_planetosm::osm_set_remote_address (QString layerName, QString ad
QString qtaxviewer_planetosm::osm_get_remote_address(QString layerName) const
{
QString res = "http://c.tile.openstreetmap.org/%1/%2/%3.png";
QString res = "http://%4.tile.openstreetmap.org/%1/%2/%3.png";
tilesviewer * pv = this->ui->widget_QTV_mainMap ;
layer_interface * la = pv->layer(layerName);
if (la)
......
......@@ -96,7 +96,7 @@ void qtwidget_planetosm::osm_set_remote_address (QString layerName, QString addr
QString qtwidget_planetosm::osm_get_remote_address(QString layerName) const
{
QString res = "http://c.tile.openstreetmap.org/%1/%2/%3.png";
QString res = "http://%4.tile.openstreetmap.org/%1/%2/%3.png";
osm_frame_widget * mp = qobject_cast<osm_frame_widget *>(m_map_widget);tilesviewer * pv=mp->viewer();
layer_interface * la = pv->layer(layerName);
if (la)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册