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