Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/08/14 17:26:32 (10 years ago)
Author:
bburlacu
Message:

#1772: Added default font, pen, and brush for the graphical components (the idea is to save memory by sharing default pens and brushes - not allocating new ones all the time), added support for tracing mutation operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs

    r10746 r10827  
    3737    private const double Diameter = 20;
    3838
     39    private readonly Brush defaultBrush;
     40    private readonly Pen defaultPen;
     41
    3942    public IGenealogyGraph GenealogyGraph {
    4043      get { return genealogyGraph; }
     
    9598      : base() {
    9699      InitializeComponent();
     100
     101      defaultBrush = new SolidBrush(Color.Transparent);
     102      defaultPen = new Pen(Color.DarkGray);
    97103    }
    98104
     
    111117
    112118        foreach (var node in nodes) {
    113           var pen = new Pen(Color.DarkGray);
    114119          var brush = new SolidBrush(node.GetColor());
    115120
    116           var visualNode = new VisualGenealogyGraphNode(Chart, x, y, x + diameter, y + diameter, pen, brush) {
     121          var visualNode = new VisualGenealogyGraphNode(Chart, x, y, x + diameter, y + diameter, defaultPen, brush) {
    117122            Data = node,
    118123            ToolTipText = "Rank: " + node.Rank + nl +
     
    138143          var visualParent = GetMappedNode(parent);
    139144          if (visualParent == null) continue;
    140           var pen = new Pen(Color.Transparent);
     145          var pen = Pens.Transparent;
    141146          var visualArc = AddArc(Chart, visualParent, visualNode, pen);
    142147          if (!arcMap.ContainsKey(Tuple.Create(visualParent, visualNode)))
     
    233238        var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
    234239        var end = new Point((int)arc.End.X, (int)arc.End.Y);
     240        arc.Pen = new Pen(Color.Transparent);
    235241        arc.Pen.Brush = new LinearGradientBrush(start, end, source.GetColor(), target.GetColor());
    236         arc.Pen.Color = Color.Transparent;
    237242        DrawLineage(nodeSelector(arc), arcSelector, nodeSelector);
    238243      }
     
    266271      foreach (var primitive in Chart.Group.Primitives) {
    267272        if (primitive is VisualGenealogyGraphArc) {
    268           primitive.Pen.Brush = new SolidBrush(Color.Transparent);
     273          primitive.Pen = Pens.Transparent;
    269274        } else if (primitive is VisualGenealogyGraphNode) {
    270           var brush = (SolidBrush)primitive.Brush;
    271           brush.Color = Color.Transparent;
    272           primitive.Pen.Color = Color.DarkGray;
     275          primitive.Brush = Brushes.Transparent;
     276          primitive.Pen = Pens.DarkGray;
    273277        }
    274278      }
Note: See TracChangeset for help on using the changeset viewer.