Esempio n. 1
0
 public float GetMinRangeX()
 {
     return(Projection.GetMinRangeX());
 }
 public HorizontalGridLinePainter(int width, Projection projection)
 {
     _width      = width;
     _projection = projection;
 }
Esempio n. 3
0
 public void MoveRangeX(float delta)
 {
     Projection.moveRangeX(delta); // Common x-axis for all graphs
     paintAll(_graphicsPictureBox);
 }
Esempio n. 4
0
 public void SetRangeX(float xMin, float xMax)
 {
     Projection.setRangeX(xMin, xMax); // Common x-axis for all graphs
     paintAll(_graphicsPictureBox);
 }
Esempio n. 5
0
 public void SetRangeY(float yMin, float yMax)
 {
     Projection.setRangeY(yMin, yMax);
 }
Esempio n. 6
0
 // Call this after fylling with all points (after parsing of the file)
 public void init_X_Limit()
 {
     Projection.SetX_Limit(GetMinimumX(), GetMaximumX());
 }
Esempio n. 7
0
        public void MouseWheel(object sender, MouseEventArgs e)
        {
            Point screenPoint = Cursor.Position;
            Point graphPoint  = _pictureBox.PointToClient(screenPoint);
            float fZoomingPoint_real;
            float newRange;

            if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
            {
                zoom_Y(sender, e);
                return;
            }
            else if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt)
            {
                float fMax        = _graphList[1].projection.YMax;
                float fMin        = _graphList[1].projection.YMin;
                int   graphHeight = ((PictureBox)sender).Height;

                Point relatMousePoint = _pictureBox.PointToClient(screenPoint);

                float fZoomingCoef = ((float)relatMousePoint.Y) / graphHeight; // Projection.Height;
                fZoomingPoint_real = fMax - (_graphList[1].projection.YRange * fZoomingCoef);

                if (e.Delta > 0)
                {
                    newRange = _graphList[1].projection.YRange / 1.2f;
                }
                else
                {
                    newRange = _graphList[1].projection.YRange * 1.2f;
                }

                float fNewY_end = fZoomingPoint_real + fZoomingCoef * newRange;

                float fNewY_start = fNewY_end - newRange;

                /*
                 * if (fNewY_start < graphicMinX)
                 *  fNewY_start = graphicMinX;
                 *
                 * if (fNewY_end > graphicMaxX)
                 *  fNewY_end = graphicMaxX;
                 */

                _graphList[1].projection.SetY_Limit(fNewY_start, fNewY_end);


                Refresh();
                _form.positionPanel_Refresh();

                return;
            }

            int graphWidth = ((PictureBox)sender).Width;



            // TODO: min/max X should be found when adding points to graphs. Change "GetMinimuxX()";
            float graphicMinX   = _graphList[0].GetFirstPoint().X; // GetMinimumX();
            float graphicMaxX   = _graphList[0].GetLastPoint().X;  //GetMaximumX();
            float graphicRangeX = graphicMaxX - graphicMinX;

            float fZoomingPointProportion = ((float)graphPoint.X) / graphWidth;

            fZoomingPoint_real = Projection.XMin + (Projection.XRange * fZoomingPointProportion);

            if (e.Delta > 0)
            {
                newRange = Projection.XRange / 2;
            }
            else
            {
                newRange = Projection.XRange * 2;
            }

            float fNewX_start = fZoomingPoint_real - fZoomingPointProportion * newRange;
            float fNewX_end   = fNewX_start + newRange;

            if (fNewX_start < graphicMinX)
            {
                fNewX_start = graphicMinX;
            }

            if (fNewX_end > graphicMaxX)
            {
                fNewX_end = graphicMaxX;
            }

            Projection.setRangeX(fNewX_start, fNewX_end);
            Refresh();
            _form.positionPanel_Refresh();
        }