diff --git a/3part/tadpole/include/tpBase/lpbengine.h b/3part/tadpole/include/tpBase/lpbengine.h index c93cb61..a713d31 100644 Binary files a/3part/tadpole/include/tpBase/lpbengine.h and b/3part/tadpole/include/tpBase/lpbengine.h differ diff --git a/src/lpbdesigner/DsgRoiDlg.cpp b/src/lpbdesigner/DsgRoiDlg.cpp index ec098a8..72bbbeb 100644 --- a/src/lpbdesigner/DsgRoiDlg.cpp +++ b/src/lpbdesigner/DsgRoiDlg.cpp @@ -2,6 +2,7 @@ #include "ui_RoiDlg.h" #include "colossusbase.h" #include "QPalette" +#include "QSetCenterDlg.h" #define WINDOWS_ICON ":/resource/app.png" @@ -45,6 +46,7 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(OnCancel())); connect(ui->pushButton_7, SIGNAL(clicked()), this, SLOT(OnCircle())); connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT(OnShowColorDlg())); + ui->pushButton_8->setAutoDefault(false); connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(OnShowTenFlag())); @@ -52,6 +54,7 @@ CDsgRoiDlg::CDsgRoiDlg(QWidget *parent) : QDialog(parent), ui(new Ui::RoiDlg) m_pRoiScene = new RoiScene(this); m_pRoiScene->SetGraphicsView(ui->graphicsView); m_pRoiScene->SetInfoLable(ui->label_pixel_info); + connect(m_pRoiScene, SIGNAL(sgResetItem(QPoint, QRect)), this, SLOT(onROIMove(QPoint, QRect))); connect(ui->m_pbUp, SIGNAL(clicked()), this, SLOT(OnMove())); connect(ui->m_pbLeft, SIGNAL(clicked()), this, SLOT(OnMove())); @@ -467,6 +470,7 @@ void CDsgRoiDlg::showEvent(QShowEvent *evt) return; m_pRoiScene->Initialize(m_tempRoiData); m_pRoiScene->DisableMenu(false); + ui->label_2->clear(); } void CDsgRoiDlg::OnZoomIn() @@ -495,3 +499,9 @@ void CDsgRoiDlg::changeEvent(QEvent *event) ui->retranslateUi(this); } } + +Q_SLOT void CDsgRoiDlg::onROIMove(QPoint pos, QRect rect) +{ + ui->label_2->setText(QString("center:[%1,%2]").arg(pos.x()).arg(pos.y())); +} + diff --git a/src/lpbdesigner/DsgRoiDlg.h b/src/lpbdesigner/DsgRoiDlg.h index 86ced8e..58bf23e 100644 --- a/src/lpbdesigner/DsgRoiDlg.h +++ b/src/lpbdesigner/DsgRoiDlg.h @@ -25,9 +25,11 @@ public: virtual void OnSetParam(IDetectorTask* pTask){} virtual void showEvent(QShowEvent *evt); Q_SLOT void onSliderChange(int value); + Q_SLOT void onROIMove(QPoint pos, QRect rect); protected: virtual void changeEvent(QEvent *event); -public slots : + +public slots: bool OnOk(); bool OnCancel(); void OnRectangle(); diff --git a/src/lpbdesigner/MainFrame.cpp b/src/lpbdesigner/MainFrame.cpp index 91e7de1..ff0af7a 100644 --- a/src/lpbdesigner/MainFrame.cpp +++ b/src/lpbdesigner/MainFrame.cpp @@ -744,6 +744,12 @@ bool CMainFrame::OnSetAlgo() m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal); m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); + + QString strName = m_pCurrentTask->GetTaskInfo()->strName; + if (!m_TaskChangeList.contains(strName)) + { + m_TaskChangeList.append(strName); + } } } return true; @@ -774,6 +780,12 @@ bool CMainFrame::OnSetOutParam() m_tParamMgrDlg.setWindowModality(Qt::ApplicationModal); m_tParamMgrDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamMgrDlg.ShowParamMgrDlg(pAlgo); + + QString strName = m_pCurrentTask->GetTaskInfo()->strName; + if (!m_TaskChangeList.contains(strName)) + { + m_TaskChangeList.append(strName); + } } } return true; @@ -1186,7 +1198,7 @@ bool CMainFrame::OnEditParam() AlgoParamType type; PLP_ALGORITHM_PARAM pParam = NULL; pParam = m_pCurrentAlgo->GetParamByName(strParaName); - if (pParam) + if (pParam)//编辑算法参数 { if (!m_tParamDlg.InitGraphView()) return false; @@ -1196,13 +1208,15 @@ bool CMainFrame::OnEditParam() m_tParamDlg.setWindowModality(Qt::ApplicationModal); m_tParamDlg.setAttribute(Qt::WA_ShowModal, true); m_tParamDlg.ShowParamDlg(pParam); - if (_pOldTask) + if (_pOldTask)//编辑完成 输出信息 { QString st = _pOldTask->GetTaskInfo()->strName; if (!m_TaskChangeList.contains(st)) { m_TaskChangeList.append(st); } + //自动刷新算法参数栏 + OnInitCurrentAlgoParam(); } return true; } diff --git a/src/lpbdesigner/RoiDlg.ui b/src/lpbdesigner/RoiDlg.ui index 50493b6..ee8230f 100644 --- a/src/lpbdesigner/RoiDlg.ui +++ b/src/lpbdesigner/RoiDlg.ui @@ -230,27 +230,17 @@ 0 - - - - Qt::Vertical - - - - 20 - 40 - + + + + false - - - - ... - :/resource/caret-up.png:/resource/caret-up.png + :/resource/btn-close.png:/resource/btn-close.png @@ -258,11 +248,39 @@ 32 + + false + + + false + + + false + + + QToolButton::DelayedPopup + true + + Qt::NoArrow + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -323,17 +341,14 @@ - - - - false - + + ... - :/resource/btn-close.png:/resource/btn-close.png + :/resource/caret-up.png:/resource/caret-up.png @@ -341,24 +356,9 @@ 32 - - false - - - false - - - false - - - QToolButton::DelayedPopup - true - - Qt::NoArrow - @@ -368,6 +368,18 @@ + + + + + 12 + + + + + + + diff --git a/src/lpbdesigner/RoiScene.cpp b/src/lpbdesigner/RoiScene.cpp index ca44b5c..ec9d9f7 100644 --- a/src/lpbdesigner/RoiScene.cpp +++ b/src/lpbdesigner/RoiScene.cpp @@ -4,6 +4,7 @@ #include "RoiItem.h" #include "QGraphicsSceneEvent" #include "colossusbase.h" +#include "QSetCenterDlg.h" #pragma execution_character_set("utf-8") RoiScene::RoiScene(QObject *parent) @@ -55,6 +56,7 @@ void RoiScene::mouseEvent(QGraphicsSceneMouseEvent *mouseEvent) bool RoiScene::Initialize(LP_DETECTOR_ROI_DATA roiData) { + if (pLineItem) { removeItem(pLineItem); @@ -300,6 +302,7 @@ void RoiScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) if (tool) tool->mouseMoveEvent(mouseEvent, this); QGraphicsScene::mouseMoveEvent(mouseEvent); + emit sgResetItem(maptoImgPos(item->scenePos()), item->boundingRect().toRect()); } else { @@ -327,7 +330,7 @@ void RoiScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) if (item != 0) { //m_pRoiDlg->ResetItem(maptoImgPos(mouseEvent->scenePos()), item->boundingRect().toRect()); - emit sgResetItem(maptoImgPos(mouseEvent->scenePos()), item->boundingRect().toRect()); + emit sgResetItem(maptoImgPos(item->scenePos()), item->boundingRect().toRect()); m_graphItemMapStruct[item].rectf = maptoImgNewPos(item); DrawTool::c_drawShape = selection; QGraphicsScene::mouseReleaseEvent(mouseEvent); @@ -343,8 +346,10 @@ void RoiScene::MoveSelectedItem(DirType type, int step) if (items.count() == 1) item = qgraphicsitem_cast(items.first()); + if (item != 0 && !item->GetCheckState()) { + //item->setPos(0, 0); switch (type) { case LEFT: @@ -534,7 +539,9 @@ void RoiScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) } } } - + menu.addSeparator(); + QAction *setCenter = menu.addAction(QObject::tr("设置圆心")); + setCenter->setObjectName("setCenter"); QAction *selectedAction = menu.exec(event->screenPos()); if (selectedAction == NULL) { @@ -717,6 +724,30 @@ void RoiScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) } updateLineItem(); } + else if (strObj == "setCenter") + { + if (ptmpItem) + { + QPointF s = maptoImgPos(ptmpItem->scenePos()); + QSetCenterDlg dlg((QWidget*)(this->parent())); + dlg.setCenter(s.x(),s.y()); + dlg.setRange(ptmpItem->boundingRect().toRect(), mImgPosOffSet * 2); + if (dlg.exec() == QDialog::Accepted) + { + double x = 0; + double y = 0; + dlg.getCenter(x, y); + QPointF itemPoint; + itemPoint.setX(x); + itemPoint.setY(y); + QPointF tt = itemPoint - mImgPosOffSet; + QPointF fff = maptoImgPos(tt); + ptmpItem->setPos(tt); + } + m_graphItemMapStruct[ptmpItem].rectf = maptoImgNewPos(ptmpItem); + } + + } QGraphicsScene::contextMenuEvent(event); menu.clear(); update(); diff --git a/src/lpbdesigner/RoiScene.h b/src/lpbdesigner/RoiScene.h index df934da..6f4ad2d 100644 --- a/src/lpbdesigner/RoiScene.h +++ b/src/lpbdesigner/RoiScene.h @@ -67,7 +67,6 @@ public: void updateTenItem(bool bFlag); int flag{ 0 }; bool bUseTenFlag{ false }; - signals: void sgResetItem(QPoint pos, QRect size); protected: diff --git a/src/lpbengine/Solution.cpp b/src/lpbengine/Solution.cpp index 584dc31..726b362 100644 --- a/src/lpbengine/Solution.cpp +++ b/src/lpbengine/Solution.cpp @@ -141,6 +141,19 @@ bool Solution::DeleteTask(QString strName) return false; } +bool Solution::ModifyTask(QString strOldName, QString strNewName) +{ + QMap::iterator its = m_TaskMapByName.find(strOldName); + if (its != m_TaskMapByName.end()) + { + (*its)->RenameFile(strOldName, strNewName); + IDetectorTask* pTask = m_TaskMapByName.take(strOldName); + m_TaskMapByName.insert(strNewName, pTask); + return true; + } + return false; +} + IDetectorTask* Solution::GetTaskByName(QString strName) { QMap::iterator its = m_TaskMapByName.find(strName); @@ -383,6 +396,9 @@ bool Solution::LoadFileEx(const QString& strPath) m_tasklist.append(taskName); QString strTaskPath = strPath + "/" + taskName; + QDir qDir(strTaskPath); + if (!qDir.exists()) + continue; LP_DETECTOR_TASK Task; Task.strName = taskName; CDetectorTask* pTask = (CDetectorTask*)AddTask(&Task, strTaskPath);//有隐藏bug diff --git a/src/lpbengine/Solution.h b/src/lpbengine/Solution.h index 8bac303..13b4316 100644 --- a/src/lpbengine/Solution.h +++ b/src/lpbengine/Solution.h @@ -11,6 +11,7 @@ public: virtual bool AddTaskByTemplate(QString strName); virtual IDetectorTask* AddTask(const PLP_DETECTOR_TASK pTask); virtual bool DeleteTask(QString strName); + virtual bool ModifyTask(QString strOldName, QString strNewName); virtual IDetectorTask* GetTaskByName(QString strName); virtual QStringList GetAllTaskNames(); virtual QMap GetAllTasks(); diff --git a/src/lpbengine/SolutionMgr.cpp b/src/lpbengine/SolutionMgr.cpp index 64c2d54..670e7bd 100644 --- a/src/lpbengine/SolutionMgr.cpp +++ b/src/lpbengine/SolutionMgr.cpp @@ -140,6 +140,7 @@ bool CDetectorSolutionMgr::SaveByNames(QStringList strNames) //加载配置文件 bool CDetectorSolutionMgr::Load() { + /*在应用程序的根目录下寻找solution文件夹,没有即创建*/ QString strExePath = QCoreApplication::applicationDirPath(); QString strSolutionDirPath = strExePath + LP_DETECTOR_BUSSINESS_CONFIG_SOLUTION_DIR; QDir solutionDir(strSolutionDirPath); @@ -149,7 +150,7 @@ bool CDetectorSolutionMgr::Load() } m_nRunSolutionID.clear(); - + /*遍历solution文件夹下的所有文件夹,每一个文件夹即是一个子solution*/ solutionDir.setFilter(QDir::Dirs | QDir::Hidden | QDir::NoSymLinks); solutionDir.setSorting(QDir::Size | QDir::Reversed); QFileInfoList dirList = solutionDir.entryInfoList(); @@ -160,7 +161,8 @@ bool CDetectorSolutionMgr::Load() if (dirList.at(i).fileName() == "." || dirList.at(i).fileName() == "..") continue; - //加载解决方案文件夹 + //加载解决方案文件夹 判断子solution文件里使用包含info.json文件,有该文件表示solution有效,solution名和文件夹名一致 + /*如果需要修改solution的名字,需要手动在后台修改solution的文件夹名字即可*/ QString strSolutionFile = strSolutionDirPath + dirList.at(i).fileName(); QString path = strSolutionFile + "/info.json"; QFileInfo finfo(path); @@ -168,8 +170,8 @@ bool CDetectorSolutionMgr::Load() continue; LP_DETECTOR_SOLUTION solutionInfo; - solutionInfo.strName = dirList.at(i).fileName(); - + solutionInfo.strName = dirList.at(i).fileName();//设置solution名 + /*开始加载solution*/ Solution* pSolution = (Solution*)AddSolution(&solutionInfo); if (!pSolution->LoadFileEx(strSolutionFile)) {//有bug @@ -184,7 +186,7 @@ bool CDetectorSolutionMgr::Load() return true; } - +/*暂时弃用*/ bool CDetectorSolutionMgr::LoadByNames(QStringList strNames) { return true; diff --git a/src/lpbengine/Task.cpp b/src/lpbengine/Task.cpp index 190241d..0f3500b 100644 --- a/src/lpbengine/Task.cpp +++ b/src/lpbengine/Task.cpp @@ -24,6 +24,7 @@ static inline bool DelDiretory(const QString &dirPath) return qDir.rmdir(dirPath); } + CDetectorTask::CDetectorTask() { m_nID = LP_DETECTOR_INVALID_ID; @@ -488,6 +489,23 @@ bool CDetectorTask::RemoveFile() DelDiretory(m_taskPath); return true; } +/*对task重命名*/ +bool CDetectorTask::RenameFile(QString strOldName, QString strNewName) +{ + if (m_taskPath.isEmpty()) + return false; + QDir qDir(m_taskPath); + if (!qDir.exists()) + return false; + QString strOld = m_taskPath; + int pos = strOld.lastIndexOf(strOldName); + QString s = strOld.mid(0, pos); + m_taskPath = s + strNewName; + bool b = qDir.rename(strOld, m_taskPath); + strParamFilePath = m_taskPath + "/taskinfo.json"; + m_tTask.strName = strNewName; + return true; +} bool CDetectorTask::AppendOtherFile(QString strpath) { diff --git a/src/lpbengine/Task.h b/src/lpbengine/Task.h index 181dd17..7a6869f 100644 --- a/src/lpbengine/Task.h +++ b/src/lpbengine/Task.h @@ -57,6 +57,7 @@ public: virtual bool SaveFile(const QString& strPath); virtual bool LoadFile(const QString& strPath); virtual bool RemoveFile(); + virtual bool RenameFile(QString strOldName, QString strNewName); virtual bool AppendOtherFile(QString strpath); bool SerializeToJson(QJsonObject& jsonObject); diff --git a/tpvs17/Enchanter/Enchanter.aps b/tpvs17/Enchanter/Enchanter.aps index 0314a42..0930391 100644 Binary files a/tpvs17/Enchanter/Enchanter.aps and b/tpvs17/Enchanter/Enchanter.aps differ diff --git a/tpvs17/Enchanter/Enchanter.rc b/tpvs17/Enchanter/Enchanter.rc index f0c7008..61302aa 100644 Binary files a/tpvs17/Enchanter/Enchanter.rc and b/tpvs17/Enchanter/Enchanter.rc differ diff --git a/tpvs17/lpCoreCtrl/lpCoreCtrl.aps b/tpvs17/lpCoreCtrl/lpCoreCtrl.aps new file mode 100644 index 0000000..1439a22 Binary files /dev/null and b/tpvs17/lpCoreCtrl/lpCoreCtrl.aps differ diff --git a/tpvs17/lpCoreCtrl/lpCoreCtrl.rc b/tpvs17/lpCoreCtrl/lpCoreCtrl.rc new file mode 100644 index 0000000..80c763c Binary files /dev/null and b/tpvs17/lpCoreCtrl/lpCoreCtrl.rc differ diff --git a/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj b/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj index b86b9eb..dd78163 100644 --- a/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj +++ b/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj @@ -40,6 +40,7 @@ + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing %(Identity)... @@ -77,6 +78,9 @@ + + + {784071A9-BF94-4D27-B62E-588ACD7E0633} Qt4VSv1.0 diff --git a/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj.filters b/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj.filters index 16e291e..ff57e83 100644 --- a/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj.filters +++ b/tpvs17/lpCoreCtrl/lpCoreCtrl.vcxproj.filters @@ -130,6 +130,9 @@ Header Files + + Header Files + @@ -147,4 +150,7 @@ Generated Files + + + \ No newline at end of file diff --git a/tpvs17/lpCoreCtrl/resource.h b/tpvs17/lpCoreCtrl/resource.h new file mode 100644 index 0000000..04447f2 --- /dev/null +++ b/tpvs17/lpCoreCtrl/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by lpCoreCtrl.rc + +// ¶һĬֵ +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/tpvs17/lpbengine/lpbengine.aps b/tpvs17/lpbengine/lpbengine.aps new file mode 100644 index 0000000..d32086f Binary files /dev/null and b/tpvs17/lpbengine/lpbengine.aps differ diff --git a/tpvs17/lpbengine/lpbengine.rc b/tpvs17/lpbengine/lpbengine.rc new file mode 100644 index 0000000..eb99dac Binary files /dev/null and b/tpvs17/lpbengine/lpbengine.rc differ diff --git a/tpvs17/lpbengine/lpbengine.vcxproj b/tpvs17/lpbengine/lpbengine.vcxproj index 4d80105..2cf5f1b 100644 --- a/tpvs17/lpbengine/lpbengine.vcxproj +++ b/tpvs17/lpbengine/lpbengine.vcxproj @@ -419,6 +419,12 @@ "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DLPBENGINE_LIB -D%(PreprocessorDefinitions) "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I.\..\..\include" "-I.\..\..\..\Colossus\include\base" "-I.\..\..\..\Colossus\include\lpbengine" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\3part\tadpole\include\tpBase" "-ID:\Valve\3part\tadpole\include\tpBase" + + + + + + diff --git a/tpvs17/lpbengine/lpbengine.vcxproj.filters b/tpvs17/lpbengine/lpbengine.vcxproj.filters index 9078714..a4d8c38 100644 --- a/tpvs17/lpbengine/lpbengine.vcxproj.filters +++ b/tpvs17/lpbengine/lpbengine.vcxproj.filters @@ -88,4 +88,12 @@ Header Files + + + Header Files + + + + + \ No newline at end of file diff --git a/tpvs17/lpbengine/resource1.h b/tpvs17/lpbengine/resource1.h new file mode 100644 index 0000000..071111d --- /dev/null +++ b/tpvs17/lpbengine/resource1.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by lpbengine.rc + +// ¶һĬֵ +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/tpvs17/lpdesigner/QSetCenterDlg.cpp b/tpvs17/lpdesigner/QSetCenterDlg.cpp new file mode 100644 index 0000000..5b73d29 --- /dev/null +++ b/tpvs17/lpdesigner/QSetCenterDlg.cpp @@ -0,0 +1,55 @@ +#include "QSetCenterDlg.h" +#include "QMessageBox" +#pragma execution_character_set("utf-8") +QSetCenterDlg::QSetCenterDlg(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); + connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked())); + connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(onButtonClicked())); + +} + +QSetCenterDlg::~QSetCenterDlg() +{ + +} + +void QSetCenterDlg::setCenter(double x, double y) +{ + ui.lineEdit->setText(QString("%1").arg(x)); + ui.lineEdit_2->setText(QString("%1").arg(y)); +} + +void QSetCenterDlg::getCenter(double &x, double &y) +{ + x = ui.lineEdit->text().toDouble(); + y = ui.lineEdit_2->text().toDouble(); +} + +void QSetCenterDlg::setRange(QRect rect, QPointF imgSize) +{ + m_ItemRect = rect; + m_ImgSize = imgSize; +} + +Q_SLOT void QSetCenterDlg::onButtonClicked() +{ + QString strObj = sender()->objectName(); + if (strObj == "pushButton") + { + double x = ui.lineEdit->text().toDouble(); + double y = ui.lineEdit_2->text().toDouble(); + if ((x + m_ItemRect.width() / 2) > m_ImgSize.x() || (x - m_ItemRect.width() / 2) < 0 || (y - m_ItemRect.height() / 2) < 0 || (y + m_ItemRect.height() / 2) > m_ImgSize.y()) + { + QMessageBox::warning(this, QObject::tr(""), QObject::tr("õԲ굼ROIⷶΧϷã")); + return; + } + QDialog::accept(); + } + else if (strObj == "pushButton_2") + { + QDialog::reject(); + } +} diff --git a/tpvs17/lpdesigner/QSetCenterDlg.h b/tpvs17/lpdesigner/QSetCenterDlg.h new file mode 100644 index 0000000..4467018 --- /dev/null +++ b/tpvs17/lpdesigner/QSetCenterDlg.h @@ -0,0 +1,24 @@ +#ifndef _QSETCENTERDLG_H_ +#define _QSETCENTERDLG_H_ + +#include +#include "ui_QSetCenterDlg.h" + +class QSetCenterDlg : public QDialog +{ + Q_OBJECT + +public: + QSetCenterDlg(QWidget *parent = Q_NULLPTR); + ~QSetCenterDlg(); + void setCenter(double x, double y); + void getCenter(double &x, double &y); + void setRange(QRect rect, QPointF imgSize); + Q_SLOT void onButtonClicked(); +private: + Ui::QSetCenterDlg ui; + QRect m_ItemRect; + QPointF m_ImgSize; +}; + +#endif diff --git a/tpvs17/lpdesigner/QSetCenterDlg.ui b/tpvs17/lpdesigner/QSetCenterDlg.ui new file mode 100644 index 0000000..36eac37 --- /dev/null +++ b/tpvs17/lpdesigner/QSetCenterDlg.ui @@ -0,0 +1,76 @@ + + + QSetCenterDlg + + + + 0 + 0 + 209 + 100 + + + + + 12 + + + + 圆心坐标设置 + + + + QLayout::SetFixedSize + + + + + 圆心X坐标 + + + + + + + 0 + + + + + + + 圆心Y坐标 + + + + + + + 0 + + + + + + + + + 确定 + + + + + + + 取消 + + + + + + + + + + + diff --git a/tpvs17/lpdesigner/lpdesigner.aps b/tpvs17/lpdesigner/lpdesigner.aps deleted file mode 100644 index cd42dd2..0000000 Binary files a/tpvs17/lpdesigner/lpdesigner.aps and /dev/null differ diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj b/tpvs17/lpdesigner/lpdesigner.vcxproj index 3e5d291..2857bf6 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj @@ -78,6 +78,7 @@ + $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing %(Identity)... @@ -93,6 +94,7 @@ + $(QTDIR)\bin\moc.exe;%(FullPath) @@ -104,6 +106,16 @@ .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\..\..\src\lpbdesigner\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DLPDESIGNER_LIB -D%(PreprocessorDefinitions) "-I." "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtWebKit" "-I$(QTDIR)\include\QtPrintSupport" "-I$(QTDIR)\include\QtWebkitWidgets" "-I.\GeneratedFiles\$(ConfigurationName)" "-I.\..\..\include\lpdesigner\algela" "-I.\..\..\include\lpdesigner" "-I.\..\..\src\lpbdesigner\GeneratedFiles" "-I.\..\..\src\ColossusBase" "-I.\..\..\3part\opencv3.4.1\include" "-I.\..\..\3part\opencv3.4.1\include\opencv" "-I.\..\..\3part\opencv3.4.1\include\opencv2" "-I.\..\..\src\lpbdesigner" "-I.\..\..\3part\tadpole\include\tpBase" + @@ -200,6 +212,9 @@ true + + true + true @@ -230,6 +245,9 @@ true + + true + true @@ -242,6 +260,7 @@ + @@ -313,6 +332,19 @@ "$(QTDIR)\bin\uic.exe" -o ".\..\..\src\lpbdesigner\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\..\..\src\lpbdesigner\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\..\..\src\lpbdesigner\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\..\..\src\lpbdesigner\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\..\..\src\lpbdesigner\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters index a3fd515..8e49285 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters @@ -76,6 +76,12 @@ Header Files + + Generated Files + + + Header Files + @@ -123,6 +129,12 @@ Header Files + + Header Files + + + Form Files + @@ -224,6 +236,15 @@ Source Files + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + @@ -235,4 +256,7 @@ Translation Files + + + \ No newline at end of file diff --git a/tpvs17/lpdesigner/lpdesigner1.aps b/tpvs17/lpdesigner/lpdesigner1.aps new file mode 100644 index 0000000..405afca Binary files /dev/null and b/tpvs17/lpdesigner/lpdesigner1.aps differ diff --git a/tpvs17/lpdesigner/lpdesigner1.rc b/tpvs17/lpdesigner/lpdesigner1.rc new file mode 100644 index 0000000..dc0ff9f Binary files /dev/null and b/tpvs17/lpdesigner/lpdesigner1.rc differ diff --git a/tpvs17/lpdesigner/resource2.h b/tpvs17/lpdesigner/resource2.h new file mode 100644 index 0000000..b691ddb --- /dev/null +++ b/tpvs17/lpdesigner/resource2.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by lpdesigner1.rc + +// ¶һĬֵ +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/tpvs17/tpMain/QAlgParamDlg.cpp b/tpvs17/tpMain/QAlgParamDlg.cpp index ca9cc30..d2a268c 100644 --- a/tpvs17/tpMain/QAlgParamDlg.cpp +++ b/tpvs17/tpMain/QAlgParamDlg.cpp @@ -127,9 +127,12 @@ Q_SLOT void QAlgParamDlg::onChangeBG() createfile->remove(DstPath); //} } - if (!QFile::copy(sourcePath, DstPath)) { + QImage img;// (sourcePath); + img.load(sourcePath); + img.save(DstPath); + //if (!QFile::copy(sourcePath, DstPath)) { //return false; - } + //} //emit sgChangeBG(DstPath); QMessageBox infobox(QMessageBox::Information, tr("提示"), tr("背景图更新完成,请重启本软件."), QMessageBox::Yes, NULL); infobox.setWindowIcon(QIcon(":/image/leaper")); diff --git a/tpvs17/tpMain/QModelMgrDlg.cpp b/tpvs17/tpMain/QModelMgrDlg.cpp index a5b8688..f8fd7af 100644 --- a/tpvs17/tpMain/QModelMgrDlg.cpp +++ b/tpvs17/tpMain/QModelMgrDlg.cpp @@ -459,6 +459,8 @@ Q_SLOT void QModelMgrDlg::onChangeModelName() emit(m_pCtrl->sgModelChanged()); onShowModelInfo(m_newName); onShowModelPic(m_newName); + + emit sgModeModeName(strModel, m_newName); } Q_SLOT void QModelMgrDlg::onProgassCancel() diff --git a/tpvs17/tpMain/QPLCDevice.cpp b/tpvs17/tpMain/QPLCDevice.cpp index bad8d79..0e787eb 100644 --- a/tpvs17/tpMain/QPLCDevice.cpp +++ b/tpvs17/tpMain/QPLCDevice.cpp @@ -117,6 +117,7 @@ void QPLCDevice::onParaster(QByteArray recvData) else if (cmd.toInt() == 2) //Ӧ { onSendHeartBit(); + emit sgRecvHeartBit(); } else if (cmd.toInt() == 3) { diff --git a/tpvs17/tpMain/QPLCDevice.h b/tpvs17/tpMain/QPLCDevice.h index 7310a5f..940ea52 100644 --- a/tpvs17/tpMain/QPLCDevice.h +++ b/tpvs17/tpMain/QPLCDevice.h @@ -36,6 +36,7 @@ signals: void sgTrigerCam(int camID); void sgSendDataCallBack(QByteArray); void sgRecvDataCallBack(QByteArray); + void sgRecvHeartBit(); private: lptkRawTcpServer *m_rawTcpServer{ nullptr }; QMutex mMtLock; diff --git a/tpvs17/tpMain/lpMainWin.cpp b/tpvs17/tpMain/lpMainWin.cpp index bb159c8..7f53780 100644 --- a/tpvs17/tpMain/lpMainWin.cpp +++ b/tpvs17/tpMain/lpMainWin.cpp @@ -22,9 +22,9 @@ #include "databasesql.h" #include "lpCryptokey.h" -#define VERSION_HUB "3.0.1.9" +#define VERSION_HUB "3.0.3.0" #define VERSION_ALG "3.0.1.4" -#define UPDATE_TIME "2021-11-10" +#define UPDATE_TIME "2021-12-03" #pragma execution_character_set("utf-8") #define MODEL_UI_ICON_NONE ":/image/no-img" @@ -206,6 +206,7 @@ lpMainWin::lpMainWin(QWidget *parent) connect(m_pModelMgrDlg, SIGNAL(sgUpdatedefect()), this, SLOT(onUpdateDefect()));//更新检测列表 connect(m_pModelMgrDlg, SIGNAL(sgAddNewModel(QString)), this, SLOT(onSlotAddNewModel(QString)));//新建模板型号 connect(m_pModelMgrDlg, SIGNAL(sgDelOldModel(QString)), this, SLOT(onSlotDelOldModel(QString)));//删除模板型号 + connect(m_pModelMgrDlg, SIGNAL(sgModeModeName(QString,QString)), this, SLOT(onSlotModModel(QString,QString)));//删除模板型号 m_pDebugDlg = new QDebugDlg();//调试界面 m_pDebugDlg->onSetCtrl(m_pCtrl); @@ -1661,6 +1662,20 @@ Q_SLOT void lpMainWin::onSlotDelOldModel(QString strName) } } } + +Q_SLOT void lpMainWin::onSlotModModel(QString strOldName, QString strNewName) +{ + if (m_pEngineCtrl) { + IDetectorSolutionMgr* pMgr = m_pEngineCtrl->getSolutionMgr(); + if (pMgr) { + IDetectorSolution* pSolution = pMgr->GetRunSolution(); + if (pSolution) { + pSolution->ModifyTask(strOldName, strNewName); + pSolution->SaveTaskByName(""); + } + } + } +} /* 保存定位检测结果数据 (1)把定位检测的对于图片保存起来,供后期核查 diff --git a/tpvs17/tpMain/lpMainWin.h b/tpvs17/tpMain/lpMainWin.h index bce312c..414f04c 100644 --- a/tpvs17/tpMain/lpMainWin.h +++ b/tpvs17/tpMain/lpMainWin.h @@ -83,6 +83,7 @@ private: Result2Ui *parseMap(const QVariantMap &vMap); Q_SLOT void onSlotAddNewModel(QString strName); Q_SLOT void onSlotDelOldModel(QString strName); + Q_SLOT void onSlotModModel(QString strOldName, QString strNewName); void onSaveValveResult(ValueResult &rlt); protected: bool onInitCoreCtrl();//核心模块ctrol初始化 diff --git a/tpvs17/valueMainUI/dumpfile.h b/tpvs17/valueMainUI/dumpfile.h new file mode 100644 index 0000000..b90ac22 --- /dev/null +++ b/tpvs17/valueMainUI/dumpfile.h @@ -0,0 +1,129 @@ +#ifndef _H_DUMPFILE_H_ +#define _H_DUMPFILE_H_ + +/*! + *FileName: dumpfile.h + *Author: Pan Yingdong + *Email: bob.pan@hzleaper.com + *Created:2020/5/19 16:02 + *Note: +*/ +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace std::chrono; + +#pragma comment(lib, "Dbghelp.lib") + +namespace NSDumpFile +{ + void CreateDumpFile(LPCWSTR lpstrDumpFilePathName, EXCEPTION_POINTERS *pException) + { + // 创建Dump文件 + // + HANDLE hDumpFile = CreateFile(lpstrDumpFilePathName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + + // Dump信息 + // + MINIDUMP_EXCEPTION_INFORMATION dumpInfo; + dumpInfo.ExceptionPointers = pException; + dumpInfo.ThreadId = GetCurrentThreadId(); + dumpInfo.ClientPointers = TRUE; + + + // 写入Dump文件内容 + // + MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpNormal, &dumpInfo, NULL, NULL); + + + CloseHandle(hDumpFile); + } + + + LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) + { + return NULL; + } + + + BOOL PreventSetUnhandledExceptionFilter() + { + HMODULE hKernel32 = LoadLibrary(_T("kernel32.dll")); + if (hKernel32 == NULL) + return FALSE; + + + void *pOrgEntry = GetProcAddress(hKernel32, "SetUnhandledExceptionFilter"); + if (pOrgEntry == NULL) + return FALSE; + + + unsigned char newJump[100]; + DWORD dwOrgEntryAddr = (DWORD)pOrgEntry; + dwOrgEntryAddr += 5; // add 5 for 5 op-codes for jmp far + + + void *pNewFunc = &MyDummySetUnhandledExceptionFilter; + DWORD dwNewEntryAddr = (DWORD)pNewFunc; + DWORD dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr; + + + newJump[0] = 0xE9; // JMP absolute + memcpy(&newJump[1], &dwRelativeAddr, sizeof(pNewFunc)); + SIZE_T bytesWritten; + BOOL bRet = WriteProcessMemory(GetCurrentProcess(), pOrgEntry, newJump, sizeof(pNewFunc) + 1, &bytesWritten); + return bRet; + } + + LONG WINAPI UnhandledExceptionFilterEx(struct _EXCEPTION_POINTERS *pException) + { + TCHAR szMbsFile[MAX_PATH] = { 0 }; + ::GetModuleFileName(NULL, szMbsFile, MAX_PATH); + TCHAR* pFind = _tcsrchr(szMbsFile, '\\'); + if (pFind) + { + *(pFind + 1) = 0; + + char buffer[80]; + time_t rawtime; + struct tm info; + time(&rawtime); + localtime_s(&info, &rawtime); + TCHAR szMbsFile[MAX_PATH] = { 0 }; + strftime(buffer, 80, "%Y-%m-%d %H-%M-%S", &info); + std::string strName = buffer; + strName += ".dmp"; + _stprintf_s(szMbsFile, MAX_PATH, _T("%S"), strName.c_str()); + CreateDumpFile(szMbsFile, pException); + } + + + // TODO: MiniDumpWriteDump + FatalAppExit(-1, _T("Fatal Error")); + return EXCEPTION_CONTINUE_SEARCH; + } + + + void RunCrashHandler() + { + SetUnhandledExceptionFilter(UnhandledExceptionFilterEx); + PreventSetUnhandledExceptionFilter(); + } +}; + + +#define DeclareDumpFile() NSDumpFile::RunCrashHandler(); +/* +使用方法 +在main文件中添加头文件 +main函数中调用DeclareDumpFile()即可 +*/ +#endif \ No newline at end of file diff --git a/tpvs17/valueMainUI/main.cpp b/tpvs17/valueMainUI/main.cpp index 16d7e36..70a8490 100644 --- a/tpvs17/valueMainUI/main.cpp +++ b/tpvs17/valueMainUI/main.cpp @@ -1,8 +1,10 @@ #include "valueMainUI.h" #include #include "QSignleApplication.h" +#include "dumpfile.h" int main(int argc, char *argv[]) { + DeclareDumpFile(); SingleApplication a(argc, argv,"valueMain"); if (!a.getInstanceRunning()) { diff --git a/tpvs17/valueMainUI/valueMainUI.cpp b/tpvs17/valueMainUI/valueMainUI.cpp index e2dfc25..89737d6 100644 --- a/tpvs17/valueMainUI/valueMainUI.cpp +++ b/tpvs17/valueMainUI/valueMainUI.cpp @@ -29,7 +29,7 @@ valueMainUI::valueMainUI(QWidget *parent) setupTrayIcon();//后台任务栏初始化 setWindowIcon(QIcon(WINDOWICON)); - setWindowTitle(tr("识别定位一体检测系统(v1.0.5 21.11.11)")); + setWindowTitle(tr("识别定位一体检测系统(v1.0.7 21.11.19)")); lpGlobalData::instance(); lpConfig::instance()->loadConfig(); @@ -127,6 +127,8 @@ valueMainUI::valueMainUI(QWidget *parent) connect(m_pPlcDevice, SIGNAL(sgSendAlgResult(int)), this, SLOT(onSendAlgResult(int))); connect(m_pPlcDevice, SIGNAL(sgSendDataCallBack(QByteArray)), this, SLOT(onShowSendTcpData(QByteArray))); connect(m_pPlcDevice, SIGNAL(sgRecvDataCallBack(QByteArray)), this, SLOT(onShowRecvTcpData(QByteArray))); + connect(m_pPlcDevice, SIGNAL(sgRecvHeartBit()), this, SLOT(onReacvHeartBit())); + } { @@ -628,13 +630,22 @@ void valueMainUI::timerEvent(QTimerEvent *event) bool bConnect = m_pPlcDevice->getClinetInfo(clientInfo); if (bConnect == true) { - QString plc = QString(tr("PLC客户端 %1").arg(clientInfo)); - m_pLabelPLC->setText(plc); - m_pLabelPLC->setStyleSheet("background-color: rgb(63, 170, 24);"); + m_heartTimeout++; + if (m_heartTimeout > 10) + { + QString plc = QString(tr("PLC 心跳超时 %1 ").arg(clientInfo)); + m_pLabelPLC->setText(plc); + m_pLabelPLC->setStyleSheet("background-color: rgb(200, 170, 24);"); + } + else { + QString plc = QString(tr("PLC客户端 %1").arg(clientInfo)); + m_pLabelPLC->setText(plc); + m_pLabelPLC->setStyleSheet("background-color: rgb(63, 170, 24);"); + } } else { m_pLabelPLC->setText(tr("PLC客户端未连接")); - m_pLabelPLC->setStyleSheet("background-color: rgb(200, 200, 10);"); + m_pLabelPLC->setStyleSheet("background-color: rgb(200, 10, 10);"); } } QString m_currentTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); @@ -1161,4 +1172,10 @@ Q_SLOT void valueMainUI::onSendAlgResult(int camID) m_pPlcDevice->onSendValueRlt(lpGlobalData::instance()->m_StationResult_2); } } -} \ No newline at end of file +} + +Q_SLOT void valueMainUI::onReacvHeartBit() +{ + m_heartTimeout = 0; +} + diff --git a/tpvs17/valueMainUI/valueMainUI.h b/tpvs17/valueMainUI/valueMainUI.h index 78b0409..575aeb6 100644 --- a/tpvs17/valueMainUI/valueMainUI.h +++ b/tpvs17/valueMainUI/valueMainUI.h @@ -74,6 +74,7 @@ private://trayIcon void SetTranslator(const QString strPath); Q_SLOT void onLanguageChange(QString strLanguage); Q_SLOT void onSendAlgResult(int camID); + Q_SLOT void onReacvHeartBit(); protected: virtual void timerEvent(QTimerEvent *event); virtual void closeEvent(QCloseEvent *event); @@ -105,7 +106,7 @@ private: bool m_bRunStateB{ false }; int m_SysTimerID{ 0 }; quint64 m_tickCount{ 0 }; - + int m_heartTimeout{ 0 }; QStringList m_appNames;//ӻapp lpTcpClient* tcp_client_ptr_A{ nullptr }; diff --git a/tpvs17/valueMainUI/valueMainUI.vcxproj b/tpvs17/valueMainUI/valueMainUI.vcxproj index e045b9c..48d7848 100644 --- a/tpvs17/valueMainUI/valueMainUI.vcxproj +++ b/tpvs17/valueMainUI/valueMainUI.vcxproj @@ -164,6 +164,7 @@ .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWebSockets;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtLocation;$(QTDIR)\include\QtNetwork;.\..\..\src\tpMain\algela;.\..\..\3part\tadpole\include\tpBase;.\..\..\3part\lp_libtcp\include;.\..\..\src\tpMain .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWebSockets;$(QTDIR)\include\QtWidgets;.\..\..\src\tpMain\algela;E:\wheelValve\3part\tadpole\include\tpBase;$(QTDIR)\include\QtLocation;$(QTDIR)\include\QtNetwork;E:\wheelValve\3part\lp_libtcp\include;E:\wheelValve\src\tpMain + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWebSockets;$(QTDIR)\include\QtWidgets;.\..\..\src\tpMain\algela;E:\wheelValve\3part\tadpole\include\tpBase .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWebSockets;$(QTDIR)\include\QtWidgets diff --git a/tpvs17/valueMainUI/valueMainUI.vcxproj.filters b/tpvs17/valueMainUI/valueMainUI.vcxproj.filters index 9ece126..00954d6 100644 --- a/tpvs17/valueMainUI/valueMainUI.vcxproj.filters +++ b/tpvs17/valueMainUI/valueMainUI.vcxproj.filters @@ -187,6 +187,9 @@ Header Files + + Header Files + diff --git a/tpvs17/valveDetector/algEg.cpp b/tpvs17/valveDetector/algEg.cpp index 18ff434..7fb678d 100644 --- a/tpvs17/valveDetector/algEg.cpp +++ b/tpvs17/valveDetector/algEg.cpp @@ -91,6 +91,7 @@ bool algEg::Exec(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) // add original center paramInput.originalPoint = Point2f(pt.x(), pt.y()); paramInput.nCenterAlg = lpAlgorithm->GetParamValue("centerAlg", LP_INT).toInt(); + double centeroffset = lpAlgorithm->GetParamValue("centerOffset", LP_INT).toInt(); // add background paramInput.backGround = lpAlgorithm->GetParamValue("background", LP_MAT).value(); luffy_imageProc::createImage(paramInput.backGround, paramInput.backGround, luffy_imageProc::emCreateGray); @@ -109,7 +110,7 @@ bool algEg::Exec(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) else { float dis = luffy_math::disofPoints(paramInput.originalPoint, paramInput.ptCenter); - if (dis > 25) + if (dis > centeroffset) { bExist = false; paramOutput.nErrorType += 8; @@ -216,7 +217,9 @@ bool algEg::Exec(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) bool algEg::Init(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) { - + LP_ALGORITHM_PARAM param1_centeroffset("centerOffset", LP_INT, 25, QObject::tr("圆心偏差距离,单位像素")); + lpAlgorithm->AddParam(¶m1_centeroffset, 1); + LP_ALGORITHM_PARAM param1_1("backgroundThresh", LP_INT, 15, QObject::tr("背景差异性阈值")); lpAlgorithm->AddParam(¶m1_1, 1);