diff options
-rw-r--r-- | src/mbgl/geometry/feature_index.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/geometry/feature_index.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/text/collision_tile.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/collision_tile.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile.cpp | 5 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile.hpp | 4 | ||||
-rw-r--r-- | test/tile/vector_tile.test.cpp | 10 |
7 files changed, 13 insertions, 23 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index b37bdb5ecc..a04d9e0606 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -59,7 +59,8 @@ void FeatureIndex::query( const optional<std::vector<std::string>>& filterLayerIDs, const GeometryTileData& geometryTileData, const CanonicalTileID& tileID, - const style::Style& style) const { + const style::Style& style, + const CollisionTile* collisionTile) const { mapbox::geometry::box<int16_t> box = mapbox::geometry::envelope(queryGeometry); @@ -154,8 +155,4 @@ void FeatureIndex::addBucketLayerName(const std::string& bucketName, const std:: bucketLayerIDs[bucketName].push_back(layerID); } -void FeatureIndex::setCollisionTile(std::unique_ptr<CollisionTile> collisionTile_) { - collisionTile = std::move(collisionTile_); -} - } // namespace mbgl diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp index 021770c78d..662e78aa2c 100644 --- a/src/mbgl/geometry/feature_index.hpp +++ b/src/mbgl/geometry/feature_index.hpp @@ -42,7 +42,8 @@ public: const optional<std::vector<std::string>>& layerIDs, const GeometryTileData&, const CanonicalTileID&, - const style::Style&) const; + const style::Style&, + const CollisionTile*) const; static optional<GeometryCoordinates> translateQueryGeometry( const GeometryCoordinates& queryGeometry, @@ -53,8 +54,6 @@ public: void addBucketLayerName(const std::string& bucketName, const std::string& layerName); - void setCollisionTile(std::unique_ptr<CollisionTile>); - private: void addFeature( std::unordered_map<std::string, std::vector<Feature>>& result, @@ -67,7 +66,6 @@ private: const float bearing, const float pixelsToTileUnits) const; - std::unique_ptr<CollisionTile> collisionTile; GridIndex<IndexedSubfeature> grid; unsigned int sortIndex = 0; diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp index 419ab31a79..368750c89f 100644 --- a/src/mbgl/text/collision_tile.cpp +++ b/src/mbgl/text/collision_tile.cpp @@ -168,7 +168,7 @@ Box CollisionTile::getTreeBox(const Point<float>& anchor, const CollisionBox& bo }; } -std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const GeometryCoordinates& queryGeometry, float scale) { +std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const GeometryCoordinates& queryGeometry, float scale) const { std::vector<IndexedSubfeature> result; if (queryGeometry.empty() || (tree.empty() && ignoredTree.empty())) { return result; diff --git a/src/mbgl/text/collision_tile.hpp b/src/mbgl/text/collision_tile.hpp index 186cd19d28..ea4324edaf 100644 --- a/src/mbgl/text/collision_tile.hpp +++ b/src/mbgl/text/collision_tile.hpp @@ -42,7 +42,7 @@ public: float placeFeature(const CollisionFeature&, bool allowOverlap, bool avoidEdges); void insertFeature(CollisionFeature&, float minPlacementScale, bool ignorePlacement); - std::vector<IndexedSubfeature> queryRenderedSymbols(const GeometryCoordinates&, float scale); + std::vector<IndexedSubfeature> queryRenderedSymbols(const GeometryCoordinates&, float scale) const; const PlacementConfig config; diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp index 4c5a61672d..9aeb35c821 100644 --- a/src/mbgl/tile/geometry_tile.cpp +++ b/src/mbgl/tile/geometry_tile.cpp @@ -117,7 +117,7 @@ void GeometryTile::onPlacement(PlacementResult result) { availableData = DataAvailability::All; } symbolBuckets = std::move(result.symbolBuckets); - featureIndex->setCollisionTile(std::move(result.collisionTile)); + collisionTile = std::move(result.collisionTile); observer->onTileChanged(*this); } @@ -153,7 +153,8 @@ void GeometryTile::queryRenderedFeatures( layerIDs, *data, id.canonical, - style); + style, + collisionTile.get()); } } // namespace mbgl diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp index 5e7e501e89..c61a510311 100644 --- a/src/mbgl/tile/geometry_tile.hpp +++ b/src/mbgl/tile/geometry_tile.hpp @@ -81,9 +81,11 @@ private: optional<PlacementConfig> requestedConfig; std::unordered_map<std::string, std::shared_ptr<Bucket>> nonSymbolBuckets; - std::unordered_map<std::string, std::shared_ptr<Bucket>> symbolBuckets; std::unique_ptr<FeatureIndex> featureIndex; std::unique_ptr<const GeometryTileData> data; + + std::unordered_map<std::string, std::shared_ptr<Bucket>> symbolBuckets; + std::unique_ptr<CollisionTile> collisionTile; }; } // namespace mbgl diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp index 9732f23b32..e34629bdba 100644 --- a/test/tile/vector_tile.test.cpp +++ b/test/tile/vector_tile.test.cpp @@ -62,14 +62,6 @@ TEST(VectorTile, Issue7615) { auto symbolBucket = std::make_shared<SymbolBucket>( MapMode::Continuous, style::SymbolLayoutProperties::Evaluated(), false, false); - // First onLayout is required so that a non-null FeatureIndex is available. - tile.onLayout(GeometryTile::LayoutResult { - {}, - std::make_unique<FeatureIndex>(), - nullptr, - 0 - }); - // Simulate placement of a symbol layer. tile.onPlacement(GeometryTile::PlacementResult { {{ @@ -80,7 +72,7 @@ TEST(VectorTile, Issue7615) { 0 }); - // Second onLayout should not cause the existing symbol bucket to be discarded. + // Subsequent onLayout should not cause the existing symbol bucket to be discarded. tile.onLayout(GeometryTile::LayoutResult { {}, nullptr, |