[4644] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[5445] | 3 | * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[4644] | 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 |
|
---|
| 22 | using System.ComponentModel;
|
---|
[4722] | 23 | using System.Drawing;
|
---|
[4644] | 24 | using HeuristicLab.Common;
|
---|
| 25 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 26 |
|
---|
| 27 | namespace HeuristicLab.Analysis {
|
---|
| 28 | /// <summary>
|
---|
| 29 | /// Visual properties of a DataRow.
|
---|
| 30 | /// </summary>
|
---|
| 31 | [StorableClass]
|
---|
| 32 | public class DataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
|
---|
| 33 | #region ChartType
|
---|
| 34 | public enum DataRowChartType {
|
---|
| 35 | Line,
|
---|
| 36 | Columns,
|
---|
| 37 | Points,
|
---|
[6342] | 38 | Bars,
|
---|
| 39 | Histogram
|
---|
[4644] | 40 | }
|
---|
| 41 | #endregion
|
---|
[6342] | 42 | #region LineStyle
|
---|
| 43 | public enum DataRowLineStyle {
|
---|
| 44 | Dash,
|
---|
| 45 | DashDot,
|
---|
| 46 | DashDotDot,
|
---|
| 47 | Dot,
|
---|
| 48 | NotSet,
|
---|
| 49 | Solid
|
---|
| 50 | }
|
---|
| 51 | #endregion
|
---|
[4644] | 52 |
|
---|
| 53 | private DataRowChartType chartType;
|
---|
| 54 | public DataRowChartType ChartType {
|
---|
| 55 | get { return chartType; }
|
---|
| 56 | set {
|
---|
| 57 | if (chartType != value) {
|
---|
| 58 | chartType = value;
|
---|
| 59 | OnPropertyChanged("ChartType");
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | private bool secondYAxis;
|
---|
| 64 | public bool SecondYAxis {
|
---|
| 65 | get { return secondYAxis; }
|
---|
| 66 | set {
|
---|
| 67 | if (secondYAxis != value) {
|
---|
| 68 | secondYAxis = value;
|
---|
| 69 | OnPropertyChanged("SecondYAxis");
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
[6342] | 73 | private bool secondXAxis;
|
---|
| 74 | public bool SecondXAxis {
|
---|
| 75 | get { return secondXAxis; }
|
---|
| 76 | set {
|
---|
| 77 | if (secondXAxis != value) {
|
---|
| 78 | secondXAxis = value;
|
---|
| 79 | OnPropertyChanged("SecondXAxis");
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
[4648] | 83 | private Color color;
|
---|
| 84 | public Color Color {
|
---|
| 85 | get { return color; }
|
---|
| 86 | set {
|
---|
| 87 | if (color != value) {
|
---|
| 88 | color = value;
|
---|
| 89 | OnPropertyChanged("Color");
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
[6342] | 93 | private DataRowLineStyle lineStyle;
|
---|
| 94 | public DataRowLineStyle LineStyle {
|
---|
| 95 | get { return lineStyle; }
|
---|
| 96 | set {
|
---|
| 97 | if (lineStyle != value) {
|
---|
| 98 | lineStyle = value;
|
---|
| 99 | OnPropertyChanged("LineStyle");
|
---|
| 100 | }
|
---|
| 101 | }
|
---|
| 102 | }
|
---|
[4648] | 103 | private bool startIndexZero;
|
---|
| 104 | public bool StartIndexZero {
|
---|
| 105 | get { return startIndexZero; }
|
---|
| 106 | set {
|
---|
| 107 | if (startIndexZero != value) {
|
---|
| 108 | startIndexZero = value;
|
---|
| 109 | OnPropertyChanged("StartIndexZero");
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 | }
|
---|
[6342] | 113 | private int lineWidth;
|
---|
| 114 | public int LineWidth {
|
---|
| 115 | get { return lineWidth; }
|
---|
| 116 | set {
|
---|
| 117 | if (lineWidth != value) {
|
---|
| 118 | lineWidth = value;
|
---|
| 119 | OnPropertyChanged("LineWidth");
|
---|
| 120 | }
|
---|
| 121 | }
|
---|
| 122 | }
|
---|
| 123 | private int bins;
|
---|
| 124 | public int Bins {
|
---|
| 125 | get { return bins; }
|
---|
| 126 | set {
|
---|
| 127 | if (bins != value) {
|
---|
| 128 | bins = value;
|
---|
| 129 | OnPropertyChanged("Bins");
|
---|
| 130 | }
|
---|
| 131 | }
|
---|
| 132 | }
|
---|
| 133 | private bool exactBins;
|
---|
| 134 | public bool ExactBins {
|
---|
| 135 | get { return exactBins; }
|
---|
| 136 | set {
|
---|
| 137 | if (exactBins != value) {
|
---|
| 138 | exactBins = value;
|
---|
| 139 | OnPropertyChanged("ExactBins");
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 | }
|
---|
[4644] | 143 |
|
---|
[4648] | 144 | #region Persistence Properties
|
---|
| 145 | [Storable(Name = "ChartType")]
|
---|
| 146 | private DataRowChartType StorableChartType {
|
---|
| 147 | get { return chartType; }
|
---|
| 148 | set { chartType = value; }
|
---|
| 149 | }
|
---|
| 150 | [Storable(Name = "SecondYAxis")]
|
---|
| 151 | private bool StorableSecondYAxis {
|
---|
| 152 | get { return secondYAxis; }
|
---|
| 153 | set { secondYAxis = value; }
|
---|
| 154 | }
|
---|
[6342] | 155 | [Storable(Name = "SecondXAxis")]
|
---|
| 156 | private bool StorableSecondXAxis {
|
---|
| 157 | get { return secondXAxis; }
|
---|
| 158 | set { secondXAxis = value; }
|
---|
| 159 | }
|
---|
[4648] | 160 | [Storable(Name = "Color")]
|
---|
| 161 | private Color StorableColor {
|
---|
| 162 | get { return color; }
|
---|
| 163 | set { color = value; }
|
---|
| 164 | }
|
---|
[6342] | 165 | [Storable(Name = "LineStyle")]
|
---|
| 166 | private DataRowLineStyle StorableLineStyle {
|
---|
| 167 | get { return lineStyle; }
|
---|
| 168 | set { lineStyle = value; }
|
---|
| 169 | }
|
---|
[4648] | 170 | [Storable(Name = "StartIndexZero")]
|
---|
| 171 | private bool StorableStartIndexZero {
|
---|
| 172 | get { return startIndexZero; }
|
---|
| 173 | set { startIndexZero = value; }
|
---|
| 174 | }
|
---|
[6342] | 175 | [Storable(Name = "LineWidth")]
|
---|
| 176 | private int StorableLineWidth {
|
---|
| 177 | get { return lineWidth; }
|
---|
| 178 | set { lineWidth = value; }
|
---|
| 179 | }
|
---|
| 180 | [Storable(Name = "Bins")]
|
---|
| 181 | private int StorableBins {
|
---|
| 182 | get { return bins; }
|
---|
| 183 | set { bins = value; }
|
---|
| 184 | }
|
---|
| 185 | [Storable(Name = "ExactBins")]
|
---|
| 186 | private bool StorableExactBins {
|
---|
| 187 | get { return exactBins; }
|
---|
| 188 | set { exactBins = value; }
|
---|
| 189 | }
|
---|
[4648] | 190 | #endregion
|
---|
| 191 |
|
---|
[4722] | 192 | [StorableConstructor]
|
---|
| 193 | protected DataRowVisualProperties(bool deserializing) : base() { }
|
---|
| 194 | protected DataRowVisualProperties(DataRowVisualProperties original, Cloner cloner)
|
---|
| 195 | : base(original, cloner) {
|
---|
| 196 | this.chartType = original.chartType;
|
---|
| 197 | this.secondYAxis = original.secondYAxis;
|
---|
[6342] | 198 | this.secondXAxis = original.secondXAxis;
|
---|
[4722] | 199 | this.color = original.color;
|
---|
[6342] | 200 | this.lineStyle = original.lineStyle;
|
---|
[4722] | 201 | this.startIndexZero = original.startIndexZero;
|
---|
[6342] | 202 | this.lineWidth = original.lineWidth;
|
---|
| 203 | this.bins = original.bins;
|
---|
| 204 | this.exactBins = original.exactBins;
|
---|
[4722] | 205 | }
|
---|
[4644] | 206 | public DataRowVisualProperties() {
|
---|
| 207 | chartType = DataRowChartType.Line;
|
---|
| 208 | secondYAxis = false;
|
---|
[6342] | 209 | secondXAxis = false;
|
---|
[4648] | 210 | color = Color.Empty;
|
---|
[6342] | 211 | lineStyle = DataRowLineStyle.Solid;
|
---|
[4648] | 212 | startIndexZero = false;
|
---|
[6342] | 213 | lineWidth = 1;
|
---|
| 214 | bins = 10;
|
---|
| 215 | exactBins = false;
|
---|
[4644] | 216 | }
|
---|
| 217 |
|
---|
[4777] | 218 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 219 | return new DataRowVisualProperties(this, cloner);
|
---|
| 220 | }
|
---|
| 221 |
|
---|
[4644] | 222 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
| 223 | protected virtual void OnPropertyChanged(string propertyName) {
|
---|
| 224 | PropertyChangedEventHandler handler = PropertyChanged;
|
---|
| 225 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
---|
| 226 | }
|
---|
| 227 | }
|
---|
| 228 | }
|
---|