Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/ScatterPlotDataRowVisualProperties.cs @ 8968

Last change on this file since 8968 was 8907, checked in by ascheibe, 12 years ago

#1892 added configuration dialog for the scatter plot

File size: 5.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.ComponentModel;
24using System.Drawing;
25using HeuristicLab.Common;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Analysis {
29  /// <summary>
30  /// Visual properties of a ScatterPlotDataRow.
31  /// </summary>
32  [StorableClass]
33  public class ScatterPlotDataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
34    #region PointStyle
35    public enum ScatterPlotDataRowPointStyle {
36      Circle,
37      Cross,
38      Diamond,
39      Square,
40      Star4,
41      Star5,
42      Star6,
43      Star10,
44      Triangle
45    }
46    #endregion
47
48    private Color color;
49    public Color Color {
50      get { return color; }
51      set {
52        if (color != value) {
53          color = value;
54          OnPropertyChanged("Color");
55        }
56      }
57    }
58    private ScatterPlotDataRowPointStyle pointStyle;
59    public ScatterPlotDataRowPointStyle PointStyle {
60      get { return pointStyle; }
61      set {
62        if (pointStyle != value) {
63          pointStyle = value;
64          OnPropertyChanged("PointStyle");
65        }
66      }
67    }
68    private int pointSize;
69    public int PointSize {
70      get { return pointSize; }
71      set {
72        if (pointSize != value) {
73          pointSize = value;
74          OnPropertyChanged("PointSize");
75        }
76      }
77    }
78    private bool isVisibleInLegend;
79    public bool IsVisibleInLegend {
80      get { return isVisibleInLegend; }
81      set {
82        if (isVisibleInLegend != value) {
83          isVisibleInLegend = value;
84          OnPropertyChanged("IsVisibleInLegend");
85        }
86      }
87    }
88    private string displayName;
89    public string DisplayName {
90      get { return displayName == null ? String.Empty : displayName; }
91      set {
92        if (displayName != value) {
93          if (value == null && displayName != String.Empty) {
94            displayName = String.Empty;
95            OnPropertyChanged("DisplayName");
96          } else if (value != null) {
97            displayName = value;
98            OnPropertyChanged("DisplayName");
99          }
100        }
101      }
102    }
103
104    #region Persistence Properties
105    [Storable(Name = "Color")]
106    private Color StorableColor {
107      get { return color; }
108      set { color = value; }
109    }
110    [Storable(Name = "PointStyle")]
111    private ScatterPlotDataRowPointStyle StorablePointStyle {
112      get { return pointStyle; }
113      set { pointStyle = value; }
114    }
115    [Storable(Name = "PointSize")]
116    private int StorablePointSize {
117      get { return pointSize; }
118      set { pointSize = value; }
119    }
120    [Storable(Name = "IsVisibleInLegend")]
121    private bool StorableIsVisibleInLegend {
122      get { return isVisibleInLegend; }
123      set { isVisibleInLegend = value; }
124    }
125    [Storable(Name = "DisplayName")]
126    private string StorableDisplayName {
127      get { return displayName; }
128      set { displayName = value; }
129    }
130    #endregion
131
132    [StorableConstructor]
133    protected ScatterPlotDataRowVisualProperties(bool deserializing) : base() { }
134    protected ScatterPlotDataRowVisualProperties(ScatterPlotDataRowVisualProperties original, Cloner cloner)
135      : base(original, cloner) {
136      this.color = original.color;
137      this.pointStyle = original.pointStyle;
138      this.pointSize = original.pointSize;
139      this.displayName = original.displayName;
140      this.isVisibleInLegend = original.isVisibleInLegend;
141    }
142    public ScatterPlotDataRowVisualProperties() {
143      color = Color.Empty;
144      pointStyle = ScatterPlotDataRowPointStyle.Circle;
145      pointSize = 3;
146      displayName = String.Empty;
147      isVisibleInLegend = true;
148    }
149    public ScatterPlotDataRowVisualProperties(string displayName)
150      : this() {
151      this.displayName = displayName;
152    }
153
154    public override IDeepCloneable Clone(Cloner cloner) {
155      return new ScatterPlotDataRowVisualProperties(this, cloner);
156    }
157
158    public event PropertyChangedEventHandler PropertyChanged;
159    protected virtual void OnPropertyChanged(string propertyName) {
160      PropertyChangedEventHandler handler = PropertyChanged;
161      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
162    }
163  }
164}
Note: See TracBrowser for help on using the repository browser.