diff options
author | Chris Loer <chris.loer@gmail.com> | 2017-11-13 15:08:08 -0800 |
---|---|---|
committer | Chris Loer <chris.loer@gmail.com> | 2017-11-13 15:08:08 -0800 |
commit | 20e7039734ce5983d43ab8f4e540483708719db8 (patch) | |
tree | 926c38c539df0ec96ba1892574952f22142a8d59 | |
parent | 0fc047db15baf31f51d911625f3bfe50ed2f28b5 (diff) | |
download | qtlocation-mapboxgl-20e7039734ce5983d43ab8f4e540483708719db8.tar.gz |
Make CanonicalTileID members non-const in order to be swap-able.
Use CanonicalTileID instead of bare z/x/y in IndexedSubfeature.
-rw-r--r-- | include/mbgl/tile/tile_id.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/geometry/feature_index.hpp | 14 | ||||
-rw-r--r-- | src/mbgl/layout/symbol_layout.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/collision_index.cpp | 6 |
4 files changed, 10 insertions, 18 deletions
diff --git a/include/mbgl/tile/tile_id.hpp b/include/mbgl/tile/tile_id.hpp index 0457dd3a07..11fb5ce537 100644 --- a/include/mbgl/tile/tile_id.hpp +++ b/include/mbgl/tile/tile_id.hpp @@ -30,9 +30,9 @@ public: CanonicalTileID scaledTo(uint8_t z) const; std::array<CanonicalTileID, 4> children() const; - const uint8_t z; - const uint32_t x; - const uint32_t y; + uint8_t z; + uint32_t x; + uint32_t y; }; ::std::ostream& operator<<(::std::ostream& os, const CanonicalTileID& rhs); diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp index 07dc1b1558..e95bb94da6 100644 --- a/src/mbgl/geometry/feature_index.hpp +++ b/src/mbgl/geometry/feature_index.hpp @@ -25,21 +25,17 @@ public: , sourceLayerName(std::move(sourceLayerName_)) , bucketName(std::move(bucketName_)) , sortIndex(sortIndex_) - , z(0) - , x(0) - , y(0) + , tileID(0, 0, 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_) + std::string sourceID_, CanonicalTileID tileID_) : index(index_) , sourceLayerName(std::move(sourceLayerName_)) , bucketName(std::move(bucketName_)) , sortIndex(std::move(sortIndex_)) , sourceID(std::move(sourceID_)) - , z(z_) - , x(x_) - , y(y_) + , tileID(std::move(tileID_)) {} size_t index; @@ -49,9 +45,7 @@ public: // Only used for symbol features std::string sourceID; - uint8_t z; - uint32_t x; - uint32_t y; + CanonicalTileID tileID; }; class FeatureIndex { diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index d84b74d42a..bdd5933987 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -293,7 +293,7 @@ void SymbolLayout::addFeature(const std::size_t index, const float textRepeatDistance = symbolSpacing / 2; IndexedSubfeature indexedFeature(feature.index, sourceLayer->getName(), bucketName, symbolInstances.size(), - sourceID, tileID.canonical.z, tileID.canonical.x, tileID.canonical.y); + sourceID, tileID.canonical); auto addSymbolInstance = [&] (const GeometryCoordinates& line, Anchor& anchor) { // https://github.com/mapbox/vector-tile-spec/tree/master/2.1#41-layers diff --git a/src/mbgl/text/collision_index.cpp b/src/mbgl/text/collision_index.cpp index 17663363b6..fee28b5873 100644 --- a/src/mbgl/text/collision_index.cpp +++ b/src/mbgl/text/collision_index.cpp @@ -288,8 +288,7 @@ std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const Geomet for (auto& queryResult : features) { auto& feature = queryResult.first; - CanonicalTileID featureTileID(feature.z, feature.x, feature.y); - if (feature.sourceID == sourceID && featureTileID == tileID.canonical) { + if (feature.sourceID == sourceID && feature.tileID == tileID.canonical) { // We only have to filter on the canonical ID because even if the feature is showing multiple times // we treat it as one feature. thisTileFeatures.push_back(queryResult); @@ -299,8 +298,7 @@ std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const Geomet std::vector<QueryResult> ignoredFeatures = ignoredGrid.queryWithBoxes(envelope); for (auto& queryResult : ignoredFeatures) { auto& feature = queryResult.first; - CanonicalTileID featureTileID(feature.z, feature.x, feature.y); - if (feature.sourceID == sourceID && featureTileID == tileID.canonical) { + if (feature.sourceID == sourceID && feature.tileID == tileID.canonical) { thisTileFeatures.push_back(queryResult); } } |