Changeset 11240 for branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs
- Timestamp:
- 07/30/14 14:59:20 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs
r11235 r11240 22 22 using System; 23 23 using System.Drawing; 24 using System.Linq; 24 25 using HeuristicLab.Core.Views; 25 26 using HeuristicLab.MainForm; … … 41 42 Content.QualityChanged -= new EventHandler(Content_QualityChanged); 42 43 Content.CoordinatesChanged -= new EventHandler(Content_CoordinatesChanged); 44 Content.ScoresChanged -= new EventHandler(Content_ScoresChanged); 43 45 Content.IntegerVectorChanged -= new EventHandler(Content_IntegerVectorChanged); 44 46 base.DeregisterContentEvents(); … … 48 50 Content.QualityChanged += new EventHandler(Content_QualityChanged); 49 51 Content.CoordinatesChanged += new EventHandler(Content_CoordinatesChanged); 52 Content.ScoresChanged += new EventHandler(Content_ScoresChanged); 50 53 Content.IntegerVectorChanged += new EventHandler(Content_IntegerVectorChanged); 51 54 } … … 77 80 } else { 78 81 var coordinates = Content.Coordinates; 82 var scores = Content.Scores; 79 83 var integerVector = Content.IntegerVector; 80 84 var bitmap = new Bitmap(pictureBox.Width, pictureBox.Height); … … 106 110 graphics.DrawPolygon(Pens.Black, tour); 107 111 } 108 for (int i = 0; i < points.Length; i++) 109 graphics.FillRectangle(Brushes.Red, points[i].X - 2, points[i].Y - 2, 6, 6); 112 113 double scoreMin = scores.Min(); 114 double scoreMax = scores.Max(); 115 double scoreRange = scoreMax - scoreMin; 116 for (int i = 0; i < points.Length; i++) { 117 double score = scores[i]; 118 int size = (int)Math.Round(((score - scoreMin) / scoreRange) * 9 + 1); 119 graphics.FillRectangle(Brushes.Red, points[i].X - size / 2, points[i].Y - size / 2, size, size); 120 } 110 121 } 111 122 } else { … … 135 146 GenerateImage(); 136 147 } 148 private void Content_ScoresChanged(object sender, EventArgs e) { 149 if (InvokeRequired) 150 Invoke(new EventHandler(Content_ScoresChanged), sender, e); 151 else 152 GenerateImage(); 153 } 137 154 private void Content_IntegerVectorChanged(object sender, EventArgs e) { 138 155 if (InvokeRequired)
Note: See TracChangeset
for help on using the changeset viewer.