1 #pragma once 2 3 #include <mbgl/tile/tile_id.hpp> 4 #include <mbgl/style/types.hpp> 5 #include <mbgl/util/geometry.hpp> 6 #include <mbgl/util/optional.hpp> 7 8 #include <vector> 9 #include <memory> 10 11 namespace mbgl { 12 13 class TransformState; 14 class LatLngBounds; 15 16 namespace util { 17 18 // Helper class to stream tile-cover results per row 19 class TileCover { 20 public: 21 TileCover(const LatLngBounds&, int32_t z); 22 // When project == true, projects the geometry points to tile coordinates 23 TileCover(const Geometry<double>&, int32_t z, bool project = true); 24 ~TileCover(); 25 26 optional<UnwrappedTileID> next(); 27 bool hasNext(); 28 29 private: 30 class Impl; 31 std::unique_ptr<Impl> impl; 32 }; 33 34 int32_t coveringZoomLevel(double z, style::SourceType type, uint16_t tileSize); 35 36 std::vector<UnwrappedTileID> tileCover(const TransformState&, int32_t z); 37 std::vector<UnwrappedTileID> tileCover(const LatLngBounds&, int32_t z); 38 std::vector<UnwrappedTileID> tileCover(const Geometry<double>&, int32_t z); 39 40 // Compute only the count of tiles needed for tileCover 41 uint64_t tileCount(const LatLngBounds&, uint8_t z); 42 uint64_t tileCount(const Geometry<double>&, uint8_t z); 43 44 } // namespace util 45 } // namespace mbgl 46