~ubuntu-branches/ubuntu/saucy/goldencheetah/saucy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 * Qwt Widget Library
 * Copyright (C) 1997   Josef Wilgen
 * Copyright (C) 2002   Uwe Rathmann
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Qwt License, Version 1.0
 *****************************************************************************/

#include "qwt_plot_seriesitem.h"

class QwtPlotAbstractSeriesItem::PrivateData
{
public:
    PrivateData():
        orientation( Qt::Vertical )
    {
    }

    Qt::Orientation orientation;
};

/*!
  Constructor
  \param title Title of the curve
*/
QwtPlotAbstractSeriesItem::QwtPlotAbstractSeriesItem( const QwtText &title ):
    QwtPlotItem( title )
{
    d_data = new PrivateData();
}

/*!
  Constructor
  \param title Title of the curve
*/
QwtPlotAbstractSeriesItem::QwtPlotAbstractSeriesItem( const QString &title ):
    QwtPlotItem( QwtText( title ) )
{
    d_data = new PrivateData();
}

//! Destructor
QwtPlotAbstractSeriesItem::~QwtPlotAbstractSeriesItem()
{
    delete d_data;
}

/*!
  Set the orientation of the item.

  The orientation() might be used in specific way by a plot item.
  F.e. a QwtPlotCurve uses it to identify how to display the curve
  int QwtPlotCurve::Steps or QwtPlotCurve::Sticks style.

  \sa orientation()
*/
void QwtPlotAbstractSeriesItem::setOrientation( Qt::Orientation orientation )
{
    if ( d_data->orientation != orientation )
    {
        d_data->orientation = orientation;
        itemChanged();
    }
}

/*!
  \return Orientation of the plot item
  \sa setOrientation()
*/
Qt::Orientation QwtPlotAbstractSeriesItem::orientation() const
{
    return d_data->orientation;
}

/*!
  \brief Draw the complete series

  \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
*/
void QwtPlotAbstractSeriesItem::draw( QPainter *painter,
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
        const QRectF &canvasRect ) const
{
    drawSeries( painter, xMap, yMap, canvasRect, 0, -1 );
}