From e41eeabc7637d989d7ad5a5946cb6b59e3b0e68f Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Mon, 10 Jul 2017 13:56:22 +0200 Subject: [PATCH] Closedown --- script/test/TestLayout.py | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/script/test/TestLayout.py b/script/test/TestLayout.py index 2da2ebe..7cf914b 100644 --- a/script/test/TestLayout.py +++ b/script/test/TestLayout.py @@ -1,8 +1,9 @@ from plotutils import * -def plot_base_plate(title = None): +def plot_base_plate(points = None, title = None): colors = (Color.RED, Color.BLUE, Color.MAGENTA, Color(128,0,128), Color(0,128,0), Color(255,128,0)) p = plot(None, title=title)[0] + plot_circle(p, 0, 0, PLATE_SIZE/2, width = 0, color = Color.GRAY, name = "Plate") plot_point(p, 0, 0, size = 10, color = Color.GRAY, name = "Center") #p.setLegendVisible(True) for block in get_blocks(): @@ -26,30 +27,22 @@ def plot_base_plate(title = None): plot_circle(p, xm, ym, LED_TOLERANCE, width = 0, color = r.color, name = str(puck.number)+"mc") p.addText((xu+xm)/2, (yu+ym)/2, str(puck.number), r.color) plot_circle(p, xm, ym, PUCK_SIZE/2, width = 0, color = Color.GRAY, name = str(puck.number)) - - -def plot_cross(plot, x, y, size = 3, width = 1, color = None, name = "Cross"): - s = LinePlotSeries(name, color) - plot.addSeries(s) - s.setLineWidth(width) - s.setPointsVisible(False) - s.appendData(x-size/2, y) - s.appendData(x+size/2, y) - s.appendData(float('nan'), float('nan')) - s.appendData(x, y-size/2) - s.appendData(x, y+size/2) - return s - -def plot_detected_leds(points): - for point in points: - plot_cross(p,point[0], point[1], size = 5, width = 1, color = Color.BLACK, name = "P"+ str(points().index(point))) - #plot_point(p, xu, yu, size = 8, color = Color.BLACK, name = str(puck.number)+"u") + if points is not None: + for point in points: + c = Color.GRAY + for puck in get_pucks(): + if puck.match(point[0], point[1]) is not None: + c = Color.BLACK + plot_cross(p,point[0], point[1], size = 10, width = 1, color = c, name = "P"+ str(points.index(point))) + #plot_point(p,point[0], point[1], size = 5, color = Color.BLACK, name = "Pc"+ str(points.index(point))) -plot_base_plate() + +points = [(100, 140), (130, 77), (120, 130), (110, 100)] +plot_base_plate(points) -points = [(100, 140), (120, 77), (120, 130), (110, 100))] -plot_detected_leds(points) + +#plot_detected_leds(points) \ No newline at end of file