OurApplication etwas sortiert und log zuweisung geändert

fix von Färbung
This commit is contained in:
i23007 2024-07-05 17:06:51 +02:00
parent e07edf8b2b
commit b2c8b4f54f
5 changed files with 22 additions and 15 deletions

2
.idea/workspace.xml generated
View File

@ -6,7 +6,9 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Stable Version with finished visualisation"> <list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Stable Version with finished visualisation">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/OurApplication/OurAlgorithm.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurAlgorithm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/OurApplication/OurApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurApplication.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/OurApplication/OurApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurApplication.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurApplication.class" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@ -40,15 +40,29 @@ public class OurApplication {
*/ */
public static void main(String[]args){ public static void main(String[]args){
LogElementList<OurLogElement>logList = new LogElementList<OurLogElement>(); Random random = new Random();
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
ExampleGraphs temp = new ExampleGraphs();
myGraph = temp.example1();
System.out.println(myGraph.toString());
OurParameterArea parameterArea = new OurParameterArea(); OurParameterArea parameterArea = new OurParameterArea();
OurDrawArea drawArea = new OurDrawArea(logList,"GraphVisualization"); OurDrawArea drawArea = new OurDrawArea(myGraph.getLogList(),"GraphVisualization");
OurTextArea textArea = new OurTextArea(logList); OurTextArea textArea = new OurTextArea(myGraph.getLogList());
OurAlgorithm algorithm = new OurAlgorithm(parameterArea); OurAlgorithm algorithm = new OurAlgorithm(parameterArea);
OurLegendArea legendArea = new OurLegendArea(); OurLegendArea legendArea = new OurLegendArea();
HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> applet = new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea, textArea, parameterArea, algorithm, logList, legendArea); HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> applet = new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea, textArea, parameterArea, algorithm, myGraph.getLogList(), legendArea);
drawArea.setCurrentGraph(myGraph.getScreenGraph());
algorithm.setCurrentGraph(myGraph);
JFrame frame = new JFrame("Visualise"); JFrame frame = new JFrame("Visualise");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(applet); frame.getContentPane().add(applet);
@ -59,9 +73,7 @@ public class OurApplication {
frame.setVisible(true); frame.setVisible(true);
Random random = new Random();
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
/*for (int i = 0; i < 10; i++) { /*for (int i = 0; i < 10; i++) {
myGraph.addVertex(new MarkedVertex<>(random.nextInt(1, 10)*40, random.nextInt(1, 10)*40, Integer.toString(i), null, Color.BLACK)); myGraph.addVertex(new MarkedVertex<>(random.nextInt(1, 10)*40, random.nextInt(1, 10)*40, Integer.toString(i), null, Color.BLACK));
@ -77,13 +89,6 @@ public class OurApplication {
*/ */
ExampleGraphs temp = new ExampleGraphs();
myGraph = temp.example1();
System.out.println(myGraph.toString());
drawArea.setCurrentGraph(myGraph.getScreenGraph());
algorithm.setCurrentGraph(myGraph);
} }

View File

@ -273,7 +273,7 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
// Logging // Logging
System.out.println("Add " + i.getName() + " with " + dist + " weight to queue."); System.out.println("Add " + i.getName() + " with " + dist + " weight to queue.");
nextVertex.getElement().getScreenVertex().setColor(Color.YELLOW); i.getScreenVertex().setColor(Color.YELLOW);
this.logList.add(new OurLogElement(step, "Step: " + step, 0, this.getScreenGraphCopy())); this.logList.add(new OurLogElement(step, "Step: " + step, 0, this.getScreenGraphCopy()));
// Nehme nächsten Knoten in die Queue auf // Nehme nächsten Knoten in die Queue auf
@ -359,7 +359,7 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
// Logging // Logging
System.out.println("Add " + i.getName() + " with " + dist + " weight to queue."); System.out.println("Add " + i.getName() + " with " + dist + " weight to queue.");
nextVertex.getElement().getScreenVertex().setColor(Color.YELLOW); i.getScreenVertex().setColor(Color.YELLOW);
this.logList.add(new OurLogElement(step, "Step: " + step, 0, this.getScreenGraphCopy())); this.logList.add(new OurLogElement(step, "Step: " + step, 0, this.getScreenGraphCopy()));
// Nehme nächsten Knoten in die Queue auf // Nehme nächsten Knoten in die Queue auf