Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/24/14 16:59:22 (10 years ago)
Author:
bburlacu
Message:

#1772: Added new SymbolicDataAnalysisGenealogyView and added support for the tracing of building blocks (finding the constituent ancestral elements of a selected subtree).

File:
1 edited

Legend:

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

    r10302 r10650  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Drawing;
     
    2647    }
    2748
     49    public IGenealogyGraphNode SelectedGraphNode { get; private set; }
     50
    2851    private void Clear() {
    2952      if (nodeMap == null)
     
    4164    private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap;
    4265
     66    #region chart modes
    4367    public bool SimpleLineages { get; set; }
    4468    public bool LockGenealogy { get; set; }
     69    public bool TraceFragments { get; set; }
     70    #endregion
     71
    4572    private Visualization.Rectangle TargetRectangle { get; set; }
     73    private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
     74    private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
    4675
    4776    private VisualGenealogyGraphNode GetMappedNode(IGenealogyGraphNode node) {
     
    6291      return arc;
    6392    }
    64     private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
    65     private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
    66 
    67     public event MouseEventHandler GenealogyGraphNodeClicked;
    68     private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
    69       var clicked = GenealogyGraphNodeClicked;
    70       if (clicked != null) clicked(sender, e);
    71     }
     93
    7294    public GenealogyGraphChart()
    7395      : base() {
    7496      InitializeComponent();
    7597    }
     98
    7699    protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) {
    77100      Chart.UpdateEnabled = false;
     
    127150      DrawInProgress = false;
    128151    }
     152
     153    public event MouseEventHandler GenealogyGraphNodeClicked;
     154    private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
     155      var clicked = GenealogyGraphNodeClicked;
     156      if (clicked != null) clicked(sender, e);
     157    }
     158
     159    #region event handlers
    129160    protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) {
    130161      if (!DrawInProgress) {
     
    160191      SelectedVisualNode = visualNodes[0] as VisualGenealogyGraphNode;
    161192      if (SelectedVisualNode == null) return;
     193      SelectedGraphNode = SelectedVisualNode.Data;
    162194
    163195      if (!LockGenealogy) {
     
    188220      base.pictureBox_MouseUp(sender, e);
    189221    }
     222    #endregion
     223
    190224    private void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) {
    191225      if (node.Brush != null) return;
     
    205239      }
    206240    }
     241
    207242    void MarkSelectedNode() {
    208243      var center = SelectedVisualNode.Center;
     
    219254      }
    220255    }
     256
    221257    private static VisualGenealogyGraphArc AddArc(IChart chart, VisualGenealogyGraphNode source, VisualGenealogyGraphNode target, Pen pen, Brush brush = null) {
    222258      var arc = new VisualGenealogyGraphArc(chart, source, target, pen) { Brush = brush };
     
    227263      return arc;
    228264    }
     265
    229266    public virtual void ClearPrimitives() {
    230267      foreach (var primitive in Chart.Group.Primitives) {
     
    236273      }
    237274    }
     275
    238276    public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes) {
    239277      Chart.UpdateEnabled = false;
    240278      ClearPrimitives();
    241279      foreach (var node in nodes) {
    242         GetMappedNode(node).Brush = new SolidBrush(node.GetColor());
     280        var graphNode = GetMappedNode(node);
     281        graphNode.Brush = new SolidBrush(node.GetColor());
    243282      }
    244283      Chart.UpdateEnabled = true;
    245284      Chart.EnforceUpdate();
    246285    }
     286
    247287    public void HighlightAll() {
    248288      Chart.UpdateEnabled = false;
     
    261301    }
    262302  }
     303
    263304  internal static class Util {
    264305    public static Color GetColor(this IGenealogyGraphNode node) {
Note: See TracChangeset for help on using the changeset viewer.