mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Properly handle basemap entries with './xxx' paths
This commit is contained in:
parent
e86f89308b
commit
2d5e11f001
@ -77,16 +77,14 @@ bool GMAP::readXML(const QString &path, QString &dataDir, QString &typFile,
|
|||||||
bool GMAP::loadTile(const QDir &dir, quint16 &id)
|
bool GMAP::loadTile(const QDir &dir, quint16 &id)
|
||||||
{
|
{
|
||||||
VectorTile *tile = new VectorTile();
|
VectorTile *tile = new VectorTile();
|
||||||
|
SubFile *file;
|
||||||
|
|
||||||
QFileInfoList ml = dir.entryInfoList(QDir::Files);
|
QFileInfoList ml = dir.entryInfoList(QDir::Files);
|
||||||
for (int i = 0; i < ml.size(); i++) {
|
for (int i = 0; i < ml.size(); i++) {
|
||||||
const QFileInfo &fi = ml.at(i);
|
const QFileInfo &fi = ml.at(i);
|
||||||
SubFile::Type type = tileType(fi.suffix());
|
if ((file = tile->addFile(fi.absoluteFilePath(), tileType(fi.suffix()))))
|
||||||
if (VectorTile::isTileFile(type)) {
|
|
||||||
SubFile *file = tile->addFile(fi.absoluteFilePath(), type);
|
|
||||||
file->setId(id++);
|
file->setId(id++);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!tile->init()) {
|
if (!tile->init()) {
|
||||||
qWarning("%s: Invalid map tile", qPrintable(dir.path()));
|
qWarning("%s: Invalid map tile", qPrintable(dir.path()));
|
||||||
@ -108,8 +106,8 @@ bool GMAP::loadTile(const QDir &dir, quint16 &id)
|
|||||||
|
|
||||||
GMAP::GMAP(const QString &fileName) : _fileName(fileName)
|
GMAP::GMAP(const QString &fileName) : _fileName(fileName)
|
||||||
{
|
{
|
||||||
QString dataDirPath, typFile, baseMap;
|
QString dataDirPath, typFilePath, baseMapPath;
|
||||||
if (!readXML(fileName, dataDirPath, typFile, baseMap))
|
if (!readXML(fileName, dataDirPath, typFilePath, baseMapPath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QDir baseDir(QFileInfo(fileName).absoluteDir());
|
QDir baseDir(QFileInfo(fileName).absoluteDir());
|
||||||
@ -121,14 +119,15 @@ GMAP::GMAP(const QString &fileName) : _fileName(fileName)
|
|||||||
QFileInfoList ml = dataDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
QFileInfoList ml = dataDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
|
||||||
quint16 id = 0;
|
quint16 id = 0;
|
||||||
|
QFileInfo baseMap(baseMapPath);
|
||||||
for (int i = 0; i < ml.size(); i++) {
|
for (int i = 0; i < ml.size(); i++) {
|
||||||
const QFileInfo &fi = ml.at(i);
|
const QFileInfo &fi = ml.at(i);
|
||||||
if (fi.isDir() && fi.baseName() != baseMap)
|
if (fi.isDir() && fi.baseName() != baseMap.baseName())
|
||||||
loadTile(QDir(fi.absoluteFilePath()), id);
|
loadTile(QDir(fi.absoluteFilePath()), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseDir.exists(typFile))
|
if (baseDir.exists(typFilePath))
|
||||||
_typ = new SubFile(baseDir.filePath(typFile));
|
_typ = new SubFile(baseDir.filePath(typFilePath));
|
||||||
|
|
||||||
if (!_tileTree.Count())
|
if (!_tileTree.Count())
|
||||||
_errorString = "No usable map tile found";
|
_errorString = "No usable map tile found";
|
||||||
|
Loading…
Reference in New Issue
Block a user