Skip to content

Commit

Permalink
[linux] Added world tour to GLFW test app
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Mar 14, 2016
1 parent 78a12d9 commit 7a509b0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions platform/default/glfw_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <mbgl/platform/platform.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/map/camera.hpp>

#include <cassert>
#include <cstdlib>
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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<mbgl::LatLng> 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;
}
}

Expand Down

0 comments on commit 7a509b0

Please sign in to comment.