def draw(self, painter, scale): painter.save() if not self.center.isNull() and not self.ctrl.isNull(): radius = distance(self.center, self.ctrl) painter.setPen(QPen(QBrush(QColor(232, 109, 21) if self.state is not self.control else QColor(21, 144, 232)), self.lineWidth(scale), Qt.SolidLine)) painter.setBrush(QBrush(QColor(21, 144, 232, 150))) painter.drawEllipse(self.center, radius, radius) self.drawControlPoint(painter, self.center, QColor(31, 174, 222), scale) self.drawControlPoint(painter, self.ctrl, QColor(222, 79, 31), scale) Figure.draw(self, painter, scale) painter.restore()
def draw(self, painter, scale): painter.save() if not self.center.isNull() and not self.ctrl.isNull(): radius = distance(self.center, self.ctrl) painter.setPen( QPen( QBrush( QColor(232, 109, 21) if self.state is not self. control else QColor(21, 144, 232)), self.lineWidth(scale), Qt.SolidLine)) painter.setBrush(QBrush(QColor(21, 144, 232, 150))) painter.drawEllipse(self.center, radius, radius) self.drawControlPoint(painter, self.center, QColor(31, 174, 222), scale) self.drawControlPoint(painter, self.ctrl, QColor(222, 79, 31), scale) Figure.draw(self, painter, scale) painter.restore()
def __repr__(self): return 'Circle(({x}, {y}), {radius})'.format(x=self.center.x(), y=self.center.y(), radius=distance(self.center, self.ctrl))
def __repr__(self): return 'Circle(({x}, {y}), {radius})'.format(x=self.center.x(), y=self.center.y(), radius=distance( self.center, self.ctrl))