#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 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, 0, 1 }, { 1, 50, 100 }, { 2, 0, 1 }, { 3, 60, 100 }, { 4, 3, 100 }, { 5, 0, 30 }, { 6, 0, 60 }, { 7, 0, 1 }, { 8, 0, 30 }, { 9, 0, 60 }, { 10, 2, 100 }, { 11, 0, 60 }, { 12, 0, 30 }, { 13, 0, 1 }, { 14, 60, 100 }, { 15, 0, 1 }, { 16, 0, 30 }, { 17, 0, 5 }, { 18, 50, 100 }, { 19, 0, 1 }, }; // 等级1 ranges << QVector { { 0, 2, 3 }, { 1, 5, 100 }, { 2, 1, 2 }, { 3, 45, 60 }, { 4, 2, 3 }, { 5, 30, 50 }, { 6, 60, 80 }, { 7, 1, 1.5 }, { 8, 30, 50 }, { 9, 60, 80 }, { 10, 1.5, 2 }, { 11, 60, 80 }, { 12, 30, 50 }, { 13, 1, 3 }, { 14, 45, 60 }, { 15, 1, 2 }, { 16, 30, 50 }, { 17, 5, 10 }, { 18, 30, 50 }, { 19, 1, 2 }, }; ranges << QVector { { 1, 3, 4 }, { 1, 20, 30 }, { 2, 2, 3 }, { 3, 30, 45 }, { 4, 1, 2 }, { 5, 50, 80 }, { 6, 80, 95 }, { 7, 1.5, 2 }, { 8, 50, 80 }, { 9, 80, 95 }, { 10, 1, 1.5 }, { 11, 80, 95 }, { 12, 50, 80 }, { 13, 3, 5 }, { 14, 30, 45 }, { 15, 2, 3 }, { 16, 50, 80 }, { 17, 10, 20 }, { 18, 20, 30 }, { 19, 2, 3 }, }; // 2 ranges << QVector { { 0, 5, 100 }, { 1, 0, 20 }, { 2, 3, 100 }, { 3, 0, 30 }, { 4, 0, 1 }, { 5, 80, 100 }, { 6, 95, 100 }, { 7, 2, 100 }, { 8, 80, 100 }, { 9, 95, 100 }, { 10, 0, 1 }, { 11, 95, 100 }, { 12, 80, 100 }, { 13, 5, 100 }, { 14, 0, 30 }, { 15, 3, 100 }, { 16, 80, 100 }, { 17, 20, 100 }, { 18, 0, 20 }, { 19, 3, 100 } }; // 等级范围p ranges << QVector { { 0, 0, 140 }, { 1, 120, 0 }, { 2, 0, 140 }, { 3, 140, 0 }, { 4, 140, 0 }, { 5, 0, 100 }, { 6, 0, 100 }, { 7, 0, 140 }, { 8, 0, 100 }, { 9, 0, 100 }, { 10, 0, 100 }, { 11, 0, 100 }, { 12, 0, 100 }, { 13, 0, 140 }, { 14, 140, 0 }, { 15, 0, 140 }, { 16, 0, 100 }, { 17, 0, 140 }, { 18, 140, 0 }, { 19, 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); // cTest(); int ret = a.exec(); delete w; return ret; }