1 #pragma once 2 3 #include <mbgl/tile/tile_id.hpp> 4 #include <mbgl/util/clip_id.hpp> 5 6 #include <set> 7 #include <vector> 8 #include <map> 9 10 namespace mbgl { 11 namespace algorithm { 12 13 class ClipIDGenerator { 14 private: 15 struct Leaf { 16 Leaf(ClipID&); 17 void add(const CanonicalTileID &p); 18 bool operator==(const Leaf &other) const; 19 20 std::set<CanonicalTileID> children; 21 ClipID& clip; 22 }; 23 24 uint8_t bit_offset = 0; 25 std::multimap<UnwrappedTileID, Leaf> pool; 26 27 public: 28 template <typename Renderable> 29 void update(std::vector<std::reference_wrapper<Renderable>> renderables); 30 31 std::map<UnwrappedTileID, ClipID> getClipIDs() const; 32 }; 33 34 } // namespace algorithm 35 } // namespace mbgl 36