Enroute Flight Navigation
A navigation app for VFR pilots
MBTILES.h
1/***************************************************************************
2 * Copyright (C) 2022-2024 by Stefan Kebekus *
3 * stefan.kebekus@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21#pragma once
22
23#include <QFile>
24#include <QMap>
25#include <QObject>
26#include <QSharedPointer>
27
28#include "fileFormats/DataFileAbstract.h"
29
30
31namespace FileFormats
32{
39
40 class MBTILES : public DataFileAbstract
41 {
42
43 public:
45 enum Format : quint8
46 {
49
52
55 };
56
63
71 MBTILES(const QString& fileName);
72
75
81 [[nodiscard]] QString attribution();
82
88
94 [[nodiscard]] QString info();
95
107 [[nodiscard]] QByteArray tile(int zoom, int x, int y);
108
116 [[nodiscard]] QMap<QString, QString> metaData() const
117 {
118 return m_metadata;
119 }
120
125 [[nodiscard]] QString fileName() const
126 {
127 return m_fileName;
128 }
129
130 private:
131 //
132 Q_DISABLE_COPY_MOVE(MBTILES)
133
134 // Name of the MBTILES file
135 QString m_fileName;
136 QSharedPointer<QFile> m_file;
137
138 // Name of the data base connection. This name is unique to each instance of
139 // this class, and should therefore not be copied.
140 QString m_databaseConnectionName;
141 QMap<QString, QString> m_metadata;
142 };
143
144} // namespace FileFormats
Utility class for databases in MBTILES format.
Definition MBTILES.h:41
QByteArray tile(int zoom, int x, int y)
Retrieve tile from an MBTILES file.
QString attribution()
Attribution of MBTILES file.
QString info()
Information about an MBTILES file.
FileFormats::MBTILES::Format format()
Determine type of data contained in an MBTILES file.
Format
Format of data tiles.
Definition MBTILES.h:46
@ Vector
Vector data in PBF format.
Definition MBTILES.h:51
@ Unknown
Unknown format.
Definition MBTILES.h:48
@ Raster
Raster data in JPG, PNG or WEBP format.
Definition MBTILES.h:54
QString fileName() const
Retrieve name of the MBTILES file.
Definition MBTILES.h:125
~MBTILES()
Standard destructor.
MBTILES(const QString &fileName)
Standard constructor.
QMap< QString, QString > metaData() const
Retrieve metadata of the MBTILES file.
Definition MBTILES.h:116
MBTILES()
Standard constructor.