Beispiel #1
0
        /// <summary>
        /// Change rotation of viewport
        /// </summary>
        /// <param name="rotation">New rotation in degrees of viewport></param>
        public void RotateTo(double rotation, long duration)
        {
            // Stop any old animation if there is one
            if (_animation != null)
            {
                _animation.Stop(false);
                _animation = null;
            }

            if (duration == 0)
            {
                _viewport.SetRotation(rotation);

                Navigated?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                var            animations = new List <AnimationEntry>();
                AnimationEntry entry;

                if (_viewport.Rotation == rotation)
                {
                    return;
                }

                entry = new AnimationEntry(
                    start: _viewport.Rotation,
                    end: rotation,
                    animationStart: 0,
                    animationEnd: 1,
                    easing: Easing.Linear,
                    tick: RotationTick,
                    final: RotationFinal
                    );
                animations.Add(entry);

                _rotationDelta = (double)entry.End - (double)entry.Start;

                if (_rotationDelta < -180.0)
                {
                    _rotationDelta += 360.0;
                }

                if (_rotationDelta > 180.0)
                {
                    _rotationDelta -= 360.0;
                }

                _animation = new Animation(duration);
                _animation.Entries.AddRange(animations);
                _animation.Start();
            }
        }
Beispiel #2
0
 public void SetRotation(double rotation)
 {
     if (Map.RotationLock)
     {
         return;
     }
     _viewport.SetRotation(rotation);
     Limiter.LimitExtent(_viewport, Map.Envelope);
 }
        /// <summary>
        /// Change rotation of viewport
        /// </summary>
        /// <param name="rotation">New rotation in degrees of viewport></param>
        public void RotateTo(double rotation)
        {
            _viewport.SetRotation(rotation);

            Navigated?.Invoke(this, EventArgs.Empty);
        }
Beispiel #4
0
 public void SetRotation(double rotation)
 {
     _viewport.SetRotation(rotation);
     Limiter.LimitExtent(_viewport, Map.Envelope);
 }
Beispiel #5
0
        /// <summary>
        /// Change rotation of viewport
        /// </summary>
        /// <param name="rotation">New rotation in degrees of viewport></param>
        /// <param name="duration">Duration for animation in milliseconds.</param>
        /// <param name="easing">The type of easing function used to transform from begin tot end state</param>
        public void RotateTo(double rotation, long duration = 0, Easing?easing = default)
        {
            _viewport.SetRotation(rotation, duration, easing);

            OnNavigated(duration, ChangeType.Discrete);
        }
Beispiel #6
0
        /// <summary>
        /// Change rotation of viewport
        /// </summary>
        /// <param name="rotation">New rotation in degrees of viewport></param>
        public void RotateTo(double rotation)
        {
            _viewport.SetRotation(rotation);

            _map.RefreshData(_viewport.Extent, _viewport.Resolution, true);
        }
        public void NavigateTo(Point center, double resolution, double rotation, long duration = 300)
        {
            // Stop any old animation if there is one
            if (_animation != null)
            {
                _animation.Stop(false);
                _animation = null;
            }

            if (duration == 0)
            {
                _viewport.SetCenter(center);
                _viewport.SetResolution(resolution);
                _viewport.SetRotation(rotation);

                Navigated?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                var animations = new List <AnimationEntry>();

                if (!_viewport.Center.Equals(center))
                {
                    var entry = new AnimationEntry(
                        start: _viewport.Center,
                        end: (ReadOnlyPoint)center,
                        animationStart: 0,
                        animationEnd: 1,
                        easing: Easing.Linear,
                        tick: CenterTick,
                        final: CenterFinal
                        );
                    animations.Add(entry);
                }

                if (_viewport.Resolution != resolution)
                {
                    var entry = new AnimationEntry(
                        start: _viewport.Resolution,
                        end: resolution,
                        animationStart: 0,
                        animationEnd: 1,
                        easing: Easing.Linear,
                        tick: ResolutionTick,
                        final: ResolutionFinal
                        );
                    animations.Add(entry);
                }

                if (_viewport.Rotation != rotation)
                {
                    var entry = new AnimationEntry(
                        start: _viewport.Rotation,
                        end: rotation,
                        animationStart: 0,
                        animationEnd: 1,
                        easing: Easing.Linear,
                        tick: RotationTick,
                        final: RotationFinal
                        );
                    animations.Add(entry);

                    _rotationDelta = (double)entry.End - (double)entry.Start;

                    if (_rotationDelta < -180.0)
                    {
                        _rotationDelta += 360.0;
                    }

                    if (_rotationDelta > 180.0)
                    {
                        _rotationDelta -= 360.0;
                    }
                }

                if (animations.Count == 0)
                {
                    return;
                }

                _animation = new Animation(duration);
                _animation.Entries.AddRange(animations);
                _animation.Start();
            }
        }