FlowTemplateDataModel.h 13 KB

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