- Timestamp:
- 02/04/15 00:43:44 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r11864 r11881 43 43 private Dictionary<Tuple<VisualGenealogyGraphNode, VisualGenealogyGraphNode>, VisualGenealogyGraphArc> arcMap; 44 44 45 #region chart modes 46 public bool SimpleLineages { get; set; } 47 public bool LockGenealogy { get; set; } 48 public bool TraceFragments { get; set; } 49 #endregion 50 51 private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished 52 45 53 public IGenealogyGraph GenealogyGraph { 46 54 get { return genealogyGraph; } … … 79 87 } 80 88 81 #region chart modes82 public bool SimpleLineages { get; set; }83 public bool LockGenealogy { get; set; }84 public bool TraceFragments { get; set; }85 #endregion86 87 89 private Visualization.Rectangle TargetRectangle { get; set; } 88 private bool DrawInProgress { get; set; } // do not try to update the chart while the drawing is not finished89 90 protected VisualGenealogyGraphNode SelectedVisualNode { get; set; } 90 91 … … 163 164 } 164 165 } 165 // TODO: connect elites166 166 167 167 Chart.UpdateEnabled = true; … … 200 200 base.pictureBox_MouseMove(sender, e); 201 201 } 202 202 203 protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) { 203 204 Cursor = Cursors.Default; … … 252 253 #endregion 253 254 255 #region drawing routines 254 256 private static void DrawLineage(VisualGenealogyGraphNode node, Func<VisualGenealogyGraphNode, IEnumerable<VisualGenealogyGraphArc>> arcSelector, Func<VisualGenealogyGraphArc, VisualGenealogyGraphNode> nodeSelector) { 255 257 var brush = (SolidBrush)node.Brush; … … 269 271 } 270 272 271 public void HighlightHotPaths() {272 Chart.UpdateEnabled = false;273 ClearPrimitives();274 var arcs = GenealogyGraph.Vertices.SelectMany(n => n.InArcs).ToList();275 foreach (var arc in arcs) { arc.Weight = 1.0; } // reset weights276 var rank = GenealogyGraph.Ranks.Max(x => x.Key);277 foreach (var graphNode in GenealogyGraph.GetByRank(rank)) {278 foreach (var ancestor in graphNode.Ancestors) {279 foreach (var arc in ancestor.InArcs) {280 arc.Weight++;281 }282 }283 }284 double max = arcs.Max(a => a.Weight);285 double min = arcs.Min(a => a.Weight);286 287 if (min.IsAlmost(max)) return;288 //translate interval (min,max) to interval (0,255)289 foreach (var arc in arcs) {290 var vArc = GetMappedArc(arc.Source, arc.Target);291 int colorIndex = (int)Math.Round((arc.Weight - min) * 255 / (max - min));292 if (colorIndex > 254) colorIndex = 254;293 vArc.Pen = new Pen(ColorGradient.Colors[colorIndex]);294 // vArc.Pen.Brush = new SolidBrush(ColorGradient.Colors[colorIndex]);295 }296 Chart.UpdateEnabled = true;297 Chart.EnforceUpdate();298 }299 300 273 void MarkSelectedNode() { 301 274 var center = SelectedVisualNode.Center; … … 342 315 primitive.Brush = new SolidBrush(Color.Transparent); 343 316 primitive.Pen = new Pen(Color.DarkGray); 344 // primitive.Pen = Pens.Transparent; // remove the node contour345 317 } 346 318 } … … 387 359 arc.Pen.Brush = new LinearGradientBrush(start, end, source.GetColor(), target.GetColor()); 388 360 } 361 #endregion 389 362 } 390 363
Note: See TracChangeset
for help on using the changeset viewer.