From 7a509b036937a5b85d74cc13301932b081d1a34a Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Sun, 13 Mar 2016 18:48:21 +0200 Subject: [PATCH] [linux] Added world tour to GLFW test app --- platform/default/glfw_view.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index a931928d6..08b7daf7a 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -94,6 +95,7 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_) printf("- Press `N` to reset north\n"); printf("- Press `R` to toggle any available `night` style class\n"); printf("- Press `Z` to cycle through north orientations\n"); + printf("- Press `A` to cycle through Mapbox offices in the world + dateline monument\n"); printf("\n"); printf("- Press `1` through `6` to add increasing numbers of point annotations for testing\n"); printf("- Press `7` through `0` to add increasing numbers of shape annotations for testing\n"); @@ -167,6 +169,26 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, case GLFW_KEY_P: { view->addRandomCustomPointAnnotations(1); } break; + case GLFW_KEY_A: { + // XXX Fix precision loss in flyTo: + // https://github.com/mapbox/mapbox-gl-native/issues/4298 + static const std::vector places = { + mbgl::LatLng { -16.796665, -179.999983 }, // Dateline monument + mbgl::LatLng { 12.9810542, 77.6345551 }, // Mapbox Bengaluru, India + mbgl::LatLng { -13.15607,-74.21773 }, // Mapbox Peru + mbgl::LatLng { 37.77572, -122.4158818 }, // Mapbox SF, USA + mbgl::LatLng { 38.91318,-77.03255 }, // Mapbox DC, USA + }; + static size_t nextPlace = 0; + mbgl::CameraOptions cameraOptions; + cameraOptions.center = places[nextPlace++]; + cameraOptions.zoom = 20; + cameraOptions.pitch = 30; + + mbgl::AnimationOptions animationOptions(mbgl::Seconds(10)); + view->map->flyTo(cameraOptions, animationOptions); + nextPlace = nextPlace % places.size(); + } break; } }