Exemple #1
0
        /// <summary>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void MouseDown(NuGenVisiPlot2D sender, MouseEventArgs e)
        {
            if (sender == null || e.Button != MouseButtons.Left)
            {
                return;
            }
            NuGenPlotPaintInterval selscr = sender.SelectionScreen;

            ac = Action(selscr, e.X);
            switch (ac)
            {
            case 1:
            case 3:
                dx = e.X - selscr.Start;
                break;

            case 2:
                dx = e.X - selscr.End;
                break;

            default:
                sender.SelectionScreen = new NuGenPlotPaintInterval(e.X, 0);
                dx = 0;
                ac = 2;
                break;
            }
            sender.Cursor = _curs[ac];
        }
Exemple #2
0
        /// <summary>
        /// </summary>
        public NuGenPlotPaintInterval ScaleTranslateMathToClient(NuGenPlotPaintIntervalF interval)
        {
            NuGenPlotPaintInterval ret = ScaleMathToClient(interval);

            ret.Start += _gitter.X;
            ret.End   += _gitter.X;
            return(ret);
        }
Exemple #3
0
        /// <summary>
        /// </summary>
        public NuGenPlotPaintIntervalF ScaleTranslateClientToMath(NuGenPlotPaintInterval interval, bool round)
        {
            interval.Start -= _gitter.X;
            interval.End   -= _gitter.X;
            NuGenPlotPaintIntervalF ret = new NuGenPlotPaintIntervalF(
                (float)(interval.Start) / (float)(_gitter.Width),
                (float)(interval.End) / (float)(_gitter.Width));

            if (round)
            {
                return(new NuGenPlotPaintIntervalF(
                           (float)Math.Round((double)ret.Start, 0),
                           (float)Math.Round((double)ret.End, 0)));
            }
            else
            {
                return(ret);
            }
        }
Exemple #4
0
 private static int Action(NuGenPlotPaintInterval selscr, int x)
 {
     if (x > selscr.Start - 3 && x < selscr.Start + 3)
     {
         return(1);
     }
     else if (x > selscr.End - 3 && x < selscr.End + 3)
     {
         return(2);
     }
     else if (x > selscr.Start + 3 && x < selscr.End - 3)
     {
         return(3);
     }
     else
     {
         return(0);
     }
 }
Exemple #5
0
        private void DoSelection(NuGenVisiPlot2D sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                ac = Action(
                    sender.SelectionScreen, e.X);
                sender.Cursor = _curs[ac];
            }
            else
            {
                Rectangle r_Gitter         = sender.GridRectangle;
                NuGenPlotPaintInterval sel = sender.SelectionScreen;
                switch (ac)
                {
                case 3:
                    int w = sel.Width;
                    sel.Start = e.X - dx;
                    sel.Width = w;
                    break;

                case 1:
                    sel = new NuGenPlotPaintInterval(e.X - dx, sel.End);
                    break;

                case 2:
                    sel = new NuGenPlotPaintInterval(sel.Start, e.X - dx);
                    break;

                case 0:
                    sel.Start = sel.End = e.X - dx;
                    break;
                }
                if (Control.ModifierKeys == Keys.Shift)
                {
                    sender.SetSelectionScreenRound(sel);
                }
                else
                {
                    sender.SelectionScreen = sel;
                }
            }
        }
Exemple #6
0
        private void DrawSelection(Graphics gr)
        {
            if (_selection.End - _selection.Start == 0f)
            {
                return;
            }
            if (!(_tool is NuGenSelectionPlotTool))
            {
                return;
            }

            NuGenPlotPaintInterval iv = ScaleMathToClient(RightOrderInterval(_selection));

            _brush.Color = _colors[(int)Colors.Selection];

            Rectangle rct = Rectangle.FromLTRB(iv.Start, -_gitter.Y, iv.End, 0);

            rct.Height = this.Height;
            //Use this for range selection
            gr.FillRectangle(_brush, rct);
            gr.DrawLine(Pens.White, rct.X, rct.Y, rct.X, rct.Bottom);
            gr.DrawLine(Pens.White, rct.Right, rct.Y, rct.Right, rct.Bottom);
        }
		private void DoSelection(NuGenVisiPlot2D sender, MouseEventArgs e)
		{
			if (e.Button != MouseButtons.Left)
			{
				ac = Action(
					sender.SelectionScreen, e.X);
				sender.Cursor = _curs[ac];
			}
			else
			{
				Rectangle r_Gitter = sender.GridRectangle;
				NuGenPlotPaintInterval sel = sender.SelectionScreen;
				switch (ac)
				{
					case 3:
					int w = sel.Width;
					sel.Start = e.X - dx;
					sel.Width = w;
					break;
					case 1:
					sel = new NuGenPlotPaintInterval(e.X - dx, sel.End);
					break;
					case 2:
					sel = new NuGenPlotPaintInterval(sel.Start, e.X - dx);
					break;
					case 0:
					sel.Start = sel.End = e.X - dx;
					break;
				}
				if (Control.ModifierKeys == Keys.Shift)
					sender.SetSelectionScreenRound(sel);
				else
					sender.SelectionScreen = sel;
			}
		}
		private static int Action(NuGenPlotPaintInterval selscr, int x)
		{
			if (x > selscr.Start - 3 && x < selscr.Start + 3)
				return 1;
			else if (x > selscr.End - 3 && x < selscr.End + 3)
				return 2;
			else if (x > selscr.Start + 3 && x < selscr.End - 3)
				return 3;
			else
				return 0;
		}
		/// <summary>
		/// </summary>
		public void SetSelectionScreenRound(NuGenPlotPaintInterval selscr)
		{
			Selection = ScaleTranslateClientToMath(selscr, true);
		}
		/// <summary>
		/// </summary>
		public NuGenPlotPaintIntervalF ScaleTranslateClientToMath(NuGenPlotPaintInterval interval, bool round)
		{
			interval.Start -= _gitter.X;
			interval.End -= _gitter.X;
			NuGenPlotPaintIntervalF ret = new NuGenPlotPaintIntervalF(
				(float)(interval.Start) / (float)(_gitter.Width),
				(float)(interval.End) / (float)(_gitter.Width));
			if (round)
				return new NuGenPlotPaintIntervalF(
					(float)Math.Round((double)ret.Start, 0),
					(float)Math.Round((double)ret.End, 0));
			else
				return ret;
		}
Exemple #11
0
 /// <summary>
 /// </summary>
 public void SetSelectionScreenRound(NuGenPlotPaintInterval selscr)
 {
     Selection = ScaleTranslateClientToMath(selscr, true);
 }
Exemple #12
0
 /// <summary>
 /// </summary>
 public NuGenPlotPaintInterval ScaleMathToClient(NuGenPlotPaintIntervalF interval)
 {
     interval.Start *= (float)_gitter.Width;
     interval.End   *= (float)_gitter.Width;
     return(NuGenPlotPaintInterval.Round(interval));
 }