def draw_solution(self, painter: QPainter): tiles = self.current_best_solution.get_selected_tiles() painter.setPen(self.pens[solution_color]) painter.setBrush(self.brushes[solution_color]) scale, translation = self._get_scale_translation(False) polygons = [ Plotter.create_polygon( np.array(t.exterior.coords) * scale + translation) for t in tiles ] for p in polygons: painter.drawPolygon(p)
def draw_grid(self, scale, translation): grid_painter = QPainter(self.pixmap) grid_painter.setRenderHint(QPainter.Antialiasing) grid_painter.setRenderHint(QPainter.SmoothPixmapTransform) ############ Draw grids ############################# grid_painter.setPen(self.grid_pen) polygons = [ Plotter.create_polygon( np.array(t.tile_poly.exterior.coords) * scale + translation) for t in self.complete_graph.tiles ] for p in polygons: grid_painter.drawPolygon(p) self.need_draw_grid = False