summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/circle_layer_impl.cpp
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-04-12 12:31:51 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-04-19 17:21:28 -0700
commit7ddca3b6116903bae9ecde1d49d29a8f1fedcec3 (patch)
treeefbdeda27dca8238965f6b7e1c263938ebe800d0 /src/mbgl/style/layers/circle_layer_impl.cpp
parentd752235ec790f8c2d4e646c32648253ec64a60c4 (diff)
downloadqtlocation-mapboxgl-7ddca3b6116903bae9ecde1d49d29a8f1fedcec3.tar.gz
[core] account for property functions in query rendered features
Diffstat (limited to 'src/mbgl/style/layers/circle_layer_impl.cpp')
-rw-r--r--src/mbgl/style/layers/circle_layer_impl.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mbgl/style/layers/circle_layer_impl.cpp b/src/mbgl/style/layers/circle_layer_impl.cpp
index ea1d4eeb65..2dde632f6e 100644
--- a/src/mbgl/style/layers/circle_layer_impl.cpp
+++ b/src/mbgl/style/layers/circle_layer_impl.cpp
@@ -29,25 +29,24 @@ std::unique_ptr<Bucket> CircleLayer::Impl::createBucket(const BucketParameters&
return std::make_unique<CircleBucket>(parameters, layers);
}
-float CircleLayer::Impl::getQueryRadius() const {
- const std::array<float, 2>& translate = paint.evaluated.get<CircleTranslate>();
- return paint.evaluated.get<CircleRadius>().constantOr(CircleRadius::defaultValue())
- + util::length(translate[0], translate[1]);
-}
-
-bool CircleLayer::Impl::queryIntersectsGeometry(
+bool CircleLayer::Impl::queryIntersectsFeature(
const GeometryCoordinates& queryGeometry,
- const GeometryCollection& geometry,
+ const GeometryTileFeature& feature,
+ const float zoom,
const float bearing,
const float pixelsToTileUnits) const {
+ // Translate query geometry
auto translatedQueryGeometry = FeatureIndex::translateQueryGeometry(
queryGeometry, paint.evaluated.get<CircleTranslate>(), paint.evaluated.get<CircleTranslateAnchor>(), bearing, pixelsToTileUnits);
- auto circleRadius = paint.evaluated.get<CircleRadius>().constantOr(CircleRadius::defaultValue()) * pixelsToTileUnits;
+ // Evaluate function
+ auto circleRadius = paint.evaluated.get<CircleRadius>()
+ .evaluate(feature, zoom, CircleRadius::defaultValue())
+ * pixelsToTileUnits;
- return util::polygonIntersectsBufferedMultiPoint(
- translatedQueryGeometry.value_or(queryGeometry), geometry, circleRadius);
+ // Test intersection
+ return util::polygonIntersectsBufferedMultiPoint(translatedQueryGeometry.value_or(queryGeometry), feature.getGeometries(), circleRadius);
}
} // namespace style