- Timestamp:
- 08/04/14 15:27:43 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.Orienteering
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs
r11245 r11265 58 58 orienteeringSolutionView.Content = null; 59 59 } else { 60 orienteeringSolutionView.Content = new OrienteeringSolution(Content.BestKnownSolution, Content.Coordinates, Content.Scores, Content.BestKnownQuality); 60 orienteeringSolutionView.Content = new OrienteeringSolution( 61 Content.BestKnownSolution, Content.Coordinates, Content.StartingPoint, Content.TerminusPoint, Content.Scores, Content.BestKnownQuality); 61 62 } 62 63 } -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs
r11245 r11265 120 120 graphics.FillRectangle(Brushes.Red, points[i].X - size / 2, points[i].Y - size / 2, size, size); 121 121 } 122 123 int startingPoint = Content.StartingPoint.Value; 124 int terminusPoint = Content.TerminusPoint.Value; 125 Font font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular); 126 graphics.DrawString("Begin", font, Brushes.Black, points[startingPoint].X, points[startingPoint].Y); 127 graphics.DrawString("End", font, Brushes.Black, points[terminusPoint].X, points[terminusPoint].Y); 122 128 } 123 129 } else { -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Analyzers/BestOrienteeringSolutionAnalyser.cs
r11240 r11265 42 42 get { return (LookupParameter<DoubleMatrix>)Parameters["Coordinates"]; } 43 43 } 44 public ILookupParameter<IntValue> StartingPointParameter { 45 get { return (ILookupParameter<IntValue>)Parameters["StartingPoint"]; } 46 } 47 public ILookupParameter<IntValue> TerminusPointParameter { 48 get { return (ILookupParameter<IntValue>)Parameters["TerminusPoint"]; } 49 } 44 50 public ILookupParameter<DoubleArray> ScoresParameter { 45 51 get { return (ILookupParameter<DoubleArray>)Parameters["Scores"]; } … … 72 78 Parameters.Add(new ScopeTreeLookupParameter<IntegerVector>("IntegerVector", "The Orienteering solutions which should be analysed.")); 73 79 Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the points.")); 80 Parameters.Add(new LookupParameter<IntValue>("StartingPoint", "Index of the starting point.")); 81 Parameters.Add(new LookupParameter<IntValue>("TerminusPoint", "Index of the ending point.")); 74 82 Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points.")); 75 83 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the Orienteering solutions which should be analyzed.")); … … 95 103 var solution = BestSolutionParameter.ActualValue; 96 104 var coordinates = CoordinatesParameter.ActualValue; 105 var startingPoint = StartingPointParameter.ActualValue; 106 var terminusPoint = TerminusPointParameter.ActualValue; 97 107 var scores = ScoresParameter.ActualValue; 98 108 if (solution == null) { … … 100 110 (IntegerVector)solutions[bestIndex].Clone(), 101 111 coordinates, 112 startingPoint, 113 terminusPoint, 102 114 scores, 103 115 new DoubleValue(qualities[bestIndex].Value)); -
branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringSolution.cs
r11240 r11265 38 38 if (coordinates != null) RegisterCoordinatesEvents(); 39 39 OnCoordinatesChanged(); 40 } 41 } 42 } 43 [Storable] 44 private IntValue startingPoint; 45 public IntValue StartingPoint { 46 get { return startingPoint; } 47 set { 48 if (startingPoint != value) { 49 if (startingPoint != null) DeregisterStartingPointEvents(); 50 startingPoint = value; 51 if (startingPoint != null) RegisterStartingPointEvents(); 52 OnStartingPointChanged(); 53 } 54 } 55 } 56 [Storable] 57 private IntValue terminusPoint; 58 public IntValue TerminusPoint { 59 get { return terminusPoint; } 60 set { 61 if (terminusPoint != value) { 62 if (terminusPoint != null) DeregisterTerminusPointEvents(); 63 terminusPoint = value; 64 if (terminusPoint != null) RegisterTerminusPointEvents(); 65 OnTerminusPointChanged(); 40 66 } 41 67 } … … 77 103 Initialize(); 78 104 } 79 public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, DoubleArray scores, DoubleValue quality) 105 public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, IntValue startingPoint, IntValue terminusPoint, 106 DoubleArray scores, DoubleValue quality) 80 107 : base() { 81 108 this.integerVector = integerVector; 82 109 this.coordinates = coordinates; 110 this.startingPoint = startingPoint; 111 this.terminusPoint = terminusPoint; 83 112 this.scores = scores; 84 113 this.quality = quality; … … 98 127 if (integerVector != null) RegisterIntegerVectorEvents(); 99 128 if (coordinates != null) RegisterCoordinatesEvents(); 129 if (startingPoint != null) RegisterStartingPointEvents(); 130 if (terminusPoint != null) RegisterTerminusPointEvents(); 100 131 if (scores != null) RegisterScoresEvents(); 101 132 if (quality != null) RegisterQualityEvents(); … … 117 148 } 118 149 150 public event EventHandler StartingPointChanged; 151 private void OnStartingPointChanged() { 152 var changed = StartingPointChanged; 153 if (changed != null) 154 changed(this, EventArgs.Empty); 155 } 156 157 public event EventHandler TerminusPointChanged; 158 private void OnTerminusPointChanged() { 159 var changed = TerminusPointChanged; 160 if (changed != null) 161 changed(this, EventArgs.Empty); 162 } 163 119 164 public event EventHandler ScoresChanged; 120 165 private void OnScoresChanged() { … … 147 192 Coordinates.Reset -= new EventHandler(Coordinates_Reset); 148 193 } 194 private void RegisterStartingPointEvents() { 195 StartingPoint.ValueChanged += new EventHandler(StartingPoint_ValueChanged); 196 } 197 private void DeregisterStartingPointEvents() { 198 StartingPoint.ValueChanged -= new EventHandler(StartingPoint_ValueChanged); 199 } 200 private void RegisterTerminusPointEvents() { 201 TerminusPoint.ValueChanged += new EventHandler(TerminusPoint_ValueChanged); 202 } 203 private void DeregisterTerminusPointEvents() { 204 TerminusPoint.ValueChanged -= new EventHandler(TerminusPoint_ValueChanged); 205 } 149 206 private void RegisterScoresEvents() { 150 207 Scores.ItemChanged += new EventHandler<EventArgs<int>>(Scores_ItemChanged); … … 174 231 OnCoordinatesChanged(); 175 232 } 233 private void StartingPoint_ValueChanged(object sender, EventArgs e) { 234 OnStartingPointChanged(); 235 } 236 private void TerminusPoint_ValueChanged(object sender, EventArgs e) { 237 OnTerminusPointChanged(); 238 } 176 239 private void Scores_ItemChanged(object sender, EventArgs<int> e) { 177 240 OnCoordinatesChanged();
Note: See TracChangeset
for help on using the changeset viewer.