Class NavigationCamera
-
- All Implemented Interfaces:
@UiThread() public class NavigationCamera
Updates the map camera while navigating.
This class listens to the progress of TrimbleMapsNavigation and moves the TrimbleMapsMap camera based on the location updates.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public @interfaceNavigationCamera.TrackingMode
-
Field Summary
Fields Modifier and Type Field Description public final static intNAVIGATION_TRACKING_MODE_GPSpublic final static intNAVIGATION_TRACKING_MODE_NORTHpublic final static intNAVIGATION_TRACKING_MODE_NONE
-
Constructor Summary
Constructors Constructor Description NavigationCamera(TrimbleMapsMap trimbleMapsMap)Creates an instance of NavigationCamera.
-
Method Summary
Modifier and Type Method Description voidstart(@Nullable() DirectionsRoute route)Called when beginning navigation with a route. voidresume(@Nullable() Location location)Called during rotation to update route information. voidupdateCameraTrackingMode(int trackingMode)Updates the TrackingMode that's going to be used when camera tracking is enabled. booleanisTrackingEnabled()Getter for current state of tracking. intgetCameraTrackingMode()Getter for TrackingMode that's being used when tracking is enabled. voidresetCameraPositionWith(int trackingMode)Resets the map camera / padding to the last known camera position. booleanshowRouteGeometryOverview(@NonNull() Array<int> padding)This method stops the map camera from tracking the current location, and then zooms out to an overview of the current route being traveled. voidupdate(@NonNull() NavigationCameraUpdate update)Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight. voidupdate(@NonNull() NavigationCameraUpdate update, int durationMs)Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight. voidupdate(@NonNull() NavigationCameraUpdate update, int durationMs, @Nullable() TrimbleMapsMap.CancelableCallback callback)Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight. voidonStart()Call in onStart to properly add the RouteProgressObserver and LocationObserver for the camera and prevent any leaks or further updates. voidonStop()Call in onStop to properly remove the RouteProgressObserver and LocationObserver for the camera and prevent any leaks or further updates. voidaddProgressChangeListener(@NonNull() TrimbleMapsNavigation navigation)This method can be called if you did not pass an instance of TrimbleMapsNavigation to the constructor. voidremoveProgressChangeListener()Removes the previously registered progress change listener. voidaddOnTrackingModeTransitionListener(@NonNull() OnTrackingModeTransitionListener listener)Adds given tracking mode transition listener for receiving notification of camera transition updates. voidremoveOnTrackingModeTransitionListener(@NonNull() OnTrackingModeTransitionListener listener)Removes given tracking mode transition listener for receiving notification of camera transition updates. voidaddOnTrackingModeChangedListener(@NonNull() OnTrackingModeChangedListener listener)Adds given tracking mode changed listener for receiving notification of camera mode changes. voidremoveOnTrackingModeChangedListener(@NonNull() OnTrackingModeChangedListener listener)Removes given tracking mode transition listener for receiving notification of camera mode changes. voidsetCamera(Camera camera)
-
-
-
Constructor Detail
-
NavigationCamera
NavigationCamera(TrimbleMapsMap trimbleMapsMap)
Creates an instance of NavigationCamera.- Parameters:
trimbleMapsMap- for moving the camera
-
-
Method Detail
-
start
void start(@Nullable() DirectionsRoute route)
Called when beginning navigation with a route.
- Parameters:
route- used to update route information
-
resume
void resume(@Nullable() Location location)
Called during rotation to update route information.
- Parameters:
location- used to update route information
-
updateCameraTrackingMode
void updateCameraTrackingMode(int trackingMode)
Updates the TrackingMode that's going to be used when camera tracking is enabled.
- Parameters:
trackingMode- the tracking mode
-
isTrackingEnabled
boolean isTrackingEnabled()
Getter for current state of tracking.
-
getCameraTrackingMode
int getCameraTrackingMode()
Getter for TrackingMode that's being used when tracking is enabled.
-
resetCameraPositionWith
void resetCameraPositionWith(int trackingMode)
Resets the map camera / padding to the last known camera position.
You can also specify a tracking mode to reset with. For example if you would like to reset the camera and continue tracking, you would use NAVIGATION_TRACKING_MODE_GPS.
- Parameters:
trackingMode- the tracking mode
-
showRouteGeometryOverview
boolean showRouteGeometryOverview(@NonNull() Array<int> padding)
This method stops the map camera from tracking the current location, and then zooms out to an overview of the current route being traveled.
- Parameters:
padding- in pixels around the bounding box of the overview (left, top, right, bottom)
-
update
void update(@NonNull() NavigationCameraUpdate update)
Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight. If the camera is in a tracking mode, this animation is going to be ignored, or break the tracking, based on the CameraUpdateMode.
- Parameters:
update- the change that should be applied to the camera.
-
update
void update(@NonNull() NavigationCameraUpdate update, int durationMs)
Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight. The animation will last a specified amount of time given in milliseconds. If the camera is in a tracking mode, this animation is going to be ignored, or break the tracking, based on the CameraUpdateMode.
- Parameters:
update- the change that should be applied to the camera.durationMs- the duration of the animation in milliseconds.
-
update
void update(@NonNull() NavigationCameraUpdate update, int durationMs, @Nullable() TrimbleMapsMap.CancelableCallback callback)
Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight. The animation will last a specified amount of time given in milliseconds. A callback can be used to be notified when animating the camera stops. During the animation, a call to getCameraPosition returns an intermediate location of the camera in flight. If the camera is in a tracking mode, this animation is going to be ignored, or break the tracking, based on the CameraUpdateMode.
- Parameters:
update- the change that should be applied to the camera.durationMs- the duration of the animation in milliseconds.callback- an optional callback to be notified from the main thread when the animation stops.
-
onStart
void onStart()
Call in onStart to properly add the RouteProgressObserver and LocationObserver for the camera and prevent any leaks or further updates.
-
onStop
void onStop()
Call in onStop to properly remove the RouteProgressObserver and LocationObserver for the camera and prevent any leaks or further updates.
-
addProgressChangeListener
void addProgressChangeListener(@NonNull() TrimbleMapsNavigation navigation)
This method can be called if you did not pass an instance of TrimbleMapsNavigation to the constructor.
The camera will begin listening to progress updates and update the route accordingly.
- Parameters:
navigation- to add the camera progress change listener
-
removeProgressChangeListener
void removeProgressChangeListener()
Removes the previously registered progress change listener.
-
addOnTrackingModeTransitionListener
void addOnTrackingModeTransitionListener(@NonNull() OnTrackingModeTransitionListener listener)
Adds given tracking mode transition listener for receiving notification of camera transition updates.
- Parameters:
listener- to be added
-
removeOnTrackingModeTransitionListener
void removeOnTrackingModeTransitionListener(@NonNull() OnTrackingModeTransitionListener listener)
Removes given tracking mode transition listener for receiving notification of camera transition updates.
- Parameters:
listener- to be removed
-
addOnTrackingModeChangedListener
void addOnTrackingModeChangedListener(@NonNull() OnTrackingModeChangedListener listener)
Adds given tracking mode changed listener for receiving notification of camera mode changes.
- Parameters:
listener- to be added
-
removeOnTrackingModeChangedListener
void removeOnTrackingModeChangedListener(@NonNull() OnTrackingModeChangedListener listener)
Removes given tracking mode transition listener for receiving notification of camera mode changes.
- Parameters:
listener- to be removed
-
-