package OurApplication; import graph.*; import graph.Graph; import logging.LogElementList; import visualisation.DrawArea; import visualizationElements.*; import java.awt.*; import java.util.Random; import java.util.Vector; /** * This class provides an example for using visualization.DrawArea. * @see logging.Algorithm @author MSch�fer * DHBW Stuttgart/Campus Horb AI2008
*
*/ public class OurDrawArea extends DrawArea{ private static final long serialVersionUID = 1L; private graph.Graph currentGraph; /** * Standard constructor. */ public OurDrawArea() { super(); } /** * Creates a test draw area and sets the specified log list. * @param logList the draw area's log list test log elements. * @param drawAreaName The display name over the draw area. */ public OurDrawArea(LogElementList logList, String drawAreaName){ super(logList, drawAreaName); } public void setCurrentGraph(Graph graph) { this.currentGraph = graph; } /** * Draws a visualization element. */ public void draw(Graphics g) { this.currentGraph.getScreenGraph().draw(g); OurLogElement logElement = (OurLogElement) logList.get(); if (logElement.getVertex() != null) { if (logElement.getVertex().getColor() == Color.BLACK) { logElement.getVertex().setColor(Color.YELLOW); } else if (logElement.getVertex().getColor() == Color.YELLOW) { logElement.getVertex().setColor(Color.BLUE); } } else { if (logElement.getEdge().getColor() == Color.BLACK) { logElement.getEdge().setColor(Color.YELLOW); } else if (logElement.getEdge().getColor() == Color.YELLOW) { logElement.getEdge().setColor(Color.BLUE); } } logElement.getVertex().draw(g); } }