Marble

TileCreator.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2004-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007-2008 Inge Wallin <ingwa@kde.org>
5//
6
7#ifndef MARBLE_TILECREATOR_H
8#define MARBLE_TILECREATOR_H
9
10#include <QString>
11#include <QThread>
12
13#include "marble_export.h"
14
15class QSize;
16class QImage;
17
18namespace Marble
19{
20
21class TileCreatorPrivate;
22
23/**
24 * Base Class for custom tile source
25 *
26 * Implement this class to have more control over the tile creating process. This
27 * is needed when creating with a high tileLevel where the whole source image can't
28 * be loaded at once.
29 **/
30class MARBLE_EXPORT TileCreatorSource
31{
32public:
33 virtual ~TileCreatorSource() = default;
34
35 /**
36 * Must return the full size of the source image
37 */
38 virtual QSize fullImageSize() const = 0;
39
40 /**
41 * Must return one specific tile
42 *
43 * tileLevel can be used to calculate the number of tiles in a row or column
44 */
45 virtual QImage tile(int n, int m, int tileLevel) = 0;
46};
47
48class MARBLE_EXPORT TileCreator : public QThread
49{
50 Q_OBJECT
51
52public:
53 /**
54 * Constructor for standard Image source
55 */
56 TileCreator(const QString &sourceDir, const QString &installMap, const QString &dem, const QString &targetDir = QString());
57
58 /**
59 * Constructor for own, custom source class
60 *
61 * Ownership of source is taken by TileCreator
62 */
63 TileCreator(TileCreatorSource *source, const QString &dem, const QString &targetDir);
64
65 ~TileCreator() override;
66
67 void cancelTileCreation();
68
69 void setTileFormat(const QString &format);
70 void setTileQuality(int quality);
71 void setResume(bool resume);
72 void setVerifyExactResult(bool verify);
73 QString tileFormat() const;
74 int tileQuality() const;
75 bool resume() const;
76 bool verifyExactResult() const;
77
78protected:
79 void run() override;
80
81Q_SIGNALS:
82 void progress(int value);
83
84private:
85 Q_DISABLE_COPY(TileCreator)
86 TileCreatorPrivate *const d;
87};
88
89}
90
91#endif
Base Class for custom tile source.
Definition TileCreator.h:31
virtual QSize fullImageSize() const =0
Must return the full size of the source image.
virtual QImage tile(int n, int m, int tileLevel)=0
Must return one specific tile.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:55:54 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.