public void Init(SolverController controller) { treeRenderer = new TreeVisualisation(controller.Strategy.EvaluationTree, new RectangleInt(0, 0, 1800, 1800), new SizeInt(8, 8)); treeRenderer.Controller = controller; treeVis.Visualisation = treeRenderer; }
public void Init(SolverController controller) { treeRenderer = new TreeVisualisation(controller); treeRenderer.RenderCanvas = new RectangleInt(0, 0, 1800, 1800); treeVis.Visualisation = treeRenderer; }
/// <summary> /// Update or Bind to the UI /// </summary> private void UpdateStatus() { // Clear existing report text richTextBoxSolverReport.Clear(); if (controller != null && controller.Strategy != null && controller.StaticAnalysis != null) { // Draw the graphs PlotGraphs(); // Show debug text richTextBoxSolverReport.Text = controller.DebugReport.ToString(new DebugReportFormatter()); // Static bitmaps if (!bitmapViewerStatic.HasLayers) { SokobanMap build = BuildCurrentMap(controller.Strategy.EvaluationTree.Root.Data); BitmapViewer.Layer mapLayer = new BitmapViewer.Layer(); mapLayer.Order = 0; mapLayer.Map = build; mapLayer.Name = "Puzzle"; bitmapViewerStatic.SetLayer(mapLayer); mapLayer.IsVisible = true; bitmapViewerStatic.SetLayer(controller.StaticAnalysis.WallMap, new SolidBrush(Color.FromArgb(120, Color.Gray))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.FloorMap, new SolidBrush(Color.FromArgb(120, Color.Green))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.InitialCrateMap, new SolidBrush(Color.FromArgb(120, Color.Blue))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.DeadMap, new SolidBrush(Color.FromArgb(120, Color.Brown))).IsVisible = true; bitmapViewerStatic.SetLayer(controller.StaticAnalysis.BoundryMap, new SolidBrush(Color.FromArgb(120, Color.LightGray))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.GoalMap, new SolidBrush(Color.FromArgb(120, Color.Yellow))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.CornerMap, new SolidBrush(Color.FromArgb(120, Color.Pink))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.RecessMap, new SolidBrush(Color.FromArgb(120, Color.Cyan))); bitmapViewerStatic.SetLayer(controller.StaticAnalysis.RoomAnalysis.DoorBitmap, new SolidBrush(Color.FromArgb(120, Color.Khaki))); foreach (Room room in controller.StaticAnalysis.RoomAnalysis.Rooms) { bitmapViewerStatic.SetLayer(room, new SolidBrush(Color.FromArgb(120, Color.LightCyan))); } BitmapViewer.Layer weightLayer = new BitmapViewer.Layer(); weightLayer.Order = 10; weightLayer.Matrix = controller.StaticAnalysis.StaticForwardCrateWeighting; weightLayer.Name = "Weightings"; weightLayer.Brush = new SolidBrush(Color.FromArgb(200, Color.Pink)); weightLayer.BrushAlt = new SolidBrush(Color.FromArgb(200, Color.Red)); weightLayer.Font = new Font("Arial Narrow", 7f); bitmapViewerStatic.SetLayer(weightLayer); bitmapViewerStatic.Render(); } // Forward Tree if (controller.Strategy.EvaluationTree != null) { treeViewer.Init(controller); treeViewer.Controller = controller; treeViewer.Render(); } // Reverse Tree if (controller.ReverseStrategy != null && controller.ReverseStrategy.EvaluationTree != null) { TreeVisualisation tresVisRev = new TreeVisualisation(controller.ReverseStrategy.EvaluationTree, new RectangleInt(0, 0, 1800, 1800), new SizeInt(8, 8)); tresVisRev.Controller = controller; visualisationContainerReverseTree.Visualisation = tresVisRev; visualisationContainerReverseTree.Render(); } // Stats SolverLabelList txt = controller.Stats.GetDisplayData(); if (txt != null) { ReportXHTML reportCurrent = new ReportXHTML("Node Details"); reportCurrent.SetCSSInline(FileManager.GetContent("$html\\style.css")); reportCurrent.Add(txt.ToHTML()); htmlViewStats.SetHTML(reportCurrent.ToString()); } UpdateEvalList(); } }
public TreeVisualisationElement(TreeVisualisation owner, TreeNode<SolverNode> node) { this.owner = owner; this.node = node; }