Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/14 20:47:50 (10 years ago)
Author:
bburlacu
Message:

#1772: Added SymbolicDataAnalysisGenealogyView, updated generic analyzer and operators.

File:
1 edited

Legend:

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

    r10271 r10285  
    66using System.Windows.Forms;
    77using HeuristicLab.Common;
     8using HeuristicLab.Core;
    89using HeuristicLab.Visualization;
    910
    1011namespace HeuristicLab.EvolutionTracking.Views {
    11   public partial class GenealogyGraphChart : ChartControl {
    12     private GenealogyGraph genealogyGraph;
     12  public partial class GenealogyGraphChart<TGraph, TVertex, TContent> : ChartControl
     13    where TGraph : class, IGenealogyGraph<TVertex, TContent>
     14    where TVertex : class, IGenealogyGraphNode<TContent>, new()
     15    where TContent : class,IItem {
     16    private TGraph genealogyGraph;
    1317
    1418    private const double XIncrement = 30;
     
    1620    private const double Diameter = 20;
    1721
    18     public GenealogyGraph GenealogyGraph {
     22    public TGraph GenealogyGraph {
    1923      get { return genealogyGraph; }
    2024      set {
     
    6266      return arc;
    6367    }
    64 
    6568    private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
    6669    private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
     
    7174      if (clicked != null) clicked(sender, e);
    7275    }
    73 
    7476    public GenealogyGraphChart() {
    7577      InitializeComponent();
    7678    }
    77 
    7879    protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) {
    7980      Chart.UpdateEnabled = false;
     
    104105        }
    105106        y -= yIncrement;
    106       }
     107        x = 0;
     108      }
     109
    107110      // add arcs
    108111      foreach (var node in GenealogyGraph.Nodes) {
     
    116119          var pen = new Pen(Color.Transparent);
    117120          var visualArc = AddArc(Chart, visualParent, visualNode, pen);
    118           arcMap.Add(Tuple.Create(visualParent, visualNode), visualArc);
     121          if (!arcMap.ContainsKey(Tuple.Create(visualParent, visualNode)))
     122            arcMap.Add(Tuple.Create(visualParent, visualNode), visualArc);
    119123        }
    120124      }
     
    126130      DrawInProgress = false;
    127131    }
    128 
    129     protected override void pictureBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) {
     132    protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) {
    130133      if (!DrawInProgress) {
    131134        switch (e.Button) {
     
    142145      base.pictureBox_MouseMove(sender, e);
    143146    }
    144 
    145147    protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) {
    146148      Cursor = Cursors.Default;
     
    189191      base.pictureBox_MouseUp(sender, e);
    190192    }
    191 
    192193    private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) {
    193194      if (node.Brush != null) return;
     
    207208      }
    208209    }
    209 
    210210    void MarkSelectedNode() {
    211211      var center = SelectedVisualNode.Center;
     
    222222      }
    223223    }
    224 
    225 
    226224    private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) {
    227225      var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush };
     
    232230      return arc;
    233231    }
    234 
    235232    public virtual void ClearPrimitives() {
    236233      foreach (var primitive in Chart.Group.Primitives) {
     
    267264    }
    268265  }
    269 
    270266  internal static class Util {
    271267    public static Color GetColor(this IGenealogyGraphNode node) {
Note: See TracChangeset for help on using the changeset viewer.