예제 #1
0
        public void ZoomToBox(Geometries.Point beginPoint, Geometries.Point endPoint)
        {
            double x, y, resolution;
            var    width  = Math.Abs(endPoint.X - beginPoint.X);
            var    height = Math.Abs(endPoint.Y - beginPoint.Y);

            if (width <= 0)
            {
                return;
            }
            if (height <= 0)
            {
                return;
            }

            ZoomHelper.ZoomToBoudingbox(beginPoint.X, beginPoint.Y, endPoint.X, endPoint.Y,
                                        ActualWidth, ActualHeight, out x, out y, out resolution);
            resolution = ZoomHelper.ClipResolutionToExtremes(_map.Resolutions, resolution);

            Map.Viewport.Center     = new Geometries.Point(x, y);
            Map.Viewport.Resolution = resolution;
            _toResolution           = resolution;

            _map.ViewChanged(true);
            OnViewChanged(true);
            RefreshGraphics();
            ClearBBoxDrawing();
        }