Changeset 3386 for trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfo.cs
- Timestamp:
- 04/17/10 23:50:05 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfo.cs
r3374 r3386 29 29 using System.Windows.Forms; 30 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Common; 31 32 32 33 namespace HeuristicLab.Operators.Views.GraphVisualization { 33 34 [StorableClass] 34 35 internal class OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo { 35 [Storable]36 private List<string> connectorNames;37 36 [Storable] 38 37 private List<string> labels; … … 57 56 58 57 public void AddConnector(string connectorName) { 59 if (!this.connectorNames.Contains(connectorName) && connectorName != "Successor") {58 if (!this.connectorNames.Contains(connectorName)) { 60 59 this.connectorNames.Add(connectorName); 61 60 this.OnChanged(); … … 73 72 this.labels = new List<string>(labels); 74 73 this.OnChanged(); 74 } 75 76 [Storable] 77 private List<string> connectorNames; 78 public override IEnumerable<string> Connectors { 79 get { return this.connectorNames; } 75 80 } 76 81 … … 163 168 public override void UpdateShape(IShape shape) { 164 169 base.UpdateShape(shape); 165 OperatorShape operatorShape = shape as OperatorShape; 166 if (operatorShape != null) { 167 operatorShape.Title = this.Title; 168 operatorShape.Color = this.Color; 169 operatorShape.LineColor = this.LineColor; 170 operatorShape.LineWidth = this.LineWidth; 171 operatorShape.Icon = this.Icon; 172 operatorShape.Collapsed = this.Collapsed; 173 174 int i = 0; 175 int j = 0; 176 //remove old connectors and skip correct connectors 177 List<string> oldConnectorNames = operatorShape.AdditionalConnectorNames.ToList(); 178 while (i < this.connectorNames.Count && j < oldConnectorNames.Count) { 179 if (this.connectorNames[i] != oldConnectorNames[j]) { 180 operatorShape.RemoveConnector(oldConnectorNames[j]); 181 } else 182 i++; 183 j++; 184 } 185 //remove remaining old connectors 186 for (; j < oldConnectorNames.Count; j++) 170 OperatorShape operatorShape = (OperatorShape)shape; 171 operatorShape.Title = this.Title; 172 operatorShape.Color = this.Color; 173 operatorShape.LineColor = this.LineColor; 174 operatorShape.LineWidth = this.LineWidth; 175 operatorShape.Icon = this.Icon; 176 operatorShape.Collapsed = this.Collapsed; 177 178 int i = 0; 179 int j = 0; 180 //remove old connectors and skip correct connectors 181 List<string> oldConnectorNames = operatorShape.AdditionalConnectorNames.ToList(); 182 while (i < this.connectorNames.Count && j < oldConnectorNames.Count) { 183 if (this.connectorNames[i] != oldConnectorNames[j]) { 187 184 operatorShape.RemoveConnector(oldConnectorNames[j]); 188 189 //add new connectors 190 for (; i < this.connectorNames.Count; i++) 191 operatorShape.AddConnector(this.connectorNames[i]); 192 193 operatorShape.UpdateLabels(this.labels); 194 } 185 } else 186 i++; 187 j++; 188 } 189 //remove remaining old connectors 190 for (; j < oldConnectorNames.Count; j++) 191 operatorShape.RemoveConnector(oldConnectorNames[j]); 192 193 //add new connectors 194 for (; i < this.connectorNames.Count; i++) 195 operatorShape.AddConnector(this.connectorNames[i]); 196 197 operatorShape.UpdateLabels(this.labels); 198 } 199 200 public override void UpdateShapeInfo(IShape shape) { 201 base.UpdateShapeInfo(shape); 202 OperatorShape operatorShape = (OperatorShape)shape; 203 this.Title = operatorShape.Title; 204 this.Color = operatorShape.Color; 205 this.LineColor = operatorShape.LineColor; 206 this.LineWidth = operatorShape.LineWidth; 207 this.Icon = operatorShape.Icon; 208 this.Collapsed = operatorShape.Collapsed; 209 210 //TODO update Connector and labels; 195 211 } 196 212 197 213 public override IDeepCloneable Clone(Cloner cloner) { 198 OperatorShapeInfo clone = (OperatorShapeInfo) 214 OperatorShapeInfo clone = (OperatorShapeInfo)base.Clone(cloner); 199 215 clone.collapsed = this.collapsed; 200 216 clone.color = this.color; … … 202 218 clone.lineWidth = this.lineWidth; 203 219 clone.title = this.title; 204 clone.icon = (Bitmap) 220 clone.icon = (Bitmap)this.icon.Clone(); 205 221 206 222 clone.connectorNames = new List<string>(this.connectorNames);
Note: See TracChangeset
for help on using the changeset viewer.