- Timestamp:
- 02/26/10 16:31:47 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/OperatorGraphVisualizationInfo.cs ¶
r2869 r2875 48 48 this.operatorGraph = operatorGraph; 49 49 this.operatorGraph.InitialOperatorChanged += new EventHandler(operatorGraph_InitialOperatorChanged); 50 operatorGraph.Operators.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded); 51 operatorGraph.Operators.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved); 52 operatorGraph.Operators.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_CollectionReset); 53 50 54 foreach (IOperator op in operatorGraph.Operators) 51 55 if (!this.shapeInfoMapping.ContainsFirst(op)) 52 56 this.AddOperator(op); 53 57 54 operatorGraph.Operators.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded); 55 operatorGraph.Operators.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved); 56 operatorGraph.Operators.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_CollectionReset); 58 this.UpdateInitialShape(); 57 59 } 58 60 59 61 public event EventHandler InitialShapeChanged; 60 62 private void operatorGraph_InitialOperatorChanged(object sender, EventArgs e) { 63 this.UpdateInitialShape(); 64 } 65 66 private void UpdateInitialShape() { 67 OperatorShapeInfo old = this.oldInitialShape as OperatorShapeInfo; 68 if (old != null) 69 old.HeadColor = oldInitialShapeColor; 70 71 OperatorShapeInfo newInitialShapeInfo = this.InitialShape as OperatorShapeInfo; 72 if (newInitialShapeInfo != null) { 73 oldInitialShapeColor = newInitialShapeInfo.HeadColor; 74 newInitialShapeInfo.HeadColor = Color.LightGreen; 75 } 76 77 oldInitialShape = this.InitialShape; 61 78 if (this.InitialShapeChanged != null) 62 79 this.InitialShapeChanged(this, new EventArgs()); 63 80 } 64 81 82 private IShapeInfo oldInitialShape; 83 private Color oldInitialShapeColor; 65 84 public IShapeInfo InitialShape { 66 85 get { -
TabularUnified trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/ShapeInfoFactory.cs ¶
r2872 r2875 43 43 operatorShapeInfo.Title = op.Name; 44 44 operatorShapeInfo.Text = op.GetType().ToString(); 45 operatorShapeInfo.HeadColor = Color.LightBlue; 45 46 46 47 return operatorShapeInfo; -
TabularUnified trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs ¶
r2872 r2875 97 97 if (shapeInfo != null) 98 98 this.graphVisualization.Controller.Model.LayoutRoot = this.shapeInfoShapeMapping.GetByFirst(shapeInfo); 99 else99 else 100 100 this.graphVisualization.Controller.Model.LayoutRoot = null; 101 101 } … … 281 281 IShape shape = this.shapeInfoShapeMapping.GetByFirst(shapeInfo); 282 282 shapeInfo.UpdateShape(shape); 283 shape.Invalidate(); 283 284 } 284 285 … … 334 335 #region methods for toolbar items 335 336 336 private int layoutCount = 0;337 337 internal void RelayoutOperatorGraph() { 338 if (this.shapeInfoShapeMapping.Count > 0 && this.connectionConnectorsMapping.Count > 0) { //otherwise the layout does not work 339 340 string layoutName = string.Empty; 341 switch (this.layoutCount % 6) { 342 case 0: { layoutName = "Random Layout"; break; } 343 case 1: { layoutName = "FruchtermanReingold Layout"; break; } 344 case 2: { layoutName = "Standard TreeLayout"; break; } 345 case 3: { layoutName = "Radial TreeLayout"; break; } 346 case 4: { layoutName = "Balloon TreeLayout"; break; } 347 case 5: { layoutName = "ForceDirected Layout"; break; } 348 } 338 if (this.shapeInfoShapeMapping.Count > 0 339 && this.connectionConnectorsMapping.Count > 0 340 && this.VisualizationInfo.InitialShape != null) { //otherwise the layout does not work 341 string layoutName = "Standard TreeLayout"; 349 342 this.graphVisualization.Controller.RunActivity(layoutName); 350 MessageBox.Show(layoutName);351 this.layoutCount++;352 343 this.graphVisualization.Invalidate(); 353 344 }
Note: See TracChangeset
for help on using the changeset viewer.