def scene_create_lines_for_cp(self, cp: ControlPoint, playerColor, enemyColor): scene = self.scene() pos = self._transform_point(cp.position) for connected_cp in cp.connected_points: pos2 = self._transform_point(connected_cp.position) if not cp.captured: color = CONST.COLORS["dark_"+enemyColor] elif cp.captured: color = CONST.COLORS["dark_"+playerColor] else: color = CONST.COLORS["dark_"+enemyColor] pen = QPen(brush=color) pen.setColor(color) pen.setWidth(6) if cp.captured and not connected_cp.captured and Conflict.has_frontline_between(cp, connected_cp): if not cp.captured: scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen) else: posx, h = Conflict.frontline_position(self.game.theater, cp, connected_cp) pos2 = self._transform_point(posx) scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen) p1 = point_from_heading(pos2[0], pos2[1], h+180, 25) p2 = point_from_heading(pos2[0], pos2[1], h, 25) frontline_pen = QPen(brush=CONST.COLORS["bright_red"]) frontline_pen.setColor(CONST.COLORS["orange"]) frontline_pen.setWidth(8) scene.addLine(p1[0], p1[1], p2[0], p2[1], pen=frontline_pen) else: scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen)
def draw_frontline_approximation(self, frontline: FrontLine, scene: QGraphicsScene, pen: QPen) -> None: posx = frontline.position h = frontline.attack_heading pos2 = self._transform_point(posx) self.draw_bezier_frontline(scene, pen, frontline) p1 = point_from_heading(pos2[0], pos2[1], h + 180, 25) p2 = point_from_heading(pos2[0], pos2[1], h, 25) scene.addItem( QFrontLine(p1[0], p1[1], p2[0], p2[1], frontline, self.game_model))