Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)