summaryrefslogtreecommitdiff
path: root/src/mbgl/map/vector_tile_data.hpp
blob: 8497323e528574b34c09cdca924917b94efbfd09 (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 <mbgl/storage/request_holder.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);

    void parse(std::function<void()> callback);
    bool parsePending(std::function<void()> callback) override;

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

    void cancel() override;

private:
    Worker& worker;
    TileWorker tileWorker;
    std::unique_ptr<WorkRequest> workRequest;

    // Contains all the Bucket objects for the tile. Buckets are render
    // objects and they get added by tile parsing operations.
    std::unordered_map<std::string, std::unique_ptr<Bucket>> buckets;

    const SourceInfo& source;
    RequestHolder req;
    std::shared_ptr<const std::string> data;
    float lastAngle = 0;
    float currentAngle;
    float lastPitch = 0;
    float currentPitch;
    bool lastCollisionDebug = 0;
    bool currentCollisionDebug = 0;
};

} // namespace mbgl

#endif