summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-10-07 13:46:42 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-10-11 09:55:32 +0300
commitefc1bff65f1667b59e3045c5258b2aa1dd9532b5 (patch)
tree837ef925e93a90e3a6dcabc8770dd5b6f72ff15a
parent22b7436acf3162b13aad1e9eb31eb91d794ac5fd (diff)
downloadqtlocation-mapboxgl-efc1bff65f1667b59e3045c5258b2aa1dd9532b5.tar.gz
[core] Ignore placement for symbol annotations
-rw-r--r--src/mbgl/annotation/annotation_manager.cpp1
-rw-r--r--test/api/annotations.test.cpp25
2 files changed, 26 insertions, 0 deletions
diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp
index 63adf9de2a..dbd5f1f433 100644
--- a/src/mbgl/annotation/annotation_manager.cpp
+++ b/src/mbgl/annotation/annotation_manager.cpp
@@ -185,6 +185,7 @@ void AnnotationManager::updateStyle(Style& style) {
layer->setSourceLayer(PointLayerID);
layer->setIconImage({"{sprite}"});
layer->setIconAllowOverlap(true);
+ layer->setIconIgnorePlacement(true);
layer->impl->spriteAtlas = &spriteAtlas;
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index 5b9fe7502e..b82a7adaca 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -341,3 +341,28 @@ TEST(Annotations, QueryRenderedFeatures) {
EXPECT_TRUE(!!features2[0].id);
EXPECT_EQ(*features2[0].id, 1);
}
+
+TEST(Annotations, QueryFractionalZoomLevels) {
+ AnnotationTest test;
+
+ auto viewSize = test.view.getSize();
+ auto box = ScreenBox { {}, { double(viewSize[0]), double(viewSize[1]) } };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));
+
+ std::vector<mbgl::AnnotationID> ids;
+ for (int longitude = 0; longitude < 10; ++longitude) {
+ for (int latitude = 0; latitude < 10; ++latitude) {
+ ids.push_back(test.map.addAnnotation(SymbolAnnotation { { double(latitude), double(longitude) }, "default_marker" }));
+ }
+ }
+
+ test.map.setLatLngZoom({ 5, 5 }, 0);
+ for (uint16_t zoomSteps = 0; zoomSteps <= 20; ++zoomSteps) {
+ test.map.setZoom(zoomSteps / 10.0);
+ test::render(test.map);
+ auto features = test.map.queryRenderedFeatures(box);
+ EXPECT_EQ(features.size(), ids.size());
+ }
+}