AutomotiveCameraBehavior
public class AutomotiveCameraBehavior : CameraBehavior
extension AutomotiveCameraBehavior: NativeBase
extension AutomotiveCameraBehavior: Hashable
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.
-
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.Declaration
Swift
public init() -
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.Declaration
Swift
public init(configJson: String) throwsParameters
configJsonA JSON string containing automotive camera configuration settings.
-
The normalized principal point. 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.
Declaration
Swift
public var normalizedPrincipalPoint: Anchor2D { get set } -
Enables or disables automatic camera adjustments during upcoming maneuvers. 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.
Declaration
Swift
public var isManeuverDetectionEnabled: Bool { get set } -
The view rectangle for camera updates. 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.
Declaration
Swift
public var viewRectangle: Rectangle2D? { get set } -
The active camera type. Defines which camera behavior is currently active:
AutomotiveCameraBehavior.ActiveCameraType.none(free navigation),AutomotiveCameraBehavior.ActiveCameraType.tracking, orAutomotiveCameraBehavior.ActiveCameraType.area.Declaration
Swift
public var activeCameraType: AutomotiveCameraBehavior.ActiveCameraType { get set } -
The current orientation mode of the camera. Defines the camera’s viewing angle and orientation for tracking mode. In
AutomotiveCameraBehavior.OrientationMode.mode2d, the camera looks straight down and rotates with the vehicle heading. InAutomotiveCameraBehavior.OrientationMode.mode3d, the camera is tilted for a perspective view. InAutomotiveCameraBehavior.OrientationMode.modeNorthUp, 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.
Declaration
Swift
public var orientationMode: AutomotiveCameraBehavior.OrientationMode { get set } -
Defines the visual presentation modes for the camera orientation.
See moreDeclaration
Swift
public enum OrientationMode : UInt32, CaseIterable, Codable -
Defines the type of camera currently handling camera updates.
See moreDeclaration
Swift
public enum ActiveCameraType : UInt32, CaseIterable, Codable -
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
AutomotiveCameraBehavior.activeCameraType. To display the configured area view, setAutomotiveCameraBehavior.activeCameraTypetoAutomotiveCameraBehavior.ActiveCameraType.area.Calling this function overrides any previously set geographic bounding box configured via
AutomotiveCameraBehavior.setAreaCameraBehaviorGeobox(...).Declaration
Swift
public func setAreaCameraBehaviorVisiblePoints(points: [GeoCoordinates], includeCurrentPosition: Bool)Parameters
pointsThe list of geographic coordinates to display.
includeCurrentPositionWhen true, the current vehicle position is included in the visible area calculation, ensuring the vehicle remains visible alongside the provided points.
-
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
AutomotiveCameraBehavior.activeCameraType. To display the configured area view, setAutomotiveCameraBehavior.activeCameraTypetoAutomotiveCameraBehavior.ActiveCameraType.area.Calling this function overrides any previously set visible points configured via
AutomotiveCameraBehavior.setAreaCameraBehaviorVisiblePoints(...).Declaration
Swift
public func setAreaCameraBehaviorGeobox(geobox: GeoBox)Parameters
geoboxThe geographic bounding box to display.