Examples Visualisation, TextArea functionality

This commit is contained in:
i23007 2024-07-07 16:27:22 +02:00
parent 6060796ddd
commit f00057ee6e
8 changed files with 9 additions and 7 deletions

View File

@ -40,6 +40,9 @@ public class OurAlgorithm extends Algorithm {
* @return a LogElementList containing the algorithm processing single steps * @return a LogElementList containing the algorithm processing single steps
*/ */
public LogElementList<OurLogElement> run() { public LogElementList<OurLogElement> run() {
OurParameterArea currentParameterArea = (OurParameterArea) this.getParameterArea();
this.setCurrentGraph(currentParameterArea.getSelectedGraph());
Random random = new Random(); Random random = new Random();

View File

@ -5,7 +5,6 @@ import logging.LogElementList;
import visualisation.HybridWindow; import visualisation.HybridWindow;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.util.Random; import java.util.Random;
/** /**
@ -51,17 +50,16 @@ public class OurApplication {
LogElementList<OurLogElement> logList=new LogElementList<OurLogElement>();
OurParameterArea parameterArea = new OurParameterArea(); OurParameterArea parameterArea = new OurParameterArea();
OurDrawArea drawArea = new OurDrawArea(myGraph.getLogList(),"GraphVisualization"); OurDrawArea drawArea = new OurDrawArea(logList,"GraphVisualization");
OurTextArea textArea = new OurTextArea(myGraph.getLogList()); OurTextArea textArea = new OurTextArea(logList);
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, myGraph.getLogList(), legendArea); HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> applet = new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea, textArea, parameterArea, algorithm, logList, 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);

View File

@ -49,6 +49,7 @@ public class OurDrawArea extends DrawArea{
public void draw(Graphics g) { public void draw(Graphics g) {
OurLogElement logElement = (OurLogElement) logList.get(); OurLogElement logElement = (OurLogElement) logList.get();
this.setCurrentGraph(((OurLogElement) logList.get()).getGraph());
logElement.getGraph().draw(g); logElement.getGraph().draw(g);
for(Edge screenEdge : currentGraph.getEdges()){ for(Edge screenEdge : currentGraph.getEdges()){
g.drawString(screenEdge.getMarking(), (screenEdge.getSource().getXpos() + screenEdge.getDestination().getXpos())/2, (screenEdge.getSource().getYpos() + screenEdge.getDestination().getYpos())/2); g.drawString(screenEdge.getMarking(), (screenEdge.getSource().getXpos() + screenEdge.getDestination().getXpos())/2, (screenEdge.getSource().getYpos() + screenEdge.getDestination().getYpos())/2);