diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-01-23 14:20:22 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-01-23 14:20:22 +0100 |
commit | 50021b730c6615d21aefa99f2f553640b43ff231 (patch) | |
tree | 0b23d06b12c2923881251cabdbe13c45f279e463 /include/llmr/map | |
parent | b4a95be0b217ac8a73bdc57a0488865b2289d5f5 (diff) | |
download | qtlocation-mapboxgl-50021b730c6615d21aefa99f2f553640b43ff231.tar.gz |
move to layer system
Diffstat (limited to 'include/llmr/map')
-rw-r--r-- | include/llmr/map/layer.hpp | 31 | ||||
-rw-r--r-- | include/llmr/map/tile.hpp | 74 |
2 files changed, 49 insertions, 56 deletions
diff --git a/include/llmr/map/layer.hpp b/include/llmr/map/layer.hpp new file mode 100644 index 0000000000..c6a10b9218 --- /dev/null +++ b/include/llmr/map/layer.hpp @@ -0,0 +1,31 @@ +#ifndef LLMR_MAP_LAYER +#define LLMR_MAP_LAYER + +#include <string> + +namespace llmr { + +class Bucket; +class Tile; + +class Layer { +public: + Layer(const std::string& name, const std::shared_ptr<Bucket>& bucket) + : name(name), + bucket(bucket) {} + +public: + std::string name; + std::shared_ptr<Bucket> bucket; + +private: + // Make noncopyable + Layer(const Layer&) = delete; + Layer(const Layer&&) = delete; + Layer& operator=(const Layer&) = delete; + Layer& operator=(const Layer && ) = delete; +}; + +} + +#endif diff --git a/include/llmr/map/tile.hpp b/include/llmr/map/tile.hpp index f4cf07148f..d70675be9c 100644 --- a/include/llmr/map/tile.hpp +++ b/include/llmr/map/tile.hpp @@ -5,6 +5,8 @@ #include "../geometry/linevertexbuffer.hpp" #include "../geometry/fill_buffer.hpp" +#include "layer.hpp" + #include <stdint.h> #include <forward_list> #include <mutex> @@ -32,76 +34,33 @@ public: obsolete }; - struct fill_index { - struct group { - uint32_t vertex_length; - uint32_t elements_length; - - group() : vertex_length(0), elements_length(0) {} - group(uint32_t vertex_length, uint32_t elements_length) - : vertex_length(vertex_length), - elements_length(elements_length) { - } - }; - - uint32_t vertex_start; - uint32_t elements_start; - uint32_t length; - std::vector<group> groups; - - fill_index(uint32_t vertex_start, uint32_t elements_start) - : vertex_start(vertex_start), - elements_start(elements_start), - length(0), - groups(1) { - } - - // debug - std::string name; - }; - - - // struct fill_index { - // uint32_t vertex_start; - // uint32_t vertex_length; - // uint32_t elements_start; - // uint32_t elements_length; - // std::string name; - - // fill_index(uint32_t vertex_start, uint32_t elements_start) - // : vertex_start(vertex_start), - // vertex_length(0), - // elements_start(elements_start), - // elements_length(0) { - // } - // }; - public: Tile(ID id); ~Tile(); // Make noncopyable - Tile(const Tile &) = delete; - Tile(const Tile &&) = delete; - Tile &operator=(const Tile &) = delete; - Tile &operator=(const Tile && ) = delete; + Tile(const Tile&) = delete; + Tile(const Tile&&) = delete; + Tile& operator=(const Tile&) = delete; + Tile& operator=(const Tile && ) = delete; // Other functions void setData(uint8_t *data, uint32_t bytes); bool parse(); - void parseLayer(const uint8_t *data, uint32_t bytes); - void parseFeature(const uint8_t *data, uint32_t bytes); + void parseLayer(const pbf layer); + // void parseFeature(const uint8_t *data, uint32_t bytes); - void addLineGeometry(pbf &geom); - void addFillGeometry(pbf &geom); + // void addLineGeometry(pbf& geom); + // void addFillGeometry(pbf& geom); + std::shared_ptr<Bucket> createFillBucket(const pbf data); void cancel(); const std::string toString() const; - static ID parent(const ID &id, int32_t z); - static std::forward_list<ID> children(const ID &id, int32_t z); + static ID parent(const ID& id, int32_t z); + static std::forward_list<ID> children(const ID& id, int32_t z); public: const ID id; @@ -109,8 +68,11 @@ public: linevertexbuffer lineVertex; debug_font_buffer debugFontVertex; - fill_buffer fillBuffer; - std::vector<fill_index> fillIndices; + std::shared_ptr<FillBuffer> fillBuffer; + + std::forward_list<Layer> layers; + + // std::vector<fill_index> fillIndices; private: // Source data |