Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 2016 was 1996, checked in by mstoeger, 15 years ago

implemented IStorable and made use of the PersistenceManager wherever possible. #639

File size: 2.4 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    protected DataRowBase() {
20      rowSettings = new DataRowSettings();
21      rowSettings.DataVisualSettingChanged += value_DataVisualSettingChanged;
22    }
23
24    void value_DataVisualSettingChanged(DataRowSettings row) {
25      OnDataRowChanged(this);
26    }
27
28    public YAxisDescriptor YAxis {
29      get { return yAxis; }
30      set {
31        yAxis = value;
32        yAxis.AddDataRow(this);
33        yAxis.YAxisDescriptorChanged += delegate { OnDataRowChanged(this); };
34        OnDataRowChanged(this);
35      }
36    }
37
38    protected void OnDataRowChanged(IDataRow row) {
39      if (DataRowChanged != null) {
40        DataRowChanged(this);
41      }
42    }
43
44    protected void OnValuesChanged(double[] values, int index, Action action) {
45      if (ValuesChanged != null) {
46        ValuesChanged(this, values, index, action);
47      }
48    }
49
50    protected void OnValueChanged(double value, int index, Action action) {
51      if (ValueChanged != null) {
52        ValueChanged(this, value, index, action);
53      }
54    }
55
56    public abstract void AddValue(double value);
57    public abstract void AddValue(double value, int index);
58    public abstract void AddValues(double[] values);
59    public abstract void AddValues(double[] values, int index);
60    public abstract void ModifyValue(double value, int index);
61    public abstract void ModifyValues(double[] values, int index);
62    public abstract void RemoveValue(int index);
63    public abstract void RemoveValues(int index, int count);
64
65    public abstract int Count { get; }
66
67    public abstract double this[int index] { get; set; }
68
69    public abstract double MinValue { get; }
70    public abstract double MaxValue { get; }
71
72    public event ValuesChangedHandler ValuesChanged;
73    public event ValueChangedHandler ValueChanged;
74    public event DataRowChangedHandler DataRowChanged;
75  }
76}
Note: See TracBrowser for help on using the repository browser.