[8280] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[15584] | 3 | * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[8280] | 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;
|
---|
| 23 | using System.ComponentModel;
|
---|
| 24 | using System.Drawing;
|
---|
| 25 | using HeuristicLab.Common;
|
---|
| 26 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Analysis {
|
---|
| 29 | /// <summary>
|
---|
| 30 | /// Visual properties of a ScatterPlotDataRow.
|
---|
| 31 | /// </summary>
|
---|
| 32 | [StorableClass]
|
---|
| 33 | public class ScatterPlotDataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
|
---|
[8907] | 34 | #region PointStyle
|
---|
[8280] | 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
|
---|
[15097] | 47 | #region
|
---|
| 48 | public enum ScatterPlotDataRowRegressionType {
|
---|
| 49 | None,
|
---|
| 50 | Linear,
|
---|
| 51 | Polynomial,
|
---|
| 52 | Exponential,
|
---|
| 53 | Logarithmic,
|
---|
| 54 | Power
|
---|
| 55 | }
|
---|
| 56 | #endregion
|
---|
[8280] | 57 |
|
---|
| 58 | private Color color;
|
---|
| 59 | public Color Color {
|
---|
| 60 | get { return color; }
|
---|
| 61 | set {
|
---|
| 62 | if (color != value) {
|
---|
| 63 | color = value;
|
---|
| 64 | OnPropertyChanged("Color");
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | private ScatterPlotDataRowPointStyle pointStyle;
|
---|
| 69 | public ScatterPlotDataRowPointStyle PointStyle {
|
---|
| 70 | get { return pointStyle; }
|
---|
| 71 | set {
|
---|
| 72 | if (pointStyle != value) {
|
---|
| 73 | pointStyle = value;
|
---|
| 74 | OnPropertyChanged("PointStyle");
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 | }
|
---|
| 78 | private int pointSize;
|
---|
| 79 | public int PointSize {
|
---|
| 80 | get { return pointSize; }
|
---|
| 81 | set {
|
---|
| 82 | if (pointSize != value) {
|
---|
| 83 | pointSize = value;
|
---|
| 84 | OnPropertyChanged("PointSize");
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 | private bool isVisibleInLegend;
|
---|
| 89 | public bool IsVisibleInLegend {
|
---|
| 90 | get { return isVisibleInLegend; }
|
---|
| 91 | set {
|
---|
| 92 | if (isVisibleInLegend != value) {
|
---|
| 93 | isVisibleInLegend = value;
|
---|
| 94 | OnPropertyChanged("IsVisibleInLegend");
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 | private string displayName;
|
---|
| 99 | public string DisplayName {
|
---|
| 100 | get { return displayName == null ? String.Empty : displayName; }
|
---|
| 101 | set {
|
---|
| 102 | if (displayName != value) {
|
---|
| 103 | if (value == null && displayName != String.Empty) {
|
---|
| 104 | displayName = String.Empty;
|
---|
| 105 | OnPropertyChanged("DisplayName");
|
---|
| 106 | } else if (value != null) {
|
---|
| 107 | displayName = value;
|
---|
| 108 | OnPropertyChanged("DisplayName");
|
---|
| 109 | }
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 | }
|
---|
[15097] | 113 | private ScatterPlotDataRowRegressionType regressionType;
|
---|
| 114 | public ScatterPlotDataRowRegressionType RegressionType {
|
---|
| 115 | get { return regressionType; }
|
---|
| 116 | set {
|
---|
| 117 | if (regressionType != value) {
|
---|
| 118 | regressionType = value;
|
---|
| 119 | OnPropertyChanged("RegressionType");
|
---|
| 120 | }
|
---|
| 121 | }
|
---|
| 122 | }
|
---|
| 123 | private int polynomialRegressionOrder;
|
---|
| 124 | public int PolynomialRegressionOrder {
|
---|
| 125 | get { return polynomialRegressionOrder; }
|
---|
| 126 | set {
|
---|
| 127 | if (polynomialRegressionOrder != value) {
|
---|
| 128 | polynomialRegressionOrder = value;
|
---|
| 129 | OnPropertyChanged("PolynomialRegressionOrder");
|
---|
| 130 | }
|
---|
| 131 | }
|
---|
| 132 | }
|
---|
| 133 | private bool isRegressionVisibleInLegend;
|
---|
| 134 | public bool IsRegressionVisibleInLegend {
|
---|
| 135 | get { return isRegressionVisibleInLegend; }
|
---|
| 136 | set {
|
---|
| 137 | if (isRegressionVisibleInLegend != value) {
|
---|
| 138 | isRegressionVisibleInLegend = value;
|
---|
| 139 | OnPropertyChanged("IsRegressionVisibleInLegend");
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 | }
|
---|
| 143 | private string regressionDisplayName;
|
---|
| 144 | public string RegressionDisplayName {
|
---|
| 145 | get { return regressionDisplayName ?? string.Empty; }
|
---|
| 146 | set {
|
---|
| 147 | if (regressionDisplayName != value) {
|
---|
| 148 | if (value == null && regressionDisplayName != string.Empty) {
|
---|
| 149 | regressionDisplayName = string.Empty;
|
---|
| 150 | OnPropertyChanged("RegressionDisplayName");
|
---|
| 151 | } else if (value != null) {
|
---|
| 152 | regressionDisplayName = value;
|
---|
| 153 | OnPropertyChanged("RegressionDisplayName");
|
---|
| 154 | }
|
---|
| 155 | }
|
---|
| 156 | }
|
---|
| 157 | }
|
---|
[8280] | 158 |
|
---|
| 159 | #region Persistence Properties
|
---|
| 160 | [Storable(Name = "Color")]
|
---|
| 161 | private Color StorableColor {
|
---|
| 162 | get { return color; }
|
---|
| 163 | set { color = value; }
|
---|
| 164 | }
|
---|
| 165 | [Storable(Name = "PointStyle")]
|
---|
| 166 | private ScatterPlotDataRowPointStyle StorablePointStyle {
|
---|
| 167 | get { return pointStyle; }
|
---|
| 168 | set { pointStyle = value; }
|
---|
| 169 | }
|
---|
| 170 | [Storable(Name = "PointSize")]
|
---|
| 171 | private int StorablePointSize {
|
---|
| 172 | get { return pointSize; }
|
---|
| 173 | set { pointSize = value; }
|
---|
| 174 | }
|
---|
| 175 | [Storable(Name = "IsVisibleInLegend")]
|
---|
| 176 | private bool StorableIsVisibleInLegend {
|
---|
| 177 | get { return isVisibleInLegend; }
|
---|
| 178 | set { isVisibleInLegend = value; }
|
---|
| 179 | }
|
---|
| 180 | [Storable(Name = "DisplayName")]
|
---|
| 181 | private string StorableDisplayName {
|
---|
| 182 | get { return displayName; }
|
---|
| 183 | set { displayName = value; }
|
---|
| 184 | }
|
---|
[15097] | 185 | [Storable(Name = "RegressionType")]
|
---|
| 186 | private ScatterPlotDataRowRegressionType StorableRegressionType {
|
---|
| 187 | get { return regressionType; }
|
---|
| 188 | set { regressionType = value; }
|
---|
| 189 | }
|
---|
| 190 | [Storable(Name = "PolynomialRegressionOrder", DefaultValue = 2)]
|
---|
| 191 | private int StorablePolynomialRegressionOrder {
|
---|
| 192 | get { return polynomialRegressionOrder; }
|
---|
| 193 | set { polynomialRegressionOrder = value; }
|
---|
| 194 | }
|
---|
| 195 | [Storable(Name = "IsRegressionVisibleInLegend", DefaultValue = true)]
|
---|
| 196 | private bool StorableIsRegressionVisibleInLegend {
|
---|
| 197 | get { return isRegressionVisibleInLegend; }
|
---|
| 198 | set { isRegressionVisibleInLegend = value; }
|
---|
| 199 | }
|
---|
| 200 | [Storable(Name = "RegressionDisplayName")]
|
---|
| 201 | private string StorableRegressionDisplayName {
|
---|
| 202 | get { return regressionDisplayName; }
|
---|
| 203 | set { regressionDisplayName = value; }
|
---|
| 204 | }
|
---|
[8280] | 205 | #endregion
|
---|
| 206 |
|
---|
| 207 | [StorableConstructor]
|
---|
| 208 | protected ScatterPlotDataRowVisualProperties(bool deserializing) : base() { }
|
---|
| 209 | protected ScatterPlotDataRowVisualProperties(ScatterPlotDataRowVisualProperties original, Cloner cloner)
|
---|
| 210 | : base(original, cloner) {
|
---|
| 211 | this.color = original.color;
|
---|
| 212 | this.pointStyle = original.pointStyle;
|
---|
| 213 | this.pointSize = original.pointSize;
|
---|
| 214 | this.displayName = original.displayName;
|
---|
| 215 | this.isVisibleInLegend = original.isVisibleInLegend;
|
---|
[15097] | 216 | this.regressionType = original.regressionType;
|
---|
| 217 | this.polynomialRegressionOrder = original.polynomialRegressionOrder;
|
---|
| 218 | this.isRegressionVisibleInLegend = original.isRegressionVisibleInLegend;
|
---|
| 219 | this.regressionDisplayName = original.regressionDisplayName;
|
---|
[8280] | 220 | }
|
---|
| 221 | public ScatterPlotDataRowVisualProperties() {
|
---|
| 222 | color = Color.Empty;
|
---|
| 223 | pointStyle = ScatterPlotDataRowPointStyle.Circle;
|
---|
| 224 | pointSize = 3;
|
---|
| 225 | displayName = String.Empty;
|
---|
| 226 | isVisibleInLegend = true;
|
---|
[15097] | 227 | regressionType = ScatterPlotDataRowRegressionType.None;
|
---|
| 228 | polynomialRegressionOrder = 2;
|
---|
| 229 | isRegressionVisibleInLegend = true;
|
---|
| 230 | regressionDisplayName = string.Empty;
|
---|
[8280] | 231 | }
|
---|
| 232 | public ScatterPlotDataRowVisualProperties(string displayName)
|
---|
| 233 | : this() {
|
---|
| 234 | this.displayName = displayName;
|
---|
| 235 | }
|
---|
| 236 |
|
---|
| 237 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 238 | return new ScatterPlotDataRowVisualProperties(this, cloner);
|
---|
| 239 | }
|
---|
| 240 |
|
---|
| 241 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
| 242 | protected virtual void OnPropertyChanged(string propertyName) {
|
---|
| 243 | PropertyChangedEventHandler handler = PropertyChanged;
|
---|
| 244 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 | }
|
---|