[671] | 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 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Text;
|
---|
| 25 | using System.Xml;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 | using HeuristicLab.Data;
|
---|
[1872] | 28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[671] | 29 |
|
---|
| 30 | namespace HeuristicLab.Logging {
|
---|
[1167] | 31 | /// <summary>
|
---|
| 32 | /// Class for point xy charts.
|
---|
| 33 | /// </summary>
|
---|
[671] | 34 | public class PointXYChart : ItemBase, IVisualizationItem {
|
---|
[1872] | 35 | [Storable]
|
---|
[677] | 36 | private ItemList myValues;
|
---|
[1167] | 37 | /// <summary>
|
---|
| 38 | /// Gets or sets the values of the current instance.
|
---|
| 39 | /// </summary>
|
---|
| 40 | /// <remarks>Calls <see cref="OnValuesChanged"/> in the setter.</remarks>
|
---|
[677] | 41 | public ItemList Values {
|
---|
[671] | 42 | get { return myValues; }
|
---|
| 43 | set {
|
---|
| 44 | if (value != myValues) {
|
---|
| 45 | myValues = value;
|
---|
| 46 | OnValuesChanged();
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 |
|
---|
[1872] | 51 | [Storable]
|
---|
[671] | 52 | private BoolData myConnectDots;
|
---|
[1167] | 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>
|
---|
[671] | 57 | public BoolData ConnectDots {
|
---|
| 58 | get { return myConnectDots; }
|
---|
| 59 | set {
|
---|
| 60 | if (value != myConnectDots) {
|
---|
| 61 | myConnectDots = value;
|
---|
| 62 | OnConnectDotsChanged();
|
---|
| 63 | }
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 |
|
---|
[1167] | 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>
|
---|
[671] | 72 | public PointXYChart() {
|
---|
| 73 | myConnectDots = new BoolData(true);
|
---|
| 74 | }
|
---|
[1167] | 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>
|
---|
[677] | 81 | public PointXYChart(bool connectDots,ItemList values) {
|
---|
[671] | 82 | myConnectDots = new BoolData(connectDots);
|
---|
| 83 | myValues = values;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
[1167] | 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>
|
---|
[671] | 93 | public override object Clone(IDictionary<Guid, object> clonedObjects) {
|
---|
| 94 | PointXYChart clone = (PointXYChart)base.Clone(clonedObjects);
|
---|
[677] | 95 | clone.myValues = (ItemList)Auxiliary.Clone(Values, clonedObjects);
|
---|
[671] | 96 | return clone;
|
---|
| 97 | }
|
---|
| 98 |
|
---|
[1167] | 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>
|
---|
[671] | 103 | public override IView CreateView() {
|
---|
| 104 | return new PointXYChartView(this);
|
---|
| 105 | }
|
---|
| 106 |
|
---|
[1167] | 107 | /// <summary>
|
---|
| 108 | /// Occurs when the values of the current instance have been changed.
|
---|
| 109 | /// </summary>
|
---|
[671] | 110 | public event EventHandler ValuesChanged;
|
---|
[1167] | 111 | /// <summary>
|
---|
| 112 | /// Fires a <c>ValuesChanged</c> event.
|
---|
| 113 | /// </summary>
|
---|
[671] | 114 | protected virtual void OnValuesChanged() {
|
---|
| 115 | if (ValuesChanged != null)
|
---|
| 116 | ValuesChanged(this, new EventArgs());
|
---|
| 117 | }
|
---|
[1167] | 118 | /// <summary>
|
---|
| 119 | /// Occurs when the boolean flag has been changed.
|
---|
| 120 | /// </summary>
|
---|
[671] | 121 | public event EventHandler ConnectDotsChanged;
|
---|
[1167] | 122 | /// <summary>
|
---|
| 123 | /// Fires a <c>ConnectDotsChanged</c> event.
|
---|
| 124 | /// </summary>
|
---|
[671] | 125 | protected virtual void OnConnectDotsChanged() {
|
---|
| 126 | if (ConnectDotsChanged != null)
|
---|
| 127 | ConnectDotsChanged(this, new EventArgs());
|
---|
| 128 | }
|
---|
| 129 | }
|
---|
| 130 | }
|
---|