1 | using System.Drawing;
|
---|
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 |
|
---|
12 | public string Label {
|
---|
13 | get { return label; }
|
---|
14 | set {
|
---|
15 | label = value;
|
---|
16 | OnDataRowChanged(this);
|
---|
17 | }
|
---|
18 | }
|
---|
19 |
|
---|
20 | public Color Color {
|
---|
21 | get { return color; }
|
---|
22 | set {
|
---|
23 | color = value;
|
---|
24 | OnDataRowChanged(this);
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | public int Thickness {
|
---|
29 | get { return thickness; }
|
---|
30 | set {
|
---|
31 | thickness = value;
|
---|
32 | OnDataRowChanged(this);
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | public DrawingStyle Style {
|
---|
37 | get { return style; }
|
---|
38 | set {
|
---|
39 | style = value;
|
---|
40 | OnDataRowChanged(this);
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | public DataRowType LineType {
|
---|
45 | get { return lineType; }
|
---|
46 | set {
|
---|
47 | lineType = value;
|
---|
48 | OnDataRowChanged(this);
|
---|
49 | }
|
---|
50 | }
|
---|
51 |
|
---|
52 | public YAxisDescriptor YAxis {
|
---|
53 | get { return yAxis; }
|
---|
54 | set {
|
---|
55 | yAxis = value;
|
---|
56 | yAxis.AddDataRow(this);
|
---|
57 | yAxis.YAxisDescriptorChanged += delegate { OnDataRowChanged(this); };
|
---|
58 | OnDataRowChanged(this);
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | protected void OnDataRowChanged(IDataRow row) {
|
---|
63 | if (DataRowChanged != null) {
|
---|
64 | DataRowChanged(this);
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | protected void OnValuesChanged(double[] values, int index, Action action) {
|
---|
69 | if (ValuesChanged != null) {
|
---|
70 | ValuesChanged(this, values, index, action);
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | protected void OnValueChanged(double value, int index, Action action) {
|
---|
75 | if (ValueChanged != null) {
|
---|
76 | ValueChanged(this, value, index, action);
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | public abstract void AddValue(double value);
|
---|
81 |
|
---|
82 | public abstract void AddValue(double value, int index);
|
---|
83 |
|
---|
84 | public abstract void AddValues(double[] values);
|
---|
85 |
|
---|
86 | public abstract void AddValues(double[] values, int index);
|
---|
87 |
|
---|
88 | public abstract void ModifyValue(double value, int index);
|
---|
89 |
|
---|
90 | public abstract void ModifyValues(double[] values, int index);
|
---|
91 |
|
---|
92 | public abstract void RemoveValue(int index);
|
---|
93 |
|
---|
94 | public abstract void RemoveValues(int index, int count);
|
---|
95 |
|
---|
96 | public abstract int Count { get; }
|
---|
97 |
|
---|
98 | public abstract double this[int index] { get; set; }
|
---|
99 |
|
---|
100 | public abstract double MinValue { get; }
|
---|
101 |
|
---|
102 | public abstract double MaxValue { get; }
|
---|
103 |
|
---|
104 | public event ValuesChangedHandler ValuesChanged;
|
---|
105 |
|
---|
106 | public event ValueChangedHandler ValueChanged;
|
---|
107 |
|
---|
108 | public event DataRowChangedHandler DataRowChanged;
|
---|
109 | }
|
---|
110 | } |
---|