Пример #1
0
        void DrawMajorMinorTicks()
        {
            OpenGL.PushMatrix(() => {
                MoveFiftyPixelsRight();

                GL.Scale(1.0 / Window.DataWidth, 1.0 / Window.WindowHeight, 1);
                GL.Translate(-Window.DataOrigin.X, 0, 0);

                GL.Color3(0.0, 0.0, 0.0);
                OpenGL.WithoutSmoothing(() => {
                    OpenGL.Begin(BeginMode.Lines, () => {
                        var majorTicks = RangeHelper.FindTicks(MajorTick, RangeStart, RangeStop);
                        var minorTicks = RangeHelper.FindTicks(MinorTick, RangeStart, RangeStop);
                        foreach (var tick in majorTicks)
                        {
                            DrawMajorTick(TickStart + tick);
                        }
                        foreach (var tick in minorTicks.Where(x => !minorTicks.Any(y => Math.Abs(x - y) < 0.0001)))
                        {
                            DrawMinorTick(TickStart + tick);
                        }
                    });
                });
            });
        }
Пример #2
0
        public void DrawCrossLines()
        {
            OpenGL.PushMatrix(() => {
                MoveFiftyPixelsRight();
                GL.Scale(1.0 / Window.DataWidth, 1.0 / Window.WindowHeight, 1);
                GL.Translate(-Window.DataOrigin.X, 50, 0);

                GL.Color4(0.0, 0.0, 0.0, 0.25);
                OpenGL.WithoutSmoothing(() => {
                    OpenGL.Begin(BeginMode.Lines, () => {
                        var majorTicks = RangeHelper.FindTicks(MajorTick, RangeStart, RangeStop);
                        foreach (var tick in majorTicks)
                        {
                            GL.Vertex2(TickStart + tick, 0);
                            GL.Vertex2(TickStart + tick, Window.WindowHeight);
                        }
                    });
                });
            });
        }
Пример #3
0
 void DrawText()
 {
     OpenGL.PushMatrix(() => {
         MoveFiftyPixelsRight();
         GL.Scale(1.0 / Window.WindowWidth, 1.0 / Window.WindowHeight, 1.0);
         var majorTicks = RangeHelper.FindTicks(MajorTick, RangeStart, RangeStop);
         foreach (var tick in majorTicks)
         {
             var tickText = tick.ToString(CultureInfo.InvariantCulture);
             PieceOfText pot;
             if (_texts.ContainsKey(tickText))
             {
                 pot = _texts[tickText];
             }
             else
             {
                 pot = new PieceOfText(_font, tickText);
                 _texts[tickText] = pot;
             }
             pot.Draw(new GLPoint(((tick - Window.Start) / Window.DataWidth) * Window.WindowWidth - 5, 0), null, null, false);
         }
     });
 }