summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-03-31 18:17:16 -0700
committerChris Loer <chris.loer@mapbox.com>2018-04-02 10:39:22 -0700
commit11961d5c31e6ec245823b583a4dc5e1b12dd7f5a (patch)
treebba4df37176aeb92d903794969c296df1e7ad2c6 /src
parent7f42e3970ee8c6a57fbb4dba7c564ff17c2eb6bb (diff)
downloadqtlocation-mapboxgl-11961d5c31e6ec245823b583a4dc5e1b12dd7f5a.tar.gz
[core] Consolidate GeometryTile symbol/nonSymbolBuckets
Conversion to one-phase tile loading removed any need to track them separately.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/tile/geometry_tile.cpp12
-rw-r--r--src/mbgl/tile/geometry_tile.hpp12
-rw-r--r--src/mbgl/tile/geometry_tile_worker.cpp9
-rw-r--r--src/mbgl/tile/geometry_tile_worker.hpp2
4 files changed, 11 insertions, 24 deletions
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index f95d7220bd..5089f95022 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -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);
diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp
index 98b5f0c490..0161e00efd 100644
--- a/src/mbgl/tile/geometry_tile.hpp
+++ b/src/mbgl/tile/geometry_tile.hpp
@@ -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;
diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp
index 482cbe0053..f57732117b 100644
--- a/src/mbgl/tile/geometry_tile_worker.cpp
+++ b/src/mbgl/tile/geometry_tile_worker.cpp
@@ -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);
diff --git a/src/mbgl/tile/geometry_tile_worker.hpp b/src/mbgl/tile/geometry_tile_worker.hpp
index 458ec76988..b5417c8114 100644
--- a/src/mbgl/tile/geometry_tile_worker.hpp
+++ b/src/mbgl/tile/geometry_tile_worker.hpp
@@ -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,