diff --git a/be-graphes-gui/src/main/java/org/insa/graphs/gui/simple/Launch.java b/be-graphes-gui/src/main/java/org/insa/graphs/gui/simple/Launch.java index aa7ea04..0a8e01e 100644 --- a/be-graphes-gui/src/main/java/org/insa/graphs/gui/simple/Launch.java +++ b/be-graphes-gui/src/main/java/org/insa/graphs/gui/simple/Launch.java @@ -14,6 +14,7 @@ import org.insa.graphs.gui.drawing.components.BasicDrawing; import org.insa.graphs.model.Graph; import org.insa.graphs.model.Path; import org.insa.graphs.model.io.BinaryGraphReader; +import org.insa.graphs.model.io.BinaryPathReader; import org.insa.graphs.model.io.GraphReader; import org.insa.graphs.model.io.PathReader; @@ -57,23 +58,26 @@ public class Launch { try (final GraphReader reader = new BinaryGraphReader(new DataInputStream( new BufferedInputStream(new FileInputStream(mapName))))) { - // TODO: read the graph - graph = null; + // DONE: read the graph + graph = reader.read(); } // create the drawing final Drawing drawing = createDrawing(); - // TODO: draw the graph on the drawing + // DONE: draw the graph on the drawing + drawing.drawGraph(graph); - // TODO: create a path reader - try (final PathReader pathReader = null) { + // DONE: create a path reader + try (final PathReader pathReader = new BinaryPathReader(new DataInputStream( + new BufferedInputStream(new FileInputStream(pathName))))) { - // TODO: read the path - path = null; + // DONE: read the path + path = pathReader.readPath(graph); } - // TODO: draw the path on the drawing + // DONE: draw the path on the drawing + drawing.drawPath(path); } } diff --git a/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java b/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java index d6a570e..3758400 100644 --- a/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java +++ b/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.Iterator; /** *
@@ -26,12 +27,32 @@ public class Path {
* @return A path that goes through the given list of nodes.
* @throws IllegalArgumentException If the list of nodes is not valid, i.e. two
* consecutive nodes in the list are not connected in the graph.
- * @deprecated Need to be implemented.
*/
public static Path createFastestPathFromNodes(Graph graph, List