Maps Perspective Change
This example demonstrates how to toggle the map view angle between 2D (vertical look-down at the map) and 3D (perspective, tilted map, looking towards the horizon).
UI and Map Integration
The MainActivity
overrides the onCreate()
function, which defines a button to toggle between 2D (vertical) and 3D (perspective/tilted) map modes.
The map starts in 2D mode (EViewPerspective.TwoDimensional), and the button shows "3D" to indicate that pressing it will switch the map to 3D mode (EViewPerspective.ThreeDimensional).
When the user presses the button, the map perspective is changed based on the currentPerspective
and using the method setMapViewPerspective
from the Map View preferences.
The Animation(EAnimation.Linear, 300)
defines the animation type and duration of the perspective change.
Every functionality using Maps SDK must be executed on the same thread as the map engine runs using SdkCall.execute
to place the desired functionality on the correct thread.
Not using SdkCall.execute
will result in an exception and the program will stop.