AutomotiveCameraBehavior (API Reference)
Class AutomotiveCameraBehavior
- All Implemented Interfaces:
CameraBehavior
Provides a high-level camera controller for automotive navigation that manages both tracking
and area camera behaviors. This class acts as a facade, delegating camera operations to either
a TrackingCameraBehavior for following the vehicle during navigation or an AreaCameraBehavior
for showing overview areas such as points of interest or route previews.
The controller supports three states: tracking mode (following the vehicle), area mode (showing geographic regions), or inactive (no automatic camera control). The inactive state allows external control of the camera, such as when responding to user touch events or when UI logic temporarily disables automatic camera behavior.
Camera configuration, including animation durations, zoom policies, and maneuver handling settings, can be provided through a JSON configuration string or file. The configuration is validated and parsed during construction.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the type of camera currently handling camera updates.static enumDefines the visual presentation modes for the camera orientation. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of this class with default camera behaviors and configuration.AutomotiveCameraBehavior(String configJson) Creates a new instance of this class configured from a JSON string. -
Method Summary
Modifier and TypeMethodDescriptionGets the type of camera currently handling camera updates.Gets the currently set normalized principal point to be used during navigation.Gets the current orientation mode.Gets the current view rectangle, if it's set.booleanGets whether maneuver-based camera adjustments are enabled.voidSets the type of camera currently handling camera updates.voidsetAreaCameraBehaviorGeobox(GeoBox geobox) Configures the Area camera to frame the specified geographic bounding box.voidsetAreaCameraBehaviorVisiblePoints(List<GeoCoordinates> points, boolean includeCurrentPosition) Configures the Area camera to frame the specified points.voidsetManeuverDetectionEnabled(boolean value) Sets whether maneuver-based camera adjustments are enabled.voidSets a normalized principal point to be used during navigation.voidSets the orientation mode for the tracking camera.voidsetViewRectangle(Rectangle2D value) Sets a view rectangle for both child cameras.
-
Constructor Details
-
AutomotiveCameraBehavior
public AutomotiveCameraBehavior()Creates a new instance of this class with default camera behaviors and configuration. This constructor automatically creates and configures the underlying
TrackingCameraBehaviorandAreaCameraBehaviorinstances with default settings. -
AutomotiveCameraBehavior
Creates a new instance of this class configured from a JSON string. The JSON configuration is validated during construction and applied to the underlying
TrackingCameraBehaviorandAreaCameraBehaviorinstances.- Parameters:
configJson-A JSON string containing automotive camera configuration settings.
- Throws:
InstantiationErrorException-InstantiationErrorExceptionwhen the JSON is malformed or contains invalid values.
-
-
Method Details
-
setAreaCameraBehaviorVisiblePoints
public void setAreaCameraBehaviorVisiblePoints(@NonNull List<GeoCoordinates> points, boolean includeCurrentPosition) Configures the Area camera to frame the specified points. The camera calculates the optimal zoom level and center position to display all provided coordinates within the viewport. Use this for showing a single point of interest or multiple points such as safety cameras.
This function does not change
getActiveCameraType(). To display the configured area view, setgetActiveCameraType()toAutomotiveCameraBehavior.ActiveCameraType.AREA.Calling this function overrides any previously set geographic bounding box configured via
setAreaCameraBehaviorGeobox(com.here.sdk.core.GeoBox).- Parameters:
points-The list of geographic coordinates to display.
includeCurrentPosition-When true, the current vehicle position is included in the visible area calculation, ensuring the vehicle remains visible alongside the provided points.
-
setAreaCameraBehaviorGeobox
Configures the Area camera to frame the specified geographic bounding box. The camera automatically calculates the appropriate zoom level and center position to ensure the entire area is visible within the viewport.
This function does not change
getActiveCameraType(). To display the configured area view, setgetActiveCameraType()toAutomotiveCameraBehavior.ActiveCameraType.AREA.Calling this function overrides any previously set visible points configured via
setAreaCameraBehaviorVisiblePoints(java.util.List<com.here.sdk.core.GeoCoordinates>, boolean).- Parameters:
geobox-The geographic bounding box to display.
-
isManeuverDetectionEnabled
public boolean isManeuverDetectionEnabled()Gets whether maneuver-based camera adjustments are enabled.
When enabled, the tracking camera automatically adjusts zoom and framing to provide better visibility of upcoming turns and maneuvers during navigation. The specific adjustments and their timing are defined in the camera configuration.
If tracking is currently active when this property is changed, the setting takes effect immediately. Otherwise, it will apply the next time tracking is activated. The initial state is determined by the camera configuration provided during construction.
- Returns:
Enables or disables automatic camera adjustments during upcoming maneuvers.
-
setManeuverDetectionEnabled
public void setManeuverDetectionEnabled(boolean value) Sets whether maneuver-based camera adjustments are enabled.
When enabled, the tracking camera automatically adjusts zoom and framing to provide better visibility of upcoming turns and maneuvers during navigation. The specific adjustments and their timing are defined in the camera configuration.
If tracking is currently active when this property is changed, the setting takes effect immediately. Otherwise, it will apply the next time tracking is activated. The initial state is determined by the camera configuration provided during construction.
- Parameters:
value-Enables or disables automatic camera adjustments during upcoming maneuvers.
-
getViewRectangle
Gets the current view rectangle, if it's set.
Defines a sub-space of the screen that the behavior should consider for camera updates. This property is forwarded to both the tracking and area cameras, ensuring consistent viewport constraints across all camera modes. If not set, it uses the viewport bounds of the underlying map view.
- Returns:
The view rectangle for camera updates.
-
setViewRectangle
Sets a view rectangle for both child cameras.
Defines a sub-space of the screen that the behavior should consider for camera updates. This property is forwarded to both the tracking and area cameras, ensuring consistent viewport constraints across all camera modes. If not set, it uses the viewport bounds of the underlying map view.
- Parameters:
value-The view rectangle for camera updates.
-
getActiveCameraType
Gets the type of camera currently handling camera updates.
Defines which camera behavior is currently active:
AutomotiveCameraBehavior.ActiveCameraType.NONE(free navigation),AutomotiveCameraBehavior.ActiveCameraType.TRACKING, orAutomotiveCameraBehavior.ActiveCameraType.AREA.- Returns:
The active camera type.
-
getOrientationMode
Gets the current orientation mode.
Defines the camera's viewing angle and orientation for tracking mode. In
AutomotiveCameraBehavior.OrientationMode.MODE_2D, the camera looks straight down and rotates with the vehicle heading. InAutomotiveCameraBehavior.OrientationMode.MODE_3D, the camera is tilted for a perspective view. InAutomotiveCameraBehavior.OrientationMode.MODE_NORTH_UP, the camera maintains north-up orientation regardless of vehicle heading.Changes to this property take effect immediately on the tracking camera and are preserved when switching between tracking and area modes.
- Returns:
The current orientation mode of the camera.
-
getNormalizedPrincipalPoint
Gets the currently set normalized principal point to be used during navigation.
Normalized principal point to be used during navigation. Defaults to (0.5, 0.775), which means the camera will use the position slightly at the bottom of the mapview.
- Specified by:
getNormalizedPrincipalPointin interfaceCameraBehavior- Returns:
The normalized principal point.
-
setNormalizedPrincipalPoint
Sets a normalized principal point to be used during navigation.
Normalized principal point to be used during navigation. Defaults to (0.5, 0.775), which means the camera will use the position slightly at the bottom of the mapview.
- Specified by:
setNormalizedPrincipalPointin interfaceCameraBehavior- Parameters:
value-The normalized principal point.
-