Developer Documentation
QwtFunctionPlot.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 //=============================================================================
51 //
52 // CLASS QwtFunctionPlot
53 //
54 //
55 // Author: David Bommes <bommes@cs.rwth-aachen.de>
56 //
57 // Version: $Revision: 1$
58 // Date: $Date: 200X-XX-XX$
59 //
60 //=============================================================================
61 
62 
63 #ifndef ACG_QWTFUNCTIONPLOT_HH
64 #define ACG_QWTFUNCTIONPLOT_HH
65 
66 #ifdef WITH_QWT
67 
68 //== INCLUDES =================================================================
69 
70 #if QT_VERSION >= 0x050000
71  #include <QtWidgets>
72 #else
73  #include <QtGui>
74 #endif
75 
76 #include <qwt_plot.h>
77 #include <qwt_plot_curve.h>
78 #include <qwt_plot_zoomer.h>
79 #include <qwt_scale_engine.h>
80 #include <qwt_plot_marker.h>
81 
82 #include <QDialog>
83 
84 // qmake users have to include pc
85 #include <ui_QwtFunctionPlotBase.hh>
86 
87 // ACGMake users have to include
88 // #include "QtFunctionPlotBase.hh"
89 
90 #if QWT_VERSION >= 0x060000
91  #include <ACG/QwtWidgets/QwtHistogramm.hh>
92 #else
93  #include "HistogramItem.hh"
94 #endif
95 
96 #include <vector>
97 #include "TextureParameters.hh"
98 
99 
100 //== FORWARDDECLARATIONS ======================================================
101 
102 //== NAMESPACES ===============================================================
103 
104 namespace ACG
105 {
106 
107 //== CLASS DEFINITION =========================================================
108 
109 
110 
111 class QwtFunctionPlot : public QDialog, public Ui::QwtFunctionPlotBase
112 {
113  Q_OBJECT
114 public:
115 
117  QwtFunctionPlot( QWidget* _parent = 0 );
118 
120  ~QwtFunctionPlot() {}
121 
122  // set the function to plot
123  void setFunction( std::vector<double>& _values );
124 
126  void setParameters(const TexParameters& _parameters);
127 
129  void setParameters(bool repeat, double repeatMax,
130  bool clamp, double clampMin, double clampMax,
131  bool center,
132  bool absolute,
133  bool scale);
134 
140  void setImage(QImage* _image);
141 
142 public slots:
143  void zoomIn();
144  void zoomOut();
145  void clamp();
146 
147  void replot();
148 
149 private:
150 
151  QwtPlotZoomer* plot_zoomer_;
152 
153  QwtPlotMarker* clampMinMarker_;
154  QwtSymbol* minSymbol_;
155 
156  QwtPlotMarker* clampMaxMarker_;
157  QwtSymbol* maxSymbol_;
158 
159  // Histogramm Plot
160 #if QWT_VERSION >= 0x060000
161  Histogram* histogram_;
162 #else
163  HistogramItem* histogram_;
164 #endif
165 
166  std::vector<double> values_;
167 
168  QImage* image_;
169 
170  TexParameters parameters_;
171 
172  double min_,max_;
173 
174 };
175 
176 
177 //=============================================================================
178 } // namespace ACG
179 
180 #endif // WITH_QWT
181 
182 //=============================================================================
183 #endif // ACG_QWTFUNCTIONPLOT_HH defined
184 //=============================================================================
185 
Histogram plotting widget.
Histogram plot.
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51