56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <QHBoxLayout>
|
|
#include <QLabel>
|
|
|
|
#include "JFJochViewerImageROIStatistics_Circle.h"
|
|
|
|
JFJochViewerImageROIStatistics_Circle::JFJochViewerImageROIStatistics_Circle(QWidget *parent)
|
|
:QWidget(parent) {
|
|
auto layout = new QHBoxLayout(this);
|
|
|
|
setFixedWidth(300);
|
|
|
|
layout->addWidget(new QLabel("x: "));
|
|
x = new NumberLineEdit(0, 10000, 0, 1, "", this);
|
|
layout->addWidget(x);
|
|
|
|
layout->addWidget(new QLabel(" y: "));
|
|
y = new NumberLineEdit(0, 10000, 0, 1, "", this);
|
|
layout->addWidget(y);
|
|
|
|
|
|
layout->addWidget(new QLabel(" r: "));
|
|
r = new NumberLineEdit(0, 10000, 0, 1, "", this);
|
|
layout->addWidget(r);
|
|
|
|
connect(x, &NumberLineEdit::newValue, [this] (float) {emit Updated();});
|
|
connect(y, &NumberLineEdit::newValue, [this] (float) {emit Updated();});
|
|
connect(r, &NumberLineEdit::newValue, [this] (float) {emit Updated();});
|
|
}
|
|
|
|
void JFJochViewerImageROIStatistics_Circle::SetROICircle(const CircleSettings& input) {
|
|
Enable();
|
|
x->setValue(input.x);
|
|
y->setValue(input.y);
|
|
r->setValue(input.r);
|
|
}
|
|
|
|
void JFJochViewerImageROIStatistics_Circle::Disable() {
|
|
x->setEnabled(false);
|
|
y->setEnabled(false);
|
|
r->setEnabled(false);
|
|
}
|
|
|
|
void JFJochViewerImageROIStatistics_Circle::Enable() {
|
|
x->setEnabled(true);
|
|
y->setEnabled(true);
|
|
r->setEnabled(true);
|
|
}
|
|
|
|
CircleSettings JFJochViewerImageROIStatistics_Circle::GetROICircle() {
|
|
return CircleSettings{.x = x->value(), .y = y->value(), .r = r->value()};
|
|
}
|
|
|