Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/3.2/DataRowBase.cs @ 2474

Last change on this file since 2474 was 2040, checked in by dwagner, 15 years ago

dw: Added new dialog for adding lines using the options dialog. (#478)

File size: 2.5 KB
Line 
1using HeuristicLab.Core;
2using HeuristicLab.Visualization.Options;
3
4namespace HeuristicLab.Visualization {
5  public abstract class DataRowBase : StorableBase, IDataRow {
6    protected YAxisDescriptor yAxis;
7
8    private DataRowSettings rowSettings ;
9
10    public DataRowSettings RowSettings {
11      get { return rowSettings; }
12      set {
13        rowSettings.DataVisualSettingChanged -= value_DataVisualSettingChanged;
14        value.DataVisualSettingChanged += value_DataVisualSettingChanged;
15        rowSettings = value;
16      }
17    }
18
19    public string Label{
20      get { return rowSettings.Label; }
21    }
22
23    protected DataRowBase() {
24      rowSettings = new DataRowSettings();
25      rowSettings.LineType = DataRowType.Normal; //default value for most lines and aggregators
26      rowSettings.DataVisualSettingChanged += value_DataVisualSettingChanged;
27    }
28
29    void value_DataVisualSettingChanged(DataRowSettings row) {
30      OnDataRowChanged(this);
31    }
32
33    public YAxisDescriptor YAxis {
34      get { return yAxis; }
35      set {
36        yAxis = value;
37        yAxis.AddDataRow(this);
38        yAxis.YAxisDescriptorChanged += delegate { OnDataRowChanged(this); };
39        OnDataRowChanged(this);
40      }
41    }
42
43    protected void OnDataRowChanged(IDataRow row) {
44      if (DataRowChanged != null) {
45        DataRowChanged(this);
46      }
47    }
48
49    protected void OnValuesChanged(double[] values, int index, Action action) {
50      if (ValuesChanged != null) {
51        ValuesChanged(this, values, index, action);
52      }
53    }
54
55    protected void OnValueChanged(double value, int index, Action action) {
56      if (ValueChanged != null) {
57        ValueChanged(this, value, index, action);
58      }
59    }
60
61    public abstract void AddValue(double value);
62    public abstract void AddValue(double value, int index);
63    public abstract void AddValues(double[] values);
64    public abstract void AddValues(double[] values, int index);
65    public abstract void ModifyValue(double value, int index);
66    public abstract void ModifyValues(double[] values, int index);
67    public abstract void RemoveValue(int index);
68    public abstract void RemoveValues(int index, int count);
69
70    public abstract int Count { get; }
71
72    public abstract double this[int index] { get; set; }
73
74    public abstract double MinValue { get; }
75    public abstract double MaxValue { get; }
76
77    public event ValuesChangedHandler ValuesChanged;
78    public event ValueChangedHandler ValueChanged;
79    public event DataRowChangedHandler DataRowChanged;
80  }
81}
Note: See TracBrowser for help on using the repository browser.