package org.insa.base; import java.awt.Dimension; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.FileInputStream; import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.insa.graph.Graph; import org.insa.graph.Path; import org.insa.graph.io.BinaryGraphReader; import org.insa.graph.io.GraphReader; import org.insa.graph.io.PathReader; import org.insa.graphics.drawing.Drawing; import org.insa.graphics.drawing.components.BasicDrawing; public class Launch { /** * Create a new Drawing inside a JFrame an return it. * * @return The created drawing. */ public static Drawing createDrawing() throws Exception { BasicDrawing basicDrawing = new BasicDrawing(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { JFrame frame = new JFrame("BE Graphes - Launch"); frame.setContentPane(basicDrawing); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setSize(new Dimension(800, 600)); } }); return basicDrawing; } public static void main(String[] args) throws Exception { // Visit these directory to see the list of available files on Commetud. String mapName = "/home/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/insa.mapgr"; String pathName = "/home/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31insa_rangueil_r2.path"; // Create a graph reader. GraphReader reader = new BinaryGraphReader( new DataInputStream(new BufferedInputStream(new FileInputStream(mapName)))); // TODO: Read the graph. Graph graph = null; // Create the drawing: Drawing drawing = createDrawing(); // TODO: Draw the graph on the drawing. // TODO: Create a PathReader. PathReader pathReader = null; // TODO: Read the path. Path path = null; // TODO: Draw the path. } }