diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/geometry/feature_index.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/geometry/feature_index.hpp | 28 | ||||
-rw-r--r-- | src/mbgl/layout/symbol_layout.cpp | 4 |
3 files changed, 29 insertions, 6 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index 1d80c055b0..c2ffe0412e 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -26,9 +26,8 @@ void FeatureIndex::insert(const GeometryCollection& geometries, const std::string& sourceLayerName, const std::string& bucketName) { for (const auto& ring : geometries) { - // TODO: Templatize grid units so feature index can stick with integers? auto envelope = mapbox::geometry::envelope(ring); - grid.insert(IndexedSubfeature { index, "", sourceLayerName, bucketName, sortIndex++, 0, 0, 0 }, // TODO: FeatureIndex doesn't need to care about tileIDs or source IDS, make this cleaner + grid.insert(IndexedSubfeature(index, sourceLayerName, bucketName, sortIndex++), {convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)}); } } diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp index 4d58fb83fe..5cf7b14d8c 100644 --- a/src/mbgl/geometry/feature_index.hpp +++ b/src/mbgl/geometry/feature_index.hpp @@ -20,11 +20,35 @@ class CollisionIndex; class IndexedSubfeature { public: IndexedSubfeature() = delete; - std::size_t index; - std::string sourceID; + IndexedSubfeature(std::size_t index_, std::string sourceLayerName_, std::string bucketName_, size_t sortIndex_) + : index(index_) + , sourceLayerName(std::move(sourceLayerName_)) + , bucketName(std::move(bucketName_)) + , sortIndex(sortIndex_) + , z(0) + , x(0) + , y(0) + {} + + IndexedSubfeature(std::size_t index_, std::string sourceLayerName_, std::string bucketName_, size_t sortIndex_, + std::string sourceID_, uint8_t z_, uint32_t x_, uint32_t y_) + : index(index_) + , sourceLayerName(std::move(sourceLayerName_)) + , bucketName(std::move(bucketName_)) + , sortIndex(std::move(sortIndex_)) + , sourceID(sourceID_) + , z(z_) + , x(x_) + , y(y_) + {} + + size_t index; std::string sourceLayerName; std::string bucketName; size_t sortIndex; + + // Only used for symbol features + std::string sourceID; uint8_t z; uint32_t x; uint32_t y; diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 6aed6bbead..747a46064f 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -292,8 +292,8 @@ void SymbolLayout::addFeature(const std::size_t index, : layout.get<SymbolPlacement>(); const float textRepeatDistance = symbolSpacing / 2; - IndexedSubfeature indexedFeature = { feature.index, sourceID, sourceLayer->getName(), bucketName, - symbolInstances.size(), tileID.canonical.z, tileID.canonical.x, tileID.canonical.y }; + IndexedSubfeature indexedFeature(feature.index, sourceLayer->getName(), bucketName, symbolInstances.size(), + sourceID, tileID.canonical.z, tileID.canonical.x, tileID.canonical.y); auto addSymbolInstance = [&] (const GeometryCoordinates& line, Anchor& anchor) { // https://github.com/mapbox/vector-tile-spec/tree/master/2.1#41-layers |