Changeset 869 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 11/29/08 13:08:35 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/CanvasUI.cs
r725 r869 2 2 using System.Diagnostics; 3 3 using System.Drawing; 4 using System.Drawing.Drawing2D; 4 5 using System.Windows.Forms; 5 6 … … 26 27 Graphics g = pe.Graphics; 27 28 29 g.SmoothingMode = SmoothingMode.AntiAlias; 30 28 31 g.FillRectangle(Brushes.White, ClientRectangle); 29 32 … … 36 39 Debug.WriteLine(e); 37 40 } 41 } 42 43 protected override void OnResize(EventArgs e) { 44 Invalidate(); 45 46 base.OnResize(e); 38 47 } 39 48 -
trunk/sources/HeuristicLab.Visualization/LineChart.Designer.cs
r754 r869 34 34 // canvasUI1 35 35 // 36 this.canvasUI1.Location = new System.Drawing.Point(3, 3); 36 this.canvasUI1.Dock = System.Windows.Forms.DockStyle.Fill; 37 this.canvasUI1.Location = new System.Drawing.Point(0, 0); 37 38 this.canvasUI1.MouseEventListener = null; 38 39 this.canvasUI1.Name = "canvasUI1"; 39 this.canvasUI1.Size = new System.Drawing.Size(5 46, 384);40 this.canvasUI1.Size = new System.Drawing.Size(552, 390); 40 41 this.canvasUI1.TabIndex = 0; 41 42 this.canvasUI1.Text = "canvasUI1"; -
trunk/sources/HeuristicLab.Visualization/LineChart.cs
r861 r869 22 22 throw new NullReferenceException("Model cannot be null."); 23 23 24 this.model = model;25 this.Item = (IItem)model;26 27 24 //TODO: correct Rectangle to fit 28 25 RectangleD clientRectangle = new RectangleD(-1, -1, 11, 11); 29 26 canvasUI1.MainCanvas.WorldShape = new WorldShape(clientRectangle, clientRectangle); 27 28 this.model = model; 29 this.Item = (IItem)model; 30 30 } 31 31 … … 38 38 model.DataRowRemoved += OnDataRowRemoved; 39 39 model.ModelChanged += OnModelChanged; 40 41 foreach (IDataRow row in model.Rows) { 42 OnDataRowAdded(row); 43 } 40 44 } 41 45 … … 59 63 60 64 for (int i = 1; i < row.Count; i++) { 61 LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color );65 LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color, row.Thickness); 62 66 lineShapes.Add(lineShape); 63 67 canvasUI1.MainCanvas.WorldShape.AddShape(lineShape); … … 76 80 private readonly IDictionary<IDataRow, List<LineShape>> rowToLineShapes = new Dictionary<IDataRow, List<LineShape>>(); 77 81 78 private void OnRowValueChanged(IDataRow row, double value, int index ) {82 private void OnRowValueChanged(IDataRow row, double value, int index, Action action) { 79 83 List<LineShape> lineShapes = rowToLineShapes[row]; 80 84 … … 84 88 // new value was added 85 89 if (index > 0 && index == lineShapes.Count+1) { 86 LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color );90 LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color, row.Thickness); 87 91 lineShapes.Add(lineShape); 88 92 canvasUI1.MainCanvas.WorldShape.AddShape(lineShape); … … 94 98 95 99 // not the last value 96 if (index > 0 && index < row.Count )100 if (index > 0 && index < row.Count-1) 97 101 lineShapes[index].Y1 = value; 98 102 … … 100 104 } 101 105 102 private void OnRowValuesChanged(IDataRow row, double[] values, int index ) {106 private void OnRowValuesChanged(IDataRow row, double[] values, int index, Action action) { 103 107 foreach (double value in values) { 104 OnRowValueChanged(row, value, index++ );108 OnRowValueChanged(row, value, index++, action); 105 109 } 106 110 } -
trunk/sources/HeuristicLab.Visualization/LineShape.cs
r861 r869 6 6 private double z; 7 7 private Color color; 8 private int thickness; 8 9 9 10 /// <summary> … … 15 16 /// <param name="y2">y coordinate of right lineEndPoind</param> 16 17 /// <param name="color">color for the LineShape</param> 17 public LineShape(double x1, double y1, double x2, double y2, double z, Color color ) {18 public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness) { 18 19 this.boundingBox = new RectangleD(x1, y1, x2, y2); 19 20 this.z = z; 20 21 this.color = color; 22 this.thickness = thickness; 21 23 } 22 24 … … 52 54 /// <param name="clippingArea">rectangle in screen-coordinates to draw</param> 53 55 public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) { 54 using (Pen pen = new Pen(color, 3)){56 using (Pen pen = new Pen(color, thickness)){ 55 57 Rectangle screenRect = Transform.ToScreen(boundingBox, viewport, clippingArea); 56 58 graphics.DrawLine(pen,screenRect.Left, screenRect.Bottom, screenRect.Right, screenRect.Top);
Note: See TracChangeset
for help on using the changeset viewer.