Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12237 for trunk/sources


Ignore:
Timestamp:
03/23/15 10:55:54 (10 years ago)
Author:
bburlacu
Message:

#2365: Fixed bug by skipping the layout phase when the tree is saved as an image file.

File:
1 edited

Legend:

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

    r12012 r12237  
    299299
    300300    #region methods for painting the symbolic expression tree
    301     private void DrawFunctionTree(Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance) {
    302       CalculateLayout(preferredWidth, preferredHeight, minHDistance, minVDistance);
     301    private void DrawFunctionTree(Graphics graphics, int preferredWidth, int preferredHeight, int minHDistance, int minVDistance, bool recalculateLayout = true) {
     302      if (recalculateLayout)
     303        CalculateLayout(preferredWidth, preferredHeight, minHDistance, minVDistance);
    303304      var visualNodes = visualTreeNodes.Values;
    304305      //draw nodes and connections
     
    366367      Image image = new Bitmap(Width, Height);
    367368      using (Graphics g = Graphics.FromImage(image)) {
    368         DrawFunctionTree(g, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance);
     369        DrawFunctionTree(g, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance, false);
    369370      }
    370371      image.Save(filename);
     
    376377        using (Metafile file = new Metafile(filename, g.GetHdc())) {
    377378          using (Graphics emfFile = Graphics.FromImage(file)) {
    378             DrawFunctionTree(emfFile, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance);
     379            DrawFunctionTree(emfFile, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance, false);
    379380          }
    380381        }
Note: See TracChangeset for help on using the changeset viewer.