Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10499


Ignore:
Timestamp:
02/21/14 14:25:14 (11 years ago)
Author:
gkronber
Message:

#2092: don't show the root node if it has only one sub-tree (the result producing branch). If ADFs are defined then it is necessary to show the root node as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs

    r10496 r10499  
    108108        visualLines = new Dictionary<Tuple<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>, VisualSymbolicExpressionTreeNodeConnection>();
    109109        if (tree != null) {
    110           foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) {
     110          IEnumerable<ISymbolicExpressionTreeNode> nodes;
     111          if (tree.Root.SubtreeCount == 1) nodes = tree.Root.GetSubtree(0).IterateNodesPrefix();
     112          else nodes = tree.Root.IterateNodesPrefix();
     113          foreach (ISymbolicExpressionTreeNode node in nodes) {
    111114            visualTreeNodes[node] = new VisualSymbolicExpressionTreeNode(node);
    112115            if (node.Parent != null) visualLines[Tuple.Create(node.Parent, node)] = new VisualSymbolicExpressionTreeNodeConnection();
     
    266269
    267270    #region methods for painting the symbolic expression tree
    268     private void DrawFunctionTree(ISymbolicExpressionTree symbolicExpressionTree, Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {
     271    private void DrawFunctionTree(ISymbolicExpressionTree symbolicExpressionTree, Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {     
    269272      var layoutNodes = layoutAdapter.Convert(symbolicExpressionTree).ToList();
     273      if(symbolicExpressionTree.Root.SubtreeCount==1) layoutNodes.RemoveAt(0);
    270274      layoutEngine.Reset();
    271275      layoutEngine.Root = layoutNodes[0];
Note: See TracChangeset for help on using the changeset viewer.