コード例 #1
0
        /// <summary>
        /// The started.
        /// </summary>
        /// <param name="e">
        /// The e.
        /// </param>
        public override void Started(ManipulationEventArgs e)
        {
            base.Started(e);

            DataPoint current = this.InverseTransform(e.CurrentPosition.X, e.CurrentPosition.Y);

            double scale = this.Step;
            if (this.FineControl)
            {
                scale *= 3;
            }

            scale = 1 + scale;

            // make sure the zoom factor is not negative
            if (scale < 0.1)
            {
                scale = 0.1;
            }

            if (this.XAxis != null)
            {
                this.PlotControl.ZoomAt(this.XAxis, scale, current.X);
            }

            if (this.YAxis != null)
            {
                this.PlotControl.ZoomAt(this.YAxis, scale, current.Y);
            }

            this.PlotControl.InvalidatePlot();
        }
コード例 #2
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.position = e.CurrentPosition;

            var selectedModels = this.Viewport.FindHits(this.position).Select(hit => hit.Model).ToList();
            this.OnModelsSelected(new ModelsSelectedByPointEventArgs(selectedModels, this.position));
        }
コード例 #3
0
        /// <summary>
        /// Occurs when a manipulation is complete.
        /// </summary>
        /// <param name="e">
        /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        public override void Completed(ManipulationEventArgs e)
        {
            base.Completed(e);

            if (this.currentSeries == null)
            {
                return;
            }

            this.currentSeries = null;
            this.PlotControl.HideTracker();
        }
コード例 #4
0
        /// <summary>
        /// Occurs when an input device begins a manipulation on the plot.
        /// </summary>
        /// <param name="e">
        /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        public override void Started(ManipulationEventArgs e)
        {
            base.Started(e);
            if (this.XAxis != null)
            {
                this.PlotControl.Reset(this.XAxis);
            }

            if (this.YAxis != null)
            {
                this.PlotControl.Reset(this.YAxis);
            }

            this.PlotControl.InvalidatePlot();
        }
コード例 #5
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">
        /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);
            if (this.XAxis != null)
            {
                this.PlotControl.Pan(this.XAxis, this.PreviousPosition, e.CurrentPosition);
            }

            if (this.YAxis != null)
            {
                this.PlotControl.Pan(this.YAxis, this.PreviousPosition, e.CurrentPosition);
            }

            this.PlotControl.RefreshPlot(false);
            this.PreviousPosition = e.CurrentPosition;
        }
コード例 #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);
            var thisPoint3D = this.UnProject(e.CurrentPosition, this.panPoint3D, this.Camera.LookDirection);

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

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

            this.LastPoint = e.CurrentPosition;
            this.LastPoint3D = this.UnProject(e.CurrentPosition, this.panPoint3D, this.Camera.LookDirection);
        }
コード例 #7
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)
        {
            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));
        }
コード例 #8
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.</param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);

            DataPoint current = this.InverseTransform(e.CurrentPosition.X, e.CurrentPosition.Y);

            if (this.XAxis != null)
            {
                this.PlotControl.ZoomAt(this.XAxis, e.ScaleX, current.X);
            }

            if (this.YAxis != null)
            {
                this.PlotControl.ZoomAt(this.YAxis, e.ScaleY, current.Y);
            }

            this.PlotControl.InvalidatePlot();
        }
コード例 #9
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);
        }
コード例 #10
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">
        /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);
            if (this.currentSeries == null)
            {
                return;
            }

            if (!this.PlotControl.ActualModel.PlotArea.Contains(e.CurrentPosition.X, e.CurrentPosition.Y))
            {
                return;
            }

            TrackerHitResult result = GetNearestHit(this.currentSeries, e.CurrentPosition, this.Snap, this.PointsOnly);

            if (result != null)
            {
                result.PlotModel = this.PlotControl.ActualModel;
                this.PlotControl.ShowTracker(result);
            }
        }
コード例 #11
0
        /// <summary>
        /// Starts manipulation of the object
        /// </summary>
        public void StartManipulation(Vector3 downPos)
        {
            if (!IsManipulationEnabled)
            {
                return;
            }
            if (isManipulating || isHolding)
            {
                return;
            }

            isManipulating = true;

            this.startHandPos  = downPos;
            this.lerpedHandPos = this.startHandPos;

            var ea = new ManipulationEventArgs(
                currentInputSource,
                currentInputSourceId,
                Vector3.zero);

            RaiseManipulationStartedEvent(ea);
        }
コード例 #12
0
 private void ManipulationChangedEventHandler(object sender, ManipulationEventArgs e)
 {
     HandleRotation(e.TotalRotation);
     HandleScale(e.ScaleDelta);
 }
コード例 #13
0
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.currentSeries = this.PlotControl.GetSeriesFromPoint(e.CurrentPosition);
     this.Delta(e);
 }
コード例 #14
0
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.currentSeries = this.PlotControl.GetSeriesFromPoint(e.CurrentPosition);
     this.Delta(e);
 }
コード例 #15
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.Viewport.ActualWidth / 2, this.Viewport.ActualHeight / 2);
            this.zoomPoint3D = this.Camera.Target;

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

            if (!this.changeFieldOfView)
            {
                this.Viewport.ShowTargetAdorner(this.zoomPoint);
            }
        }
コード例 #16
0
 /// <summary>
 /// Occurs when the input device changes position during a manipulation.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Delta(ManipulationEventArgs e)
 {
 }
コード例 #17
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;
 }
コード例 #18
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);
 }
コード例 #19
0
 /// <summary>
 /// Occurs when a manipulation is complete.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Completed(ManipulationEventArgs e)
 {
     this.PlotControl.SetCursorType(CursorType.Default);
 }
コード例 #20
0
        /// <summary>
        /// Occurs when the input device changes position during a manipulation.
        /// </summary>
        /// <param name="e">
        /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        public override void Delta(ManipulationEventArgs e)
        {
            base.Delta(e);
            if (this.currentSeries == null)
            {
                return;
            }

            if (!this.PlotControl.ActualModel.PlotArea.Contains(e.CurrentPosition.X, e.CurrentPosition.Y))
            {
                return;
            }

            TrackerHitResult result = GetNearestHit(this.currentSeries, e.CurrentPosition, this.Snap, this.PointsOnly);
            if (result != null)
            {
                result.PlotModel = this.PlotControl.ActualModel;
                this.PlotControl.ShowTracker(result);
            }
        }
コード例 #21
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);
 }
コード例 #22
0
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.PreviousPosition = e.CurrentPosition;
 }
コード例 #23
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();
 }
コード例 #24
0
        /// <summary>
        /// Occurs when an input device begins a manipulation on the plot.
        /// </summary>
        /// <param name="e">
        /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
        /// </param>
        public virtual void Started(ManipulationEventArgs e)
        {
            Axis xaxis;
            Axis yaxis;
            this.PlotControl.GetAxesFromPoint(e.CurrentPosition, out xaxis, out yaxis);
            this.StartPosition = e.CurrentPosition;

            this.XAxis = xaxis;
            this.YAxis = yaxis;

            this.PlotControl.SetCursorType(this.GetCursorType());
        }
コード例 #25
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();
 }
コード例 #26
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);
 }
コード例 #27
0
 /// <summary>
 /// Occurs when the input device changes position during a manipulation.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Delta(ManipulationEventArgs e)
 {
 }
コード例 #28
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();
        }
コード例 #29
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
 }
コード例 #30
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();
 }
コード例 #31
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)
 {
 }
コード例 #32
0
 /// <summary>
 /// Occurs when a manipulation is complete.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public virtual void Completed(ManipulationEventArgs e)
 {
     this.PlotControl.SetCursorType(CursorType.Default);
 }
コード例 #33
0
 /// <summary>
 /// Occurs when an input device begins a manipulation on the plot.
 /// </summary>
 /// <param name="e">
 /// The <see cref="OxyPlot.ManipulationEventArgs"/> instance containing the event data.
 /// </param>
 public override void Started(ManipulationEventArgs e)
 {
     base.Started(e);
     this.PreviousPosition = e.CurrentPosition;
 }
コード例 #34
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)
 {
 }
コード例 #35
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;
 }
コード例 #36
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.Camera.Target;
            if (this.MouseDownNearestPoint3D != null)
            {
                this.panPoint3D = this.MouseDownNearestPoint3D.Value;
            }

            this.LastPoint3D = this.UnProject(this.MouseDownPoint, this.panPoint3D, this.Camera.LookDirection);
        }