Beispiel #1
0
 protected override void ShowNearestSelectedPointCommands(AppIdentity identity, LineSeries lineSeries, OxyMouseDownEventArgs args)
 {
     GuiModelData.SelectedApplicationIdentity = identity;
     var requestId = getSelectedRequestId(args.HitTestResult.Index, lineSeries);
     showCommands(requestId);
     setSelectedPointInfo(lineSeries, args);
 }
Beispiel #2
0
 /// <summary>
 /// Adds the specified mouse manipulator and invokes the <see cref="MouseManipulator.Started" /> method with the specified mouse down event arguments.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="manipulator">The manipulator to add.</param>
 /// <param name="args">The <see cref="OxyMouseDownEventArgs" /> instance containing the event data.</param>
 public virtual void AddMouseManipulator(
     IView view,
     ManipulatorBase <OxyMouseEventArgs> manipulator,
     OxyMouseDownEventArgs args)
 {
     this.MouseDownManipulators.Add(manipulator);
     manipulator.Started(args);
 }
Beispiel #3
0
 /// <summary>
 /// Raises the <see cref="MouseDown" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected virtual void OnMouseDown(object sender, OxyMouseDownEventArgs e)
 {
     var handler = this.MouseDown;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Raises the <see cref="MouseDown" /> event.
 /// </summary>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected internal virtual void OnMouseDown(OxyMouseDownEventArgs e)
 {
     var handler = this.MouseDown;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Beispiel #5
0
        /// <summary>
        /// Raises the <see cref="MouseDown" /> event.
        /// </summary>
        /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        protected internal virtual void OnMouseDown(OxyMouseDownEventArgs e)
        {
            var handler = this.MouseDown;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #6
0
        protected override void ShowNearestSelectedPointCommands(AppIdentity identity, LineSeries lineSeries, OxyMouseDownEventArgs args)
        {
            GuiModelData.SelectedApplicationIdentity = identity;

            var indexOfNearestPoint = (int)Math.Round(args.HitTestResult.Index);
            var point = lineSeries.Points[indexOfNearestPoint];
            var time = (long)point.X;
            showCommands(time);

            SelectedPointInfo = GetSelectedPointInfo(lineSeries, point);
        }
Beispiel #7
0
        protected override void ShowNearestSelectedPointCommands(AppIdentity identity, LineSeries lineSeries, OxyMouseDownEventArgs args)
        {
            GuiModelData.SelectedApplicationIdentity = identity;

            var indexOfNearestPoint = (int)Math.Round(args.HitTestResult.Index);
            var point = lineSeries.Points[indexOfNearestPoint];
            var connectionId = (int)point.X;
            CallbacksManagerBase.ShowAllCommandsWithSameConnectionId(connectionId);

            SelectedPointInfo = GetSelectedPointInfo(lineSeries, point);
        }
Beispiel #8
0
        /// <summary>
        /// Handles mouse down events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseDown(IView view, OxyMouseDownEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseDown(this, args);
                    if (args.Handled)
                    {
                        return(true);
                    }
                }

                var command = this.GetCommand(new OxyMouseDownGesture(args.ChangedButton, args.ModifierKeys, args.ClickCount));
                return(this.HandleCommand(command, view, args));
            }
        }
Beispiel #9
0
        /// <summary>
        /// Handles mouse down events.
        /// </summary>
        /// <param name="view">The plot view.</param>
        /// <param name="args">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
        /// <returns><c>true</c> if the event was handled.</returns>
        public virtual bool HandleMouseDown(IView view, OxyMouseDownEventArgs args)
        {
            lock (this.GetSyncRoot(view))
            {
                if (view.ActualModel != null)
                {
                    view.ActualModel.HandleMouseDown(this, args);
                    if (args.Handled)
                    {
                        return true;
                    }
                }

                var command = this.GetCommand(new OxyMouseDownGesture(args.ChangedButton, args.ModifierKeys, args.ClickCount));
                return this.HandleCommand(command, view, args);
            }
        }
Beispiel #10
0
        // event handler
        void plotModel_MouseDown(object sender, OxyPlot.OxyMouseDownEventArgs e)
        {
            if (DivergenceConvergencePlot.Series.Any(p => p.GetType() == typeof(OxyPlot.Wpf.LineSeries)))
            {
                //  int l = DivergenceConvergencePlot.Series.Count;
                var list = DivergenceConvergencePlot.Series.Where(p => p.GetType() != typeof(OxyPlot.Wpf.LineSeries)).ToList();

                DivergenceConvergencePlot.Series.Clear();
                list.ForEach(p => DivergenceConvergencePlot.Series.Add(p));

                DivergenceConvergencePlot.InvalidatePlot();
            }

            try
            {
                ScatterPoint res = (ScatterPoint)e.HitTestResult.Item;

                if (res != null)
                {
                    string ID = res.Tag.ToString();

                    OxyPlot.Wpf.LineSeries tempseries = new OxyPlot.Wpf.LineSeries();
                    List <DataPoint>       points     = new List <DataPoint>();

                    //find all series with the ID
                    foreach (OxyPlot.Wpf.ScatterSeries series in DivergenceConvergencePlot.Series)
                    {
                        if (series.Tag.ToString() == ID)
                        {
                            ScatterPoint point = (ScatterPoint)series.Items[0];

                            points.Add(new DataPoint(point.X, point.Y));
                            //contains single point
                        }
                    }

                    tempseries.ItemsSource = points;
                    DivergenceConvergencePlot.Series.Add(tempseries);

                    DivergenceConvergencePlot.InvalidatePlot();
                }
            }
            catch (Exception ex)
            { }
        }
Beispiel #11
0
        /// <summary>
        /// Handles the mouse down event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public virtual void HandleMouseDown(object sender, OxyMouseDownEventArgs e)
        {
            var args = new HitTestArguments(e.Position, MouseHitTolerance);
            foreach (var result in this.HitTest(args))
            {
                e.HitTestResult = result;
                result.Element.OnMouseDown(e);
                if (e.Handled)
                {
                    this.currentMouseEventElement = result.Element;
                    return;
                }
            }

            if (!e.Handled)
            {
                this.OnMouseDown(sender, e);
            }
        }
        /// <summary>
        /// Handles the mouse down event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="OxyPlot.OxyMouseEventArgs" /> instance containing the event data.</param>
        public virtual void HandleMouseDown(object sender, OxyMouseDownEventArgs e)
        {
            var args = new HitTestArguments(e.Position, MouseHitTolerance);
            foreach (var result in this.HitTest(args))
            {
                e.HitTestResult = result;
                result.Element.OnMouseDown(e);
                if (e.Handled)
                {
                    this.currentMouseEventElement = result.Element;
                    return;
                }
            }

            if (!e.Handled)
            {
                this.OnMouseDown(sender, e);
            }
        }
Beispiel #13
0
        private void setSelectedPointInfo(LineSeries lineSeries, OxyMouseDownEventArgs args)
        {
            var firstCommand = GuiModelData.RelatedCommands.FirstOrDefault();
            if (firstCommand == null)
                return;

            SelectedPointInfo =
                string.Format("{0}{1}URL: {2}",
                GetSelectedPointInfo(lineSeries, lineSeries.Points[(int)Math.Round(args.HitTestResult.Index)]),
                Environment.NewLine, firstCommand.HttpInfo.Url);
        }
Beispiel #14
0
 private void CutInsidePolygon(OxyPlot.Series.LineSeries lineSeries, OxyMouseDownEventArgs e)
 {
     DataPoint clickPoint = lineSeries.InverseTransform(e.Position);
     CuttingInsidePolygon.Instance.StartCutting(clickPoint);
     plotModel.InvalidatePlot(false);
 }
 /// <summary>
 /// Raises the <see cref="MouseDown" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="OxyMouseEventArgs" /> instance containing the event data.</param>
 protected virtual void OnMouseDown(object sender, OxyMouseDownEventArgs e)
 {
     var handler = this.MouseDown;
     if (handler != null)
     {
         handler(sender, e);
     }
 }
		public GraphViewPage (ExampleInfo exampleInfo)
		{
			var opv = new OxyPlotView {
				WidthRequest = 300,
				HeightRequest = 300,
			};
			opv.Model = exampleInfo.PlotModel;

			var label = new Label {
				Text = "Category: " + exampleInfo.Category,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			bool GameOfLife = exampleInfo.Title.Contains ("Conway");
			if (!GameOfLife) {
				Content = new StackLayout {
					BackgroundColor = Color.White,
					Orientation = StackOrientation.Vertical,
					VerticalOptions = LayoutOptions.StartAndExpand,
					Children = {
						opv,
						label
					}
				};
			} else {

				var stepButton = new Button {
					Text = "step"
				};
				stepButton.Clicked += (sender, e) => {
					var ea = new OxyMouseDownEventArgs ();
					ea.ChangedButton = OxyMouseButton.Left;
					ea.Position = new ScreenPoint (150, 150);
					opv.Model.HandleMouseDown (this, ea);
					opv.InvalidateDisplay ();
				};


				var startButton = new Button {
					Text = "run"
				};
				startButton.Clicked += (sender, e) => {
					if (!keepRunning) {
						keepRunning = true;
						Device.StartTimer (new TimeSpan (0, 0, 0, 0, 200), () => {
							var ea = new OxyMouseDownEventArgs ();
							ea.ChangedButton = OxyMouseButton.Left;
							ea.Position = new ScreenPoint (150, 150);
							opv.Model.HandleMouseDown (this, ea);
							Device.BeginInvokeOnMainThread(() => {
								opv.InvalidateDisplay ();
							});
							return keepRunning;
						});
					}
				};
				var stopButton = new Button {
					Text = "stop"
				};
				stopButton.Clicked += (sender, e) => {
					keepRunning = false;
				};

				Content = new StackLayout {
					Orientation = StackOrientation.Vertical,
					VerticalOptions = LayoutOptions.FillAndExpand,
					Children = {
						opv,
						label,
						new StackLayout {
							HorizontalOptions = LayoutOptions.Center,
                            VerticalOptions = LayoutOptions.StartAndExpand,
							Orientation = StackOrientation.Horizontal,
                            Children = { stepButton, startButton, stopButton }
						}

					}
				};
			}
		}
Beispiel #17
0
 /// <summary>Graph has been clicked.</summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnChartClick(object sender, OxyMouseDownEventArgs e)
 {
     e.Handled = false;
     if (e.ChangedButton == OxyMouseButton.Left) /// Left clicks only
     {
         if (e.ClickCount == 1 && SingleClick != null)
             SingleClick.Invoke(this, e);
         else if (e.ClickCount == 2)
             OnMouseDoubleClick(sender, e);
     }
 }
Beispiel #18
0
 void lineSeries_MouseDown(object sender, OxyMouseDownEventArgs e)
 {
     if (CurMainStage == Stage.Cutting)
     {
         CutInsidePolygon((OxyPlot.Series.LineSeries)sender, e);
     }
 }
Beispiel #19
0
        /// <summary>
        /// User has double clicked somewhere on a graph.
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        private void OnMouseDoubleClick(object sender, OxyMouseDownEventArgs e)
        {
            Point Location = new Point((int)e.Position.X, (int)e.Position.Y);
            Cairo.Rectangle plotRect = this.plot1.Model.PlotArea.ToRect(false);
            Rectangle plotArea = new Rectangle((int)plotRect.X, (int)plotRect.Y, (int)plotRect.Width, (int)plotRect.Height);
            if (plotArea.Contains(Location))
            {
                Cairo.Rectangle legendRect = this.plot1.Model.LegendArea.ToRect(true);
                Rectangle legendArea = new Rectangle((int)legendRect.X, (int)legendRect.Y, (int)legendRect.Width, (int)legendRect.Height);
                if (legendArea.Contains(Location))
                {
                    int y = Convert.ToInt32(Location.Y - this.plot1.Model.LegendArea.Top);
                    int itemHeight = Convert.ToInt32(this.plot1.Model.LegendArea.Height) / this.plot1.Model.Series.Count;
                    int seriesIndex = y / itemHeight;
                    if (this.OnLegendClick != null)
                    {
                        LegendClickArgs args = new LegendClickArgs();
                        args.seriesIndex = seriesIndex;
                        args.controlKeyPressed = e.IsControlDown;
                        this.OnLegendClick.Invoke(sender, args);
                    }
                }
                else
                {
                    if (this.OnPlotClick != null)
                    {
                        this.OnPlotClick.Invoke(sender, e);
                    }
                }
            }
            else
            {
                Rectangle leftAxisArea = new Rectangle(0, plotArea.Y, plotArea.X, plotArea.Height);
                Rectangle titleArea = new Rectangle(plotArea.X, 0, plotArea.Width, plotArea.Y);
                Rectangle topAxisArea = new Rectangle(plotArea.X, 0, plotArea.Width, 0);

                if (this.GetAxis(Models.Graph.Axis.AxisType.Top) != null)
                {
                    titleArea = new Rectangle(plotArea.X, 0, plotArea.Width, plotArea.Y / 2);
                    topAxisArea = new Rectangle(plotArea.X, plotArea.Y / 2, plotArea.Width, plotArea.Y / 2);
                }

                Rectangle rightAxisArea = new Rectangle(plotArea.Right, plotArea.Top, MainWidget.Allocation.Width - plotArea.Right, plotArea.Height);
                Rectangle bottomAxisArea = new Rectangle(plotArea.Left, plotArea.Bottom, plotArea.Width, MainWidget.Allocation.Height - plotArea.Bottom);
                if (titleArea.Contains(Location))
                {
                    if (this.OnTitleClick != null)
                    {
                        this.OnTitleClick(sender, e);
                    }
                }

                if (this.OnAxisClick != null)
                {
                    if (leftAxisArea.Contains(Location))
                    {
                        this.OnAxisClick.Invoke(Models.Graph.Axis.AxisType.Left);
                    }
                    else if (topAxisArea.Contains(Location))
                    {
                        this.OnAxisClick.Invoke(Models.Graph.Axis.AxisType.Top);
                    }
                    else if (rightAxisArea.Contains(Location))
                    {
                        this.OnAxisClick.Invoke(Models.Graph.Axis.AxisType.Right);
                    }
                    else if (bottomAxisArea.Contains(Location))
                    {
                        this.OnAxisClick.Invoke(Models.Graph.Axis.AxisType.Bottom);
                    }
                }
            }
        }
Beispiel #20
0
 /// <summary>
 /// Adds the specified mouse manipulator and invokes the <see cref="MouseManipulator.Started" /> method with the specified mouse down event arguments.
 /// </summary>
 /// <param name="view">The plot view.</param>
 /// <param name="manipulator">The manipulator to add.</param>
 /// <param name="args">The <see cref="OxyMouseDownEventArgs" /> instance containing the event data.</param>
 public virtual void AddMouseManipulator(
     IView view,
     ManipulatorBase<OxyMouseEventArgs> manipulator,
     OxyMouseDownEventArgs args)
 {
     this.MouseDownManipulators.Add(manipulator);
     manipulator.Started(args);
 }
 private static void DefaultXAxis_MouseDown(object sender, OxyMouseDownEventArgs e)
 {
     throw new NotImplementedException();
 }