123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package org.insa.graphs.gui.simple;
-
- import java.awt.BorderLayout;
- 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.graphs.gui.drawing.Drawing;
- 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.GraphReader;
- import org.insa.graphs.model.io.PathReader;
-
- public class Launch {
-
- //Adrien BARBANSON - 25 mars 2021
-
- /**
- * Create a new Drawing inside a JFrame an return it.
- *
- * @return The created drawing.
- *
- * @throws Exception if something wrong happens when creating the graph.
- */
- 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.setLayout(new BorderLayout());
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setVisible(true);
- frame.setSize(new Dimension(800, 600));
- frame.setContentPane(basicDrawing);
- frame.validate();
- }
- });
- return basicDrawing;
- }
-
- public static void main(String[] args) throws Exception {
-
- // Visit these directory to see the list of available files on Commetud.
- final String mapName = "/home/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/insa.mapgr";
- final String pathName = "/home/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31insa_rangueil_r2.path";
-
- // Create a graph reader.
- final GraphReader reader = new BinaryGraphReader(
- new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
-
- // TODO: Read the graph.
- final Graph graph = null;
-
- // Create the drawing:
- final Drawing drawing = createDrawing();
-
- // TODO: Draw the graph on the drawing.
-
- // TODO: Create a PathReader.
- final PathReader pathReader = null;
-
- // TODO: Read the path.
- final Path path = null;
-
- // TODO: Draw the path.
- }
-
- }
|