Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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>();
        }
Esempio n. 3
0
        public GraphYAxis(SimpleShader2D shaderProgram)
        {
            _shaderProgram = shaderProgram;

            YTicks = new GLSLVertexBuffer <Vector2>();

            YTicks.SetAttributeInfo(shaderProgram.AttributeCoord2D, 2);
        }
Esempio n. 4
0
        /// <summary>
        /// Initialises the capture graph with the default graph collection
        /// </summary>
        public void Initialise()
        {
            //clear the canvas collection and crreate default graphs
            CanvasCollection.Clear();
            DataVolume = new GraphCanvas("Traffic Volume", CanvasManager.SimpleShader2D)
            {
                Color = Color4.Firebrick
            };
            PacketCount = new GraphCanvas("Packet Count", CanvasManager.SimpleShader2D)
            {
                Color = Color4.DarkSlateBlue
            };

            MatchingCounts.Clear();

            var colors = FilterColors(CanvasManager.FileManager.CountCache.FilterFiles.Count);

            for (int k = 0; k < CanvasManager.FileManager.CountCache.FilterFiles.Count; k++)
            {
                var    filter = CanvasManager.FileManager.CountCache.FilterFiles[k];
                string name   = filter.Filename;
                name = name.Substring(name.LastIndexOf('\\') + 1, name.LastIndexOf('.') - name.LastIndexOf('\\') - 1);
                MatchingCounts.Add(new GraphCanvas(name, CanvasManager.SimpleShader2D)
                {
                    Color         = colors[k],
                    ScaleFunction = new GraphScaleConfig(GraphScaleFunction.Maximum, GraphScaleTarget.PacketCount),
                    GraphType     = GraphType.SolidGraph
                });
            }

            //set the shaders for the axis and background ui
            _yAxis      = new GraphYAxis(CanvasManager.SimpleShader2D);
            _background = new GraphBackground(CanvasManager.SimpleShader2D);
            _xAxis      = new GraphXAxis(CanvasManager.SimpleShader2D);

            //initialise the border
            Border = new GLSLVertexBuffer <Vector2>();
            Border.SetAttributeInfo(CanvasManager.SimpleShader2D.AttributeCoord2D, 2);

            //set the default graph types
            DataVolume.GraphType  = GraphType.LineGraph;
            PacketCount.GraphType = GraphType.SolidGraph;

            //sett eh default grraph scale funtions
            DataVolume.ScaleFunction  = new GraphScaleConfig(GraphScaleFunction.Maximum, GraphScaleTarget.DataVolume);
            PacketCount.ScaleFunction = new GraphScaleConfig(GraphScaleFunction.Maximum, GraphScaleTarget.PacketCount);

            //add the default graphs to the canvas collection
            CanvasCollection.Add(PacketCount);

            foreach (GraphCanvas canvas in MatchingCounts)
            {
                CanvasCollection.Add(canvas);
            }

            CanvasCollection.Add(DataVolume);
        }
Esempio n. 5
0
        /// <summary>
        /// Swaps the back buffer and front buffer, and empties the new back buffer (old front buffer)
        /// </summary>
        public void SwapBuffers()
        {
            if (_backData == null)
            {
                return;
            }
            var tmp = _frontBuffer;

            _frontBuffer = _backBuffer;
            _frontData   = _backData;
            _backBuffer  = tmp;
            _backData    = null;
        }
Esempio n. 6
0
        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;
        }