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
117 [[nodiscard]] int tileSize();
118
126 [[nodiscard]] QMap<QString, QString> metaData() const
127 {
128 return m_metadata;
129 }
130
135 [[nodiscard]] QString fileName() const
136 {
137 return m_fileName;
138 }
139
140 private:
141 //
142 Q_DISABLE_COPY_MOVE(MBTILES)
143
144 // Name of the MBTILES file
145 QString m_fileName;
146 QSharedPointer<QFile> m_file;
147
148 // Name of the data base connection. This name is unique to each instance of
149 // this class, and should therefore not be copied.
150 QString m_databaseConnectionName;
151 QMap<QString, QString> m_metadata;
152 };
153
154} // 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:135
~MBTILES()
Standard destructor.
MBTILES(const QString &fileName)
Standard constructor.
QMap< QString, QString > metaData() const
Retrieve metadata of the MBTILES file.
Definition MBTILES.h:126
int tileSize()
Retrieve tile size from an MBTILES file in raster format.
MBTILES()
Standard constructor.