Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15040


Ignore:
Timestamp:
06/21/17 10:56:18 (7 years ago)
Author:
bburlacu
Message:

#2794: Introduce properties for vertical and horizontal padding.

File:
1 edited

Legend:

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

    r15029 r15040  
    3737    private ILayoutEngine<ISymbolicExpressionTreeNode> layoutEngine;
    3838
    39     private const int preferredNodeWidth = 70;
    40     private const int preferredNodeHeight = 46;
     39    private int preferredNodeWidth = 70;
     40    public int PreferredNodeWidth {
     41      get { return preferredNodeWidth; }
     42      set { preferredNodeWidth = value; }
     43    }
     44
     45    private int preferredNodeHeight = 46;
     46    public int PreferredNodeHeight {
     47      get { return preferredNodeHeight; }
     48      set { preferredNodeHeight = value; }
     49    }
     50
    4151    private int minHorizontalDistance = 30;
     52    public int MinimumHorizontalDistance {
     53      get { return minHorizontalDistance; }
     54      set { minHorizontalDistance = value; }
     55    }
     56
    4257    private int minVerticalDistance = 30;
     58    public int MinimumVerticalDistance {
     59      get { return minVerticalDistance; }
     60      set { minVerticalDistance = value; }
     61    }
     62
     63    private int minHorizontalPadding = 20;
     64    public int MinimumHorizontalPadding {
     65      get { return minHorizontalPadding; }
     66      set { minHorizontalPadding = value; }
     67    }
     68
     69    private int minVerticalPadding = 20;
     70    public int MinimumVerticalPadding {
     71      get { return minVerticalPadding; }
     72      set { minVerticalPadding = value; }
     73    }
    4374
    4475    public SymbolicExpressionTreeChart() {
     
    287318        actualRoot = tree.Root.GetSubtree(0);
    288319      }
    289       var paddingX = 20; // add 10px padding on each side (left and right)
    290       var paddingY = 20; // add 10px padding on top and bottom
    291       var visualNodes = layoutEngine.CalculateLayout(actualRoot, Width - paddingX, Height - paddingY).ToList();
     320      var visualNodes = layoutEngine.CalculateLayout(actualRoot, Width - minHorizontalPadding, Height - minVerticalPadding).ToList();
    292321      // add the padding
    293322      foreach (var vn in visualNodes) {
    294         vn.X += paddingX / 2;
    295         vn.Y += paddingY / 2;
     323        vn.X += minHorizontalPadding / 2;
     324        vn.Y += minVerticalPadding / 2;
    296325      }
    297326
Note: See TracChangeset for help on using the changeset viewer.