1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

added unique nodeId for penaltyVehicles

This commit is contained in:
oblonski 2014-06-11 22:52:19 +02:00
parent 1c9437898d
commit 76b3ecc8d0

View file

@ -22,6 +22,7 @@ import jsprit.core.problem.solution.route.activity.DeliveryActivity;
import jsprit.core.problem.solution.route.activity.PickupActivity; import jsprit.core.problem.solution.route.activity.PickupActivity;
import jsprit.core.problem.solution.route.activity.TourActivity; import jsprit.core.problem.solution.route.activity.TourActivity;
import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity; import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity;
import jsprit.core.problem.vehicle.PenaltyVehicleType;
import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.Vehicle;
import org.graphstream.graph.Edge; import org.graphstream.graph.Edge;
@ -384,7 +385,9 @@ public class GraphStreamViewer {
} }
private void renderVehicle(Graph g, Vehicle vehicle, Label label) { private void renderVehicle(Graph g, Vehicle vehicle, Label label) {
Node vehicleStart = g.addNode(makeId(vehicle.getId(),vehicle.getStartLocationId())); String nodeId = makeId(vehicle.getId(),vehicle.getStartLocationId());
if(vehicle.getType() instanceof PenaltyVehicleType) nodeId = makeId("pen_"+vehicle.getId(),vehicle.getStartLocationId());
Node vehicleStart = g.addNode(nodeId);
if(label.equals(Label.ID)) vehicleStart.addAttribute("ui.label", "depot"); if(label.equals(Label.ID)) vehicleStart.addAttribute("ui.label", "depot");
// if(label.equals(Label.ACTIVITY)) n.addAttribute("ui.label", "start"); // if(label.equals(Label.ACTIVITY)) n.addAttribute("ui.label", "start");
vehicleStart.addAttribute("x", vehicle.getStartLocationCoordinate().getX()); vehicleStart.addAttribute("x", vehicle.getStartLocationCoordinate().getX());