Add origin node to arc.

This commit is contained in:
Mikael Capelle
2018-02-20 11:26:04 +01:00
parent 11b07b652b
commit a6e8a22081
3 changed files with 20 additions and 11 deletions

View File

@@ -5,8 +5,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import javax.sound.midi.ControllerEventListener;
import org.insa.graph.Arc;
import org.insa.graph.Graph;
import org.insa.graph.Node;
@@ -147,14 +145,14 @@ public class BinaryGraphReader extends BinaryReader implements AbstractGraphRead
Node dest = nodes.get(destNode);
// Add successor to initial arc.
orig.addSuccessor(new Arc(dest, length, info, points));
new Arc(orig, dest, length, info, points);
// And reverse arc if its a two-way road.
if (!info.isOneWay()) {
// Add without segments.
ArrayList<Point> rPoints = new ArrayList<Point>(points);
Collections.reverse(rPoints);
dest.addSuccessor(new Arc(orig, length, info, rPoints));
new Arc(dest, orig, length, info, rPoints);
}
}