summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-10-30 11:19:51 -0700
committerChris Loer <chris.loer@gmail.com>2017-10-30 11:19:51 -0700
commiteb59bf0b055df8ed2670e38c3af93e6c913f982b (patch)
tree3f9c46a463710148bbea6464a4a8a043fd01bfc4
parent75ed16f3db666177525ead4af2273ef09062733e (diff)
downloadqtlocation-mapboxgl-upstream/start-collision-query.tar.gz
Switch queryRenderedSymbols to use canonical tile IDsupstream/start-collision-query
-rw-r--r--src/mbgl/geometry/feature_index.cpp4
-rw-r--r--src/mbgl/geometry/feature_index.hpp2
-rw-r--r--src/mbgl/layout/symbol_layout.cpp2
-rw-r--r--src/mbgl/text/collision_index.cpp8
-rw-r--r--src/mbgl/text/collision_index.hpp2
5 files changed, 8 insertions, 10 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp
index ec6a3b5c2c..5ddba511df 100644
--- a/src/mbgl/geometry/feature_index.cpp
+++ b/src/mbgl/geometry/feature_index.cpp
@@ -28,7 +28,7 @@ void FeatureIndex::insert(const GeometryCollection& geometries,
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, 0, 0 }, // TODO: FeatureIndex doesn't need to care about tileIDs or source IDS, make this cleaner
+ 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
{convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)});
}
}
@@ -82,7 +82,7 @@ void FeatureIndex::query(
addFeature(result, indexedFeature, queryGeometry, queryOptions, geometryTileData, tileID, layers, bearing, pixelsToTileUnits);
}
- std::vector<IndexedSubfeature> symbolFeatures = collisionIndex.queryRenderedSymbols(queryGeometry, UnwrappedTileID(0, tileID), sourceID); // TODO: hook up
+ std::vector<IndexedSubfeature> symbolFeatures = collisionIndex.queryRenderedSymbols(queryGeometry, tileID, sourceID);
std::sort(symbolFeatures.begin(), symbolFeatures.end(), topDownSymbols);
for (const auto& symbolFeature : symbolFeatures) {
addFeature(result, symbolFeature, queryGeometry, queryOptions, geometryTileData, tileID, layers, bearing, pixelsToTileUnits);
diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp
index 7d1759a4be..4d58fb83fe 100644
--- a/src/mbgl/geometry/feature_index.hpp
+++ b/src/mbgl/geometry/feature_index.hpp
@@ -28,8 +28,6 @@ public:
uint8_t z;
uint32_t x;
uint32_t y;
- uint8_t overscaledZ;
- int16_t wrap;
};
class FeatureIndex {
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 58c06aa923..f74f2fb8b6 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -295,7 +295,7 @@ 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, tileID.overscaledZ, tileID.wrap };
+ symbolInstances.size(), 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
diff --git a/src/mbgl/text/collision_index.cpp b/src/mbgl/text/collision_index.cpp
index 1d1d1d9a10..0e3966e7de 100644
--- a/src/mbgl/text/collision_index.cpp
+++ b/src/mbgl/text/collision_index.cpp
@@ -235,7 +235,7 @@ void CollisionIndex::insertFeature(CollisionFeature& feature, bool ignorePlaceme
}
}
-std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const GeometryCoordinates& queryGeometry, const UnwrappedTileID& tileID, const std::string& sourceID) const {
+std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const GeometryCoordinates& queryGeometry, const CanonicalTileID& tileID, const std::string& sourceID) const {
std::vector<IndexedSubfeature> result;
if (queryGeometry.empty() || (collisionGrid.empty() && ignoredGrid.empty())) {
return result;
@@ -244,7 +244,7 @@ std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const Geomet
mat4 posMatrix;
mat4 projMatrix;
transformState.getProjMatrix(projMatrix);
- transformState.matrixFor(posMatrix, tileID);
+ transformState.matrixFor(posMatrix, UnwrappedTileID(0, tileID)); // TODO: This probably isn't right, I think it's working right now because both the wrapped and unwrapped version are getting queried, but I haven't thought through why it should work.
matrix::multiply(posMatrix, projMatrix, posMatrix);
GeometryCoordinates polygon;
@@ -272,7 +272,7 @@ std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const Geomet
for (auto& queryResult : features) {
auto& feature = queryResult.first;
- UnwrappedTileID featureTileID(feature.z, feature.x, feature.y); // TODO: Think about overscaling/wrapping
+ CanonicalTileID featureTileID(feature.z, feature.x, feature.y);
if (feature.sourceID == sourceID && featureTileID == tileID) {
thisTileFeatures.push_back(queryResult);
}
@@ -281,7 +281,7 @@ std::vector<IndexedSubfeature> CollisionIndex::queryRenderedSymbols(const Geomet
std::vector<QueryResult> ignoredFeatures = ignoredGrid.query({{minX, minY}, {maxX, maxY}});
for (auto& queryResult : ignoredFeatures) {
auto& feature = queryResult.first;
- UnwrappedTileID featureTileID(feature.z, feature.x, feature.y); // TODO: Think about overscaling/wrapping
+ CanonicalTileID featureTileID(feature.z, feature.x, feature.y);
if (feature.sourceID == sourceID && featureTileID == tileID) {
thisTileFeatures.push_back(queryResult);
}
diff --git a/src/mbgl/text/collision_index.hpp b/src/mbgl/text/collision_index.hpp
index 3a6ad031af..059d6dee1a 100644
--- a/src/mbgl/text/collision_index.hpp
+++ b/src/mbgl/text/collision_index.hpp
@@ -31,7 +31,7 @@ public:
void insertFeature(CollisionFeature& feature, bool ignorePlacement);
- std::vector<IndexedSubfeature> queryRenderedSymbols(const GeometryCoordinates&, const UnwrappedTileID& tileID, const std::string& sourceID) const;
+ std::vector<IndexedSubfeature> queryRenderedSymbols(const GeometryCoordinates&, const CanonicalTileID& tileID, const std::string& sourceID) const;
private: