[core] When reparsing a tile, replace all existing buckets
A tile may go from having particular layers, to not having them. (Annotation tiles in particular.)
This commit is contained in:
@@ -287,6 +287,6 @@ void TileWorker::createSymbolBucket(const GeometryTileLayer& layer,
|
||||
|
||||
void TileWorker::insertBucket(const std::string& name, std::unique_ptr<Bucket> bucket) {
|
||||
if (bucket->hasData()) {
|
||||
result.buckets.emplace_back(name, std::move(bucket));
|
||||
result.buckets.emplace(name, std::move(bucket));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class GeometryTileLayer;
|
||||
class TileParseResultBuckets {
|
||||
public:
|
||||
TileData::State state = TileData::State::invalid;
|
||||
std::vector<std::pair<std::string, std::unique_ptr<Bucket>>> buckets;
|
||||
std::unordered_map<std::string, std::unique_ptr<Bucket>> buckets;
|
||||
};
|
||||
|
||||
using TileParseResult = mapbox::util::variant<TileParseResultBuckets, // success
|
||||
|
||||
@@ -39,6 +39,7 @@ VectorTileData::VectorTileData(const TileID& id_,
|
||||
|
||||
if (!tile) {
|
||||
state = State::parsed;
|
||||
buckets.clear();
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
@@ -69,9 +70,7 @@ VectorTileData::VectorTileData(const TileID& id_,
|
||||
|
||||
// Move over all buckets we received in this parse request, potentially overwriting
|
||||
// existing buckets in case we got a refresh parse.
|
||||
for (auto& bucket : resultBuckets.buckets) {
|
||||
buckets[bucket.first] = std::move(bucket.second);
|
||||
}
|
||||
buckets = std::move(resultBuckets.buckets);
|
||||
|
||||
// The target configuration could have changed since we started placement. In this case,
|
||||
// we're starting another placement run.
|
||||
|
||||
Reference in New Issue
Block a user