~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to src/qwt_plot_histogram.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2011-06-10 11:22:47 UTC
  • mfrom: (1.1.6 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110610112247-0i1019vvmzaq6p86
Tags: 6.0.0-1
* New upstream release (Closes: #624107):
  - drop Qt3 support. (Closes: #604379, #626868)
* Register documentation with doc-base. (Closes: #626567)
* Drop patches:
  - 01_makefiles.diff
  - 02_add_missing_warnings.diff
  - 03_qwt_branch_pull_r544.diff
* Add qwt_install_paths.patch to fix the hardcoded installation paths.
* Update debian/control:
  - drop libqt3-mt-dev build dependency.
  - bump Standards-Version to 3.9.2 (no changes).
  - drop Qt3 related packages.
  - due to bump soname (and as we dropper Qt3 support):
    - libqwt5-qt4-dev -> libqwt-dev
    - libqwt5-qt4 -> libqwt6
    - libqwt5-doc -> libqwt-doc
* Update debian/copyright file.
* Update debian/rules: drop Qt3 packages support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 
2
 * Qwt Widget Library
 
3
 * Copyright (C) 1997   Josef Wilgen
 
4
 * Copyright (C) 2002   Uwe Rathmann
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the Qwt License, Version 1.0
 
8
 *****************************************************************************/
 
9
 
 
10
#ifndef QWT_PLOT_HISTOGRAM_H
 
11
#define QWT_PLOT_HISTOGRAM_H
 
12
 
 
13
#include "qwt_global.h"
 
14
#include "qwt_plot_seriesitem.h"
 
15
#include "qwt_column_symbol.h"
 
16
#include <qcolor.h>
 
17
#include <qvector.h>
 
18
 
 
19
class QwtIntervalData;
 
20
class QString;
 
21
class QPolygonF;
 
22
 
 
23
/*!
 
24
  \brief QwtPlotHistogram represents a series of samples, where an interval
 
25
         is associated with a value ( \f$y = f([x1,x2])\f$ ).
 
26
 
 
27
  The representation depends on the style() and an optional symbol()
 
28
  that is displayed for each interval.
 
29
 
 
30
  \note The term "histogram" is used in a different way in the areas of
 
31
        digital image processing and statistics. Wikipedia introduces the
 
32
        terms "image histogram" and "color histogram" to avoid confusions.
 
33
        While "image histograms" can be displayed by a QwtPlotCurve there
 
34
        is no applicable plot item for a "color histogram" yet.
 
35
*/
 
36
 
 
37
class QWT_EXPORT QwtPlotHistogram: public QwtPlotSeriesItem<QwtIntervalSample>
 
38
{
 
39
public:
 
40
    /*!
 
41
        Histogram styles.
 
42
        The default style is QwtPlotHistogram::Columns.
 
43
 
 
44
        \sa setStyle(), style(), setSymbol(), symbol(), setBaseline()
 
45
    */
 
46
    enum HistogramStyle
 
47
    {
 
48
        /*!
 
49
           Draw an outline around the area, that is build by all intervals
 
50
           using the pen() and fill it with the brush(). The outline style
 
51
           requires, that the intervals are in increasing order and
 
52
           not overlapping.
 
53
         */
 
54
        Outline,
 
55
 
 
56
        /*!
 
57
           Draw a column for each interval. When a symbol() has been set
 
58
           the symbol is used otherwise the column is displayed as 
 
59
           plain rectangle using pen() and brush().
 
60
         */
 
61
        Columns,
 
62
 
 
63
        /*!
 
64
           Draw a simple line using the pen() for each interval.
 
65
         */
 
66
        Lines,
 
67
 
 
68
        /*!
 
69
           Styles >= UserStyle are reserved for derived
 
70
           classes that overload drawSeries() with
 
71
           additional application specific ways to display a histogram.
 
72
         */
 
73
        UserStyle = 100
 
74
    };
 
75
 
 
76
    explicit QwtPlotHistogram( const QString &title = QString::null );
 
77
    explicit QwtPlotHistogram( const QwtText &title );
 
78
    virtual ~QwtPlotHistogram();
 
79
 
 
80
    virtual int rtti() const;
 
81
 
 
82
    void setPen( const QPen & );
 
83
    const QPen &pen() const;
 
84
 
 
85
    void setBrush( const QBrush & );
 
86
    const QBrush &brush() const;
 
87
 
 
88
    void setSamples( const QVector<QwtIntervalSample> & );
 
89
 
 
90
    void setBaseline( double reference );
 
91
    double baseline() const;
 
92
 
 
93
    void setStyle( HistogramStyle style );
 
94
    HistogramStyle style() const;
 
95
 
 
96
    void setSymbol( const QwtColumnSymbol * );
 
97
    const QwtColumnSymbol *symbol() const;
 
98
 
 
99
    virtual void drawSeries( QPainter *p,
 
100
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
 
101
        const QRectF &canvasRect, int from, int to ) const;
 
102
 
 
103
    virtual QRectF boundingRect() const;
 
104
 
 
105
    virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const;
 
106
 
 
107
protected:
 
108
    virtual QwtColumnRect columnRect( const QwtIntervalSample &,
 
109
        const QwtScaleMap &, const QwtScaleMap & ) const;
 
110
 
 
111
    virtual void drawColumn( QPainter *, const QwtColumnRect &,
 
112
        const QwtIntervalSample & ) const;
 
113
 
 
114
    void drawColumns( QPainter *,
 
115
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
 
116
        int from, int to ) const;
 
117
 
 
118
    void drawOutline( QPainter *,
 
119
        const QwtScaleMap &xMap, const QwtScaleMap &yMap,
 
120
        int from, int to ) const;
 
121
 
 
122
    void drawLines( QPainter *,
 
123
         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
 
124
         int from, int to ) const;
 
125
 
 
126
private:
 
127
    void init();
 
128
    void flushPolygon( QPainter *, double baseLine, QPolygonF & ) const;
 
129
 
 
130
    class PrivateData;
 
131
    PrivateData *d_data;
 
132
};
 
133
 
 
134
#endif