Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11265 for branches


Ignore:
Timestamp:
08/04/14 15:27:43 (10 years ago)
Author:
pfleck
Message:

#2208 Improved orienteering solution view by labeling start and endpoint

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  
    5858        orienteeringSolutionView.Content = null;
    5959      } 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);
    6162      }
    6263    }
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs

    r11245 r11265  
    120120                graphics.FillRectangle(Brushes.Red, points[i].X - size / 2, points[i].Y - size / 2, size, size);
    121121              }
     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);
    122128            }
    123129          } else {
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Analyzers/BestOrienteeringSolutionAnalyser.cs

    r11240 r11265  
    4242      get { return (LookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
    4343    }
     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    }
    4450    public ILookupParameter<DoubleArray> ScoresParameter {
    4551      get { return (ILookupParameter<DoubleArray>)Parameters["Scores"]; }
     
    7278      Parameters.Add(new ScopeTreeLookupParameter<IntegerVector>("IntegerVector", "The Orienteering solutions which should be analysed."));
    7379      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."));
    7482      Parameters.Add(new LookupParameter<DoubleArray>("Scores", "The scores of the points."));
    7583      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the Orienteering solutions which should be analyzed."));
     
    95103      var solution = BestSolutionParameter.ActualValue;
    96104      var coordinates = CoordinatesParameter.ActualValue;
     105      var startingPoint = StartingPointParameter.ActualValue;
     106      var terminusPoint = TerminusPointParameter.ActualValue;
    97107      var scores = ScoresParameter.ActualValue;
    98108      if (solution == null) {
     
    100110          (IntegerVector)solutions[bestIndex].Clone(),
    101111          coordinates,
     112          startingPoint,
     113          terminusPoint,
    102114          scores,
    103115          new DoubleValue(qualities[bestIndex].Value));
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringSolution.cs

    r11240 r11265  
    3838          if (coordinates != null) RegisterCoordinatesEvents();
    3939          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();
    4066        }
    4167      }
     
    77103      Initialize();
    78104    }
    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)
    80107      : base() {
    81108      this.integerVector = integerVector;
    82109      this.coordinates = coordinates;
     110      this.startingPoint = startingPoint;
     111      this.terminusPoint = terminusPoint;
    83112      this.scores = scores;
    84113      this.quality = quality;
     
    98127      if (integerVector != null) RegisterIntegerVectorEvents();
    99128      if (coordinates != null) RegisterCoordinatesEvents();
     129      if (startingPoint != null) RegisterStartingPointEvents();
     130      if (terminusPoint != null) RegisterTerminusPointEvents();
    100131      if (scores != null) RegisterScoresEvents();
    101132      if (quality != null) RegisterQualityEvents();
     
    117148    }
    118149
     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
    119164    public event EventHandler ScoresChanged;
    120165    private void OnScoresChanged() {
     
    147192      Coordinates.Reset -= new EventHandler(Coordinates_Reset);
    148193    }
     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    }
    149206    private void RegisterScoresEvents() {
    150207      Scores.ItemChanged += new EventHandler<EventArgs<int>>(Scores_ItemChanged);
     
    174231      OnCoordinatesChanged();
    175232    }
     233    private void StartingPoint_ValueChanged(object sender, EventArgs e) {
     234      OnStartingPointChanged();
     235    }
     236    private void TerminusPoint_ValueChanged(object sender, EventArgs e) {
     237      OnTerminusPointChanged();
     238    }
    176239    private void Scores_ItemChanged(object sender, EventArgs<int> e) {
    177240      OnCoordinatesChanged();
Note: See TracChangeset for help on using the changeset viewer.