当前位置: 首页>>代码示例>>Python>>正文


Python QwtPainter.drawPolyline方法代码示例

本文整理汇总了Python中qwt.painter.QwtPainter.drawPolyline方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPainter.drawPolyline方法的具体用法?Python QwtPainter.drawPolyline怎么用?Python QwtPainter.drawPolyline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qwt.painter.QwtPainter的用法示例。


在下文中一共展示了QwtPainter.drawPolyline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: drawSteps

# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawPolyline [as 别名]
 def drawSteps(self, painter, xMap, yMap, canvasRect, from_, to):
     doAlign = QwtPainter.roundingAlignment(painter)
     polygon = QPolygonF(2*(to-from_)+1)
     inverted = self.orientation() == Qt.Vertical
     if self.__data.attributes & self.Inverted:
         inverted = not inverted
     series = self.data()
     ip = 0
     for i in range(from_, to+1):
         sample = series.sample(i)
         xi = xMap.transform(sample.x())
         yi = yMap.transform(sample.y())
         if doAlign:
             xi = round(xi)
             yi = round(yi)
         if ip > 0:
             p0 = polygon[ip-2]
             if inverted:
                 polygon[ip-1] = QPointF(p0.x(), yi)
             else:
                 polygon[ip-1] = QPointF(xi, p0.y())
         polygon[ip] = QPointF(xi, yi)
         ip += 2
     if self.__data.paintAttributes & self.ClipPolygons:
         clipped = QwtClipper().clipPolygonF(canvasRect, polygon, False)
         QwtPainter.drawPolyline(painter, clipped)
     else:
         QwtPainter.drawPolyline(painter, polygon)
     if self.__data.brush.style() != Qt.NoBrush:
         self.fillCurve(painter, xMap, yMap, canvasRect, polygon)
开发者ID:petebachant,项目名称:python-qwt,代码行数:32,代码来源:plot_curve.py

示例2: drawSteps

# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawPolyline [as 别名]
 def drawSteps(self, painter, xMap, yMap, canvasRect, from_, to):
     """
     Draw steps
     
     :param QPainter painter: Painter
     :param qwt.scale_map.QwtScaleMap xMap: Maps x-values into pixel coordinates.
     :param qwt.scale_map.QwtScaleMap yMap: Maps y-values into pixel coordinates.
     :param QRectF canvasRect: Contents rectangle of the canvas
     :param int from_: Index of the first point to be painted
     :param int to: Index of the last point to be painted. If to < 0 the curve will be painted to its last point.
     
     .. seealso::
     
         :py:meth:`draw()`, :py:meth:`drawSticks()`, 
         :py:meth:`drawDots()`, :py:meth:`drawLines()`
     """
     doAlign = QwtPainter.roundingAlignment(painter)
     polygon = QPolygonF(2*(to-from_)+1)
     inverted = self.orientation() == Qt.Vertical
     if self.__data.attributes & self.Inverted:
         inverted = not inverted
     series = self.data()
     ip = 0
     for i in range(from_, to+1):
         sample = series.sample(i)
         xi = xMap.transform(sample.x())
         yi = yMap.transform(sample.y())
         if doAlign:
             xi = round(xi)
             yi = round(yi)
         if ip > 0:
             p0 = polygon[ip-2]
             if inverted:
                 polygon[ip-1] = QPointF(p0.x(), yi)
             else:
                 polygon[ip-1] = QPointF(xi, p0.y())
         polygon[ip] = QPointF(xi, yi)
         ip += 2
     if self.__data.paintAttributes & self.ClipPolygons:
         clipped = QwtClipper().clipPolygonF(canvasRect, polygon, False)
         QwtPainter.drawPolyline(painter, clipped)
     else:
         QwtPainter.drawPolyline(painter, polygon)
     if self.__data.brush.style() != Qt.NoBrush:
         self.fillCurve(painter, xMap, yMap, canvasRect, polygon)
开发者ID:gyenney,项目名称:Tools,代码行数:47,代码来源:plot_curve.py

示例3: drawLines

# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawPolyline [as 别名]
 def drawLines(self, painter, xMap, yMap, canvasRect, from_, to):
     """
     Draw lines
     
     :param QPainter painter: Painter
     :param qwt.scale_map.QwtScaleMap xMap: Maps x-values into pixel coordinates.
     :param qwt.scale_map.QwtScaleMap yMap: Maps y-values into pixel coordinates.
     :param QRectF canvasRect: Contents rectangle of the canvas
     :param int from_: Index of the first point to be painted
     :param int to: Index of the last point to be painted. If to < 0 the curve will be painted to its last point.
     
     .. seealso::
     
         :py:meth:`draw()`, :py:meth:`drawDots()`, 
         :py:meth:`drawSteps()`, :py:meth:`drawSticks()`
     """
     if from_ > to:
         return
     doAlign = QwtPainter.roundingAlignment(painter)
     doFill = self.__data.brush.style() != Qt.NoBrush\
              and self.__data.brush.color().alpha() > 0
     clipRect = QRectF()
     if self.__data.paintAttributes & self.ClipPolygons:
         pw = max([1., painter.pen().widthF()])
         clipRect = canvasRect.adjusted(-pw, -pw, pw, pw)
     doIntegers = False
     if QT_VERSION < 0x040800:
         if painter.paintEngine().type() == QPaintEngine.Raster:
             if not doFill:
                 doIntegers = True
     noDuplicates = self.__data.paintAttributes & self.FilterPoints
     mapper = QwtPointMapper()
     mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
     mapper.setFlag(QwtPointMapper.WeedOutPoints, noDuplicates)
     mapper.setBoundingRect(canvasRect)
     if doIntegers:
         polyline = mapper.toPolygon(xMap, yMap, self.data(), from_, to)
         if self.__data.paintAttributes & self.ClipPolygons:
             polyline = QwtClipper().clipPolygon(clipRect.toAlignedRect(),
                                                polyline, False)
         QwtPainter.drawPolyline(painter, polyline)
     else:
         polyline = mapper.toPolygonF(xMap, yMap, self.data(), from_, to)
         if doFill:
             if painter.pen().style() != Qt.NoPen:
                 filled = QPolygonF(polyline)
                 self.fillCurve(painter, xMap, yMap, canvasRect, filled)
                 filled.clear()
                 if self.__data.paintAttributes & self.ClipPolygons:
                     polyline = QwtClipper().clipPolygonF(clipRect,
                                                          polyline, False)
                 QwtPainter.drawPolyline(painter, polyline)
             else:
                 self.fillCurve(painter, xMap, yMap, canvasRect, polyline)
         else:
             if self.__data.paintAttributes & self.ClipPolygons:
                 polyline = QwtClipper().clipPolygonF(clipRect, polyline,
                                                      False)
             QwtPainter.drawPolyline(painter, polyline)
开发者ID:gyenney,项目名称:Tools,代码行数:61,代码来源:plot_curve.py

示例4: drawLines

# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawPolyline [as 别名]
 def drawLines(self, painter, xMap, yMap, canvasRect, from_, to):
     if from_ > to:
         return
     doAlign = QwtPainter.roundingAlignment(painter)
     doFit = (self.__data.attributes & self.Fitted)\
             and self.__data.curveFitter
     doFill = self.__data.brush.style() != Qt.NoBrush\
              and self.__data.brush.color().alpha() > 0
     clipRect = QRectF()
     if self.__data.paintAttributes & self.ClipPolygons:
         pw = max([1., painter.pen().widthF()])
         clipRect = canvasRect.adjusted(-pw, -pw, pw, pw)
     doIntegers = False
     if QT_VERSION < 0x040800:
         if painter.paintEngine().type() == QPaintEngine.Raster:
             if not doFit and not doFill:
                 doIntegers = True
     noDuplicates = self.__data.paintAttributes & self.FilterPoints
     mapper = QwtPointMapper()
     mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
     mapper.setFlag(QwtPointMapper.WeedOutPoints, noDuplicates)
     mapper.setBoundingRect(canvasRect)
     if doIntegers:
         polyline = mapper.toPolygon(xMap, yMap, self.data(), from_, to)
         if self.__data.paintAttributes & self.ClipPolygons:
             polyline = QwtClipper().clipPolygon(clipRect.toAlignedRect(),
                                                polyline, False)
         QwtPainter.drawPolyline(painter, polyline)
     else:
         polyline = mapper.toPolygonF(xMap, yMap, self.data(), from_, to)
         if doFit:
             polyline = self.__data.curveFitter.fitCurve(polyline)
         if doFill:
             if painter.pen().style() != Qt.NoPen:
                 filled = QPolygonF(polyline)
                 self.fillCurve(painter, xMap, yMap, canvasRect, filled)
                 filled.clear()
                 if self.__data.paintAttributes & self.ClipPolygons:
                     polyline = QwtClipper().clipPolygonF(clipRect,
                                                          polyline, False)
                 QwtPainter.drawPolyline(painter, polyline)
             else:
                 self.fillCurve(painter, xMap, yMap, canvasRect, polyline)
         else:
             if self.__data.paintAttributes & self.ClipPolygons:
                 polyline = QwtClipper().clipPolygonF(clipRect, polyline,
                                                      False)
             QwtPainter.drawPolyline(painter, polyline)
开发者ID:petebachant,项目名称:python-qwt,代码行数:50,代码来源:plot_curve.py


注:本文中的qwt.painter.QwtPainter.drawPolyline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。