KOSMIndoorMap
overpassquerymanager.cpp
70 d->m_nam->enableStrictTransportSecurityStore(true, QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/org.kde.osm/hsts/"));
73 diskCache->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/org.kde.osm/overpass-cache/"));
93 if (query->query().isEmpty() || query->boundingBox().isNull() || !query->boundingBox().isValid() || query->tileSize().isNull() || !query->tileSize().isValid()) {
100 const auto xTileCount = std::max<int>(1, query->boundingBox().width() / query->tileSize().width());
101 const auto yTileCount = std::max<int>(1, query->boundingBox().height() / query->tileSize().height());
104 qDebug() << "Creating" << xTileCount * yTileCount << "tasks with tile size" << xTileSize << "x" << yTileSize;
133 nextSlot += std::chrono::seconds(1); // for msec rounding errors that would other wise give us a busy loop
148 req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, executor.task->forceReload ? QNetworkRequest::PreferNetwork : QNetworkRequest::AlwaysCache);
160void OverpassQueryManagerPrivate::taskFinished(OverpassQueryExecutor *executor, QNetworkReply *reply)
163 if (reply->error() == QNetworkReply::UnknownContentError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 429) {
166 qDebug() << "rate limit error, increasing cooldown time to" << executor->cooldownTime.count() << "seconds";
168 } else if (reply->error() == QNetworkReply::ContentNotFoundError && !executor->task->forceReload) {
173 // TODO disable affected executors here and reschedule the failed task, rather than cancelling entirely
174 qDebug() << reply->error() << reply->errorString() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) << reply->readAll();
191 task->bbox = { executor->task->bbox.x() + x * xTileSize, executor->task->bbox.y() + y * yTileSize, xTileSize, yTileSize };
218 if (std::any_of(m_executors.begin(), m_executors.end(), [query](const auto &executor) { return executor.task && executor.task->query == query; })
219 || std::any_of(m_tasks.begin(), m_tasks.end(), [query](const auto &task) { return task->query == query; }))
227 m_tasks.erase(std::remove_if(m_tasks.begin(), m_tasks.end(), [query](const auto &task) { return task->query == query; }), m_tasks.end());
An Overpass QL query job, to be executed by OverpassQueryManager.
Definition overpassquery.h:26
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
Low-level types and functions to work with raw OSM data as efficiently as possible.
Definition locationqueryoverlayproxymodel.h:15
QDateTime addSecs(qint64 s) const const
QDateTime currentDateTimeUtc()
QString errorString() const const
QByteArray readAll()
bool isEmpty() const const
QNetworkReply * get(const QNetworkRequest &request)
void setCacheDirectory(const QString &cacheDir)
UnknownContentError
QVariant attribute(QNetworkRequest::Attribute code) const const
NetworkError error() const const
void finished()
CacheLoadControlAttribute
PreferNetwork
NoLessSafeRedirectPolicy
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
GenericCacheLocation
QString writableLocation(StandardLocation type)
QString fromUtf8(QByteArrayView str)
QTaskBuilder< Task > task(Task &&task)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
singleShot
void start()
void timeout()
void addQueryItem(const QString &key, const QString &value)
int toInt(bool *ok) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:11:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:11:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.