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.1KB

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