protected override void InternalVisualize(TestCaseUI ui) { ui.Log("D = " + distance); ui.Log("V = " + v); // Горизонт ui.Line(-100, 0, 100, 0, new Pen(Color.Black, 3)); // Цель ui.Circle(50, 0, 2, new Pen(Color.Blue, 1)); if (LastException == null) { //Траектория foreach (var dot in trajectory.Where((p, i) => i%10 == 0)) ui.Dot(-50 + dot.Item1*100/distance, -dot.Item2*100/distance, Color.Red); ui.Circle(-50, 0, 1, new Pen(Color.Black, 5)); if (trajectory.Any()) { // Пушка ui.Line(-50, 0, -50 + 10 * Math.Cos(angle), -10 * Math.Sin(angle), new Pen(Color.Black, 3)); ui.Log("Угол прицеливания: " + 180 * angle / Math.PI + "°"); ui.Log("Высота над целью = " + trajectory.Last().Item2); ui.Log("Время снаряда в полете = " + time); } } }
public static void DrawFigure(TestCaseUI ui) { ui.Line(-50, -10, -50, 10, TestCase.neutralPen); ui.Line(50, -10, 50, 10, TestCase.neutralPen); ui.Line(-50, 10, 0, 60, TestCase.neutralPen); ui.Line(50, 10, 0, 60, TestCase.neutralPen); ui.Arc(0, -10, 50, 180, 180, TestCase.neutralPen); }
protected override void InternalVisualize(TestCaseUI ui) { ui.Log("Wall inclanation: " + ToGradus(wallInclanation)); ui.Log("Direction: " + ToGradus(initialDirection)); ui.Line(-100 * Math.Cos(wallInclanation), 100 * Math.Sin(wallInclanation), 100 * Math.Cos(wallInclanation), -100 * Math.Sin(wallInclanation), new Pen(Color.Black, 1)); ui.Line(-50 * Math.Cos(initialDirection), 50 * Math.Sin(initialDirection), 0, 0, new Pen(Color.Red, 3)); ui.Line(50 * Math.Cos(angle), -50 * Math.Sin(angle), 0, 0, new Pen(Color.Red, 3) { DashStyle = DashStyle.Dash }); ui.Line(50 * Math.Cos(expectedFinalDirection), -50 * Math.Sin(expectedFinalDirection), 0, 0, new Pen(Color.Green, 1) { DashStyle = DashStyle.Dash }); }
private void DrawWall(TestCaseUI ui, int x, int y) { var x1 = x*cellSize - 100; var y1 = y*cellSize - 100; var x2 = (x + 1) * cellSize - 101; var y2 = (y + 1) * cellSize - 101; ui.Rect(new Rectangle(x1, y1, cellSize, cellSize), neutralPen); ui.Line(x1, y1, x2, y2, neutralPen); ui.Line(x1, y2, x2, y1, neutralPen); }
protected override void InternalVisualize(TestCaseUI ui) { ui.Rect(r1, neutralPen); ui.Rect(r2, neutralPen); ui.Log("r1: {0}", r1); ui.Log("r2: {0}", r2); ui.Log("Solution: "); ui.Log(" intersected: {0} {1}", intersectedAnswer, intersected != intersectedAnswer ? "wrong!" : ""); ui.Log(" intersection square: {0} {1}", intersectionSquareAnswer, intersectionSquare != intersectionSquareAnswer ? "wrong!" : ""); ui.Log(" index of inner rectangle: {0} {1}", indexOfInnerRectAnswer, indexOfInnerRectangle != indexOfInnerRectAnswer ? "wrong!" : ""); }
public void Visualize(TestCaseUI ui) { if (LastResult == TestResult.OK) ui.Log("Success!"); if (LastResult == TestResult.Failed) ui.Log("Failed..."); InternalVisualize(ui); if (LastException != null) { ui.Log(""); ui.Log(LastException.ToString()); } }
private void Visualize(TestCase testCase) { ClearTestCaseView(); using (Graphics g = Graphics.FromImage(bitmap)) { Brush brush = testCase.LastResult == TestResult.OK ? Brushes.Aquamarine : (testCase.LastResult == TestResult.Failed ? Brushes.LightPink : Brushes.LightGoldenrodYellow); g.FillRectangle(brush, 0, 0, bitmap.Width, bitmap.Height); } using (var ui = new TestCaseUI(bitmap, logTextBox)) testCase.Visualize(ui); pictureContainer.Invalidate(); }
protected override void InternalVisualize(TestCaseUI ui) { for (int x = 0; x < maze.Size.Width; x++) for (int y = 0; y < maze.Size.Height; y++) if (maze.IsWall(new Point(x, y))) DrawWall(ui, x, y); Point last = maze.Robot; foreach (var cur in robot.Path) { ui.Line(Conv(last.X), Conv(last.Y), Conv(cur.X), Conv(cur.Y), actualAnswerPen); last = cur; } ui.Circle(Conv(robot.X), Conv(robot.Y), cellSize / 3.0, actualAnswerPen); ui.Circle(Conv(maze.Exit.X), Conv(maze.Exit.Y), cellSize / 2.5, expectedAnswerPen); }
public void Visualize(TestCaseUI ui) { if (LastResult == TestResult.OK) { ui.Log("Success!"); } if (LastResult == TestResult.Failed) { ui.Log("Failed..."); } InternalVisualize(ui); if (LastException != null) { ui.Log(""); ui.Log(LastException.ToString()); } }
protected override void InternalVisualize(TestCaseUI ui) { ui.Line(-100, 0, 100, 0, neutralThinPen); ui.Line(0, -100, 0, 100, neutralThinPen); ui.Line(a.X, a.Y, b.X, b.Y, neutralPen); ui.Circle(a.X, a.Y, 1, neutralPen); ui.Circle(b.X, b.Y, 1, neutralPen); ui.Circle(x.X, x.Y, 3, neutralPen); ui.Circle(x.X, x.Y, answer, new Pen(actualAnswerPen.Color, 1) { DashStyle = DashStyle.Custom, DashPattern = new float[] { 4, 4 } }); ui.Log("A = " + a); ui.Log("B = " + b); ui.Log("X = " + x); ui.Log("Expected distance " + distance); ui.Log("Calculated distance: {0}", answer); }
protected override void InternalVisualize(TestCaseUI ui) { ui.Line(-100, 0, 100, 0, neutralThinPen); ui.Line(0, -100, 0, 100, neutralThinPen); FigureShape.DrawFigure(ui); ui.Line(50, -10, 50, 10, neutralPen); ui.Line(-50, 10, 0, 60, neutralPen); ui.Line(50, 10, 0, 60, neutralPen); ui.Arc(0, -10, 50, 180, 180, neutralPen); ui.Circle(x, y, 1, neutralPen); ui.Circle(x, y, answer, new Pen(actualAnswerPen.Color, 1) {DashStyle = DashStyle.Custom, DashPattern = new float[]{4, 4}}); ui.Circle(x, y, distance, new Pen(expectedAnswerPen.Color, 1) {DashStyle = DashStyle.Custom, DashPattern = new float[]{4, 4}}); ui.Log("Point: ({0}, {1})", x, y); ui.Log("Calculated distance: {0}", answer); }
protected abstract void InternalVisualize(TestCaseUI ui);
protected override void InternalVisualize(TestCaseUI ui) { ui.Circle(0, 0, 10, Pens.Red); }