Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Check for matching source when parsing tiles (fixes #1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Jul 2, 2015
1 parent 4870bcc commit 1087924
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/mbgl/map/live_tile_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ LiveTileData::LiveTileData(const TileID& id_,
: TileData(id_),
worker(style_.workers),
tileWorker(id_,
source_.source_id,
source_.max_zoom,
style_,
style_.layers,
source_.max_zoom,
state,
std::make_unique<CollisionTile>(id_.z, 4096,
source_.tile_size * id.overscaling,
Expand Down
10 changes: 7 additions & 3 deletions src/mbgl/map/tile_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@

using namespace mbgl;

TileWorker::TileWorker(const TileID& id_,
TileWorker::TileWorker(TileID id_,
std::string sourceID_,
const uint16_t maxZoom_,
Style& style_,
std::vector<util::ptr<StyleLayer>> layers_,
const uint16_t maxZoom_,
const std::atomic<TileData::State>& state_,
std::unique_ptr<CollisionTile> collision_)
: layers(std::move(layers_)),
style(style_),
id(id_),
sourceID(sourceID_),
maxZoom(maxZoom_),
style(style_),
state(state_),
collision(std::move(collision_)) {
assert(style.sprite);
Expand Down Expand Up @@ -121,6 +123,8 @@ void TileWorker::parseLayer(const StyleLayer& layer, const GeometryTile& geometr
const StyleBucket& styleBucket = *layer.bucket;

// Skip this bucket if we are to not render this
if (styleBucket.source != sourceID)
return;
if (id.z < std::floor(styleBucket.min_zoom) && std::floor(styleBucket.min_zoom) < maxZoom)
return;
if (id.z >= std::ceil(styleBucket.max_zoom))
Expand Down
10 changes: 6 additions & 4 deletions src/mbgl/map/tile_worker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ using TileParseResult = mapbox::util::variant<

class TileWorker : public util::noncopyable {
public:
TileWorker(const TileID&,
TileWorker(TileID,
std::string sourceID,
uint16_t maxZoom,
Style&,
std::vector<util::ptr<StyleLayer>>,
const uint16_t maxZoom,
const std::atomic<TileData::State>&,
std::unique_ptr<CollisionTile>);
~TileWorker();
Expand All @@ -57,10 +58,11 @@ class TileWorker : public util::noncopyable {
template <class Bucket>
void addBucketGeometries(Bucket&, const GeometryTileLayer&, const FilterExpression&);

Style& style;

const TileID id;
const std::string sourceID;
const uint16_t maxZoom;

Style& style;
const std::atomic<TileData::State>& state;

bool partialParse = false;
Expand Down
3 changes: 2 additions & 1 deletion src/mbgl/map/vector_tile_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ VectorTileData::VectorTileData(const TileID& id_,
: TileData(id_),
worker(style_.workers),
tileWorker(id_,
source_.source_id,
source_.max_zoom,
style_,
style_.layers,
source_.max_zoom,
state,
std::make_unique<CollisionTile>(id_.z, 4096,
source_.tile_size * id.overscaling,
Expand Down

0 comments on commit 1087924

Please sign in to comment.