Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/14 16:23:40 (11 years ago)
Author:
bburlacu
Message:

#1772: Improved usage of GenealogyGraph and GenealogyGraphNode classes. Made some progress on building block tracing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/FragmentGraphView.cs

    r10656 r10677  
    2020    public new IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>> Content {
    2121      get { return (IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>>)base.Content; }
    22       set {
    23         base.Content = value;
    24         MakeTiles();
    25         Draw();
    26       }
     22      set { base.Content = value; }
    2723    }
    2824
     
    3834      var chart = symbolicExpressionChartControl.Chart;
    3935      tileDictionary.Clear();
    40       foreach (var node in Content.Nodes.Cast<IGenealogyGraphNode<IFragment<ISymbolicExpressionTreeNode>>>()) {
     36      foreach (var node in Content.Nodes) {
    4137        var tile = new SymbolicExpressionTreeTile(chart);
    4238        tile.LayoutEngine = symbolicExpressionEngine;
     
    4844      }
    4945
    50       foreach (var node in Content.Nodes.Where(n => n.InArcs != null && n.InArcs.Count > 0)) {
    51         var graphNode = (IGenealogyGraphNode<IFragment<ISymbolicExpressionTreeNode>>)node;
    52         var layoutNode = tileDictionary[graphNode];
     46
     47      foreach (var node in Content.Nodes.Where(n => n.Children.Any())) {
     48        var layoutNode = tileDictionary[node];
    5349        layoutNode.Children = new List<TileLayoutNode>();
    54         foreach (var c in node.InArcs.Select(x => x.Source as IGenealogyGraphNode<IFragment<ISymbolicExpressionTreeNode>>)) {
    55           layoutNode.Children.Add(tileDictionary[c]);
     50        foreach (var child in node.Children) {
     51          layoutNode.Children.Add(tileDictionary[child]);
    5652        }
    5753      }
     
    5955
    6056    private void Draw() {
    61       var root = tileDictionary[(IGenealogyGraphNode<IFragment<ISymbolicExpressionTreeNode>>)Content.Nodes[0]];
    62       var visualNodes = layoutEngine.CalculateLayout(root);
     57      var root = Content.Nodes.First();
     58
     59      var fragmentRoot = tileDictionary[root];
     60      var visualNodes = layoutEngine.CalculateLayout(fragmentRoot);
    6361
    6462      symbolicExpressionChartControl.UpdateEnabled = false;
     
    8280
    8381    #region Event Handlers (Content)
    84 
    8582    // TODO: Put event handlers of the content here
    86 
    87     #endregion
    88 
    8983    protected override void OnContentChanged() {
    9084      base.OnContentChanged();
    91       if (Content == null) {
    92         // TODO: Add code when content has been changed and is null
    93       } else {
    94         // TODO: Add code when content has been changed and is not null
     85      if (Content != null) {
     86        MakeTiles();
     87        Draw();
    9588      }
    9689    }
    97 
     90    #endregion
    9891
    9992    protected override void SetEnabledStateOfControls() {
Note: See TracChangeset for help on using the changeset viewer.