3 using namespace wfrest;
21 resp->String(
"<html>\n");
22 resp->String(
"<head>\n");
23 resp->String(
" <link "
24 "type=\"text/css\"rel=\"stylesheet\"href=\"https://cdn.jsdelivr.net/npm/"
25 "litegraph.js@0.7.10/css/litegraph.css\">\n");
26 resp->String(
" <script "
27 "type=\"text/javascript\"src=\"https://cdn.jsdelivr.net/npm/litegraph.js@0.7.10/"
28 "build/litegraph.min.js\"></script>\n");
29 resp->String(
"</head>");
30 resp->String(
"<body style='width:100%; height:100%'>\n");
32 " <canvas id='mycanvas' width='1024' height='720' style='border: 1px solid'></canvas>\n");
33 resp->String(
" <script>\n");
34 resp->String(
" var graph = new LGraph();\n");
35 resp->String(
" var canvas = new LGraphCanvas(\"#mycanvas\", graph);\n");
43 std::string outtext, outtext2;
44 outtext =
" function leafNode" + std::to_string(nodeCode) +
"() {\n";
45 resp->String(outtext);
46 outtext = leafNode->
host;
47 outtext2 =
" this.addWidget(\"text\",\"host\",\"" + outtext +
"\");\n";
48 resp->String(outtext2);
49 outtext = leafNode->
port;
50 outtext2 =
" this.addWidget(\"text\",\"port\",\"" + outtext +
"\");\n";
51 resp->String(outtext2);
53 outtext2 =
" this.addWidget(\"text\",\"userName\",\"" + outtext +
"\");\n";
54 resp->String(outtext2);
56 outtext2 =
" this.addWidget(\"text\",\"passWord\",\"" + outtext +
"\");\n";
57 resp->String(outtext2);
58 resp->String(
" this.addOutput(\"data\", \"text\");\n");
60 outtext = leafNode->
dataBaseName + std::to_string(nodeCode);
62 " leafNode" + std::to_string(nodeCode) +
".title = \"mysql_" + outtext +
"\";\n";
63 resp->String(outtext2);
64 outtext =
" LiteGraph.registerNodeType(\"basic/leafNode" + std::to_string(nodeCode)
65 +
"\", leafNode" + std::to_string(nodeCode) +
");\n";
66 resp->String(outtext);
67 resp->String(
" var node_leaf" + std::to_string(nodeCode)
68 +
" = LiteGraph.createNode(\"basic/leafNode" + std::to_string(nodeCode) +
"\");\n");
70 outtext =
" node_leaf" + std::to_string(nodeCode) +
".pos = [" + std::to_string(posx) +
","
71 + std::to_string(posy) +
"];\n";
72 resp->String(outtext);
73 outtext =
" graph.add(node_leaf" + std::to_string(nodeCode) +
");\n";
74 resp->String(outtext);
82 outtext =
" function opNode" + std::to_string(nodeCode) +
"() {\n";
83 resp->String(outtext);
84 for (
int i = 1; i < input_num + 1; i++) {
85 outtext =
" this.addInput(\"inputdata_" + std::to_string(i) +
"\", \"text\");\n";
86 resp->String(outtext);
88 outtext =
" this.addOutput(\"output_data\", \"text\");}\n";
89 resp->String(outtext);
90 outtext =
" opNode" + std::to_string(nodeCode) +
".title = \"opNode\";\n";
91 resp->String(outtext);
92 outtext =
" LiteGraph.registerNodeType(\"basic/opNode" + std::to_string(nodeCode)
93 +
"\", opNode" + std::to_string(nodeCode) +
");\n";
94 resp->String(outtext);
95 outtext =
" var node_op" + std::to_string(nodeCode)
96 +
" = LiteGraph.createNode(\"basic/opNode" + std::to_string(nodeCode) +
"\");\n";
97 resp->String(outtext);
98 outtext =
" node_op" + std::to_string(nodeCode) +
".pos = [" + std::to_string(posx) +
","
99 + std::to_string(posy) +
"];\n";
100 resp->String(outtext);
101 outtext =
" graph.add(node_op" + std::to_string(nodeCode) +
");\n";
102 resp->String(outtext);
105 int posx = 100 + 2 * 250;
107 outtext =
" function outputNode() {";
108 resp->String(outtext);
109 for (
int i = 0; i < opCodeNow; i++) {
110 outtext =
" this.addInput(\"outdata" + std::to_string(i) +
"\", \"text\");\n";
111 resp->String(outtext);
115 outtext =
" outputNode.title = \"outputNode\";";
116 resp->String(outtext);
117 outtext =
" LiteGraph.registerNodeType(\"basic/outputNode\", outputNode);\n";
118 resp->String(outtext);
119 outtext =
" var node_out = LiteGraph.createNode(\"basic/outputNode\");\n";
120 resp->String(outtext);
121 outtext =
" node_out.pos = [" + std::to_string(posx) +
"," + std::to_string(posy) +
"];\n";
122 resp->String(outtext);
123 outtext =
" graph.add(node_out);\n";
124 resp->String(outtext);
128 outtext =
" node_leaf" + std::to_string(nodeleftnum) +
".connect(0,node_op"
129 + std::to_string(noderightnum) +
"," + std::to_string(nowinputsnum) +
");\n";
130 resp->String(outtext);
134 outtext =
" node_op" + std::to_string(nodeleftnum) +
".connect(0,node_out,"
135 + std::to_string(nowinputsnum) +
");\n";
136 resp->String(outtext);
141 outtext =
"graph.start();\n";
142 resp->String(outtext);
143 outtext =
" </script>\n";
144 resp->String(outtext);
145 outtext =
"</body>\n";
146 resp->String(outtext);
147 outtext =
"</html>\n";
148 resp->String(outtext);