Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/26/14 02:19:58 (10 years ago)
Author:
bburlacu
Message:

#1772: Got the lineageExplorerChart to display symbolic expression trees with the correct orientation (vertically flipped).

File:
1 edited

Legend:

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

    r10514 r10517  
    2525using HeuristicLab.Visualization;
    2626using HeuristicLab.Visualization.Primitives;
    27 using Rectangle = HeuristicLab.Visualization.Rectangle;
    2827
    2928namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
     
    5655      LayoutEngine.CalculateLayout();
    5756
    58       var primitivesMap = new Dictionary<LayoutNode<ISymbolicExpressionTreeNode>, LabeledPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase
     57      var primitivesMap = new Dictionary<LayoutNode<ISymbolicExpressionTreeNode>, IPrimitive>(); // both Ellipse and Rectangle are derived from the RectangularPrimitiveBase
    5958      var font = new Font(FontFamily.GenericSansSerif, 10, GraphicsUnit.Pixel);
    6059
    6160      foreach (var node in layoutNodes) {
    62         LabeledPrimitive labeledPrimitive;
    63         if (node.Children == null || node.Children.Count == 0) {
    64           var rectangle = new Rectangle(Chart, node.X, node.Y, node.X + preferredNodeWidth, node.Y + preferredNodeHeight);
    65           var textPrimitive = new TextPrimitive(Chart, rectangle.LowerLeft, rectangle.UpperRight) {
    66             Font = font,
    67             Text = node.Content.ToString()
    68           };
    69           labeledPrimitive = new LabeledPrimitive(Chart, rectangle, textPrimitive);
     61        var lowerLeft = new PointD(node.X, node.Y);
     62        var upperRight = new PointD(node.X + preferredNodeWidth, node.Y + preferredNodeHeight);
     63
     64        RectangularPrimitiveBase rectangularPrimitive;
     65        if (node.IsLeaf) {
     66          rectangularPrimitive = new LabeledRectangle(Chart, lowerLeft, upperRight) { Font = font, Text = node.Content.ToString() };
    7067        } else {
    71           var ellipse = new Ellipse(Chart, node.X, node.Y, node.X + preferredNodeWidth, node.Y + preferredNodeHeight);
    72           var textPrimitive = new TextPrimitive(Chart, ellipse.LowerLeft, ellipse.UpperRight) {
    73             Font = font,
    74             Text = node.Content.ToString()
    75           };
    76           labeledPrimitive = new LabeledPrimitive(Chart, ellipse, textPrimitive);
     68          rectangularPrimitive = new LabeledEllipse(Chart, lowerLeft, upperRight) { Font = font, Text = node.Content.ToString() };
    7769        }
    78         this.Add(labeledPrimitive);
    79         primitivesMap.Add(node, labeledPrimitive);
     70
     71        this.Add(rectangularPrimitive);
     72        primitivesMap.Add(node, rectangularPrimitive);
    8073      }
    8174
Note: See TracChangeset for help on using the changeset viewer.