These are the flags you find in Qwt 6.1
so this means i am using two different versions of qwt6.1, probably qwt6.1 old SVN version and the last release qwt6.1-rc3 , as The two have the same PaintAttribute, one simple different was the older qwt6.1 use
grid->setMajPen() while the other use grid->setMajorPen(). and they differ in performance when reploting the curve with lot of points.
Thanks, I'll have a look at the spectroCurve implementation and see if I can do your suggestions.
Added after 1 57 minutes:
Well, I was trying to overload the drawDots method,
.h
#ifndef SPECTROCURVE_H
#define SPECTROCURVE_H
#include <qwt_plot_spectrocurve.h>
class SpectroCurve : public QwtPlotSpectroCurve
{
public:
protected:
const QRectF &canvasRect,
int from,
int to
) const;
};
#endif // SPECTROCURVE_H
#ifndef SPECTROCURVE_H
#define SPECTROCURVE_H
#include <qwt_plot_spectrocurve.h>
class SpectroCurve : public QwtPlotSpectroCurve
{
public:
SpectroCurve(QWidget * = NULL);
protected:
virtual void drawDots( QPainter *,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
};
#endif // SPECTROCURVE_H
To copy to clipboard, switch view to plain text mode
.cpp
#include "spectrocurve.h"
#include "qwt_plot_spectrocurve.h"
#include "qwt_color_map.h"
#include "qwt_scale_map.h"
#include "qwt_painter.h"
#include <qpainter.h>
SpectroCurve
::SpectroCurve( QWidget *parent
): QwtPlotSpectroCurve()
{
}
void QwtPlotSpectroCurve
::drawDots( QPainter *painter,
const QRectF &canvasRect,
int from,
int to
) const {
// if ( !d_data->colorRange.isValid() )
// return;
// const bool doAlign = QwtPainter::roundingAlignment( painter );
// const QwtColorMap::Format format = d_data->colorMap->format();
// if ( format == QwtColorMap::Indexed )
// d_data->colorTable = d_data->colorMap->colorTable( d_data->colorRange );
// const QwtSeriesData<QwtPoint3D> *series = data();
// for ( int i = from; i <= to; i++ )
// {
// const QwtPoint3D sample = series->sample( i );
// double xi = xMap.transform( sample.x() );
// double yi = yMap.transform( sample.y() );
// if ( doAlign )
// {
// xi = qRound( xi );
// yi = qRound( yi );
// }
// if ( d_data->paintAttributes & QwtPlotSpectroCurve::ClipPoints )
// {
// if ( !canvasRect.contains( xi, yi ) )
// continue;
// }
// if ( format == QwtColorMap::RGB )
// {
// const QRgb rgb = d_data->colorMap->rgb(
// d_data->colorRange, sample.z() );
// painter->setPen( QPen( QColor( rgb ), d_data->penWidth ) );
// }
// else
// {
// const unsigned char index = d_data->colorMap->colorIndex(
// d_data->colorRange, sample.z() );
// painter->setPen( QPen( QColor( d_data->colorTable[index] ),
// d_data->penWidth ) );
// }
// QwtPainter::drawPoint( painter, QPointF( xi, yi ) );
// }
// d_data->colorTable.clear();
}
#include "spectrocurve.h"
#include "qwt_plot_spectrocurve.h"
#include "qwt_color_map.h"
#include "qwt_scale_map.h"
#include "qwt_painter.h"
#include <qpainter.h>
SpectroCurve::SpectroCurve( QWidget *parent ):
QwtPlotSpectroCurve()
{
}
void QwtPlotSpectroCurve::drawDots( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const
{
// if ( !d_data->colorRange.isValid() )
// return;
// const bool doAlign = QwtPainter::roundingAlignment( painter );
// const QwtColorMap::Format format = d_data->colorMap->format();
// if ( format == QwtColorMap::Indexed )
// d_data->colorTable = d_data->colorMap->colorTable( d_data->colorRange );
// const QwtSeriesData<QwtPoint3D> *series = data();
// for ( int i = from; i <= to; i++ )
// {
// const QwtPoint3D sample = series->sample( i );
// double xi = xMap.transform( sample.x() );
// double yi = yMap.transform( sample.y() );
// if ( doAlign )
// {
// xi = qRound( xi );
// yi = qRound( yi );
// }
// if ( d_data->paintAttributes & QwtPlotSpectroCurve::ClipPoints )
// {
// if ( !canvasRect.contains( xi, yi ) )
// continue;
// }
// if ( format == QwtColorMap::RGB )
// {
// const QRgb rgb = d_data->colorMap->rgb(
// d_data->colorRange, sample.z() );
// painter->setPen( QPen( QColor( rgb ), d_data->penWidth ) );
// }
// else
// {
// const unsigned char index = d_data->colorMap->colorIndex(
// d_data->colorRange, sample.z() );
// painter->setPen( QPen( QColor( d_data->colorTable[index] ),
// d_data->penWidth ) );
// }
// QwtPainter::drawPoint( painter, QPointF( xi, yi ) );
// }
// d_data->colorTable.clear();
}
To copy to clipboard, switch view to plain text mode
I keep getting error when i try to compile it.
error: undefined reference to `VTT for SpectroCurve'
error: undefined reference to `vtable for SpectroCurve'
I wonder if i can use the same code the drawDots method has, so i can play around to understand the code, but
these errors are thrown.
error: invalid use of incomplete type 'struct QwtPlotSpectroCurve::PrivateData'
error: forward declaration of 'struct QwtPlotSpectroCurve::PrivateData'
thanks
Bookmarks