OpenWalnut  1.5.0dev
WTransferFunctionHistogram.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WTRANSFERFUNCTIONHISTOGRAM_H
26 #define WTRANSFERFUNCTIONHISTOGRAM_H
27 
28 #include <vector>
29 #include "QGraphicsItem"
30 
32 
33 /**
34  * Display a semi-transparent line graph as the histogram of the current data set.
35  */
37 {
38 public:
39  /** type of the base class */
41 
42  /**
43  * Default constructor.
44  *
45  * \param parent the parent widget
46  */
47  explicit WTransferFunctionHistogram( WTransferFunctionWidget* parent = 0x0 );
48 
49  /**
50  * Default destructor.
51  */
53 
54  /**
55  * Get the bounding rect of the histogram.
56  *
57  * \returns the bounding rectangle
58  **/
59  QRectF boundingRect() const;
60 
61  /**
62  * Paint a semi-transparent histogram on top of the transfer function but below the
63  * input handles.
64  *
65  * \param painter Painter that does the low-level painting of the histogram item
66  * \param option Style of the graphics histogram graphics item (currently not used in the function)
67  */
68  virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget* );
69 
70  /**
71  * Get histogram data.
72  *
73  * \return histogram data as double vector.
74  */
75  const std::vector< double >& getData() const;
76 
77  /**
78  * Get histogram data.
79  *
80  * \return histogram data as double vector.
81  */
82  std::vector< double >& getData();
83 
84 private:
85  /** the histogram data */
86  std::vector< double > m_data;
87 };
88 
89 #endif // WTRANSFERFUNCTIONHISTOGRAM_H
90 
Display a semi-transparent line graph as the histogram of the current data set.
WTransferFunctionHistogram(WTransferFunctionWidget *parent=0x0)
Default constructor.
virtual ~WTransferFunctionHistogram()
Default destructor.
QGraphicsItem BaseClass
type of the base class
QRectF boundingRect() const
Get the bounding rect of the histogram.
std::vector< double > m_data
the histogram data
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
Paint a semi-transparent histogram on top of the transfer function but below the input handles.
const std::vector< double > & getData() const
Get histogram data.
A widget that holds a scene to display and modify the transfer function.