Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10728 for branches


Ignore:
Timestamp:
04/07/14 17:05:31 (11 years ago)
Author:
bburlacu
Message:

#1772: Improved aspect of visual components of the FragmentGraphView.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
6 edited

Legend:

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

    r10685 r10728  
    3535  /// </summary>
    3636  public class SymbolicExpressionTreeTile : Group {
    37     public double PreferredNodeWidth { get; set; }
    38     public double PreferredNodeHeight { get; set; }
     37    public int PreferredNodeWidth { get; set; }
     38    public int PreferredNodeHeight { get; set; }
    3939
    4040    public Size Size {
     
    119119      var actualRoot = Root;
    120120      if (Root.Symbol is ProgramRootSymbol && Root.SubtreeCount == 1) { actualRoot = Root.GetSubtree(0); }
     121
     122      LayoutEngine.NodeWidth = PreferredNodeWidth;
     123      LayoutEngine.NodeHeight = PreferredNodeHeight;
     124
    121125      var visualNodes = LayoutEngine.CalculateLayout(actualRoot);
    122126
     
    139143        this.Add(rectangularPrimitive);
    140144
    141         //        int x = Position.X, y = Position.Y;
    142         //        if (x > rectangularPrimitive.LowerLeft.X) {
    143         //          x = (int)Math.Floor(rectangularPrimitive.LowerLeft.X);
    144         //        }
    145         //        if (y > rectangularPrimitive.LowerLeft.Y) {
    146         //          y = (int)Math.Floor(rectangularPrimitive.LowerLeft.Y);
    147         //        }
    148         //        Position = new Point(x, y);
    149         //        int w = Size.Width, h = Size.Height;
    150 
    151 
    152145        if (rectangularPrimitive.Size.Width.IsAlmost(0) || rectangularPrimitive.Size.Height.IsAlmost(0)) {
    153146          throw new Exception("Primitive size cannot be zero.");
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/FragmentGraphView.cs

    r10685 r10728  
    5454
    5555      var fragmentRoot = tileDictionary[root];
     56      int maxTileWidth = 0, maxTileHeight = 0;
     57      foreach (var tile in Content.Nodes.Select(x => tileDictionary[x].Tile)) {
     58        var size = tile.Size;
     59        if (maxTileWidth < size.Width) maxTileWidth = size.Width;
     60        if (maxTileHeight < size.Height) maxTileHeight = size.Height;
     61      }
     62      layoutEngine.NodeWidth = maxTileWidth;
     63      layoutEngine.NodeHeight = maxTileHeight;
     64      layoutEngine.HorizontalSpacing = PreferredSpacing;
     65      layoutEngine.VerticalSpacing = PreferredSpacing;
     66
    5667      var visualNodes = layoutEngine.CalculateLayout(fragmentRoot);
    5768
     
    6273        symbolicExpressionChartControl.Add(tile);
    6374      }
     75      //      symbolicExpressionChartControl.FlipVertical();
    6476      symbolicExpressionChartControl.UpdateEnabled = true;
    6577      symbolicExpressionChartControl.EnforceUpdate();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10655 r10728  
    231231      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
    232232    </Compile>
    233     <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
    234       <SubType>UserControl</SubType>
    235     </Compile>
     233    <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" />
    236234    <Compile Include="SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
    237235      <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisExpressionLineageExplorerView.cs

    r10655 r10728  
    8181      symbolicExpressionChartControl.UpdateEnabled = false;
    8282      symbolicExpressionChartControl.Add(tile);
    83       symbolicExpressionChartControl.FlipVertical();
     83      //      symbolicExpressionChartControl.FlipVertical();
    8484      symbolicExpressionChartControl.UpdateEnabled = true;
    8585      symbolicExpressionChartControl.EnforceUpdate();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicExpressionChartControl.Designer.cs

    r10655 r10728  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       components = new System.ComponentModel.Container();
     26      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
     27      this.SuspendLayout();
     28      //
     29      // SymbolicExpressionChartControl
     30      //
     31      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    2732      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     33      this.DoubleBuffered = true;
     34      this.Name = "SymbolicExpressionChartControl";
     35      this.Controls.SetChildIndex(this.pictureBox, 0);
     36      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
     37      this.ResumeLayout(false);
     38
    2839    }
    2940
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicExpressionChartControl.cs

    r10655 r10728  
    11using System.Collections.Generic;
    22using System.Drawing;
     3using System.Drawing.Drawing2D;
     4using System.Linq;
    35using System.Windows.Forms;
    46using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
     
    2527
    2628    public void Draw(Graphics graphics) {
     29      graphics.SmoothingMode = SmoothingMode.HighQuality;
    2730      Chart.Group.Draw(graphics);
    2831    }
     
    3841
    3942    public void FlipVertical() {
    40       foreach (var primitive in Chart.Group.Primitives) {
    41         var tile = primitive as SymbolicExpressionTreeTile;
    42         if (tile != null) {
    43           foreach (var p in tile.Primitives) {
    44             FlipPrimitive(p);
    45           }
    46         } else {
    47           FlipPrimitive(primitive);
    48         }
     43      foreach (var p in Chart.Group.Primitives.OfType<SymbolicExpressionTreeTile>().SelectMany(x => x.Primitives)) {
     44        FlipPrimitive(p);
    4945      }
    5046    }
     
    6763
    6864      var selectedPrimitives = Chart.GetAllPrimitives(point);
    69       // first primitive in the list should be the tile, the second one should be the actual primitive representing a tree node
    70       var tile = (SymbolicExpressionTreeTile)selectedPrimitives[0];
    71       var selectedPrimitive = (RectangularPrimitiveBase)selectedPrimitives[1];
    72       var tree = tile.SymbolicExpressionTree; // use the tree to get the genealogy graph node and the fragments used for tracing building blocks
     65      if (!selectedPrimitives.Any()) return;
    7366
    74       var pen = new Pen(Color.Blue);
    75       using (var g = Graphics.FromImage(pictureBox.Image)) {
    76         g.DrawRectangle(pen, (float)selectedPrimitive.LowerLeft.X, (float)selectedPrimitive.LowerLeft.Y, (float)selectedPrimitive.Size.Width, (float)selectedPrimitive.Size.Height);
     67      foreach (var primitive in selectedPrimitives) {
     68        if (primitive is SymbolicExpressionTreeTile) continue;
     69        primitive.Pen = new Pen(Color.Blue);
     70        primitive.Pen.Brush = new SolidBrush(Color.Blue);
    7771      }
     72      EnforceUpdate();
    7873    }
    7974  }
Note: See TracChangeset for help on using the changeset viewer.