2 #include <QColorDialog>
4 #include <spectrumdisplayform.h>
6 int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1;
8 SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent)
13 _useOpenGL = useOpenGL;
14 _systemSpecifiedFlag = false;
15 _intValidator = new QIntValidator(this);
16 _intValidator->setBottom(0);
17 _frequencyDisplayPlot = new FrequencyDisplayPlot(FrequencyPlotDisplayFrame);
18 _waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame
\0);
20 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
21 _waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
24 _timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
25 _constellationDisplayPlot = new ConstellationDisplayPlot(ConstellationDisplayFrame);
26 _numRealDataPoints = 1024;
27 _realFFTDataPoints = new double[_numRealDataPoints];
28 _averagedValues = new double[_numRealDataPoints];
29 _historyVector = new std::vector<double*>;
31 AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500
32 MinHoldCheckBox_toggled( false );
33 MaxHoldCheckBox_toggled( false );
35 WaterfallMaximumIntensityWheel->setRange(-200, 0);
36 WaterfallMaximumIntensityWheel->setTickCnt(50);
37 WaterfallMinimumIntensityWheel->setRange(-200, 0);
38 WaterfallMinimumIntensityWheel->setTickCnt(50);
39 WaterfallMinimumIntensityWheel->setValue(-200);
41 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
42 Waterfall3DMaximumIntensityWheel->setRange(-200, 0);
43 Waterfall3DMaximumIntensityWheel->setTickCnt(50);
44 Waterfall3DMinimumIntensityWheel->setRange(-200, 0);
45 Waterfall3DMinimumIntensityWheel->setTickCnt(50);
46 Waterfall3DMinimumIntensityWheel->setValue(-200);
50 _peakAmplitude = -HUGE_VAL;
52 _noiseFloorAmplitude = -HUGE_VAL;
54 connect(_waterfallDisplayPlot, SIGNAL(UpdatedLowerIntensityLevel(const double)),
55 _frequencyDisplayPlot, SLOT(SetLowerIntensityLevel(const double)));
56 connect(_waterfallDisplayPlot, SIGNAL(UpdatedUpperIntensityLevel(const double)),
57 _frequencyDisplayPlot, SLOT(SetUpperIntensityLevel(const double)));
59 _frequencyDisplayPlot->SetLowerIntensityLevel(-200);
60 _frequencyDisplayPlot->SetUpperIntensityLevel(-200);
62 // Load up the acceptable FFT sizes...
63 FFTSizeComboBox->clear();
64 for(long fftSize = SpectrumGUIClass::MIN_FFT_SIZE; fftSize <= SpectrumGUIClass::MAX_FFT_SIZE; fftSize *= 2){
65 FFTSizeComboBox->insertItem(FFTSizeComboBox->count(), QString("%1").arg(fftSize));
69 ToggleTabFrequency(false);
70 ToggleTabWaterfall(false);
71 ToggleTabWaterfall3D(false);
73 ToggleTabConstellation(false);
76 SpectrumDisplayForm::~SpectrumDisplayForm()
78 // Qt deletes children when parent is deleted
80 // Don't worry about deleting Display Plots - they are deleted when parents are deleted
81 /* delete _intValidator; */
83 delete[] _realFFTDataPoints;
84 delete[] _averagedValues;
86 for(unsigned int count = 0; count < _historyVector->size(); count++){
87 delete[] _historyVector->operator[](count);
90 delete _historyVector;
94 SpectrumDisplayForm::setSystem( SpectrumGUIClass * newSystem,
95 const uint64_t numFFTDataPoints,
96 const uint64_t numTimeDomainDataPoints )
98 ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints);
100 if(newSystem != NULL){
102 _systemSpecifiedFlag = true;
105 _systemSpecifiedFlag = false;
110 SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdateEvent)
112 //printf("Parent Width: %d Height: %d\n", width(), height());
113 //printf("Frequency Frame Width: %d Height: %d\n", FrequencyPlotDisplayFrame->width(), FrequencyPlotDisplayFrame->height());
114 //printf("Frequency Plot Width: %d Height: %d\n", _frequencyDisplayPlot->width(), _frequencyDisplayPlot->height());
117 //_lastSpectrumEvent = (SpectrumUpdateEvent)(*spectrumUpdateEvent);
118 const std::complex<float>* complexDataPoints = spectrumUpdateEvent->getFFTPoints();
119 const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints();
120 const double* realTimeDomainDataPoints = spectrumUpdateEvent->getRealTimeDomainPoints();
121 const double* imagTimeDomainDataPoints = spectrumUpdateEvent->getImagTimeDomainPoints();
122 const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
123 const double timePerFFT = spectrumUpdateEvent->getTimePerFFT();
124 const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp();;
125 const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag();
126 const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag();
127 const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp();
129 // REMEMBER: The dataTimestamp is NOT valid when the repeat data flag is true...
130 ResizeBuffers(numFFTDataPoints, numTimeDomainDataPoints);
132 // Calculate the Magnitude of the complex point
133 const std::complex<float>* complexDataPointsPtr = complexDataPoints+numFFTDataPoints/2;
134 double* realFFTDataPointsPtr = _realFFTDataPoints;
136 // Run this twice to perform the fftshift operation on the data here as well
137 for(uint64_t point = 0; point < numFFTDataPoints/2; point++){
139 // 50 ohm load assumption
140 // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
141 // 75 ohm load assumption
142 // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
144 // perform scaling here
145 std::complex<float> pt = (*complexDataPointsPtr) / std::complex<float>((float)numFFTDataPoints);
146 *realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20);
148 complexDataPointsPtr++;
149 realFFTDataPointsPtr++;
152 // This loop takes the first half of the input data and puts it in the second half of the plotted data
153 complexDataPointsPtr = complexDataPoints;
154 for(uint64_t point = 0; point < numFFTDataPoints/2; point++){
155 std::complex<float> pt = (*complexDataPointsPtr) / std::complex<float>((float)numFFTDataPoints);
156 *realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20);
158 complexDataPointsPtr++;
159 realFFTDataPointsPtr++;
162 // Don't update the averaging history if this is repeated data
164 _AverageHistory(_realFFTDataPoints);
167 const double fft_bin_size = (_stopFrequency-_startFrequency) /
168 static_cast<double>(numFFTDataPoints);
170 // find the peak, sum (for mean), etc
171 _peakAmplitude = -HUGE_VAL;
173 for(uint64_t number = 0; number < numFFTDataPoints; number++){
175 if(_realFFTDataPoints[number] > _peakAmplitude){
176 // Calculate the frequency relative to the local bw, adjust for _startFrequency later
177 _peakFrequency = (static_cast<float>(number) * fft_bin_size);
178 _peakAmplitude = _realFFTDataPoints[number];
179 // _peakBin = number;
182 sumMean += _realFFTDataPoints[number];
185 // calculate the spectral mean
186 // +20 because for the comparison below we only want to throw out bins
187 // that are significantly higher (and would, thus, affect the mean more)
188 const double meanAmplitude = (sumMean / numFFTDataPoints) + 20.0;
190 // now throw out any bins higher than the mean
192 uint64_t newNumDataPoints = numFFTDataPoints;
193 for(uint64_t number = 0; number < numFFTDataPoints; number++){
194 if (_realFFTDataPoints[number] <= meanAmplitude)
195 sumMean += _realFFTDataPoints[number];
200 if (newNumDataPoints == 0) // in the odd case that all
201 _noiseFloorAmplitude = meanAmplitude; // amplitudes are equal!
203 _noiseFloorAmplitude = sumMean / newNumDataPoints;
206 if(lastOfMultipleUpdatesFlag){
207 int tabindex = SpectrumTypeTab->currentIndex();
208 if(tabindex == d_plot_fft) {
209 _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints,
210 _noiseFloorAmplitude, _peakFrequency,
213 if(tabindex == d_plot_time) {
214 _timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints,
215 imagTimeDomainDataPoints,
216 numTimeDomainDataPoints);
218 if(tabindex == d_plot_constellation) {
219 _constellationDisplayPlot->PlotNewData(realTimeDomainDataPoints,
220 imagTimeDomainDataPoints,
221 numTimeDomainDataPoints);
224 // Don't update the repeated data for the waterfall
226 if(tabindex == d_plot_waterfall) {
227 _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
228 timePerFFT, dataTimestamp,
229 spectrumUpdateEvent->getDroppedFFTFrames());
231 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
232 if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
233 _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
234 timePerFFT, dataTimestamp,
235 spectrumUpdateEvent->getDroppedFFTFrames());
241 // Tell the system the GUI has been updated
242 if(_systemSpecifiedFlag){
243 _system->SetLastGUIUpdateTime(generatedTimestamp);
244 _system->DecrementPendingGUIUpdateEvents();
250 SpectrumDisplayForm::resizeEvent( QResizeEvent *e )
253 s.setWidth(FrequencyPlotDisplayFrame->width());
254 s.setHeight(FrequencyPlotDisplayFrame->height());
255 emit _frequencyDisplayPlot->resizeSlot(&s);
257 s.setWidth(TimeDomainDisplayFrame->width());
258 s.setHeight(TimeDomainDisplayFrame->height());
259 emit _timeDomainDisplayPlot->resizeSlot(&s);
261 s.setWidth(WaterfallPlotDisplayFrame->width());
262 s.setHeight(WaterfallPlotDisplayFrame->height());
263 emit _waterfallDisplayPlot->resizeSlot(&s);
265 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
266 s.setWidth(Waterfall3DPlotDisplayFrame->width());
267 s.setHeight(Waterfall3DPlotDisplayFrame->height());
268 emit _waterfall3DDisplayPlot->resizeSlot(&s);
271 s.setWidth(ConstellationDisplayFrame->width());
272 s.setHeight(ConstellationDisplayFrame->height());
273 emit _constellationDisplayPlot->resizeSlot(&s);
277 SpectrumDisplayForm::customEvent( QEvent * e)
279 if(e->type() == QEvent::User+3){
280 if(_systemSpecifiedFlag){
281 WindowComboBox->setCurrentIndex(_system->GetWindowType());
282 FFTSizeComboBox->setCurrentIndex(_system->GetFFTSizeIndex());
283 //FFTSizeComboBox->setCurrentIndex(1);
286 waterfallMinimumIntensityChangedCB(WaterfallMinimumIntensityWheel->value());
287 waterfallMaximumIntensityChangedCB(WaterfallMaximumIntensityWheel->value());
289 // If the video card doesn't support OpenGL then don't display the 3D Waterfall
290 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
291 waterfall3DMinimumIntensityChangedCB(Waterfall3DMinimumIntensityWheel->value());
292 waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
294 // Check for Hardware Acceleration of the OpenGL
295 if(!_waterfall3DDisplayPlot->format().directRendering()){
296 // Only ask this once while the program is running...
297 if(_openGLWaterfall3DFlag == -1){
298 _openGLWaterfall3DFlag = 0;
299 if(QMessageBox::warning(this, "OpenGL Direct Rendering NOT Supported", "<center>The system's video card hardware or current drivers do not support direct hardware rendering of the OpenGL modules.</center><br><center>Software rendering is VERY processor intensive.</center><br><center>Do you want to use software rendering?</center>", QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) == QMessageBox::Yes){
300 _openGLWaterfall3DFlag = 1;
305 _openGLWaterfall3DFlag = 1;
309 if(_openGLWaterfall3DFlag != 1){
310 ToggleTabWaterfall3D(false);
313 // Clear any previous display
316 else if(e->type() == 10005){
317 SpectrumUpdateEvent* spectrumUpdateEvent = (SpectrumUpdateEvent*)e;
318 newFrequencyData(spectrumUpdateEvent);
320 else if(e->type() == 10008){
321 setWindowTitle(((SpectrumWindowCaptionEvent*)e)->getLabel());
323 else if(e->type() == 10009){
325 if(_systemSpecifiedFlag){
326 _system->ResetPendingGUIUpdateEvents();
329 else if(e->type() == 10010){
330 _startFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStartFrequency();
331 _stopFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetStopFrequency();
332 _centerFrequency = ((SpectrumFrequencyRangeEvent*)e)->GetCenterFrequency();
334 UseRFFrequenciesCB(UseRFFrequenciesCheckBox->isChecked());
339 SpectrumDisplayForm::AvgLineEdit_valueChanged( int value )
341 SetAverageCount(value);
346 SpectrumDisplayForm::MaxHoldCheckBox_toggled( bool newState )
348 MaxHoldResetBtn->setEnabled(newState);
349 _frequencyDisplayPlot->SetMaxFFTVisible(newState);
350 MaxHoldResetBtn_clicked();
355 SpectrumDisplayForm::MinHoldCheckBox_toggled( bool newState )
357 MinHoldResetBtn->setEnabled(newState);
358 _frequencyDisplayPlot->SetMinFFTVisible(newState);
359 MinHoldResetBtn_clicked();
364 SpectrumDisplayForm::MinHoldResetBtn_clicked()
366 _frequencyDisplayPlot->ClearMinData();
367 _frequencyDisplayPlot->replot();
372 SpectrumDisplayForm::MaxHoldResetBtn_clicked()
374 _frequencyDisplayPlot->ClearMaxData();
375 _frequencyDisplayPlot->replot();
380 SpectrumDisplayForm::TabChanged(int index)
382 // This might be dangerous to call this with NULL
387 SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency,
388 const double newStartFrequency,
389 const double newStopFrequency)
392 if(UseRFFrequenciesCheckBox->isChecked()) {
393 fdiff = newCenterFrequency;
396 fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency));
400 std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
401 double units10 = floor(log10(fdiff));
402 double units3 = std::max(floor(units10 / 3.0), 0.0);
403 double units = pow(10, (units10-fmod(units10, 3.0)));
404 int iunit = static_cast<int>(units3);
406 _startFrequency = newStartFrequency;
407 _stopFrequency = newStopFrequency;
408 _centerFrequency = newCenterFrequency;
410 _frequencyDisplayPlot->SetFrequencyRange(newStartFrequency,
413 UseRFFrequenciesCheckBox->isChecked(),
414 units, strunits[iunit]);
415 _waterfallDisplayPlot->SetFrequencyRange(newStartFrequency,
418 UseRFFrequenciesCheckBox->isChecked(),
419 units, strunits[iunit]);
420 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
421 _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
424 UseRFFrequenciesCheckBox->isChecked(),
425 units, strunits[iunit]);
431 SpectrumDisplayForm::GetAverageCount()
433 return _historyVector->size();
437 SpectrumDisplayForm::SetAverageCount(const int newCount)
440 if(newCount != static_cast<int>(_historyVector->size())){
441 std::vector<double*>::iterator pos;
442 while(newCount < static_cast<int>(_historyVector->size())){
443 pos = _historyVector->begin();
445 _historyVector->erase(pos);
448 while(newCount > static_cast<int>(_historyVector->size())){
449 _historyVector->push_back(new double[_numRealDataPoints]);
457 SpectrumDisplayForm::_AverageHistory(const double* newBuffer)
459 if(_numRealDataPoints > 0){
460 if(_historyVector->size() > 0){
461 memcpy(_historyVector->operator[](_historyEntry), newBuffer,
462 _numRealDataPoints*sizeof(double));
464 // Increment the next location to store data
465 _historyEntryCount++;
466 if(_historyEntryCount > static_cast<int>(_historyVector->size())){
467 _historyEntryCount = _historyVector->size();
469 _historyEntry = (++_historyEntry)%_historyVector->size();
471 // Total up and then average the values
473 for(uint64_t location = 0; location < _numRealDataPoints; location++){
475 for(int number = 0; number < _historyEntryCount; number++){
476 sum += _historyVector->operator[](number)[location];
478 _averagedValues[location] = sum/static_cast<double>(_historyEntryCount);
482 memcpy(_averagedValues, newBuffer, _numRealDataPoints*sizeof(double));
488 SpectrumDisplayForm::ResizeBuffers( const uint64_t numFFTDataPoints,
489 const uint64_t /*numTimeDomainDataPoints*/ )
491 // Convert from Complex to Real for certain Displays
492 if(_numRealDataPoints != numFFTDataPoints){
493 _numRealDataPoints = numFFTDataPoints;
494 delete[] _realFFTDataPoints;
495 delete[] _averagedValues;
497 _realFFTDataPoints = new double[_numRealDataPoints];
498 _averagedValues = new double[_numRealDataPoints];
499 memset(_realFFTDataPoints, 0x0, _numRealDataPoints*sizeof(double));
501 const int historySize = _historyVector->size();
502 SetAverageCount(0); // Clear the existing history
503 SetAverageCount(historySize);
510 SpectrumDisplayForm::Reset()
514 _waterfallDisplayPlot->Reset();
515 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
516 _waterfall3DDisplayPlot->Reset();
522 SpectrumDisplayForm::AverageDataReset()
525 _historyEntryCount = 0;
527 memset(_averagedValues, 0x0, _numRealDataPoints*sizeof(double));
529 MaxHoldResetBtn_clicked();
530 MinHoldResetBtn_clicked();
535 SpectrumDisplayForm::closeEvent( QCloseEvent *e )
537 if(_systemSpecifiedFlag){
538 _system->SetWindowOpenFlag(false);
541 qApp->processEvents();
543 QWidget::closeEvent(e);
548 SpectrumDisplayForm::WindowTypeChanged( int newItem )
550 if(_systemSpecifiedFlag){
551 _system->SetWindowType(newItem);
557 SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag )
559 SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency);
564 SpectrumDisplayForm::waterfallMaximumIntensityChangedCB( double newValue )
566 if(newValue > WaterfallMinimumIntensityWheel->value()){
567 WaterfallMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
570 WaterfallMaximumIntensityWheel->setValue(WaterfallMinimumIntensityWheel->value());
573 _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
574 WaterfallMaximumIntensityWheel->value());
579 SpectrumDisplayForm::waterfallMinimumIntensityChangedCB( double newValue )
581 if(newValue < WaterfallMaximumIntensityWheel->value()){
582 WaterfallMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
585 WaterfallMinimumIntensityWheel->setValue(WaterfallMaximumIntensityWheel->value());
588 _waterfallDisplayPlot->SetIntensityRange(WaterfallMinimumIntensityWheel->value(),
589 WaterfallMaximumIntensityWheel->value());
593 SpectrumDisplayForm::waterfall3DMaximumIntensityChangedCB( double newValue )
595 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
596 if(newValue > Waterfall3DMinimumIntensityWheel->value()){
597 Waterfall3DMaximumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
600 Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
603 _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
604 Waterfall3DMaximumIntensityWheel->value());
610 SpectrumDisplayForm::waterfall3DMinimumIntensityChangedCB( double newValue )
612 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
613 if(newValue < Waterfall3DMaximumIntensityWheel->value()){
614 Waterfall3DMinimumIntensityLabel->setText(QString("%1 dB").arg(newValue, 0, 'f', 0));
617 Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
620 _waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
621 Waterfall3DMaximumIntensityWheel->value());
627 SpectrumDisplayForm::FFTComboBoxSelectedCB( const QString &fftSizeString )
629 if(_systemSpecifiedFlag){
630 _system->SetFFTSize(fftSizeString.toLong());
636 SpectrumDisplayForm::WaterfallAutoScaleBtnCB()
638 double minimumIntensity = _noiseFloorAmplitude - 5;
639 if(minimumIntensity < WaterfallMinimumIntensityWheel->minValue()){
640 minimumIntensity = WaterfallMinimumIntensityWheel->minValue();
642 WaterfallMinimumIntensityWheel->setValue(minimumIntensity);
643 double maximumIntensity = _peakAmplitude + 10;
644 if(maximumIntensity > WaterfallMaximumIntensityWheel->maxValue()){
645 maximumIntensity = WaterfallMaximumIntensityWheel->maxValue();
647 WaterfallMaximumIntensityWheel->setValue(maximumIntensity);
648 waterfallMaximumIntensityChangedCB(maximumIntensity);
652 SpectrumDisplayForm::Waterfall3DAutoScaleBtnCB()
654 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
655 double minimumIntensity = _noiseFloorAmplitude - 5;
656 if(minimumIntensity < Waterfall3DMinimumIntensityWheel->minValue()){
657 minimumIntensity = Waterfall3DMinimumIntensityWheel->minValue();
659 Waterfall3DMinimumIntensityWheel->setValue(minimumIntensity);
660 double maximumIntensity = _peakAmplitude + 10;
661 if(maximumIntensity > Waterfall3DMaximumIntensityWheel->maxValue()){
662 maximumIntensity = Waterfall3DMaximumIntensityWheel->maxValue();
664 Waterfall3DMaximumIntensityWheel->setValue(maximumIntensity);
665 waterfallMaximumIntensityChangedCB(maximumIntensity);
670 SpectrumDisplayForm::WaterfallIntensityColorTypeChanged( int newType )
672 QColor lowIntensityColor;
673 QColor highIntensityColor;
674 if(newType == WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
675 // Select the Low Intensity Color
676 lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
677 if(!lowIntensityColor.isValid()){
678 lowIntensityColor = Qt::black;
680 QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok);
681 lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
683 // Select the High Intensity Color
684 highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
685 if(!highIntensityColor.isValid()){
686 highIntensityColor = Qt::white;
688 QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok);
689 highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
692 _waterfallDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor, highIntensityColor);
696 SpectrumDisplayForm::Waterfall3DIntensityColorTypeChanged( int newType )
698 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
699 QColor lowIntensityColor;
700 QColor highIntensityColor;
701 if(newType == Waterfall3DDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED){
702 // Select the Low Intensity Color
703 lowIntensityColor = _waterfallDisplayPlot->GetUserDefinedLowIntensityColor();
704 if(!lowIntensityColor.isValid()){
705 lowIntensityColor = Qt::black;
707 QMessageBox::information(this, "Low Intensity Color Selection", "In the next window, select the low intensity color for the waterfall display", QMessageBox::Ok);
708 lowIntensityColor = QColorDialog::getColor(lowIntensityColor, this);
710 // Select the High Intensity Color
711 highIntensityColor = _waterfallDisplayPlot->GetUserDefinedHighIntensityColor();
712 if(!highIntensityColor.isValid()){
713 highIntensityColor = Qt::white;
715 QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok);
716 highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
718 _waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor,
725 SpectrumDisplayForm::ToggleTabFrequency(const bool state)
728 if(d_plot_fft == -1) {
729 SpectrumTypeTab->addTab(FrequencyPage, "Frequency Display");
730 d_plot_fft = SpectrumTypeTab->count()-1;
734 SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(FrequencyPage));
740 SpectrumDisplayForm::ToggleTabWaterfall(const bool state)
743 if(d_plot_waterfall == -1) {
744 SpectrumTypeTab->addTab(WaterfallPage, "Waterfall Display");
745 d_plot_waterfall = SpectrumTypeTab->count()-1;
749 SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(WaterfallPage));
750 d_plot_waterfall = -1;
755 SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state)
758 if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
759 if(d_plot_waterfall3d == -1) {
760 SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
761 d_plot_waterfall3d = SpectrumTypeTab->count()-1;
766 SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));
767 d_plot_waterfall3d = -1;
772 SpectrumDisplayForm::ToggleTabTime(const bool state)
775 if(d_plot_time == -1) {
776 SpectrumTypeTab->addTab(TimeDomainPage, "Time Domain Display");
777 d_plot_time = SpectrumTypeTab->count()-1;
781 SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(TimeDomainPage));
787 SpectrumDisplayForm::ToggleTabConstellation(const bool state)
790 if(d_plot_constellation == -1) {
791 SpectrumTypeTab->addTab(ConstellationPage, "Constellation Display");
792 d_plot_constellation = SpectrumTypeTab->count()-1;
796 SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(ConstellationPage));
797 d_plot_constellation = -1;
803 SpectrumDisplayForm::SetTimeDomainAxis(double min, double max)
805 _timeDomainDisplayPlot->set_yaxis(min, max);
809 SpectrumDisplayForm::SetConstellationAxis(double xmin, double xmax,
810 double ymin, double ymax)
812 _constellationDisplayPlot->set_axis(xmin, xmax, ymin, ymax);
816 SpectrumDisplayForm::SetConstellationPenSize(int size)
818 _constellationDisplayPlot->set_pen_size( size );
822 SpectrumDisplayForm::SetFrequencyAxis(double min, double max)
824 _frequencyDisplayPlot->set_yaxis(min, max);