[core] Consolidate GeometryTile symbol/nonSymbolBuckets
Conversion to one-phase tile loading removed any need to track them separately.
This commit is contained in:
@@ -131,8 +131,7 @@ void GeometryTile::onLayout(LayoutResult result, const uint64_t resultCorrelatio
|
||||
pending = false;
|
||||
}
|
||||
|
||||
nonSymbolBuckets = std::move(result.nonSymbolBuckets);
|
||||
symbolBuckets = std::move(result.symbolBuckets);
|
||||
buckets = std::move(result.buckets);
|
||||
|
||||
dataPendingCommit = {{ std::move(result.tileData), std::move(result.featureIndex) }};
|
||||
|
||||
@@ -177,11 +176,7 @@ void GeometryTile::upload(gl::Context& context) {
|
||||
}
|
||||
};
|
||||
|
||||
for (auto& entry : nonSymbolBuckets) {
|
||||
uploadFn(*entry.second);
|
||||
}
|
||||
|
||||
for (auto& entry : symbolBuckets) {
|
||||
for (auto& entry : buckets) {
|
||||
uploadFn(*entry.second);
|
||||
}
|
||||
|
||||
@@ -197,7 +192,6 @@ void GeometryTile::upload(gl::Context& context) {
|
||||
}
|
||||
|
||||
Bucket* GeometryTile::getBucket(const Layer::Impl& layer) const {
|
||||
const auto& buckets = layer.type == LayerType::Symbol ? symbolBuckets : nonSymbolBuckets;
|
||||
const auto it = buckets.find(layer.id);
|
||||
if (it == buckets.end()) {
|
||||
return nullptr;
|
||||
@@ -209,7 +203,7 @@ Bucket* GeometryTile::getBucket(const Layer::Impl& layer) const {
|
||||
|
||||
void GeometryTile::commitFeatureIndex() {
|
||||
// We commit our pending FeatureIndex and GeometryTileData when a global placement has run,
|
||||
// synchronizing the global CollisionIndex with the latest symbolBuckets/FeatureIndex/GeometryTileData
|
||||
// synchronizing the global CollisionIndex with the latest buckets/FeatureIndex/GeometryTileData
|
||||
if (dataPendingCommit) {
|
||||
data = std::move(dataPendingCommit->first);
|
||||
featureIndex = std::move(dataPendingCommit->second);
|
||||
|
||||
@@ -65,23 +65,20 @@ public:
|
||||
|
||||
class LayoutResult {
|
||||
public:
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> nonSymbolBuckets;
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> buckets;
|
||||
std::unique_ptr<FeatureIndex> featureIndex;
|
||||
std::unique_ptr<GeometryTileData> tileData;
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> symbolBuckets;
|
||||
optional<AlphaImage> glyphAtlasImage;
|
||||
optional<PremultipliedImage> iconAtlasImage;
|
||||
|
||||
LayoutResult(std::unordered_map<std::string, std::shared_ptr<Bucket>> nonSymbolBuckets_,
|
||||
LayoutResult(std::unordered_map<std::string, std::shared_ptr<Bucket>> buckets_,
|
||||
std::unique_ptr<FeatureIndex> featureIndex_,
|
||||
std::unique_ptr<GeometryTileData> tileData_,
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> symbolBuckets_,
|
||||
optional<AlphaImage> glyphAtlasImage_,
|
||||
optional<PremultipliedImage> iconAtlasImage_)
|
||||
: nonSymbolBuckets(std::move(nonSymbolBuckets_)),
|
||||
: buckets(std::move(buckets_)),
|
||||
featureIndex(std::move(featureIndex_)),
|
||||
tileData(std::move(tileData_)),
|
||||
symbolBuckets(std::move(symbolBuckets_)),
|
||||
glyphAtlasImage(std::move(glyphAtlasImage_)),
|
||||
iconAtlasImage(std::move(iconAtlasImage_)) {}
|
||||
};
|
||||
@@ -117,8 +114,7 @@ private:
|
||||
|
||||
uint64_t correlationID = 0;
|
||||
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> nonSymbolBuckets;
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> symbolBuckets;
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> buckets;
|
||||
|
||||
optional<std::pair<std::unique_ptr<const GeometryTileData>, std::unique_ptr<FeatureIndex>>> dataPendingCommit;
|
||||
std::unique_ptr<FeatureIndex> featureIndex;
|
||||
|
||||
@@ -328,7 +328,7 @@ void GeometryTileWorker::parse() {
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::unique_ptr<SymbolLayout>> symbolLayoutMap;
|
||||
nonSymbolBuckets.clear();
|
||||
buckets.clear();
|
||||
featureIndex = std::make_unique<FeatureIndex>();
|
||||
BucketParameters parameters { id, mode, pixelRatio };
|
||||
|
||||
@@ -388,7 +388,7 @@ void GeometryTileWorker::parse() {
|
||||
}
|
||||
|
||||
for (const auto& layer : group) {
|
||||
nonSymbolBuckets.emplace(layer->getID(), bucket);
|
||||
buckets.emplace(layer->getID(), bucket);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,8 +448,6 @@ void GeometryTileWorker::performSymbolLayout() {
|
||||
symbolLayoutsNeedPreparation = false;
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> buckets;
|
||||
|
||||
for (auto& symbolLayout : symbolLayouts) {
|
||||
if (obsolete) {
|
||||
return;
|
||||
@@ -471,10 +469,9 @@ void GeometryTileWorker::performSymbolLayout() {
|
||||
firstLoad = false;
|
||||
|
||||
parent.invoke(&GeometryTile::onLayout, GeometryTile::LayoutResult {
|
||||
std::move(nonSymbolBuckets),
|
||||
std::move(buckets),
|
||||
std::move(featureIndex),
|
||||
*data ? (*data)->clone() : nullptr,
|
||||
std::move(buckets),
|
||||
std::move(glyphAtlasImage),
|
||||
std::move(iconAtlasImage)
|
||||
}, correlationID);
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
const float pixelRatio;
|
||||
|
||||
std::unique_ptr<FeatureIndex> featureIndex;
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> nonSymbolBuckets;
|
||||
std::unordered_map<std::string, std::shared_ptr<Bucket>> buckets;
|
||||
|
||||
enum State {
|
||||
Idle,
|
||||
|
||||
Reference in New Issue
Block a user