Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/07/14 21:44:36 (10 years ago)
Author:
bburlacu
Message:

#1772: Cleaned up the design of the generic genealogy analyzer and related classes, created generic genealogy graph view. Added instrumentation code to TravelingSalesmapProblem.cs allowing genealogy tracking. Merged trunk changes (instrumentation for multi operators).

File:
1 edited

Legend:

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

    r10285 r10300  
    1 #region License Information
    2 /* HeuristicLab
    3  * Copyright (C) 2002-2010 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 
    22 using System;
    23 using System.Linq;
    24 using System.Windows.Forms;
    25 using HeuristicLab.Core.Views;
     1using HeuristicLab.Core.Views;
    262using HeuristicLab.MainForm;
    273
    284namespace HeuristicLab.EvolutionTracking.Views {
    29   [View("GenealogyGraph")]
    30   [Content(typeof(GenealogyGraph), IsDefaultView = true)]
     5  [View("GenealogyGraphView")]
     6  [Content(typeof(GenealogyGraph), IsDefaultView = false)]
    317  public sealed partial class GenealogyGraphView : ItemView {
    32     public new GenealogyGraph Content {
    33       get { return (GenealogyGraph)base.Content; }
     8    public new IGenealogyGraph Content {
     9      get { return (IGenealogyGraph)base.Content; }
    3410      set { base.Content = value; }
    3511    }
    3612
    37     public GenealogyGraphView()
    38       : base() {
     13    public GenealogyGraphView() {
    3914      InitializeComponent();
    40       // set button icons here because if set in the designer file, they get overwritten
    41       this.highlightAllButton.Image = Common.Resources.VSImageLibrary.Gradient;
    42       this.simpleLineagesCheckBox.Image = Common.Resources.VSImageLibrary.ArrowDown;
    43       this.lockGenealogyCheckBox.Image = Common.Resources.VSImageLibrary.ProtectForm;
    4415    }
    4516
    4617    protected override void DeregisterContentEvents() {
    4718      // TODO: Deregister your event handlers here
    48       Content.GraphUpdated -= GenealogyGraphUpdated;
    4919      base.DeregisterContentEvents();
    5020    }
     
    5323      base.RegisterContentEvents();
    5424      // TODO: Register your event handlers here
    55       Content.GraphUpdated += GenealogyGraphUpdated;
    5625    }
    5726
    5827    #region Event Handlers (Content)
    5928    // TODO: Put event handlers of the content here
     29    #endregion
     30
    6031    protected override void OnContentChanged() {
    6132      base.OnContentChanged();
    62       //      genealogyGraphChart.GenealogyGraph = Content ?? null;
     33      if (Content == null) {
     34      } else {
     35        genealogyGraphChart.GenealogyGraph = Content;
     36      }
    6337    }
    64     private void Content_GraphChanged(object sender, EventArgs e) {
    65     }
     38
    6639    protected override void SetEnabledStateOfControls() {
    6740      base.SetEnabledStateOfControls();
    68       genealogyGraphChart.Enabled = Content != null;
     41      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
    6942    }
    70     #endregion
    7143
    7244    #region Event Handlers (child controls)
    73     private void GenealogyGraphUpdated(object sender, EventArgs args) {
    74       genealogyGraphChart.GenealogyGraph = Content;
    75     }
    76     void MatchNodesAndRepaint() {
    77       genealogyGraphChart.Chart.UpdateEnabled = false;
    78       genealogyGraphChart.ClearPrimitives(); // clear node colors
    79 
    80       genealogyGraphChart.Chart.UpdateEnabled = true;
    81       genealogyGraphChart.Chart.EnforceUpdate();
    82     }
    83 
    84     private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
    85     }
     45    // TODO: Put event handlers of child controls here.
    8646    #endregion
    87     private void simpleLineagesCheckBox_CheckedChanged(object sender, EventArgs e) {
    88       genealogyGraphChart.SimpleLineages = simpleLineagesCheckBox.Checked;
    89     }
    90 
    91     private void highlightAllButton_Click(object sender, EventArgs e) {
    92     }
    93 
    94     private void lockGenealogyCheckBox_CheckedChanged(object sender, EventArgs e) {
    95       genealogyGraphChart.LockGenealogy = lockGenealogyCheckBox.Checked;
    96     }
    97 
    98     private void highlightRootParentsButton_Click(object sender, EventArgs e) {
    99       var nodes = genealogyGraphChart.GenealogyGraph.Nodes.Where(n => n.InArcs != null && n.InArcs.Count == 2).Select(n => (GenealogyGraphNode)n.InArcs[0].Source).ToList();
    100       genealogyGraphChart.HighlightNodes(nodes);
    101     }
    102 
    103     private void highlightSecondaryParentsButton_Click(object sender, EventArgs e) {
    104       var nodes = genealogyGraphChart.GenealogyGraph.Nodes.Where(n => n.InArcs != null && n.InArcs.Count == 2).Select(n => (GenealogyGraphNode)n.InArcs[1].Source).ToList();
    105       genealogyGraphChart.HighlightNodes(nodes);
    106     }
    10747  }
    10848}
Note: See TracChangeset for help on using the changeset viewer.