public GraphBackground(SimpleShader2D shaderProgram) { _uniformTransform = shaderProgram.UniformTransform; _uniformColor = shaderProgram.UniformColor; _selectionBlock = new GLSLVertexBuffer <Vector2>(); _selectionBlock.SetAttributeInfo(shaderProgram.AttributeCoord2D, 2); _selectionData = new Vector2[4]; _selectionData[0] = new Vector2(0, -1); _selectionData[1] = new Vector2(0, 1); _selectionData[2] = new Vector2(1, -1); _selectionData[3] = new Vector2(1, 1); _selectionBlock.BindData(_selectionData, BufferUsageHint.StaticDraw); SelectorColor = Color4.LightSkyBlue; SelectionColor = Color4.LightGray; _shiftMatrix = Matrix4.Identity; _XShift = 0; _lastMousePosition = new Point(0, 0); Enabled = true; MarkList = new MarkList(); }
public GraphXAxis(SimpleShader2D shaderProgram) { _shader = shaderProgram; _uniformTransform = shaderProgram.UniformTransform; _uniformColor = shaderProgram.UniformColor; DrawMinorTicks = true; MinorTickScale = 0.5f; TickColor = Color4.Black; GridColor = Color4.LightGray; DrawMajorGridlines = false; DrawMinorGridlines = false; _tickMajorBuffer = new GLSLVertexBuffer <Vector2>(); _tickMinorBuffer = new GLSLVertexBuffer <Vector2>(); _gridMajorBuffer = new GLSLVertexBuffer <Vector2>(); _gridMinorBuffer = new GLSLVertexBuffer <Vector2>(); _tickMajorBuffer.SetAttributeInfo(_shader.AttributeCoord2D, 2); _tickMinorBuffer.SetAttributeInfo(_shader.AttributeCoord2D, 2); _gridMajorBuffer.SetAttributeInfo(_shader.AttributeCoord2D, 2); _gridMinorBuffer.SetAttributeInfo(_shader.AttributeCoord2D, 2); MajorOffsets = new List <float>(); MinorOffsets = new List <float>(); }
public static void Initialise(ViewFormSetup setup, ViewForm ui) { //DateTime begin = DateTime.Now; Size viewportSize = ui.ViewPortSize; SimpleShader2D = new SimpleShader2D(); ControlWidth = viewportSize.Width; ControlHeight = viewportSize.Height; BorderSize = 20; TickSize = 10; TextSize = 100; SetViewportTransfrom(); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); _projection = Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, -10, 10); //0, _graph.Bounds.X, 0, _graph.Bounds.Y, -10, 10); GL.MultMatrix(ref _projection); ServerSocket = new ServerSocket(setup.Socket); FileManager = new FileManager(setup.Project); Initialised = true; int filterCount = setup.Project.FilterFiles.Count; TimeTree = new TimeFrameTree(FileManager, filterCount); TimeTree.Fill(); FrameElement tmp = TimeTree; while (tmp.Children.Count == 1 && tmp.Level != FrameNodeLevel.Minute) { tmp = tmp.Children[0]; tmp.Fill(); } MajorTickDepth = (FrameNodeLevel)(((int)tmp.Level) + 1); if ((int)MajorTickDepth >= (int)FrameNodeLevel.Minute) { RenderUnit = FrameNodeLevel.Second; } else if ((int)MajorTickDepth <= (int)FrameNodeLevel.Month) { RenderUnit = (FrameNodeLevel)(((int)MajorTickDepth) + 2); } else { RenderUnit = (FrameNodeLevel)(((int)MajorTickDepth) + 1); } var start = TimeTree.StartTime; var end = TimeTree.EndTime; //CurrentCanvasData = TimeTree.GetCanvasData(new DateTime(start.Year, start.Month, 1), new DateTime(start.Year, start.Month + 1, 1), FrameNodeLevel.Day, FrameNodeLevel.Month); CurrentCanvasData = TimeTree.GetCanvasData(start, end, RenderUnit, FrameNodeLevel.Root); // TimeSpan total = DateTime.Now.Subtract(begin); // MessageBox.Show("Setup Time (ms): " + total.TotalMilliseconds); }
public GraphYAxis(SimpleShader2D shaderProgram) { _shaderProgram = shaderProgram; YTicks = new GLSLVertexBuffer <Vector2>(); YTicks.SetAttributeInfo(shaderProgram.AttributeCoord2D, 2); }
public GraphCanvas(string name, SimpleShader2D shaderProgram) { _shaderProgram = shaderProgram; Color = Color4.LightSteelBlue; _alphaBlend = 1f; _frontBuffer = new GLSLVertexBuffer <Vector2>(); _backBuffer = new GLSLVertexBuffer <Vector2>(); GraphType = GraphType.LineGraph; ScaleFunction = new GraphScaleConfig(GraphScaleFunction.Maximum, GraphScaleTarget.DataVolume); Hide = false; Name = name; }