#include "SchemePlanManager.h" #include "ProjectManager.h" #include #include 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 l1 = { "构建权重分析指标体系", "收集权重分析数据", "指标体系优化", "指标权重计算", "", "", "分析结果展示", "生成分析评估报告" }; QList l2 = { "构建技术措施指标体系", "", "", "", "收集评估数据", "评估计算", "评估结果展示", "生成评估报告" }; QList l3 = { "构建方案优选指标体系", "收集方案优选权重分析数据", "指标体系优化", "指标权重计算", "评估数据采集", "方案优选计算", "方案优选结果展示", "生成方案优选报告" }; QList l4 = { "构建效能评估指标体系", "收集效能评估权重分析数据", "指标体系优化", "效能评估权重计算", "收集效能评估数据", "效能评估计算", "效能评估结果展示", "生成效能评估报告" }; QList> names = { l1, l2, l3, l4 }; /// 获取指标类型枚举值 index /// 由于枚举值不是连续自然数, 故不能作为下表来索引数组 /// 故须使用 index 替代 int index = 0; QMetaEnum indexEnum = QMetaEnum::fromType(); 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::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::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) { }