92 lines
3.5 KiB
C++
92 lines
3.5 KiB
C++
|
|
#include "dialogalgoarg.h"
|
||
|
|
#include "ui_dialogalgoarg.h"
|
||
|
|
#include "PathManager.h"
|
||
|
|
#include "VrLog.h"
|
||
|
|
|
||
|
|
DialogAlgoArg::DialogAlgoArg(IVrWheelMeasureConfig* config, WheelMeasureConfigResult* configResult,
|
||
|
|
QWidget *parent)
|
||
|
|
: QDialog(parent)
|
||
|
|
, ui(new Ui::DialogAlgoArg)
|
||
|
|
, m_config(config)
|
||
|
|
, m_configResult(configResult)
|
||
|
|
{
|
||
|
|
ui->setupUi(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
DialogAlgoArg::~DialogAlgoArg()
|
||
|
|
{
|
||
|
|
delete ui;
|
||
|
|
}
|
||
|
|
|
||
|
|
void DialogAlgoArg::Init()
|
||
|
|
{
|
||
|
|
loadParams();
|
||
|
|
}
|
||
|
|
|
||
|
|
void DialogAlgoArg::loadParams()
|
||
|
|
{
|
||
|
|
if (!m_configResult) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 加载角点参数
|
||
|
|
ui->edit_minEndingGap->setText(QString::number(m_configResult->algorithmParams.cornerParam.minEndingGap));
|
||
|
|
ui->edit_minEndingGap_z->setText(QString::number(m_configResult->algorithmParams.cornerParam.minEndingGap_z));
|
||
|
|
ui->edit_scale->setText(QString::number(m_configResult->algorithmParams.cornerParam.scale));
|
||
|
|
ui->edit_cornerTh->setText(QString::number(m_configResult->algorithmParams.cornerParam.cornerTh));
|
||
|
|
|
||
|
|
// 加载线段参数
|
||
|
|
ui->edit_segGapTh_y->setText(QString::number(m_configResult->algorithmParams.lineSegParam.segGapTh_y));
|
||
|
|
ui->edit_segGapTh_z->setText(QString::number(m_configResult->algorithmParams.lineSegParam.segGapTh_z));
|
||
|
|
ui->edit_maxDist->setText(QString::number(m_configResult->algorithmParams.lineSegParam.maxDist));
|
||
|
|
|
||
|
|
// 加载过滤参数
|
||
|
|
ui->edit_continuityTh->setText(QString::number(m_configResult->algorithmParams.filterParam.continuityTh));
|
||
|
|
ui->edit_outlierTh->setText(QString::number(m_configResult->algorithmParams.filterParam.outlierTh));
|
||
|
|
|
||
|
|
// 加载树生长参数
|
||
|
|
ui->edit_yDeviation_max->setText(QString::number(m_configResult->algorithmParams.growParam.yDeviation_max));
|
||
|
|
ui->edit_zDeviation_max->setText(QString::number(m_configResult->algorithmParams.growParam.zDeviation_max));
|
||
|
|
}
|
||
|
|
|
||
|
|
void DialogAlgoArg::saveParams()
|
||
|
|
{
|
||
|
|
if (!m_configResult || !m_config) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 保存角点参数
|
||
|
|
m_configResult->algorithmParams.cornerParam.minEndingGap = ui->edit_minEndingGap->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.cornerParam.minEndingGap_z = ui->edit_minEndingGap_z->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.cornerParam.scale = ui->edit_scale->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.cornerParam.cornerTh = ui->edit_cornerTh->text().toDouble();
|
||
|
|
|
||
|
|
// 保存线段参数
|
||
|
|
m_configResult->algorithmParams.lineSegParam.segGapTh_y = ui->edit_segGapTh_y->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.lineSegParam.segGapTh_z = ui->edit_segGapTh_z->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.lineSegParam.maxDist = ui->edit_maxDist->text().toDouble();
|
||
|
|
|
||
|
|
// 保存过滤参数
|
||
|
|
m_configResult->algorithmParams.filterParam.continuityTh = ui->edit_continuityTh->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.filterParam.outlierTh = ui->edit_outlierTh->text().toDouble();
|
||
|
|
|
||
|
|
// 保存树生长参数
|
||
|
|
m_configResult->algorithmParams.growParam.yDeviation_max = ui->edit_yDeviation_max->text().toDouble();
|
||
|
|
m_configResult->algorithmParams.growParam.zDeviation_max = ui->edit_zDeviation_max->text().toDouble();
|
||
|
|
|
||
|
|
// 保存到文件
|
||
|
|
QString configPath = PathManager::GetInstance().GetConfigFilePath();
|
||
|
|
m_config->SaveConfig(configPath.toStdString(), *m_configResult);
|
||
|
|
}
|
||
|
|
|
||
|
|
void DialogAlgoArg::on_btn_apply_clicked()
|
||
|
|
{
|
||
|
|
saveParams();
|
||
|
|
accept();
|
||
|
|
}
|
||
|
|
|
||
|
|
void DialogAlgoArg::on_btn_cancel_clicked()
|
||
|
|
{
|
||
|
|
reject();
|
||
|
|
}
|