def __init__(self, polygon): """构造函数 Args: polygon (DaoPolygon): 多边形对象 """ super().__init__() self.MAR = 20 self.points = polygon_base.get_qt_points(polygon.vertices) self.rect = polygon_base.get_bounding_rect(self.points) self.top_left = self.rect.topLeft() self.bottom_right = self.rect.bottomRight() self.dots_rect = self.rect self.offset = QPointF(0, 0) self.old_points = self.points self.point_id = -1
def __init__(self, polygon): """构造函数 Args: polygon (DaoPolygon): 多边形对象 """ super().__init__() self.layer = polygon.layer self.points = polygon_base.get_qt_points(polygon.vertices) if len(self.points) > 0: self.rect = polygon_base.get_bounding_rect(self.points) self.top_left = self.rect.topLeft() self.bottom_right = self.rect.topLeft() self.rect.adjust(-self.MAR, -self.MAR, self.MAR, self.MAR) else: self.top_left = QPointF(float('Inf'), float('Inf')) self.bottom_right = QPointF(-float('Inf'), -float('Inf')) self.rect = QRectF()