FlowTemplateDataModel.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. #ifndef FLOWTEMPLARTEDATAMODEL_H
  2. #define FLOWTEMPLARTEDATAMODEL_H
  3. #include <QtNodes/NodeDelegateModel>
  4. #include <QObject>
  5. #include <QLabel>
  6. #include <QComboBox>
  7. #include <Widgets/ComboBox.h>
  8. #include <Widgets/Menu.h>
  9. using QtNodes::NodeData;
  10. using QtNodes::NodeDataType;
  11. using QtNodes::NodeDelegateModel;
  12. using QtNodes::PortIndex;
  13. using QtNodes::PortType;
  14. class FlowTemplateData : public NodeData
  15. {
  16. public:
  17. NodeDataType type() const override { return NodeDataType { "FlowTemplateData", "" }; }
  18. };
  19. class FlowTemplateDataModel : public NodeDelegateModel
  20. {
  21. Q_OBJECT
  22. public:
  23. FlowTemplateDataModel();
  24. ~FlowTemplateDataModel() = default;
  25. QString caption() const override { return QString("流程样板模型"); }
  26. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  27. QString portCaption(PortType pt, PortIndex) const override
  28. {
  29. if (pt == PortType::In) {
  30. return "输入";
  31. } else if (pt == PortType::Out) {
  32. return "输出";
  33. }
  34. return "";
  35. }
  36. QString name() const override { return QString("FlowTemplateData"); }
  37. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  38. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  39. {
  40. return FlowTemplateData().type();
  41. }
  42. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowTemplateData>(); }
  43. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  44. QWidget *embeddedWidget() override;
  45. };
  46. class FlowIndexData : public NodeData
  47. {
  48. public:
  49. NodeDataType type() const override { return NodeDataType { "FlowIndexData", "" }; }
  50. };
  51. class FlowIndexDataModel : public NodeDelegateModel
  52. {
  53. Q_OBJECT
  54. public:
  55. FlowIndexDataModel();
  56. ~FlowIndexDataModel() = default;
  57. QString caption() const override { return QString("构建指标体系"); }
  58. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  59. QString portCaption(PortType pt, PortIndex) const override
  60. {
  61. if (pt == PortType::In) {
  62. return "输入";
  63. } else if (pt == PortType::Out) {
  64. return "输出";
  65. }
  66. return "";
  67. }
  68. QString name() const override { return QString("FlowIndexData"); }
  69. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  70. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  71. {
  72. return FlowIndexData().type();
  73. }
  74. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowIndexData>(); }
  75. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  76. QWidget *embeddedWidget() override;
  77. };
  78. class FlowSampleData : public NodeData
  79. {
  80. public:
  81. NodeDataType type() const override { return NodeDataType { "FlowSampleData", "" }; }
  82. };
  83. class FlowSampleDataModel : public NodeDelegateModel
  84. {
  85. Q_OBJECT
  86. public:
  87. FlowSampleDataModel() : NodeDelegateModel() { }
  88. ~FlowSampleDataModel() = default;
  89. QString caption() const override { return QString("收集数据"); }
  90. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  91. QString portCaption(PortType pt, PortIndex) const override
  92. {
  93. if (pt == PortType::In) {
  94. return "输入";
  95. } else if (pt == PortType::Out) {
  96. return "输出";
  97. }
  98. return "";
  99. }
  100. QString name() const override { return QString("FlowSampleData"); }
  101. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  102. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  103. {
  104. return FlowSampleData().type();
  105. }
  106. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowSampleData>(); }
  107. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  108. QWidget *embeddedWidget() override;
  109. };
  110. class FlowPCAData : public NodeData
  111. {
  112. public:
  113. NodeDataType type() const override { return NodeDataType { "FlowPCAData", "" }; }
  114. };
  115. class FlowPCADataModel : public NodeDelegateModel
  116. {
  117. Q_OBJECT
  118. public:
  119. FlowPCADataModel() : NodeDelegateModel() { }
  120. ~FlowPCADataModel() = default;
  121. QString caption() const override { return QString("主成分分析法"); }
  122. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  123. QString portCaption(PortType pt, PortIndex) const override
  124. {
  125. if (pt == PortType::In) {
  126. return "输入";
  127. } else if (pt == PortType::Out) {
  128. return "输出";
  129. }
  130. return "";
  131. }
  132. QString name() const override { return QString("FlowPCAData"); }
  133. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  134. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  135. {
  136. return FlowPCAData().type();
  137. }
  138. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowPCAData>(); }
  139. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  140. QWidget *embeddedWidget() override;
  141. };
  142. class FlowWeightData : public NodeData
  143. {
  144. public:
  145. NodeDataType type() const override { return NodeDataType { "FlowWeightData", "" }; }
  146. };
  147. class FlowWeightDataModel : public NodeDelegateModel
  148. {
  149. Q_OBJECT
  150. public:
  151. FlowWeightDataModel() : NodeDelegateModel() { }
  152. ~FlowWeightDataModel() = default;
  153. QString caption() const override { return QString("权重计算"); }
  154. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  155. QString portCaption(PortType pt, PortIndex) const override
  156. {
  157. if (pt == PortType::In) {
  158. return "输入";
  159. } else if (pt == PortType::Out) {
  160. return "输出";
  161. }
  162. return "";
  163. }
  164. QString name() const override { return QString("FlowWeightData"); }
  165. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  166. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  167. {
  168. return FlowWeightData().type();
  169. }
  170. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowWeightData>(); }
  171. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  172. QWidget *embeddedWidget() override;
  173. };
  174. class FlowSchemeData : public NodeData
  175. {
  176. public:
  177. NodeDataType type() const override { return NodeDataType { "FlowSchemeData", "" }; }
  178. };
  179. class FlowSchemeDataModel : public NodeDelegateModel
  180. {
  181. Q_OBJECT
  182. public:
  183. FlowSchemeDataModel() : NodeDelegateModel() { }
  184. ~FlowSchemeDataModel() = default;
  185. QString caption() const override { return QString("算法"); }
  186. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  187. QString portCaption(PortType pt, PortIndex) const override
  188. {
  189. if (pt == PortType::In) {
  190. return "输入";
  191. } else if (pt == PortType::Out) {
  192. return "输出";
  193. }
  194. return "";
  195. }
  196. QString name() const override { return QString("FlowSchemeData"); }
  197. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  198. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  199. {
  200. return FlowSchemeData().type();
  201. }
  202. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowSchemeData>(); }
  203. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  204. QWidget *embeddedWidget() override;
  205. };
  206. class FlowEffiData : public NodeData
  207. {
  208. public:
  209. NodeDataType type() const override { return NodeDataType { "FlowEffiData", "" }; }
  210. };
  211. class FlowEffiDataModel : public NodeDelegateModel
  212. {
  213. Q_OBJECT
  214. public:
  215. FlowEffiDataModel() : NodeDelegateModel() { }
  216. ~FlowEffiDataModel() = default;
  217. QString caption() const override { return QString("算法"); }
  218. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  219. QString portCaption(PortType pt, PortIndex) const override
  220. {
  221. if (pt == PortType::In) {
  222. return "输入";
  223. } else if (pt == PortType::Out) {
  224. return "输出";
  225. }
  226. return "";
  227. }
  228. QString name() const override { return QString("FlowEffiData"); }
  229. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  230. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  231. {
  232. return FlowEffiData().type();
  233. }
  234. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowEffiData>(); }
  235. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  236. QWidget *embeddedWidget() override;
  237. };
  238. class FlowResultData : public NodeData
  239. {
  240. public:
  241. NodeDataType type() const override { return NodeDataType { "FlowResultData", "" }; }
  242. };
  243. class FlowResultDataModel : public NodeDelegateModel
  244. {
  245. Q_OBJECT
  246. public:
  247. FlowResultDataModel() : NodeDelegateModel() { }
  248. ~FlowResultDataModel() = default;
  249. QString caption() const override { return QString("结果展示"); }
  250. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  251. QString portCaption(PortType pt, PortIndex) const override
  252. {
  253. if (pt == PortType::In) {
  254. return "输入";
  255. } else if (pt == PortType::Out) {
  256. return "输出";
  257. }
  258. return "";
  259. }
  260. QString name() const override { return QString("FlowResultData"); }
  261. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  262. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  263. {
  264. return FlowResultData().type();
  265. }
  266. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowResultData>(); }
  267. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  268. QWidget *embeddedWidget() override;
  269. };
  270. class FlowReportData : public NodeData
  271. {
  272. public:
  273. NodeDataType type() const override { return NodeDataType { "FlowReportData", "" }; }
  274. };
  275. class FlowReportDataModel : public NodeDelegateModel
  276. {
  277. Q_OBJECT
  278. public:
  279. FlowReportDataModel() : NodeDelegateModel() { }
  280. ~FlowReportDataModel() = default;
  281. QString caption() const override { return QString("生成报告"); }
  282. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  283. QString portCaption(PortType pt, PortIndex) const override
  284. {
  285. if (pt == PortType::In) {
  286. return "输入";
  287. } else if (pt == PortType::Out) {
  288. return "输出";
  289. }
  290. return "";
  291. }
  292. QString name() const override { return QString("FlowReportData"); }
  293. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  294. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  295. {
  296. return FlowReportData().type();
  297. }
  298. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowReportData>(); }
  299. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  300. QWidget *embeddedWidget() override;
  301. };
  302. class FlowEffiLevData : public NodeData
  303. {
  304. public:
  305. NodeDataType type() const override { return NodeDataType { "FlowEffiLevData", "" }; }
  306. };
  307. class FlowEffiLevDataModel : public NodeDelegateModel
  308. {
  309. Q_OBJECT
  310. public:
  311. FlowEffiLevDataModel() : NodeDelegateModel() { }
  312. ~FlowEffiLevDataModel() = default;
  313. QString caption() const override { return QString("效能分级"); }
  314. bool portCaptionVisible(PortType, PortIndex) const override { return false; }
  315. QString portCaption(PortType pt, PortIndex) const override
  316. {
  317. if (pt == PortType::In) {
  318. return "输入";
  319. } else if (pt == PortType::Out) {
  320. return "输出";
  321. }
  322. return "";
  323. }
  324. QString name() const override { return QString("FlowEffiLevData"); }
  325. unsigned int nPorts(PortType const /*portType*/) const override { return 1; }
  326. NodeDataType dataType(PortType const portType, PortIndex const portIndex) const override
  327. {
  328. return FlowEffiLevData().type();
  329. }
  330. std::shared_ptr<NodeData> outData(PortIndex const port) override { return std::make_shared<FlowEffiLevData>(); }
  331. void setInData(std::shared_ptr<NodeData>, PortIndex const) override { }
  332. QWidget *embeddedWidget() override;
  333. };
  334. #endif // FLOWTEMPLARTEDATAMODEL_H