Changeset 2942
- Timestamp:
- 03/05/10 16:37:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/GraphVisualizationInfo.cs
r2935 r2942 37 37 get { return this.operatorShapeInfoMapping; } 38 38 set { 39 foreach (KeyValuePair<IOperator, IOperatorShapeInfo> pair in value.FirstEnumerable) 40 this.AddShapeInfo(pair.Key, pair.Value); 39 IOperator op; 40 IOperatorShapeInfo shapeInfo; 41 foreach (KeyValuePair<IOperator, IOperatorShapeInfo> pair in value.FirstEnumerable) { 42 op = pair.Key; 43 shapeInfo = pair.Value; 44 this.RegisterOperatorEvents(op); 45 this.operatorParameterCollectionMapping.Add(op, pair.Key.Parameters); 46 this.operatorShapeInfoMapping.Add(op, shapeInfo); 47 this.shapeInfos.Add(shapeInfo); 48 } 49 50 foreach(IOperator oper in value.FirstValues) { 51 foreach (IParameter param in oper.Parameters) { 52 this.parameterOperatorMapping.Add(param, oper); 53 IValueParameter<IOperator> opParam = param as IValueParameter<IOperator>; 54 if (opParam != null) { 55 this.RegisterOperatorParameterEvents(opParam); 56 shapeInfo = this.operatorShapeInfoMapping.GetByFirst(oper); 57 if (opParam.Value != null) { 58 this.connections.Add(new KeyValuePair<IOperatorShapeInfo, string>(shapeInfo, param.Name), this.operatorShapeInfoMapping.GetByFirst(opParam.Value)); 59 } 60 } else 61 this.RegisterParameterEvents(param); 62 } 63 } 41 64 } 42 65 } … … 56 79 public GraphVisualizationInfo(OperatorGraph operatorGraph) 57 80 : this() { 58 this.operatorGraph = operatorGraph; 59 this.operatorGraph.InitialOperatorChanged += new EventHandler(operatorGraph_InitialOperatorChanged); 60 operatorGraph.Operators.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded); 61 operatorGraph.Operators.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved); 62 operatorGraph.Operators.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_CollectionReset); 81 this.OperatorGraph = operatorGraph; 63 82 64 83 foreach (IOperator op in operatorGraph.Operators) … … 109 128 } 110 129 130 131 private OperatorGraph operatorGraph; 111 132 [Storable] 112 private OperatorGraph operatorGraph;113 133 public OperatorGraph OperatorGraph { 114 134 get { return this.operatorGraph; } 135 private set { 136 if (this.operatorGraph != null || value == null) 137 throw new InvalidOperationException("Could not set OperatorGraph"); 138 139 this.operatorGraph = value; 140 this.operatorGraph.InitialOperatorChanged += new EventHandler(operatorGraph_InitialOperatorChanged); 141 this.operatorGraph.Operators.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded); 142 this.operatorGraph.Operators.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved); 143 this.operatorGraph.Operators.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_CollectionReset); 144 } 115 145 } 116 146 … … 126 156 } 127 157 128 [Storable]129 158 private ObservableDictionary<KeyValuePair<IOperatorShapeInfo, string>, IOperatorShapeInfo> connections; 130 159 public INotifyObservableDictionaryItemsChanged<KeyValuePair<IOperatorShapeInfo, string>, IOperatorShapeInfo> ObservableConnections { … … 145 174 this.AddParameter(op, param); 146 175 147 if (!this.operatorGraph.Operators.Contains(op)) 148 this.operatorGraph.Operators.Add(op); 176 this.operatorGraph.Operators.Add(op); 149 177 } 150 178 … … 184 212 this.operatorParameterCollectionMapping.Add(op, op.Parameters); 185 213 this.operatorShapeInfoMapping.Add(op, shapeInfo); 214 this.shapeInfos.Add(shapeInfo); 186 215 foreach (IParameter param in op.Parameters) 187 216 this.AddParameter(op, param); 188 189 this.shapeInfos.Add(shapeInfo);190 217 } 191 218 }
Note: See TracChangeset
for help on using the changeset viewer.