| 613 | } |
| 614 | |
| 615 | void |
| 616 | TimeWindow::populateSamplingProperties(SamplingProperties &prop) |
| 617 | { |
| 618 | bool haveSelection = this->ui->realWaveform->getHorizontalSelectionPresent(); |
| 619 | bool intSelection = |
| 620 | haveSelection && this->ui->intSelectionButton->isChecked(); |
| 621 | qreal seconds; |
| 622 | |
| 623 | prop.fs = this->fs; |
| 624 | prop.loopGain = 0; |
| 625 | |
| 626 | if (this->ui->clkGardnerButton->isChecked()) |
| 627 | prop.sync = SamplingClockSync::GARDNER; |
| 628 | else if (this->ui->clkZcButton->isChecked()) |
| 629 | prop.sync = SamplingClockSync::ZERO_CROSSING; |
| 630 | else |
| 631 | prop.sync = SamplingClockSync::MANUAL; |
| 632 | |
| 633 | if (this->ui->decAmplitudeButton->isChecked()) { |
| 634 | prop.space = SamplingSpace::AMPLITUDE; |
| 635 | prop.zeroCrossingAngle = this->ui->clkComponentCombo->currentIndex() == 0 |
| 636 | ? 1 |
| 637 | : -I; |
| 638 | } else if (this->ui->decPhaseButton->isChecked()) { |
| 639 | prop.space = SamplingSpace::PHASE; |
| 640 | } else if (this->ui->decFrequencyButton->isChecked()) { |
| 641 | prop.space = SamplingSpace::FREQUENCY; |
| 642 | } |
| 643 | |
| 644 | if (intSelection) { |
| 645 | size_t start = static_cast<size_t>( |
| 646 | this->ui->realWaveform->getHorizontalSelectionStart()); |
| 647 | prop.data = this->getDisplayData() + start; |
| 648 | prop.length = |
| 649 | static_cast<size_t>( |
| 650 | this->ui->realWaveform->getHorizontalSelectionEnd() |
| 651 | - this->ui->realWaveform->getHorizontalSelectionStart()); |
| 652 | prop.symbolSync = start; |
| 653 | } else { |
| 654 | prop.data = this->getDisplayData(); |
| 655 | prop.length = this->getDisplayDataLength(); |
| 656 | prop.symbolSync = 0; |
| 657 | } |
| 658 | |
| 659 | seconds = prop.length / this->fs; |
| 660 | |
| 661 | if (haveSelection && this->ui->clkSelectionButton->isChecked()) { |
| 662 | if (intSelection) { |
| 663 | // Interval is selection. Select all subdivisions |
| 664 | prop.symbolCount = this->ui->periodicDivisionsSpin->value(); |
| 665 | prop.rate = prop.symbolCount / seconds; |
| 666 | } else { |
| 667 | qreal selLength = |
| 668 | this->ui->realWaveform->getHorizontalSelectionEnd() |
| 669 | - this->ui->realWaveform->getHorizontalSelectionStart(); |
| 670 | |
| 671 | // Compute deltaT based on selection and then the number of symbols |
| 672 | // in the defined interval. |
no test coverage detected