Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11503


Ignore:
Timestamp:
10/26/14 22:20:26 (10 years ago)
Author:
bburlacu
Message:

#1772: Added handling of double click event in the genealogy graph (opens a new view of the selected symbolic expression tree). Added highlighting of trace data. Very minor cosmetic changes to the TraceCalculator. Removed resx file from project.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r11253 r11503  
    283283      <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
    284284    </Compile>
    285     <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" />
     285    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
     286      <SubType>UserControl</SubType>
     287    </Compile>
    286288    <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
    287289      <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
     
    370372    </Content>
    371373  </ItemGroup>
    372   <ItemGroup>
    373     <EmbeddedResource Include="Tracking\SymboldDataAnalysisGenealogyView.resx">
    374       <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
    375     </EmbeddedResource>
    376   </ItemGroup>
    377374  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    378375  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs

    r11253 r11503  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Drawing;
     
    6162    protected override void RegisterContentEvents() {
    6263      genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
     64      genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;
    6365      symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionNodeClicked;
    6466      base.RegisterContentEvents();
     
    7880
    7981      if (graphNode.InArcs.Any()) {
    80         var fragment = (IFragment<ISymbolicExpressionTreeNode>)graphNode.InArcs.Last().Data;
     82        var fragment = graphNode.InArcs.Last().Data as IFragment<ISymbolicExpressionTreeNode>;
    8183        if (fragment != null) {
    8284          treeChart_HighlightSubtree(graphNode.Data.NodeAt(fragment.Index1));
     85        } else {
     86          var td = graphNode.InArcs.Last().Data as Tuple<int, int, int, int>;
     87          if (td != null) {
     88            var s = graphNode.Data.NodeAt(td.Item1);
     89            var f = graphNode.Data.NodeAt(td.Item2);
     90            treeChart_HighlightSubtree(s, Color.Orange);
     91            treeChart_HighlightSubtree(f, Color.RoyalBlue);
     92          }
    8393        }
    8494      }
     95    }
     96
     97    public void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) {
     98      var visualNode = (VisualGenealogyGraphNode)sender;
     99      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data;
     100      var tree = graphNode.Data;
     101      MainFormManager.MainForm.ShowContent(tree);
    85102    }
    86103
     
    109126        var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer));
    110127
    111         var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)).Cast<IGenealogyGraphNode<ISymbolicExpressionTree>>();
     128        var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x));
    112129        graphChart_highlightMatchingVertices(matchingVertices);
    113130      }
     
    133150    }
    134151
    135     private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree) {
     152    private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree, Color? color = null) {
     153      Color myColor = color == null ? Color.RoyalBlue : (Color)color;
    136154      foreach (var s in subtree.IterateNodesPrefix()) {
    137155        var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s);
    138         visualNode.LineColor = Color.RoyalBlue;
    139         visualNode.FillColor = Color.LightBlue;
     156        visualNode.LineColor = myColor;
     157        //        visualNode.FillColor = myColor;
    140158
    141159        foreach (var c in s.Subtrees) {
    142160          var visualArc = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c);
    143           visualArc.LineColor = Color.RoyalBlue;
     161          visualArc.LineColor = myColor;
    144162        }
    145163      }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs

    r10746 r11503  
    1 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
     1using System.Windows.Forms;
     2
     3namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    24  partial class SymbolicDataAnalysisExpressionGenealogyGraphChart {
    35    /// <summary>
     
    2426    /// </summary>
    2527    private void InitializeComponent() {
    26       components = new System.ComponentModel.Container();
     28      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
     29      this.SuspendLayout();
     30      //
     31      // pictureBox
     32      //
     33      this.pictureBox.MouseDoubleClick += new MouseEventHandler(this.pictureBox_DoubleClick);
     34      //
     35      // SymbolicDataAnalysisExpressionGenealogyGraphChart
     36      //
     37      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    2738      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     39      this.Name = "SymbolicDataAnalysisExpressionGenealogyGraphChart";
     40      this.Controls.SetChildIndex(this.pictureBox, 0);
     41      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
     42      this.ResumeLayout(false);
     43
    2844    }
    2945
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisExpressionGenealogyGraphChart.cs

    r10746 r11503  
    2020#endregion
    2121
     22using System.Linq;
     23using System.Windows.Forms;
    2224using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2325using HeuristicLab.EvolutionTracking;
     
    3436      set { base.GenealogyGraph = value; }
    3537    }
     38
     39    private void pictureBox_DoubleClick(object sender, MouseEventArgs e) {
     40      var visualNodes = Chart.GetAllPrimitives(e.Location).Where(p => p is VisualGenealogyGraphNode).ToList();
     41      if (!visualNodes.Any()) {
     42        SelectedVisualNode = null;
     43        return;
     44      }
     45      var visualNode = visualNodes.First();
     46
     47      base.OnGenealogyGraphNodeDoubleClicked(visualNode, e);
     48    }
    3649    // add event handlers here for processing events coming from the tree chart
    3750  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs

    r11493 r11503  
    187187    private void ConnectLast(IGenealogyGraphNode<ISymbolicExpressionTree> g, int si, IGenealogyGraphNode<ISymbolicExpressionTree> last) {
    188188      IFragment<ISymbolicExpressionTreeNode> fragment = g.Parents.Any() ? (IFragment<ISymbolicExpressionTreeNode>)g.InArcs.Last().Data : null;
    189       var n = traceGraph.GetByContent(g.Data);
    190       if (n == null) {
    191         n = g.Copy();
    192         traceGraph.AddVertex(n);
    193       }
    194189      int fi = fragment == null ? 0 : fragment.Index1; // fragment index
    195       traceMap[n] = new Tuple<int, int>(si, fi);
     190      var n = GetTraceNode(g, si, fi); // will append n to the trace graph if it does not exist
    196191      if (last == null)
    197192        return;
     
    201196      var td = new Tuple<int, int, int, int>(si, fi, lastSi, lastFi); // trace data
    202197      var arc = n.InArcs.SingleOrDefault(a => a.Source == last && a.Data.Equals(td));
    203       if (arc != null)
    204         return;
    205       arc = new GenealogyGraphArc(last, n) { Data = td };
    206       traceGraph.AddArc(arc);
     198      if (arc == null) {
     199        arc = new GenealogyGraphArc(last, n) { Data = td };
     200        traceGraph.AddArc(arc);
     201      }
    207202    }
    208203  }
Note: See TracChangeset for help on using the changeset viewer.