You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <private/qgeofiletilecache_p.h>
|
|
|
|
#include <QSqlDatabase>
|
|
|
|
class TiQGeoFileTileCache : public QGeoFileTileCache
|
|
{
|
|
public:
|
|
TiQGeoFileTileCache(const QString& directory = QString(), QObject* parent = nullptr);
|
|
~TiQGeoFileTileCache();
|
|
|
|
QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec& spec) override;
|
|
|
|
void insert(const QGeoTileSpec& spec, const QByteArray& bytes, const QString& format,
|
|
QAbstractGeoTileCache::CacheAreas areas = QAbstractGeoTileCache::AllCaches) override;
|
|
|
|
private:
|
|
void addToSqlite(const QGeoTileSpec& spec, const QString& format, const QByteArray& bytes);
|
|
|
|
QSharedPointer<QGeoTileTexture> getFromSqlite(const QGeoTileSpec& spec);
|
|
|
|
//由于qtlocation提供的qhash计算出现错误的机率较大,因此我们自已计算hash
|
|
static quint64 getTileHash(int type, int x, int y, int z);
|
|
|
|
bool openSqlite(const QString& connectId);
|
|
|
|
private:
|
|
QSqlDatabase* m_db = nullptr;
|
|
bool m_valid = false;
|
|
QString m_dbName = "TiMapCache.db";
|
|
};
|