Class OrbitLocationCameraController


  • public final class OrbitLocationCameraController
    extends CameraController
    Represents a camera controller that restricts the scene view's camera to orbit a fixed location.

    Interactions on the scene view will pivot the camera around a target location so the camera is always looking at the point. When active, setting the viewpoint on the scene view will be disabled.

    Since:
    100.1.0
    See Also:
    SceneView.setCameraController(CameraController)
    • Constructor Detail

      • OrbitLocationCameraController

        public OrbitLocationCameraController​(Point targetLocation,
                                             double cameraDistance)
        Creates an orbit location camera controller given a target location, and distance from target.
        Parameters:
        targetLocation - target location to pivot the camera
        cameraDistance - distance between the camera and the target, in meters
        Throws:
        IllegalArgumentException - if targetLocation is null
        IllegalArgumentException - if cameraDistance is zero or less
        Since:
        100.1.0
      • OrbitLocationCameraController

        public OrbitLocationCameraController​(Point targetLocation,
                                             Point cameraLocation)
        Creates an orbit location camera controller given a target location and camera location. The camera is placed at the given camera location and will point toward the target location.
        Parameters:
        targetLocation - target location to look at
        cameraLocation - location of the camera
        Throws:
        IllegalArgumentException - if targetLocation or cameraLocation are null
        Since:
        100.3.0
    • Method Detail

      • moveCameraAsync

        public ListenableFuture<Boolean> moveCameraAsync​(double deltaDistance,
                                                         double deltaHeadingOffset,
                                                         double deltaPitchOffset,
                                                         float duration)
        Moves the camera to a new offset position with the specified duration.
        Parameters:
        deltaDistance - the change in distance to apply in the animation, in meters
        deltaHeadingOffset - the change in heading to apply in the animation, in degrees
        deltaPitchOffset - the change in pitch to apply in the animation, in degrees
        duration - the duration of the animation, in seconds
        Returns:
        a Future used to check whether the animation completed successfully
        Since:
        100.1.0
      • setCameraDistance

        public void setCameraDistance​(double distance)
        Sets the distance between the camera and the target. The camera position is derived from this distance plus the camera offsets.
        Parameters:
        distance - distance between the camera and the target, in meters
        Throws:
        IllegalArgumentException - if distance is zero or less
        Since:
        100.1.0
      • getCameraDistance

        public double getCameraDistance()
        Gets the distance between the camera and the target.
        Returns:
        the distance between the camera and the target, in meters
        Since:
        100.1.0
      • setCameraHeadingOffset

        public void setCameraHeadingOffset​(double headingOffset)
        Sets the clockwise angle in the target symbol's horizontal plane starting directly behind the symbol. The default value is 0 degrees.

        If the headingOffset is not between minCameraHeadingOffset and maxCameraHeadingOffset, it will be normalized as follows:

        1. if hedingOffset < minCameraHeadingOffset, then 360 will be added to headingOffset until the new value is above minCameraHeadingOffset. If the new value is less than maxCameraHeadingOffset, it will be used. Otherwise, the new value will be set to minCameraHeadingOffset.
        2. if hedingOffset > maxCameraHeadingOffset, then 360 will be subtracted from headingOffset until the new value is below maxCameraHeadingOffset. If the new value is greater than minCameraHeadingOffset, it will be used. Otherwise, the new value will be set to maxCameraHeadingOffset.
        Parameters:
        headingOffset - camera heading offset, in degrees
        Since:
        100.1.0
      • getCameraHeadingOffset

        public double getCameraHeadingOffset()
        Gets the camera heading offset. The default value is 0 degrees.

        The return value can be different than what was set. See setCameraHeadingOffset(double) for details.

        Returns:
        the camera heading offset, in degrees
        Since:
        100.1.0
      • setCameraPitchOffset

        public void setCameraPitchOffset​(double pitchOffset)
        Sets anti-clockwise angle from the positive Z axis of the target's symbol to the symbol's horizontal plane. The default value is 45 degrees.

        The value will be clamped to minCameraPitchOffset and maxCameraPitchOffset.

        Parameters:
        pitchOffset - camera pitch offset, in degrees
        Since:
        100.1.0
      • getCameraPitchOffset

        public double getCameraPitchOffset()
        Gets the camera pitch offset. The default value is 45 degrees.

        The value is clamped to minCameraPitchOffset and maxCameraPitchOffset.

        Returns:
        the camera pitch offset, in degrees
        Since:
        100.1.0
      • setMinCameraDistance

        public void setMinCameraDistance​(double minDistance)
        Sets the minimum distance between the camera and the target. Interactions and animations are limited by this. The default value is 0 meters.
        Parameters:
        minDistance - the minimum distance from the camera to the target, in meters
        Throws:
        IllegalArgumentException - if minDistance is negative
        Since:
        100.1.0
      • getMinCameraDistance

        public double getMinCameraDistance()
        Gets the minimum distance between the camera and the target. Interactions and animations are limited by this. The default value is 0 meters.
        Returns:
        the minimum distance between the camera and the target, in meters
        Since:
        100.1.0
      • setMaxCameraDistance

        public void setMaxCameraDistance​(double maxDistance)
        Sets the maximum distance between the camera and the target. Interactions and animations are limited by this. The default value is Double.MAX_VALUE meters.
        Parameters:
        maxDistance - the minimum distance from the camera to the target, in meters
        Throws:
        IllegalArgumentException - if maxDistance is negative
        Since:
        100.1.0
      • getMaxCameraDistance

        public double getMaxCameraDistance()
        Gets the maximum distance between the camera and the target. Interactions and animations are limited by this. The default value is Double.MAX_VALUE meters.
        Returns:
        the maximum distance between the camera and the target, in meters
        Since:
        100.1.0
      • setMinCameraHeadingOffset

        public void setMinCameraHeadingOffset​(double minHeadingOffset)
        Sets the minimum camera heading offset. Interactions and animations are limited by this. The default value is -180 degrees.
        Parameters:
        minHeadingOffset - the minimum heading offset, in degrees
        Since:
        100.1.0
      • getMinCameraHeadingOffset

        public double getMinCameraHeadingOffset()
        Gets the minimum camera heading offset. Interactions and animations are limited by this. The default value is -180 degrees.
        Returns:
        the minimum camera heading offset, in degrees
        Since:
        100.1.0
      • setMaxCameraHeadingOffset

        public void setMaxCameraHeadingOffset​(double maxHeadingOffset)
        Sets the maximum camera heading offset. Interactions and animations are limited by this. The default value is 180 degrees.
        Parameters:
        maxHeadingOffset - the maximum camera heading offset, in degrees
        Since:
        100.1.0
      • getMaxCameraHeadingOffset

        public double getMaxCameraHeadingOffset()
        Gets the maximum camera heading offset. Interactions and animations are limited by this. The default value is 180 degrees.
        Returns:
        the maximum camera heading offset, in degrees
        Since:
        100.1.0
      • setMinCameraPitchOffset

        public void setMinCameraPitchOffset​(double minPitchOffset)
        Sets the minimum camera pitch offset. Interactions and animations are limited by this. The default value is 0 degrees.
        Parameters:
        minPitchOffset - the minimum camera pitch offset, in degrees
        Since:
        100.1.0
      • getMinCameraPitchOffset

        public double getMinCameraPitchOffset()
        Gets the minimum camera pitch offset. Interactions and animations are limited by this. The default value is 0 degrees.
        Returns:
        the minimum camera pitch offset, in degrees
        Since:
        100.1.0
      • setMaxCameraPitchOffset

        public void setMaxCameraPitchOffset​(double maxPitchOffset)
        Sets the maximum camera pitch offset. Interactions and animations are limited by this. The default value is 180 degrees.
        Parameters:
        maxPitchOffset - the maximum pitch offset, in degrees
        Since:
        100.1.0
      • getMaxCameraPitchOffset

        public double getMaxCameraPitchOffset()
        Gets the maximum camera pitch offset. Interactions and animations are limited by this. The default value is 180 degrees.
        Returns:
        the maximum camera pitch offset, in degrees
        Since:
        100.1.0
      • setCameraDistanceInteractive

        public void setCameraDistanceInteractive​(boolean distanceInteractive)
        Sets whether a zoom interaction can affect the camera distance. The default value is true.
        Parameters:
        distanceInteractive - true to let a zoom interaction affect the camera distance, otherwise false
        Since:
        100.1.0
      • setCameraHeadingOffsetInteractive

        public void setCameraHeadingOffsetInteractive​(boolean headingOffsetInteractive)
        Sets whether a horizontal pan interaction can affect the camera heading offset. The default value is true.
        Parameters:
        headingOffsetInteractive - true to let a horizontal pan interaction affect the camera heading offset, otherwise false
        Since:
        100.1.0
      • setCameraPitchOffsetInteractive

        public void setCameraPitchOffsetInteractive​(boolean pitchOffsetInteractive)
        Sets whether a vertical pan interaction can affect the camera pitch offset. The default value is true.
        Parameters:
        pitchOffsetInteractive - true to let a vertical pan interaction affect the camera pitch offset, otherwise false
        Since:
        100.1.0
      • isCameraDistanceInteractive

        public boolean isCameraDistanceInteractive()
        Gets whether a zoom interaction can affect the camera distance. The default value is true.
        Returns:
        true if a zoom interaction affect the camera distance, otherwise false
        Since:
        100.1.0
      • isCameraHeadingOffsetInteractive

        public boolean isCameraHeadingOffsetInteractive()
        Gets whether a horizontal pan interaction can affect the camera heading offset. The default value is true.
        Returns:
        true if a horizontal pan interaction affect the camera heading offset, otherwise false
        Since:
        100.1.0
      • isCameraPitchOffsetInteractive

        public boolean isCameraPitchOffsetInteractive()
        Gets whether a vertical pan interaction can affect the camera pitch offset. The default value is true.
        Returns:
        true if a vertical pan interaction affect the camera pitch offset, otherwise false
        Since:
        100.1.0
      • getTargetLocation

        public Point getTargetLocation()
        Gets the target for the camera to look at and rotate around.
        Returns:
        the target for the camera to look at and rotate around
        Since:
        100.1.0
      • removeCameraDistanceChangedListener

        public boolean removeCameraDistanceChangedListener​(CameraDistanceChangedListener<OrbitLocationCameraController> listener)
        Removes a camera distance changed listener.
        Parameters:
        listener - the listener
        Returns:
        true if successful, otherwise false
        Since:
        100.1.0
      • removeCameraHeadingOffsetChangedListener

        public boolean removeCameraHeadingOffsetChangedListener​(CameraHeadingOffsetChangedListener<OrbitLocationCameraController> listener)
        Removes a camera heading offset changed listener.
        Parameters:
        listener - the listener
        Returns:
        true if successful, otherwise false
        Since:
        100.1.0
      • removeCameraPitchOffsetChangedListener

        public boolean removeCameraPitchOffsetChangedListener​(CameraPitchOffsetChangedListener<OrbitLocationCameraController> listener)
        Removes a camera pitch offset changed listener.
        Parameters:
        listener - the listener
        Returns:
        true if successful, otherwise false
        Since:
        100.1.0