private static async Task CreateCameraKeyframe(MapView mapView, MapPoint orig_cameraPoint, ProjectionTransformation transformation,
                                                       CameraTrack cameraTrack, TimeSpan currentTimespanValue, double pitch, double heading, bool ignoreRotation = false, bool ignoreTranslation = false)
        {
            await QueuedTask.Run(() =>
            {
                Keyframe keyFrame = null;
                MapPoint projected_cameraPoint = (MapPoint)GeometryEngine.Instance.ProjectEx(orig_cameraPoint, transformation);

                if (mapView.ViewingMode == MapViewingMode.Map)
                {
                    var camera = new Camera(projected_cameraPoint.X, projected_cameraPoint.Y, CameraZOffset, heading, null, CameraViewpoint.LookAt);
                    keyFrame   = cameraTrack.CreateKeyframe(camera, currentTimespanValue, AnimationTransition.FixedArc, .5);
                }
                else
                {
                    var camera = new Camera(projected_cameraPoint.X, projected_cameraPoint.Y, (projected_cameraPoint.Z + CameraZOffset), pitch, heading, null, CameraViewpoint.LookAt);
                    keyFrame   = cameraTrack.CreateKeyframe(camera, currentTimespanValue, AnimationTransition.FixedArc, .5);
                }

                if (ignoreRotation)
                {
                    CameraKeyframe camKey    = keyFrame as CameraKeyframe;
                    camKey.HeadingTransition = AnimationTransition.None;
                    camKey.RollTransition    = AnimationTransition.None;
                    camKey.PitchTransition   = AnimationTransition.None;
                }
                if (ignoreTranslation)
                {
                    CameraKeyframe camKey = keyFrame as CameraKeyframe;
                    camKey.XTransition    = AnimationTransition.None;
                    camKey.YTransition    = AnimationTransition.None;
                    camKey.ZTransition    = AnimationTransition.None;
                }
            });
        }
Example #2
0
        private static async Task CreateCameraKeyframe(MapPoint orig_cameraPoint, ProjectionTransformation transformation, CameraTrack cameraTrack, TimeSpan currentTimespanValue)
        {
            await QueuedTask.Run(() =>
            {
                Keyframe keyFrame = null;
                MapPoint projected_cameraPoint = (MapPoint)GeometryEngine.Instance.ProjectEx(orig_cameraPoint, transformation);

                var camera = new Camera(projected_cameraPoint.X, projected_cameraPoint.Y, _cameraZOffset, _keyframeHeading, null, CameraViewpoint.LookAt);
                keyFrame   = cameraTrack.CreateKeyframe(camera, currentTimespanValue, AnimationTransition.FixedArc, .5);
            });
        }