summaryrefslogtreecommitdiff
path: root/src/mbgl/map/vector_tile_data.hpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2015-04-22 15:05:42 +0200
committerThiago Marcos P. Santos <thiago@mapbox.com>2015-05-05 18:35:40 +0300
commit1455e5e53c1795401bec1b88272e93ce326d1753 (patch)
tree6da9f2f2ade694fb2164cd40a47777cea26ed58b /src/mbgl/map/vector_tile_data.hpp
parentc487c521b44c3a4a3ef13422580be76d466a9c70 (diff)
downloadqtlocation-mapboxgl-1455e5e53c1795401bec1b88272e93ce326d1753.tar.gz
Add partial tile parsing
This change will add a new state to the tile called "partial" which is a state where the tile can be rendered but some information might be missing. For now we skip the SymbolBucket if the Sprites are not loaded (will also do the same for the glyphs in the future). When the Sprites are finally loaded, we trigger another update, this time the Tile will get completely re-rendered and change the state to "parsed".
Diffstat (limited to 'src/mbgl/map/vector_tile_data.hpp')
-rw-r--r--src/mbgl/map/vector_tile_data.hpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mbgl/map/vector_tile_data.hpp b/src/mbgl/map/vector_tile_data.hpp
index 10eaf9c184..146bc93229 100644
--- a/src/mbgl/map/vector_tile_data.hpp
+++ b/src/mbgl/map/vector_tile_data.hpp
@@ -10,6 +10,7 @@
#include <iosfwd>
#include <memory>
+#include <mutex>
#include <unordered_map>
namespace mbgl {
@@ -42,6 +43,8 @@ public:
void parse() override;
virtual Bucket* getBucket(StyleLayer const &layer_desc) override;
+ void setBucket(StyleLayer const &layer_desc, std::unique_ptr<Bucket> bucket);
+
protected:
// Holds the actual geometries in this tile.
FillVertexBuffer fillVertexBuffer;
@@ -50,16 +53,22 @@ protected:
TriangleElementsBuffer triangleElementsBuffer;
LineElementsBuffer lineElementsBuffer;
- // Holds the buckets of this tile.
- // They contain the location offsets in the buffers stored above
- std::unordered_map<std::string, std::unique_ptr<Bucket>> buckets;
-
GlyphAtlas& glyphAtlas;
GlyphStore& glyphStore;
SpriteAtlas& spriteAtlas;
util::ptr<Sprite> sprite;
Style& style;
+private:
+ // Contains all the Bucket objects for the tile. Buckets are render
+ // objects and they get added to this std::map<> by the workers doing
+ // the actual tile parsing as they get processed. Tiles partially
+ // parsed can get new buckets at any moment but are also fit for
+ // rendering. That said, access to this list needs locking unless
+ // the tile is completely parsed.
+ std::unordered_map<std::string, std::unique_ptr<Bucket>> buckets;
+ mutable std::mutex bucketsMutex;
+
public:
const float depth;
};