Free cookie consent management tool by TermsFeed Policy Generator

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.