Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/26/10 16:31:47 (15 years ago)
Author:
mkommend
Message:

corrected layouting issues in netron (ticket #867)

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  
    4848      this.operatorGraph = operatorGraph;
    4949      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
    5054      foreach (IOperator op in operatorGraph.Operators)
    5155        if (!this.shapeInfoMapping.ContainsFirst(op))
    5256          this.AddOperator(op);
    5357
    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();
    5759    }
    5860
    5961    public event EventHandler InitialShapeChanged;
    6062    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;
    6178      if (this.InitialShapeChanged != null)
    6279        this.InitialShapeChanged(this, new EventArgs());
    6380    }
    6481
     82    private IShapeInfo oldInitialShape;
     83    private Color oldInitialShapeColor;
    6584    public IShapeInfo InitialShape {
    6685      get {
  • TabularUnified trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/ShapeInfoFactory.cs

    r2872 r2875  
    4343      operatorShapeInfo.Title = op.Name;
    4444      operatorShapeInfo.Text = op.GetType().ToString();
     45      operatorShapeInfo.HeadColor = Color.LightBlue;
    4546
    4647      return operatorShapeInfo;
  • TabularUnified trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs

    r2872 r2875  
    9797      if (shapeInfo != null)
    9898        this.graphVisualization.Controller.Model.LayoutRoot = this.shapeInfoShapeMapping.GetByFirst(shapeInfo);
    99       else
     99       else
    100100        this.graphVisualization.Controller.Model.LayoutRoot = null;
    101101    }
     
    281281      IShape shape = this.shapeInfoShapeMapping.GetByFirst(shapeInfo);
    282282      shapeInfo.UpdateShape(shape);
     283      shape.Invalidate();
    283284    }
    284285
     
    334335    #region methods for toolbar items
    335336
    336     private int layoutCount = 0;
    337337    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";
    349342        this.graphVisualization.Controller.RunActivity(layoutName);
    350         MessageBox.Show(layoutName);
    351         this.layoutCount++;
    352343        this.graphVisualization.Invalidate();
    353344      }
Note: See TracChangeset for help on using the changeset viewer.