QPlot2D.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:KerbalPie 作者: Vivero 项目源码 文件源码
def _assemble_plot(self, qpainter):
        qpainter.save()
        #---

        # draw bounding box
        qpainter.setPen(self._bbox_pen)
        qpainter.setBrush(self._bbox_brush)
        qpainter.drawRect(self._bbox_rect)

        # x-axis
        qpainter.setFont(self._labelFont)
        qpainter.setPen(self._axes_tick_pen)
        qpainter.setBrush(self._axes_tick_brush)
        for tick_line in self._xaxis_ticks:
            qpainter.drawLine(tick_line)

        for i in range(len(self._xaxis_ticks_text)):
            qpainter.drawText(self._xaxis_ticks_text_rect[i], Qt.AlignVCenter | Qt.AlignHCenter, self._xaxis_ticks_text[i])

        # y-axis
        for tick_line in self._yaxis_ticks:
            qpainter.drawLine(tick_line)

        for i in range(len(self._yaxis_ticks_text)):
            qpainter.drawText(self._yaxis_ticks_text_rect[i], Qt.AlignVCenter | Qt.AlignHCenter, self._yaxis_ticks_text[i])

        # x-axis origin
        qpainter.setPen(self._axes_origin_pen)
        qpainter.setBrush(self._axes_origin_brush)
        if self._xaxis_origin_x > self._bbox_x0 and self._xaxis_origin_x < self._bbox_x1:
            qpainter.drawLine(self._xaxis_origin_line)

        # y-axis origin
        if self._yaxis_origin_y > self._bbox_y0 and self._yaxis_origin_y < self._bbox_y1:
            qpainter.drawLine(self._yaxis_origin_line)

        # draw plots
        for plot_key in self._plot_points.keys():
            qpainter.setPen(self._plot_pens[plot_key])
            qpainter.setBrush(QBrush(Qt.NoBrush))

            if self._plot_draw_method[plot_key] == 'line' and len(self._plot_points[plot_key]) > 1:
                qpainter.drawPolyline(QPolygonF(self._plot_points[plot_key]))

            else:
                for plot_point in self._plot_points[plot_key]:
                    qpainter.drawPoint(plot_point)


        #---
        qpainter.restore()



    # G E T T E R S   /   S E T T E R S 
    #===========================================================================
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号