예제 #1
0
파일: plot_curve.py 프로젝트: gyenney/Tools
 def drawDots(self, painter, xMap, yMap, canvasRect, from_, to):
     """
     Draw dots
     
     :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:`drawSteps()`, :py:meth:`drawLines()`
     """
     color = painter.pen().color()
     if painter.pen().style() == Qt.NoPen or color.alpha() == 0:
         return
     doFill = self.__data.brush.style() != Qt.NoBrush\
              and self.__data.brush.color().alpha() > 0
     doAlign = QwtPainter.roundingAlignment(painter)
     mapper = QwtPointMapper()
     mapper.setBoundingRect(canvasRect)
     mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
     if self.__data.paintAttributes & self.FilterPoints:
         if color.alpha() == 255\
            and not (painter.renderHints() & QPainter.Antialiasing):
             mapper.setFlag(QwtPointMapper.WeedOutPoints, True)
     if doFill:
         mapper.setFlag(QwtPointMapper.WeedOutPoints, False)
         points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
         QwtPainter.drawPoints(painter, points)
         self.fillCurve(painter, xMap, yMap, canvasRect, points)
     elif self.__data.paintAttributes & self.ImageBuffer:
         image = mapper.toImage(
             xMap, yMap, self.data(), from_, to, self.__data.pen,
             painter.testRenderHint(QPainter.Antialiasing))
         painter.drawImage(canvasRect.toAlignedRect(), image)
     else:
         if doAlign:
             points = mapper.toPoints(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
         else:
             points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
예제 #2
0
파일: plot_curve.py 프로젝트: gyenney/Tools
 def drawDots(self, painter, xMap, yMap, canvasRect, from_, to):
     """
     Draw dots
     
     :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:`drawSteps()`, :py:meth:`drawLines()`
     """
     color = painter.pen().color()
     if painter.pen().style() == Qt.NoPen or color.alpha() == 0:
         return
     doFill = self.__data.brush.style() != Qt.NoBrush\
              and self.__data.brush.color().alpha() > 0
     doAlign = QwtPainter.roundingAlignment(painter)
     mapper = QwtPointMapper()
     mapper.setBoundingRect(canvasRect)
     mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
     if self.__data.paintAttributes & self.FilterPoints:
         if color.alpha() == 255\
            and not (painter.renderHints() & QPainter.Antialiasing):
             mapper.setFlag(QwtPointMapper.WeedOutPoints, True)
     if doFill:
         mapper.setFlag(QwtPointMapper.WeedOutPoints, False)
         points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
         QwtPainter.drawPoints(painter, points)
         self.fillCurve(painter, xMap, yMap, canvasRect, points)
     elif self.__data.paintAttributes & self.ImageBuffer:
         image = mapper.toImage(xMap, yMap, self.data(), from_, to,
                            self.__data.pen,
                            painter.testRenderHint(QPainter.Antialiasing))
         painter.drawImage(canvasRect.toAlignedRect(), image)
     else:
         if doAlign:
             points = mapper.toPoints(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
         else:
             points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
예제 #3
0
 def drawDots(self, painter, xMap, yMap, canvasRect, from_, to):
     color = painter.pen().color()
     if painter.pen().style() == Qt.NoPen or color.alpha() == 0:
         return
     doFill = self.__data.brush.style() != Qt.NoBrush\
              and self.__data.brush.color().alpha() > 0
     doAlign = QwtPainter.roundingAlignment(painter)
     mapper = QwtPointMapper()
     mapper.setBoundingRect(canvasRect)
     mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
     if self.__data.paintAttributes & self.FilterPoints:
         if color.alpha() == 255\
            and not (painter.renderHints() & QPainter.Antialiasing):
             mapper.setFlag(QwtPointMapper.WeedOutPoints, True)
     if doFill:
         mapper.setFlag(QwtPointMapper.WeedOutPoints, False)
         points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
         QwtPainter.drawPoints(painter, points)
         self.fillCurve(painter, xMap, yMap, canvasRect, points)
     elif self.__data.paintAttributes & self.ImageBuffer:
         image = mapper.toImage(xMap, yMap, self.data(), from_, to,
                         self.__data.pen,
                         painter.testRenderHint(QPainter.Antialiasing),
                         self.renderThreadCount())
         painter.drawImage(canvasRect.toAlignedRect(), image)
     elif self.__data.paintAttributes & self.MinimizeMemory:
         series = self.data()
         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)
             QwtPainter.drawPoint(painter, QPointF(xi, yi))
     else:
         if doAlign:
             points = mapper.toPoints(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
         else:
             points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
예제 #4
0
 def drawDots(self, painter, xMap, yMap, canvasRect, from_, to):
     color = painter.pen().color()
     if painter.pen().style() == Qt.NoPen or color.alpha() == 0:
         return
     doFill = self.__data.brush.style() != Qt.NoBrush\
              and self.__data.brush.color().alpha() > 0
     doAlign = QwtPainter.roundingAlignment(painter)
     mapper = QwtPointMapper()
     mapper.setBoundingRect(canvasRect)
     mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
     if self.__data.paintAttributes & self.FilterPoints:
         if color.alpha() == 255\
            and not (painter.renderHints() & QPainter.Antialiasing):
             mapper.setFlag(QwtPointMapper.WeedOutPoints, True)
     if doFill:
         mapper.setFlag(QwtPointMapper.WeedOutPoints, False)
         points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
         QwtPainter.drawPoints(painter, points)
         self.fillCurve(painter, xMap, yMap, canvasRect, points)
     elif self.__data.paintAttributes & self.ImageBuffer:
         image = mapper.toImage(
             xMap, yMap, self.data(), from_, to, self.__data.pen,
             painter.testRenderHint(QPainter.Antialiasing),
             self.renderThreadCount())
         painter.drawImage(canvasRect.toAlignedRect(), image)
     elif self.__data.paintAttributes & self.MinimizeMemory:
         series = self.data()
         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)
             QwtPainter.drawPoint(painter, QPointF(xi, yi))
     else:
         if doAlign:
             points = mapper.toPoints(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)
         else:
             points = mapper.toPointsF(xMap, yMap, self.data(), from_, to)
             QwtPainter.drawPoints(painter, points)