casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QwtConfig.h
Go to the documentation of this file.
1 #pragma once
2 #include <qwt_global.h>
3 #include <qwt_scale_widget.h>
4 #include <qwt_plot_curve.h>
5 #include <qwt_color_map.h>
6 #if QWT_VERSION >= 0x060000
7 #include <qwt_compat.h>
8 #include <qwt_series_data.h>
9 #include <qwt_plot_canvas.h>
10 
11 typedef QwtIntervalSeriesData qwt_interval_t;
12 inline void set_data(QwtPlotCurve *curve, const QVector<double> &x, const QVector<double> &y) {
13  curve->setSamples(x,y);
14 }
15 inline void set_color_map( QwtScaleWidget *scale, QwtDoubleInterval &range, const QwtLinearColorMap &colorMap ) {
16  QwtLinearColorMap* copyMap = new QwtLinearColorMap( colorMap.color1( ), colorMap.color2( ) );
17  QVector<double> colorStops = colorMap.colorStops();
18  for ( int i = 1; i < colorStops.size() - 1; ++i) {
19  copyMap->addColorStop( colorStops[i], QColor(colorMap.rgb(QwtInterval(0,1), colorStops[i])) );
20  }
21  scale->setColorMap( range, copyMap );
22 }
23 template<class T> inline void set_symbol( T *qwt_thing, const QwtSymbol &sym ) {
24  qwt_thing->setSymbol(&sym);
25 }
26 #else
27 #include <qwt_interval_data.h>
28 typedef QwtIntervalData qwt_interval_t;
29 inline void set_data(QwtPlotCurve *curve, const QVector<double> &x, const QVector<double> &y) {
30  curve->setData(x,y);
31 }
32 inline void set_color_map( QwtScaleWidget *scale, QwtDoubleInterval &range, const QwtLinearColorMap &colorMap ) {
33  scale->setColorMap( range, colorMap );
34 }
35 template<class T> inline void set_symbol( T *qwt_thing, const QwtSymbol &sym ) {
36  qwt_thing->setSymbol(sym);
37 }
38 #endif
void set_color_map(QwtScaleWidget *scale, QwtDoubleInterval &range, const QwtLinearColorMap &colorMap)
Definition: QwtConfig.h:32
void set_data(QwtPlotCurve *curve, const QVector< double > &x, const QVector< double > &y)
Definition: QwtConfig.h:29
void set_symbol(T *qwt_thing, const QwtSymbol &sym)
Definition: QwtConfig.h:35
QwtIntervalData qwt_interval_t
Definition: QwtConfig.h:28