{
public:
QpnwPhasedArrayPlot * parent;
// Provide pointer to QpnwPhasedArrayPlot so we can access the data
SpectrogramData( QpnwPhasedArrayPlot * theParent ):
QwtRasterData(QwtDoubleRect
(-90,
0,
180,
2000)) // Left, bottom, width, height {
parent = theParent;
}
// Left as example
{
return new SpectrogramData(0);
}
// Left as example
{
}
// Return data. Crashes here.
virtual double value(double x, double y) const
{
return parent->spectData[(unsigned int) x+90].at( (unsigned int) y );
}
};
QpnwPhasedArrayPlot
::QpnwPhasedArrayPlot(QwtPlot * thePlot
){
DEBUG
->print
(QDateTime::currentDateTime().
toString("dd.MM.yy hh:mm:ss.zzz") + ": " + "Initialising Plot");
// Create spectrogram
// Create some fake data
for( int x = 0; x < 180; x++ )
for( int y = 0; y < 2000; y++ )
spectData[x].append(y);
spectData[90].clear();
for( int x = 0; x < 2000; x++ )
spectData[90].append(x);
// Attach the data
spectrogram->setData(SpectrogramData(this));
spectrogram->attach(thePlot);
}
//
class SpectrogramData: public QwtRasterData
{
public:
QpnwPhasedArrayPlot * parent;
// Provide pointer to QpnwPhasedArrayPlot so we can access the data
SpectrogramData( QpnwPhasedArrayPlot * theParent ):
QwtRasterData(QwtDoubleRect(-90, 0, 180, 2000)) // Left, bottom, width, height
{
parent = theParent;
}
// Left as example
virtual QwtRasterData *copy() const
{
return new SpectrogramData(0);
}
// Left as example
virtual QwtDoubleInterval range() const
{
return QwtDoubleInterval(0.0, 4096);
}
// Return data. Crashes here.
virtual double value(double x, double y) const
{
QMessageBox::information(0,"","A");
return parent->spectData[(unsigned int) x+90].at( (unsigned int) y );
}
};
QpnwPhasedArrayPlot::QpnwPhasedArrayPlot(QwtPlot * thePlot)
{
DEBUG->print(QDateTime::currentDateTime().toString("dd.MM.yy hh:mm:ss.zzz") + ": " + "Initialising Plot");
// Create spectrogram
spectrogram = new QwtPlotSpectrogram();
// Create some fake data
for( int x = 0; x < 180; x++ )
for( int y = 0; y < 2000; y++ )
spectData[x].append(y);
spectData[90].clear();
for( int x = 0; x < 2000; x++ )
spectData[90].append(x);
// Attach the data
spectrogram->setData(SpectrogramData(this));
spectrogram->attach(thePlot);
}
//
To copy to clipboard, switch view to plain text mode
Bookmarks