Thanks, Uwe.
Now I have some question about the initraster() function. Should I reimplement the whole function (similar to value) or should I just call it with particular QRectF and QSize values? This is my rendition SpectrogramData:
{
public:
SpectrumData *Data;
double dx, dy;
SpectrogramData(SpectrumData *InputData)
{
Data = InputData;
setInterval( Qt::XAxis, QwtInterval( Data->.first(), Data->XData.last() ) );
setInterval( Qt::YAxis, QwtInterval( Data->YData.first(), Data->YData.last() ) );
setInterval( Qt::ZAxis, QwtInterval( Data->MinZ, Data->MaxZ ) );
dx = (Data->XData.last()-Data->XData.first())/(Data->XData.size()-1);
dy = (Data->YData.last()-Data->YData.first())/(Data->YData.size()-1);
}
virtual double value(double x, double y) const
{
int i = (x-Data->XData.first())/dx, j = (y-Data->YData.first())/dy;
return Data->ZData[j][i];
}
}
class SpectrogramData: public QwtRasterData
{
public:
SpectrumData *Data;
double dx, dy;
SpectrogramData(SpectrumData *InputData)
{
Data = InputData;
setInterval( Qt::XAxis, QwtInterval( Data->.first(), Data->XData.last() ) );
setInterval( Qt::YAxis, QwtInterval( Data->YData.first(), Data->YData.last() ) );
setInterval( Qt::ZAxis, QwtInterval( Data->MinZ, Data->MaxZ ) );
dx = (Data->XData.last()-Data->XData.first())/(Data->XData.size()-1);
dy = (Data->YData.last()-Data->YData.first())/(Data->YData.size()-1);
}
virtual double value(double x, double y) const
{
int i = (x-Data->XData.first())/dx, j = (y-Data->YData.first())/dy;
return Data->ZData[j][i];
}
}
To copy to clipboard, switch view to plain text mode
I tried to experiment with your suggestion and added these lines to the end of the constructor (lines 14+):
QSize QS
(Data
->LengthOfX,Data
->LengthOfY
);
QRectF QR
(0,
0,
500,
500);
// Some random numbers to initialize QRectF initRaster(QR,QS);
QSize QS(Data->LengthOfX,Data->LengthOfY);
QRectF QR(0,0,500,500); // Some random numbers to initialize QRectF
initRaster(QR,QS);
To copy to clipboard, switch view to plain text mode
but this implementation doesn't seem to yield any difference. Could you elaborate a bit more on initraster()? I searched this forum, but I can't find a good example of its usage.
Thanks in advance.
Bookmarks