No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Launch.java 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package org.insa.base;
  2. import java.awt.BorderLayout;
  3. import java.awt.Dimension;
  4. import java.io.BufferedInputStream;
  5. import java.io.DataInputStream;
  6. import java.io.FileInputStream;
  7. import javax.swing.JFrame;
  8. import javax.swing.SwingUtilities;
  9. import org.insa.graph.Graph;
  10. import org.insa.graph.Path;
  11. import org.insa.graph.io.BinaryGraphReader;
  12. import org.insa.graph.io.GraphReader;
  13. import org.insa.graph.io.PathReader;
  14. import org.insa.graphics.drawing.Drawing;
  15. import org.insa.graphics.drawing.components.BasicDrawing;
  16. public class Launch {
  17. /**
  18. * Create a new Drawing inside a JFrame an return it.
  19. *
  20. * @return The created drawing.
  21. */
  22. public static Drawing createDrawing() throws Exception {
  23. BasicDrawing basicDrawing = new BasicDrawing();
  24. SwingUtilities.invokeAndWait(new Runnable() {
  25. @Override
  26. public void run() {
  27. JFrame frame = new JFrame("BE Graphes - Launch");
  28. frame.setLayout(new BorderLayout());
  29. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  30. frame.setVisible(true);
  31. frame.setSize(new Dimension(800, 600));
  32. frame.setContentPane(basicDrawing);
  33. frame.validate();
  34. }
  35. });
  36. return basicDrawing;
  37. }
  38. public static void main(String[] args) throws Exception {
  39. // Visit these directory to see the list of available files on Commetud.
  40. String mapName = "/home/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/insa.mapgr";
  41. String pathName = "/home/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31insa_rangueil_r2.path";
  42. // Create a graph reader.
  43. GraphReader reader = new BinaryGraphReader(
  44. new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
  45. // TODO: Read the graph.
  46. Graph graph = null;
  47. // Create the drawing:
  48. Drawing drawing = createDrawing();
  49. // TODO: Draw the graph on the drawing.
  50. // TODO: Create a PathReader.
  51. PathReader pathReader = null;
  52. // TODO: Read the path.
  53. Path path = null;
  54. // TODO: Draw the path.
  55. }
  56. }