1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2015 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.Drawing;
|
---|
23 | using HeuristicLab.Common;
|
---|
24 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.Core.Networks {
|
---|
27 | [StorableClass]
|
---|
28 | public sealed class NodeVisualProperties : VisualProperties, INodeVisualProperties {
|
---|
29 | [Storable]
|
---|
30 | private double x;
|
---|
31 | public double X {
|
---|
32 | get { return x; }
|
---|
33 | set {
|
---|
34 | if (x == value) return;
|
---|
35 | x = value;
|
---|
36 | OnChanged();
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | [Storable]
|
---|
41 | private double y;
|
---|
42 | public double Y {
|
---|
43 | get { return y; }
|
---|
44 | set {
|
---|
45 | if (y == value) return;
|
---|
46 | y = value;
|
---|
47 | OnChanged();
|
---|
48 | }
|
---|
49 | }
|
---|
50 |
|
---|
51 | [Storable]
|
---|
52 | private double width;
|
---|
53 | public double Width {
|
---|
54 | get { return width; }
|
---|
55 | set {
|
---|
56 | if (width == value) return;
|
---|
57 | width = value;
|
---|
58 | OnChanged();
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | [Storable]
|
---|
63 | private double height;
|
---|
64 | public double Height {
|
---|
65 | get { return height; }
|
---|
66 | set {
|
---|
67 | if (height == value) return;
|
---|
68 | height = value;
|
---|
69 | OnChanged();
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | [Storable]
|
---|
74 | private Color color;
|
---|
75 | public Color Color {
|
---|
76 | get { return color; }
|
---|
77 | set {
|
---|
78 | if (color == value) return;
|
---|
79 | color = value;
|
---|
80 | OnChanged();
|
---|
81 | }
|
---|
82 | }
|
---|
83 |
|
---|
84 | #region Constructors & Cloning
|
---|
85 | [StorableConstructor]
|
---|
86 | private NodeVisualProperties(bool deserializing) : base(deserializing) { }
|
---|
87 | private NodeVisualProperties(NodeVisualProperties original, Cloner cloner)
|
---|
88 | : base(original, cloner) {
|
---|
89 | x = original.x;
|
---|
90 | y = original.y;
|
---|
91 | width = original.width;
|
---|
92 | height = original.height;
|
---|
93 | color = original.color;
|
---|
94 | }
|
---|
95 |
|
---|
96 | public NodeVisualProperties() {
|
---|
97 | x = double.NaN;
|
---|
98 | y = double.NaN;
|
---|
99 | width = double.NaN;
|
---|
100 | height = double.NaN;
|
---|
101 | }
|
---|
102 |
|
---|
103 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
104 | return new NodeVisualProperties(this, cloner);
|
---|
105 | }
|
---|
106 | #endregion
|
---|
107 | }
|
---|
108 | }
|
---|