File indexing completed on 2024-03-03 03:58:36

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2016 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_MBTILEWRITER_H
0007 #define MARBLE_MBTILEWRITER_H
0008 
0009 #include <QSqlQuery>
0010 #include <QFileInfo>
0011 
0012 namespace Marble
0013 {
0014 
0015 class MbTileWriter
0016 {
0017 public:
0018     explicit MbTileWriter(const QString &filename, const QString &extension="o5m");
0019     ~MbTileWriter();
0020 
0021     void setOverwriteTiles(bool overwrite);
0022     void setReportProgress(bool report);
0023     void setCommitInterval(int interval);
0024 
0025     void addTile(const QFileInfo &file, qint32 x, qint32 y, qint32 z);
0026     void addTile(QIODevice* device, qint32 x, qint32 y, qint32 z);
0027     bool hasTile(qint32 x, qint32 y, qint32 z) const;
0028 
0029 private:
0030     void execQuery(const QString &query) const;
0031     void execQuery(QSqlQuery &query) const;
0032     void setMetaData(const QString &name, const QString &value);
0033 
0034     bool m_overwriteTiles;
0035     bool m_reportProgress;
0036     int m_tileCounter;
0037     int m_commitInterval;
0038 };
0039 
0040 }
0041 
0042 #endif