/// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        protected override void Started(ManipulationEventArgs e)
        {
            base.Started(e);
            this.position = e.CurrentPosition;

            var selectedModels = this.Viewport.FindHits(this.position).Select(hit => hit.Model).ToList();
            this.OnModelsSelected(new ModelsSelectedByPointEventArgs(selectedModels, this.position));
        }
예제 #2
0
파일: PanHandler.cs 프로젝트: ondrej11/o106
        /// <summary>
        /// Occurs when the position is changed during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);
            var thisPoint3D = this.UnProject(e.CurrentPosition, this.panPoint3D, this.Controller.CameraLookDirection);

            if (this.LastPoint3D == null || thisPoint3D == null)
            {
                return;
            }

            Vector3D delta3D = this.LastPoint3D.Value - thisPoint3D.Value;
            this.Pan(delta3D);

            this.LastPoint = e.CurrentPosition;
            this.LastPoint3D = this.UnProject(e.CurrentPosition, this.panPoint3D, this.Controller.CameraLookDirection);
        }
        /// <summary>
        /// The customized complete operation when the manipulation is completed.
        /// </summary>
        /// <param name="e">
        /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        protected override void Completed(ManipulationEventArgs e)
        {
            this.HideRectangle();

            var selectedModels =
                    this.Viewport.FindHits(this.selectionRect, this.SelectionHitMode).Select(hit => hit.Model).ToList();

            // We do not handle the point selection, unless no models are selected. If no models are selected, we clear the
            // existing selection.
            if (this.selectionRect.Size.Equals(default(Size)) && selectedModels.Any())
            {
                return;
            }

            this.OnModelsSelected(new ModelsSelectedByRectangleEventArgs(selectedModels, this.selectionRect));
        }
        /// <summary>
        /// The customized complete operation when the manipulation is completed.
        /// </summary>
        /// <param name="e">
        /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        protected override void Completed(ManipulationEventArgs e)
        {
            this.HideRectangle();

            var res = this.Viewport.FindHits(this.selectionRect, this.SelectionHitMode);

            var selectedModels = res.Select(hit => hit.Model).ToList();

            // We do not handle the point selection, unless no models are selected. If no models are selected, we clear the
            // existing selection.
            if (this.selectionRect.Size.Equals(default(Size)) && selectedModels.Any())
            {
                return;
            }

            this.OnModelsSelected(new ModelsSelectedByRectangleEventArgs(selectedModels, this.selectionRect));
            var selectedVisuals = res.Select(hit => hit.Visual).ToList();

            this.OnVisualsSelected(new VisualsSelectedByRectangleEventArgs(selectedVisuals, this.selectionRect));
        }
예제 #5
0
        /// <summary>
        /// Occurs when the position is changed during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);

            double ar = this.Controller.ActualHeight / this.Controller.ActualWidth;
            var delta = this.MouseDownPoint - e.CurrentPosition;

            if (Math.Abs(delta.Y / delta.X) < ar)
            {
                delta.Y = Math.Sign(delta.Y) * Math.Abs(delta.X * ar);
            }
            else
            {
                delta.X = Math.Sign(delta.X) * Math.Abs(delta.Y / ar);
            }

            this.zoomRectangle = new Rect(this.MouseDownPoint, this.MouseDownPoint - delta);

            this.Controller.UpdateRectangle(this.zoomRectangle);
        }
예제 #6
0
        /// <summary>
        /// Occurs when the position is changed during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);

            double ar    = this.Controller.ActualHeight / this.Controller.ActualWidth;
            var    delta = this.MouseDownPoint - e.CurrentPosition;

            if (Math.Abs(delta.Y / delta.X) < ar)
            {
                delta.Y = Math.Sign(delta.Y) * Math.Abs(delta.X * ar);
            }
            else
            {
                delta.X = Math.Sign(delta.X) * Math.Abs(delta.Y / ar);
            }

            this.zoomRectangle = new Rect(this.MouseDownPoint, this.MouseDownPoint - delta);

            this.Controller.UpdateRectangle(this.zoomRectangle);
        }
예제 #7
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 protected override void Delta(ManipulationEventArgs e)
 {
     base.Delta(e);
     this.selectionRect = new Rect(this.MouseDownPoint, e.CurrentPosition);
     this.UpdateRectangle();
 }
예제 #8
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Delta(ManipulationEventArgs e)
 {
     deltaMoved     = e.CurrentPosition - this.LastPoint;
     this.LastPoint = e.CurrentPosition;
     this.Zoom(deltaMoved.Y * 0.01, this.zoomPoint3D);
 }
예제 #9
0
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Started(ManipulationEventArgs e)
 {
     this.MouseDownPoint = e.CurrentPosition;
 }
예제 #10
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Completed(ManipulationEventArgs e)
 {
 }
예제 #11
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Delta(ManipulationEventArgs e)
 {
     base.Delta(e);
     this.Rotate(this.LastPoint, e.CurrentPosition, this.rotationPoint3D);
     this.LastPoint = e.CurrentPosition;
 }
예제 #12
0
        /// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Started(ManipulationEventArgs e)
        {
            base.Started(e);

            this.rotationPoint = new Point(
                this.Controller.Viewport.ActualWidth / 2, this.Controller.Viewport.ActualHeight / 2);
            this.rotationPoint3D = this.Controller.CameraTarget;

            switch (this.Controller.CameraMode)
            {
                case CameraMode.WalkAround:
                    this.rotationPoint = this.MouseDownPoint;
                    this.rotationPoint3D = this.Controller.CameraPosition;
                    break;
                default:
                    if (this.changeLookAt && this.MouseDownNearestPoint3D != null)
                    {
                        this.LookAt(this.MouseDownNearestPoint3D.Value, 0);
                        this.rotationPoint3D = this.Controller.CameraTarget;
                    }
                    else if (this.Controller.RotateAroundMouseDownPoint && this.MouseDownNearestPoint3D != null)
                    {
                        this.rotationPoint = this.MouseDownPoint;
                        this.rotationPoint3D = this.MouseDownNearestPoint3D.Value;
                    }

                    break;
            }

            if (this.Controller.CameraMode == CameraMode.Inspect)
            {
                this.Controller.ShowTargetAdorner(this.rotationPoint);
            }

            switch (this.Controller.CameraRotationMode)
            {
                case CameraRotationMode.Trackball:
                    break;
                case CameraRotationMode.Turntable:
                    break;
                case CameraRotationMode.Turnball:
                    this.InitTurnballRotationAxes(e.CurrentPosition);
                    break;
            }

            this.Controller.StopSpin();
        }
예제 #13
0
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Started(ManipulationEventArgs e)
 {
     this.SetMouseDownPoint(e.CurrentPosition);
     this.LastPoint = this.MouseDownPoint;
     this.LastPoint3D = this.MouseDownPoint3D;
     /// DELETED BY SJT FOR .NET 3.5
     //this.ManipulationWatch.Restart();
 }
예제 #14
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Completed(ManipulationEventArgs e)
 {
     var elapsed = this.ManipulationWatch.ElapsedMilliseconds;
     if (elapsed > 0 && elapsed < this.Controller.SpinReleaseTime)
     {
         this.OnInertiaStarting((int)this.ManipulationWatch.ElapsedMilliseconds);
     }
 }
예제 #15
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Delta(ManipulationEventArgs e)
 {
     var delta = e.CurrentPosition - this.LastPoint;
     this.LastPoint = e.CurrentPosition;
     this.Zoom(delta.Y * 0.01, this.zoomPoint3D);
 }
예제 #16
0
 /// <summary>
 /// The customized complete operation when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected override void Completed(ManipulationEventArgs e)
 {
     // do not raise event here
 }
예제 #17
0
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 protected override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.selectionRect = new Rect(this.MouseDownPoint, this.MouseDownPoint);
     this.ShowRectangle();
 }
 /// <summary>
 /// The customized complete operation when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected override void Completed(ManipulationEventArgs e)
 {
     this.HideRectangle();
     base.Completed(e);
 }
예제 #19
0
 /// <summary>
 /// The customized complete operation when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected override void Completed(ManipulationEventArgs e)
 {
     // do not raise event here
 }
 /// <summary>
 /// The customized complete operation when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected override void Completed(ManipulationEventArgs e)
 {
     this.HideRectangle();
     base.Completed(e);
 }
예제 #21
0
        /// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Started(ManipulationEventArgs e)
        {
            base.Started(e);

            this.rotationPoint = new Point(
                this.Controller.Viewport.ActualWidth / 2, this.Controller.Viewport.ActualHeight / 2);
            this.rotationPoint3D = this.Controller.CameraTarget;

            switch (this.Controller.CameraMode)
            {
            case CameraMode.WalkAround:
                this.rotationPoint   = this.MouseDownPoint;
                this.rotationPoint3D = this.Controller.CameraPosition;
                break;

            default:
                if (this.Controller.FixedRotationPointEnabled)
                {
                    this.rotationPoint   = this.Viewport.Point3DtoPoint2D(this.Controller.FixedRotationPoint);
                    this.rotationPoint3D = this.Controller.FixedRotationPoint;
                }
                else if (this.changeLookAt && this.MouseDownNearestPoint3D != null)
                {
                    this.LookAt(this.MouseDownNearestPoint3D.Value, 0);
                    this.rotationPoint3D = this.Controller.CameraTarget;
                }
                else if (this.Controller.RotateAroundMouseDownPoint && this.MouseDownNearestPoint3D != null)
                {
                    this.rotationPoint   = this.MouseDownPoint;
                    this.rotationPoint3D = this.MouseDownNearestPoint3D.Value;
                }

                break;
            }

            if (this.Controller.CameraMode == CameraMode.Inspect)
            {
                if (this.Controller.ZoomAroundMouseDownPoint)
                {
                    this.Controller.ShowTargetAdorner(this.MouseDownNearestPoint2D);
                }
                else
                {
                    this.Controller.ShowTargetAdorner(this.MouseDownPoint);
                }
            }

            switch (this.Controller.CameraRotationMode)
            {
            case CameraRotationMode.Trackball:
                break;

            case CameraRotationMode.Turntable:
                break;

            case CameraRotationMode.Turnball:
                this.InitTurnballRotationAxes(e.CurrentPosition);
                break;
            }

            this.Controller.StopSpin();
        }
예제 #22
0
        /// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Started(ManipulationEventArgs e)
        {
            base.Started(e);
            this.zoomPoint = new Point(
                this.Controller.Viewport.ActualWidth / 2, this.Controller.Viewport.ActualHeight / 2);
            this.zoomPoint3D = this.Controller.CameraTarget;

            if (this.Controller.ZoomAroundMouseDownPoint && this.MouseDownNearestPoint3D != null)
            {
                this.zoomPoint = this.MouseDownPoint;
                this.zoomPoint3D = this.MouseDownNearestPoint3D.Value;
            }

            if (!this.changeFieldOfView)
            {
                this.Controller.ShowTargetAdorner(this.zoomPoint);
            }
        }
예제 #23
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Completed(ManipulationEventArgs e)
 {
 }
예제 #24
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Completed(ManipulationEventArgs e)
 {
     base.Completed(e);
     this.Controller.HideRectangle();
     this.ZoomRectangle(this.zoomRectangle);
 }
예제 #25
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Delta(ManipulationEventArgs e)
 {
 }
예제 #26
0
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.zoomRectangle = new Rect(this.MouseDownPoint, this.MouseDownPoint);
     this.Controller.ShowRectangle(this.zoomRectangle, Colors.LightGray, Colors.Black);
 }
예제 #27
0
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Started(ManipulationEventArgs e)
 {
     this.MouseDownPoint = e.CurrentPosition;
 }
예제 #28
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Delta(ManipulationEventArgs e)
 {
 }
예제 #29
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Delta(ManipulationEventArgs e)
 {
 }
예제 #30
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Delta(ManipulationEventArgs e)
 {
     base.Delta(e);
     this.Rotate(this.LastPoint, e.CurrentPosition, this.rotationPoint3D);
     this.LastPoint = e.CurrentPosition;
 }
예제 #31
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Completed(ManipulationEventArgs e)
 {
     base.Completed(e);
     this.Controller.HideRectangle();
     this.ZoomRectangle(this.zoomRectangle);
 }
예제 #32
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Completed(ManipulationEventArgs e)
 {
     base.Completed(e);
     this.Controller.HideTargetAdorner();
 }
예제 #33
0
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.zoomRectangle = new Rect(this.MouseDownPoint, this.MouseDownPoint);
     this.Controller.ShowRectangle(this.zoomRectangle, Colors.LightGray, Colors.Black);
 }
예제 #34
0
파일: PanHandler.cs 프로젝트: ondrej11/o106
        /// <summary>
        /// Occurs when the manipulation is started.
        /// </summary>
        /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Started(ManipulationEventArgs e)
        {
            base.Started(e);
            this.panPoint3D = this.Controller.CameraTarget;
            if (this.MouseDownNearestPoint3D != null)
            {
                this.panPoint3D = this.MouseDownNearestPoint3D.Value;
            }

            this.LastPoint3D = this.UnProject(this.MouseDownPoint, this.panPoint3D, this.Controller.CameraLookDirection);
        }
 /// <summary>
 /// Occurs when the manipulation is started.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 protected override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.selectionRect = new Rect(this.MouseDownPoint, this.MouseDownPoint);
     this.ShowRectangle();
 }
예제 #36
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 public override void Completed(ManipulationEventArgs e)
 {
     base.Completed(e);
     this.Controller.HideTargetAdorner();
 }
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationEventArgs"/> instance containing the event data.</param>
 protected override void Delta(ManipulationEventArgs e)
 {
     base.Delta(e);
     this.selectionRect = new Rect(this.MouseDownPoint, e.CurrentPosition);
     this.UpdateRectangle();
 }
예제 #38
0
 /// <summary>
 /// Occurs when the position is changed during a manipulation.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Delta(ManipulationEventArgs e)
 {
 }
예제 #39
0
 /// <summary>
 /// Occurs when the manipulation is completed.
 /// </summary>
 /// <param name="e">
 /// The <see cref="ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 protected virtual void Completed(ManipulationEventArgs e)
 {
     var handler = this.ModelsSelected;
     if (handler != null)
     {
         handler(this.Viewport, this.PrepareModelsSelectedEventArgs());
     }
 }