mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-31 09:05:14 +01:00
Use the map name from the metadata table if available
This commit is contained in:
parent
0a74684713
commit
99ea19e35a
@ -76,22 +76,25 @@ MBTilesMap::MBTilesMap(const QString &fileName, QObject *parent)
|
|||||||
qMax(0, query.value(3).toInt())) + 1, _zooms.min());
|
qMax(0, query.value(3).toInt())) + 1, _zooms.min());
|
||||||
Coordinates tl(osm::m2ll(QPointF(minX, maxY)));
|
Coordinates tl(osm::m2ll(QPointF(minX, maxY)));
|
||||||
Coordinates br(osm::m2ll(QPointF(maxX, minY)));
|
Coordinates br(osm::m2ll(QPointF(maxX, minY)));
|
||||||
// Workaround of broken zoom level 0 and 1 due to numerical instability
|
// Workaround of broken zoom levels 0 and 1 due to numerical instability
|
||||||
tl.rlat() = qMin(tl.lat(), 85.0511);
|
tl.rlat() = qMin(tl.lat(), 85.0511);
|
||||||
br.rlat() = qMax(br.lat(), -85.0511);
|
br.rlat() = qMax(br.lat(), -85.0511);
|
||||||
_bounds = RectC(tl, br);
|
_bounds = RectC(tl, br);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QSqlQuery query("SELECT value FROM metadata WHERE name = 'name'", _db);
|
||||||
|
if (query.first())
|
||||||
|
_name = query.value(0).toString();
|
||||||
|
else
|
||||||
|
_name = QFileInfo(_fileName).fileName();
|
||||||
|
}
|
||||||
|
|
||||||
_db.close();
|
_db.close();
|
||||||
|
|
||||||
_valid = true;
|
_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MBTilesMap::name() const
|
|
||||||
{
|
|
||||||
return QFileInfo(_fileName).fileName();;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MBTilesMap::load()
|
void MBTilesMap::load()
|
||||||
{
|
{
|
||||||
_db.open();
|
_db.open();
|
||||||
|
@ -11,7 +11,7 @@ class MBTilesMap : public Map
|
|||||||
public:
|
public:
|
||||||
MBTilesMap(const QString &fileName, QObject *parent = 0);
|
MBTilesMap(const QString &fileName, QObject *parent = 0);
|
||||||
|
|
||||||
QString name() const;
|
QString name() const {return _name;}
|
||||||
|
|
||||||
QRectF bounds();
|
QRectF bounds();
|
||||||
qreal resolution(const QRectF &rect);
|
qreal resolution(const QRectF &rect);
|
||||||
@ -43,7 +43,7 @@ private:
|
|||||||
|
|
||||||
QSqlDatabase _db;
|
QSqlDatabase _db;
|
||||||
|
|
||||||
QString _fileName;
|
QString _fileName, _name;
|
||||||
RectC _bounds;
|
RectC _bounds;
|
||||||
Range _zooms;
|
Range _zooms;
|
||||||
int _zoom;
|
int _zoom;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user