Exemplo n.º 1
0
/*!
  \brief Draw the line part (without symbols) of a curve interval.
  \param painter Painter
  \param style curve style, see QwtPlotCurve::CurveStyle
  \param xMap x map
  \param yMap y map
  \param canvasRect Contents rectangle of the canvas
  \param from index of the first point to be painted
  \param to index of the last point to be painted
  \sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
*/
void QwtPlotCurve::drawCurve( QPainter *painter, int style,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect, int from, int to ) const
{
    switch ( style )
    {
        case Lines:
            if ( testCurveAttribute( Fitted ) )
            {
                // we always need the complete
                // curve for fitting
                from = 0;
                to = dataSize() - 1;
            }
            drawLines( painter, xMap, yMap, canvasRect, from, to );
            break;
        case Sticks:
            drawSticks( painter, xMap, yMap, canvasRect, from, to );
            break;
        case Steps:
            drawSteps( painter, xMap, yMap, canvasRect, from, to );
            break;
        case Dots:
            drawDots( painter, xMap, yMap, canvasRect, from, to );
            break;
        case NoCurve:
        default:
            break;
    }
}
Exemplo n.º 2
0
void QwtCurve::drawCurve(QPainter *painter, int style,
    const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to)
{
    switch (style)
    {
        case NoCurve:
            break;
        case Lines:
            drawLines(painter, xMap, yMap, from, to);
            break;
        case Sticks:
            drawSticks(painter, xMap, yMap, from, to);
            break;
        case Steps:
            drawSteps(painter, xMap, yMap, from, to);
            break;
        case Spline:
            if ( from > 0 || to < dataSize() - 1 )
                drawLines(painter, xMap, yMap, from, to);
            else
                drawSpline(painter, xMap, yMap);
            break;
        case Dots:
            drawDots(painter, xMap, yMap, from, to);
            break;
        default:
            break;
    }
}
/*!
  \brief Draw the line part (without symbols) of a curve interval.
  \param painter Painter
  \param style curve style, see QwtPlotCurve::CurveStyle
  \param xMap x map
  \param yMap y map
  \param canvasRect Contents rectangle of the canvas
  \param from index of the first point to be painted
  \param to index of the last point to be painted
  \sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
*/
void QwtPlotCurve::drawCurve( QPainter *painter, int style,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect, int from, int to ) const
{
    switch ( style )
    {
        case Lines:
            if ( testCurveAttribute( Fitted ) )
            {
                // we always need the complete
                // curve for fitting
                from = 0;
                to = dataSize() - 1;
            }
            drawLines( painter, xMap, yMap, canvasRect, from, to );
            break;
        case Sticks:
            drawSticks( painter, xMap, yMap, canvasRect, from, to );
            break;
        case Steps:
            drawSteps( painter, xMap, yMap, canvasRect, from, to );
            break;
        case Dots:
            drawDots( painter, xMap, yMap, canvasRect, from, to );
            break;
        case LinesAndDots:
            {
                 if ( testCurveAttribute( Fitted ) )
                 {
                     from = 0;
                     to = dataSize() - 1;
                 }
                 drawLines( painter, xMap, yMap, canvasRect, from, to );

                 QPen prev_pen = painter->pen();
                 QPen new_pen  = prev_pen;
                 new_pen.setWidth( prev_pen.width() * 3);

                 painter->setPen( new_pen );
                 drawDots( painter, xMap, yMap, canvasRect, from, to );
                 painter->setPen( prev_pen );
             }
            break;
        case NoCurve:
        default:
            break;
    }
}
Exemplo n.º 4
0
/**
 * Draws the curve efficiently.
 * @param painter Painter
 * @param xMap Maps x-values into pixel coordinates.
 * @param yMap Maps y-values into pixel coordinates.
 * @param canvasRect Contents rect of the canvas in painter coordinates
 */
void FunctionCurve::drawObject(QPainter *painter, 
  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
  const QRect &canvasRect) const
{
  painter->save();
  QPen p = pen();
  //painter->setRenderHint(QPainter::Antialiasing);
  //p.setJoinStyle(Qt::RoundJoin);
  //p.setCapStyle(Qt::RoundCap);
  painter->setPen(p);
  switch( m_curveStyle )
  {
  case NoCurve: drawNoCurve(painter, xMap, yMap, canvasRect); break;
  case Lines: drawLines(painter, xMap, yMap, canvasRect); break;
  case Sticks: drawSticks(painter, xMap, yMap, canvasRect); break;
  case Steps: drawSteps(painter, xMap, yMap, canvasRect); break;
  case Dots: drawDots(painter, xMap, yMap, canvasRect); break;
  default: drawLines(painter, xMap, yMap, canvasRect); break;
  };
  painter->restore();
}
Exemplo n.º 5
0
void QwtPlotCurve::drawCurve(QPainter *painter, int style,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    int from, int to) const
{
	const int numPoints = (int)dataSize();
	if (!painter || numPoints < 1)
		return;

	if (to < 0 || to >= numPoints)
		to = numPoints - 1;

    switch (style)
    {
        case Lines:
            if ( testCurveAttribute(Fitted) )
            {
                // we always need the complete
                // curve for fitting
                from = 0;
                to = dataSize() - 1;
            }
            drawLines(painter, xMap, yMap, from, to);
            break;
        case Sticks:
            drawSticks(painter, xMap, yMap, from, to);
            break;
        case Steps:
            drawSteps(painter, xMap, yMap, from, to);
            break;
        case Dots:
            drawDots(painter, xMap, yMap, from, to);
            break;
        case NoCurve:
        default:
            break;
    }
}