summaryrefslogtreecommitdiff
path: root/test/map/transform.test.cpp
diff options
context:
space:
mode:
authorGali Nelle <galinelle.mapbox@gmail.com>2020-03-15 18:47:45 +0200
committerGali Nelle <galinelle.mapbox@gmail.com>2020-03-19 16:46:36 +0200
commit8d46773bb57c0b78f5062849d5e9f29682ae9f5f (patch)
treed551f5ba69ce2d9652f72a0cb1dfdc7d2d268fbe /test/map/transform.test.cpp
parent7d77a55fe05266ead14f20d49d9a19a5709d6a8e (diff)
downloadqtlocation-mapboxgl-8d46773bb57c0b78f5062849d5e9f29682ae9f5f.tar.gz
Add additional transformState::latLngToScreenCoordinate getterupstream/galinelle_transformState
This change adds a latLngToScreenCoordinate overload, to retrieve the projected vec4 in additional to the ScreenCoordinate object, that is useful to detect whether the projected latLng is in front or behind the camera.
Diffstat (limited to 'test/map/transform.test.cpp')
-rw-r--r--test/map/transform.test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 506e61aca7..41bf31a032 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -130,6 +130,16 @@ TEST(Transform, PerspectiveProjection) {
point = transform.getState().latLngToScreenCoordinate({37.692872969426375, -76.75823239205641});
ASSERT_NEAR(point.x, 1000.0, 1e-5);
ASSERT_NEAR(point.y, 0.0, 1e-4);
+
+ mbgl::vec4 p;
+ point = transform.getState().latLngToScreenCoordinate({37.692872969426375, -76.75823239205641}, p);
+ ASSERT_NEAR(point.x, 1000.0, 1e-5);
+ ASSERT_NEAR(point.y, 0.0, 1e-4);
+ ASSERT_GT(p[3], 0.0);
+
+ transform.jumpTo(CameraOptions().withCenter(LatLng{38.0, -77.0}).withZoom(18.0).withPitch(51.56620156));
+ point = transform.getState().latLngToScreenCoordinate({7.692872969426375, -76.75823239205641}, p);
+ ASSERT_LT(p[3], 0.0);
}
TEST(Transform, UnwrappedLatLng) {