Example #1
0
        /// <summary>
        /// Smoothly animates the camera to view the supplied interest point. Requires that a camera has been set using SetControlledCamera.
        /// </summary>
        /// <param name="interestPoint">The latitude and longitude of the point on the ground which the camera should be looking at once the transition is complete.</param>
        /// <param name="distanceFromInterest">Optional. The distance in metres from the interest point at which the camera should sit. If unspecified/null the distance to the previous interest point is maintained.</param>
        /// <param name="headingDegrees">Optional. The heading in degrees (0, 360) with which to view the target point, with 0 facing north, 90 east, etc. If unspecified/null the heading with which the camera&apos;s previous interest point was viewed will be maintained.</param>
        /// <param name="tiltDegrees">Optional. The camera tilt in degrees, where a value of 0 represents a camera looking straight down at the interest point, along the direction of gravity.</param>
        /// <param name="transitionDuration">Optional. The total duration of the transition, in seconds. If not specified the duration will be calculated from the distance to be travelled and the camera&apos;s maximum speed.</param>
        /// <param name="jumpIfFarAway">Optional. By default AnimateTo will provide a smooth transition for short distances, but an instantaneous transition if there is a large distance to be covered (rather than waiting for a lengthy animation to play). If you want to override this behaviour and force an animation (even over large distances), you can set this to false.</param>
        /// <returns>Whether the camera successfully animated or not.</returns>
        public bool AnimateTo(
            LatLong interestPoint,
            double?distanceFromInterest = null,
            double?headingDegrees       = null,
            double?tiltDegrees          = null,
            double?transitionDuration   = null,
            bool jumpIfFarAway          = true)
        {
            if (m_controlledCamera == null)
            {
                throw new ArgumentNullException("Camera", m_nonNullCameraMessage);
            }

            var cameraUpdate = new CameraUpdate.Builder()
                               .Target(interestPoint)
                               .Distance(distanceFromInterest)
                               .Bearing(headingDegrees)
                               .Tilt(tiltDegrees)
                               .Build();

            var cameraAnimationOptions = new CameraAnimationOptions.Builder()
                                         .InterruptByGestureAllowed(true)
                                         .SnapIfDistanceExceedsThreshold(jumpIfFarAway)
                                         .Duration(transitionDuration)
                                         .Build();

            var cameraUpdateInterop           = cameraUpdate.ToCameraUpdateInterop();
            var cameraAnimationOptionsInterop = cameraAnimationOptions.ToCameraAnimationOptionsInterop();

            NativeCameraApi_AnimateCamera(NativePluginRunner.API, ref cameraUpdateInterop, ref cameraAnimationOptionsInterop);

            return(true);
        }
Example #2
0
        /// <summary>
        /// Moves the camera to view the supplied interest point instantaneously, without any animation.
        /// Requires that a camera has been set using SetControlledCamera.
        /// </summary>
        /// <param name="interestPoint">The latitude and longitude of the point on the ground which the camera should look at.</param>
        /// <param name="distanceFromInterest">Optional. The distance in metres from the interest point at which the camera should sit. If unspecified/null the altitude is set to 0.0.</param>
        /// <param name="headingDegrees">Optional. The heading in degrees (0, 360) with which to view the target point, with 0 facing north, 90 east, etc. If unspecified/null the heading with which the camera&apos;s previous interest point was viewed will be maintained.</param>
        /// <param name="tiltDegrees">Optional. The camera tilt in degrees, where a value of 0 represents a camera looking straight down at the interest point, along the direction of gravity.</param>
        /// <returns>Whether the camera successfully moved or not.</returns>
        public bool MoveTo(
            LatLong interestPoint,
            double?distanceFromInterest = null,
            double?headingDegrees       = null,
            double?tiltDegrees          = null)
        {
            if (m_controlledCamera == null)
            {
                throw new ArgumentNullException("Camera", m_nonNullCameraMessage);
            }

            var cameraUpdate = new CameraUpdate.Builder()
                               .Target(interestPoint)
                               .Distance(distanceFromInterest)
                               .Bearing(headingDegrees)
                               .Tilt(tiltDegrees)
                               .Build();

            var cameraUpdateInterop = cameraUpdate.ToCameraUpdateInterop();

            NativeCameraApi_MoveCamera(
                NativePluginRunner.API,
                ref cameraUpdateInterop);

            return(true);
        }