2024-07-02 19:13:30 +00:00
|
|
|
|
package OurApplication;
|
|
|
|
|
|
2024-07-03 17:41:46 +00:00
|
|
|
|
import graph.*;
|
2024-07-02 19:13:30 +00:00
|
|
|
|
import logging.LogElementList;
|
|
|
|
|
import visualisation.HybridWindow;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
2024-07-03 17:41:46 +00:00
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.util.Random;
|
2024-07-02 19:13:30 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This application provides an example for using logging and visualization packages.
|
|
|
|
|
* It uses extended classes from logging and visualization.
|
|
|
|
|
* @see OurAlgorithm
|
|
|
|
|
* @see OurApplication
|
|
|
|
|
* @see OurDrawArea
|
|
|
|
|
* @see OurHybridWindow
|
|
|
|
|
* @see OurLogElement
|
|
|
|
|
* @see OurParameterArea
|
|
|
|
|
* @see OurTextArea
|
|
|
|
|
* @see OurLegendArea
|
|
|
|
|
* @see JPanel
|
|
|
|
|
* @author MSch<EFBFBD>fer
|
|
|
|
|
* DHBW Stuttgart/Campus Horb AI2008<br>
|
|
|
|
|
* <br>
|
|
|
|
|
*/
|
|
|
|
|
public class OurApplication {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Standard constructor.
|
|
|
|
|
*/
|
|
|
|
|
public OurApplication() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The applications main method.
|
|
|
|
|
* Creates a HybridWindow with TestParameterArea, TestLegendArea ,TestDrawArea, TestTextArea and TestAlgorithm and starts it.
|
|
|
|
|
* @param args
|
|
|
|
|
*/
|
|
|
|
|
public static void main(String[]args){
|
|
|
|
|
|
2024-07-05 15:06:51 +00:00
|
|
|
|
Random random = new Random();
|
|
|
|
|
|
|
|
|
|
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
|
|
|
|
|
|
|
|
|
|
ExampleGraphs temp = new ExampleGraphs();
|
|
|
|
|
myGraph = temp.example1();
|
2024-07-07 10:58:33 +00:00
|
|
|
|
//sean: Ich wollte erst hier dann das ausgewählte Beispiel reinhauen, jedoch wird das hier nur einmal am Anfang aufgerufen
|
2024-07-05 15:06:51 +00:00
|
|
|
|
System.out.println(myGraph.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-02 22:46:21 +00:00
|
|
|
|
OurParameterArea parameterArea = new OurParameterArea();
|
2024-07-05 15:06:51 +00:00
|
|
|
|
OurDrawArea drawArea = new OurDrawArea(myGraph.getLogList(),"GraphVisualization");
|
|
|
|
|
OurTextArea textArea = new OurTextArea(myGraph.getLogList());
|
2024-07-02 22:46:21 +00:00
|
|
|
|
OurAlgorithm algorithm = new OurAlgorithm(parameterArea);
|
|
|
|
|
OurLegendArea legendArea = new OurLegendArea();
|
2024-07-05 15:06:51 +00:00
|
|
|
|
HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> applet = new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea, textArea, parameterArea, algorithm, myGraph.getLogList(), legendArea);
|
2024-07-02 19:13:30 +00:00
|
|
|
|
|
|
|
|
|
|
2024-07-05 15:06:51 +00:00
|
|
|
|
drawArea.setCurrentGraph(myGraph.getScreenGraph());
|
|
|
|
|
algorithm.setCurrentGraph(myGraph);
|
|
|
|
|
|
2024-07-07 14:29:45 +00:00
|
|
|
|
|
2024-07-02 22:46:21 +00:00
|
|
|
|
JFrame frame = new JFrame("Visualise");
|
2024-07-02 19:13:30 +00:00
|
|
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
|
frame.getContentPane().add(applet);
|
|
|
|
|
frame.pack();
|
|
|
|
|
applet.init();
|
|
|
|
|
applet.start();
|
|
|
|
|
frame.setSize(800,600);
|
|
|
|
|
frame.setVisible(true);
|
2024-07-02 22:46:21 +00:00
|
|
|
|
|
|
|
|
|
|
2024-07-03 17:41:46 +00:00
|
|
|
|
|
|
|
|
|
|
2024-07-05 13:08:33 +00:00
|
|
|
|
/*for (int i = 0; i < 10; i++) {
|
2024-07-03 17:41:46 +00:00
|
|
|
|
myGraph.addVertex(new MarkedVertex<>(random.nextInt(1, 10)*40, random.nextInt(1, 10)*40, Integer.toString(i), null, Color.BLACK));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
|
|
|
|
|
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
|
|
|
|
|
}
|
2024-07-05 13:08:33 +00:00
|
|
|
|
|
2024-07-03 17:41:46 +00:00
|
|
|
|
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
|
|
|
|
|
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2024-07-02 19:13:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|