|
|
|
|
@ -127,22 +127,13 @@ CMainFrame::CMainFrame(QWidget *parent)
|
|
|
|
|
|
|
|
|
|
ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnParamListPopMenu(const QPoint&)));
|
|
|
|
|
connect(ui->tableWidget, SIGNAL(cellChanged(int, int)), this, SLOT(OnCellChanged(int, int)));
|
|
|
|
|
connect(ui->tableWidget, SIGNAL(cellClicked(int, int)), this, SLOT(OnCellClicked(int, int)));
|
|
|
|
|
// connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(OnListItemClick()));
|
|
|
|
|
// connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(OnListItemDoubleClick()));
|
|
|
|
|
|
|
|
|
|
// ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
// connect(ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnListWidgetPopMenu(const QPoint&)));
|
|
|
|
|
|
|
|
|
|
ui->gv_input->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(ui->gv_input, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OnGvInputWidgetPopMenu(const QPoint&)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnClearResult()));
|
|
|
|
|
connect(ui->m_pbLoadImage, SIGNAL(clicked()), this, SLOT(onLoadImage()));
|
|
|
|
|
//connect(ui->menubar, SIGNAL(triggered(QAction *)), this, SLOT(OnMainMenuTrigger(QAction*)));
|
|
|
|
|
connect(ui->m_pbSaveBtn, SIGNAL(clicked()), this, SLOT(OnTrigger()));
|
|
|
|
|
connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnClearResult()));//清空打印信息
|
|
|
|
|
connect(ui->m_pbLoadImage, SIGNAL(clicked()), this, SLOT(onLoadImage()));//加载图片
|
|
|
|
|
connect(ui->m_pbSaveBtn, SIGNAL(clicked()), this, SLOT(OnTrigger()));//保存标定参数
|
|
|
|
|
connect(this, SIGNAL(sgShowStatus(QString)), this, SLOT(OnShowStatus(QString)));
|
|
|
|
|
|
|
|
|
|
ui->gv_input->setInfoLabel(ui->label_pixel_info);
|
|
|
|
|
@ -156,7 +147,6 @@ CMainFrame::CMainFrame(QWidget *parent)
|
|
|
|
|
m_plablStatus = new QLabel(this);
|
|
|
|
|
ui->statusBar->addWidget(m_plablStatus);
|
|
|
|
|
_pSaveStatus = ui->label_SaveStatus;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CMainFrame::~CMainFrame()
|
|
|
|
|
@ -257,9 +247,12 @@ bool CMainFrame::InitGraphView()
|
|
|
|
|
ui->tableWidget_2->verticalHeader()->setHidden(true);
|
|
|
|
|
ui->tableWidget_2->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
|
|
|
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
|
|
|
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
|
|
|
|
|
|
|
|
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Custom);
|
|
|
|
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Custom);
|
|
|
|
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
|
|
|
|
|
ui->tableWidget->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch);
|
|
|
|
|
ui->tableWidget->hideColumn(2);
|
|
|
|
|
ui->tableWidget_2->hideColumn(2);
|
|
|
|
|
ui->textEdit->setWordWrapMode(QTextOption::NoWrap);
|
|
|
|
|
|
|
|
|
|
{ /*获取所有的solution*/
|
|
|
|
|
@ -364,6 +357,7 @@ bool CMainFrame::InitCurrentTask()
|
|
|
|
|
|
|
|
|
|
ui->tableWidget_2->setItem(nIndex, 1, new QTableWidgetItem(QObject::tr(pAlg->GetAlgorithmInfo()->strName.toStdString().c_str())));
|
|
|
|
|
ui->tableWidget_2->setItem(nIndex, 2, new QTableWidgetItem(QString::number(pAlg->GetAlgorithmInfo()->nRoiID)));
|
|
|
|
|
ui->tableWidget_2->setItem(nIndex, 3, new QTableWidgetItem(pAlg->GetAlgorithmInfo()->strDescription));
|
|
|
|
|
|
|
|
|
|
if (nIndex == 0)
|
|
|
|
|
{
|
|
|
|
|
@ -459,58 +453,6 @@ bool CMainFrame::OnSetRunSolution()
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnBatchLoadImage(bool bReLoad)
|
|
|
|
|
{
|
|
|
|
|
if (!currentTask())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
QString strDefaultDirPath = m_pCurrentTask->GetTaskInfo()->strDirPath;
|
|
|
|
|
QStringList strFileNamesList = QFileDialog::getOpenFileNames(this, "open file", strDefaultDirPath, "Images (*.bmp *.png *.xpm *.jpg)");
|
|
|
|
|
if (strFileNamesList.size() <= 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ui->listWidget->clear();
|
|
|
|
|
// ui->listWidget->setSpacing(12);
|
|
|
|
|
// ui->listWidget->setMovement(QListView::Static);
|
|
|
|
|
// ui->listWidget->setViewMode(QListView::IconMode);
|
|
|
|
|
// ui->listWidget->setWrapping(false);
|
|
|
|
|
// ui->listWidget->setFlow(QListView::LeftToRight);
|
|
|
|
|
|
|
|
|
|
// for (int i = 0; i < strFileNamesList.size(); i++)
|
|
|
|
|
// {
|
|
|
|
|
// QListWidgetItem* item = new QListWidgetItem("Test", ui->listWidget);
|
|
|
|
|
// item->setData(Qt::UserRole, strFileNamesList.at(i));
|
|
|
|
|
// item->setText(strFileNamesList.at(i).split("/").last());
|
|
|
|
|
// ui->listWidget->addItem(item);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
QString strFileName = strFileNamesList[0];
|
|
|
|
|
std::string strpath = strFileName.toLocal8Bit().toStdString();//中文路径支持
|
|
|
|
|
//cv::Mat m_img = cv::imread(strpath, CV_LOAD_IMAGE_UNCHANGED);
|
|
|
|
|
m_pCurrentTask->GetTaskInfo()->templateImg = cv::imread(strpath, CV_LOAD_IMAGE_GRAYSCALE);
|
|
|
|
|
oldMat = m_pCurrentTask->GetTaskInfo()->templateImg;
|
|
|
|
|
if (ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input))
|
|
|
|
|
{
|
|
|
|
|
m_pCurrentTask->GetTaskInfo()->strImageName = strFileName.split("/").last();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnCopyFileTitle()
|
|
|
|
|
{
|
|
|
|
|
// QListWidgetItem* item = ui->listWidget->currentItem();
|
|
|
|
|
|
|
|
|
|
// if (item)
|
|
|
|
|
// {
|
|
|
|
|
// QClipboard *clipboard = QApplication::clipboard();
|
|
|
|
|
// clipboard->setText(item->text());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnShowCameraImage(QImage img)
|
|
|
|
|
{
|
|
|
|
|
m_pCurrentTask->GetTaskInfo()->templateImg = ColossusBase::QImage2cvMat(img).clone();
|
|
|
|
|
@ -527,20 +469,6 @@ void __stdcall ImageEventHandler(void * callBackOwner, QImage& img, int nDeviceI
|
|
|
|
|
emit p->sgShowCameraImage(img);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnSnapImage()
|
|
|
|
|
{
|
|
|
|
|
// if (!currentTask())
|
|
|
|
|
// return false;
|
|
|
|
|
//
|
|
|
|
|
// DeviceType type;
|
|
|
|
|
// IDetectorCameraDevice* pCamera = (IDetectorCameraDevice*)m_pDeviceMgr->GetDevice(m_pCurrentTask->GetTaskInfo()->nCameraID, type);
|
|
|
|
|
// if (!pCamera && type != CAMERA)
|
|
|
|
|
// return false;
|
|
|
|
|
//
|
|
|
|
|
// pCamera->SnapImage(this, ImageEventHandler);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::InitCurrentNode()
|
|
|
|
|
{
|
|
|
|
|
if (!m_pSolutionMgr)
|
|
|
|
|
@ -578,10 +506,8 @@ bool CMainFrame::InitCurrentNode()
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -589,42 +515,26 @@ bool CMainFrame::OnTreeItemClick()
|
|
|
|
|
{
|
|
|
|
|
if (!InitCurrentTask())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnParamPopMenu(const QPoint& points)
|
|
|
|
|
{
|
|
|
|
|
if (!currentTask())
|
|
|
|
|
return false;
|
|
|
|
|
QMenu menu(this);
|
|
|
|
|
QAction *runAction = menu.addAction(QObject::tr("运行"));
|
|
|
|
|
runAction->setObjectName("runAction");
|
|
|
|
|
menu.addSeparator();
|
|
|
|
|
|
|
|
|
|
// QAction *addAlgoAction = menu.addAction(QStringLiteral("添加算法"));
|
|
|
|
|
// addAlgoAction->setObjectName("addAlgoAction");
|
|
|
|
|
// menu.addSeparator();
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
QAction *setAction = menu.addAction(QObject::tr("输入参数设置"));
|
|
|
|
|
setAction->setObjectName("setAction");
|
|
|
|
|
QAction *outParamAction = menu.addAction(QObject::tr("输出参数设置"));
|
|
|
|
|
outParamAction->setObjectName("outParamAction");
|
|
|
|
|
|
|
|
|
|
// QAction *importParamAciton = menu.addAction(QStringLiteral("导入参数"));
|
|
|
|
|
// QAction *exportParamAciton = menu.addAction(QStringLiteral("导出参数"));
|
|
|
|
|
// QAction *importOutParamAciton = menu.addAction(QStringLiteral("导入输出参数"));
|
|
|
|
|
// QAction *exportOutParamAciton = menu.addAction(QStringLiteral("导出输出参数"));
|
|
|
|
|
QAction *updateRelyOnAlgoAciton = menu.addAction(QObject::tr("更新关联算法参数"));
|
|
|
|
|
updateRelyOnAlgoAciton->setObjectName("updateRelyOnAlgoAciton");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QAction *selectedAction = menu.exec(QCursor::pos());
|
|
|
|
|
if (!selectedAction)
|
|
|
|
|
{
|
|
|
|
|
@ -787,7 +697,6 @@ bool CMainFrame::OnDeleteAlgo()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -808,7 +717,6 @@ 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);
|
|
|
|
|
@ -817,11 +725,8 @@ bool CMainFrame::OnSetAlgo()
|
|
|
|
|
m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
m_tParamMgrDlg.ShowParamMgrDlg(pAlgo);
|
|
|
|
|
//m_tParamMgrDlg.exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -841,7 +746,6 @@ 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;
|
|
|
|
|
|
|
|
|
|
@ -851,10 +755,8 @@ bool CMainFrame::OnSetOutParam()
|
|
|
|
|
m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
m_tParamMgrDlg.ShowParamMgrDlg(pAlgo);
|
|
|
|
|
//m_tParamMgrDlg.exec();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -875,44 +777,32 @@ 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())
|
|
|
|
|
{
|
|
|
|
|
QString strResult = "";
|
|
|
|
|
|
|
|
|
|
strResult += "<span style='font-size:10px;font-weight:bold;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;font-weight:bold;'>";
|
|
|
|
|
strResult += QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
strResult += " ";
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strResult += "<span style='font-size:10px;font-weight:bold;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;font-weight:bold;'>";
|
|
|
|
|
strResult += QObject::tr("算法名称:");
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
|
|
|
|
|
strResult += "<span style='font-size:10px;color:#ff0000;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;color:#ff0000;'>";
|
|
|
|
|
strResult += QObject::tr(pAlgo->GetAlgorithmInfo()->strName.toStdString().c_str());
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
strResult += ",";
|
|
|
|
|
|
|
|
|
|
if (m_pCurrentTask->GetTaskInfo()->strImageName.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
strResult += "<span style='font-size:10px;font-weight:bold;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;font-weight:bold;'>";
|
|
|
|
|
strResult += QObject::tr("图片名称:");
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
|
|
|
|
|
strResult += "<span style='font-size:10px;color:#ff0000;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;color:#ff0000;'>";
|
|
|
|
|
strResult += m_pCurrentTask->GetTaskInfo()->strImageName;
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
strResult += ",";
|
|
|
|
|
@ -924,11 +814,11 @@ bool CMainFrame::OnRunAlgo()
|
|
|
|
|
PLP_ALGORITHM_PARAM pOutParam = *it;
|
|
|
|
|
if (pOutParam)
|
|
|
|
|
{
|
|
|
|
|
strResult += "<span style='font-size:10px;font-weight:bold;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;font-weight:bold;'>";
|
|
|
|
|
strResult += pOutParam->strName + ":";
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
|
|
|
|
|
strResult += "<span style='font-size:10px;color:#ff0000;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;color:#ff0000;'>";
|
|
|
|
|
switch (pOutParam->type)
|
|
|
|
|
{
|
|
|
|
|
case LP_INT:
|
|
|
|
|
@ -994,12 +884,11 @@ bool CMainFrame::OnRunAlgo()
|
|
|
|
|
strResult = strResult.left(strResult.length() - 1);
|
|
|
|
|
ui->textEdit->append(strResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
QString strResult = "";
|
|
|
|
|
strResult += "<span style='font-size:10px;color:#ff0000;'>";
|
|
|
|
|
strResult += "<span style='font-size:12px;color:#ff0000;'>";
|
|
|
|
|
strResult += QObject::tr("加载算法失败,请检查是否配置相应的算法库");
|
|
|
|
|
strResult += "</span>";
|
|
|
|
|
ui->textEdit->append(strResult);
|
|
|
|
|
@ -1070,27 +959,6 @@ bool CMainFrame::OnSelectAlgo()
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnListWidgetPopMenu(const QPoint&)
|
|
|
|
|
{
|
|
|
|
|
QMenu menu;
|
|
|
|
|
QAction *batchLoadImgAction = menu.addAction(QObject::tr("加载标定图片"));
|
|
|
|
|
//QAction *copyTitleAction = menu.addAction(QStringLiteral("复制图片名称"));
|
|
|
|
|
//QAction *deleteAction = menu.addAction(QStringLiteral("删除"));
|
|
|
|
|
|
|
|
|
|
QAction *selectedAction = menu.exec(QCursor::pos());
|
|
|
|
|
if (!selectedAction)
|
|
|
|
|
{
|
|
|
|
|
menu.clear();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (selectedAction == batchLoadImgAction)
|
|
|
|
|
{
|
|
|
|
|
OnBatchLoadImage();
|
|
|
|
|
}
|
|
|
|
|
menu.clear();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnGvInputWidgetPopMenu(const QPoint&)
|
|
|
|
|
{
|
|
|
|
|
if (!m_pCurrentTask || m_pCurrentTask->GetTaskInfo()->templateImg.empty())
|
|
|
|
|
@ -1126,8 +994,6 @@ bool CMainFrame::OnGvInputWidgetPopMenu(const QPoint&)
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menu.clear();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -1137,35 +1003,11 @@ bool CMainFrame::OnListItemDoubleClick()
|
|
|
|
|
return OnRunAlgo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnListItemClick()
|
|
|
|
|
{
|
|
|
|
|
// if (m_pCurrentTask)
|
|
|
|
|
// {
|
|
|
|
|
// QListWidgetItem* item = ui->listWidget->currentItem();
|
|
|
|
|
//
|
|
|
|
|
// if (item)
|
|
|
|
|
// {
|
|
|
|
|
// QString strFilePath = item->data(Qt::UserRole).toString();
|
|
|
|
|
// std::string strpath = strFilePath.toLocal8Bit().toStdString();
|
|
|
|
|
// m_pCurrentTask->GetTaskInfo()->templateImg = cv::imread(strpath, 0);
|
|
|
|
|
//
|
|
|
|
|
// if (ColossusBase::showImage(m_pCurrentTask->GetTaskInfo()->templateImg, ui->gv_input))
|
|
|
|
|
// {
|
|
|
|
|
// m_pCurrentTask->GetTaskInfo()->strImageName = strFilePath.split("/").last();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnClearResult()
|
|
|
|
|
{
|
|
|
|
|
ui->textEdit->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnInitCurrentAlgoParam()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
@ -1204,13 +1046,16 @@ bool CMainFrame::OnInitCurrentAlgoParam()
|
|
|
|
|
QMap<QString, PLP_ALGORITHM_PARAM> mParam = m_pCurrentAlgo->GetAllParams();
|
|
|
|
|
int nIndex = 0;
|
|
|
|
|
for (QMap<QString, PLP_ALGORITHM_PARAM>::iterator its = mParam.begin(); its != mParam.end(); ++its){
|
|
|
|
|
PLP_ALGORITHM_PARAM pParam = *its;
|
|
|
|
|
if(pParam->bIsShow == false)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
ui->tableWidget->setRowCount(nIndex + 1);
|
|
|
|
|
ui->tableWidget->setItem(nIndex, 0, new QTableWidgetItem(QString::number(nIndex + 1)));
|
|
|
|
|
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));
|
|
|
|
|
ui->tableWidget->setItem(nIndex, 4, new QTableWidgetItem((*its)->strDescription));
|
|
|
|
|
nIndex++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1222,38 +1067,27 @@ bool CMainFrame::OnInitCurrentAlgoParam()
|
|
|
|
|
bool CMainFrame::OnParamListPopMenu(const QPoint&)
|
|
|
|
|
{
|
|
|
|
|
QMenu menu;
|
|
|
|
|
// QAction *addParamAction = menu.addAction(QStringLiteral("添加"));
|
|
|
|
|
// addParamAction->setObjectName("addParamAction");
|
|
|
|
|
QAction *editParamAction = menu.addAction(QObject::tr("编辑"));
|
|
|
|
|
editParamAction->setObjectName("editParamAction");
|
|
|
|
|
// QAction *deleteParamAction = menu.addAction(QStringLiteral("删除"));
|
|
|
|
|
// deleteParamAction->setObjectName("deleteParamAction");
|
|
|
|
|
|
|
|
|
|
QAction *selectedAction = menu.exec(QCursor::pos());
|
|
|
|
|
|
|
|
|
|
if (!selectedAction)
|
|
|
|
|
{
|
|
|
|
|
menu.clear();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
QString strObj = selectedAction->objectName();
|
|
|
|
|
|
|
|
|
|
//if (selectedAction == addParamAction)
|
|
|
|
|
if (strObj == "addParamAction")
|
|
|
|
|
{
|
|
|
|
|
OnAddParam();
|
|
|
|
|
}
|
|
|
|
|
//else if (selectedAction == editParamAction)
|
|
|
|
|
else if (strObj == "editParamAction")
|
|
|
|
|
{
|
|
|
|
|
OnEditParam();
|
|
|
|
|
}
|
|
|
|
|
//else if (selectedAction == deleteParamAction)
|
|
|
|
|
else if (strObj == "deleteParamAction")
|
|
|
|
|
{
|
|
|
|
|
OnDeleteParam();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu.clear();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -1274,15 +1108,12 @@ bool CMainFrame::OnAddParam()
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1320,7 +1151,7 @@ bool CMainFrame::OnEditParam()
|
|
|
|
|
int nRowIndex = ui->tableWidget->currentRow();
|
|
|
|
|
if (nRowIndex != -1)
|
|
|
|
|
{
|
|
|
|
|
QList<QTableWidgetItem*>items;//= ui->tableWidget->selectedItems();
|
|
|
|
|
QList<QTableWidgetItem*> items;
|
|
|
|
|
for (int i = 0; i < ui->tableWidget->colorCount(); i++)
|
|
|
|
|
{
|
|
|
|
|
items.push_back(ui->tableWidget->item(nRowIndex, i));
|
|
|
|
|
@ -1333,29 +1164,20 @@ bool CMainFrame::OnEditParam()
|
|
|
|
|
if (!oldMat.empty())
|
|
|
|
|
_pOldTask->GetTaskInfo()->templateImg = oldMat;
|
|
|
|
|
}
|
|
|
|
|
//int nCurrentID = item->text().toInt();
|
|
|
|
|
QString strParaName = item->text();
|
|
|
|
|
AlgoParamType type;
|
|
|
|
|
PLP_ALGORITHM_PARAM pParam = NULL;
|
|
|
|
|
pParam = m_pCurrentAlgo->GetParamByName(strParaName);
|
|
|
|
|
//pParam = m_pCurrentAlgo->GetParam(nCurrentID);
|
|
|
|
|
|
|
|
|
|
if (pParam)
|
|
|
|
|
{
|
|
|
|
|
if (!m_tParamDlg.InitGraphView())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// m_tParamDlg.show();
|
|
|
|
|
m_tParamDlg.setParent(this);
|
|
|
|
|
m_tParamDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_tParamDlg.setWindowIcon(QIcon(":/image/leaper"));
|
|
|
|
|
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);
|
|
|
|
|
QString st = _pOldTask->GetTaskInfo()->strName;
|
|
|
|
|
if (!m_TaskChangeList.contains(st))
|
|
|
|
|
{
|
|
|
|
|
@ -1610,23 +1432,8 @@ QString CMainFrame::GetParamTypeStr(AlgoParamType type)
|
|
|
|
|
return strType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnCellChanged(int row, int column)
|
|
|
|
|
{
|
|
|
|
|
QString str = sender()->objectName();
|
|
|
|
|
int a = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CMainFrame::OnNextBtnClick()
|
|
|
|
|
{
|
|
|
|
|
// int index = ui->listWidget->currentRow();
|
|
|
|
|
// int maxindex = ui->listWidget->count()-1;
|
|
|
|
|
//
|
|
|
|
|
// if (index < maxindex)
|
|
|
|
|
// {
|
|
|
|
|
// ui->listWidget->setCurrentRow(index + 1);
|
|
|
|
|
// OnListItemClick();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return OnRunAlgo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1657,30 +1464,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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1690,38 +1491,6 @@ 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;
|
|
|
|
|
}
|
|
|
|
|
if (SystemStateInfo::bParamStateFlag)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox msgBox(QMessageBox::Warning, QObject::tr("提示"), QObject::tr("配置已修改过,是否保存相关参数到文件中?"), 0, this);
|
|
|
|
|
msgBox.addButton(QObject::tr("是"), QMessageBox::AcceptRole);
|
|
|
|
|
msgBox.addButton(QObject::tr("否"), QMessageBox::RejectRole);
|
|
|
|
|
if (msgBox.exec() == QMessageBox::AcceptRole)
|
|
|
|
|
{
|
|
|
|
|
//m_pDE->Save();
|
|
|
|
|
}
|
|
|
|
|
SystemStateInfo::bParamStateFlag = false;
|
|
|
|
|
}
|
|
|
|
|
if (m_pSolutionMgr && m_pSolutionMgr->GetRunSolution()) {
|
|
|
|
|
m_pSolutionMgr->SetRunSolution(m_pSolutionMgr->GetRunSolution()->GetSolutionName());
|
|
|
|
|
}
|
|
|
|
|
//OnManualTrigger();
|
|
|
|
|
QMainWindow::closeEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void CMainFrame::onLoadImage()
|
|
|
|
|
{
|
|
|
|
|
if (!currentTask())
|
|
|
|
|
@ -1743,3 +1512,4 @@ Q_SLOT void CMainFrame::onLoadImage()
|
|
|
|
|
m_pCurrentTask->GetTaskInfo()->strImageName = strFileName.split("/").last();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|