Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive_Milestone2/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs @ 6004

Last change on this file since 6004 was 1561, checked in by dwagner, 16 years ago

Added functionality: Checkbox to enable/disable Markers for every datapoint added to OptionsDialog. (#581)

File size: 2.9 KB
Line 
1using System.Drawing;
2
3namespace HeuristicLab.Visualization {
4  public abstract class DataRowBase : IDataRow {
5    private string label = "";
6    private Color color = Color.Black;
7    private int thickness = 2;
8    private DrawingStyle style = DrawingStyle.Solid;
9    private DataRowType lineType = DataRowType.Normal;
10    private YAxisDescriptor yAxis;
11    private bool showMarkers = true;
12
13    public bool ShowMarkers {
14      get { return showMarkers; }
15      set {
16        showMarkers = value;
17        OnDataRowChanged(this);
18      }
19    }         
20
21    public string Label {
22      get { return label; }
23      set {
24        label = value;
25        OnDataRowChanged(this);
26      }
27    }
28
29    public Color Color {
30      get { return color; }
31      set {
32        color = value;
33        OnDataRowChanged(this);
34      }
35    }
36
37    public int Thickness {
38      get { return thickness; }
39      set {
40        thickness = value;
41        OnDataRowChanged(this);
42      }
43    }
44
45    public DrawingStyle Style {
46      get { return style; }
47      set {
48        style = value;
49        OnDataRowChanged(this);
50      }
51    }
52
53    public DataRowType LineType {
54      get { return lineType; }
55      set {
56        lineType = value;
57        OnDataRowChanged(this);
58      }
59    }
60
61    public YAxisDescriptor YAxis {
62      get { return yAxis; }
63      set {
64        yAxis = value;
65        yAxis.AddDataRow(this);
66        yAxis.YAxisDescriptorChanged += delegate { OnDataRowChanged(this); };
67        OnDataRowChanged(this);
68      }
69    }
70
71    protected void OnDataRowChanged(IDataRow row) {
72      if (DataRowChanged != null) {
73        DataRowChanged(this);
74      }
75    }
76
77    protected void OnValuesChanged(double[] values, int index, Action action) {
78      if (ValuesChanged != null) {
79        ValuesChanged(this, values, index, action);
80      }
81    }
82
83    protected void OnValueChanged(double value, int index, Action action) {
84      if (ValueChanged != null) {
85        ValueChanged(this, value, index, action);
86      }
87    }
88
89    public abstract void AddValue(double value);
90
91    public abstract void AddValue(double value, int index);
92
93    public abstract void AddValues(double[] values);
94
95    public abstract void AddValues(double[] values, int index);
96
97    public abstract void ModifyValue(double value, int index);
98
99    public abstract void ModifyValues(double[] values, int index);
100
101    public abstract void RemoveValue(int index);
102
103    public abstract void RemoveValues(int index, int count);
104
105    public abstract int Count { get; }
106
107    public abstract double this[int index] { get; set; }
108
109    public abstract double MinValue { get; }
110
111    public abstract double MaxValue { get; }
112
113    public event ValuesChangedHandler ValuesChanged;
114
115    public event ValueChangedHandler ValueChanged;
116
117    public event DataRowChangedHandler DataRowChanged;
118  }
119}
Note: See TracBrowser for help on using the repository browser.