#include "view/MainWindow.h" #include "helper/GenerateMiniDump.h" #include #include #include #include #include #include #include #include "FileUtil.h" #include "ImportDataUtil.h" #include "dbService/ClassSet.h" #include "algorithm/GreyClusterEvaluation.h" #include #include void test() { MEAMat mat; MEARangeMat ranges; // 样本1 mat << QVector { 2, 35, 2, 90, 2.5, 35, 70, 2.5, 35, 30, 2.5, 70, 25, 2, 50, 1, 45, 8, 60, 1 }; // 样本2 mat << QVector { 4, 20, 3, 40, 0.5, 55, 90, 1.2, 55, 70, 1.2, 90, 60, 6, 20, 3, 75, 25, 25, 3 }; qDebug() << mat[0].size() << mat[1].size(); // 等级1 ranges << QVector { { 0, true, false, 0, 1 }, { 1, true, false, 50, 100 }, { 2, true, false, 0, 1 }, { 3, true, false, 60, 100 }, { 4, true, false, 3, 100 }, { 5, true, false, 0, 30 }, { 6, true, false, 0, 60 }, { 7, true, false, 0, 1 }, { 8, true, false, 0, 30 }, { 9, true, false, 0, 60 }, { 10, true, false, 2, 100 }, { 11, true, false, 0, 60 }, { 12, true, false, 0, 30 }, { 13, true, false, 0, 1 }, { 14, true, false, 60, 100 }, { 15, true, false, 0, 1 }, { 16, true, false, 0, 30 }, { 17, true, false, 0, 5 }, { 18, true, false, 50, 100 }, { 19, true, false, 0, 1 }, }; // 等级1 ranges << QVector { { 0, true, false, 2, 3 }, { 1, true, false, 5, 100 }, { 2, true, false, 1, 2 }, { 3, true, false, 45, 60 }, { 4, true, false, 2, 3 }, { 5, true, false, 30, 50 }, { 6, true, false, 60, 80 }, { 7, true, false, 1, 1.5 }, { 8, true, false, 30, 50 }, { 9, true, false, 60, 80 }, { 10, true, false, 1.5, 2 }, { 11, true, false, 60, 80 }, { 12, true, false, 30, 50 }, { 13, true, false, 1, 3 }, { 14, true, false, 45, 60 }, { 15, true, false, 1, 2 }, { 16, true, false, 30, 50 }, { 17, true, false, 5, 10 }, { 18, true, false, 30, 50 }, { 19, true, false, 1, 2 }, }; ranges << QVector { { 1, true, false, 3, 4 }, { 1, true, false, 20, 30 }, { 2, true, false, 2, 3 }, { 3, true, false, 30, 45 }, { 4, true, false, 1, 2 }, { 5, true, false, 50, 80 }, { 6, true, false, 80, 95 }, { 7, true, false, 1.5, 2 }, { 8, true, false, 50, 80 }, { 9, true, false, 80, 95 }, { 10, true, false, 1, 1.5 }, { 11, true, false, 80, 95 }, { 12, true, false, 50, 80 }, { 13, true, false, 3, 5 }, { 14, true, false, 30, 45 }, { 15, true, false, 2, 3 }, { 16, true, false, 50, 80 }, { 17, true, false, 10, 20 }, { 18, true, false, 20, 30 }, { 19, true, false, 2, 3 }, }; // 2 ranges << QVector { { 0, true, false, 5, 100 }, { 1, true, false, 0, 20 }, { 2, true, false, 3, 100 }, { 3, true, false, 0, 30 }, { 4, true, false, 0, 1 }, { 5, true, false, 80, 100 }, { 6, true, false, 95, 100 }, { 7, true, false, 2, 100 }, { 8, true, false, 80, 100 }, { 9, true, false, 95, 100 }, { 10, true, false, 0, 1 }, { 11, true, false, 95, 100 }, { 12, true, false, 80, 100 }, { 13, true, false, 5, 100 }, { 14, true, false, 0, 30 }, { 15, true, false, 3, 100 }, { 16, true, false, 80, 100 }, { 17, true, false, 20, 100 }, { 18, true, false, 0, 20 }, { 19, true, false, 3, 100 } }; // 等级范围p ranges << QVector { { 0, true, false, 0, 140 }, { 1, true, false, 120, 0 }, { 2, true, false, 0, 140 }, { 3, true, false, 140, 0 }, { 4, true, false, 140, 0 }, { 5, true, false, 0, 100 }, { 6, true, false, 0, 100 }, { 7, true, false, 0, 140 }, { 8, true, false, 0, 100 }, { 9, true, false, 0, 100 }, { 10, true, false, 0, 100 }, { 11, true, false, 0, 100 }, { 12, true, false, 0, 100 }, { 13, true, false, 0, 140 }, { 14, true, false, 140, 0 }, { 15, true, false, 0, 140 }, { 16, true, false, 0, 100 }, { 17, true, false, 0, 140 }, { 18, true, false, 140, 0 }, { 19, true, false, 0, 140 }, }; // 等级 MatterElementAnalysis me(mat, ranges); me.evaluate({ 0.05558152, 0.01462673, 0.12860136, 0.0567758, 0.02524748, 0.05098171, 0.31008254, 0.12573223, 0.01327194, 0.01461917, 0.01931854, 0.05014989, 0.06026197, 0.01258931, 0.0281506, 0.00588096, 0.01585843, 0.00331298, 0.00740806, 0.00154762 }); QVector index = me.getBestIndex(); qDebug() << index; } void cTest() { } int main(int argc, char *argv[]) { DUMP_FILE_HOOK_HANLE; QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); std::locale::global(std::locale("")); #ifndef QT_NO_OPENGL QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); #endif QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache, true); // Set application attributes #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); #endif QCoreApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true); QApplication a(argc, argv); a.setApplicationVersion("2.0"); a.setApplicationName("QFD2"); a.setApplicationDisplayName("伪装防护评估系统软件"); Q_INIT_RESOURCE(qfluentwidgets); QTranslator *translator = new QTranslator(); translator->load(QLocale::system(), ":/resource/i18n/qfluentwidgets_zh.qm"); QCoreApplication::installTranslator(translator); MainWindow *w = new MainWindow; // test(); // 居中显示窗体 w->move((QApplication::primaryScreen()->availableGeometry().width() - w->width()) / 2, (QApplication::primaryScreen()->availableGeometry().height() - w->height()) / 2); QSettings config("config.ini", QSettings::IniFormat); config.setIniCodec("UTF-8"); int roleType = config.value("USERCONFIG/RoleType", "").toInt(); if (roleType == 0) { w->show(); } else { qDebug() << "---------------------"; // TODO 导入文件入库操作 bool result = FileUtil().importEngineerFile(); if (result) { ImportDataUtil().importSystemData(); w->show(); } else { delete w; qDebug() << "----"; qApp->exit(); } } // w.show(); QFont font; font.setPointSize(14); a.setFont(font); setbuf(stdout, NULL); DWORD processId = GetCurrentProcessId(); qDebug() << __FUNCTION__ << __LINE__ << processId << endl; printf("Process ID: %u\n", processId); int ret = a.exec(); delete w; return ret; }