/// <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));
        }
Beispiel #2
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);
            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));
        }
        /// <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);
        }
Beispiel #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);
        }
Beispiel #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();
 }
Beispiel #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);
 }
Beispiel #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;
 }
 /// <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)
 {
 }
Beispiel #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;
 }
Beispiel #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();
        }
Beispiel #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();
 }
Beispiel #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);
     }
 }
 /// <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);
 }
Beispiel #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
 }
Beispiel #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);
 }
 /// <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);
 }
Beispiel #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();
        }
        /// <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);
            }
        }
Beispiel #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)
 {
 }
Beispiel #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);
 }
Beispiel #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)
 {
 }
Beispiel #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);
 }
Beispiel #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;
 }
Beispiel #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)
 {
 }
 /// <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)
 {
 }
Beispiel #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;
 }
 /// <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);
 }
Beispiel #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();
 }
 /// <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);
 }
Beispiel #34
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.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();
 }
Beispiel #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();
 }
Beispiel #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)
 {
 }
 /// <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());
     }
 }