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