Changeset 2934 for trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/OperatorShapeInfo.cs
- Timestamp:
- 03/05/10 12:37:59 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/OperatorShapeInfo.cs
r2868 r2934 28 28 using Netron.Diagramming.Core; 29 29 using System.Windows.Forms; 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 31 31 32 namespace HeuristicLab.Operators.Views.GraphVisualization { 32 internal class OperatorShapeInfo : ShapeInfo { 33 internal class OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo { 34 [Storable] 35 private List<string> connectorNames; 36 [Storable] 37 private List<string> labels; 33 38 34 private List<string> connectorNames;35 39 public OperatorShapeInfo() 36 40 : base(typeof(OperatorShape)) { 37 41 this.connectorNames = new List<string>(); 42 this.labels = new List<string>(); 38 43 } 39 44 … … 44 49 } 45 50 46 public override void AddConnector(string connectorName) { 51 public OperatorShapeInfo(IEnumerable<string> connectorNames, IEnumerable<string> labels) 52 : this(connectorNames) { 53 foreach (string label in labels) 54 this.labels.Add(label); 55 } 56 57 public void AddConnector(string connectorName) { 47 58 if (!this.connectorNames.Contains(connectorName) && connectorName != "Successor") { 48 59 this.connectorNames.Add(connectorName); … … 51 62 } 52 63 53 public overridevoid RemoveConnector(string connectorName) {64 public void RemoveConnector(string connectorName) { 54 65 if (this.connectorNames.Contains(connectorName)) { 55 66 this.connectorNames.Remove(connectorName); … … 58 69 } 59 70 71 public void UpdateLabels(IEnumerable<string> labels) { 72 this.labels = new List<string>(labels); 73 this.OnChanged(); 74 } 75 76 [Storable] 77 private bool collapsed; 78 public bool Collapsed { 79 get { return this.collapsed; } 80 set { 81 if (this.collapsed != value) { 82 this.collapsed = value; 83 this.OnChanged(); 84 } 85 } 86 } 87 88 [Storable] 60 89 private string title; 61 90 public string Title { … … 69 98 } 70 99 71 private string text; 72 public string Text { 73 get { return this.text; } 100 [Storable] 101 private Color color; 102 public Color Color { 103 get { return this.color; } 74 104 set { 75 if (this. text!= value) {76 this. text= value;105 if (this.color != value) { 106 this.color = value; 77 107 this.OnChanged(); 78 108 } … … 80 110 } 81 111 82 private Color headColor; 83 public Color HeadColor { 84 get { return this.headColor; } 112 [Storable] 113 private Bitmap icon; 114 public Bitmap Icon { 115 get { return this.icon; } 85 116 set { 86 if (this. headColor!= value) {87 this. headColor= value;117 if (this.icon != value) { 118 this.icon = value; 88 119 this.OnChanged(); 89 120 } … … 94 125 OperatorShape shape = (OperatorShape)base.CreateShape(); 95 126 shape.Title = this.Title; 96 shape.SubTitle = this.Text; 97 shape.HeadColor = this.HeadColor; 127 shape.Color = this.Color; 128 shape.Icon = this.Icon; 129 shape.Collapsed = this.Collapsed; 98 130 foreach (string connectorName in this.connectorNames) 99 131 shape.AddConnector(connectorName); 132 133 shape.UpdateLabels(this.labels); 100 134 return shape; 101 135 } … … 104 138 base.UpdateShape(shape); 105 139 OperatorShape operatorShape = shape as OperatorShape; 106 107 140 if (operatorShape != null) { 108 141 operatorShape.Title = this.Title; 109 operatorShape. SubTitle = this.Text;110 operatorShape. HeadColor = this.HeadColor;142 operatorShape.Color = this.Color; 143 operatorShape.Collapsed = this.Collapsed; 111 144 112 145 int i = 0; … … 121 154 j++; 122 155 } 123 //remove old connectors156 //remove remaining old connectors 124 157 for (; j < oldConnectorNames.Count; j++) 125 158 operatorShape.RemoveConnector(oldConnectorNames[j]); … … 128 161 for (; i < this.connectorNames.Count; i++) 129 162 operatorShape.AddConnector(this.connectorNames[i]); 163 164 operatorShape.UpdateLabels(this.labels); 130 165 } 131 166 }
Note: See TracChangeset
for help on using the changeset viewer.