|
|
|
|
@ -6,6 +6,8 @@
|
|
|
|
|
typedef QMap<int, PLP_DETECTOR_TASK> TaskMap;
|
|
|
|
|
typedef QMap<QString, PLP_DETECTOR_TASK> TaskMapStr;
|
|
|
|
|
|
|
|
|
|
#define WINDOW_ICON ":/resource/app.png"
|
|
|
|
|
|
|
|
|
|
QString showVariant(const AlgoParamType type, const QVariant &var) {
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
@ -120,7 +122,7 @@ CMainFrame::CMainFrame(QWidget *parent)
|
|
|
|
|
ui = new Ui::MainFrame;
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
setContextMenuPolicy(Qt::NoContextMenu);
|
|
|
|
|
setWindowIcon(QIcon(":/img/resource/app.png"));
|
|
|
|
|
setWindowIcon(QIcon(WINDOW_ICON));
|
|
|
|
|
connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(OnTreeItemClick()));
|
|
|
|
|
ui->treeWidget->setStyleSheet("QTreeWidget::item{height:30px}");
|
|
|
|
|
|
|
|
|
|
@ -705,10 +707,10 @@ bool CMainFrame::OnParamPopMenu(const QPoint& points)
|
|
|
|
|
// addAlgoAction->setObjectName("addAlgoAction");
|
|
|
|
|
// menu.addSeparator();
|
|
|
|
|
|
|
|
|
|
QAction *selectAlgoAction = menu.addAction(QObject::tr("选择算法"));
|
|
|
|
|
selectAlgoAction->setObjectName("selectAlgoAction");
|
|
|
|
|
QAction *editAction = menu.addAction(QObject::tr("编辑"));
|
|
|
|
|
editAction->setObjectName("editAction");
|
|
|
|
|
// QAction *selectAlgoAction = menu.addAction(QObject::tr("选择算法"));
|
|
|
|
|
// selectAlgoAction->setObjectName("selectAlgoAction");
|
|
|
|
|
// QAction *editAction = menu.addAction(QObject::tr("编辑"));
|
|
|
|
|
// editAction->setObjectName("editAction");
|
|
|
|
|
// QAction *deleteAction = menu.addAction(QStringLiteral("删除"));
|
|
|
|
|
// deleteAction->setObjectName("deleteAction");
|
|
|
|
|
// menu.addSeparator();
|
|
|
|
|
@ -821,7 +823,6 @@ bool CMainFrame::OnAddAlgo()
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnEditAlgo()
|
|
|
|
|
{
|
|
|
|
|
//return false;
|
|
|
|
|
if (!currentTask())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
@ -905,16 +906,17 @@ bool CMainFrame::OnSetAlgo()
|
|
|
|
|
IDetectorAlgorithm* pAlgo = m_pCurrentTask->GetAlgorithm(nCurrentID);
|
|
|
|
|
if (!pAlgo)
|
|
|
|
|
return false;
|
|
|
|
|
//CDsgAlgorithmParamMgrDlg m_tParamMgrDlg;
|
|
|
|
|
|
|
|
|
|
if (!m_tParamMgrDlg.Initialize(m_pDE, m_pCurrentTask, pAlgo,PARAM_IN))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
m_tParamMgrDlg.setParent(this);
|
|
|
|
|
m_tParamMgrDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_tParamMgrDlg.setWindowIcon(QIcon(WINDOW_ICON));
|
|
|
|
|
m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
m_tParamMgrDlg.ShowParamMgrDlg(pAlgo);
|
|
|
|
|
//m_tParamMgrDlg.exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -934,10 +936,13 @@ bool CMainFrame::OnSetOutParam()
|
|
|
|
|
IDetectorAlgorithm* pAlgo = m_pCurrentTask->GetAlgorithm(nCurrentID);
|
|
|
|
|
if (!pAlgo)
|
|
|
|
|
return false;
|
|
|
|
|
//CDsgAlgorithmParamMgrDlg m_tParamMgrDlg;
|
|
|
|
|
if (!m_tParamMgrDlg.Initialize(m_pDE, m_pCurrentTask, pAlgo,PARAM_OUT))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
m_tParamMgrDlg.setParent(this);
|
|
|
|
|
m_tParamMgrDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_tParamMgrDlg.setWindowIcon(QIcon(WINDOW_ICON));
|
|
|
|
|
m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
m_tParamMgrDlg.ShowParamMgrDlg(pAlgo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -962,18 +967,6 @@ bool CMainFrame::OnRunAlgo()
|
|
|
|
|
if (!pAlgo)
|
|
|
|
|
return false;
|
|
|
|
|
m_pCurrentTask->GetTaskInfo()->detectImg = m_pCurrentTask->GetTaskInfo()->templateImg;
|
|
|
|
|
//QString strHeader = "";
|
|
|
|
|
//strHeader += "<span style='font-size:15px;color:#ff0000;font-weight:bold;'>";
|
|
|
|
|
//strHeader += pAlgo->GetAlgorithmInfo()->strName;
|
|
|
|
|
|
|
|
|
|
//if (pCurrentTask->GetTaskInfo()->strImageName.size() > 0)
|
|
|
|
|
//{
|
|
|
|
|
// strHeader += "->";
|
|
|
|
|
// strHeader += pCurrentTask->GetTaskInfo()->strImageName;
|
|
|
|
|
//}
|
|
|
|
|
//strHeader += ":";
|
|
|
|
|
//ui->textEdit->append(strHeader);
|
|
|
|
|
|
|
|
|
|
if (pAlgo->Exec())
|
|
|
|
|
{
|
|
|
|
|
int nCount = pAlgo->EnumOutParam(NULL, 0);
|
|
|
|
|
@ -1029,12 +1022,12 @@ bool CMainFrame::OnRunAlgo()
|
|
|
|
|
}
|
|
|
|
|
case LP_BOOLEAN:
|
|
|
|
|
{
|
|
|
|
|
strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value);// lppOutParam[i]->value.toString();
|
|
|
|
|
strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case LP_STRING:
|
|
|
|
|
{
|
|
|
|
|
strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value); //lppOutParam[i]->value.toString();
|
|
|
|
|
strResult += showVariant(lppOutParam[i]->type, lppOutParam[i]->value);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case LP_DOUBLE:
|
|
|
|
|
@ -1225,17 +1218,8 @@ bool CMainFrame::OnGvInputWidgetPopMenu(const QPoint&)
|
|
|
|
|
{
|
|
|
|
|
m_TaskChangeList.append(strName);
|
|
|
|
|
}
|
|
|
|
|
// QString fileName = QFileDialog::getSaveFileName(this, tr("save image"), qApp->applicationDirPath(), tr("Image (*.bmp)"));
|
|
|
|
|
//
|
|
|
|
|
// if (!fileName.isNull())
|
|
|
|
|
// {
|
|
|
|
|
// std::string strpath = fileName.toLocal8Bit().toStdString();
|
|
|
|
|
// if (!cv::imwrite(strpath, m_pCurrentTask->GetTaskInfo()->img))
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu.clear();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -1328,23 +1312,8 @@ bool CMainFrame::OnInitCurrentAlgoParam()
|
|
|
|
|
ui->tableWidget->setItem(nIndex, 1, new QTableWidgetItem((*its)->strName));
|
|
|
|
|
ui->tableWidget->setItem(nIndex, 2, new QTableWidgetItem(GetParamTypeStr((*its)->type)));
|
|
|
|
|
ui->tableWidget->setItem(nIndex, 3, new QTableWidgetItem(showVariant((*its)->type, (*its)->value)));
|
|
|
|
|
//ui->tableWidget->setItem(nIndex, 4, new QTableWidgetItem((*its)->strDescription));
|
|
|
|
|
nIndex++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (int i = 0; i < nCount; i++)
|
|
|
|
|
// {
|
|
|
|
|
// if (lppParam[i])
|
|
|
|
|
// {
|
|
|
|
|
// ui->tableWidget->setRowCount(i + 1);
|
|
|
|
|
// ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString::number(lppParam[i]->nID)));
|
|
|
|
|
// ui->tableWidget->setItem(i, 1, new QTableWidgetItem(lppParam[i]->strName));
|
|
|
|
|
// ui->tableWidget->setItem(i, 2, new QTableWidgetItem(GetParamTypeStr(lppParam[i]->type)));
|
|
|
|
|
// ui->tableWidget->setItem(i, 3, new QTableWidgetItem(showVariant(lppParam[i]->type, lppParam[i]->value)));
|
|
|
|
|
// ui->tableWidget->setItem(i, 4, new QTableWidgetItem(lppParam[i]->strDescription));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
delete[] lppParam;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1399,20 +1368,22 @@ bool CMainFrame::OnAddParam()
|
|
|
|
|
|
|
|
|
|
if (!m_tParamDlg.InitGraphView())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
m_tParamDlg.setParent(this);
|
|
|
|
|
m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_tParamDlg.setWindowIcon(QIcon(WINDOW_ICON));
|
|
|
|
|
m_tParamDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_tParamDlg.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
PLP_ALGORITHM_PARAM pParam = m_tParamDlg.ShowParamDlg(NULL);
|
|
|
|
|
if (pParam)
|
|
|
|
|
{
|
|
|
|
|
int nRowCount = ui->tableWidget->rowCount();
|
|
|
|
|
|
|
|
|
|
ui->tableWidget->setRowCount(nRowCount + 1);
|
|
|
|
|
ui->tableWidget->setItem(nRowCount, 0, new QTableWidgetItem(QString::number(pParam->nID)));
|
|
|
|
|
ui->tableWidget->setItem(nRowCount, 1, new QTableWidgetItem(pParam->strName));
|
|
|
|
|
ui->tableWidget->setItem(nRowCount, 2, new QTableWidgetItem(GetParamTypeStr(pParam->type)));
|
|
|
|
|
ui->tableWidget->setItem(nRowCount, 3, new QTableWidgetItem(showVariant(pParam->type, pParam->value)));
|
|
|
|
|
|
|
|
|
|
ui->tableWidget->setItem(nRowCount, 4, new QTableWidgetItem(pParam->strDescription));
|
|
|
|
|
|
|
|
|
|
QString str = QString("%1").arg(pParam->strDescription);
|
|
|
|
|
ui->tableWidget->setItem(nRowCount, 4, new QTableWidgetItem(str));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1475,13 +1446,16 @@ bool CMainFrame::OnEditParam()
|
|
|
|
|
if (!m_tParamDlg.InitGraphView())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// m_tParamDlg.show();
|
|
|
|
|
|
|
|
|
|
m_tParamDlg.setParent(this);
|
|
|
|
|
m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_tParamDlg.setWindowIcon(QIcon(WINDOW_ICON));
|
|
|
|
|
m_tParamDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_tParamDlg.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
m_tParamDlg.ShowParamDlg(pParam);
|
|
|
|
|
// items.at(1)->setText(pParam->strName);
|
|
|
|
|
// items.at(2)->setText(GetParamTypeStr(pParam->type));
|
|
|
|
|
// items.at(3)->setText(showVariant(pParam->type,pParam->value));
|
|
|
|
|
//items.at(4)->setText(pParam->strDescription);
|
|
|
|
|
// items.at(4)->setText(pParam->strDescription);
|
|
|
|
|
QString st = _pOldTask->GetTaskInfo()->strName;
|
|
|
|
|
if (!m_TaskChangeList.contains(st))
|
|
|
|
|
{
|
|
|
|
|
@ -1783,30 +1757,24 @@ void CMainFrame::OnCellClicked(int row, int column)
|
|
|
|
|
IDetectorSolution * CMainFrame::currentSolution()
|
|
|
|
|
{
|
|
|
|
|
if (!m_pCurrentSolution) {
|
|
|
|
|
//emit sgShowStatus("current solution not exist");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
//emit sgShowStatus("current solution exist");
|
|
|
|
|
return m_pCurrentSolution;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IDetectorTask * CMainFrame::currentTask()
|
|
|
|
|
{
|
|
|
|
|
if (!m_pCurrentTask) {
|
|
|
|
|
//emit sgShowStatus("current task not exist");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
//emit sgShowStatus("current task exist");
|
|
|
|
|
return m_pCurrentTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IDetectorAlgorithm * CMainFrame::currentAlgorithm()
|
|
|
|
|
{
|
|
|
|
|
if (!m_pCurrentAlgo) {
|
|
|
|
|
//emit sgShowStatus("current algo not exist");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
//emit sgShowStatus("current algo exist");
|
|
|
|
|
return m_pCurrentAlgo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1816,16 +1784,11 @@ void CMainFrame::OnShowStatus(QString strMess)
|
|
|
|
|
p->showMessage(strMess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString CMainFrame::genInfo()
|
|
|
|
|
{
|
|
|
|
|
//<! solution xx:, task xx:, algo: xx;
|
|
|
|
|
QString strMess = "";
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMainFrame::closeEvent(QCloseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
return QMainWindow::closeEvent(event);;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_pOldTask){
|
|
|
|
|
if (!oldMat.empty())
|
|
|
|
|
_pOldTask->GetTaskInfo()->templateImg = oldMat;
|
|
|
|
|
|