summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/feature_index.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-07 11:49:22 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-10-11 10:54:58 +0300
commit38e78e25dfa3bc5b69a29029d4e065e72f462c37 (patch)
tree45eb6f881081ab585bb6665b3d49f099fbcb6b43 /src/mbgl/geometry/feature_index.cpp
parent61d8ecefda3a01d0860746af98d632b73c526d98 (diff)
downloadqtlocation-mapboxgl-38e78e25dfa3bc5b69a29029d4e065e72f462c37.tar.gz
[core] No need for feature querying to support multipolygons
Diffstat (limited to 'src/mbgl/geometry/feature_index.cpp')
-rw-r--r--src/mbgl/geometry/feature_index.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp
index 62db3b478d..cd131dde72 100644
--- a/src/mbgl/geometry/feature_index.cpp
+++ b/src/mbgl/geometry/feature_index.cpp
@@ -52,7 +52,7 @@ static bool topDownSymbols(const IndexedSubfeature& a, const IndexedSubfeature&
void FeatureIndex::query(
std::unordered_map<std::string, std::vector<Feature>>& result,
- const GeometryCollection& queryGeometry,
+ const GeometryCoordinates& queryGeometry,
const float bearing,
const double tileSize,
const double scale,
@@ -93,7 +93,7 @@ void FeatureIndex::query(
void FeatureIndex::addFeature(
std::unordered_map<std::string, std::vector<Feature>>& result,
const IndexedSubfeature& indexedFeature,
- const GeometryCollection& queryGeometry,
+ const GeometryCoordinates& queryGeometry,
const optional<std::vector<std::string>>& filterLayerIDs,
const GeometryTileData& geometryTileData,
const CanonicalTileID& tileID,
@@ -128,8 +128,8 @@ void FeatureIndex::addFeature(
}
}
-optional<GeometryCollection> FeatureIndex::translateQueryGeometry(
- const GeometryCollection& queryGeometry,
+optional<GeometryCoordinates> FeatureIndex::translateQueryGeometry(
+ const GeometryCoordinates& queryGeometry,
const std::array<float, 2>& translate,
const style::TranslateAnchorType anchorType,
const float bearing,
@@ -143,13 +143,9 @@ optional<GeometryCollection> FeatureIndex::translateQueryGeometry(
translateVec = util::rotate(translateVec, -bearing);
}
- GeometryCollection translated;
- for (const auto& ring : queryGeometry) {
- translated.emplace_back();
- auto& translatedRing = translated.back();
- for (const auto& p : ring) {
- translatedRing.push_back(p - translateVec);
- }
+ GeometryCoordinates translated;
+ for (const auto& p : queryGeometry) {
+ translated.push_back(p - translateVec);
}
return translated;
}