From bc45d65c58692cf0e21b4a932e4ba7bb674f12ba Mon Sep 17 00:00:00 2001 From: galinelle Date: Thu, 19 Mar 2020 18:53:09 +0200 Subject: Add additional transformState::latLngToScreenCoordinate getter (#16311) 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. --- test/map/transform.test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') 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) { -- cgit v1.2.1