AM3DNormalizationABEditor::AM3DNormalizationABEditor(AM3DNormalizationAB *analysisBlock, QWidget *parent) : QWidget(parent) { analysisBlock_ = analysisBlock; dataNames_ = new QComboBox; normalizationNames_ = new QComboBox; populateComboBox(); connect(dataNames_, SIGNAL(currentIndexChanged(int)), this, SLOT(onDataNameChoiceChanged(int))); connect(normalizationNames_, SIGNAL(currentIndexChanged(int)), this, SLOT(onNormalizationNameChoiceChanged(int))); connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(populateComboBox())); if (analysisBlock_->inputDataSourceCount() > 0){ dataNames_->setCurrentIndex(dataNames_->findData(analysisBlock_->dataName())); normalizationNames_->setCurrentIndex(normalizationNames_->findData(analysisBlock_->normalizationName())); } QFormLayout *layout = new QFormLayout; layout->addRow("Data:", dataNames_); layout->addRow("Normalization:", normalizationNames_); setLayout(layout); }
AM1DBasicIntegralABEditor::AM1DBasicIntegralABEditor(AM1DIntegralAB *analysisBlock, QWidget *parent) : QWidget(parent) { analysisBlock_ = analysisBlock; names_ = new QComboBox; populateComboBox(); connect(names_, SIGNAL(currentIndexChanged(int)), this, SLOT(onNameChoiceChanged(int))); connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(populateComboBox())); if (analysisBlock_->inputDataSourceCount() > 0) onNameChoiceChanged(0); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(new QLabel("Input:"), 0, Qt::AlignRight); layout->addWidget(names_, 0, Qt::AlignLeft); setLayout(layout); }
bool AMAnalysisBlock::setInputDataSources(const QList<AMDataSource*>& dataSources) { // if a non-empty set of data sources has been provided, and they are not acceptable, return false. (An empty list must always be acceptable) if(!dataSources.isEmpty() && !areInputDataSourcesAcceptable(dataSources)) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -98, QString("There was an error connecting the input data sources to this analysis component '%1: %2'. The data sources provided weren't acceptable. This can happen if they have the wrong dimension, don't provide enough data, etc.").arg(name()).arg(description()))); return false; } for(int i=0; i<inputDataSourceCount(); i++) { AMDataSource* oldSource = inputDataSourceAt(i); disconnect(oldSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*))); oldSource->deregisterObserver(this); } for(int i=0; i<dataSources.count(); i++) { AMDataSource* newSource = dataSources.at(i); connect(newSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*))); dataSources.at(i)->registerObserver(this); } setInputDataSourcesImplementation(dataSources); emit inputSourcesChanged(); return true; }
AM4DBinningABEditor::AM4DBinningABEditor(AM4DBinningAB *analysisBlock, QWidget *parent) : QWidget(parent) { analysisBlock_ = analysisBlock; names_ = new QComboBox; populateComboBox(); connect(names_, SIGNAL(currentIndexChanged(int)), this, SLOT(onNameChoiceChanged(int))); connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(populateComboBox())); axisSelector_ = new QComboBox(); axisSelector_->addItem("Horizontal"); axisSelector_->addItem("Vertical"); axisSelector_->addItem("Depth"); rangeMinControl_ = new QSpinBox(); rangeMinControl_->setSingleStep(1); rangeMinControl_->setMinimum(0); rangeMaxControl_ = new QSpinBox(); rangeMaxControl_->setSingleStep(1); rangeMaxControl_->setMinimum(0); plot_ = new MPlot(); plotWidget_ = new MPlotWidget(); plotWidget_->setPlot(plot_); plot_->plotArea()->setBrush(QBrush(QColor(Qt::white))); plot_->axisRight()->setTicks(0); plot_->axisBottom()->setTicks(4); plot_->axisLeft()->showGrid(false); plot_->axisBottom()->showAxisName(false); plot_->axisLeft()->showAxisName(false); plot_->axisScaleBottom()->setPadding(0); plot_->axisScaleLeft()->setPadding(0); seriesData_ = new MPlotVectorSeriesData(); series_ = new MPlotSeriesBasic(); series_->setMarker(MPlotMarkerShape::None); series_->setModel(seriesData_, true); plot_->addItem(series_); QColor white(Qt::white); QPen pen(white, 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); white.setAlphaF(0.6); rangeRectangle1_ = new MPlotRectangle(QRectF(0,0,10,10), Qt::NoPen, QBrush(white)); rangeRectangle1_->setSelectable(false); rangeRectangle1_->setIgnoreWhenAutoScaling(true); rangeRectangle1_->setZValue(3000); plot_->addItem(rangeRectangle1_); rangeRectangle1_->setVisible(false); rangeRectangle2_ = new MPlotRectangle(QRectF(0,0,10,10), Qt::NoPen, QBrush(white)); rangeRectangle2_->setSelectable(false); rangeRectangle2_->setIgnoreWhenAutoScaling(true); rangeRectangle2_->setZValue(3000); plot_->addItem(rangeRectangle2_); rangeRectangle2_->setVisible(false); plot_->legend()->enableDefaultLegend(false); plot_->addTool(new MPlotDragZoomerTool()); plot_->addTool(new MPlotWheelZoomerTool()); QVBoxLayout* vl = new QVBoxLayout(); QFormLayout* fl = new QFormLayout(); fl->addRow("Input:", names_); fl->addRow("Sum", axisSelector_); QHBoxLayout* hl = new QHBoxLayout(); hl->addWidget(rangeMinControl_); hl->addWidget(new QLabel("To")); hl->addWidget(rangeMaxControl_); fl->addRow("From (index)", hl); vl->addLayout(fl); vl->addWidget(plotWidget_); setLayout(vl); onAnalysisBlockInputDataSourcesChanged(); // This needs to be called last because it requires all of the pointers to be valid. All of dem. if (analysisBlock_->inputDataSourceCount() > 0) onNameChoiceChanged(0); // make connections connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(onAnalysisBlockInputDataSourcesChanged())); connect(axisSelector_, SIGNAL(currentIndexChanged(int)), this, SLOT(onSumAxisControlChanged(int))); connect(rangeMinControl_, SIGNAL(valueChanged(int)), this, SLOT(onRangeMinControlChanged(int))); connect(rangeMaxControl_, SIGNAL(valueChanged(int)), this, SLOT(onRangeMaxControlChanged(int))); }
AM1DCalibrationABEditor::AM1DCalibrationABEditor(AM1DCalibrationAB *analysisBlock, QWidget *parent) : QWidget(parent) { analysisBlock_ = analysisBlock; chooseScanDialog_ = 0; dataNames_ = new QComboBox; normalizationNames_ = new QComboBox; populateComboBox(); /// Spinners for Energy calibration energyCalibrationOffsetBox_ = new QDoubleSpinBox; energyCalibrationOffsetBox_->setSingleStep(0.1); energyCalibrationOffsetBox_->setRange(-1000,1000); energyCalibrationOffsetBox_->setValue(analysisBlock_->energyCalibrationOffset()); energyCalibrationReferenceBox_ = new QDoubleSpinBox; energyCalibrationReferenceBox_->setSingleStep(0.1); energyCalibrationReferenceBox_->setRange(-1000,20000); energyCalibrationReferenceBox_->setValue(analysisBlock_->energyCalibrationReference()); energyCalibrationScalingBox_ = new QDoubleSpinBox; energyCalibrationScalingBox_->setSingleStep(0.01); energyCalibrationScalingBox_->setRange(0.01,5); energyCalibrationScalingBox_->setValue(analysisBlock_->energyCalibrationScaling()); isTransmissionCheckbox_ = new QCheckBox; isTransmissionCheckbox_->setChecked(analysisBlock_->isTransmission()); toEdgeJumpCheckbox_ = new QCheckBox; toEdgeJumpCheckbox_->setChecked(analysisBlock_->toEdgeJump()); preEdgePointSlider_ = new QSlider(Qt::Horizontal); preEdgePointSlider_->setValue(analysisBlock_->preEdgePoint()); preEdgePointSlider_->setRange(-1,analysisBlock_->size(0)-1); preEdgePointSlider_->setEnabled(analysisBlock_->toEdgeJump()); postEdgePointSlider_ = new QSlider(Qt::Horizontal); postEdgePointSlider_->setValue(analysisBlock_->postEdgePoint()); postEdgePointSlider_->setRange(-1,analysisBlock_->size(0)-1); postEdgePointSlider_->setEnabled(analysisBlock_->toEdgeJump()); /// Apply to sources/scans button applyToAllSourcesButton_ = new QPushButton("Apply to All Sources"); applyToScansButton_ = new QPushButton("Apply to Scans..."); connect(dataNames_, SIGNAL(currentIndexChanged(int)), this, SLOT(onDataNameChoiceChanged(int))); connect(normalizationNames_, SIGNAL(currentIndexChanged(int)), this, SLOT(onNormalizationNameChoiceChanged(int))); connect(analysisBlock_, SIGNAL(inputSourcesChanged()), this, SLOT(populateComboBox())); connect(energyCalibrationOffsetBox_, SIGNAL(valueChanged(double)), this, SLOT(onEnergyCalibrationOffsetChanged(double))); connect(energyCalibrationScalingBox_, SIGNAL(valueChanged(double)), this, SLOT(onEnergyCalibrationScalingChanged(double))); connect(energyCalibrationReferenceBox_, SIGNAL(valueChanged(double)), this, SLOT(onEnergyCalibrationReferenceChanged(double))); connect(applyToScansButton_, SIGNAL(clicked()), this, SLOT(onApplyToScansButtonClicked())); connect(isTransmissionCheckbox_, SIGNAL(clicked(bool)), this, SLOT(onIsTransmissionChanged(bool))); connect(toEdgeJumpCheckbox_, SIGNAL(clicked(bool)), this, SLOT(onToEdgeJumpChanged(bool))); connect(preEdgePointSlider_, SIGNAL(valueChanged(int)), this, SLOT(onPreEdgePointChanged(int))); connect(postEdgePointSlider_, SIGNAL(valueChanged(int)), this, SLOT(onPostEdgePointChanged(int))); preEdgePointLabel_ = new QLabel("Set to zero at:"); postEdgePointLabel_ = new QLabel("Set to one at"); if (analysisBlock_->inputDataSourceCount() > 0){ dataNames_->setCurrentIndex(dataNames_->findData(analysisBlock_->dataName())); normalizationNames_->setCurrentIndex(normalizationNames_->findData(analysisBlock_->normalizationName())); } onPreEdgePointChanged(analysisBlock->preEdgePoint()); //to set widget labels onPostEdgePointChanged(analysisBlock->postEdgePoint()); QFormLayout *layout = new QFormLayout; layout->addRow("Data:", dataNames_); layout->addRow("Normalization:", normalizationNames_); layout->addRow("Transmisssion Spectra:", isTransmissionCheckbox_); layout->addRow("Normalize to Edge:", toEdgeJumpCheckbox_); layout->addRow(preEdgePointLabel_, preEdgePointSlider_); layout->addRow(postEdgePointLabel_, postEdgePointSlider_); layout->addRow("Offset:", energyCalibrationOffsetBox_); layout->addRow("Scaling:",energyCalibrationScalingBox_); layout->addRow("Reference:",energyCalibrationReferenceBox_); layout->addRow("", applyToScansButton_); setLayout(layout); }