Changeset 11852 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
- Timestamp:
- 02/01/15 23:17:56 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r11817 r11852 40 40 private readonly Pen defaultPen; 41 41 42 private Dictionary<IGenealogyGraphNode, VisualGenealogyGraphNode> nodeMap; 43 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap; 44 42 45 public IGenealogyGraph GenealogyGraph { 43 46 get { return genealogyGraph; } … … 63 66 } 64 67 65 private Dictionary<IGenealogyGraphNode, VisualGenealogyGraphNode> nodeMap; 66 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap; 68 public bool UpdateEnabled { 69 get { return Chart.UpdateEnabled; } 70 set { Chart.UpdateEnabled = value; } 71 } 72 73 public void EnforceUpdate() { 74 Chart.EnforceUpdate(); 75 } 67 76 68 77 #region chart modes … … 225 234 226 235 // update 227 Chart.UpdateEnabled = true;228 Chart.EnforceUpdate();236 UpdateEnabled = true; 237 EnforceUpdate(); 229 238 230 239 if (SelectedVisualNode != null) 231 /* emit clicked event */ 232 OnGenealogyGraphNodeClicked(SelectedVisualNode, e); 240 OnGenealogyGraphNodeClicked(SelectedVisualNode, e); // emit clicked event 233 241 234 242 base.pictureBox_MouseUp(sender, e); … … 306 314 } 307 315 316 public void ClearArcs() { 317 foreach (var primitive in Chart.Group.Primitives.OfType<VisualGenealogyGraphArc>()) { 318 primitive.Pen = Pens.Transparent; 319 } 320 } 321 322 public void ClearNodes() { 323 foreach (var primitive in Chart.Group.Primitives.OfType<VisualGenealogyGraphNode>()) { 324 primitive.Brush = new SolidBrush(Color.Transparent); 325 primitive.Pen = new Pen(Color.LightGray); 326 } 327 } 328 308 329 public virtual void ClearPrimitives() { 309 330 foreach (var primitive in Chart.Group.Primitives) { … … 313 334 primitive.Brush = new SolidBrush(Color.Transparent); 314 335 primitive.Pen = new Pen(Color.DarkGray); 315 } 316 } 317 } 318 319 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes) { 320 Chart.UpdateEnabled = false; 321 ClearPrimitives(); 336 // primitive.Pen = Pens.Transparent; // remove the node contour 337 } 338 } 339 } 340 341 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes, bool clearPrimitives = true) { 342 if (clearPrimitives) 343 ClearPrimitives(); 344 322 345 foreach (var node in nodes) { 323 346 var graphNode = GetMappedNode(node); 324 347 graphNode.Brush = new SolidBrush(node.GetColor()); 325 348 } 326 Chart.UpdateEnabled = true; 327 Chart.EnforceUpdate(); 349 } 350 351 public void HighlightNodes(IEnumerable<IGenealogyGraphNode> nodes, Color color, bool clearPrimitives = true) { 352 if (clearPrimitives) 353 ClearPrimitives(); 354 355 foreach (var node in nodes.Select(GetMappedNode)) { 356 node.Brush = new SolidBrush(color); 357 } 328 358 } 329 359 330 360 public void HighlightAll() { 331 Chart.UpdateEnabled = false;332 361 foreach (var visualNode in nodeMap.Values) { 333 362 visualNode.Brush = new SolidBrush(visualNode.Data.GetColor()); … … 340 369 arc.Pen.Brush = new LinearGradientBrush(start, end, source.GetColor(), target.GetColor()); 341 370 } 342 Chart.UpdateEnabled = true;343 Chart.EnforceUpdate();344 371 } 345 372
Note: See TracChangeset
for help on using the changeset viewer.