diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-16 18:53:56 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-16 18:53:56 -0700 |
commit | 4ea281c750c5afcc68f2832bb42d98a1cbce6735 (patch) | |
tree | 60bc7d3ccba2c54859e2e023997cc027cc67aea7 /include/mbgl/map/tile_data.hpp | |
parent | c1a64dc5fa73b54cc5de77629781dfc74302a1e7 (diff) | |
download | qtlocation-mapboxgl-4ea281c750c5afcc68f2832bb42d98a1cbce6735.tar.gz |
rename llmr => mbgl
Diffstat (limited to 'include/mbgl/map/tile_data.hpp')
-rw-r--r-- | include/mbgl/map/tile_data.hpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/include/mbgl/map/tile_data.hpp b/include/mbgl/map/tile_data.hpp new file mode 100644 index 0000000000..a4b73c339f --- /dev/null +++ b/include/mbgl/map/tile_data.hpp @@ -0,0 +1,77 @@ +#ifndef MBGL_MAP_TILE_DATA +#define MBGL_MAP_TILE_DATA + +#include <mbgl/map/tile.hpp> +#include <mbgl/util/noncopyable.hpp> +#include <mbgl/platform/platform.hpp> +#include <mbgl/geometry/vao.hpp> +#include <mbgl/renderer/debug_bucket.hpp> + +#include <cstdint> +#include <string> +#include <memory> +#include <atomic> + +namespace mbgl { + +class Map; +class Painter; +class StyleLayer; + +class TileData : public std::enable_shared_from_this<TileData>, + private util::noncopyable { +public: + struct exception : std::exception {}; + struct geometry_too_long_exception : exception {}; + +public: + typedef std::shared_ptr<TileData> Ptr; + + enum class State { + invalid, + initial, + loading, + loaded, + parsed, + obsolete + }; + +public: + TileData(Tile::ID id, Map &map, const std::string url); + ~TileData(); + + void request(); + void cancel(); + void reparse(); + const std::string toString() const; + + // Override this in the child class. + virtual void beforeParse(); + virtual void parse() = 0; + virtual void afterParse(); + virtual void render(Painter &painter, std::shared_ptr<StyleLayer> layer_desc) = 0; + virtual bool hasData(std::shared_ptr<StyleLayer> layer_desc) const = 0; + + +public: + const Tile::ID id; + std::atomic<State> state; + +protected: + Map ↦ + + // Request-related information. + const std::string url; + std::weak_ptr<platform::Request> req; + std::string data; + + // Contains the tile ID string for painting debug information. + DebugFontBuffer debugFontBuffer; + +public: + DebugBucket debugBucket; +}; + +} + +#endif |