internal DebugWindow(ParkingSolver solver) : this() { this.solver = solver; int layerCount = (int)Math.Ceiling(360 / solver.OrientationTolerance / 2); layerScrollBar.Maximum = layerCount - 1; //layerScrollBar.LargeChange =Math.Ceiling( layerCount/10.0); //layerScrollBar.ViewportSize = layerCount; for (int i = 0; i < layerCount; i++) { Color c = Gqqnbig.Drawing.ColorConversion.HslToRgb((i * 120) % 360, 1, 0.5); Brush brush = new SolidColorBrush(c); GridLayer l = new GridLayer(new Pen(brush, 0.5), solver.Map.Size, solver.DistanceTolerance); l.Visibility = System.Windows.Visibility.Collapsed; l.Width = solver.Map.Size.Width; l.Height = solver.Map.Size.Height; l.VerticalAlignment = VerticalAlignment.Top; l.HorizontalAlignment = HorizontalAlignment.Left; grid.Children.Add(l); } }
void ReadState() { foreach (GridLayer layer in grid.Children) { layer.InitDrawing(); //layer.SetPoint(100, 300); } int x = (int)((int)(solver.EndPoint.X / solver.DistanceTolerance) * solver.DistanceTolerance); int y = (int)((int)(solver.EndPoint.Y / solver.DistanceTolerance) * solver.DistanceTolerance); int z = (int)(solver.EndOrientation / solver.OrientationTolerance / 2); ((GridLayer)grid.Children[z]).SetPoint(x, y, false); foreach (ParkingSolver.Node node in solver.Open_List) { x = (int)((int)(node.Position.X / solver.DistanceTolerance) * solver.DistanceTolerance); y = (int)((int)(node.Position.Y / solver.DistanceTolerance) * solver.DistanceTolerance); z = (int)(node.Position.Z / solver.OrientationTolerance / 2); GridLayer layer = (GridLayer)grid.Children[z]; layer.SetPoint(x, y); } foreach (List <ParkingSolver.Node> sublist in solver.Close_List) { foreach (ParkingSolver.Node node in sublist) { x = (int)((int)(node.Position.X / solver.DistanceTolerance) * solver.DistanceTolerance); y = (int)((int)(node.Position.Y / solver.DistanceTolerance) * solver.DistanceTolerance); z = (int)(node.Position.Z / solver.OrientationTolerance / 2); GridLayer layer = (GridLayer)grid.Children[z]; layer.SetPoint(x, y, false); } } foreach (GridLayer layer in grid.Children) { layer.EndDrawing(); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { for (int i = 0; i < grid.Children.Count; i++) { GridLayer gridLayer = (GridLayer)grid.Children[i]; gridLayer.RenderTransform = new SkewTransform(-30, 0, 0, solver.Map.Size.Height); } //layerScrollBar.Track.Thumb.Height = 50; //layerScrollBar.Track.Thumb.Height = layerScrollBar.Track.ActualHeight / layerScrollBar.Maximum * 10; //if (layerScrollBar.Track.Thumb.Height < 10) // layerScrollBar.Track.Thumb.Height = 10; //layerCanvas.Width = solver.Map.Size.Width; //layerCanvas.Height = solver.Map.Size.Height; //for (double i = 0; i < layerCanvas.Width; i+=solver.DistanceTolerance) //{ // Line l = new Line(); // l.Stroke = Brushes.Black; // l.StrokeThickness = 0.1; // l.X1 = i; // l.Y1 = 0; // l.X2 = i; // l.Y2 = layerCanvas.Height; // layerCanvas.Children.Add(l); //} //for (double j = 0; j < layerCanvas.Height; j += solver.DistanceTolerance) //{ // Line l = new Line(); // l.Stroke = Brushes.Black; // l.StrokeThickness = 0.1; // l.X1 = 0; // l.Y1 = j; // l.X2 = layerCanvas.Width; // l.Y2 = j; // layerCanvas.Children.Add(l); //} }