Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/02/15 17:23:33 (9 years ago)
Author:
bburlacu
Message:

#1772: Improved functionality of the SymbolicDataAnalysisGenealogyGraphView in terms of graph navigation and display of useful information. Fixed save of tree image to file in the SymbolicExpressionTreeChart.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs

    r11638 r11864  
    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);
     304
    303305      var visualNodes = visualTreeNodes.Values;
    304306      //draw nodes and connections
     
    364366    public void SaveImageAsBitmap(string filename) {
    365367      if (tree == null) return;
    366       Image image = new Bitmap(Width, Height);
    367       using (Graphics g = Graphics.FromImage(image)) {
    368         DrawFunctionTree(g, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance);
    369       }
    370       image.Save(filename);
     368      Image bitmap = new Bitmap(Width, Height);
     369      using (var g = Graphics.FromImage(bitmap)) {
     370        DrawFunctionTree(g, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance, false);
     371      }
     372      bitmap.Save(filename);
    371373    }
    372374
     
    376378        using (Metafile file = new Metafile(filename, g.GetHdc())) {
    377379          using (Graphics emfFile = Graphics.FromImage(file)) {
    378             DrawFunctionTree(emfFile, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance);
     380            DrawFunctionTree(emfFile, preferredNodeWidth, preferredNodeHeight, minHorizontalDistance, minVerticalDistance, false);
    379381          }
    380382        }
Note: See TracChangeset for help on using the changeset viewer.