#ifndef _H_MODELMANAGER_H_ #define _H_MODELMANAGER_H_ #include "qstring.h" #include "qmap.h" #include #include "cv.h" #include "qstringlist.h" #include "IWheelModel.h" #include #include class IWheelModel; struct CmpByValue { bool operator()(const std::pair & lhs, const std::pair & rhs) { return lhs.second < rhs.second; } }; struct modelInfo { double md_diameter; double md_height; std::vector mpAllImage; }; class ModelManager { public: explicit ModelManager(QString strRoot); virtual ~ModelManager(); bool init(); IWheelModel *getModel(QString str); QString getModelPicPath(QString str); bool addModel(QString); bool addModel(IWheelModel *); bool reName(QString strOld, QString strNew); QJsonObject readJson(QString strFile); void writeJson(QString strFile, QJsonObject rootObj); IWheelModel *createModel(); bool delModel(QString); bool modModel(QString); bool saveModel(QString); bool saveAllModel(); bool ClearAllCount(); QStringList getNoDetectModelName();//获取所有未检测模板名 QStringList getDetectModelName();//获取所有检测模板名 QStringList getAllModelName();//获取所有模板名 QStringList getAllTrainModelName(); //获取所有加入训练的模板名 bool setAllModelsState(bool state); bool setRestDetect(); QMap getDetectModelMap(); QMap *getAllModelMapPtr(); QMap> getAllModelImage(); QMap getAllImgsExcSelf(QString strName = QString()); std::vector getFirstImgFromFalse(QString strName = QString()); std::vector getAllModelImageExcSelf(QString strName = QString()); std::vector getAllTarImgs(std::vector strName); class TempImage *getTmpImage(QString str); class TempImage *getTrainImage(QString str); private: QVariantMap genDbMap(IWheelModel* val); private: QMap m_mpModels; class ModelMgrDB* m_pModelDB; QString m_strRoot; }; #endif