QwtFunctionPlot.hh 5.91 KB
Newer Older
1
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
2
3
*                                                                            *
*                              OpenFlipper                                   *
Jan Möbius's avatar
Jan Möbius committed
4
*      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen       *
Jan Möbius's avatar
Jan Möbius committed
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
*                           www.openflipper.org                              *
*                                                                            *
*--------------------------------------------------------------------------- *
*  This file is part of OpenFlipper.                                         *
*                                                                            *
*  OpenFlipper is free software: you can redistribute it and/or modify       *
*  it under the terms of the GNU Lesser General Public License as            *
*  published by the Free Software Foundation, either version 3 of            *
*  the License, or (at your option) any later version with the               *
*  following exceptions:                                                     *
*                                                                            *
*  If other files instantiate templates or use macros                        *
*  or inline functions from this file, or you compile this file and          *
*  link it with other files to produce an executable, this file does         *
*  not by itself cause the resulting executable to be covered by the         *
*  GNU Lesser General Public License. This exception does not however        *
*  invalidate any other reasons why the executable file might be             *
*  covered by the GNU Lesser General Public License.                         *
*                                                                            *
*  OpenFlipper is distributed in the hope that it will be useful,            *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of            *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
*  GNU Lesser General Public License for more details.                       *
*                                                                            *
*  You should have received a copy of the GNU LesserGeneral Public           *
*  License along with OpenFlipper. If not,                                   *
*  see <http://www.gnu.org/licenses/>.                                       *
*                                                                            *
33
34
35
\*===========================================================================*/

/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
36
37
38
39
40
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
41
42
\*===========================================================================*/

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//=============================================================================
//
// CLASS QwtFunctionPlot
//
//
// Author:  David Bommes <bommes@cs.rwth-aachen.de>
//
// Version: $Revision: 1$
// Date:    $Date: 200X-XX-XX$
//
//=============================================================================


#ifndef ACG_QWTFUNCTIONPLOT_HH
#define ACG_QWTFUNCTIONPLOT_HH

Jan Möbius's avatar
Jan Möbius committed
59
#ifdef WITH_QWT
60
61
62

//== INCLUDES =================================================================

Matthias Möller's avatar
Matthias Möller committed
63
64
65
66
67
68
#if QT_VERSION >= 0x050000 
  #include <QtWidgets>
#else
  #include <QtGui>
#endif

69
70
71
72
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_zoomer.h>
#include <qwt_scale_engine.h>
73
#include <qwt_plot_marker.h>
74

Jan Möbius's avatar
Jan Möbius committed
75
// qmake users have to include pc
76
77
78
79
80
#include <ui_QwtFunctionPlotBase.hh>

// ACGMake users have to include
// #include "QtFunctionPlotBase.hh"

81
82
83
84
85
86
#if QWT_VERSION >= 0x060000
 #include <ACG/QtWidgets/QwtHistogramm.hh>
#else
 #include "HistogramItem.hh"
#endif

87
#include <vector>
88
89
#include "TextureParameters.hh"

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

//== FORWARDDECLARATIONS ======================================================

//== NAMESPACES ===============================================================

namespace ACG
{

//== CLASS DEFINITION =========================================================



class QwtFunctionPlot : public QDialog, public Ui::QwtFunctionPlotBase
{
  Q_OBJECT
public:

  /// Default constructor
Dirk Wilden's avatar
Dirk Wilden committed
108
  QwtFunctionPlot( QWidget*    _parent = 0 );
109
110
111
112

  /// Destructor
  ~QwtFunctionPlot() {}

Dirk Wilden's avatar
Dirk Wilden committed
113
114
  // set the function to plot
  void setFunction( std::vector<double>& _values );
115

116
117
118
119
  /// Set all parameters as one block
  void setParameters(const TexParameters& _parameters);

  /// Set the parameters separately
Dirk Wilden's avatar
Dirk Wilden committed
120
121
122
123
124
  void setParameters(bool repeat, double repeatMax,
                     bool clamp,  double clampMin, double clampMax,
                     bool center,
                     bool absolute,
                     bool scale);
125

126
127
128
129
130
  /** The function plot accesses an image to get colors from them.
   *  The colors are equivalent to the rendered color textures.
   *
   * @param _image Image that is used to take the colors from
   */
Dirk Wilden's avatar
Dirk Wilden committed
131
  void setImage(QImage* _image);
132

133
134
135
136
137
public slots:
  void zoomIn();
  void zoomOut();
  void clamp();
  
Dirk Wilden's avatar
Dirk Wilden committed
138
  void replot();
139

Dirk Wilden's avatar
Dirk Wilden committed
140
private:
141

Dirk Wilden's avatar
Dirk Wilden committed
142
  QwtPlotZoomer* plot_zoomer_;
143

144
145
146
147
148
149
  QwtPlotMarker* clampMinMarker_;
  QwtSymbol*     minSymbol_;

  QwtPlotMarker* clampMaxMarker_;
  QwtSymbol*     maxSymbol_;

150
151
152
153
  // Histogramm Plot
#if QWT_VERSION >= 0x060000
  Histogram* histogram_;
#else
Dirk Wilden's avatar
Dirk Wilden committed
154
  HistogramItem* histogram_;
155
#endif
156

Dirk Wilden's avatar
Dirk Wilden committed
157
  std::vector<double> values_;
158

Dirk Wilden's avatar
Dirk Wilden committed
159
  QImage* image_;
160

161
  TexParameters parameters_;
Dirk Wilden's avatar
Dirk Wilden committed
162

163
  double min_,max_;
164
165
166
167
168
169

};


//=============================================================================
} // namespace ACG
170

Jan Möbius's avatar
Jan Möbius committed
171
#endif // WITH_QWT
172

173
174
175
176
//=============================================================================
#endif // ACG_QWTFUNCTIONPLOT_HH defined
//=============================================================================