Changeset 8556 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views
- Timestamp:
- 09/03/12 15:09:52 (12 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphChart.cs
r8249 r8556 32 32 namespace HeuristicLab.EvolutionaryTracking.Views { 33 33 public partial class GenealogyGraphChart : ChartControl { 34 private Dictionary< GenealogyGraphNode, List<VisualGenealogyGraphNode>> _visualNodeMap;35 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> _visualArcMap;34 private Dictionary<IGenealogyGraphNode, VisualGenealogyGraphNode> visualNodeMap; 35 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> visualArcMap; 36 36 private const int Diameter = 20; // node diameter 37 37 private int x, y; // coordinates for positioning each node 38 38 private const int Cx = 30, Cy = 30; // position increments 39 private VisualGenealogyGraphNode _selectedGenealogyGraphNode;40 public VisualGenealogyGraphNode SelectedGenealogyGraphNode { get { return _selectedGenealogyGraphNode; } }41 private Visualization.Rectangle _targetRectangle; // provides a rectangle mark of the currently selected genealogy graph node42 43 private SymbolicExpressionTreeGenealogyGraph _graph;39 private VisualGenealogyGraphNode selectedGenealogyGraphNode; 40 public VisualGenealogyGraphNode SelectedGenealogyGraphNode { get { return selectedGenealogyGraphNode; } } 41 private Visualization.Rectangle targetRectangle; // provides a rectangle mark of the currently selected genealogy graph node 42 43 private SymbolicExpressionTreeGenealogyGraph graph; 44 44 public SymbolicExpressionTreeGenealogyGraph Graph { 45 get { return _graph; }45 get { return graph; } 46 46 internal set { 47 _graph = value;48 _visualNodeMap = new Dictionary<GenealogyGraphNode, List<VisualGenealogyGraphNode>>();49 _visualArcMap = new Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc>();47 graph = value; 48 visualNodeMap = new Dictionary<IGenealogyGraphNode, VisualGenealogyGraphNode>(); 49 visualArcMap = new Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc>(); 50 50 DrawGraph(); 51 51 } … … 65 65 66 66 public void DrawGraph() { 67 if ( _graph == null) return;67 if (graph == null) return; 68 68 Chart.UpdateEnabled = false; 69 69 70 var genealogyGraphNodes = Graph.Values.ToList(); 71 var layers = genealogyGraphNodes.GroupBy(n => Graph[n].Ranks[0]).OrderBy(g => g.Key).Select(g => new { Rank = g.Key, Nodes = g.ToList() }).ToList(); 72 List<GenealogyGraphNode> currentLayer = null; 73 List<GenealogyGraphNode> previousLayer = null; 74 75 for (int i = 0; i != layers.Count(); ++i) { 76 var layer = layers[i]; 77 double currentRank = layer.Rank; 78 if (i > 0 && currentRank % 1 == 0) { 79 previousLayer = currentLayer; 80 currentLayer = layer.Nodes; 81 int d = previousLayer.Count - currentLayer.Count; 82 if (d > 0) 83 currentLayer.AddRange(previousLayer.Take(d)); 84 } else { 85 currentLayer = layer.Nodes; 86 } 87 currentLayer.Sort((b, a) => { 88 if (Graph[a].Quality.Equals(Graph[b].Quality)) { 89 if (Graph[a].IsElite) return 1; 90 if (Graph[b].IsElite) return -1; 91 } 92 return Graph[a].Quality.CompareTo(Graph[b].Quality); 93 }); // sort descending by quality (using comparison defined in GenealogyGraphNode class) 94 70 var layers = Graph.Nodes.GroupBy(n => n.Ranks[0]).OrderBy(g => g.Key).Select(g => new { Rank = g.Key, Nodes = g.ToList() }).ToList(); 71 for (int i = 0; i != layers.Count; ++i) { 72 // sort descending by quality (using comparison defined in GenealogyGraphNode class) 73 layers[i].Nodes.Sort((b, a) => Graph.Compare(a, b)); 95 74 x = 0; // reset horizontal coordinate 96 75 // start laying out visual nodes 97 foreach (var node in currentLayer) {76 foreach (var node in layers[i].Nodes) { 98 77 var pen = new Pen(Color.LightGray); 99 78 var nl = Environment.NewLine; … … 101 80 Data = node, 102 81 ToolTipText = "Id: " + node.Label + nl + 103 "Ranks: " + string.Join(",", Graph[node].Ranks.Select(r => r.ToString())) + nl +104 "Quality: " + String.Format("{0:0.0000}", Graph[node].Quality) + nl +105 "IsElite: " + Graph[node].IsElite82 "Ranks: " + string.Join(",", node.Ranks) + nl + 83 "Quality: " + String.Format("{0:0.0000}", node.Quality) + nl + 84 "IsElite: " + node.IsElite 106 85 }; 107 86 Chart.Group.Add(visualNode); 108 if (!_visualNodeMap.ContainsKey(node)) 109 _visualNodeMap[node] = new List<VisualGenealogyGraphNode>(); 110 _visualNodeMap[node].Add(visualNode); 87 if (!visualNodeMap.ContainsKey(node)) 88 visualNodeMap[node] = visualNode; 111 89 112 90 x += Cx; // increment horizontal coordinate … … 114 92 115 93 y -= Cy; // decrement vertical coordinate (because the origin is upside down) 94 95 // connect elites from successive layers with visual arcs 96 if (i > 0) { 97 for (int m = 0; m != layers[i].Nodes.Count; ++m) 98 for (int n = 0; n != layers[i - 1].Nodes.Count; ++n) { 99 if (layers[i].Nodes[m].SymbolicExpressionTree == layers[i - 1].Nodes[n].SymbolicExpressionTree) { 100 var v1 = visualNodeMap[layers[i].Nodes[m]]; 101 var v2 = visualNodeMap[layers[i - 1].Nodes[n]]; 102 var pen = new Pen(Color.LightGray); 103 visualArcMap[Tuple.Create(v2, v1)] = AddArc(Chart, v2, v1, pen); 104 } 105 } 106 } 116 107 } 117 108 // add arcs separately (to avoid some ordering problems) 118 foreach (var node in _visualNodeMap.Keys) {119 var visualNode = _visualNodeMap[node][0];109 foreach (var node in visualNodeMap.Keys) { 110 var visualNode = visualNodeMap[node]; 120 111 if (node.InEdges == null) continue; 121 112 122 113 foreach (var arc in node.InEdges) { 123 var visualParent = _visualNodeMap[arc.Target][0];114 var visualParent = visualNodeMap[arc.Target]; 124 115 var pen = new Pen(Color.Transparent); 125 _visualArcMap[Tuple.Create(visualParent, visualNode)] = AddArc(Chart, visualParent, visualNode, pen); 126 } 127 } 128 // connect visual nodes representing the same elite individual with a line 129 foreach (var list in _visualNodeMap.Values.Where(l => l.Count > 1)) { 130 for (int i = 1; i != list.Count; ++i) { 131 var pen = new Pen(Color.LightGray); 132 _visualArcMap[Tuple.Create(list[i - 1], list[i])] = AddArc(Chart, list[i - 1], list[i], pen); 116 visualArcMap[Tuple.Create(visualParent, visualNode)] = AddArc(Chart, visualParent, visualNode, pen); 133 117 } 134 118 } … … 156 140 var visualNodes = Chart.GetAllPrimitives(e.Location).Where(p => p is VisualGenealogyGraphNode).ToList(); 157 141 if (visualNodes.Count > 0) { 158 if ( _selectedGenealogyGraphNode == visualNodes[0]) return;159 _selectedGenealogyGraphNode = visualNodes[0] as VisualGenealogyGraphNode;160 if ( _selectedGenealogyGraphNode == null) return;142 if (selectedGenealogyGraphNode == visualNodes[0]) return; 143 selectedGenealogyGraphNode = visualNodes[0] as VisualGenealogyGraphNode; 144 if (selectedGenealogyGraphNode == null) return; 161 145 // new node has been selected, clean up 162 146 Chart.UpdateEnabled = false; … … 164 148 ClearAllNodes(); 165 149 // use a rectangle to highlight the currently selected genealogy graph node 166 var center = _selectedGenealogyGraphNode.Center;167 var size = _selectedGenealogyGraphNode.Size;150 var center = selectedGenealogyGraphNode.Center; 151 var size = selectedGenealogyGraphNode.Size; 168 152 double x1 = center.X - size.Width / 2; 169 153 double x2 = x1 + size.Width; 170 154 double y1 = center.Y - size.Height / 2; 171 155 double y2 = y1 + size.Height; 172 if ( _targetRectangle == null) {173 _targetRectangle = new Visualization.Rectangle(Chart, x1, y1, x2, y2, new Pen(Color.Black), null);174 Chart.Group.Add( _targetRectangle);156 if (targetRectangle == null) { 157 targetRectangle = new Visualization.Rectangle(Chart, x1, y1, x2, y2, new Pen(Color.Black), null); 158 Chart.Group.Add(targetRectangle); 175 159 } else { 176 _targetRectangle.SetPosition(x1, y1, x2, y2); 177 } 178 var gNode = _selectedGenealogyGraphNode.Data; // genealogy graph node (representing an individual in the population) 179 double rank = Graph[gNode].Ranks[0]; 160 targetRectangle.SetPosition(x1, y1, x2, y2); 161 } 162 var gNode = selectedGenealogyGraphNode.Data; // genealogy graph node (representing an individual in the population) 163 // double rank = Graph[gNode].Ranks[0]; 164 double rank = ((SymbolicExpressionGenealogyGraphNode)gNode).Ranks[0]; 180 165 // ancestors 181 var ancestors = gNode.Ancestors().Where(n => Graph[n].Ranks.Last() < rank).ToList();166 var ancestors = gNode.Ancestors().Where(n => ((SymbolicExpressionGenealogyGraphNode)n).Ranks.Last() < rank).ToList(); 182 167 ancestors.Add(gNode); 183 168 // descendants 184 var descendants = gNode.Descendants().Where(n => Graph[n].Ranks.Last() > rank).ToList();169 var descendants = gNode.Descendants().Where(n => ((SymbolicExpressionGenealogyGraphNode)n).Ranks.Last() > rank).ToList(); 185 170 descendants.Add(gNode); 186 171 // highlight ancestors 187 foreach (var node in ancestors.Select(n => _visualNodeMap[n][0])) {188 node.Brush = new SolidBrush( Graph[node.Data].GetColor());172 foreach (var node in ancestors.Select(n => visualNodeMap[n])) { 173 node.Brush = new SolidBrush(((SymbolicExpressionGenealogyGraphNode)node.Data).GetColor()); 189 174 if (node.IncomingArcs != null) 190 175 foreach (var arc in node.IncomingArcs) { 191 // check if, in case of elites, the target node is the first visual representation of the elite192 // (for purposes of display consistency)193 bool isFirst = arc.Source == _visualNodeMap[arc.Source.Data][0];194 if (arc.Source.Data == arc.Target.Data || !isFirst) continue;195 176 var start = new Point((int)arc.Start.X, (int)arc.Start.Y); 196 177 var end = new Point((int)arc.End.X, (int)arc.End.Y); 197 arc.Pen.Brush = new LinearGradientBrush(start, end, Graph[arc.Source.Data].GetColor(), Graph[arc.Target.Data].GetColor()); 178 var srcNode = arc.Source.Data as SymbolicExpressionGenealogyGraphNode; 179 var destNode = arc.Target.Data as SymbolicExpressionGenealogyGraphNode; 180 arc.Pen.Brush = new LinearGradientBrush(start, end, srcNode.GetColor(), destNode.GetColor()); 198 181 } 199 182 } 200 183 // highlight descendants 201 foreach (var node in descendants.Select(n => _visualNodeMap[n][0])) {202 node.Brush = new SolidBrush( Graph[node.Data].GetColor());184 foreach (var node in descendants.Select(n => visualNodeMap[n])) { 185 node.Brush = new SolidBrush((node.Data as SymbolicExpressionGenealogyGraphNode).GetColor()); 203 186 if (node.OutgoingArcs != null) 204 187 foreach (var arc in node.OutgoingArcs) { 205 // check if, in case of elites, the target node is the first visual representation of the elite206 // (for purposes of display consistency)207 bool isFirst = arc.Target == _visualNodeMap[arc.Target.Data][0];208 if (arc.Source.Data == arc.Target.Data || !isFirst) continue;209 188 var start = new Point((int)arc.Start.X, (int)arc.Start.Y); 210 189 var end = new Point((int)arc.End.X, (int)arc.End.Y); 211 arc.Pen.Brush = new LinearGradientBrush(start, end, Graph[arc.Source.Data].GetColor(), Graph[arc.Target.Data].GetColor()); 190 var srcNode = arc.Source.Data as SymbolicExpressionGenealogyGraphNode; 191 var destNode = arc.Target.Data as SymbolicExpressionGenealogyGraphNode; 192 arc.Pen.Brush = new LinearGradientBrush(start, end, srcNode.GetColor(), destNode.GetColor()); 212 193 } 213 194 } 214 195 } else { 215 _selectedGenealogyGraphNode = null;196 selectedGenealogyGraphNode = null; 216 197 } 217 198 // update 218 199 Chart.UpdateEnabled = true; 219 200 Chart.EnforceUpdate(); 220 if ( _selectedGenealogyGraphNode != null)201 if (selectedGenealogyGraphNode != null) 221 202 /* emit clicked event */ 222 OnGenealogyGraphNodeClicked( _selectedGenealogyGraphNode, e);203 OnGenealogyGraphNodeClicked(selectedGenealogyGraphNode, e); 223 204 } 224 205 } … … 226 207 public void ClearAllNodes() { 227 208 foreach (var primitive in Chart.Group.Primitives) { 228 primitive.Brush = null;229 209 if (primitive is VisualGenealogyGraphArc) { 230 210 var arc = primitive as VisualGenealogyGraphArc; 231 if (arc.Source.Data != arc.Target.Data && primitive.Pen.Brush != null) 211 var sourceData = (arc.Source.Data as SymbolicExpressionGenealogyGraphNode).SymbolicExpressionTree; 212 var targetData = (arc.Target.Data as SymbolicExpressionGenealogyGraphNode).SymbolicExpressionTree; 213 if (sourceData != targetData) { 232 214 primitive.Pen.Brush = new SolidBrush(Color.Transparent); 215 } else { 216 primitive.Pen.Brush = new SolidBrush(Color.LightGray); 217 } 218 } else { 219 primitive.Brush = null; 233 220 } 234 221 } … … 236 223 237 224 public void HighlightLineage(IEnumerable<GenealogyGraphNode> nodes) { 238 foreach (var node in nodes.Select Many(n => _visualNodeMap[n])) {239 node.Brush = new SolidBrush( Graph[node.Data].GetColor());240 if (node.IncomingArcs == null || node != _visualNodeMap[node.Data][0]) continue;225 foreach (var node in nodes.Select(n => visualNodeMap[n])) { 226 node.Brush = new SolidBrush((node.Data as SymbolicExpressionGenealogyGraphNode).GetColor()); 227 if (node.IncomingArcs == null || node != visualNodeMap[node.Data]) continue; 241 228 foreach (var arc in node.IncomingArcs) { 242 229 if (arc.Source.Data == node.Data) continue; 243 230 var start = new Point((int)arc.Start.X, (int)arc.Start.Y); 244 231 var end = new Point((int)arc.End.X, (int)arc.End.Y); 245 arc.Pen.Brush = new LinearGradientBrush(start, end, Graph[arc.Source.Data].GetColor(), Graph[arc.Target.Data].GetColor()); 246 } 247 } 248 } 249 232 var srcNode = arc.Source.Data as SymbolicExpressionGenealogyGraphNode; 233 var destNode = arc.Target.Data as SymbolicExpressionGenealogyGraphNode; 234 arc.Pen.Brush = new LinearGradientBrush(start, end, srcNode.GetColor(), destNode.GetColor()); 235 } 236 } 237 } 238 239 // TODO: optimize and reduce complexity of this method 250 240 public void HighlightNodes(IEnumerable<ISymbolicExpressionTree> trees, Color color) { 251 foreach (var visualNode in trees.Select(tree => _visualNodeMap[Graph.GetNode(tree)]).SelectMany(vList => vList)) 252 visualNode.Brush = new SolidBrush(color); 241 foreach (var tree in trees) 242 foreach (var graphNode in Graph.Nodes) { 243 if (graphNode.SymbolicExpressionTree == tree) { 244 var visualNode = visualNodeMap[graphNode]; 245 visualNode.Brush = new SolidBrush(color); 246 } 247 } 248 } 249 250 public void HighlightNode(SymbolicExpressionGenealogyGraphNode graphNode, Color color) { 251 visualNodeMap[graphNode].Brush = new SolidBrush(color); 253 252 } 254 253 … … 256 255 Chart.UpdateEnabled = false; 257 256 ClearAllNodes(); 258 var graphNodes = Graph.Values.ToList(); 259 double min = graphNodes.Min(x => x.InEdges == null ? 0 : x.InEdges.Count); 260 double max = graphNodes.Max(x => x.InEdges == null ? 0 : x.InEdges.Count); 261 foreach (var graphNode in graphNodes) { 262 var visualNode = _visualNodeMap[graphNode][0]; 257 double max = Graph.Nodes.Max(x => x.InEdges == null ? 0 : x.InEdges.Count); 258 foreach (var graphNode in Graph.Nodes) { 259 var visualNode = visualNodeMap[graphNode]; 263 260 double deg = graphNode.InEdges == null ? 0 : graphNode.InEdges.Count; 264 var color = Color.FromArgb((int)(1 - deg / max) * 255, (int)(deg / max * 255), 100); 261 int index = (int)(deg / max * ColorGradient.Colors.Count); 262 if (index == ColorGradient.Colors.Count) --index; 263 var color = ColorGradient.Colors[index]; 265 264 visualNode.Brush = new SolidBrush(color); 266 265 } … … 272 271 Chart.UpdateEnabled = false; 273 272 ClearAllNodes(); 274 var graphNodes = Graph.Values.ToList(); 275 double min = graphNodes.Min(x => x.OutEdges == null ? 0 : x.OutEdges.Count); 273 var graphNodes = Graph.Nodes; 276 274 double max = graphNodes.Max(x => x.OutEdges == null ? 0 : x.OutEdges.Count); 277 275 foreach (var graphNode in graphNodes) { 278 var visualNode = _visualNodeMap[graphNode][0];276 var visualNode = visualNodeMap[graphNode]; 279 277 double deg = graphNode.OutEdges == null ? 0 : graphNode.OutEdges.Count; 280 int index = (int)(deg / max * ColorGradient.Colors.Count) - 1; 281 if (index < 0) index = 0; 282 visualNode.Brush = new SolidBrush(ColorGradient.Colors[index]); 278 int index = (int)(deg / max * ColorGradient.Colors.Count); 279 if (index == ColorGradient.Colors.Count) --index; 280 var color = ColorGradient.Colors[index]; 281 visualNode.Brush = new SolidBrush(color); 283 282 } 284 283 Chart.UpdateEnabled = true; … … 288 287 289 288 internal static class Util { 290 public static Color GetColor(this NodeMetadata nm) {291 var colorIndex = (int)(n m.Quality * ColorGradient.Colors.Count);289 public static Color GetColor(this SymbolicExpressionGenealogyGraphNode node) { 290 var colorIndex = (int)(node.Quality * ColorGradient.Colors.Count); 292 291 if (colorIndex >= ColorGradient.Colors.Count) --colorIndex; 293 292 return ColorGradient.Colors[colorIndex]; -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.Designer.cs
r8213 r8556 28 28 this.splitContainer = new System.Windows.Forms.SplitContainer(); 29 29 this.genealogyTableLayout = new System.Windows.Forms.TableLayoutPanel(); 30 this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart(); 31 this.topControlBox = new System.Windows.Forms.GroupBox(); 30 32 this.graphControlsPanel = new System.Windows.Forms.Panel(); 33 this.similarityModeLabel = new System.Windows.Forms.Label(); 34 this.similarityModeSelector = new System.Windows.Forms.ComboBox(); 31 35 this.selectModeButton = new System.Windows.Forms.RadioButton(); 32 36 this.moveModeButton = new System.Windows.Forms.RadioButton(); 33 37 this.zoomModeButton = new System.Windows.Forms.RadioButton(); 34 this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();35 this.topControlBox = new System.Windows.Forms.GroupBox();36 this.similarityModeLabel = new System.Windows.Forms.Label();37 this.similarityModeSelector = new System.Windows.Forms.ComboBox();38 38 this.genealogyGraphChart = new HeuristicLab.EvolutionaryTracking.Views.GenealogyGraphChart(); 39 this.inDegreeButton = new System.Windows.Forms.Button();40 this.outDegreeButton = new System.Windows.Forms.Button();41 39 this.mainTableLayout.SuspendLayout(); 42 40 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); … … 45 43 this.splitContainer.SuspendLayout(); 46 44 this.genealogyTableLayout.SuspendLayout(); 45 this.topControlBox.SuspendLayout(); 47 46 this.graphControlsPanel.SuspendLayout(); 48 this.topControlBox.SuspendLayout();49 47 this.SuspendLayout(); 50 48 // … … 62 60 this.mainTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 63 61 this.mainTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 64 this.mainTableLayout.Size = new System.Drawing.Size( 528, 443);62 this.mainTableLayout.Size = new System.Drawing.Size(787, 584); 65 63 this.mainTableLayout.TabIndex = 6; 66 64 // … … 81 79 this.splitContainer.Panel2.Controls.Add(this.symbolicExpressionTreeChart); 82 80 this.splitContainer.Panel2MinSize = 50; 83 this.splitContainer.Size = new System.Drawing.Size( 522, 387);84 this.splitContainer.SplitterDistance = 241;81 this.splitContainer.Size = new System.Drawing.Size(781, 528); 82 this.splitContainer.SplitterDistance = 360; 85 83 this.splitContainer.TabIndex = 7; 86 84 // … … 90 88 this.genealogyTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 91 89 this.genealogyTableLayout.Controls.Add(this.genealogyGraphChart, 0, 1); 92 this.genealogyTableLayout.Controls.Add(this.graphControlsPanel, 0, 0);93 90 this.genealogyTableLayout.Dock = System.Windows.Forms.DockStyle.Fill; 94 91 this.genealogyTableLayout.Location = new System.Drawing.Point(0, 0); … … 97 94 this.genealogyTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); 98 95 this.genealogyTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 99 this.genealogyTableLayout.Size = new System.Drawing.Size( 239, 385);96 this.genealogyTableLayout.Size = new System.Drawing.Size(358, 526); 100 97 this.genealogyTableLayout.TabIndex = 4; 101 //102 // graphControlsPanel103 //104 this.graphControlsPanel.Controls.Add(this.outDegreeButton);105 this.graphControlsPanel.Controls.Add(this.inDegreeButton);106 this.graphControlsPanel.Controls.Add(this.selectModeButton);107 this.graphControlsPanel.Controls.Add(this.moveModeButton);108 this.graphControlsPanel.Controls.Add(this.zoomModeButton);109 this.graphControlsPanel.Location = new System.Drawing.Point(3, 3);110 this.graphControlsPanel.Name = "graphControlsPanel";111 this.graphControlsPanel.Size = new System.Drawing.Size(194, 30);112 this.graphControlsPanel.TabIndex = 0;113 //114 // selectModeButton115 //116 this.selectModeButton.Appearance = System.Windows.Forms.Appearance.Button;117 this.selectModeButton.AutoSize = true;118 this.selectModeButton.Location = new System.Drawing.Point(65, 3);119 this.selectModeButton.Name = "selectModeButton";120 this.selectModeButton.Size = new System.Drawing.Size(24, 23);121 this.selectModeButton.TabIndex = 5;122 this.selectModeButton.TabStop = true;123 this.selectModeButton.Text = "S";124 this.selectModeButton.UseVisualStyleBackColor = true;125 this.selectModeButton.CheckedChanged += new System.EventHandler(this.selectModeButton_CheckedChanged);126 //127 // moveModeButton128 //129 this.moveModeButton.Appearance = System.Windows.Forms.Appearance.Button;130 this.moveModeButton.AutoSize = true;131 this.moveModeButton.Location = new System.Drawing.Point(3, 3);132 this.moveModeButton.Name = "moveModeButton";133 this.moveModeButton.Size = new System.Drawing.Size(26, 23);134 this.moveModeButton.TabIndex = 3;135 this.moveModeButton.TabStop = true;136 this.moveModeButton.Text = "M";137 this.moveModeButton.UseVisualStyleBackColor = true;138 this.moveModeButton.CheckedChanged += new System.EventHandler(this.moveModeButton_CheckedChanged);139 //140 // zoomModeButton141 //142 this.zoomModeButton.Appearance = System.Windows.Forms.Appearance.Button;143 this.zoomModeButton.AutoSize = true;144 this.zoomModeButton.Location = new System.Drawing.Point(35, 3);145 this.zoomModeButton.Name = "zoomModeButton";146 this.zoomModeButton.Size = new System.Drawing.Size(24, 23);147 this.zoomModeButton.TabIndex = 4;148 this.zoomModeButton.TabStop = true;149 this.zoomModeButton.Text = "Z";150 this.zoomModeButton.UseVisualStyleBackColor = true;151 this.zoomModeButton.CheckedChanged += new System.EventHandler(this.zoomModeButton_CheckedChanged);152 98 // 153 99 // symbolicExpressionTreeChart … … 158 104 this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0); 159 105 this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart"; 160 this.symbolicExpressionTreeChart.Size = new System.Drawing.Size( 275, 385);106 this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(415, 526); 161 107 this.symbolicExpressionTreeChart.Spacing = 5; 162 108 this.symbolicExpressionTreeChart.SuspendRepaint = false; … … 167 113 // topControlBox 168 114 // 115 this.topControlBox.Controls.Add(this.graphControlsPanel); 169 116 this.topControlBox.Controls.Add(this.similarityModeLabel); 170 117 this.topControlBox.Controls.Add(this.similarityModeSelector); … … 172 119 this.topControlBox.Location = new System.Drawing.Point(3, 3); 173 120 this.topControlBox.Name = "topControlBox"; 174 this.topControlBox.Size = new System.Drawing.Size( 522, 44);121 this.topControlBox.Size = new System.Drawing.Size(781, 44); 175 122 this.topControlBox.TabIndex = 6; 176 123 this.topControlBox.TabStop = false; 177 124 this.topControlBox.Text = "Controls"; 125 // 126 // graphControlsPanel 127 // 128 this.graphControlsPanel.Controls.Add(this.selectModeButton); 129 this.graphControlsPanel.Controls.Add(this.moveModeButton); 130 this.graphControlsPanel.Controls.Add(this.zoomModeButton); 131 this.graphControlsPanel.Location = new System.Drawing.Point(246, 14); 132 this.graphControlsPanel.Name = "graphControlsPanel"; 133 this.graphControlsPanel.Size = new System.Drawing.Size(93, 30); 134 this.graphControlsPanel.TabIndex = 2; 178 135 // 179 136 // similarityModeLabel … … 199 156 this.similarityModeSelector.SelectedIndexChanged += new System.EventHandler(this.similarityModeSelector_SelectedIndexChanged); 200 157 // 158 // selectModeButton 159 // 160 this.selectModeButton.Appearance = System.Windows.Forms.Appearance.Button; 161 this.selectModeButton.Location = new System.Drawing.Point(63, 3); 162 this.selectModeButton.Name = "selectModeButton"; 163 this.selectModeButton.Size = new System.Drawing.Size(24, 24); 164 this.selectModeButton.TabIndex = 11; 165 this.selectModeButton.TabStop = true; 166 this.selectModeButton.UseVisualStyleBackColor = true; 167 this.selectModeButton.CheckedChanged += new System.EventHandler(this.selectModeButton_CheckedChanged); 168 // 169 // moveModeButton 170 // 171 this.moveModeButton.Appearance = System.Windows.Forms.Appearance.Button; 172 this.moveModeButton.Location = new System.Drawing.Point(3, 3); 173 this.moveModeButton.Name = "moveModeButton"; 174 this.moveModeButton.Size = new System.Drawing.Size(24, 24); 175 this.moveModeButton.TabIndex = 9; 176 this.moveModeButton.TabStop = true; 177 this.moveModeButton.UseVisualStyleBackColor = true; 178 this.moveModeButton.CheckedChanged += new System.EventHandler(this.moveModeButton_CheckedChanged); 179 // 180 // zoomModeButton 181 // 182 this.zoomModeButton.Appearance = System.Windows.Forms.Appearance.Button; 183 this.zoomModeButton.Location = new System.Drawing.Point(33, 3); 184 this.zoomModeButton.Name = "zoomModeButton"; 185 this.zoomModeButton.Size = new System.Drawing.Size(24, 24); 186 this.zoomModeButton.TabIndex = 10; 187 this.zoomModeButton.TabStop = true; 188 this.zoomModeButton.UseVisualStyleBackColor = true; 189 this.zoomModeButton.CheckedChanged += new System.EventHandler(this.zoomModeButton_CheckedChanged); 190 // 201 191 // genealogyGraphChart 202 192 // 203 193 this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control; 204 194 this.genealogyGraphChart.Dock = System.Windows.Forms.DockStyle.Fill; 205 this.genealogyGraphChart.Location = new System.Drawing.Point(3, 3 9);195 this.genealogyGraphChart.Location = new System.Drawing.Point(3, 3); 206 196 this.genealogyGraphChart.Name = "genealogyGraphChart"; 207 197 this.genealogyGraphChart.ScaleOnResize = true; 208 this.genealogyGraphChart.Size = new System.Drawing.Size( 233, 343);198 this.genealogyGraphChart.Size = new System.Drawing.Size(352, 520); 209 199 this.genealogyGraphChart.TabIndex = 2; 210 //211 // inDegreeButton212 //213 this.inDegreeButton.AutoSize = true;214 this.inDegreeButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;215 this.inDegreeButton.Location = new System.Drawing.Point(95, 3);216 this.inDegreeButton.Name = "inDegreeButton";217 this.inDegreeButton.Size = new System.Drawing.Size(28, 23);218 this.inDegreeButton.TabIndex = 6;219 this.inDegreeButton.Text = "IN";220 this.inDegreeButton.UseVisualStyleBackColor = true;221 this.inDegreeButton.Click += new System.EventHandler(this.inDegreeButton_Click);222 //223 // outDegreeButton224 //225 this.outDegreeButton.AutoSize = true;226 this.outDegreeButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;227 this.outDegreeButton.Location = new System.Drawing.Point(129, 3);228 this.outDegreeButton.Name = "outDegreeButton";229 this.outDegreeButton.Size = new System.Drawing.Size(40, 23);230 this.outDegreeButton.TabIndex = 7;231 this.outDegreeButton.Text = "OUT";232 this.outDegreeButton.UseVisualStyleBackColor = true;233 this.outDegreeButton.Click += new System.EventHandler(this.outDegreeButton_Click);234 200 // 235 201 // GenealogyGraphView … … 239 205 this.Controls.Add(this.mainTableLayout); 240 206 this.Name = "GenealogyGraphView"; 241 this.Size = new System.Drawing.Size( 528, 443);207 this.Size = new System.Drawing.Size(787, 584); 242 208 this.mainTableLayout.ResumeLayout(false); 243 209 this.splitContainer.Panel1.ResumeLayout(false); … … 246 212 this.splitContainer.ResumeLayout(false); 247 213 this.genealogyTableLayout.ResumeLayout(false); 248 this.graphControlsPanel.ResumeLayout(false);249 this.graphControlsPanel.PerformLayout();250 214 this.topControlBox.ResumeLayout(false); 251 215 this.topControlBox.PerformLayout(); 216 this.graphControlsPanel.ResumeLayout(false); 252 217 this.ResumeLayout(false); 253 218 … … 268 233 private System.Windows.Forms.RadioButton moveModeButton; 269 234 private System.Windows.Forms.RadioButton zoomModeButton; 270 private System.Windows.Forms.Button inDegreeButton;271 private System.Windows.Forms.Button outDegreeButton;272 235 273 236 } -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/GenealogyGraphView.cs
r8248 r8556 36 36 [Content(typeof(SymbolicExpressionTreeGenealogyGraph), IsDefaultView = true)] 37 37 public sealed partial class GenealogyGraphView : ItemView { 38 private VisualSymbolicExpressionTreeNode _selectedVisualSymbolicExpressionTreeNode; 39 38 private VisualSymbolicExpressionTreeNode selectedVisualSymbExprTreeNode; 40 39 public new SymbolicExpressionTreeGenealogyGraph Content { 41 40 get { return (SymbolicExpressionTreeGenealogyGraph)base.Content; } … … 43 42 } 44 43 44 private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> clonedNodeMap; 45 45 46 public GenealogyGraphView() 46 47 : base() { 47 48 InitializeComponent(); 49 // set button icons here because if set in the designer file, they get overwritten 50 this.moveModeButton.Image = Common.Resources.VSImageLibrary.Pointer; 51 this.zoomModeButton.Image = Common.Resources.VSImageLibrary.Zoom; 52 this.selectModeButton.Image = Common.Resources.VSImageLibrary.Object; 53 54 48 55 similarityModeSelector.SelectedIndex = 0; // set default similarity mode to "exact" 49 56 } … … 61 68 genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked; 62 69 symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionTreeNodeClicked; 70 symbolicExpressionTreeChart.SymbolicExpressionTreeNodeDoubleClicked += treeChart_SymbolicExpressionTreeNodeDoubleClicked; 63 71 } 64 72 … … 71 79 else { 72 80 genealogyGraphChart.Graph = Content; 73 var best = Content. Values.OrderByDescending(x => genealogyGraphChart.Graph[x].Quality).First();74 symbolicExpressionTreeChart.Tree = (ISymbolicExpressionTree)best.Data;81 var best = Content.Nodes.OrderByDescending(x => x.Quality).First(); 82 symbolicExpressionTreeChart.Tree = best.SymbolicExpressionTree; 75 83 } 76 84 } … … 91 99 // the type hierarchy goes like this: VisualGenealogyGraphNode --> GenealogyGraphNode --> symbolicExpressionTree 92 100 var visualGenealogyGraphNode = (VisualGenealogyGraphNode)sender; 93 var genealogyGraphNode = ( GenealogyGraphNode)visualGenealogyGraphNode.Data;94 symbolicExpressionTreeChart.Tree = (ISymbolicExpressionTree)genealogyGraphNode.Data;101 var genealogyGraphNode = (SymbolicExpressionGenealogyGraphNode)visualGenealogyGraphNode.Data; 102 symbolicExpressionTreeChart.Tree = genealogyGraphNode.SymbolicExpressionTree; 95 103 // highlight the relevant fragment in the symbolic expression tree 96 if (_selectedVisualSymbolicExpressionTreeNode != null) { 104 selectedVisualSymbExprTreeNode = null; 105 106 bool repaint = false; 107 108 // paint highlighted nodes in symbolic expression tree 109 if (selectedVisualSymbExprTreeNode != null) { 110 // clear selected subtree from the tree chart 97 111 var nodes = symbolicExpressionTreeChart.Tree.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>; 98 var fragments = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>; 99 int index = SymbolicExpressionTreeMatching.FindMatch(nodes, fragments, similarityModeSelector.SelectedIndex); 112 var fragments = selectedVisualSymbExprTreeNode.SymbolicExpressionTreeNode.IterateNodesBreadth() as List<ISymbolicExpressionTreeNode>; 113 var similarityLevel = Enum.GetNames(typeof(SimilarityLevel))[similarityModeSelector.SelectedIndex]; 114 int index = SymbolicExpressionTreeMatching.FindMatch(nodes, fragments, (SimilarityLevel)Enum.Parse(typeof(SimilarityLevel), similarityLevel)); 100 115 if (index != -1) { 101 _selectedVisualSymbolicExpressionTreeNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(nodes[index]); 102 var subtree = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode; 103 foreach (var visualNode in subtree.IterateNodesBreadth().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node))) { 104 visualNode.FillColor = Color.LightBlue; 105 } 106 symbolicExpressionTreeChart.Repaint(); 116 selectedVisualSymbExprTreeNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(nodes[index]); 117 var subtree = selectedVisualSymbExprTreeNode.SymbolicExpressionTreeNode; 118 foreach (var node in subtree.IterateNodesBreadth()) { 119 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 120 visualNode.LineColor = Color.Blue; 121 } 122 repaint = true; 107 123 } 108 124 } 125 // paint graph nodes 109 126 var tree = symbolicExpressionTreeChart.Tree; 110 var graphNode = Content.GetNode(tree); 111 if (graphNode.InEdges != null) { 112 var arc = graphNode.InEdges.Find(a => a.Data != null); 113 if (arc != null) { 114 var fragment = arc.Data as ISymbolicExpressionTreeNode; 115 foreach (var node in fragment.IterateNodesBreadth()) { 116 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 117 if (visualNode == null) 118 continue; 119 visualNode.FillColor = Color.LightGreen; 120 } 121 symbolicExpressionTreeChart.Repaint(); 122 } 123 } 127 var graphNodes = Content.Nodes.Where(n => n.SymbolicExpressionTree == tree).ToList(); 128 if (graphNodes.Count > 0) { 129 foreach (var graphNode in graphNodes) 130 if (graphNode != null && graphNode.InEdges != null) { 131 var arc = graphNode.InEdges.Find(a => a.Data != null); 132 if (arc != null) { 133 var fragment = arc.Data as ISymbolicExpressionTreeNode; 134 foreach (var node in fragment.IterateNodesBreadth()) { 135 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 136 if (visualNode == null) 137 continue; 138 visualNode.LineColor = Color.Orange; 139 } 140 } 141 repaint = true; 142 } 143 } 144 if (repaint) 145 symbolicExpressionTreeChart.Repaint(); 124 146 } 125 147 … … 140 162 141 163 private void treeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) { 142 _selectedVisualSymbolicExpressionTreeNode = (VisualSymbolicExpressionTreeNode)sender; 143 // find out which individuals in the genealogy graph contain this specific subtree 144 var treeNode = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode; 164 ISymbolicExpressionTreeNode selectedSubtree = null; 165 genealogyGraphChart.Chart.UpdateEnabled = false; 166 switch (e.Button) { 167 case MouseButtons.Left: { 168 selectedVisualSymbExprTreeNode = (VisualSymbolicExpressionTreeNode)sender; 169 if (selectedVisualSymbExprTreeNode == null) return; 170 // find out which individuals in the genealogy graph contain this specific subtree 171 selectedSubtree = selectedVisualSymbExprTreeNode.SymbolicExpressionTreeNode; 172 // clone every node in the selected subtree so that edit operations are possible without altering the original subtree 173 // save the originalNode-->clone mapping to make it easier to work with subtrees 174 if (clonedNodeMap == null) 175 clonedNodeMap = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 176 clonedNodeMap.Clear(); 177 var selectedSubtreeClone = selectedSubtree.Clone() as SymbolicExpressionTreeNode; 178 var subtreeNodes = selectedSubtree.IterateNodesPostfix().ToList(); 179 var cloneNodes = selectedSubtreeClone.IterateNodesPostfix().ToList(); 180 for (int i = 0; i != subtreeNodes.Count; ++i) 181 clonedNodeMap.Add(subtreeNodes[i], cloneNodes[i]); 182 // highlight subtree nodes in the tree chart 183 foreach (var node in symbolicExpressionTreeChart.Tree.IterateNodesPostfix()) { 184 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 185 visualNode.FillColor = Color.Transparent; 186 } 187 selectedSubtree.ForEachNodePostfix(node => { 188 symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node).FillColor = Color.LightBlue; 189 }); 190 } 191 break; 192 case MouseButtons.Middle: { 193 var visualNode = (VisualSymbolicExpressionTreeNode)sender; 194 if (selectedVisualSymbExprTreeNode == null || selectedVisualSymbExprTreeNode == visualNode) 195 return; 196 selectedSubtree = clonedNodeMap[selectedVisualSymbExprTreeNode.SymbolicExpressionTreeNode]; 197 var selectedNode = visualNode.SymbolicExpressionTreeNode; 198 if (clonedNodeMap.ContainsKey(selectedNode)) { 199 var selected = clonedNodeMap[selectedNode]; 200 var parent = selected.Parent; 201 parent.RemoveSubtree(parent.IndexOfSubtree(selected)); 202 selectedNode.ForEachNodePostfix(node => { 203 symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node).FillColor = Color.Transparent; 204 clonedNodeMap.Remove(node); 205 }); 206 } 207 } 208 break; 209 } 210 // update visual graph nodes that contain matching trees 145 211 Color[] colors = { Color.LightSkyBlue, Color.PaleGreen, Color.Tan }; 146 // update visual graph nodes147 genealogyGraphChart.Chart.UpdateEnabled = false;148 212 genealogyGraphChart.ClearAllNodes(); // clear node colors 149 // color each graph node according to the degree to which it matches the selected tree fragment 150 foreach (var i in Enum.GetValues(typeof(SymbolicExpressionTreeMatching.SimilarityLevel)).Cast<int>().Reverse()) { 151 var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, i).ToList(); 152 if (owners.Any()) genealogyGraphChart.HighlightNodes(owners, colors[i]); // highlight matching individuals from the genealogy 213 // color each graph node according to the degree to which it matches the selected tree fragment 214 var similarityValues = Enum.GetValues(typeof(SimilarityLevel)).Cast<SimilarityLevel>().ToList(); 215 foreach (var graphNode in genealogyGraphChart.Graph.Nodes) { 216 var tree = graphNode.SymbolicExpressionTree; 217 for (int i = 0; i != similarityValues.Count; ++i) { 218 if (tree.ContainsFragment(selectedSubtree, similarityValues[i])) { 219 genealogyGraphChart.HighlightNode(graphNode, colors[i]); 220 break; 221 } 222 } 153 223 } 154 224 genealogyGraphChart.Chart.UpdateEnabled = true; 155 225 genealogyGraphChart.Chart.EnforceUpdate(); 156 157 // highlight subtree nodes in the tree chart158 foreach (var visualNode in symbolicExpressionTreeChart.Tree.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))159 visualNode.FillColor = Color.Transparent;160 161 foreach (var visualNode in treeNode.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node)))162 visualNode.FillColor = Color.LightBlue;163 164 226 // refresh the tree chart 165 227 symbolicExpressionTreeChart.Repaint(); 166 228 } 167 229 230 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) { 231 } 232 168 233 private void similarityModeSelector_SelectedIndexChanged(object sender, EventArgs e) { 169 if (_selectedVisualSymbolicExpressionTreeNode == null) return; 170 var treeNode = _selectedVisualSymbolicExpressionTreeNode.SymbolicExpressionTreeNode; 171 var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, similarityModeSelector.SelectedIndex).ToList(); 234 if (selectedVisualSymbExprTreeNode == null) return; 235 var treeNode = selectedVisualSymbExprTreeNode.SymbolicExpressionTreeNode; 236 var similarityLevel = Enum.GetNames(typeof(SimilarityLevel))[similarityModeSelector.SelectedIndex]; 237 var owners = genealogyGraphChart.Graph.TraceFragment(treeNode, (SimilarityLevel)Enum.Parse(typeof(SimilarityLevel), similarityLevel)).ToList(); 172 238 if (owners.Any()) { 173 239 genealogyGraphChart.Chart.UpdateEnabled = false; 174 240 genealogyGraphChart.ClearAllNodes(); // clear the fill color of all nodes 175 genealogyGraphChart.HighlightNodes(owners, Color.LightSkyBlue); // highlight matching individuals from the genealogy 241 genealogyGraphChart.HighlightNodes(owners, Color.LightSkyBlue); 242 // highlight matching individuals from the genealogy 176 243 genealogyGraphChart.Chart.UpdateEnabled = true; 177 244 } 178 245 genealogyGraphChart.Chart.EnforceUpdate(); 179 246 // highlight subtree nodes in the tree chart 180 foreach (var visualNode in symbolicExpressionTreeChart.Tree.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node))) 247 foreach (var node in symbolicExpressionTreeChart.Tree.IterateNodesPostfix()) { 248 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 181 249 visualNode.FillColor = Color.Transparent; 182 foreach (var visualNode in treeNode.IterateNodesPostfix().Select(node => symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node))) 250 } 251 foreach (var node in treeNode.IterateNodesPostfix()) { 252 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 183 253 visualNode.FillColor = Color.LightBlue; 254 } 184 255 } 185 256 #endregion -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/HeuristicLab.EvolutionaryTracking.Views-3.4.csproj
r8213 r8556 41 41 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 42 42 </Reference> 43 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 43 44 <Reference Include="HeuristicLab.Core-3.3"> 44 45 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.EvolutionaryTracking.Views/3.4/VisualGenealogyGraphNode.cs
r8248 r8556 27 27 namespace HeuristicLab.EvolutionaryTracking.Views { 28 28 public class VisualGenealogyGraphNode : Ellipse { 29 public GenealogyGraphNode Data { get; internal set; }29 public IGenealogyGraphNode Data { get; internal set; } 30 30 private List<VisualGenealogyGraphArc> _incomingArcs = new List<VisualGenealogyGraphArc>(); 31 31 private List<VisualGenealogyGraphArc> _outgoingArgs = new List<VisualGenealogyGraphArc>(); … … 74 74 get { return new PointD((LowerLeft.X + UpperRight.X) / 2, (LowerLeft.Y + UpperRight.Y) / 2); } 75 75 } 76 77 public override void Draw(Graphics graphics) { 78 Point p = Chart.TransformWorldToPixel(new PointD(LowerLeft.X, LowerLeft.Y + Size.Height)); 79 Size s = Chart.TransformWorldToPixel(Size); 80 if (Brush != null) 81 graphics.FillEllipse(Brush, p.X, p.Y, s.Width, s.Height); 82 graphics.DrawEllipse(Pen, p.X, p.Y, s.Width, s.Height); 83 if (((SymbolicExpressionGenealogyGraphNode)Data).IsElite) { 84 graphics.DrawEllipse(Pen, p.X + 2, p.Y + 2, s.Width - 4, s.Height - 4); 85 } 86 } 76 87 } 77 88 }
Note: See TracChangeset
for help on using the changeset viewer.