21 #include "ui_cropdialog.h" 37 dataset_ = workspace_->GetDataset(dataset_key);
39 if (dataset_->non_spatial()){
40 ui->xMinDoubleSpinBox->setDisabled(
true);
41 ui->xMaxDoubleSpinBox->setDisabled(
true);
42 ui->yMinDoubleSpinBox->setDisabled(
true);
43 ui->yMaxDoubleSpinBox->setDisabled(
true);
46 double wl_min = dataset_->wavelength().min();
47 double wl_max = dataset_->wavelength().max();
49 QCPRange key_range = dataset_->KeyRange();
50 QCPRange value_range = dataset_->ValueRange();
52 ui->wlMinDoubleSpinBox->setMinimum(wl_min);
53 ui->wlMinDoubleSpinBox->setMaximum(wl_max);
54 ui->wlMaxDoubleSpinBox->setMinimum(wl_min);
55 ui->wlMaxDoubleSpinBox->setMaximum(wl_max);
57 ui->xMinDoubleSpinBox->setMinimum(key_range.
lower);
58 ui->xMinDoubleSpinBox->setMaximum(key_range.
upper);
59 ui->xMaxDoubleSpinBox->setMinimum(key_range.
lower);
60 ui->xMaxDoubleSpinBox->setMaximum(key_range.
upper);
62 ui->yMinDoubleSpinBox->setMinimum(value_range.
lower);
63 ui->yMinDoubleSpinBox->setMaximum(value_range.
upper);
64 ui->yMaxDoubleSpinBox->setMinimum(value_range.
lower);
65 ui->yMaxDoubleSpinBox->setMaximum(value_range.
upper);
79 void CropDialog::on_buttonBox_accepted()
81 double x_min = ui->xMinDoubleSpinBox->value();
82 double x_max = ui->xMaxDoubleSpinBox->value();
83 double y_min = ui->yMinDoubleSpinBox->value();
84 double y_max = ui->yMaxDoubleSpinBox->value();
85 double wl_min = ui->wlMinDoubleSpinBox->value();
86 double wl_max = ui->wlMaxDoubleSpinBox->value();
88 if (dataset_->non_spatial()){
94 if ((!std::isnan(x_max)) && ((x_max - x_min) <= 0 || (y_max - y_min <= 0))){
95 QMessageBox::warning(
this,
"Error",
"Minimum is larger than maximum!");
100 dataset_->CropSpectra(x_min, x_max, y_min, y_max, wl_min, wl_max);
110 void CropDialog::on_buttonBox_rejected()
CropDialog(QWidget *parent, QSharedPointer< VespucciWorkspace > ws, const QString &dataset_key)
CropDialog::CropDialog.
The CropDialog class A dialog that allows the user to "Crop" the dataset (delete all spectra that are...
Represents the range an axis is encompassing.