Fix issue with ArcBackward being drawn.

This commit is contained in:
Holt59 2018-03-12 21:12:31 +01:00
parent 19220dc8a4
commit 251dbbb074

View File

@ -33,10 +33,23 @@ public class Node implements Comparable<Node> {
*/ */
public static Arc linkNodes(Node origin, Node destination, float length, public static Arc linkNodes(Node origin, Node destination, float length,
RoadInformation roadInformation, ArrayList<Point> points) { RoadInformation roadInformation, ArrayList<Point> points) {
ArcForward arc = new ArcForward(origin, destination, length, roadInformation, points); Arc arc = null;
if (roadInformation.isOneWay()) {
arc = new ArcForward(origin, destination, length, roadInformation, points);
origin.addSuccessor(arc); origin.addSuccessor(arc);
if (!roadInformation.isOneWay()) { }
destination.addSuccessor(new ArcBackward(arc)); else {
Arc d2o;
if (origin.getId() < destination.getId()) {
arc = new ArcForward(origin, destination, length, roadInformation, points);
d2o = new ArcBackward(arc);
}
else {
d2o = new ArcForward(destination, origin, length, roadInformation, points);
arc = new ArcBackward(d2o);
}
origin.addSuccessor(arc);
destination.addSuccessor(d2o);
} }
return arc; return arc;
} }