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.

    • 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.

      • 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