Esempio n. 1
0
        public void Display(GLRect rect, bool draw)
        {
            if (Window == null)
            {
                Window = new GraphWindow();
            }

            var xyratio  = Window.DataWidth / Window.DataHeight;
            var newRatio = rect.Width / rect.Height;

            Window.DataOrigin   = rect.Location;
            Window.DataWidth    = rect.Width;
            Window.DataHeight   = rect.Height;
            Window.WindowWidth  = _glcontrol.Width;
            Window.WindowHeight = _glcontrol.Height;

            if (Window.WindowWidth == 0)
            {
                throw new Exception(ZeroError);
            }
            if (Window.WindowHeight == 0)
            {
                throw new Exception(ZeroError);
            }

            if (Math.Abs(newRatio - xyratio) > 0.01)
            {
                _displayChanged = true;
            }
            if (draw)
            {
                Draw();
            }
        }
 public static GLPoint GetMagnitude(Point p, GraphWindow w) {
     var xscale = (w.Finish - w.Start) / w.WindowWidth;
     var yscale = (w.Top - w.Bottom) / w.WindowHeight;
     const double xoffset = 0; //window x start
     const double yoffset = 0; //window y start
     return new GLPoint((p.X - xoffset) * xscale,
                       (p.Y - yoffset) * yscale);
 }
Esempio n. 3
0
        public static GLPoint GetMagnitude(Point p, GraphWindow w)
        {
            var          xscale  = (w.Finish - w.Start) / w.WindowWidth;
            var          yscale  = (w.Top - w.Bottom) / w.WindowHeight;
            const double xoffset = 0; //window x start
            const double yoffset = 0; //window y start

            return(new GLPoint((p.X - xoffset) * xscale,
                               (p.Y - yoffset) * yscale));
        }
Esempio n. 4
0
        public void Draw()
        {
            if (Window == null)
            {
                Window = new GraphWindow {
                    DataOrigin   = new GLPoint(0, 0),
                    DataHeight   = 100,
                    DataWidth    = 100,
                    WindowHeight = Control.Height,
                    WindowWidth  = Control.Width
                };
            }
            if (Window.WindowWidth == 0 || Window.WindowHeight == 0)
            {
                return;
            }

            _glcontrol.MakeCurrent();

            if (_displayChanged)
            {
                _displayChanged = false;
                LoadDisplayLists();
            }


            GL.ClearColor(1.0f, 1.0f, 1.0f, 1.0f);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.LoadIdentity();

            SetupProjection();

            ConfigureLeftTickBar();
            ConfigureBottomTickBar();

            _leftTickBar.DrawCrossLines();
            _bottomTickBar.DrawCrossLines();

            DrawDataAndMarkers();

            if (TextEnabled)
            {
                _leftTickBar.DrawTicks();
                _bottomTickBar.DrawTicks();
            }

            DrawDeadSpace();

            _glcontrol.SwapBuffers();
        }
        public void Draw(GraphWindow window, GLPoint location) {
            GL.Color3(1.0, 1.0, 1.0);
            GL.BindTexture(TextureTarget.Texture2D, _texture);

            var height = GetMagnitude(new Point(0, _bitmap.Height),window).Y;
            var width = GetMagnitude(new Point(_bitmap.Width, 0), window).X;

            var ox = location.X - (width / 2.0);
            var oy = location.Y - (height / 2.0);

            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0f, 0f); GL.Vertex2(ox, oy + height);
            GL.TexCoord2(1f, 0f); GL.Vertex2(ox + width, oy + height);
            GL.TexCoord2(1f, 1f); GL.Vertex2(ox + width, oy);
            GL.TexCoord2(0f, 1f); GL.Vertex2(ox, oy);
            GL.End();

            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
Esempio n. 6
0
        public void Draw(GraphWindow window, GLPoint location)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("PersistentTexture");
            }
            GL.Color3(1.0, 1.0, 1.0);
            GL.BindTexture(TextureTarget.Texture2D, _texture);

            var height = GetMagnitude(new Point(0, _bitmap.Height), window).Y;
            var width  = GetMagnitude(new Point(_bitmap.Width, 0), window).X;

            var ox = location.X - (width / 2.0);
            var oy = location.Y - (height / 2.0);

            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0f, 0f); GL.Vertex2(ox, oy + height);
            GL.TexCoord2(1f, 0f); GL.Vertex2(ox + width, oy + height);
            GL.TexCoord2(1f, 1f); GL.Vertex2(ox + width, oy);
            GL.TexCoord2(0f, 1f); GL.Vertex2(ox, oy);
            GL.End();

            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
Esempio n. 7
0
 public void Draw(GraphWindow window) {
     Draw();
 }
Esempio n. 8
0
 public void Draw(GraphWindow window)
 {
     Draw();
 }
Esempio n. 9
0
        public void Display(GLRect rect, bool draw) {
            if (Window == null) {
                Window = new GraphWindow();
            }

            var xyratio = Window.DataWidth / Window.DataHeight;
            var newRatio = rect.Width / rect.Height;

            Window.DataOrigin = rect.Location;
            Window.DataWidth = rect.Width;
            Window.DataHeight = rect.Height;
            Window.WindowWidth = _glcontrol.Width;
            Window.WindowHeight = _glcontrol.Height;

            if (Window.WindowWidth == 0) throw new Exception(ZeroError);
            if (Window.WindowHeight == 0) throw new Exception(ZeroError);

            if (Math.Abs(newRatio - xyratio) > 0.01) {
                _displayChanged = true;
            }
            if (draw) {
                Draw();
            }
        }
Esempio n. 10
0
        public void Draw() {
            if (Window == null) {
                Window = new GraphWindow {
                    DataOrigin = new GLPoint(0, 0),
                    DataHeight = 100,
                    DataWidth = 100,
                    WindowHeight = Control.Height,
                    WindowWidth = Control.Width
                };
            }
            if (Window.WindowWidth == 0 || Window.WindowHeight == 0) return;

            _glcontrol.MakeCurrent();

            if (_displayChanged) {
                _displayChanged = false;
                LoadDisplayLists();
            }


            GL.ClearColor(1.0f, 1.0f, 1.0f, 1.0f);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.LoadIdentity();

            SetupProjection();

            ConfigureLeftTickBar();
            ConfigureBottomTickBar();

            _leftTickBar.DrawCrossLines();
            _bottomTickBar.DrawCrossLines();

            DrawDataAndMarkers();

            if (TextEnabled) {
                _leftTickBar.DrawTicks();
                _bottomTickBar.DrawTicks();
            }

            DrawDeadSpace();

            _glcontrol.SwapBuffers();
        }
Esempio n. 11
0
        public void Display(GLRect rect, bool draw) {
            if (Window == null) {
                Window = new GraphWindow();
            }
            Window.DataOrigin = rect.Location;
            Window.DataWidth = rect.Width;
            Window.DataHeight = rect.Height;
            Window.WindowWidth = _glcontrol.Width;
            Window.WindowHeight = _glcontrol.Height;

            if (Window.WindowWidth == 0) throw new Exception(ZeroError);
            if (Window.WindowHeight == 0) throw new Exception(ZeroError);

            _glcontrol.MakeCurrent();

            LoadDisplayLists();
            if (draw) {
                Draw();
            }
        }