Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/10 16:12:34 (14 years ago)
Author:
svonolfe
Message:

Adapted VRP view (#1039)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VRPSolutionView.cs

    r4068 r4151  
    138138                foreach (Tour tour in Content.Solution.Tours) {
    139139                  double t = 0.0;
    140                   Point[] tourPoints = new Point[tour.Count];
     140                  Point[] tourPoints = new Point[tour.Count + 2];
    141141                  int lastCustomer = 0;
    142142
    143                   for (int i = 0; i < tour.Count; i++) {
    144                     int customer = tour[i].Value;
    145 
    146                     Point customerPoint = new Point(border + ((int)((coordinates[customer, 0] - xMin) * xStep)),
    147                                     bitmap.Height - (border + ((int)((coordinates[customer, 1] - yMin) * yStep))));
    148                     tourPoints[i] = customerPoint;
    149 
    150                     if (i > 0) {
     143                  for (int i = -1; i <= tour.Count; i++) {
     144                    int location = 0;
     145
     146                    if (i == -1 || i == tour.Count)
     147                      location = 0; //depot
     148                    else
     149                      location = tour[i].Value;
     150
     151                    Point locationPoint = new Point(border + ((int)((coordinates[location, 0] - xMin) * xStep)),
     152                                    bitmap.Height - (border + ((int)((coordinates[location, 1] - yMin) * yStep))));
     153                    tourPoints[i + 1] = locationPoint;
     154
     155                    if (i != -1 && i != tour.Count) {
    151156                      Brush customerBrush = Brushes.Black;
    152157
    153158                      t += VehicleRoutingProblem.GetDistance(
    154                         lastCustomer, customer, coordinates, distanceMatrix, useDistanceMatrix);
    155 
    156                       if (t < readyTime[customer]) {
    157                         t = readyTime[customer];
     159                        lastCustomer, location, coordinates, distanceMatrix, useDistanceMatrix);
     160
     161                      if (t < readyTime[location]) {
     162                        t = readyTime[location];
    158163                        customerBrush = Brushes.Yellow;
    159                       } else if (t > dueTime[customer]) {
     164                      } else if (t > dueTime[location]) {
    160165                        customerBrush = Brushes.Red;
    161166                      }
    162167
    163                       t += serviceTime[customer];
    164 
    165                       graphics.FillRectangle(customerBrush, customerPoint.X - 2, customerPoint.Y - 2, 6, 6);
     168                      t += serviceTime[location];
     169
     170                      graphics.FillRectangle(customerBrush, locationPoint.X - 2, locationPoint.Y - 2, 6, 6);
    166171                    }
    167                     lastCustomer = customer;
     172                    lastCustomer = location;
    168173                  }
    169174
Note: See TracChangeset for help on using the changeset viewer.