Changeset 11506


Ignore:
Timestamp:
10/27/14 20:47:37 (8 years ago)
Author:
bburlacu
Message:

#1772: Updated views (fixed position and anchors).

Location:
branches/HeuristicLab.EvolutionTracking
Files:
4 edited

Legend:

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

    r11262 r11506  
    5050    }
    5151
    52     public IGenealogyGraphNode SelectedGraphNode { get; private set; }
     52    public IGenealogyGraphNode SelectedGraphNode {
     53      get {
     54        return SelectedVisualNode == null ? null : SelectedVisualNode.Data;
     55      }
     56    }
    5357
    5458    private void Clear() {
     
    7074    private Visualization.Rectangle TargetRectangle { get; set; }
    7175    private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished
    72     private VisualGenealogyGraphNode SelectedVisualNode { get; set; }
     76    protected VisualGenealogyGraphNode SelectedVisualNode { get; set; }
    7377
    7478    private VisualGenealogyGraphNode GetMappedNode(IGenealogyGraphNode node) {
     
    156160
    157161    public event MouseEventHandler GenealogyGraphNodeClicked;
    158     private void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
     162    protected void OnGenealogyGraphNodeClicked(object sender, MouseEventArgs e) {
    159163      var clicked = GenealogyGraphNodeClicked;
    160164      if (clicked != null) clicked(sender, e);
    161165    }
    162166
     167    public event MouseEventHandler GenealogyGraphNodeDoubleClicked;
     168    protected void OnGenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs e) {
     169      var doubleClicked = GenealogyGraphNodeDoubleClicked;
     170      if (doubleClicked != null)
     171        doubleClicked(sender, e);
     172    }
    163173    #region event handlers
     174
    164175    protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) {
    165176      if (!DrawInProgress) {
     
    195206      SelectedVisualNode = visualNodes[0] as VisualGenealogyGraphNode;
    196207      if (SelectedVisualNode == null) return;
    197       SelectedGraphNode = SelectedVisualNode.Data;
    198208
    199209      if (!LockGenealogy) {
     
    334344      Chart.EnforceUpdate();
    335345    }
     346
     347    public void HighlightArc(IGenealogyGraphNode source, IGenealogyGraphNode target) {
     348      var arc = GetMappedArc(source, target) ??
     349                AddArc(Chart, GetMappedNode(source), GetMappedNode(target), new Pen(Color.Transparent));
     350      var start = new Point((int)arc.Start.X, (int)arc.Start.Y);
     351      var end = new Point((int)arc.End.X, (int)arc.End.Y);
     352      arc.Pen = new Pen(Color.Transparent);
     353      arc.Pen.Brush = new LinearGradientBrush(start, end, source.GetColor(), target.GetColor());
     354    }
    336355  }
    337356
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.Designer.cs

    r10347 r11506  
    2626    private void InitializeComponent() {
    2727      this.splitContainer = new System.Windows.Forms.SplitContainer();
    28       this.panel1 = new System.Windows.Forms.Panel();
    29       this.panel2 = new System.Windows.Forms.Panel();
     28      this.genealogyGraphChart = new HeuristicLab.EvolutionTracking.Views.GenealogyGraphChart();
    3029      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    31       this.genealogyGraphChart = new HeuristicLab.EvolutionTracking.Views.GenealogyGraphChart();
    3230      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    3331      this.splitContainer.Panel1.SuspendLayout();
    3432      this.splitContainer.Panel2.SuspendLayout();
    3533      this.splitContainer.SuspendLayout();
    36       this.panel1.SuspendLayout();
    37       this.panel2.SuspendLayout();
    3834      this.SuspendLayout();
    3935      //
     
    4642      // splitContainer.Panel1
    4743      //
    48       this.splitContainer.Panel1.Controls.Add(this.panel1);
     44      this.splitContainer.Panel1.Controls.Add(this.genealogyGraphChart);
    4945      //
    5046      // splitContainer.Panel2
    5147      //
    52       this.splitContainer.Panel2.Controls.Add(this.panel2);
    53       this.splitContainer.Size = new System.Drawing.Size(1128, 700);
    54       this.splitContainer.SplitterDistance = 500;
     48      this.splitContainer.Panel2.Controls.Add(this.viewHost);
     49      this.splitContainer.Size = new System.Drawing.Size(894, 678);
     50      this.splitContainer.SplitterDistance = 417;
    5551      this.splitContainer.TabIndex = 0;
    56       //
    57       // panel1
    58       //
    59       this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    60       this.panel1.Controls.Add(this.genealogyGraphChart);
    61       this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
    62       this.panel1.Location = new System.Drawing.Point(0, 0);
    63       this.panel1.Name = "panel1";
    64       this.panel1.Size = new System.Drawing.Size(500, 700);
    65       this.panel1.TabIndex = 0;
    66       //
    67       // panel2
    68       //
    69       this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    70       this.panel2.Controls.Add(this.viewHost);
    71       this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
    72       this.panel2.Location = new System.Drawing.Point(0, 0);
    73       this.panel2.Name = "panel2";
    74       this.panel2.Size = new System.Drawing.Size(624, 700);
    75       this.panel2.TabIndex = 0;
    76       //
    77       // viewHost
    78       //
    79       this.viewHost.Caption = "View";
    80       this.viewHost.Content = null;
    81       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    82       this.viewHost.Enabled = false;
    83       this.viewHost.Location = new System.Drawing.Point(0, 0);
    84       this.viewHost.Name = "viewHost";
    85       this.viewHost.ReadOnly = false;
    86       this.viewHost.Size = new System.Drawing.Size(622, 698);
    87       this.viewHost.TabIndex = 0;
    88       this.viewHost.ViewsLabelVisible = true;
    89       this.viewHost.ViewType = null;
    9052      //
    9153      // genealogyGraphChart
     
    9961      this.genealogyGraphChart.ScaleOnResize = true;
    10062      this.genealogyGraphChart.SimpleLineages = false;
    101       this.genealogyGraphChart.Size = new System.Drawing.Size(498, 698);
     63      this.genealogyGraphChart.Size = new System.Drawing.Size(417, 678);
    10264      this.genealogyGraphChart.TabIndex = 2;
     65      this.genealogyGraphChart.TraceFragments = false;
     66      //
     67      // viewHost
     68      //
     69      this.viewHost.Caption = "View";
     70      this.viewHost.Content = null;
     71      this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
     72      this.viewHost.Enabled = false;
     73      this.viewHost.Location = new System.Drawing.Point(0, 0);
     74      this.viewHost.Name = "viewHost";
     75      this.viewHost.ReadOnly = false;
     76      this.viewHost.Size = new System.Drawing.Size(473, 678);
     77      this.viewHost.TabIndex = 0;
     78      this.viewHost.ViewsLabelVisible = true;
     79      this.viewHost.ViewType = null;
    10380      //
    10481      // GenealogyGraphView
     
    10885      this.Controls.Add(this.splitContainer);
    10986      this.Name = "GenealogyGraphView";
    110       this.Size = new System.Drawing.Size(1128, 700);
     87      this.Size = new System.Drawing.Size(894, 678);
    11188      this.splitContainer.Panel1.ResumeLayout(false);
    11289      this.splitContainer.Panel2.ResumeLayout(false);
    11390      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    11491      this.splitContainer.ResumeLayout(false);
    115       this.panel1.ResumeLayout(false);
    116       this.panel2.ResumeLayout(false);
    11792      this.ResumeLayout(false);
    11893
     
    12398    protected System.Windows.Forms.SplitContainer splitContainer;
    12499    protected MainForm.WindowsForms.ViewHost viewHost;
    125     protected System.Windows.Forms.Panel panel1;
    126     protected System.Windows.Forms.Panel panel2;
    127100    protected GenealogyGraphChart genealogyGraphChart;
    128101
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.Designer.cs

    r10888 r11506  
    4949      this.components = new System.ComponentModel.Container();
    5050      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    51       this.genealogyGraphChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.SymbolicDataAnalysisExpressionGenealogyGraphChart();
    5251      this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
    5352      this.groupBox1 = new System.Windows.Forms.GroupBox();
     53      this.hotPaths_button = new System.Windows.Forms.Button();
    5454      this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();
    5555      this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();
    5656      this.trace_checkBox = new System.Windows.Forms.CheckBox();
    57       this.hotPaths_button = new System.Windows.Forms.Button();
     57      this.genealogyGraphChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.SymbolicDataAnalysisExpressionGenealogyGraphChart();
    5858      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    5959      this.splitContainer1.Panel1.SuspendLayout();
     
    6565      // splitContainer1
    6666      //
     67      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     68            | System.Windows.Forms.AnchorStyles.Left)
     69            | System.Windows.Forms.AnchorStyles.Right)));
    6770      this.splitContainer1.Location = new System.Drawing.Point(0, 57);
    6871      this.splitContainer1.Name = "splitContainer1";
     
    7578      //
    7679      this.splitContainer1.Panel2.Controls.Add(this.symbolicExpressionTreeChart);
    77       this.splitContainer1.Size = new System.Drawing.Size(1247, 698);
    78       this.splitContainer1.SplitterDistance = 607;
     80      this.splitContainer1.Size = new System.Drawing.Size(1244, 695);
     81      this.splitContainer1.SplitterDistance = 605;
    7982      this.splitContainer1.TabIndex = 0;
    8083      //
    81       // genealogyGraphChart
    82       //
    83       this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control;
    84       this.genealogyGraphChart.Dock = System.Windows.Forms.DockStyle.Fill;
    85       this.genealogyGraphChart.GenealogyGraph = null;
    86       this.genealogyGraphChart.Location = new System.Drawing.Point(0, 0);
    87       this.genealogyGraphChart.LockGenealogy = false;
    88       this.genealogyGraphChart.Name = "genealogyGraphChart";
    89       this.genealogyGraphChart.ScaleOnResize = true;
    90       this.genealogyGraphChart.SimpleLineages = false;
    91       this.genealogyGraphChart.Size = new System.Drawing.Size(607, 698);
    92       this.genealogyGraphChart.TabIndex = 0;
    93       this.genealogyGraphChart.TraceFragments = false;
    94       //
    9584      // symbolicExpressionTreeChart
    9685      //
     86      this.symbolicExpressionTreeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     87            | System.Windows.Forms.AnchorStyles.Left)
     88            | System.Windows.Forms.AnchorStyles.Right)));
    9789      this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
    98       this.symbolicExpressionTreeChart.Dock = System.Windows.Forms.DockStyle.Fill;
    9990      this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
    10091      this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
    10192      this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
    102       this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(636, 698);
     93      this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(635, 692);
    10394      this.symbolicExpressionTreeChart.Spacing = 5;
    10495      this.symbolicExpressionTreeChart.SuspendRepaint = false;
     
    109100      // groupBox1
    110101      //
     102      this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     103            | System.Windows.Forms.AnchorStyles.Right)));
    111104      this.groupBox1.Controls.Add(this.hotPaths_button);
    112105      this.groupBox1.Controls.Add(this.simpleLineages_checkBox);
     
    115108      this.groupBox1.Location = new System.Drawing.Point(3, 3);
    116109      this.groupBox1.Name = "groupBox1";
    117       this.groupBox1.Size = new System.Drawing.Size(1195, 48);
     110      this.groupBox1.Size = new System.Drawing.Size(1241, 48);
    118111      this.groupBox1.TabIndex = 4;
    119112      this.groupBox1.TabStop = false;
    120113      this.groupBox1.Text = "Controls";
     114      //
     115      // hotPaths_button
     116      //
     117      this.hotPaths_button.Location = new System.Drawing.Point(263, 15);
     118      this.hotPaths_button.Name = "hotPaths_button";
     119      this.hotPaths_button.Size = new System.Drawing.Size(75, 23);
     120      this.hotPaths_button.TabIndex = 7;
     121      this.hotPaths_button.Text = "Hot paths";
     122      this.hotPaths_button.UseVisualStyleBackColor = true;
     123      this.hotPaths_button.Click += new System.EventHandler(this.hotPaths_button_Click);
    121124      //
    122125      // simpleLineages_checkBox
     
    153156      this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged);
    154157      //
    155       // hotPaths_button
    156       //
    157       this.hotPaths_button.Location = new System.Drawing.Point(263, 15);
    158       this.hotPaths_button.Name = "hotPaths_button";
    159       this.hotPaths_button.Size = new System.Drawing.Size(75, 23);
    160       this.hotPaths_button.TabIndex = 7;
    161       this.hotPaths_button.Text = "Hot paths";
    162       this.hotPaths_button.UseVisualStyleBackColor = true;
    163       this.hotPaths_button.Click += new System.EventHandler(this.hotPaths_button_Click);
     158      // genealogyGraphChart
     159      //
     160      this.genealogyGraphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     161            | System.Windows.Forms.AnchorStyles.Left)
     162            | System.Windows.Forms.AnchorStyles.Right)));
     163      this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control;
     164      this.genealogyGraphChart.GenealogyGraph = null;
     165      this.genealogyGraphChart.Location = new System.Drawing.Point(-5, 0);
     166      this.genealogyGraphChart.LockGenealogy = false;
     167      this.genealogyGraphChart.Name = "genealogyGraphChart";
     168      this.genealogyGraphChart.ScaleOnResize = true;
     169      this.genealogyGraphChart.SimpleLineages = false;
     170      this.genealogyGraphChart.Size = new System.Drawing.Size(607, 692);
     171      this.genealogyGraphChart.TabIndex = 0;
     172      this.genealogyGraphChart.TraceFragments = false;
    164173      //
    165174      // SymboldDataAnalysisGenealogyView
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs

    r11503 r11506  
    7878      var tree = graphNode.Data;
    7979      symbolicExpressionTreeChart.Tree = tree;
    80 
    8180      if (graphNode.InArcs.Any()) {
    8281        var fragment = graphNode.InArcs.Last().Data as IFragment<ISymbolicExpressionTreeNode>;
    8382        if (fragment != null) {
    8483          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           }
     84        }
     85      }
     86      if (graphNode.OutArcs.Any()) {
     87        var td = graphNode.OutArcs.Last().Data as Tuple<int, int, int, int>;
     88        if (td != null) {
     89          var s = graphNode.Data.NodeAt(td.Item3); // subtree index
     90          var f = graphNode.Data.NodeAt(td.Item4); // fragment index
     91          treeChart_HighlightSubtree(s, Color.Orange);
     92          treeChart_HighlightSubtree(f, Color.RoyalBlue);
    9393        }
    9494      }
     
    9898      var visualNode = (VisualGenealogyGraphNode)sender;
    9999      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data;
    100       var tree = graphNode.Data;
    101       MainFormManager.MainForm.ShowContent(tree);
     100      //      var tree = graphNode.Data;
     101      //      var model = new RegressionModel();
     102      //      var solution = new RegressionSolution()
     103      //      MainFormManager.MainForm.ShowContent(tree);
    102104    }
    103105
     
    117119        var subtreeIndex = graphNode.Data.IterateNodesPrefix().ToList().IndexOf(subtree);
    118120        var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex);
     121
    119122        if (fragmentGraph.Vertices.Any()) {
     123          var genealogyNodes = fragmentGraph.Vertices.Select(v => Content.GetByContent(v.Data));
     124          genealogyGraphChart.HighlightNodes(genealogyNodes);
     125          foreach (var a in fragmentGraph.Arcs) {
     126            genealogyGraphChart.HighlightArc(Content.GetByContent(a.Target.Data), Content.GetByContent(a.Source.Data));
     127          }
    120128          MainFormManager.MainForm.ShowContent(fragmentGraph); // display the fragment graph on the screen
    121129        }
Note: See TracChangeset for help on using the changeset viewer.