123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #include "EvalDataManager.h"
- #include "ProjectManager.h"
- EvalDataManager::EvalDataManager(QObject *parent) : QObject(parent) { }
- QList<NodeMatrixInfo> EvalDataManager::dataSample(SchemePlanManager::SchemeProcessInfo process, CMind *mind1,
- CMind *mind2)
- {
- QList<NodeMatrixInfo> list;
- if (mind1->levels() < 2) {
- return list;
- }
- unsigned seed = 1;
- srand(seed);
- for (int lev = 1; lev < mind1->levels(); lev++) {
- QList<CNodeData> nodes = mind1->nodesInLevel(lev);
- for (int i = 0; i < nodes.count(); i++) {
- CNodeData node = nodes[i]; // 父节点
- QList<CNodeData> subNodes = mind1->subNodes(node);
- for (int i = 0; i < subNodes.count(); i++) {
- CNodeData subNode = subNodes[i]; // 子节点
- }
- }
- }
- return list;
- // 权重数据
- if (process.type == SchemePlanManager::ImportWeightData) {
- // 来自专家数据, 子指标间的权重比
- if (process.dSource == SchemePlanManager::FromExpert) {
- for (int lev = 1; lev < mind1->levels(); lev++) {
- QList<CNodeData> nodes = mind1->nodesInLevel(lev);
- for (CNodeData node : nodes) {
- QList<CNodeData> subNodes = mind1->subNodes(node);
- for (int i = 0; i < subNodes.count(); i++) {
- CNodeData vNode = subNodes[i];
- for (int j = i; j < subNodes.count(); j++) {
- CNodeData hNode = subNodes[j];
- NodeMatrixInfo data;
- data.engineerId = node.projectId;
- data.mark = QString("%1").arg(lev);
- data.abscissa = QString("%1").arg(hNode.id);
- data.ordinate = QString("%1").arg(vNode.id);
- if (i == j) {
- data.nodeValue = "1";
- list.append(data);
- continue;
- }
- int r = rand() % 8 + 2;
- data.nodeValue = QString("%1").arg(r);
- list.append(data);
- NodeMatrixInfo data1;
- data1.engineerId = node.projectId;
- data1.mark = QString("%1").arg(lev);
- data1.abscissa = QString("%1").arg(vNode.id);
- data1.ordinate = QString("%1").arg(hNode.id);
- data1.nodeValue = QString("1/%1").arg(r);
- list.append(data1);
- }
- }
- }
- }
- } else if (process.dSource == SchemePlanManager::FromMeasurement) {
- for (int i = 0; i < mind1->nodeList().count(); i++) {
- CNodeData node = mind1->nodeList()[i];
- NodeMatrixInfo data;
- data.engineerId = node.projectId;
- data.abscissa = QString("%1").arg(node.id);
- int r = rand() % 8 + 2;
- data.nodeValue = QString("%1").arg(r);
- list.append(data);
- }
- }
- } else if (process.type == SchemePlanManager::ImportEvalData) {
- if (process.indexType == ProjectManager::TechIndex) {
- for (int i = 0; i < mind1->nodeList().count(); i++) {
- CNodeData hNode = mind1->nodeList()[i];
- for (int j = 0; j < mind2->nodeList().count(); j++) {
- CNodeData vNode = mind2->nodeList()[j];
- NodeMatrixInfo data;
- data.engineerId = hNode.projectId;
- data.abscissa = QString("%1").arg(hNode.id);
- data.ordinate = QString("%1").arg(vNode.id);
- int r = rand() % 8 + 2;
- data.nodeValue = QString("%1").arg(r);
- list.append(data);
- }
- }
- }
- }
- return list;
- }
|