blob: 0cc85ad054c4e74d7b43e2834205d7d750720763 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// Copyright (C) 2015 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QABSTRACTGEOTILECACHE_P_H
#define QABSTRACTGEOTILECACHE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtLocation/private/qlocationglobal_p.h>
#include <QtCore/QSharedPointer>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtGui/QImage>
#include "qgeotilespec_p.h"
QT_BEGIN_NAMESPACE
class QGeoMappingManager;
class QGeoMappingManagerEngine;
class QGeoTile;
class QAbstractGeoTileCache;
class QThread;
/* This is also used in the mapgeometry */
struct QGeoTileTexture
{
QGeoTileSpec spec;
QImage image;
bool textureBound = false;
};
class Q_LOCATION_PRIVATE_EXPORT QAbstractGeoTileCache : public QObject
{
Q_OBJECT
public:
enum CostStrategy {
Unitary,
ByteSize
};
enum CacheArea {
DiskCache = 0x01,
MemoryCache = 0x02,
AllCaches = 0xFF
};
Q_DECLARE_FLAGS(CacheAreas, CacheArea)
virtual ~QAbstractGeoTileCache();
virtual void setMaxDiskUsage(int diskUsage);
virtual int maxDiskUsage() const;
virtual int diskUsage() const;
virtual void setMaxMemoryUsage(int memoryUsage);
virtual int maxMemoryUsage() const;
virtual int memoryUsage() const;
virtual void setMinTextureUsage(int textureUsage) = 0;
virtual void setExtraTextureUsage(int textureUsage) = 0;
virtual int maxTextureUsage() const = 0;
virtual int minTextureUsage() const = 0;
virtual int textureUsage() const = 0;
virtual void clearAll() = 0;
virtual void setCostStrategyDisk(CostStrategy costStrategy) = 0;
virtual CostStrategy costStrategyDisk() const = 0;
virtual void setCostStrategyMemory(CostStrategy costStrategy) = 0;
virtual CostStrategy costStrategyMemory() const = 0;
virtual void setCostStrategyTexture(CostStrategy costStrategy) = 0;
virtual CostStrategy costStrategyTexture() const = 0;
virtual QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec) = 0;
virtual void insert(const QGeoTileSpec &spec,
const QByteArray &bytes,
const QString &format,
QAbstractGeoTileCache::CacheAreas areas = QAbstractGeoTileCache::AllCaches) = 0;
virtual void handleError(const QGeoTileSpec &spec, const QString &errorString);
virtual void init() = 0;
static QString baseCacheDirectory();
static QString baseLocationCacheDirectory();
protected:
QAbstractGeoTileCache(QObject *parent = nullptr);
virtual void printStats() = 0;
friend class QGeoTiledMappingManagerEngine;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractGeoTileCache::CacheAreas)
QT_END_NAMESPACE
#endif // QABSTRACTGEOTILECACHE_P_H
|