Bugfix: time gate filter size, improve dialog shutdown
This commit is contained in:
parent
4d959598b5
commit
dc5cb73b3f
@ -237,15 +237,6 @@ void Math::TimeGate::updateFilter()
|
|||||||
auto maxX = input->rData().back().x;
|
auto maxX = input->rData().back().x;
|
||||||
auto minX = input->rData().front().x;
|
auto minX = input->rData().front().x;
|
||||||
|
|
||||||
// auto c1 = center - span / 2;
|
|
||||||
// auto c2 = center + span / 2;
|
|
||||||
|
|
||||||
// if(c1 < minX) {
|
|
||||||
// c1 = minX;
|
|
||||||
// }
|
|
||||||
// if(c2 > maxX) {
|
|
||||||
// c2 = maxX;
|
|
||||||
// }
|
|
||||||
auto wc1 = Util::Scale<double>(center - span / 2, minX, maxX, 0, 1);
|
auto wc1 = Util::Scale<double>(center - span / 2, minX, maxX, 0, 1);
|
||||||
auto wc2 = Util::Scale<double>(center + span / 2, minX, maxX, 0, 1);
|
auto wc2 = Util::Scale<double>(center + span / 2, minX, maxX, 0, 1);
|
||||||
|
|
||||||
@ -270,7 +261,7 @@ void Math::TimeGate::updateFilter()
|
|||||||
Fft::shift(buf, true);
|
Fft::shift(buf, true);
|
||||||
Fft::transform(buf, false);
|
Fft::transform(buf, false);
|
||||||
|
|
||||||
filter.resize(buf.size());
|
filter.resize(buf.size() / 2);
|
||||||
for(unsigned int i=0;i<buf.size() / 2;i++) {
|
for(unsigned int i=0;i<buf.size() / 2;i++) {
|
||||||
filter[i] = abs(buf[i]);
|
filter[i] = abs(buf[i]);
|
||||||
}
|
}
|
||||||
@ -389,8 +380,6 @@ void Math::TimeGateGraph::paintEvent(QPaintEvent *event)
|
|||||||
p1.setY(Util::Scale<double>(y_last, -120, 20, plotBottom, plotTop));
|
p1.setY(Util::Scale<double>(y_last, -120, 20, plotBottom, plotTop));
|
||||||
p2.setX(Util::Scale<double>(now.x, minX, maxX, plotLeft, plotRight));
|
p2.setX(Util::Scale<double>(now.x, minX, maxX, plotLeft, plotRight));
|
||||||
p2.setY(Util::Scale<double>(y_now, -120, 20, plotBottom, plotTop));
|
p2.setY(Util::Scale<double>(y_now, -120, 20, plotBottom, plotTop));
|
||||||
// auto p1 = plotValueToPixel(last.x, y_last);
|
|
||||||
// auto p2 = plotValueToPixel(now.x, y_now);
|
|
||||||
// draw line
|
// draw line
|
||||||
p.drawLine(p1, p2);
|
p.drawLine(p1, p2);
|
||||||
}
|
}
|
||||||
@ -398,7 +387,7 @@ void Math::TimeGateGraph::paintEvent(QPaintEvent *event)
|
|||||||
auto filter = gate->rFilter();
|
auto filter = gate->rFilter();
|
||||||
pen = QPen(Qt::red, 1);
|
pen = QPen(Qt::red, 1);
|
||||||
p.setPen(pen);
|
p.setPen(pen);
|
||||||
for(unsigned int i=increment;i<filter.size();i+=increment) {
|
for(unsigned int i=increment;i<filter.size() && i<input.size();i+=increment) {
|
||||||
auto x_last = input[i-increment].x;
|
auto x_last = input[i-increment].x;
|
||||||
auto x_now = input[i].x;
|
auto x_now = input[i].x;
|
||||||
|
|
||||||
@ -414,9 +403,6 @@ void Math::TimeGateGraph::paintEvent(QPaintEvent *event)
|
|||||||
p1.setY(Util::Scale<double>(f_last, -120, 20, plotBottom, plotTop));
|
p1.setY(Util::Scale<double>(f_last, -120, 20, plotBottom, plotTop));
|
||||||
p2.setX(Util::Scale<double>(x_now, minX, maxX, plotLeft, plotRight));
|
p2.setX(Util::Scale<double>(x_now, minX, maxX, plotLeft, plotRight));
|
||||||
p2.setY(Util::Scale<double>(f_now, -120, 20, plotBottom, plotTop));
|
p2.setY(Util::Scale<double>(f_now, -120, 20, plotBottom, plotTop));
|
||||||
// auto p1 = plotValueToPixel(x_last, f_last);
|
|
||||||
// auto p2 = plotValueToPixel(x_now, f_now);
|
|
||||||
|
|
||||||
// draw line
|
// draw line
|
||||||
p.drawLine(p1, p2);
|
p.drawLine(p1, p2);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ TraceEditDialog::TraceEditDialog(Trace &t, QWidget *parent) :
|
|||||||
auto d = new QDialog();
|
auto d = new QDialog();
|
||||||
auto ui = new Ui::NewTraceMathDialog();
|
auto ui = new Ui::NewTraceMathDialog();
|
||||||
ui->setupUi(d);
|
ui->setupUi(d);
|
||||||
connect(d, &QDialog::finished, [=](){
|
connect(d, &QDialog::rejected, [=](){
|
||||||
delete ui;
|
delete ui;
|
||||||
});
|
});
|
||||||
for(int i = 0; i < (int) TraceMath::Type::Last;i++) {
|
for(int i = 0; i < (int) TraceMath::Type::Last;i++) {
|
||||||
@ -184,8 +184,9 @@ TraceEditDialog::TraceEditDialog(Trace &t, QWidget *parent) :
|
|||||||
connect(ui->list, &QListWidget::currentRowChanged, ui->stack, &QStackedWidget::setCurrentIndex);
|
connect(ui->list, &QListWidget::currentRowChanged, ui->stack, &QStackedWidget::setCurrentIndex);
|
||||||
|
|
||||||
connect(ui->list, &QListWidget::doubleClicked, ui->buttonBox, &QDialogButtonBox::accepted);
|
connect(ui->list, &QListWidget::doubleClicked, ui->buttonBox, &QDialogButtonBox::accepted);
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, [=](){
|
connect(d, &QDialog::accepted, [=](){
|
||||||
auto type = static_cast<TraceMath::Type>(ui->list->currentRow());
|
auto type = static_cast<TraceMath::Type>(ui->list->currentRow());
|
||||||
|
delete ui;
|
||||||
auto newMath = TraceMath::createMath(type);
|
auto newMath = TraceMath::createMath(type);
|
||||||
model->addOperations(newMath);
|
model->addOperations(newMath);
|
||||||
if(newMath.size() == 1) {
|
if(newMath.size() == 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user