blob: 92d9778fd554a90983b4cbe47d0c5f626734bfbc (
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
|
#ifndef MBGL_MAP_TILE_DATA
#define MBGL_MAP_TILE_DATA
#include <mbgl/map/tile_id.hpp>
#include <mbgl/renderer/debug_bucket.hpp>
#include <mbgl/geometry/debug_font_buffer.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/ptr.hpp>
#include <atomic>
#include <string>
#include <functional>
namespace mbgl {
class Environment;
class Painter;
class SourceInfo;
class StyleLayer;
class Request;
class Worker;
class TileData : public std::enable_shared_from_this<TileData>,
private util::noncopyable {
public:
enum class State {
invalid,
initial,
loading,
loaded,
parsed,
obsolete
};
TileData(const TileID&, const SourceInfo&);
~TileData();
void request(Worker&, float pixelRatio, std::function<void ()> callback);
void reparse(Worker&, std::function<void ()> callback);
void cancel();
const std::string toString() const;
inline bool ready() const {
return state == State::parsed;
}
// Override this in the child class.
virtual void parse() = 0;
virtual void render(Painter &painter, const StyleLayer &layer_desc, const mat4 &matrix) = 0;
virtual bool hasData(StyleLayer const &layer_desc) const = 0;
const TileID id;
const std::string name;
std::atomic<State> state;
protected:
const SourceInfo& source;
Environment& env;
Request *req = nullptr;
std::string data;
// Contains the tile ID string for painting debug information.
DebugFontBuffer debugFontBuffer;
public:
DebugBucket debugBucket;
};
}
#endif
|