
Originally Posted by
embeddedmz
The difference with curves, is that a spectrogram (waterfall) has a fixed dimensions (data is updated but the dimensions are always the same), so it is impossible to make spectrogram's Y axis labels "fall" over time with the actual Qwt classes (I tried all the stuff you mentionned before).
The spectrogam ( every QwtPlotRasterItem ) creates a QImage, what is actually an array of color values. This array is interpreted as lines from left to right, what means that you can shift the content vertically by a simple memmove ( https://en.cppreference.com/w/cpp/string/byte/memmove ).
The typical situation of a waterfall plot is, that some lines at the bottom go out of scope, while others appear at the top. This can be implemented best by shifting the lines vertically, while only the new lines have to be recalculated. Calculating parts of an image only is possible with QwtPlotSpectrogram::renderTile. ( When looking into QwtPlotSpectrogram::renderImage you can see how renderTile is used to run the image composition in parallel on multiple threads ).
So all the pieces are already there, to write something like this:
{
public:
const QRectF &area,
const QSize &imageSize
) const override
{
if( m_image is valid )
{
shift lines down;
fill some lines at the top
}
else
{
}
return m_image;
}
private:
};
class WaterfallItem : public QwtPlotSpectrogram
{
public:
QImage renderImage(
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &area, const QSize &imageSize ) const override
{
if( m_image is valid )
{
shift lines down;
fill some lines at the top
}
else
{
m_image = QwtPlotSpectrogram::renderImage( ... );
}
return m_image;
}
private:
QImage m_image;
};
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks