コード例 #1
0
        private void ZoomViewTo(Point center, double orientation, Vector scale)
        {
            CircleEase ease = new CircleEase();

            ease.EasingMode = EasingMode.EaseInOut;
            AnimateUtility.AnimateElementPoint(zoomCanvas.CurrentView, DisplayMatrix.CenterProperty, center, 0, 1.5, ease);
            AnimateUtility.AnimateElementDouble(zoomCanvas.CurrentView, DisplayMatrix.OrientationProperty, orientation, 0, 1.5, ease);
            AnimateUtility.AnimateElementVector(zoomCanvas.CurrentView, DisplayMatrix.ScaleProperty, scale, 0, 1.5, ease);
        }
コード例 #2
0
        public void FlyTo(Rect rect, double newOrientation, TimeSpan delta)
        {
            StopFlyTo();
            Rect          currentRect = DisplayMatrix.MatrixToBounds(this.ZoomMatrix, this.RenderSize);
            DisplayMatrix temp        = DisplayMatrix.BoundsToMatrix(rect, this.RenderSize);

            Point newCenter = (rect.TopLeft + new Vector(rect.Width / 2, rect.Height / 2));

            newCenter = new Point(-newCenter.X, -newCenter.Y);
            double scaleX = currentRect.Size.Width / rect.Size.Width;
            double scaleY = currentRect.Size.Height / rect.Size.Height;

            Vector newScale = this.ZoomMatrix.Scale * Math.Min(scaleX, scaleY);

            newScale = new Vector(1 / temp.Scale.X, 1 / temp.Scale.Y);
            AnimateUtility.AnimateElementPoint(this.ZoomMatrix, DisplayMatrix.CenterProperty, newCenter, 0, delta.TotalSeconds);
            AnimateUtility.AnimateElementVector(this.ZoomMatrix, DisplayMatrix.ScaleProperty, newScale, 0, delta.TotalSeconds);
            AnimateUtility.AnimateElementDouble(this.ZoomMatrix, DisplayMatrix.OrientationProperty, newOrientation, 0, delta.TotalSeconds);
        }
コード例 #3
0
        private void GenerateMapModel(Point centerStart, Point centerTarget, double orientationStart, double orientationTarget, Vector scaleStart, Vector scaleTarget)
        {
            ShowZoneModel mapModel = new ShowZoneModel();

            mapModel.Text = "Bing Maps 3D";
            ShowMapView mapView = new ShowMapView(mapModel);

            ShowZoneModel model = mapView.Model as ShowZoneModel;

            if (model == null)
            {
                return;
            }

            centerStart  = zoomCanvas.ScreenToWorld(centerStart);
            centerTarget = zoomCanvas.ScreenToWorld(centerTarget);

            model.IsMap                     = true;
            model.IsLocked                  = this.isLocked;
            model.DisplayMatrix.Center      = centerStart;
            model.DisplayMatrix.Orientation = orientationStart;
            model.DisplayMatrix.Scale       = scaleStart;

            AnimateUtility.AnimateElementPoint(model.DisplayMatrix, DisplayMatrix.CenterProperty, centerTarget, 0, 1);
            AnimateUtility.AnimateElementDouble(model.DisplayMatrix, DisplayMatrix.OrientationProperty, orientationTarget, 0, 1);
            AnimateUtility.AnimateElementVector(model.DisplayMatrix, DisplayMatrix.ScaleProperty, scaleTarget, 0, 1);

            if (!showContext.Models.Contains(model))
            {
                showContext.Models.Add(model);
            }
            showContext.SendToFront(model);

            if (!zoomCanvas.Items.Contains(mapView))
            {
                zoomCanvas.Items.Add(mapView);
            }
        }
コード例 #4
0
        private ShowView GenerateModel(ShowModel model, Point centerStart, Point centerTarget, double orientationStart, double orientationTarget, Vector scaleStart, Vector scaleTarget)
        {
            centerStart  = zoomCanvas.ScreenToWorld(centerStart);
            centerTarget = zoomCanvas.ScreenToWorld(centerTarget);

            model.IsLocked                  = this.isLocked;
            model.DisplayMatrix.Center      = centerStart;
            model.DisplayMatrix.Orientation = orientationStart;
            model.DisplayMatrix.Scale       = scaleStart;

            AnimateUtility.AnimateElementPoint(model.DisplayMatrix, DisplayMatrix.CenterProperty, centerTarget, 0, 1);
            AnimateUtility.AnimateElementDouble(model.DisplayMatrix, DisplayMatrix.OrientationProperty, orientationTarget, 0, 1);
            AnimateUtility.AnimateElementVector(model.DisplayMatrix, DisplayMatrix.ScaleProperty, scaleTarget, 0, 1);

            showContext.Models.Add(model);
            showContext.SendToFront(model);

            ShowView view = showContext.CreateView(model);

            zoomCanvas.Items.Add(view);

            return(view);
        }