1 | using HeuristicLab.Visualization.Options;
|
---|
2 |
|
---|
3 | namespace 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 | private DataRowSettings rowSettings ;
|
---|
14 |
|
---|
15 | public DataRowSettings RowSettings {
|
---|
16 | get { return rowSettings; }
|
---|
17 | set {
|
---|
18 | rowSettings.DataVisualSettingChanged -= value_DataVisualSettingChanged;
|
---|
19 | value.DataVisualSettingChanged += value_DataVisualSettingChanged;
|
---|
20 | rowSettings = value;
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | public DataRowBase() {
|
---|
25 | rowSettings = new DataRowSettings();
|
---|
26 | rowSettings.DataVisualSettingChanged += value_DataVisualSettingChanged;
|
---|
27 | }
|
---|
28 |
|
---|
29 | void value_DataVisualSettingChanged(DataRowSettings row) {
|
---|
30 | OnDataRowChanged(this);
|
---|
31 | }
|
---|
32 |
|
---|
33 | // public bool ShowMarkers {
|
---|
34 | // get { return showMarkers; }
|
---|
35 | // set {
|
---|
36 | // showMarkers = value;
|
---|
37 | // OnDataRowChanged(this);
|
---|
38 | // }
|
---|
39 | // }
|
---|
40 |
|
---|
41 | public string Label
|
---|
42 | {
|
---|
43 | get { return RowSettings.Label; }
|
---|
44 | }
|
---|
45 | //
|
---|
46 | // public Color Color {
|
---|
47 | // get { return color; }
|
---|
48 | // set {
|
---|
49 | // color = value;
|
---|
50 | // OnDataRowChanged(this);
|
---|
51 | // }
|
---|
52 | // }
|
---|
53 | //
|
---|
54 | // public int Thickness {
|
---|
55 | // get { return thickness; }
|
---|
56 | // set {
|
---|
57 | // thickness = value;
|
---|
58 | // OnDataRowChanged(this);
|
---|
59 | // }
|
---|
60 | // }
|
---|
61 |
|
---|
62 | // public DrawingStyle Style {
|
---|
63 | // get { return style; }
|
---|
64 | // set {
|
---|
65 | // style = value;
|
---|
66 | // OnDataRowChanged(this);
|
---|
67 | // }
|
---|
68 | // }
|
---|
69 | //
|
---|
70 | // public DataRowType LineType {
|
---|
71 | // get { return lineType; }
|
---|
72 | // set {
|
---|
73 | // lineType = value;
|
---|
74 | // OnDataRowChanged(this);
|
---|
75 | // }
|
---|
76 | // }
|
---|
77 |
|
---|
78 | public YAxisDescriptor YAxis {
|
---|
79 | get { return yAxis; }
|
---|
80 | set {
|
---|
81 | yAxis = value;
|
---|
82 | yAxis.AddDataRow(this);
|
---|
83 | yAxis.YAxisDescriptorChanged += delegate { OnDataRowChanged(this); };
|
---|
84 | OnDataRowChanged(this);
|
---|
85 | }
|
---|
86 | }
|
---|
87 |
|
---|
88 | protected void OnDataRowChanged(IDataRow row) {
|
---|
89 | if (DataRowChanged != null) {
|
---|
90 | DataRowChanged(this);
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 | protected void OnValuesChanged(double[] values, int index, Action action) {
|
---|
95 | if (ValuesChanged != null) {
|
---|
96 | ValuesChanged(this, values, index, action);
|
---|
97 | }
|
---|
98 | }
|
---|
99 |
|
---|
100 | protected void OnValueChanged(double value, int index, Action action) {
|
---|
101 | if (ValueChanged != null) {
|
---|
102 | ValueChanged(this, value, index, action);
|
---|
103 | }
|
---|
104 | }
|
---|
105 |
|
---|
106 | public abstract void AddValue(double value);
|
---|
107 |
|
---|
108 | public abstract void AddValue(double value, int index);
|
---|
109 |
|
---|
110 | public abstract void AddValues(double[] values);
|
---|
111 |
|
---|
112 | public abstract void AddValues(double[] values, int index);
|
---|
113 |
|
---|
114 | public abstract void ModifyValue(double value, int index);
|
---|
115 |
|
---|
116 | public abstract void ModifyValues(double[] values, int index);
|
---|
117 |
|
---|
118 | public abstract void RemoveValue(int index);
|
---|
119 |
|
---|
120 | public abstract void RemoveValues(int index, int count);
|
---|
121 |
|
---|
122 | public abstract int Count { get; }
|
---|
123 |
|
---|
124 | public abstract double this[int index] { get; set; }
|
---|
125 |
|
---|
126 | public abstract double MinValue { get; }
|
---|
127 |
|
---|
128 | public abstract double MaxValue { get; }
|
---|
129 |
|
---|
130 | public event ValuesChangedHandler ValuesChanged;
|
---|
131 |
|
---|
132 | public event ValueChangedHandler ValueChanged;
|
---|
133 |
|
---|
134 | public event DataRowChangedHandler DataRowChanged;
|
---|
135 | }
|
---|
136 | } |
---|