/// <summary> /// Swaps the draw positions of two canvases in the canvas list /// </summary> /// <param name="index1">the first canvas</param> /// <param name="index2">the second canvas</param> public void SwapDrawPosition(int index1, int index2) { GraphCanvas tmp = List[index1]; List[index1] = List[index2]; List[index2] = tmp; }
/// <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); }
/// <summary> /// Adds a graph canvas to the canvas list /// </summary> /// <param name="canvas">the graph canvas to add</param> public void Add(GraphCanvas canvas) { List.Add(canvas); }