summaryrefslogtreecommitdiff
path: root/include/mbgl/util/clip_ids.hpp
blob: 5855b16af73f8c95268e19a3e9e2a2af3c1f49b2 (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
#ifndef MBGL_UTIL_CLIP_IDS
#define MBGL_UTIL_CLIP_IDS

#include <mbgl/map/tile.hpp>
#include <list>
#include <set>
#include <vector>
#include <forward_list>
#include <map>

namespace mbgl {

class ClipIDGenerator {
private:
    struct Leaf {
        Leaf(Tile &tile);
        void add(const Tile::ID &p);
        bool operator==(const Leaf &other) const;

        Tile &tile;
        std::forward_list<Tile::ID> children;
    };

    typedef std::vector<Leaf> Pool;
    std::forward_list<Pool> pools;
    uint8_t bit_offset = 0;

private:
    bool reuseExisting(Leaf &leaf);

public:
    void update(std::forward_list<Tile *> tiles);
};


}

#endif