summaryrefslogtreecommitdiff
path: root/src/mbgl/map/vector_tile_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/map/vector_tile_data.cpp')
-rw-r--r--src/mbgl/map/vector_tile_data.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp
index 7560168ed7..263ad52b9d 100644
--- a/src/mbgl/map/vector_tile_data.cpp
+++ b/src/mbgl/map/vector_tile_data.cpp
@@ -6,6 +6,7 @@
#include <mbgl/map/source.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/platform/log.hpp>
+#include <mbgl/text/collision.hpp>
#include <mbgl/util/pbf.hpp>
using namespace mbgl;
@@ -19,12 +20,13 @@ VectorTileData::VectorTileData(const TileID& id_,
util::ptr<Sprite> sprite_,
const SourceInfo& source_)
: TileData(id_, source_),
+ depth(id_.z >= source_.max_zoom ? mapMaxZoom - id_.z : 1),
glyphAtlas(glyphAtlas_),
glyphStore(glyphStore_),
spriteAtlas(spriteAtlas_),
sprite(sprite_),
style(style_),
- depth(id.z >= source.max_zoom ? mapMaxZoom - id.z : 1) {
+ collision(util::make_unique<Collision>(id_.z, 4096, source_.tile_size, depth)) {
}
VectorTileData::~VectorTileData() {
@@ -35,7 +37,7 @@ VectorTileData::~VectorTileData() {
}
void VectorTileData::parse() {
- if (state != State::loaded && state != State::partial) {
+ if (getState() != State::loaded && getState() != State::partial) {
return;
}
@@ -48,24 +50,24 @@ void VectorTileData::parse() {
TileParser parser(*vt, *this, style, glyphAtlas, glyphStore, spriteAtlas, sprite);
parser.parse();
- if (state == State::obsolete) {
+ if (getState() == State::obsolete) {
return;
}
if (parser.isPartialParse()) {
- state = State::partial;
+ setState(State::partial);
} else {
- state = State::parsed;
+ setState(State::parsed);
}
} catch (const std::exception& ex) {
Log::Error(Event::ParseTile, "Parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what());
- state = State::obsolete;
+ setState(State::obsolete);
return;
}
}
Bucket* VectorTileData::getBucket(StyleLayer const& layer) {
- if (!ready() || !layer.bucket) {
+ if (!isReady() || !layer.bucket) {
return nullptr;
}
@@ -91,3 +93,11 @@ void VectorTileData::setBucket(StyleLayer const& layer, std::unique_ptr<Bucket>
buckets[layer.bucket->name] = std::move(bucket);
}
+
+void VectorTileData::setState(const State& state_) {
+ TileData::setState(state_);
+
+ if (isImmutable()) {
+ collision.reset();
+ }
+}