123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- #include "SchemePlanManager.h"
- #include "ProjectManager.h"
- #include <QMetaEnum>
- #include <QDebug>
- QString SchemePlanManager::stringFromDataSource(SchemePlanManager::SchemeDataSource src)
- {
- switch (src) {
- case NoData:
- return "无";
- case FromExpert:
- return "导入专家数据";
- case FromMeasurement:
- return "添加实测数据";
- }
- }
- QString SchemePlanManager::stringFromAlgorithm(SchemePlanManager::Algorithm alg)
- {
- switch (alg) {
- case NoAlg:
- return "无";
- case PrincipalComponents:
- return "主成分分析法";
- case Entropy:
- return "熵值法";
- case AHP:
- return "层次分析法";
- case HWM:
- return "层次加权法";
- case SPA:
- return "集对分析法";
- case MEA:
- return "物元分析法";
- case GCE:
- return "灰色聚类评估法";
- case WeightedSum:
- return "加权求和法";
- }
- }
- QString SchemePlanManager::processName(const SchemeProcessInfo &process)
- {
- QList<QString> l1 = { "构建权重分析指标体系", "收集权重分析数据", "指标体系优化", "指标权重计算", "", "",
- "分析结果展示", "生成分析评估报告" };
- QList<QString> l2 = {
- "构建技术措施指标体系", "", "", "", "收集评估数据", "评估计算", "评估结果展示", "生成评估报告"
- };
- QList<QString> l3 = { "构建方案优选指标体系", "收集方案优选权重分析数据",
- "指标体系优化", "指标权重计算",
- "评估数据采集", "方案优选计算",
- "方案优选结果展示", "生成方案优选报告" };
- QList<QString> l4 = { "构建效能评估指标体系", "收集效能评估权重分析数据", "指标体系优化",
- "效能评估权重计算", "收集效能评估数据", "效能评估计算",
- "效能评估结果展示", "生成效能评估报告" };
- QList<QList<QString>> names = { l1, l2, l3, l4 };
- /// 获取指标类型枚举值 index
- /// 由于枚举值不是连续自然数, 故不能作为下表来索引数组
- /// 故须使用 index 替代
- int index = 0;
- QMetaEnum indexEnum = QMetaEnum::fromType<ProjectManager::IndexType>();
- for (int i = 0; i < indexEnum.keyCount(); i++) {
- if (indexEnum.value(i) == process.indexType) {
- index = i;
- break;
- }
- }
- if (index >= 0 && index < names.count() && process.type >= 0 && process.type < names[index].count()) {
- return names[index][process.type];
- }
- return "";
- }
- QList<SchemePlanManager::SchemeDataSource>
- SchemePlanManager::processOptionalDataSource(const SchemeProcessInfo &process)
- {
- if (process.type == ImportEvalData && process.indexType == ProjectManager::EfficiencyIndex) {
- return { FromMeasurement };
- }
- if (process.type == ImportWeightData || process.type == ImportEvalData) {
- return { FromExpert, FromMeasurement };
- }
- return {};
- }
- /**
- * 根据指标体系类型和方案步骤类型, 返回可选算法
- * date: 2023-11-03 by chengxr
- */
- QList<SchemePlanManager::Algorithm> SchemePlanManager::processOptionalAlgorithms(const SchemeProcessInfo &process)
- {
- switch (process.type) {
- case OptimizeIndex:
- return { PrincipalComponents };
- case CalculateWeight: {
- return { AHP, Entropy, PrincipalComponents };
- }
- case RunEvaluate: {
- if (process.indexType == ProjectManager::TechIndex) {
- return { WeightedSum };
- } else if (process.indexType == ProjectManager::OptimalIndex) {
- return { HWM, SPA };
- } else if (process.indexType == ProjectManager::EfficiencyIndex) {
- return { MEA, GCE };
- }
- return {};
- }
- case IndexSystem:
- case ImportWeightData:
- case ImportEvalData:
- case ShowEvalResult:
- case GenerateReport:
- return {};
- }
- }
- bool SchemePlanManager::processIsOptional(const SchemeProcessInfo &process)
- {
- return (process.type == GenerateReport);
- }
- SchemePlanManager::SchemePlanManager(QObject *parent) : QObject(parent) { }
|