diff --git a/3part/tadpole/include/tpBase/lpbengine.h b/3part/tadpole/include/tpBase/lpbengine.h index 64d8914..96dadb9 100644 Binary files a/3part/tadpole/include/tpBase/lpbengine.h and b/3part/tadpole/include/tpBase/lpbengine.h differ diff --git a/src/lpbdesigner/AlgorithmParamMgrDlg.ui b/src/lpbdesigner/AlgorithmParamMgrDlg.ui index 1fdedc5..ee09fb8 100644 --- a/src/lpbdesigner/AlgorithmParamMgrDlg.ui +++ b/src/lpbdesigner/AlgorithmParamMgrDlg.ui @@ -18,16 +18,16 @@ - 2 + 5 - 2 + 5 - 2 + 5 - 2 + 5 diff --git a/src/lpbdesigner/DeviceDlg.ui b/src/lpbdesigner/DeviceDlg.ui deleted file mode 100644 index 9c3c494..0000000 --- a/src/lpbdesigner/DeviceDlg.ui +++ /dev/null @@ -1,82 +0,0 @@ - - - DeviceDlg - - - - 0 - 0 - 280 - 181 - - - - 设备信息 - - - - - - - - 名称: - - - - - - - - - - 描述: - - - - - - - - - - 类型: - - - - - - - - - - - - Qt::Horizontal - - - - 97 - 20 - - - - - - - - 确定 - - - - - - - 取消 - - - - - - - - diff --git a/src/lpbdesigner/DeviceListDlg.ui b/src/lpbdesigner/DeviceListDlg.ui deleted file mode 100644 index 6bb7fb3..0000000 --- a/src/lpbdesigner/DeviceListDlg.ui +++ /dev/null @@ -1,110 +0,0 @@ - - - DeviceListDialog - - - - 0 - 0 - 630 - 387 - - - - 设备信息 - - - - - - - - 设备: - - - - - - - - - - 搜索 - - - - - - - Qt::Horizontal - - - - 68 - 20 - - - - - - - - - - - 编号 - - - - - 名称 - - - - - 描述 - - - - - 类型 - - - - - - - - - - Qt::Horizontal - - - - 408 - 20 - - - - - - - - 确定 - - - - - - - 关闭 - - - - - - - - - - diff --git a/src/lpbdesigner/DeviceMgrDlg.ui b/src/lpbdesigner/DeviceMgrDlg.ui deleted file mode 100644 index 0b813b2..0000000 --- a/src/lpbdesigner/DeviceMgrDlg.ui +++ /dev/null @@ -1,118 +0,0 @@ - - - DeviceMgrDialog - - - - 0 - 0 - 630 - 387 - - - - 设备管理 - - - - - - - - 设备: - - - - - - - - - - 搜索 - - - - - - - 应用 - - - - - - - - - - 编号 - - - - - 名称 - - - - - 描述 - - - - - 类型 - - - - - - - - - - Qt::Horizontal - - - - 218 - 20 - - - - - - - - 新增 - - - - - - - 编辑 - - - - - - - 删除 - - - - - - - 关闭 - - - - - - - - - - diff --git a/src/lpbdesigner/GeneratedFiles/ui_DeviceMgrDlg.h b/src/lpbdesigner/GeneratedFiles/ui_DeviceMgrDlg.h deleted file mode 100644 index 0ee43b6..0000000 --- a/src/lpbdesigner/GeneratedFiles/ui_DeviceMgrDlg.h +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'DeviceMgrDlg.ui' -** -** Created by: Qt User Interface Compiler version 5.9.4 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_DEVICEMGRDLG_H -#define UI_DEVICEMGRDLG_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Ui_DeviceMgrDialog -{ -public: - QVBoxLayout *verticalLayout; - QHBoxLayout *horizontalLayout; - QLabel *label; - QLineEdit *lineEdit; - QPushButton *pushButton; - QPushButton *pushButton_2; - QTableWidget *tableWidget; - QHBoxLayout *horizontalLayout_2; - QSpacerItem *horizontalSpacer; - QPushButton *pushButton_3; - QPushButton *pushButton_4; - QPushButton *pushButton_5; - QPushButton *pushButton_6; - - void setupUi(QDialog *DeviceMgrDialog) - { - if (DeviceMgrDialog->objectName().isEmpty()) - DeviceMgrDialog->setObjectName(QStringLiteral("DeviceMgrDialog")); - DeviceMgrDialog->resize(630, 387); - verticalLayout = new QVBoxLayout(DeviceMgrDialog); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - horizontalLayout = new QHBoxLayout(); - horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - label = new QLabel(DeviceMgrDialog); - label->setObjectName(QStringLiteral("label")); - - horizontalLayout->addWidget(label); - - lineEdit = new QLineEdit(DeviceMgrDialog); - lineEdit->setObjectName(QStringLiteral("lineEdit")); - - horizontalLayout->addWidget(lineEdit); - - pushButton = new QPushButton(DeviceMgrDialog); - pushButton->setObjectName(QStringLiteral("pushButton")); - - horizontalLayout->addWidget(pushButton); - - pushButton_2 = new QPushButton(DeviceMgrDialog); - pushButton_2->setObjectName(QStringLiteral("pushButton_2")); - - horizontalLayout->addWidget(pushButton_2); - - - verticalLayout->addLayout(horizontalLayout); - - tableWidget = new QTableWidget(DeviceMgrDialog); - if (tableWidget->columnCount() < 4) - tableWidget->setColumnCount(4); - QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); - tableWidget->setHorizontalHeaderItem(0, __qtablewidgetitem); - QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); - tableWidget->setHorizontalHeaderItem(1, __qtablewidgetitem1); - QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem(); - tableWidget->setHorizontalHeaderItem(2, __qtablewidgetitem2); - QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem(); - tableWidget->setHorizontalHeaderItem(3, __qtablewidgetitem3); - tableWidget->setObjectName(QStringLiteral("tableWidget")); - - verticalLayout->addWidget(tableWidget); - - horizontalLayout_2 = new QHBoxLayout(); - horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); - horizontalSpacer = new QSpacerItem(218, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - horizontalLayout_2->addItem(horizontalSpacer); - - pushButton_3 = new QPushButton(DeviceMgrDialog); - pushButton_3->setObjectName(QStringLiteral("pushButton_3")); - - horizontalLayout_2->addWidget(pushButton_3); - - pushButton_4 = new QPushButton(DeviceMgrDialog); - pushButton_4->setObjectName(QStringLiteral("pushButton_4")); - - horizontalLayout_2->addWidget(pushButton_4); - - pushButton_5 = new QPushButton(DeviceMgrDialog); - pushButton_5->setObjectName(QStringLiteral("pushButton_5")); - - horizontalLayout_2->addWidget(pushButton_5); - - pushButton_6 = new QPushButton(DeviceMgrDialog); - pushButton_6->setObjectName(QStringLiteral("pushButton_6")); - - horizontalLayout_2->addWidget(pushButton_6); - - - verticalLayout->addLayout(horizontalLayout_2); - - - retranslateUi(DeviceMgrDialog); - - QMetaObject::connectSlotsByName(DeviceMgrDialog); - } // setupUi - - void retranslateUi(QDialog *DeviceMgrDialog) - { - DeviceMgrDialog->setWindowTitle(QApplication::translate("DeviceMgrDialog", "\350\256\276\345\244\207\347\256\241\347\220\206", Q_NULLPTR)); - label->setText(QApplication::translate("DeviceMgrDialog", "\350\256\276\345\244\207\357\274\232", Q_NULLPTR)); - pushButton->setText(QApplication::translate("DeviceMgrDialog", "\346\220\234\347\264\242", Q_NULLPTR)); - pushButton_2->setText(QApplication::translate("DeviceMgrDialog", "\345\272\224\347\224\250", Q_NULLPTR)); - QTableWidgetItem *___qtablewidgetitem = tableWidget->horizontalHeaderItem(0); - ___qtablewidgetitem->setText(QApplication::translate("DeviceMgrDialog", "\347\274\226\345\217\267", Q_NULLPTR)); - QTableWidgetItem *___qtablewidgetitem1 = tableWidget->horizontalHeaderItem(1); - ___qtablewidgetitem1->setText(QApplication::translate("DeviceMgrDialog", "\345\220\215\347\247\260", Q_NULLPTR)); - QTableWidgetItem *___qtablewidgetitem2 = tableWidget->horizontalHeaderItem(2); - ___qtablewidgetitem2->setText(QApplication::translate("DeviceMgrDialog", "\346\217\217\350\277\260", Q_NULLPTR)); - QTableWidgetItem *___qtablewidgetitem3 = tableWidget->horizontalHeaderItem(3); - ___qtablewidgetitem3->setText(QApplication::translate("DeviceMgrDialog", "\347\261\273\345\236\213", Q_NULLPTR)); - pushButton_3->setText(QApplication::translate("DeviceMgrDialog", "\346\226\260\345\242\236", Q_NULLPTR)); - pushButton_4->setText(QApplication::translate("DeviceMgrDialog", "\347\274\226\350\276\221", Q_NULLPTR)); - pushButton_5->setText(QApplication::translate("DeviceMgrDialog", "\345\210\240\351\231\244", Q_NULLPTR)); - pushButton_6->setText(QApplication::translate("DeviceMgrDialog", "\345\205\263\351\227\255", Q_NULLPTR)); - } // retranslateUi - -}; - -namespace Ui { - class DeviceMgrDialog: public Ui_DeviceMgrDialog {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_DEVICEMGRDLG_H diff --git a/src/lpbdesigner/GeneratedFiles/ui_MainFrame.h b/src/lpbdesigner/GeneratedFiles/ui_MainFrame.h index cb613ec..2a078ed 100644 --- a/src/lpbdesigner/GeneratedFiles/ui_MainFrame.h +++ b/src/lpbdesigner/GeneratedFiles/ui_MainFrame.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include #include #include +#include #include #include "lpTreeWidget.h" #include "lpimgviewer.h" @@ -36,7 +36,9 @@ QT_BEGIN_NAMESPACE class Ui_MainFrame { public: - QAction *actionTest; + QAction *actionadd; + QAction *actiondel; + QAction *actionsave; QWidget *centralwidget; QGridLayout *gridLayout_2; QHBoxLayout *horizontalLayout_2; @@ -55,18 +57,11 @@ public: lpImgViewer *gv_output; QWidget *layoutWidget1; QHBoxLayout *horizontalLayout_5; - QGroupBox *groupBox; - QGridLayout *gridLayout_6; - QGridLayout *gridLayout; - QHBoxLayout *horizontalLayout; - QPushButton *pushButton_8; - QSpacerItem *horizontalSpacer_3; - QPushButton *pushButton_next; - QListWidget *listWidget; QGroupBox *groupBox_3; QGridLayout *gridLayout_7; QTextEdit *textEdit; QHBoxLayout *horizontalLayout_6; + QPushButton *m_pbLoadImage; QSpacerItem *horizontalSpacer_2; QPushButton *pushButton_5; QLabel *label_pixel_info; @@ -79,29 +74,26 @@ public: QGridLayout *gridLayout_4; QTableWidget *tableWidget; QStatusBar *statusBar; + QToolBar *toolBar; void setupUi(QMainWindow *MainFrame) { if (MainFrame->objectName().isEmpty()) MainFrame->setObjectName(QStringLiteral("MainFrame")); MainFrame->setWindowModality(Qt::ApplicationModal); - MainFrame->resize(963, 664); - actionTest = new QAction(MainFrame); - actionTest->setObjectName(QStringLiteral("actionTest")); - QIcon icon; - QString iconThemeName = QStringLiteral("1"); - if (QIcon::hasThemeIcon(iconThemeName)) { - icon = QIcon::fromTheme(iconThemeName); - } else { - icon.addFile(QStringLiteral(":/img/resource/save.png"), QSize(), QIcon::Normal, QIcon::Off); - } - actionTest->setIcon(icon); + MainFrame->resize(1050, 755); + actionadd = new QAction(MainFrame); + actionadd->setObjectName(QStringLiteral("actionadd")); + actiondel = new QAction(MainFrame); + actiondel->setObjectName(QStringLiteral("actiondel")); + actionsave = new QAction(MainFrame); + actionsave->setObjectName(QStringLiteral("actionsave")); centralwidget = new QWidget(MainFrame); centralwidget->setObjectName(QStringLiteral("centralwidget")); gridLayout_2 = new QGridLayout(centralwidget); - gridLayout_2->setSpacing(0); + gridLayout_2->setSpacing(5); gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); - gridLayout_2->setContentsMargins(0, 0, 0, 0); + gridLayout_2->setContentsMargins(5, 5, 5, 5); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); m_pbSaveBtn = new QPushButton(centralwidget); @@ -109,9 +101,9 @@ public: QFont font; font.setPointSize(11); m_pbSaveBtn->setFont(font); - QIcon icon1; - icon1.addFile(QStringLiteral(":/img/resource/save.png"), QSize(), QIcon::Normal, QIcon::Off); - m_pbSaveBtn->setIcon(icon1); + QIcon icon; + icon.addFile(QStringLiteral(":/img/resource/save.png"), QSize(), QIcon::Normal, QIcon::Off); + m_pbSaveBtn->setIcon(icon); m_pbSaveBtn->setIconSize(QSize(20, 20)); m_pbSaveBtn->setFlat(true); @@ -131,9 +123,19 @@ public: splitter_3 = new QSplitter(centralwidget); splitter_3->setObjectName(QStringLiteral("splitter_3")); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(splitter_3->sizePolicy().hasHeightForWidth()); + splitter_3->setSizePolicy(sizePolicy); splitter_3->setOrientation(Qt::Horizontal); treeWidget = new LpTreeWidget(splitter_3); treeWidget->setObjectName(QStringLiteral("treeWidget")); + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy1.setHorizontalStretch(3); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(treeWidget->sizePolicy().hasHeightForWidth()); + treeWidget->setSizePolicy(sizePolicy1); QFont font1; font1.setFamily(QStringLiteral("Consolas")); font1.setPointSize(11); @@ -141,6 +143,11 @@ public: splitter_3->addWidget(treeWidget); splitter_2 = new QSplitter(splitter_3); splitter_2->setObjectName(QStringLiteral("splitter_2")); + QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy2.setHorizontalStretch(8); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(splitter_2->sizePolicy().hasHeightForWidth()); + splitter_2->setSizePolicy(sizePolicy2); splitter_2->setOrientation(Qt::Vertical); frame = new QFrame(splitter_2); frame->setObjectName(QStringLiteral("frame")); @@ -183,44 +190,6 @@ public: horizontalLayout_5->setSpacing(1); horizontalLayout_5->setObjectName(QStringLiteral("horizontalLayout_5")); horizontalLayout_5->setContentsMargins(0, 0, 0, 0); - groupBox = new QGroupBox(layoutWidget1); - groupBox->setObjectName(QStringLiteral("groupBox")); - gridLayout_6 = new QGridLayout(groupBox); - gridLayout_6->setObjectName(QStringLiteral("gridLayout_6")); - gridLayout_6->setContentsMargins(1, 1, 1, 1); - gridLayout = new QGridLayout(); - gridLayout->setObjectName(QStringLiteral("gridLayout")); - gridLayout->setContentsMargins(2, 2, 2, 2); - horizontalLayout = new QHBoxLayout(); - horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - pushButton_8 = new QPushButton(groupBox); - pushButton_8->setObjectName(QStringLiteral("pushButton_8")); - - horizontalLayout->addWidget(pushButton_8); - - horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - horizontalLayout->addItem(horizontalSpacer_3); - - pushButton_next = new QPushButton(groupBox); - pushButton_next->setObjectName(QStringLiteral("pushButton_next")); - - horizontalLayout->addWidget(pushButton_next); - - - gridLayout->addLayout(horizontalLayout, 1, 0, 1, 1); - - listWidget = new QListWidget(groupBox); - listWidget->setObjectName(QStringLiteral("listWidget")); - - gridLayout->addWidget(listWidget, 0, 0, 1, 2); - - - gridLayout_6->addLayout(gridLayout, 0, 0, 1, 1); - - - horizontalLayout_5->addWidget(groupBox); - groupBox_3 = new QGroupBox(layoutWidget1); groupBox_3->setObjectName(QStringLiteral("groupBox_3")); gridLayout_7 = new QGridLayout(groupBox_3); @@ -233,6 +202,11 @@ public: horizontalLayout_6 = new QHBoxLayout(); horizontalLayout_6->setObjectName(QStringLiteral("horizontalLayout_6")); + m_pbLoadImage = new QPushButton(groupBox_3); + m_pbLoadImage->setObjectName(QStringLiteral("m_pbLoadImage")); + + horizontalLayout_6->addWidget(m_pbLoadImage); + horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_6->addItem(horizontalSpacer_2); @@ -249,7 +223,6 @@ public: horizontalLayout_5->addWidget(groupBox_3); horizontalLayout_5->setStretch(0, 1); - horizontalLayout_5->setStretch(1, 1); splitter->addWidget(layoutWidget1); gridLayout_3->addWidget(splitter, 1, 0, 1, 1); @@ -325,6 +298,13 @@ public: statusBar = new QStatusBar(MainFrame); statusBar->setObjectName(QStringLiteral("statusBar")); MainFrame->setStatusBar(statusBar); + toolBar = new QToolBar(MainFrame); + toolBar->setObjectName(QStringLiteral("toolBar")); + MainFrame->addToolBar(Qt::TopToolBarArea, toolBar); + + toolBar->addAction(actionadd); + toolBar->addAction(actiondel); + toolBar->addAction(actionsave); retranslateUi(MainFrame); @@ -334,15 +314,15 @@ public: void retranslateUi(QMainWindow *MainFrame) { MainFrame->setWindowTitle(QApplication::translate("MainFrame", "\346\240\207\345\256\232", Q_NULLPTR)); - actionTest->setText(QApplication::translate("MainFrame", "test", Q_NULLPTR)); + actionadd->setText(QApplication::translate("MainFrame", "add", Q_NULLPTR)); + actiondel->setText(QApplication::translate("MainFrame", "del", Q_NULLPTR)); + actionsave->setText(QApplication::translate("MainFrame", "save", Q_NULLPTR)); m_pbSaveBtn->setText(QApplication::translate("MainFrame", "\344\277\235\345\255\230", Q_NULLPTR)); label_SaveStatus->setText(QString()); QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem(); ___qtreewidgetitem->setText(0, QApplication::translate("MainFrame", "\350\247\243\345\206\263\346\226\271\346\241\210\350\265\204\346\272\220\347\256\241\347\220\206", Q_NULLPTR)); - groupBox->setTitle(QApplication::translate("MainFrame", "\345\257\274\345\205\245\345\233\276\347\211\207\357\274\232", Q_NULLPTR)); - pushButton_8->setText(QApplication::translate("MainFrame", "\346\213\215\346\221\204", Q_NULLPTR)); - pushButton_next->setText(QApplication::translate("MainFrame", ">", Q_NULLPTR)); groupBox_3->setTitle(QApplication::translate("MainFrame", "\350\276\223\345\207\272\347\273\223\346\236\234\357\274\232", Q_NULLPTR)); + m_pbLoadImage->setText(QApplication::translate("MainFrame", "\345\212\240\350\275\275\345\233\276\345\203\217", Q_NULLPTR)); pushButton_5->setText(QApplication::translate("MainFrame", "\346\270\205\347\251\272\347\273\223\346\236\234", Q_NULLPTR)); label_pixel_info->setText(QApplication::translate("MainFrame", "Pixel info: ...", Q_NULLPTR)); groupBox_2->setTitle(QApplication::translate("MainFrame", "\347\256\227\346\263\225\345\210\227\350\241\250", Q_NULLPTR)); @@ -361,6 +341,7 @@ public: ___qtablewidgetitem5->setText(QApplication::translate("MainFrame", "\347\261\273\345\236\213", Q_NULLPTR)); QTableWidgetItem *___qtablewidgetitem6 = tableWidget->horizontalHeaderItem(3); ___qtablewidgetitem6->setText(QApplication::translate("MainFrame", "\345\200\274", Q_NULLPTR)); + toolBar->setWindowTitle(QApplication::translate("MainFrame", "toolBar", Q_NULLPTR)); } // retranslateUi }; diff --git a/src/lpbdesigner/GeneratedFiles/ui_ParamDlg.h b/src/lpbdesigner/GeneratedFiles/ui_ParamDlg.h index cabf233..9420862 100644 --- a/src/lpbdesigner/GeneratedFiles/ui_ParamDlg.h +++ b/src/lpbdesigner/GeneratedFiles/ui_ParamDlg.h @@ -57,7 +57,7 @@ public: if (ParamDlg->objectName().isEmpty()) ParamDlg->setObjectName(QStringLiteral("ParamDlg")); ParamDlg->setWindowModality(Qt::ApplicationModal); - ParamDlg->resize(279, 294); + ParamDlg->resize(279, 304); QFont font; font.setFamily(QStringLiteral("Arial")); font.setPointSize(10); @@ -66,7 +66,7 @@ public: ParamDlg->setFont(font); gridLayout_2 = new QGridLayout(ParamDlg); gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); - gridLayout_2->setContentsMargins(2, 2, 2, 2); + gridLayout_2->setContentsMargins(5, 5, 5, 5); gridLayout = new QGridLayout(); gridLayout->setObjectName(QStringLiteral("gridLayout")); label_6 = new QLabel(ParamDlg); diff --git a/src/lpbdesigner/GeneratedFiles/ui_RoiDlg.h b/src/lpbdesigner/GeneratedFiles/ui_RoiDlg.h index 7d667d3..f9da855 100644 --- a/src/lpbdesigner/GeneratedFiles/ui_RoiDlg.h +++ b/src/lpbdesigner/GeneratedFiles/ui_RoiDlg.h @@ -87,7 +87,7 @@ public: RoiDlg->setFont(font); gridLayout_3 = new QGridLayout(RoiDlg); gridLayout_3->setObjectName(QStringLiteral("gridLayout_3")); - gridLayout_3->setContentsMargins(1, 1, 1, 1); + gridLayout_3->setContentsMargins(5, 5, 5, 5); horizontalSpacer_5 = new QSpacerItem(649, 27, QSizePolicy::Expanding, QSizePolicy::Minimum); gridLayout_3->addItem(horizontalSpacer_5, 1, 0, 1, 1); diff --git a/src/lpbdesigner/MainFrame.cpp b/src/lpbdesigner/MainFrame.cpp index 9e28a18..371f852 100644 --- a/src/lpbdesigner/MainFrame.cpp +++ b/src/lpbdesigner/MainFrame.cpp @@ -3,8 +3,8 @@ #include "colossusbase.h" #include #pragma execution_character_set("utf-8") -typedef QMap TaskMap; -typedef QMap TaskMapStr; +//typedef QMap TaskMap; +//typedef QMap TaskMapStr; QString showVariant(const AlgoParamType type, const QVariant &var) { switch (type) @@ -132,26 +132,25 @@ CMainFrame::CMainFrame(QWidget *parent) 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())); +// 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->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->pushButton_8, SIGNAL(clicked()), this, SLOT(OnSnapImage())); - + 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(this, SIGNAL(sgShowStatus(QString)), this, SLOT(OnShowStatus(QString))); ui->gv_input->setInfoLabel(ui->label_pixel_info); - connect(ui->pushButton_next, SIGNAL(clicked()), this, SLOT(OnNextBtnClick())); + //connect(ui->pushButton_next, SIGNAL(clicked()), this, SLOT(OnNextBtnClick())); connect(ui->gv_input, SIGNAL(imgScaled(QTransform, QPointF)), ui->gv_output, SLOT(scaleImg(QTransform, QPointF))); connect(ui->gv_input, SIGNAL(imgMoved(QPointF)), ui->gv_output, SLOT(moveImg(QPointF))); @@ -266,121 +265,57 @@ bool CMainFrame::InitGraphView() 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->listWidget->clear(); +// ui->listWidget->clear(); ui->textEdit->setWordWrapMode(QTextOption::NoWrap); - //int nSolutionCount = m_pSolutionMgr->GetSolutionCount(); - //if (nSolutionCount > 0) - { - QMap tmp = m_pSolutionMgr->GetAllSolutions(); - for (QMap::iterator it = tmp.begin();it!= tmp.end();++it) + { /*获取所有的solution*/ + QMap tmp = m_pSolutionMgr->GetAllSolutions(); + for (QMap::iterator it = tmp.begin(); it!= tmp.end(); ++it) { IDetectorSolution* tmpSolution = *it; if (tmpSolution != nullptr) { PLP_DETECTOR_SOLUTION pSolutionInfo = tmpSolution->GetSolutionInfo(); QTreeWidgetItem *solutionItem = NULL; - - if (m_pSolutionMgr->GetRunSolution() && m_pSolutionMgr->GetRunSolution()->GetID() == tmpSolution->GetID()) - { - QString strText = pSolutionInfo->strName + tr("(√)"); - solutionItem = new QTreeWidgetItem(ui->treeWidget, QStringList(strText)); - } - else - { - solutionItem = new QTreeWidgetItem(ui->treeWidget, QStringList(pSolutionInfo->strName)); - } - + QString strText = pSolutionInfo->strName;// +tr("(√)"); + solutionItem = new QTreeWidgetItem(ui->treeWidget, QStringList(strText)); solutionItem->setData(0, Qt::UserRole, tmpSolution->GetID()); solutionItem->setData(1, Qt::UserRole, SOLUTION); + solutionItem->setData(2, Qt::UserRole, it.key()); - QStringList strKeys = tmpSolution->GetAllTaskNames(); - QMap m_tmpMap; - for (int n = 0; n < strKeys.size();n++) - { - IDetectorTask* pTask = tmpSolution->GetTask(strKeys[n]); - if (pTask) - { - PLP_DETECTOR_TASK pTaskInfo = pTask->GetTaskInfo(); - int ID = pTaskInfo->nCameraID; - int TaskID = pTask->GetID(); - QString strKey = strKeys[n]; - pTaskInfo->nID = TaskID; - if (m_tmpMap.contains(ID)) - { - QMap::iterator item = m_tmpMap.find(ID); - (*item)[strKey] = pTaskInfo; - } - else - { - TaskMapStr Itemtmp; - Itemtmp[strKey] = pTaskInfo; - m_tmpMap[ID] = Itemtmp; - } - } - } - - for (QMap::iterator its = m_tmpMap.begin(); its != m_tmpMap.end(); ++its) - { - int camID = its.key(); - QString strStationName = QString(QObject::tr("工位%1")).arg(camID); - QTreeWidgetItem *childItem = new QTreeWidgetItem(solutionItem, QStringList(strStationName)); - childItem->setData(0, Qt::UserRole, tmpSolution->GetID()); - childItem->setData(1, Qt::UserRole, SOLUTION); - solutionItem->addChild(childItem); - - TaskMapStr tmp = *its; - int nFirstID = 0; - QString strFirstName; - for(TaskMapStr::iterator it = tmp.begin(); it != tmp.end();++it) - { - if ((*it)->strName.contains("TEMPLATE")) - { - nFirstID = (*it)->nID; - strFirstName = (*it)->strName; - break; - } - } - if (nFirstID != 0){ - QTreeWidgetItem *firstTaskItem = new QTreeWidgetItem(childItem, QStringList(strFirstName)); - firstTaskItem->setData(0, Qt::UserRole, nFirstID); - firstTaskItem->setData(1, Qt::UserRole, Task); - childItem->addChild(firstTaskItem); - } - - - for (TaskMapStr::iterator itItem = tmp.begin(); itItem != tmp.end(); ++itItem) - { - if (nFirstID!=0 &&((*itItem)->strName.contains("TEMPLATE"))) - { - continue; - } - QTreeWidgetItem *TaskItem = new QTreeWidgetItem(childItem, QStringList((*itItem)->strName)); - TaskItem->setData(0, Qt::UserRole, (*itItem)->nID); - TaskItem->setData(1, Qt::UserRole, Task); - childItem->addChild(TaskItem); - } - } - - //if (i == 0) + QMap mItemMap = tmpSolution->GetAllTasks(); + /*设置template模板在最前面*/ + QMap::iterator it = mItemMap.find("template"); + if (it != mItemMap.end()) { - ui->treeWidget->setCurrentItem(solutionItem); + int nID = (*it)->GetTaskInfo()->nID; + QString strName = (*it)->GetTaskInfo()->strName; + QTreeWidgetItem *TaskItem = new QTreeWidgetItem(solutionItem, QStringList(strName)); + TaskItem->setData(0, Qt::UserRole, nID); + TaskItem->setData(1, Qt::UserRole, Task); + solutionItem->addChild(TaskItem); } - if (m_pSolutionMgr->GetRunSolution() && m_pSolutionMgr->GetRunSolution()->GetID() == tmpSolution->GetID()) - { - ui->treeWidget->setCurrentItem(solutionItem); - ui->treeWidget->expandItem(solutionItem); - ui->treeWidget->setCurrentItem(solutionItem); + for (QMap::iterator its = mItemMap.begin(); its != mItemMap.end(); ++its) + { + int nID = (*its)->GetTaskInfo()->nID; + QString strName = (*its)->GetTaskInfo()->strName; + if(strName.contains("template")||strName == "template") + continue; + QTreeWidgetItem *TaskItem = new QTreeWidgetItem(solutionItem, QStringList(strName)); + TaskItem->setData(0, Qt::UserRole, nID); + TaskItem->setData(1, Qt::UserRole, Task); + solutionItem->addChild(TaskItem); } + ui->treeWidget->expandItem(solutionItem); + ui->treeWidget->setCurrentItem(solutionItem); } } } m_TaskChangeList.clear(); if (!InitCurrentTask()) return true; - return true; } @@ -395,7 +330,7 @@ bool CMainFrame::InitCurrentTask() ui->tableWidget_2->setRowCount(0); ui->tableWidget_2->clearContents(); - ui->listWidget->clear(); +// ui->listWidget->clear(); ui->gv_input->clear(); ui->gv_output->clear(); @@ -441,7 +376,6 @@ bool CMainFrame::InitCurrentTask() } ui->tableWidget_2->setItem(i, 1, new QTableWidgetItem(QObject::tr(lppAlgo[i]->GetAlgorithmInfo()->strName.toStdString().c_str()))); - //ui->tableWidget_2->setItem(i, 2, new QTableWidgetItem(lppAlgo[i]->GetAlgorithmInfo()->strDescription)); ui->tableWidget_2->setItem(i, 2, new QTableWidgetItem(QString::number(lppAlgo[i]->GetAlgorithmInfo()->nRoiID))); if (i == 0) @@ -477,7 +411,7 @@ bool CMainFrame::InitCurrentSolution(QTreeWidgetItem* pItem, IDetectorSolution* QStringList strKey = pSolution->GetAllTaskNames(); for (int n = 0; n < strKey.size(); n++) { - IDetectorTask* pTask = pSolution->GetTask(strKey[n]); + IDetectorTask* pTask = pSolution->GetTaskByName(strKey[n]); if (pTask) { PLP_DETECTOR_TASK pTaskInfo = pTask->GetTaskInfo(); @@ -489,28 +423,6 @@ bool CMainFrame::InitCurrentSolution(QTreeWidgetItem* pItem, IDetectorSolution* pItem->addChild(TaskItem); } } - -// int nTaskCount = pSolution->EnumTask(NULL, 0); -// if (nTaskCount > 0) -// { -// IDetectorTask** lppTask = new IDetectorTask*[nTaskCount]; -// nTaskCount = pSolution->EnumTask(lppTask, nTaskCount); -// for (int i = 0; i < nTaskCount; i++) -// { -// if (lppTask[i]) -// { -// PLP_DETECTOR_TASK pTaskInfo = lppTask[i]->GetTaskInfo(); -// -// QTreeWidgetItem *TaskItem = new QTreeWidgetItem(pItem, QStringList(pTaskInfo->strName)); -// TaskItem->setData(0, Qt::UserRole, lppTask[i]->GetID()); -// TaskItem->setData(1, Qt::UserRole, Task); -// -// pItem->addChild(TaskItem); -// } -// } -// -// delete[] lppTask; -// } return true; } @@ -526,7 +438,8 @@ bool CMainFrame::OnSetRunSolution() { if (pRunSolution->GetID() == m_pCurrentSolution->GetID()) { - m_pSolutionMgr->SetRunSolution(LP_DETECTOR_INVALID_ID); + QString strName = pRunSolution->GetSolutionName(); + m_pSolutionMgr->SetRunSolution(strName); ui->treeWidget->currentItem()->setText(0, m_pCurrentSolution->GetSolutionInfo()->strName); return true; } @@ -536,14 +449,14 @@ bool CMainFrame::OnSetRunSolution() for (int i = 0; i < nItemCount; i++) { QTreeWidgetItem* pItem = ui->treeWidget->topLevelItem(i); - if (pItem->data(0, Qt::UserRole).toInt() == pRunSolution->GetID()) + if (pItem->data(0, Qt::UserRole).toString() == pRunSolution->GetSolutionName()) { pItem->setText(0, pRunSolution->GetSolutionInfo()->strName); break; } } - m_pSolutionMgr->SetRunSolution(m_pCurrentSolution->GetID()); + m_pSolutionMgr->SetRunSolution(m_pCurrentSolution->GetSolutionName()); QString strText = m_pCurrentSolution->GetSolutionInfo()->strName + tr("(√)"); ui->treeWidget->currentItem()->setText(0, strText); return true; @@ -551,7 +464,7 @@ bool CMainFrame::OnSetRunSolution() } else { - m_pSolutionMgr->SetRunSolution(m_pCurrentSolution->GetID()); + m_pSolutionMgr->SetRunSolution(m_pCurrentSolution->GetSolutionName()); QString strText = m_pCurrentSolution->GetSolutionInfo()->strName + tr("(√)"); ui->treeWidget->currentItem()->setText(0, strText); return true; @@ -573,25 +486,20 @@ bool CMainFrame::OnBatchLoadImage(bool bReLoad) 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); -// ui->listWidget->setIconSize(QSize(75, 75)); +// 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); - } +// 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();//中文路径支持 @@ -607,13 +515,13 @@ bool CMainFrame::OnBatchLoadImage(bool bReLoad) bool CMainFrame::OnCopyFileTitle() { - QListWidgetItem* item = ui->listWidget->currentItem(); +// QListWidgetItem* item = ui->listWidget->currentItem(); - if (item) - { - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(item->text()); - } +// if (item) +// { +// QClipboard *clipboard = QApplication::clipboard(); +// clipboard->setText(item->text()); +// } return true; } @@ -661,7 +569,7 @@ bool CMainFrame::InitCurrentNode() if (m_pCurrentSolution) m_pCurrentSolution->ClearUserParamValue(); - int nSolutionID = currentItem->data(0, Qt::UserRole).toInt(); + QString nSolutionID = currentItem->data(0, Qt::UserRole).toString(); m_pCurrentSolution = m_pSolutionMgr->GetSolutionByID(nSolutionID); if (!m_pCurrentSolution) return false; @@ -673,13 +581,14 @@ bool CMainFrame::InitCurrentNode() { if (currentItem->parent()) { - int nSolutionID = currentItem->parent()->data(0, Qt::UserRole).toInt(); + QString nSolutionID = currentItem->parent()->data(2, Qt::UserRole).toString(); m_pCurrentSolution = m_pSolutionMgr->GetSolutionByID(nSolutionID); if (!m_pCurrentSolution) return false; + QString strName = currentItem->data(0,Qt::DisplayRole).toString(); int nTaskID = currentItem->data(0, Qt::UserRole).toInt(); - m_pCurrentTask = m_pCurrentSolution->GetTask(nTaskID); + m_pCurrentTask = m_pCurrentSolution->GetTaskByName(strName); if (!m_pCurrentTask) return false; } @@ -1183,26 +1092,11 @@ bool CMainFrame::OnListWidgetPopMenu(const QPoint&) { menu.clear(); return false; - } -// if (selectedAction == deleteAction) -// { -// if (ui->listWidget->currentItem()) -// { -// ui->listWidget->removeItemWidget(ui->listWidget->currentItem()); -// delete ui->listWidget->currentItem(); -// } -// } -// else + } if (selectedAction == batchLoadImgAction) { OnBatchLoadImage(); } -// else if (selectedAction == copyTitleAction) -// { -// OnCopyFileTitle(); -// } - - menu.clear(); return true; } @@ -1255,24 +1149,24 @@ bool CMainFrame::OnListItemDoubleClick() 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; - } +// 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; } @@ -1754,14 +1648,14 @@ void CMainFrame::OnCellChanged(int row, int column) bool CMainFrame::OnNextBtnClick() { - int index = ui->listWidget->currentRow(); - int maxindex = ui->listWidget->count()-1; - - if (index < maxindex) - { - ui->listWidget->setCurrentRow(index + 1); - OnListItemClick(); - } +// int index = ui->listWidget->currentRow(); +// int maxindex = ui->listWidget->count()-1; +// +// if (index < maxindex) +// { +// ui->listWidget->setCurrentRow(index + 1); +// OnListItemClick(); +// } return OnRunAlgo(); } @@ -1852,8 +1746,30 @@ void CMainFrame::closeEvent(QCloseEvent *event) SystemStateInfo::bParamStateFlag = false; } if (m_pSolutionMgr && m_pSolutionMgr->GetRunSolution()) { - m_pSolutionMgr->SetRunSolution(m_pSolutionMgr->GetRunSolution()->GetID()); + m_pSolutionMgr->SetRunSolution(m_pSolutionMgr->GetRunSolution()->GetSolutionName()); } //OnManualTrigger(); QMainWindow::closeEvent(event); } + +Q_SLOT void CMainFrame::onLoadImage() +{ + if (!currentTask()) + return ; + + QString strDefaultDirPath = m_pCurrentTask->GetTaskInfo()->strDirPath; + QStringList strFileNamesList = QFileDialog::getOpenFileNames(this, "open file", strDefaultDirPath, "Images (*.bmp *.png *.xpm *.jpg)"); + if (strFileNamesList.size() <= 0) + { + return ; + } + + QString strFileName = strFileNamesList[0]; + std::string strpath = strFileName.toLocal8Bit().toStdString();//中文路径支持 + 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(); + } +} diff --git a/src/lpbdesigner/MainFrame.h b/src/lpbdesigner/MainFrame.h index dad3b1a..8845d95 100644 --- a/src/lpbdesigner/MainFrame.h +++ b/src/lpbdesigner/MainFrame.h @@ -42,6 +42,7 @@ public: QString genInfo(); virtual void closeEvent(QCloseEvent *event); + Q_SLOT void onLoadImage(); QString GetParamTypeStr(AlgoParamType type); signals: void sgShowStatus(QString); diff --git a/src/lpbdesigner/MainFrame.ui b/src/lpbdesigner/MainFrame.ui index 476b5e2..604772b 100644 --- a/src/lpbdesigner/MainFrame.ui +++ b/src/lpbdesigner/MainFrame.ui @@ -9,8 +9,8 @@ 0 0 - 963 - 664 + 1050 + 755 @@ -19,19 +19,19 @@ - 0 + 5 - 0 + 5 - 0 + 5 - 0 + 5 - 0 + 5 @@ -46,7 +46,7 @@ 保存 - + :/img/resource/save.png:/img/resource/save.png @@ -84,10 +84,22 @@ + + + 0 + 0 + + Qt::Horizontal + + + 3 + 0 + + Consolas @@ -101,6 +113,12 @@ + + + 8 + 0 + + Qt::Vertical @@ -175,81 +193,10 @@ - + 1 - - - - 导入图片: - - - - 1 - - - 1 - - - 1 - - - 1 - - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - - 拍摄 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - > - - - - - - - - - - - - - @@ -273,6 +220,13 @@ + + + + 加载图像 + + + @@ -439,13 +393,33 @@ - - - - :/img/resource/save.png:/img/resource/save.png + + + toolBar + + + TopToolBarArea + + + false + + + + + + + + add + + + + del + + + - test + save @@ -462,7 +436,7 @@ - + diff --git a/src/lpbdesigner/ParamDlg.ui b/src/lpbdesigner/ParamDlg.ui index ecc8fb3..faeea0b 100644 --- a/src/lpbdesigner/ParamDlg.ui +++ b/src/lpbdesigner/ParamDlg.ui @@ -10,7 +10,7 @@ 0 0 279 - 294 + 304 @@ -26,16 +26,16 @@ - 2 + 5 - 2 + 5 - 2 + 5 - 2 + 5 diff --git a/src/lpbdesigner/RoiDlg.ui b/src/lpbdesigner/RoiDlg.ui index 2dce40d..2cc85d6 100644 --- a/src/lpbdesigner/RoiDlg.ui +++ b/src/lpbdesigner/RoiDlg.ui @@ -23,16 +23,16 @@ - 1 + 5 - 1 + 5 - 1 + 5 - 1 + 5 diff --git a/src/lpbengine/Algorithm.cpp b/src/lpbengine/Algorithm.cpp index ca8d234..9e76215 100644 --- a/src/lpbengine/Algorithm.cpp +++ b/src/lpbengine/Algorithm.cpp @@ -468,7 +468,7 @@ bool CDetectorAlgorithm::SerializeToJson(QJsonDocument* pJsonDocument, QJsonArra { cv::Mat matResult = p->value.value(); //QString strExePath = QCoreApplication::applicationDirPath(); - QString strFilePath = m_pTask->GetPath();// strExePath + LP_DETECTOR_BUSSINESS_IN_PARAM_FILE_DIR; + QString strFilePath = m_pTask->GetPath()+"/";// strExePath + LP_DETECTOR_BUSSINESS_IN_PARAM_FILE_DIR; QString strName = QString("%1_%2_%3_%4").arg(m_pTask->GetParentSolution()->GetID()).arg(m_pTask->GetID()).arg(m_nID).arg(p->nID); QString strFileName = strName + "_in" + ".bmp"; QString strFileName2 = strFileName; @@ -881,7 +881,7 @@ bool CDetectorAlgorithm::SerializeFromJson(QJsonObject* pJsonObject) case LP_MAT: { //QString strExePath = QCoreApplication::applicationDirPath(); - QString strFilePath = m_pTask->GetPath(); //strExePath + LP_DETECTOR_BUSSINESS_IN_PARAM_FILE_DIR; + QString strFilePath = m_pTask->GetPath() + "/"; //strExePath + LP_DETECTOR_BUSSINESS_IN_PARAM_FILE_DIR; QString strFileName = jsonObject.value("param_file_path").toString(); strFilePath += strFileName; QFile file(strFilePath); @@ -1195,8 +1195,8 @@ bool CDetectorAlgorithm::Load(QString dllPath) } else { - //QString strExePath = QCoreApplication::applicationDirPath(); - QString strDefaultFilePath = m_pTask->GetPath();// strExePath + LP_DETECTOR_BUSSINESS_CONFIG_ALGO_DIR + strFileName; + QString strExePath = QCoreApplication::applicationDirPath(); + QString strDefaultFilePath = strExePath + LP_DETECTOR_BUSSINESS_CONFIG_ALGO_DIR + strFileName; QFile defaultFile(strDefaultFilePath); if (defaultFile.exists()) @@ -1850,7 +1850,7 @@ bool CDetectorAlgorithm::ImportParam(QJsonArray paramArray)//导入参数 //QString strExePath = QCoreApplication::applicationDirPath(); - QString strFilePath = m_pTask->GetPath(); //strExePath + LP_DETECTOR_BUSSINESS_IMAGE_DIR; + QString strFilePath = m_pTask->GetPath() + "/"; //strExePath + LP_DETECTOR_BUSSINESS_IMAGE_DIR; QString strFileName = strFilePath + QString::number(param.nID) + ".bmp"; std::string strpath = strFileName.toLocal8Bit().toStdString(); roiData.img = cv::imread(strpath, CV_LOAD_IMAGE_UNCHANGED); @@ -1988,7 +1988,7 @@ QByteArray CDetectorAlgorithm::ExportParam() LP_DETECTOR_ROI_DATA roiData = p->value.value(); - QString strExePath = m_pTask->GetPath(); //QCoreApplication::applicationDirPath(); +// QString strExePath = m_pTask->GetPath(); //QCoreApplication::applicationDirPath(); QString strFilePath = m_pTask->GetPath()+"/"; //strExePath + "/" + "images/"; QString strFileName = strFilePath + QString::number(p->nID) + ".bmp"; std::string strpath = strFileName.toLocal8Bit().toStdString(); diff --git a/src/lpbengine/CDetectorEngine.cpp b/src/lpbengine/CDetectorEngine.cpp index 1d78380..2c55946 100644 --- a/src/lpbengine/CDetectorEngine.cpp +++ b/src/lpbengine/CDetectorEngine.cpp @@ -44,7 +44,7 @@ bool CDetectorEngine::detect(cv::Mat srcImg, QString modeName, AlgResultCallBack IDetectorSolution* pSolution = m_SolutionMgr.GetRunSolution(); if (pSolution) { - IDetectorTask* pTask = pSolution->GetTask(modeName); + IDetectorTask* pTask = pSolution->GetTaskByName(modeName); if (pTask) { pTask->GetTaskInfo()->detectImg = srcImg; diff --git a/src/lpbengine/Solution.cpp b/src/lpbengine/Solution.cpp index 03602f2..b96d3ac 100644 --- a/src/lpbengine/Solution.cpp +++ b/src/lpbengine/Solution.cpp @@ -40,6 +40,11 @@ PLP_DETECTOR_SOLUTION Solution::GetSolutionInfo() return &m_tSolutionInfo; } +QString Solution::GetSolutionName() +{ + return m_tSolutionInfo.strName; +} + IDetectorTask* Solution::AddTask(const PLP_DETECTOR_TASK pTask, QString strPath) { if (NULL == pTask) @@ -51,7 +56,6 @@ IDetectorTask* Solution::AddTask(const PLP_DETECTOR_TASK pTask, QString strPath) { p->SetID(++m_nBaseID); p->LoadFile(strPath); - m_TaskMapByID.insert(p->GetID(), p); m_TaskMapByName.insert(p->GetTaskInfo()->strName, p); return p; } @@ -72,7 +76,6 @@ bool Solution::AddTaskByCopy(IDetectorTask* pSrc) { p->SetID(++m_nBaseID); p->Copy(pSrc); - m_TaskMapByID.insert(p->GetID(), p); m_TaskMapByName.insert(p->GetTaskInfo()->strName, p); return true; } @@ -81,7 +84,17 @@ bool Solution::AddTaskByCopy(IDetectorTask* pSrc) return false; } -IDetectorTask* Solution::AddTask(const PLP_DETECTOR_TASK pTask, bool bRet /*= true*/) +bool Solution::SetRunTask(QString strName) +{ + QMap::iterator it = m_TaskMapByName.find(strName); + if (it != m_TaskMapByName.end()) + { + return true; + } + return false; +} + +IDetectorTask* Solution::AddTask(const PLP_DETECTOR_TASK pTask) { if (NULL == pTask) return NULL; @@ -91,7 +104,6 @@ IDetectorTask* Solution::AddTask(const PLP_DETECTOR_TASK pTask, bool bRet /*= tr if (p->Initialize(this, m_pAlgoLibMgr) && p->SetTaskInfo(pTask)) { p->SetID(++m_nBaseID); - m_TaskMapByID.insert(p->GetID(), p); m_TaskMapByName.insert(p->GetTaskInfo()->strName, p); return p; } @@ -100,38 +112,12 @@ IDetectorTask* Solution::AddTask(const PLP_DETECTOR_TASK pTask, bool bRet /*= tr return NULL; } -bool Solution::SetRunTask(int nCameraID, QString strTaskName) -{ - QMap::iterator it = m_TaskMapByName.find(strTaskName); - if (it != m_TaskMapByName.end()) - { - m_CurRunTaskMap[nCameraID] = *it; - return true; - } - return false; -} - -bool Solution::DeleteTask(int nTaskID) -{ - QMap::iterator it = m_TaskMapByID.find(nTaskID); - if (it != m_TaskMapByID.end()){ - QString strName = (*it)->GetTaskInfo()->strName; - m_TaskMapByName.remove(strName); - (*it)->RemoveFile(); - delete *it; - *it = nullptr; - m_TaskMapByID.erase(it); - return true; - } - return true; -} bool Solution::DeleteTask(QString strName) { QMap::iterator its = m_TaskMapByName.find(strName); if (its != m_TaskMapByName.end()) { int nID = (*its)->GetID(); - m_TaskMapByID.remove(nID); (*its)->RemoveFile(); delete *its; m_TaskMapByName.erase(its); @@ -140,20 +126,7 @@ bool Solution::DeleteTask(QString strName) return false; } -IDetectorTask* Solution::GetTask(int nTaskID) -{ - QMap::iterator it = m_TaskMapByID.find(nTaskID); - if (it != m_TaskMapByID.end()){ - - if ((*it) != nullptr) - return *it; - else - return nullptr; - } - return nullptr; -} - -IDetectorTask* Solution::GetTask(QString strName) +IDetectorTask* Solution::GetTaskByName(QString strName) { QMap::iterator its = m_TaskMapByName.find(strName); if (its != m_TaskMapByName.end()) @@ -185,14 +158,11 @@ void Solution::Release() void Solution::CleanUp() { - for (QMap::iterator it = m_TaskMapByID.begin(); it != m_TaskMapByID.end(); ++it) + for (QMap::iterator it = m_TaskMapByName.begin(); it != m_TaskMapByName.end(); ++it) { if (*it) (*it)->Release(); } - m_TaskMapByID.clear(); - m_TaskMapByName.clear(); - m_CurRunTaskMap.clear(); } bool Solution::CheckTask(int nTaskID, QString strTaskName) @@ -219,7 +189,7 @@ bool Solution::SaveFileEx(const QString& strPath, QStringList sTaskNames) CDetectorTask *p = (CDetectorTask*)m_TaskMapByName.value(strObj); if (p) { - QString taskPath = strPath + "/" + strObj; + QString taskPath = strPath + "/" + strObj; if (!dir.exists(taskPath)) { dir.mkpath(taskPath); } @@ -244,7 +214,7 @@ bool Solution::SaveFileEx(const QString& strPath) dir.setPath(strPath); - for (QMap::iterator iter = m_TaskMapByID.begin(); iter != m_TaskMapByID.end(); ++iter) { + for (QMap::iterator iter = m_TaskMapByName.begin(); iter != m_TaskMapByName.end(); ++iter) { if (*iter) { CDetectorTask *p = (CDetectorTask*)*iter; @@ -323,7 +293,7 @@ bool Solution::LoadFileEx(const QString& strPath) if (infoObj.isEmpty()) return false; //解析solution基本信息 - m_tSolutionInfo.strName = infoObj.value("solution_name").toString(); + //m_tSolutionInfo.strName = infoObj.value("solution_name").toString(); m_tSolutionInfo.nType = infoObj.value("solution_type").toInt(0); m_tSolutionInfo.strDescription = infoObj.value("solution_description").toString(); m_nID = infoObj.value("solution_id").toInt(); @@ -346,7 +316,7 @@ bool Solution::LoadFileEx(const QString& strPath) if (!pTask) { qWarning("load task: %s fail", strTaskPath); - DeleteTask(pTask->GetID()); + DeleteTask(taskName); pTask = NULL; continue; } @@ -360,67 +330,6 @@ bool Solution::LoadFileEx(const QString& strPath) return true; } -// bool Solution::SaveFile(const QString& strPath) -// { -// QJsonDocument document; -// QJsonObject jsonObject; -// -// if (!SerializeToJson(jsonObject)) { -// return false; -// } -// -// document.setObject(jsonObject); -// QByteArray byteArray = document.toJson(); -// if (byteArray.isEmpty()) -// return false; -// -// QFile file(strPath); -// if (file.open(QFile::WriteOnly | QFile::Text)) -// { -// file.write(byteArray); -// file.flush(); -// file.close(); -// return true; -// } -// -// return false; -// } - -// bool Solution::LoadFile(const QString& strPath) -// { -// QJsonDocument document; -// QJsonParseError parse_error; -// -// QFile solutionFile(strPath); -// if (!solutionFile.open(QFile::ReadOnly)) -// { -// return false; -// } -// -// QByteArray byteArray; -// byteArray = solutionFile.readAll(); -// if (byteArray.isEmpty()) -// return false; -// -// document = QJsonDocument::fromJson(byteArray, &parse_error); -// if (parse_error.error == QJsonParseError::NoError) -// { -// if (!document.isEmpty() && !document.isNull()) -// { -// if (document.isObject()) -// { -// QJsonObject solutionJsonObject = document.object(); -// if (!SerializeFromJson(&solutionJsonObject)) -// { -// return false; -// } -// } -// } -// } -// -// return true; -// } - bool Solution::SerializeToJson(QJsonObject& jsonObject) { jsonObject.insert("solution_name", m_tSolutionInfo.strName); @@ -429,7 +338,7 @@ bool Solution::SerializeToJson(QJsonObject& jsonObject) jsonObject.insert("solution_id", m_nID); QJsonArray TaskArray; - for (QMap::iterator iter = m_TaskMapByID.begin(); iter != m_TaskMapByID.end(); ++iter){ + for (QMap::iterator iter = m_TaskMapByName.begin(); iter != m_TaskMapByName.end(); ++iter){ if (*iter) { QJsonObject taskObject; @@ -492,7 +401,7 @@ IDetectorSolution* Solution::Copy() if (!pNewSolution->SetSolutionInfo(&m_tSolutionInfo)) return NULL; - for (QMap::iterator iter = m_TaskMapByID.begin(); iter != m_TaskMapByID.end(); ++iter) + for (QMap::iterator iter = m_TaskMapByName.begin(); iter != m_TaskMapByName.end(); ++iter) { IDetectorTask* pTask = *iter; if (pTask) @@ -505,7 +414,7 @@ IDetectorSolution* Solution::Copy() } } } - pNewSolution->m_CurRunTaskMap = m_CurRunTaskMap; + pNewSolution->m_TaskMapByName = m_TaskMapByName; return pNewSolution; } @@ -529,16 +438,6 @@ bool Solution::GetModifyFlag() return m_bIsModify; } -IDetectorTask* Solution::GetTaskByCameraID(int nCameraID) -{ - QMap::iterator iter = m_CurRunTaskMap.find(nCameraID); - if (iter != m_CurRunTaskMap.end()) - { - return *iter; - } - - return nullptr; -} bool Solution::Copy(IDetectorSolution* pSrcSolution, bool bRet /* = true */) { @@ -578,7 +477,7 @@ IDetectorTask* Solution::AddAndCopyTask(IDetectorTask* pSrcTask, LP_DETECTOR_TAS void Solution::LoadUserParamValue() { - for (QMap::iterator iter = m_TaskMapByID.begin(); iter != m_TaskMapByID.end(); ++iter) + for (QMap::iterator iter = m_TaskMapByName.begin(); iter != m_TaskMapByName.end(); ++iter) { if (nullptr != *iter) { @@ -590,7 +489,7 @@ void Solution::LoadUserParamValue() void Solution::SaveUserParamValue() { - for (QMap::iterator iter = m_TaskMapByID.begin(); iter != m_TaskMapByID.end(); ++iter) + for (QMap::iterator iter = m_TaskMapByName.begin(); iter != m_TaskMapByName.end(); ++iter) { if (nullptr != *iter) { @@ -602,7 +501,7 @@ void Solution::SaveUserParamValue() void Solution::ClearUserParamValue() { - for (QMap::iterator iter = m_TaskMapByID.begin(); iter != m_TaskMapByID.end(); ++iter) + for (QMap::iterator iter = m_TaskMapByName.begin(); iter != m_TaskMapByName.end(); ++iter) { if (nullptr != *iter) { @@ -617,9 +516,9 @@ QStringList Solution::GetAllTaskNames() return m_TaskMapByName.keys(); } -QMap Solution::GetRunningTask() +QMap Solution::GetAllTasks() { - return m_CurRunTaskMap; + return m_TaskMapByName; } diff --git a/src/lpbengine/Solution.h b/src/lpbengine/Solution.h index 2442449..2e841d6 100644 --- a/src/lpbengine/Solution.h +++ b/src/lpbengine/Solution.h @@ -8,59 +8,55 @@ class Solution : public IDetectorSolution public: Solution(); virtual ~Solution(); + virtual IDetectorTask* AddTask(const PLP_DETECTOR_TASK pTask); + virtual bool DeleteTask(QString strName); + virtual IDetectorTask* GetTaskByName(QString strName); + virtual QStringList GetAllTaskNames(); + virtual QMap GetAllTasks(); + virtual bool SetSolutionInfo(const PLP_DETECTOR_SOLUTION pSolution); virtual PLP_DETECTOR_SOLUTION GetSolutionInfo(); - virtual IDetectorTask* AddTask(const PLP_DETECTOR_TASK pTask, bool bRet = true); - bool AddTaskByCopy(IDetectorTask* pSrc); - virtual bool SetRunTask(int nCameraID, QString strTaskName); - IDetectorTask* AddTask(const PLP_DETECTOR_TASK pTask, QString strPath); - virtual bool DeleteTask(int nTaskID); - bool DeleteTask(QString strName); - virtual IDetectorTask* GetTask(int nTaskID); - IDetectorTask* GetTask(QString strName); - virtual void Release(); + virtual QString GetSolutionName(); + virtual int GetID() const; - void SetID(int nID); - virtual int GetTaskBaseID() const; - - virtual bool GetRunState(); + virtual void Release(); + virtual IDetectorSolution* Copy(); + + virtual bool GetRunState(); virtual void SetRunState(bool bRun); virtual bool GetModifyFlag(); virtual void SetModifyFlag(bool bModify); - - virtual IDetectorTask* GetTaskByCameraID(int nCameraID); - bool Initialize(IAlgorithmLibMgr* pAlgoLibMgr); - void CleanUp(); - virtual IDetectorSolution* Copy(); virtual bool Copy(IDetectorSolution* pSrcSolution, bool bRet = true); virtual IDetectorTask* AddAndCopyTask(IDetectorTask* pSrcTask, LP_DETECTOR_TASK tTaskInfo); + virtual int GetTaskBaseID() const; + + virtual bool SaveFileEx(const QString& strPath); + virtual bool SaveFileEx(const QString& strPath, QStringList sTaskNames); + virtual bool LoadFileEx(const QString& strPath); virtual void SaveUserParamValue(); virtual void LoadUserParamValue(); virtual void ClearUserParamValue(); - virtual QStringList GetAllTaskNames(); - virtual QMap GetRunningTask(); +public: + bool Initialize(IAlgorithmLibMgr* pAlgoLibMgr); + void CleanUp(); + + void SetID(int nID); + bool AddTaskByCopy(IDetectorTask* pSrc); + virtual bool SetRunTask(QString strName); + IDetectorTask* AddTask(const PLP_DETECTOR_TASK pTask, QString strPath); bool CheckTask(int nTaskID, QString strTaskName); - - virtual bool SaveFileEx(const QString& strPath); - virtual bool SaveFileEx(const QString& strPath, QStringList sTaskNames); - virtual bool LoadFileEx(const QString& strPath); - //virtual bool SaveFile(const QString& strPath); -// virtual bool LoadFile(const QString& strPath); bool SerializeToJson(QJsonObject& jsonObject); - bool SerializeFromJson(QJsonObject* pJsonObject); + bool SerializeFromJson(QJsonObject* jsonObject); private: - int m_nID; - int m_nBaseID; - bool m_bIsRun; - bool m_bIsModify; + int m_nID{ 0 }; + int m_nBaseID{ 0 }; + bool m_bIsRun{ 0 }; + bool m_bIsModify{ 0 }; LP_DETECTOR_SOLUTION m_tSolutionInfo; QMap m_TaskMapByName; - QMap m_TaskMapByID; - QMap m_CurRunTaskMap;//CamID(int),TaskPtr(IDetectorTask*) IAlgorithmLibMgr* m_pAlgoLibMgr; QMutex m_mutex; - QStringList m_tasklist;//task名列表 }; diff --git a/src/lpbengine/SolutionMgr.cpp b/src/lpbengine/SolutionMgr.cpp index be2e2f0..2072c5c 100644 --- a/src/lpbengine/SolutionMgr.cpp +++ b/src/lpbengine/SolutionMgr.cpp @@ -19,7 +19,7 @@ bool CDetectorSolutionMgr::Initialize(IAlgorithmLibMgr* pAlgoLibMgr) return true; } -IDetectorSolution* CDetectorSolutionMgr::AddSolution(const PLP_DETECTOR_SOLUTION pSolution, bool bRet/* = true */) +IDetectorSolution* CDetectorSolutionMgr::AddSolution(const PLP_DETECTOR_SOLUTION pSolution) { if (NULL == pSolution) return NULL; @@ -29,7 +29,7 @@ IDetectorSolution* CDetectorSolutionMgr::AddSolution(const PLP_DETECTOR_SOLUTION if (p->Initialize(m_pAlgoLibMgr) && p->SetSolutionInfo(pSolution)) { p->SetID(++m_nBaseID); - m_vecSolution.insert(m_nBaseID, p); + m_vecSolution.insert(pSolution->strName, p); return p; } @@ -37,12 +37,12 @@ IDetectorSolution* CDetectorSolutionMgr::AddSolution(const PLP_DETECTOR_SOLUTION return NULL; } -bool CDetectorSolutionMgr::DeleteSolutionByID(int nSolutionID) +bool CDetectorSolutionMgr::DeleteSolutionByID(QString strName) { - if (m_nRunSolutionID == nSolutionID) - m_nRunSolutionID = LP_DETECTOR_INVALID_ID; + if (m_nRunSolutionID == strName) + m_nRunSolutionID.clear(); - QMap::iterator it = m_vecSolution.find(nSolutionID); + QMap::iterator it = m_vecSolution.find(strName); if (it != m_vecSolution.end()) { m_vecSolution.erase(it); @@ -51,11 +51,12 @@ bool CDetectorSolutionMgr::DeleteSolutionByID(int nSolutionID) return false; } -IDetectorSolution* CDetectorSolutionMgr::GetSolutionByID(int nSolutionID) + +IDetectorSolution* CDetectorSolutionMgr::GetSolutionByID(QString strName) { - if (nSolutionID == 0) - return m_vecSolution.first(); - QMap::iterator it = m_vecSolution.find(nSolutionID); + if (strName.isEmpty()) + return nullptr; + QMap::iterator it = m_vecSolution.find(strName); if (it != m_vecSolution.end()) { (*it)->SetRunState(true); @@ -69,30 +70,14 @@ int CDetectorSolutionMgr::GetSolutionCount() return m_vecSolution.size(); } -QMap CDetectorSolutionMgr::GetAllSolutions() +QMap CDetectorSolutionMgr::GetAllSolutions() { return m_vecSolution; } -bool CDetectorSolutionMgr::CheckSolution(int nSolutionID, QString strSolutionName) -{ - for (QMap::iterator iter = m_vecSolution.begin(); - iter != m_vecSolution.end(); ++iter) - { - if (NULL != *iter) - { - IDetectorSolution *p = *iter; - if (p->GetID() == nSolutionID && p->GetSolutionInfo()->strName == strSolutionName) - return true; - } - } - - return false; -} - void CDetectorSolutionMgr::CleanUp() { - for (QMap::iterator iter = m_vecSolution.begin(); + for (QMap::iterator iter = m_vecSolution.begin(); iter != m_vecSolution.end(); ++iter) { if (*iter) @@ -109,7 +94,7 @@ bool CDetectorSolutionMgr::Save() QJsonDocument document; QString strExePath = QCoreApplication::applicationDirPath(); /*耗时过长*/ - for (QMap::iterator iter = m_vecSolution.begin(); + for (QMap::iterator iter = m_vecSolution.begin(); iter != m_vecSolution.end(); ++iter) { if (*iter) @@ -152,11 +137,11 @@ bool CDetectorSolutionMgr::Save() int nID = strFileName.mid(0, strFileName.indexOf("_")).toInt(); QString strSolutionName = strFileName.mid(strFileName.indexOf("_") + 1, strFileName.indexOf(".") - strFileName.indexOf("_") - 1); - if (!CheckSolution(nID, strSolutionName)) - { - qWarning() << "SaveAll, remove solution file" << strSolutionName; - EngineBase::DeleteDir(strSolutionFile); - } +// if (!CheckSolution(nID, strSolutionName)) +// { +// qWarning() << "SaveAll, remove solution file" << strSolutionName; +// EngineBase::DeleteDir(strSolutionFile); +// } } return true; @@ -167,7 +152,7 @@ bool CDetectorSolutionMgr::SaveByNames(QStringList strNames) QJsonDocument document; QString strExePath = QCoreApplication::applicationDirPath(); /*耗时过长*/ - for (QMap::iterator iter = m_vecSolution.begin(); + for (QMap::iterator iter = m_vecSolution.begin(); iter != m_vecSolution.end(); ++iter) { if (*iter) @@ -210,11 +195,11 @@ bool CDetectorSolutionMgr::SaveByNames(QStringList strNames) int nID = strFileName.mid(0, strFileName.indexOf("_")).toInt(); QString strSolutionName = strFileName.mid(strFileName.indexOf("_") + 1, strFileName.indexOf(".") - strFileName.indexOf("_") - 1); - if (!CheckSolution(nID, strSolutionName)) - { - qWarning() << "SaveAll, remove solution file" << strSolutionName; - EngineBase::DeleteDir(strSolutionFile); - } +// if (!CheckSolution(nID, strSolutionName)) +// { +// qWarning() << "SaveAll, remove solution file" << strSolutionName; +// EngineBase::DeleteDir(strSolutionFile); +// } } return true; } @@ -229,7 +214,7 @@ bool CDetectorSolutionMgr::Load() solutionDir.mkdir(strSolutionDirPath); } - m_nRunSolutionID = 0; + m_nRunSolutionID.clear(); solutionDir.setFilter(QDir::Dirs | QDir::Hidden | QDir::NoSymLinks); solutionDir.setSorting(QDir::Size | QDir::Reversed); @@ -250,12 +235,13 @@ bool CDetectorSolutionMgr::Load() LP_DETECTOR_SOLUTION solutionInfo; + solutionInfo.strName = dirList.at(i).fileName(); Solution* pSolution = (Solution*)AddSolution(&solutionInfo); if (!pSolution->LoadFileEx(strSolutionFile)) {//有bug qErrnoWarning("load solution: %s fail", strSolutionFile.toLocal8Bit().data()); - DeleteSolutionByID(pSolution->GetID());// + DeleteSolutionByID(solutionInfo.strName);// pSolution = NULL; } if (pSolution) @@ -281,10 +267,10 @@ bool CDetectorSolutionMgr::ReLoad() return Load(); } -bool CDetectorSolutionMgr::SetRunSolution(int nSolutionID) +bool CDetectorSolutionMgr::SetRunSolution(QString strName) { - m_nRunSolutionID = nSolutionID; - IDetectorSolution* pRunSolution = GetSolutionByID(nSolutionID); + m_nRunSolutionID = strName; + IDetectorSolution* pRunSolution = GetSolutionByID(strName); return true; } diff --git a/src/lpbengine/SolutionMgr.h b/src/lpbengine/SolutionMgr.h index fd229c7..7b9716f 100644 --- a/src/lpbengine/SolutionMgr.h +++ b/src/lpbengine/SolutionMgr.h @@ -8,30 +8,29 @@ class CDetectorSolutionMgr : public IDetectorSolutionMgr public: CDetectorSolutionMgr(); virtual ~CDetectorSolutionMgr(); - IDetectorSolution* AddSolution(const PLP_DETECTOR_SOLUTION pSolution, bool bRet = true); - bool DeleteSolutionByID(int nSolutionID); - IDetectorSolution* GetSolutionByID(int nSolutionID); + IDetectorSolution* AddSolution(const PLP_DETECTOR_SOLUTION pSolution); + bool DeleteSolutionByID(QString strName); + IDetectorSolution* GetSolutionByID(QString strName); int GetSolutionCount(); - QMap GetAllSolutions(); + QMap GetAllSolutions(); void CleanUp(); bool Initialize(IAlgorithmLibMgr* pAlgoLibMgr); - virtual bool SetRunSolution(int nSolutionID); + virtual bool SetRunSolution(QString strName); virtual IDetectorSolution* GetRunSolution(); virtual IDetectorSolution* AddAndCopySolution(IDetectorSolution* pSrcSolution); - virtual bool CheckSolution(int nSolutionID, QString strSolutionName); virtual bool Save(); virtual bool SaveByNames(QStringList strNames); virtual bool Load(); virtual bool LoadByNames(QStringList strNames); virtual bool ReLoad(); private: - QMap m_vecSolution; + QMap m_vecSolution; int m_nBaseID; - int m_nRunSolutionID; + QString m_nRunSolutionID; IAlgorithmLibMgr* m_pAlgoLibMgr{ NULL }; }; diff --git a/src/lpbengine/Task.cpp b/src/lpbengine/Task.cpp index 283f0d4..6784973 100644 --- a/src/lpbengine/Task.cpp +++ b/src/lpbengine/Task.cpp @@ -420,7 +420,7 @@ bool CDetectorTask::SaveFile(const QString& strPath) return false; } - QString strFileName = strFilePath + /*QString::number(m_pSolution->GetID()) + "_" + QString::number(m_nID)*/ + "template.png"; + QString strFileName = strFilePath + "/" + /*QString::number(m_pSolution->GetID()) + "_" + QString::number(m_nID)*/ + "template.png"; std::string strpath = strFileName.toLocal8Bit().toStdString(); if (!cv::imwrite(strpath/*strFileName.toLatin1().data()*/, m_tTask.templateImg)) diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj b/tpvs17/lpdesigner/lpdesigner.vcxproj index b5dfa01..5e903c8 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj @@ -78,9 +78,6 @@ - - - $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing %(Identity)... @@ -94,9 +91,6 @@ - - - @@ -288,36 +282,6 @@ .\..\..\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)" - $(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)" - $(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)" - $(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)... diff --git a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters index 21daf80..a9a5280 100644 --- a/tpvs17/lpdesigner/lpdesigner.vcxproj.filters +++ b/tpvs17/lpdesigner/lpdesigner.vcxproj.filters @@ -43,12 +43,6 @@ - - Header Files - - - Header Files - Header Files @@ -58,9 +52,6 @@ Header Files - - Header Files - Header Files @@ -70,15 +61,6 @@ Generated Files - - Generated Files - - - Generated Files - - - Generated Files - Generated Files @@ -132,15 +114,6 @@ Form Files - - Form Files - - - Form Files - - - Form Files - Form Files