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);
        }
示例#2
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);
            }
        }
示例#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);
        }
示例#4
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);
        }
示例#5
0
        public void ZoomIn()
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            _viewport.SetResolution(resolution);

            _map.RefreshData(_viewport.Extent, _viewport.Resolution, true);
        }
示例#6
0
        public void ZoomIn(Point centerOfZoom)
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom);

            Navigated?.Invoke(this, EventArgs.Empty);
        }
示例#7
0
        public void ZoomIn()
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            _viewport.SetResolution(resolution);

            Navigated?.Invoke(this, EventArgs.Empty);
        }
示例#8
0
        public void ZoomIn(Point centerOfZoom)
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom);

            _map.RefreshData(_viewport.Extent, _viewport.Resolution, true);
        }
        public void ZoomIn()
        {
            if (this.toResolution == 0)
            {
                this.toResolution = this.transform.Resolution;
            }

            this.toResolution = ZoomHelper.ZoomIn(this.rootLayer.Schema.Resolutions, this.toResolution);
            ZoomMiddle();
        }
示例#10
0
        public void ZoomIn()
        {
            if (toResolution == 0)
            {
                toResolution = viewport.Resolution;
            }

            toResolution = ZoomHelper.ZoomIn(map.Resolutions, toResolution);
            ZoomMiddle();
        }
示例#11
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);
 }
示例#12
0
        public void ZoomIn()
        {
            if (ZoomLocked)
            {
                return;
            }
            if (!viewInitialized)
            {
                return;
            }

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

            OnViewChanged(false);
        }
示例#13
0
        public void ZoomIn()
        {
            if (ZoomLocked)
            {
                return;
            }

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

            toResolution = ZoomHelper.ZoomIn(map.Resolutions, toResolution);
            ZoomMiddle();
        }
示例#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;
        }
示例#15
0
        public void ZoomIn()
        {
            if (ZoomLocked)
            {
                return;
            }

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

            _toResolution = ZoomHelper.ZoomIn(_map.Resolutions, _toResolution);
            ZoomMiddle();
        }
示例#16
0
        public void ZoomIn(PointF mapPosition)
        {
            // When zooming in we want the mouse position to stay above the same world coordinate.
            // We do that in 3 steps.

            // 1) Temporarily center on where the mouse is
            Map.Viewport.Center = Map.Viewport.ScreenToWorld(mapPosition.X, mapPosition.Y);

            // 2) Then zoom
            Map.Viewport.Resolution = ZoomHelper.ZoomIn(_map.Resolutions, Map.Viewport.Resolution);

            // 3) Then move the temporary center back to the mouse position
            Map.Viewport.Center = Map.Viewport.ScreenToWorld(
                Map.Viewport.Width - mapPosition.X,
                Map.Viewport.Height - mapPosition.Y);

            ViewChanged(true);
            Invalidate();
        }
示例#17
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);
        }
示例#18
0
        /// <summary>
        /// Zoom in to a given point
        /// </summary>
        /// <param name="centerOfZoom">Center to use for zoom in</param>
        public void ZoomIn(Point centerOfZoom)
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom);
        }
示例#19
0
        /// <summary>
        /// Zoom in to the next resolution
        /// </summary>
        public void ZoomIn()
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution);
        }
示例#20
0
 public void ZoomIn()
 {
     viewport.Resolution = ZoomHelper.ZoomIn(map.Resolutions, viewport.Resolution);
     ViewChanged(true);
     InvalidateMap(true);
 }
示例#21
0
        /// <summary>
        /// Zoom in 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 ZoomIn(MPoint centerOfZoom, long duration = -1, Easing?easing = default)
        {
            var resolution = ZoomHelper.ZoomIn(_map.Resolutions, _viewport.Resolution);

            ZoomTo(resolution, centerOfZoom, duration, easing);
        }
示例#22
0
 public void ZoomIn()
 {
     Map.Viewport.Resolution = ZoomHelper.ZoomIn(_map.Resolutions, Map.Viewport.Resolution);
     ViewChanged(true);
     Invalidate();
 }