summaryrefslogtreecommitdiff
path: root/src/mbgl/map/vector_tile_data.hpp
blob: 4db0cbe0049a1297a56c94f26dd805e5f1b19fdf (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
#ifndef MBGL_MAP_VECTOR_TILE_DATA
#define MBGL_MAP_VECTOR_TILE_DATA

#include <mbgl/map/tile_data.hpp>
#include <mbgl/map/tile_worker.hpp>

#include <atomic>

namespace mbgl {

class Style;
class SourceInfo;
class WorkRequest;
class Request;

class VectorTileData : public TileData {
public:
    VectorTileData(const TileID&,
                   Style&,
                   const SourceInfo&,
                   float angle_,
                   float pitch_,
                   bool collisionDebug_);
    ~VectorTileData();

    Bucket* getBucket(const StyleLayer&) override;

    void request(float pixelRatio,
                 const std::function<void()>& callback);

    bool reparse(std::function<void ()> callback);

    void redoPlacement(float angle, float pitch, bool collisionDebug) override;

    void cancel() override;

private:
    Worker& worker;
    TileWorker tileWorker;
    std::unique_ptr<WorkRequest> workRequest;
    bool parsing = false;
    const SourceInfo& source;
    Request* req = nullptr;
    std::string data;
    float lastAngle = 0;
    float currentAngle;
    float lastPitch = 0;
    float currentPitch;
    bool lastCollisionDebug = 0;
    bool currentCollisionDebug = 0;
    bool redoingPlacement = false;
};

}

#endif