コード例 #1
0
ファイル: Polygon.py プロジェクト: Ingener74/White-Albatross
    def draw(self, painter, scale):

        painter.save()
        painter.setPen(QPen(QBrush(QColor(232, 109, 21) if self.state is self.add_point else
                                   QColor(21, 144, 232)),
                            self.lineWidth(scale),
                            Qt.SolidLine))
        painter.drawPolygon(QPolygon(self.polygon))

        for i, poly in enumerate(self.convex_polygons):
            if poly:
                painter.setPen(QPen(QBrush(Figure.COLORS[i % len(Figure.COLORS)]),
                                    self.lineWidth(scale),
                                    Qt.SolidLine))
                color = Figure.COLORS[i % len(Figure.COLORS)]
                color.setAlpha(150)
                painter.setBrush(QBrush(QColor(color)))
                painter.drawPolygon(QPolygon(poly))

        for point in self.polygon:
            self.drawControlPoint(painter, point,
                                  QColor(31, 174, 222) if point is self.polygon[0] else
                                  QColor(222, 79, 31) if point is self.polygon[-1] else
                                  QColor(78, 222, 31), scale)

        Figure.draw(self, painter, scale)
        painter.restore()
コード例 #2
0
    def draw(self, painter, scale):
        painter.save()
        if not self.p1.isNull() and not self.p2.isNull():
            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.drawRect(QRect(self.p1, self.p2))

            self.drawControlPoint(painter, self.p1, QColor(31, 174, 222), scale)
            self.drawControlPoint(painter, self.p2, QColor(222, 79, 31), scale)

        Figure.draw(self, painter, scale)
        painter.restore()
コード例 #3
0
ファイル: Circle.py プロジェクト: Ingener74/White-Albatross
    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()
コード例 #4
0
    def draw(self, painter, scale):
        painter.save()
        if not self.p1.isNull() and not self.p2.isNull():
            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.drawRect(QRect(self.p1, self.p2))

            self.drawControlPoint(painter, self.p1, QColor(31, 174, 222),
                                  scale)
            self.drawControlPoint(painter, self.p2, QColor(222, 79, 31), scale)

        Figure.draw(self, painter, scale)
        painter.restore()
コード例 #5
0
ファイル: Circle.py プロジェクト: Ingener74/White-Albatross
    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()