本文整理汇总了C++中LatLng::wrap方法的典型用法代码示例。如果您正苦于以下问题:C++ LatLng::wrap方法的具体用法?C++ LatLng::wrap怎么用?C++ LatLng::wrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LatLng
的用法示例。
在下文中一共展示了LatLng::wrap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transform
TEST(Transform, UnwrappedLatLng) {
MockView view;
Transform transform(view, ConstrainMode::HeightOnly);
transform.resize({{ 1000, 1000 }});
transform.setScale(2 << 9);
transform.setPitch(0.9);
transform.setLatLng(LatLng(38, -77));
const TransformState& state = transform.getState();
LatLng fromGetLatLng = state.getLatLng();
ASSERT_DOUBLE_EQ(fromGetLatLng.latitude, 38);
ASSERT_DOUBLE_EQ(fromGetLatLng.longitude, -77);
LatLng fromScreenCoordinate = state.screenCoordinateToLatLng({ 500, 500 });
ASSERT_NEAR(fromScreenCoordinate.latitude, 37.999999999999829, 0.0001); // 1.71E-13
ASSERT_NEAR(fromScreenCoordinate.longitude, -76.999999999999773, 0.0001); // 2.27E-13
LatLng wrappedForwards = state.screenCoordinateToLatLng(state.latLngToScreenCoordinate({ 38, 283 }));
ASSERT_NEAR(wrappedForwards.latitude, 37.999999999999716, 0.0001); // 2.84E-13
ASSERT_NEAR(wrappedForwards.longitude, 282.99999999988751, 0.0001); // 1.1249E-11
wrappedForwards.wrap();
ASSERT_NEAR(wrappedForwards.longitude, -77.000000000112493, 0.001); // 1.1249E-11
LatLng wrappedBackwards = state.screenCoordinateToLatLng(state.latLngToScreenCoordinate({ 38, -437 }));
ASSERT_NEAR(wrappedBackwards.latitude, wrappedForwards.latitude, 0.001);
ASSERT_NEAR(wrappedBackwards.longitude, -436.99999999988728, 0.001); // 1.1272E-11
wrappedBackwards.wrap();
ASSERT_NEAR(wrappedBackwards.longitude, -76.99999999988728, 0.001); // 1.1272E-11
}
示例2:
TEST(Transform, UnwrappedLatLng) {
Transform transform;
transform.resize({ 1000, 1000 });
// 0.9 rad ~ 51.56620156 deg
transform.jumpTo(CameraOptions().withCenter(LatLng { 38.0, -77.0 }).withZoom(10.0).withPitch(51.56620156));
const TransformState& state = transform.getState();
LatLng fromGetLatLng = state.getLatLng();
ASSERT_DOUBLE_EQ(fromGetLatLng.latitude(), 38.0);
ASSERT_DOUBLE_EQ(fromGetLatLng.longitude(), -77.0);
LatLng fromScreenCoordinate = state.screenCoordinateToLatLng({ 500, 500 });
ASSERT_NEAR(fromScreenCoordinate.latitude(), 38.0, 1e-8);
ASSERT_NEAR(fromScreenCoordinate.longitude(), -77.0, 1e-8);
LatLng wrappedRightwards = state.screenCoordinateToLatLng(state.latLngToScreenCoordinate({ 38, 283 }));
ASSERT_NEAR(wrappedRightwards.latitude(), 38.0, 1e-8);
ASSERT_NEAR(wrappedRightwards.longitude(), 283.0, 1e-8);
wrappedRightwards.wrap();
ASSERT_NEAR(wrappedRightwards.longitude(), -77.0, 1e-8);
LatLng wrappedLeftwards = state.screenCoordinateToLatLng(state.latLngToScreenCoordinate({ 38, -437 }));
ASSERT_DOUBLE_EQ(wrappedLeftwards.latitude(), wrappedRightwards.latitude());
ASSERT_NEAR(wrappedLeftwards.longitude(), -437.0, 1e-8);
wrappedLeftwards.wrap();
ASSERT_NEAR(wrappedLeftwards.longitude(), -77.0, 1e-8);
}