using Cursach.Realisations; using Cursach.States; namespace Cursach; public class Visualizator { private State? State { get; set; } public void Draw(Graphics g, State state) { Pen penLine = new(Color.Black, 5); Pen penBid = new(Color.Red, 2); Pen penSelectedBid = new(Color.Green, 3); Brush darkBrush = new SolidBrush(Color.Black); g.FillRectangle(new SolidBrush(Color.White), 0, 0, 500, 500); AdjacencyList _adjacencyList = state.AdjacencyList; foreach (var parentNode in _adjacencyList.Keys()) { foreach (var childNode in _adjacencyList.Values(parentNode)) { g.DrawLine(penLine, parentNode.GetPosition(), childNode.GetPosition()); } g.DrawString(parentNode.ToString(), new Font("Comic Sans MS", 7), darkBrush, parentNode.GetPosition().X - 20, parentNode.GetPosition().Y - 30); if (state.visited.Contains(parentNode)) { VizulizatorGraph.DrawPoint(g, parentNode.GetPosition(), Color.Crimson); } else if (state.queue.Contains(parentNode)) { VizulizatorGraph.DrawPoint(g, parentNode.GetPosition(), Color.DarkSlateGray); } else { VizulizatorGraph.DrawPoint(g, parentNode.GetPosition(), Color.Gray); } } } }