Package com.navmii.sdk.map
Class MapView.CameraController
java.lang.Object
com.navmii.sdk.map.MapView.CameraController
- Enclosing class:
- MapView
public final class MapView.CameraController
extends java.lang.Object
CameraController provides the ability to manage map rotation, tilt and zoom via
changing the camera position (heading, tilt and zoom) instantly or animated.
It also allows to listen to the camera position changes which can be invoked:
- by the user interaction with the map (gestures)
- by animating or moving the camera using methods of CameraController
- by the SDK itself (for example, when option to follow the GPS postion is set in MapView).
-
Field Summary
Fields Modifier and Type Field Description static float
DEFAULT_ANIMATION_DURATION
-
Method Summary
Modifier and Type Method Description void
addCameraMovementListener(MapView.CameraMovementListener listener)
Adds a listener responding to events described in theMapView.CameraMovementListener
interface.void
animateCamera(CameraPosition cameraPosition)
Changes the camera position with animation.void
animateCamera(CameraPosition cameraPosition, float duration, MapView.CameraAnimationListener cameraAnimationListener)
Changes the camera position with animation and notifies the listener when the animation is finished.void
animateCamera(CameraPosition cameraPosition, MapView.CameraAnimationListener cameraAnimationListener)
Changes the camera position with animation and notifies the specified listener when the animation is finished.CameraPosition
getCameraPosition()
Returns the current camera position.CameraPosition
getCameraPositionForMapRectangle(MapRectangle mapRectangle, float heading, float tilt)
CameraPosition
getCameraPositionForMapRectangle(MapRectangle mapRectangle, float heading, float tilt, android.graphics.Rect padding, float lowestZoomLevel)
void
moveCamera(CameraPosition cameraPosition)
Changes the camera position instantly, without animation.void
removeCameraMovementListener(MapView.CameraMovementListener listener)
Removes the specified listener from the list.void
stopAnimation()
Stops all the currently performing animations.
-
Field Details
-
DEFAULT_ANIMATION_DURATION
public static final float DEFAULT_ANIMATION_DURATION- See Also:
- Constant Field Values
-
-
Method Details
-
getCameraPosition
Returns the current camera position. SeeCameraPosition
for more information.- Returns:
- The camera position.
-
getCameraPositionForMapRectangle
public CameraPosition getCameraPositionForMapRectangle(MapRectangle mapRectangle, float heading, float tilt) -
getCameraPositionForMapRectangle
public CameraPosition getCameraPositionForMapRectangle(MapRectangle mapRectangle, float heading, float tilt, android.graphics.Rect padding, float lowestZoomLevel) -
moveCamera
Changes the camera position instantly, without animation.- Parameters:
cameraPosition
- The new position of the camera.
-
animateCamera
Changes the camera position with animation. The default animation duration is 0.5f seconds.- Parameters:
cameraPosition
- The new position of the camera.
-
animateCamera
public void animateCamera(CameraPosition cameraPosition, @Nullable MapView.CameraAnimationListener cameraAnimationListener)Changes the camera position with animation and notifies the specified listener when the animation is finished. The default animation duration is 0.5f seconds.- Parameters:
cameraPosition
- The new position of the camera.cameraAnimationListener
- The listener to notify when the animation ends. This parameter may be null. SeeMapView.CameraAnimationListener
for more information.
-
animateCamera
public void animateCamera(CameraPosition cameraPosition, float duration, MapView.CameraAnimationListener cameraAnimationListener)Changes the camera position with animation and notifies the listener when the animation is finished.- Parameters:
cameraPosition
- The new position of the camera.duration
- The total duration of the animation, measured in seconds. If you specify 0, the changes are made without animation.cameraAnimationListener
- The listener to notify the animation ends. This parameter may be null. SeeMapView.CameraAnimationListener
for more information.
-
stopAnimation
public void stopAnimation()Stops all the currently performing animations.MapView.CameraAnimationListener.onAnimationEnded(boolean)
will be called with the parameter set to true. -
addCameraMovementListener
Adds a listener responding to events described in theMapView.CameraMovementListener
interface. You can add multiple listeners using this method.- Parameters:
listener
- The listener.
-
removeCameraMovementListener
Removes the specified listener from the list.- Parameters:
listener
- The listener.
-