}
int colorIndex = 0;
// TODO Too many nested for loops
for (Vehicle vehicle : solution.getVehicleList()) {
g.setColor(TangoColorFactory.SEQUENCE_2[colorIndex]);
Customer vehicleInfoCustomer = null;
int longestNonDepotDistance = -1;
int load = 0;
for (Customer customer : solution.getCustomerList()) {
if (customer.getPreviousStandstill() != null && customer.getVehicle() == vehicle) {
load += customer.getDemand();
Location previousLocation = customer.getPreviousStandstill().getLocation();
Location location = customer.getLocation();
translator.drawRoute(g, previousLocation.getLongitude(), previousLocation.getLatitude(),
location.getLongitude(), location.getLatitude(),
location instanceof AirLocation);
// Determine where to draw the vehicle info
int distance = customer.getDistanceFromPreviousStandstill();
if (customer.getPreviousStandstill() instanceof Customer) {
if (longestNonDepotDistance < distance) {
longestNonDepotDistance = distance;
vehicleInfoCustomer = customer;
}
} else if (vehicleInfoCustomer == null) {
// If there is only 1 customer in this chain, draw it on a line to the Depot anyway
vehicleInfoCustomer = customer;
}
// Line back to the vehicle depot
if (customer.getNextCustomer() == null) {
Location vehicleLocation = vehicle.getLocation();
g.setStroke(TangoColorFactory.FAT_DASHED_STROKE);
translator.drawRoute(g, location.getLongitude(), location.getLatitude(),
vehicleLocation.getLongitude(), vehicleLocation.getLatitude(),
location instanceof AirLocation);
g.setStroke(TangoColorFactory.NORMAL_STROKE);
}
}
}
// Draw vehicle info
if (vehicleInfoCustomer != null) {
if (load > vehicle.getCapacity()) {
g.setColor(TangoColorFactory.SCARLET_2);
}
Location previousLocation = vehicleInfoCustomer.getPreviousStandstill().getLocation();
Location location = vehicleInfoCustomer.getLocation();
double longitude = (previousLocation.getLongitude() + location.getLongitude()) / 2.0;
int x = translator.translateLongitudeToX(longitude);
double latitude = (previousLocation.getLatitude() + location.getLatitude()) / 2.0;
int y = translator.translateLatitudeToY(latitude);
boolean ascending = (previousLocation.getLongitude() < location.getLongitude())