Ejemplo n.º 1
0
        private void MapControlMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (!_viewportInitialized)
            {
                return;
            }
            if (ZoomLocked)
            {
                return;
            }

            _currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event

            if (double.IsNaN(_toResolution))
            {
                _toResolution = Map.Viewport.Resolution;
            }

            if (e.Delta > 0)
            {
                _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution);
            }
            else if (e.Delta < 0)
            {
                _toResolution = ZoomHelper.ZoomOut(_map.Resolutions, _toResolution);
            }

            e.Handled = true; //so that the scroll event is not sent to the html page.

            // Some cheating for personal gain. This workaround could be ommitted if the zoom animations was on CenterX, CenterY and Resolution, not Resolution alone.
            Map.Viewport.Center.X += 0.000000001;
            Map.Viewport.Center.Y += 0.000000001;

            StartZoomAnimation(Map.Viewport.Resolution, _toResolution);
        }
        private void MapControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            this.currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event

            if (this.toResolution == 0)
            {
                this.toResolution = this.transform.Resolution;
            }

            if (e.Delta > 0)
            {
                this.toResolution = ZoomHelper.ZoomIn(this.rootLayer.Schema.Resolutions, this.toResolution);
            }
            else if (e.Delta < 0)
            {
                this.toResolution = ZoomHelper.ZoomOut(this.rootLayer.Schema.Resolutions, this.toResolution);
            }

            e.Handled = true; //so that the scroll event is not sent to the html page.

            //this.transform.Resolution = toResolution;
            //this.Refresh();

            this.StartZoomAnimation(this.transform.Resolution, this.toResolution);
        }
Ejemplo n.º 3
0
        private void MapControlMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (ZoomLocked)
            {
                return;
            }

            currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event

            if (double.IsNaN(toResolution))
            {
                toResolution = viewport.Resolution;
            }

            if (e.Delta > 0)
            {
                toResolution = ZoomHelper.ZoomIn(map.Resolutions, toResolution);
            }
            else if (e.Delta < 0)
            {
                toResolution = ZoomHelper.ZoomOut(map.Resolutions, toResolution);
            }

            e.Handled = true; //so that the scroll event is not sent to the html page.

            //some cheating for personal gain
            viewport.CenterX += 0.000000001;
            viewport.CenterY += 0.000000001;
            map.ViewChanged(false, viewport.Extent, viewport.Resolution);
            OnViewChanged(false, true);

            StartZoomAnimation(viewport.Resolution, toResolution);
        }
Ejemplo n.º 4
0
        private void MapControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (AllowMoveAndZoom)
            {
                currentMousePosition = e.GetPosition(this); //Needed for both MouseMove and MouseWheel event for mousewheel event

                if (toResolution == 0)
                {
                    toResolution = viewport.Resolution;
                }

                if (e.Delta > 0)
                {
                    toResolution = ZoomHelper.ZoomIn(map.Resolutions, toResolution);
                }
                else if (e.Delta < 0)
                {
                    if (toResolution < 1200)  //Stop zooming out at this resolution
                    {
                        toResolution = ZoomHelper.ZoomOut(map.Resolutions, toResolution);
                    }
                }

                e.Handled = true; //so that the scroll event is not sent to the html page.

                //some cheating for personal gain
                viewport.CenterX += 0.000000001;
                viewport.CenterY += 0.000000001;
                OnViewChanged(false, true);

                StartZoomAnimation(viewport.Resolution, toResolution);
            }
        }
Ejemplo n.º 5
0
        public void ZoomOut(Point centerOfZoom)
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom);

            _map.RefreshData(_viewport.Extent, _viewport.Resolution, true);
        }
Ejemplo n.º 6
0
        public void ZoomOut()
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            _viewport.SetResolution(resolution);

            Navigated?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 7
0
        public void ZoomOut(Point centerOfZoom)
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom);

            Navigated?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 8
0
        public void ZoomOut()
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            _viewport.SetResolution(resolution);

            _map.RefreshData(_viewport.Extent, _viewport.Resolution, true);
        }
Ejemplo n.º 9
0
        public void ZoomOut()
        {
            if (double.IsNaN(toResolution))
            {
                toResolution = viewport.Resolution;
            }

            toResolution = ZoomHelper.ZoomOut(map.Resolutions, toResolution);
            ZoomMiddle();
        }
Ejemplo n.º 10
0
        public void ZoomOut()
        {
            if (double.IsNaN(_toResolution))
            {
                _toResolution = Map.Viewport.Resolution;
            }

            _toResolution = ZoomHelper.ZoomOut(_map.Resolutions, _toResolution);
            ZoomMiddle();
        }
        public void ZoomOut()
        {
            if (this.toResolution == 0)
            {
                this.toResolution = this.transform.Resolution;
            }

            this.toResolution = ZoomHelper.ZoomOut(this.rootLayer.Schema.Resolutions, this.toResolution);
            ZoomMiddle();
        }
Ejemplo n.º 12
0
 private double DetermineNewResolution(int mouseWheelDelta, double currentResolution)
 {
     if (mouseWheelDelta > 0)
     {
         return(ZoomHelper.ZoomIn(map.Resolutions, currentResolution));
     }
     if (mouseWheelDelta < 0)
     {
         return(ZoomHelper.ZoomOut(map.Resolutions, currentResolution));
     }
     return(currentResolution);
 }
Ejemplo n.º 13
0
        public void ZoomOut()
        {
            if (ZoomLocked)
            {
                return;
            }
            if (!viewInitialized)
            {
                return;
            }

            viewport.Resolution = ZoomHelper.ZoomOut(map.Resolutions, viewport.Resolution);

            OnViewChanged(false);
        }
Ejemplo n.º 14
0
        void MapControlMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (e.Delta > 0)
            {
                _viewport.UnitsPerPixel = ZoomHelper.ZoomIn(_tileSource.Schema.Resolutions.Select(r => r.Value.UnitsPerPixel).ToList(), _viewport.UnitsPerPixel);
            }
            else if (e.Delta < 0)
            {
                _viewport.UnitsPerPixel = ZoomHelper.ZoomOut(_tileSource.Schema.Resolutions.Select(r => r.Value.UnitsPerPixel).ToList(), _viewport.UnitsPerPixel);
            }

            _fetcher.ViewChanged(_viewport.Extent, _viewport.UnitsPerPixel);
            e.Handled = true; //so that the scroll event is not sent to the html page.
            _invalid  = true;
        }
Ejemplo n.º 15
0
        public double GetResolution(int delta, IViewport viewport, IMap map)
        {
            // If the animation has ended then start from the current resolution.
            // The alternative is that use the previous resolution target and add an extra
            // level to that.
            if (!IsAnimating())
            {
                _toResolution = viewport.Resolution;
            }

            if (delta > Constants.Epsilon)
            {
                _toResolution = ZoomHelper.ZoomIn(map.Resolutions, _toResolution);
            }
            else if (delta < Constants.Epsilon)
            {
                _toResolution = ZoomHelper.ZoomOut(map.Resolutions, _toResolution);
            }

            // TickCount is fast https://stackoverflow.com/a/4075602/85325
            _tickCount = Environment.TickCount;

            return(_toResolution);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Zoom out to a given point
        /// </summary>
        /// <param name="centerOfZoom">Center to use for zoom out</param>
        public void ZoomOut(Point centerOfZoom)
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Zoom out to the next resolution
        /// </summary>
        public void ZoomOut()
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Zoom out to a given point
        /// </summary>
        /// <param name="centerOfZoom">Center of zoom. This is the one point in the map that stays on the same location while zooming in.
        /// For instance, in mouse wheel zoom animation the position of the mouse pointer can be the center of zoom.</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 ZoomOut(MPoint centerOfZoom, long duration = -1, Easing?easing = default)
        {
            var resolution = ZoomHelper.ZoomOut(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom, duration, easing);
        }
Ejemplo n.º 19
0
 public void ZoomOut()
 {
     Map.Viewport.Resolution = ZoomHelper.ZoomOut(_map.Resolutions, Map.Viewport.Resolution);
     ViewChanged(true);
     Invalidate();
 }
Ejemplo n.º 20
0
 public void ZoomOut()
 {
     viewport.Resolution = ZoomHelper.ZoomOut(map.Resolutions, viewport.Resolution);
     ViewChanged(true);
     InvalidateMap(true);
 }