v1.0.0-rc.72
This commit is contained in:
@@ -9,21 +9,36 @@ JFJochViewerSidePanelChart::JFJochViewerSidePanelChart(QWidget *parent) : QWidge
|
||||
|
||||
combo_box = new QComboBox(this);
|
||||
combo_box->addItem("Azimuthal integration (1D)", 0);
|
||||
combo_box->addItem("Azimuthal integration (2D)", 3);
|
||||
combo_box->addItem("Wilson plot", 1);
|
||||
combo_box->addItem("I/sigma", 2);
|
||||
|
||||
|
||||
layout->addWidget(combo_box);
|
||||
|
||||
connect(combo_box, &QComboBox::currentIndexChanged,
|
||||
this, &JFJochViewerSidePanelChart::comboBoxSelected);
|
||||
|
||||
azint_plot = new JFJochSimpleChartView(this);
|
||||
layout->addWidget(azint_plot);
|
||||
azint_image = new JFJochAzIntImageView(this);
|
||||
|
||||
stack = new QStackedWidget(this);
|
||||
stack->addWidget(azint_plot); // index 0
|
||||
stack->addWidget(azint_image); // index 1
|
||||
layout->addWidget(stack);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void JFJochViewerSidePanelChart::comboBoxSelected(int val) {
|
||||
// Switch between chart (options 0..2) and image (option 3)
|
||||
auto index = combo_box->currentIndex();
|
||||
int mode = combo_box->itemData(index).toInt();
|
||||
if (mode == 3) {
|
||||
stack->setCurrentWidget(azint_image);
|
||||
} else {
|
||||
stack->setCurrentWidget(azint_plot);
|
||||
}
|
||||
redrawPlot();
|
||||
}
|
||||
|
||||
@@ -44,12 +59,29 @@ void JFJochViewerSidePanelChart::redrawPlot() {
|
||||
x = image->ImageData().integration_one_over_d;
|
||||
y = image->ImageData().integration_Isigma;
|
||||
break;
|
||||
case 3: {
|
||||
// Render 2D azimuthal integration as an image
|
||||
const auto &profile = image->ImageData().az_int_profile;
|
||||
const auto &ds = image->Dataset();
|
||||
int az_bins = ds.azimuthal_bins;
|
||||
int q_bins = ds.q_bins;
|
||||
if (az_bins > 1 && q_bins > 0 && profile.size() == static_cast<size_t>(az_bins * q_bins)) {
|
||||
azint_image->SetData(profile, az_bins, q_bins);
|
||||
} else {
|
||||
azint_image->Clear();
|
||||
}
|
||||
// Make sure we don't try to update the chart in this mode
|
||||
x.clear();
|
||||
y.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!x.empty() && !y.empty())
|
||||
if (!x.empty() && !y.empty()) {
|
||||
azint_plot->UpdateData(x,y);
|
||||
else
|
||||
} else {
|
||||
azint_plot->ClearData();
|
||||
}
|
||||
}
|
||||
|
||||
void JFJochViewerSidePanelChart::loadImage(std::shared_ptr<const JFJochReaderImage> in_image) {
|
||||
|
||||
Reference in New Issue
Block a user