Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Persistence Test/HeuristicLab.Logging/3.3/PointXYChart.cs @ 4498

Last change on this file since 4498 was 1872, checked in by epitzer, 15 years ago

Upgrade Charting.Data, Logging, Operators.Programmable, OptimizationFrontend, OffspringSelection, SGA, TestFunctions and ThreadParallelEngine to 3.3 (#603)

File size: 4.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 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.Collections.Generic;
24using System.Text;
25using System.Xml;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Logging {
31  /// <summary>
32  /// Class for point xy charts.
33  /// </summary>
34  public class PointXYChart : ItemBase, IVisualizationItem {
35    [Storable]
36    private ItemList myValues;
37    /// <summary>
38    /// Gets or sets the values of the current instance.
39    /// </summary>
40    /// <remarks>Calls <see cref="OnValuesChanged"/> in the setter.</remarks>
41    public ItemList Values {
42      get { return myValues; }
43      set {
44        if (value != myValues) {
45          myValues = value;
46          OnValuesChanged();
47        }
48      }
49    }
50
51    [Storable]
52    private BoolData myConnectDots;
53    /// <summary>
54    /// Gets or sets the flag whether the dots should be connected or not.
55    /// </summary>
56    /// <remarks>Calls <see cref="OnConnectDotsChanged"/> in the setter.</remarks>
57    public BoolData ConnectDots {
58      get { return myConnectDots; }
59      set {
60        if (value != myConnectDots) {
61          myConnectDots = value;
62          OnConnectDotsChanged();
63        }
64      }
65    }
66 
67         
68    /// <summary>
69    /// Initializes a new instance of <see cref="PointXYChart"/> with the <c>ConnectDots</c> flag set to
70    /// <c>true</c>.
71    /// </summary>
72    public PointXYChart() {
73      myConnectDots = new BoolData(true);
74    }
75    /// <summary>
76    /// Initializes a new instance of <see cref="PointXYChart"/> with the given <paramref name="connectDots"/>
77    /// flag and the specified <paramref name="values"/>.
78    /// </summary>
79    /// <param name="connectDots">The flag whether the dots should be connected or not.</param>
80    /// <param name="values">The values with which the current instance should be initialized.</param>
81    public PointXYChart(bool connectDots,ItemList values) {
82      myConnectDots = new BoolData(connectDots);
83      myValues = values;
84    }
85
86    /// <summary>
87    /// Clones the current instance (deep clone).
88    /// </summary>
89    /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class
90    /// <see cref="Auxiliary"/>.</remarks>
91    /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param>
92    /// <returns>The cloned object as <see cref="PointXYChart"/>.</returns>
93    public override object Clone(IDictionary<Guid, object> clonedObjects) {
94      PointXYChart clone = (PointXYChart)base.Clone(clonedObjects);
95      clone.myValues = (ItemList)Auxiliary.Clone(Values, clonedObjects);
96      return clone;
97    }
98
99    /// <summary>
100    /// Creates a new instance of <see cref="PointXYChartView"/> to represent the current instance visually.
101    /// </summary>
102    /// <returns>The created view as <see cref="PointXYChartView"/>.</returns>
103    public override IView CreateView() {
104      return new PointXYChartView(this);
105    }
106
107    /// <summary>
108    /// Occurs when the values of the current instance have been changed.
109    /// </summary>
110    public event EventHandler ValuesChanged;
111    /// <summary>
112    /// Fires a <c>ValuesChanged</c> event.
113    /// </summary>
114    protected virtual void OnValuesChanged() {
115      if (ValuesChanged != null)
116        ValuesChanged(this, new EventArgs());
117    }
118    /// <summary>
119    /// Occurs when the boolean flag has been changed.
120    /// </summary>
121    public event EventHandler ConnectDotsChanged;
122    /// <summary>
123    /// Fires a <c>ConnectDotsChanged</c> event.
124    /// </summary>
125    protected virtual void OnConnectDotsChanged() {
126      if (ConnectDotsChanged != null)
127        ConnectDotsChanged(this, new EventArgs());
128    }
129  }
130}
Note: See TracBrowser for help on using the repository browser.