Graphics drawing method, device, electronic device and storage medium
By determining the superior and subordinate relationship between task nodes and drawing it in the graphical interface, the problem that the task structure cannot be accurately visualized in the existing technology is solved, and the clear display of the task structure and efficiency improvement are achieved.
Patent Information
- Application Number
- CN202210447498.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2042-04-26
AI Technical Summary
The prior art cannot accurately visualize the task structure of the project, resulting in low display efficiency.
By obtaining the original task node information, the superior and subordinate relationships between task nodes are determined, and the relative positions of task nodes are determined in the graph drawing interface based on these relationships, and coordinates are assigned to them, and finally a task structure diagram is drawn.
It realizes accurate visual display of the task structure, improves the display efficiency, makes the task structure diagram clear and reflects the logical relationship between task nodes.
Smart Images

Figure CN114998473B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a graphics drawing method, device, electronic device and storage medium. Background Art
[0002] Almost all projects can be divided into several tasks to be performed (activities). These tasks are usually subject to certain conditions, such as some tasks can only be started after other tasks are completed. By abstracting the tasks to be performed as task nodes and drawing a task structure diagram between task nodes, the logical relationship between the task nodes in the project can be simply and clearly represented.
[0003] At present, the task structure diagram is generally drawn manually. When the computer obtains the basic task node information, it cannot draw a task structure diagram with complete upstream and downstream logical relationships of task nodes using existing algorithm technology.
[0004] For example, the following data information is input to the computer: the downstream task nodes of task node A are task nodes B and C, the downstream task nodes of task node B are task nodes C and D, the downstream task node of task node C is task node E, the downstream task node of D is task node E, and E has no downstream task node. The computer expresses the data structure on the UI (User Interface) graphic drawing interface according to the above information, and obtains Figure 1 The task structure diagram shown.
[0005] like Figure 1 As shown, there are connections from task node A to task nodes B and C, and there are also connections from task node B to task nodes C, D, and E. Figure 1 In the example, the task nodes are directly arranged from top to bottom, resulting in overlapping lines. In addition, if there is a line from task node D to task node B, there will be a reverse line from task node D to task node B. It can be seen that this display format is obviously messy and incomprehensible.
[0006] This shows that the existing algorithm technology cannot accurately visualize the task structure of the project, and the display efficiency is low. Summary of the invention
[0007] The present disclosure provides a graphics drawing method, device, electronic device and storage medium to at least solve the problem that the task structure of a project cannot be accurately visualized and the display efficiency is low in the related art. The technical solution of the present disclosure is as follows:
[0008] According to a first aspect of an embodiment of the present disclosure, there is provided a graphics drawing method, comprising:
[0009] Obtaining original task node information, and determining the superior-subordinate relationship between the task nodes based on the original task node information; the task node is a task to be executed of the project, and the original task node information includes: each task node information and its corresponding next-level task node information;
[0010] Determine the relative position of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes;
[0011] Assigning position coordinates to the task node according to the relative position to obtain the coordinates of the task node in the graphic drawing interface;
[0012] According to the coordinates of the task nodes and the superior-subordinate relationships, a structure diagram of the tasks to be executed of the project is drawn in the graphic drawing interface.
[0013] Optionally, determining the superior-subordinate relationship between the task nodes based on the original task node information includes:
[0014] Based on the information of each task node and its corresponding next-level task node information, determining a connection line corresponding to two task nodes having a superior-subordinate relationship, wherein the connection line includes a starting task node and an ending task node;
[0015] Storing the starting task node information and the ending task node information of the connection into a connection information set;
[0016] The in-degree port identifier and out-degree port identifier corresponding to each task node are stored in the task node information set;
[0017] The superior-subordinate relationship between the task nodes is determined by using the connection information set and the task node information set.
[0018] Optionally, the determining the superior-subordinate relationship between the task nodes by using the connection information set and the task node information set includes:
[0019] Traversing the task nodes in the task node information set, if the in-degree port identifier and the out-degree port identifier of the traversed task node do not exist in the connection information set, storing the task node in the first data set;
[0020] Traversing the links in the link information set, if the starting task node and the ending task node of the traversed link only appear once in the link information set, storing the combination of the two task nodes corresponding to the link in the second data set;
[0021] Storing the links associated with the remaining task nodes in the task node information set into a third data set;
[0022] The superior-subordinate relationship between task nodes is determined according to the first data set, the second data set, and the third data set.
[0023] Optionally, the determining the superior-subordinate relationship between the task nodes in the first data set and the second data set respectively includes:
[0024] Determine the task nodes in the first data set as isolated task nodes that have no connection relationship with other task nodes;
[0025] Determine a starting task node and an ending task node in a combination of two task nodes of the second data set as an upper-level task node and a lower-level task node, respectively;
[0026] By using the starting task node and the ending task node of any link in the third data set, traversing the third data set, the superior-subordinate relationship between the task nodes corresponding to the link in the third data set is obtained, wherein:
[0027] If the starting task node of any link is the same as the starting task node of any other link in the third data set, determining the ending task node of any other link as the subordinate task node of the starting task node of any link;
[0028] If the starting task node of any link is the same as the ending task node of any other link in the third data set, determining the starting task node of any other link as the upper-level task node of the starting task node of any link;
[0029] If the termination task node of any link is the same as the start task node of any other link in the third data set, the termination task node of any other link is determined as the subordinate task node of the termination task node of any link;
[0030] If the termination task node of any link is the same as the termination task node of any other link in the third data set, the start task node of any other link is determined as the upper-level task node of the termination task node of any link.
[0031] Optionally, after obtaining the superior-subordinate relationship between the task nodes, the method further includes:
[0032] From the task nodes having the superior-subordinate relationship, a plurality of task nodes of the same level and independent task nodes of different levels from other task nodes are obtained;
[0033] The multiple task nodes of the same level and the independent task nodes are stored in a fourth data set.
[0034] Optionally, determining the superior-subordinate relationship between task nodes according to the first data set, the second data set, and the third data set includes:
[0035] Obtaining a starting task node and an ending task node of any one connection in the third data set, and putting the starting task node and the initial task node into a preset array as a set element;
[0036] The third data set is traversed respectively by using the set elements in the preset array, and the corresponding task nodes in the third data set are inserted into the preset array according to the result of the traversal to obtain a fourth data set; wherein, in the fourth data set, multiple task nodes of the same level and independent task nodes of different levels from other task nodes exist as a set element respectively; the traversal rule is:
[0037] If there is a termination task node in the connection of the third data set that is the same as the element of the first data set, then the starting task node of the connection is inserted in the previous item of the termination task node; if there is a starting task node in the third data set that is the same as the element of the first data set, then the termination task node of the connection is inserted in the next item of the starting task node; wherein the element of the first data set is any set element in the preset array;
[0038] The superior-subordinate relationship between task nodes is determined according to the fourth data set, the first data set, the second data set, and the third data set.
[0039] Optionally, determining the relative position of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes includes:
[0040] Determine the positional relationship of each task node in the first data set in the graphic drawing interface as a horizontal parallel relationship;
[0041] Determine the positional relationship of each upper-level task node in the second data set in the graphic drawing interface as a horizontal parallel relationship, and determine the relative position between the upper-level task node and its corresponding lower-level task node as a vertical arrangement relationship, wherein the upper-level task node is located above the corresponding lower-level task node;
[0042] The position relationship of the task nodes of the same level in the fourth data set in the graphic drawing interface is determined as a horizontal parallel relationship, and the position of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes.
[0043] Optionally, assigning position coordinates to the task node according to the relative position to obtain the coordinates of the task node in the graphic drawing interface includes:
[0044] The same ordinate value is assigned to the task nodes in the horizontal parallel relationship in the same data set, and different ordinate values are assigned according to the first preset interval distance; the same ordinate value is assigned to the task nodes in the vertical arrangement relationship in the same data set, and different ordinate values are assigned according to the second preset interval distance;
[0045] For the independent task node, the vertical coordinate value of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes, and the horizontal coordinate value of the independent task node is determined according to the principle of symmetry.
[0046] Optionally, assigning different horizontal coordinate values according to the first preset interval distance includes:
[0047] According to the principle that the task nodes in the horizontal parallel relationship are symmetrically distributed on both sides of the central axis of the graphic drawing interface, the first preset interval distance and the horizontal coordinate value between the task nodes in the horizontal parallel relationship are determined.
[0048] Optionally, determining the horizontal coordinate value of the independent task node according to the symmetry principle includes:
[0049] The horizontal coordinate value of the independent task node is determined on the central axis of the graphic drawing interface.
[0050] Optionally, drawing a structure diagram of tasks to be executed of the project in the graphic drawing interface according to the coordinates of the task nodes and the superior-subordinate relationship includes:
[0051] Determine, according to the coordinates of the task node, a first offset of the task node from the leftmost side of the graphic drawing interface and a second offset of the task node from the topmost side of the graphic drawing interface;
[0052] Rendering the task node in the graphic drawing interface according to the first offset and the second offset to obtain a UI task node, where the UI task node is a drawing display result of the task node on the graphic drawing interface;
[0053] The superior-subordinate relationship of the UI task nodes is determined according to the superior-subordinate relationship of the task nodes, the UI task nodes with the superior-subordinate relationship in the graphic drawing interface are connected with lines, and arrows are added to the in-degree ports of the UI task nodes to obtain the task structure diagram to be executed of the project.
[0054] According to a second aspect of an embodiment of the present disclosure, there is provided a graphics drawing device, comprising:
[0055] The relationship determination module is configured to execute and obtain original task node information, and determine the superior-subordinate relationship between the task nodes based on the original task node information; the task node is a task to be executed in the project, and the original task node information includes: each task node information and its corresponding next-level task node information;
[0056] A relative position determination module is configured to determine the relative position of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes;
[0057] A coordinate determination module, configured to assign position coordinates to the task node according to the relative position, and obtain the coordinates of the task node in the graphic drawing interface;
[0058] The drawing module is configured to draw a structure diagram of tasks to be executed in the project in the graphic drawing interface according to the coordinates of the task nodes and the superior-subordinate relationships.
[0059] Optionally, the relationship determination module is specifically configured to execute:
[0060] Based on the information of each task node and its corresponding next-level task node information, determining a connection line corresponding to two task nodes having a superior-subordinate relationship, wherein the connection line includes a starting task node and an ending task node;
[0061] Storing the starting task node information and the ending task node information of the connection into a connection information set;
[0062] The in-degree port identifier and out-degree port identifier corresponding to each task node are stored in the task node information set;
[0063] The superior-subordinate relationship between the task nodes is determined by using the connection information set and the task node information set.
[0064] Optionally, the relationship determination module is specifically configured to execute:
[0065] Traversing the task nodes in the task node information set, if the in-degree port identifier and the out-degree port identifier of the traversed task node do not exist in the connection information set, storing the task node in the first data set;
[0066] Traversing the links in the link information set, if the starting task node and the ending task node of the traversed link only appear once in the link information set, storing the combination of the two task nodes corresponding to the link in the second data set;
[0067] Storing the links associated with the remaining task nodes in the task node information set into a third data set;
[0068] The superior-subordinate relationship between task nodes is determined according to the first data set, the second data set, and the third data set.
[0069] Optionally, the relationship determination module is specifically configured to execute:
[0070] Determine the task nodes in the first data set as isolated task nodes that have no connection relationship with other task nodes;
[0071] Determine a starting task node and an ending task node in a combination of two task nodes of the second data set as an upper-level task node and a lower-level task node, respectively;
[0072] By using the starting task node and the ending task node of any link in the third data set, traversing the third data set, the superior-subordinate relationship between the task nodes corresponding to the link in the third data set is obtained, wherein:
[0073] If the starting task node of any link is the same as the starting task node of any other link in the third data set, determining the ending task node of any other link as the subordinate task node of the starting task node of any link;
[0074] If the starting task node of any link is the same as the ending task node of any other link in the third data set, determining the starting task node of any other link as the upper-level task node of the starting task node of any link;
[0075] If the termination task node of any link is the same as the start task node of any other link in the third data set, the termination task node of any other link is determined as the subordinate task node of the termination task node of any link;
[0076] If the termination task node of any link is the same as the termination task node of any other link in the third data set, the start task node of any other link is determined as the upper-level task node of the termination task node of any link.
[0077] Optionally, the device further comprises:
[0078] A task node acquisition module is configured to acquire, from the task nodes having the superior-subordinate relationship, a plurality of task nodes of the same level and independent task nodes of different levels from other task nodes;
[0079] The fourth data set determination module is configured to execute storing the plurality of task nodes of the same level and the independent task nodes into a fourth data set.
[0080] Optionally, the relationship determination module is specifically configured to execute:
[0081] Obtaining a starting task node and an ending task node of any one connection in the third data set, and putting the starting task node and the initial task node into a preset array as a set element;
[0082] The third data set is traversed respectively by using the set elements in the preset array, and the corresponding task nodes in the third data set are inserted into the preset array according to the result of the traversal to obtain a fourth data set; wherein, in the fourth data set, multiple task nodes of the same level and independent task nodes of different levels from other task nodes exist as a set element respectively; the traversal rule is:
[0083] If there is a termination task node in the connection of the third data set that is the same as the element of the first data set, then the starting task node of the connection is inserted in the previous item of the termination task node; if there is a starting task node in the third data set that is the same as the element of the first data set, then the termination task node of the connection is inserted in the next item of the starting task node; wherein the element of the first data set is any set element in the preset array;
[0084] The superior-subordinate relationship between task nodes is determined according to the fourth data set, the first data set, the second data set, and the third data set.
[0085] Optionally, the relative position determination module is specifically configured to execute:
[0086] Determine the positional relationship of each task node in the first data set in the graphic drawing interface as a horizontal parallel relationship;
[0087] Determine the positional relationship of each upper-level task node in the second data set in the graphic drawing interface as a horizontal parallel relationship, and determine the relative position between the upper-level task node and its corresponding lower-level task node as a vertical arrangement relationship, wherein the upper-level task node is located above the corresponding lower-level task node;
[0088] The position relationship of the task nodes of the same level in the fourth data set in the graphic drawing interface is determined as a horizontal parallel relationship, and the position of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes.
[0089] Optionally, the coordinate determination module is specifically configured to execute:
[0090] The same ordinate value is assigned to the task nodes in the horizontal parallel relationship in the same data set, and different ordinate values are assigned according to the first preset interval distance; the same ordinate value is assigned to the task nodes in the vertical arrangement relationship in the same data set, and different ordinate values are assigned according to the second preset interval distance;
[0091] For the independent task node, the vertical coordinate value of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes, and the horizontal coordinate value of the independent task node is determined according to the principle of symmetry.
[0092] Optionally, the coordinate determination module is specifically configured to execute:
[0093] According to the principle that the task nodes in the horizontal parallel relationship are symmetrically distributed on both sides of the central axis of the graphic drawing interface, the first preset interval distance and the horizontal coordinate value between the task nodes in the horizontal parallel relationship are determined.
[0094] Optionally, the coordinate determination module is specifically configured to execute:
[0095] The horizontal coordinate value of the independent task node is determined on the central axis of the graphic drawing interface.
[0096] Optionally, the drawing module is specifically configured to execute:
[0097] Determine, according to the coordinates of the task node, a first offset of the task node from the leftmost side of the graphic drawing interface and a second offset of the task node from the topmost side of the graphic drawing interface;
[0098] Rendering the task node in the graphic drawing interface according to the first offset and the second offset to obtain a UI task node, where the UI task node is a drawing display result of the task node on the graphic drawing interface;
[0099] The superior-subordinate relationship of the UI task nodes is determined according to the superior-subordinate relationship of the task nodes, the UI task nodes with the superior-subordinate relationship in the graphic drawing interface are connected with lines, and arrows are added to the in-degree ports of the UI task nodes to obtain the task structure diagram to be executed of the project.
[0100] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0101] processor;
[0102] a memory for storing instructions executable by the processor;
[0103] The processor is configured to execute the instructions to implement the graphics drawing method as described in the first aspect.
[0104] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute the graphics drawing method as described in the first aspect.
[0105] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the graphics drawing method described in the first aspect is implemented.
[0106] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0107] In an embodiment of the present disclosure, based on the information of each task node and its corresponding next-level task node information, the superior-subordinate relationship between task nodes is determined; the task node is a task node of the project; according to the superior-subordinate relationship, the relative position of the task node in the graphic drawing interface is determined; according to the relative position, the task node is assigned a position coordinate to obtain the coordinate of the task node in the graphic drawing interface; according to the coordinates and the superior-subordinate relationship, a task structure diagram of the project is drawn in the graphic drawing interface. The above method converts the original task node and the subordinate task node information into the superior-subordinate relationship between task nodes that can be understood by the computer, and determines the relative position of the task node according to the superior-subordinate relationship between the task nodes. The relative position can reflect the upstream and downstream relationship between the task nodes. The task structure diagram drawn in this way can accurately express the logical relationship between the task nodes, so that the task structure is accurately visualized and the display efficiency is improved.
[0108] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0109] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0110] Figure 1 A task structure diagram is drawn according to a traditional method shown in an exemplary embodiment;
[0111] Figure 2 is a flowchart of steps of a first graphics drawing method according to an exemplary embodiment;
[0112] Figure 3 is a schematic diagram showing coordinates of a task node in a graphic drawing interface according to an exemplary embodiment;
[0113] Figure 4 is a schematic diagram of a task structure diagram according to an exemplary embodiment;
[0114] Figure 5 is a flowchart of steps of a first method for determining a superior-subordinate relationship between task nodes according to an exemplary embodiment;
[0115] Figure 6 is a flowchart showing a step of determining a superior-subordinate relationship between task nodes of a third data set according to an exemplary embodiment;
[0116] Figure 7 is a flowchart of steps of a second graphics drawing method according to an exemplary embodiment;
[0117] Figure 8 is a structural block diagram of a graphics drawing device according to an exemplary embodiment;
[0118] Fig. 9 It is a block diagram of an electronic device for graphic drawing according to an exemplary embodiment. DETAILED DESCRIPTION
[0119] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0120] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0121] Figure 2 is a flowchart of the steps of a first graphics drawing method according to an exemplary embodiment. Figure 2 As shown, the graphics drawing method includes the following steps.
[0122] In step S11, the original task node information is obtained, and based on the original task node information, the superior-subordinate relationship between the task nodes is determined; the task node is a task to be executed of the project, and the original task node information includes: each task node information and its corresponding next-level task node information.
[0123] In the embodiment of the present invention, a project can generally be divided into several tasks to be executed, and one task to be executed can be considered as a task node. For example, before the server sends data to the client, it needs to process the data first. The processing flow is: data recall, data screening, ab experiment, anchor configuration, delivery time configuration, and output processed data. The above example can be regarded as a data processing project, and each step in the processing flow is a task to be executed, and one task to be executed is a task node.
[0124] By drawing a task structure diagram between task nodes, you can predict whether the project can be completed successfully and estimate the shortest time required to complete the entire project.
[0125] For a project, the original information generally obtained is the configuration information of the task nodes included in the project, and the information of the task nodes that can be executed in the next step after the current task node is executed. In this way, the original task node information in the present invention is: the task node information and the corresponding next-level task node information. When the task structure diagram of the project is drawn using the front end, the task to be executed can be abstracted as a task node, and the original task node information of the project is input to the front end.
[0126] For example, the original task node information is:
[0127] {1:down_processor2,2:down_processor6,6:down_processor:7,3:down_processor4,4:down_proc essor7,5:down_processor9,9:down_processor7,7:down_processor8,10,11,12:down_processor13,14:down_processor15}.
[0128] Among them, 1-15 are the task nodes in the project, and n:down_processor m means: the next-level task node of task node n is task node m, that is, the next-level task node of task node 1 is 2, the next-level task node of task node 2 is 6, and so on.
[0129] The execution subject of the embodiment of the present invention may be the front end of a computer, and the original task node information may be provided by the back end to the front end, or may be pre-stored by the front end.
[0130] According to the original task node information, the connection information between the two task nodes can be obtained. The two task nodes connected by the connection are the starting task node and the ending task node, and each task node also has an in-degree port and an out-degree port. According to the starting task node and the ending task node information of each connection, as well as the in-degree port and out-degree port identifiers of each task node, the superior-subordinate relationship between the task nodes can be obtained.
[0131] For example, the superior-subordinate relationship between the task nodes obtained from the above original task node information is: 1→2→6→7→8, 3→4→7→8, 5→9→7→8, 12→13, 14→15, 10,11.
[0132] Among them, task nodes 10 and 11 have no superior-subordinate relationship with other task nodes and are isolated task nodes; task node 12 has only one subordinate task node 13, and task node 14 has only one subordinate task node 15, which can be called two task nodes; for the remaining task nodes, the subordinate task nodes of task node 1 are 5, 2, 3, 9, 6, 4, 7, and 8, among which task nodes 5, 2, and 3 are in a peer relationship, and task nodes 9, 6, and 4 are in a peer relationship. Task nodes 9, 6, and 4 are also the next-level task nodes of task nodes 5, 2, and 3, task node 7 is the next-level task node of task nodes 9, 6, and 4, and task node 8 is the next-level task node of task node 7. The details are as follows:
[0133] Isolated task nodes: {10,11};
[0134] Two task nodes: {[12,13],[14,15]};
[0135] Remaining task nodes: {[1],[5,2,3],[9,6,4],[7],[8]}.
[0136] In step S12, the relative positions of the task nodes in the graphic drawing interface are determined according to the hierarchical relationship between the task nodes.
[0137] After determining the superior-subordinate relationship between task nodes, the relative positions of the task nodes in the graphic drawing interface can be determined based on the principle that superior task nodes are located above subordinate task nodes and task nodes of the same level are located in the same row.
[0138] For task nodes that have no superior-subordinate relationship with other task nodes, they can be placed at any position outside other task nodes.
[0139] For example, there is no superior-subordinate relationship between the isolated task node, the two task nodes, and the remaining task nodes. Then, the isolated task node {10,11} can be located above or below the two task nodes {[12,13],[14,15]}, or above or below the remaining task nodes {[1],[5,2,3],[9,6,4]],[7],[8]}; similarly, the two task nodes {[12,13],[14,15]} can be located above or below the remaining task nodes {[1],[5,2,3],[9,6,4],[7],[8]}.
[0140] In step S13, position coordinates are assigned to the task node according to the relative position to obtain the coordinates of the task node in the graphic drawing interface.
[0141] Specifically, the vertical spacing distance between task nodes in a superior-subordinate relationship and the horizontal spacing distance between task nodes in a peer relationship may be set, and the spacing distance between task nodes that do not have a superior-subordinate relationship may be set.
[0142] Then, the coordinates of one of the task nodes on the graphic drawing interface are determined, and the coordinates of each task node in the graphic drawing interface can be obtained according to the relative positions between the task nodes.
[0143] Figure 3 The figure is a schematic diagram showing coordinates of a task node in a graphic drawing interface according to an exemplary embodiment.
[0144] like Figure 3As shown, for example, task nodes 12 and 13, which have a superior-subordinate relationship, are spaced apart by a preset distance in the vertical direction, task nodes 14 and 15 are also spaced apart by a preset distance in the vertical direction, task nodes 5, 2, 3 of the same level are spaced apart by a preset distance in the horizontal direction, and task nodes 9, 6, 4 of the same level are spaced apart by a preset distance in the horizontal direction. After obtaining the relative positions between the task nodes, as long as the coordinates of a task node in the graphic drawing interface are set, for example, the coordinates of task node 2 in the graphic drawing interface are set, the coordinates of each task node in the graphic drawing interface can be obtained.
[0145] In step S14, a structure diagram of tasks to be executed of the project is drawn in the graphic drawing interface according to the coordinates of the task nodes and the superior-subordinate relationships.
[0146] Specifically, the offset of the task node relative to the line boundary of the graphic drawing interface can be obtained according to the coordinates of each task node, and then the task node is rendered according to the offset. At the same time, each task node is connected with a line, and a direction arrow from the in-degree port to the out-degree port is added to the line, so that the task structure diagram displayed on the graphic drawing interface can be obtained.
[0147] Figure 4 It is a schematic diagram of a task structure diagram according to an exemplary embodiment.
[0148] like Figure 4 As shown, the arrows in the task structure diagram show the hierarchical relationship between task nodes. There are no overlapping or reverse connections, and the logical relationship between task nodes is clear.
[0149] This solution provides a complete solution for converting the topological relationship data between task nodes into the information required for UI (User Interface) rendering. The backend does not need to provide any UI information. The frontend can display the original task node information on the graphic drawing interface through the automatic arrangement capability of this solution, without the need to manually modify the data through cumbersome codes and manually display the task nodes on the graphic drawing interface.
[0150] In summary, in the embodiments of the present disclosure, based on the information of each task node and its corresponding next-level task node information, the superior-subordinate relationship between task nodes is determined; the task node is a task node of the project; according to the superior-subordinate relationship, the relative position of the task node in the graphic drawing interface is determined; according to the relative position, the task node is assigned a position coordinate to obtain the coordinate of the task node in the graphic drawing interface; according to the coordinates and the superior-subordinate relationship, the task structure diagram of the project is drawn in the graphic drawing interface. The above method converts the original task node and the subordinate task node information into the superior-subordinate relationship between task nodes that can be understood by the computer, and determines the relative position of the task node according to the superior-subordinate relationship between the task nodes. The relative position can reflect the superior-subordinate relationship between the task nodes. The task structure diagram drawn in this way does not have overlapping lines and reverse lines, and can accurately express the logical relationship between the task nodes, so that the task structure is accurately visualized and the display efficiency is improved.
[0151] Figure 5 The first method for determining the superior-subordinate relationship between task nodes is shown in a flowchart according to an exemplary embodiment. The method includes the following steps.
[0152] In step S21, based on the information of each task node and its corresponding next-level task node information, a connection line corresponding to two task nodes having a superior-subordinate relationship is determined, wherein the connection line includes a start task node and an end task node.
[0153] The connection line corresponding to two task nodes in a superior-subordinate relationship, that is, the connection line between the two task nodes, points from the superior task node to the subordinate task node, that is, the starting task node of the connection line is the superior task node, and the ending task node of the connection line is the subordinate task node.
[0154] For example, based on the original task node information 1:down_processor2, 1→2 can be obtained, where → is the line corresponding to task nodes 1 and 2, the starting task node of the line is 1, and the ending task node of the line is 2.
[0155] In step S22, the starting task node information and the ending task node information of the connection are stored in a connection information set.
[0156] The starting task node and the ending task node of the connection are taken as an element and stored in the connection information set, which can be an array.
[0157] For example, the starting task node and the ending task node of the connection are determined according to the original task node information in step S11, and the starting task node and the ending task node of each connection are stored in the connection information set. The following connection information set LinksArray can be obtained, where source represents the starting task node, target represents the ending task node, inputPortId represents the starting port, and outPortId represents the ending port.
[0158] LinksArray:[
[0159] {source:1,target:2,inputPortId:1_out_1,outPortId:2_in_1},
[0160] {source:2,target:6,inputPortId:2_out_1,outPortId:6_in_1},
[0161] {source:6,target:7,inputPortId:6_out_1,outPortId:7_in_1},
[0162] {source:3,target:4,inputPortId:3_out_1,outPortId:4_in_1},
[0163] {source:4,target:7,inputPortId:4_out_1,outPortId:7_in_1},
[0164] {source:5,target:9,inputPortId:5_out_1,outPortId:9_in_1},
[0165] {source:9,target:7,inputPortId:9_out_1,outPortId:7_in_1},
[0166] {source:7,target:8,inputPortId:7_out_1,outPortId:8_in_1},
[0167] {source:12,target:13,inputPortId:12_out_1,outPortId:13_in_1},
[0168] {source:14,target:15,inputPortId:14_out_1,outPortId:15_in_1}, ]
[0170] In step S23, the in-degree port identifier and the out-degree port identifier corresponding to each task node are stored in the task node information set.
[0171] The in-degree port refers to the task node pointed by the arrow of the connection, and the out-degree port refers to the task node pointed by the arrow of the connection. For example, for 1→3→4, task node 1 has no in-degree port, and its out-degree port is 1, the in-degree port of task node 3 is 3, the out-degree port of task node 3 is 3, the in-degree port of task node 4 is 4, and the out-degree port is 4.
[0172] For example, the in-degree port and out-degree port corresponding to each task node are determined for the original task node information in step S11, and the in-degree port and out-degree port of each item are stored in the task node information set.
[0173] The following task node information set NodesArray can be obtained, where id represents the task node identifier, name represents the task node name, inputPortId represents the in-degree port, and outPortId represents the out-degree port.
[0174] NodesArray:[
[0175] {id:1,name:'1',inputPortId:1_in_1,outPortId:1_out_1},
[0176] {id:2,name:'2',inputPortId:2_in_1,outPortId:2_out_1},
[0177] {id:3,name:'3',inputPortId:3_in_1,outPortId:3_out_1},
[0178] {id:4,name:'4',inputPortId:4_in_1,outPortId:4_out_1},
[0179] {id:5,name:'5',inputPortId:5_in_1,outPortId:5_out_1},
[0180] {id:6,name:'6',inputPortId:6_in_1,outPortId:6_out_1},
[0181] {id:7,name:'7',inputPortId:7_in_1,outPortId:7_out_1},
[0182] {id:8,name:'8',inputPortId:8_in_1,outPortId:8_out_1},
[0183] {id:9,name:'9',inputPortId:9_in_1,outPortId:9_out_1},
[0184] {id:10,name:'10',inputPortId:10_in_1,outPortId:10_out_1},
[0185] {id:11,name:'11',inputPortId:11_in_1,outPortId:11_out_1},
[0186] {id:12,name:'12',inputPortId:12_in_1,outPortId:12_out_1},
[0187] {id:13,name:'13',inputPortId:13_in_1,outPortId:13_out_1},
[0188] {id:14,name:'14',inputPortId:14_in_1,outPortId:14_out_1},
[0189] {id:15,name:'15',inputPortId:15_in_1,outPortId:15_out_1}, ]
[0191] In step S24, the superior-subordinate relationship between the task nodes is determined using the connection information set and the task node information set.
[0192] Specifically, the connection information set and the task node information set can be used to find out the task nodes that have no connection relationship with other task nodes, find out the task nodes that have only one connection relationship with other task nodes, and find out the task nodes that have connection relationships with multiple other task nodes. Then, based on the above connection relationships, the superior-subordinate relationship between the task nodes is determined.
[0193] In a possible implementation, based on the above embodiment, Figure 6 As shown, the above step S24 may include steps S241 to S244:
[0194] In step S241, the task nodes in the task node information set are traversed, and if the in-degree port identifier and the out-degree port identifier of the traversed task node do not exist in the connection information set, the task node is stored in the first data set.
[0195] The in-degree port identifier and out-degree port identifier of the task node do not exist in the connection information set, indicating that the task node has no corresponding connection, that is, the task node has no connection relationship with other task nodes. The task node is an isolated task node, and the task node is stored in the first data set.
[0196] For example, in the above NodesArray, the in-degree port identifiers and out-degree port identifiers of task nodes 10 and 11 do not exist in LinksArray, so task nodes 10 and 11 are stored in the first data set. Specifically, the first data set can be represented as: SingleNodes: {10,11}.
[0197] In step S242, the links in the link information set are traversed, and if the start task node and the end task node of the traversed link only appear once in the link information set, the combination of the two task nodes corresponding to the link is stored in the second data set.
[0198] If the starting task node and the ending task node of the connection only appear once in the connection information set, it means that the starting task node has no connection relationship with other task nodes except the connection relationship with the ending task node, and the same is true for the ending task node. Then, the combination of the starting task node and the ending task node is stored in the second data set.
[0199] For example, in the LinksArray above, source:12 and target:13 only appear once, and source:14 and target:15 also only appear once, so the task node combination [12,13] and the task node combination [14,15] are stored in the second data set. Specifically, the second data set can be represented as: TwoNodes: {[12,13],[14,15]}.
[0200] In step S243, the links associated with the remaining task nodes in the task node information set are stored in a third data set.
[0201] The remaining task nodes are task nodes that are connected to multiple other task nodes, and the information of the connections associated with these task nodes is stored in the third data set.
[0202] For example, in the above NodesArray, the remaining task nodes are 1, 2, 6, 7, 8, 3, 4, 9, and the lines associated with the above task nodes are: 1→2, 2→6, 6→7, 3→4, 4→7, 5→9, 9→7, 7→8. The information of these lines is stored in the third data set remainingArray, and the following is obtained:
[0203] remainingArrays:[
[0204] {source:1,target:2,inputPortId:1_out_1,outPortId:2_in_1},
[0205] {source:2,target:6,inputPortId:2_out_1,outPortId:6_in_1},
[0206] {source:6,target:7,inputPortId:6_out_1,outPortId:7_in_1},
[0207] {source:3,target:4,inputPortId:3_out_1,outPortId:4_in_1},
[0208] {source:4,target:7,inputPortId:4_out_1,outPortId:7_in_1},
[0209] {source:5,target:9,inputPortId:5_out_1,outPortId:9_in_1},
[0210] {source:9,target:7,inputPortId:9_out_1,outPortId:7_in_1},
[0211] {source:7,target:8,inputPortId:7_out_1,outPortId:8_in_1}, ]
[0213] In step S244, the superior-subordinate relationship between task nodes is determined according to the first data set, the second data set, and the third data set.
[0214] The task nodes in the first data set are isolated task nodes and have no superior-subordinate relationship with other task nodes; the task nodes in the second data set can determine the superior-subordinate relationship based on the relationship between the starting task node and the terminating task node; for the task nodes in the third data set, it is necessary to determine the superior-subordinate relationship between the task nodes based on the in-degree port, out-degree port and the relationship between the starting task node and the terminating task node in the connection information set.
[0215] The embodiments of the present invention respectively determine the hierarchical relationships between the task nodes in the first data set, the second data set, and the third data set, and can perform targeted analysis and processing according to the different characteristics of the task node relationships in different arrays, thereby improving execution efficiency and the accuracy of the analysis results.
[0216] In a possible implementation, step S244 includes the following steps S2441-S2443:
[0217] Step S2441: determine the task nodes in the first data set as isolated task nodes that have no connection relationship with other task nodes.
[0218] The task nodes in the first data set have no superior-subordinate relationship with other task nodes and are isolated task nodes.
[0219] Step S2442: determine the starting task node and the ending task node in the combination of two task nodes of the second data set as the upper-level task node and the lower-level task node, respectively.
[0220] Since in the execution steps of the task nodes, the start task node is executed first and then the end task node is executed, therefore, the start task node is the upper-level task node and the end task node is the lower-level task node.
[0221] For example, in the combination [12,13] of TwoNodes, 12 is the upper-level task node and 13 is the lower-level task node. In the combination [14,15], 14 is the upper-level task node and 15 is the lower-level task node.
[0222] Step S2443, using the starting task node and the ending task node of any link in the third data set, traverse the third data set to obtain the superior-subordinate relationship between the task nodes corresponding to the link in the third data set, which specifically includes the following four situations A1-A4:
[0223] A1. If the starting task node of any link is the same as the starting task node of any other link in the third data set, the ending task node of any other link is determined as the subordinate task node of the starting task node of any link;
[0224] A2. If the starting task node of any link is the same as the ending task node of any other link in the third data set, the starting task node of any other link is determined as the upper-level task node of the starting task node of any link;
[0225] A3. If the termination task node of any link is the same as the start task node of any other link in the third data set, the termination task node of any other link is determined as the subordinate task node of the termination task node of any link;
[0226] A4. If the termination task node of any link is the same as the termination task node of any other link in the third data set, the start task node of any other link is determined as the upper-level task node of the termination task node of any link.
[0227] Specifically, take any set element in the third data set, traverse the in-degree ports and out-degree ports of the task node of the set element in the third data set, and determine the superior-subordinate relationship between the task node of this item and other task nodes according to A1-A4, until all the set elements in the third data set are executed with the above steps, then the superior-subordinate relationship between all task nodes in the third data set and other task nodes is obtained.
[0228] The steps A1-A4 are illustrated as follows:
[0229] For example, the starting task node and the ending task node in the third data set are traversed by using the in-degree port identifier and the out-degree port identifier of the task node in the third data set. The lines in the third data set remainingArrays and their in-degree port and out-degree port identifiers are as follows:
[0230] remainingArrays:[
[0231] {source:1,target:2,inputPortId:1_out_1,outPortId:2_in_1},
[0232] {source:2,target:6,inputPortId:2_out_1,outPortId:6_in_1},
[0233] {source:6,target:7,inputPortId:6_out_1,outPortId:7_in_1},
[0234] {source:3,target:4,inputPortId:3_out_1,outPortId:4_in_1},
[0235] {source:4,target:7,inputPortId:4_out_1,outPortId:7_in_1},
[0236] {source:5,target:9,inputPortId:5_out_1,outPortId:9_in_1},
[0237] {source:9,target:7,inputPortId:9_out_1,outPortId:7_in_1},
[0238] {source:7,target:8,inputPortId:7_out_1,outPortId:8_in_1},]
[0239] First, take the first item in the array, whose out-degree port 2 is the same as the starting task node of the connection in the second item of the array, then determine the ending task node 6 of the second item as the subordinate task node of task node 2 corresponding to out-degree port 2.
[0240] Take the second item in the array, whose out-degree port 6 is the same as the starting task node in the third item of the array, then determine the ending task node 7 of the third item as the subordinate task node of task node 6.
[0241] Take the third item in the array, whose out-degree port 7 is the same as the terminating task node in the fifth item of the array, then determine the starting task node 4 of the fifth item as the parent task node of task node 7.
[0242] Take the fourth item in the array, whose out-degree port 4 is the same as the starting task node in the fifth item of the array, then determine the ending task node 7 of the fifth item as the subordinate task node of task node 4.
[0243] In this way, the final superior-subordinate relationship between the task nodes is: 1→2→6→7→8, 3→4→7→8, 5→9→7→8.
[0244] In steps A1-A4, the superior-subordinate relationship between each task node can be obtained according to the out-degree port, in-degree port of the task node, the starting task node and the ending task node information of the connection. This solution is accurate and efficient, and does not change the data structure of the original task node information, thus avoiding pollution to the original task node information provided by the backend.
[0245] In a possible implementation manner, determining the superior-subordinate relationship between task nodes according to the first data set, the second data set, and the third data set further includes another method different from step S2443, which includes the following steps S2444-S2446:
[0246] Step S2444, obtaining a first starting task node and a first ending task node of any one link in the third data set, and putting the first starting task node and the first initial task node into a preset array as a set element;
[0247] Step S2445, using the set elements in the preset array to traverse the third data set respectively, and inserting the corresponding task nodes in the third data set into the preset array according to the result of the traversal, to obtain a fourth data set; wherein, in the fourth data set, multiple task nodes of the same level and independent task nodes with different levels from other task nodes exist as a set element respectively; the traversal rules are:
[0248] If there is a termination task node in the connection of the third data set that is the same as the element of the first data set, then the starting task node of the connection is inserted in the previous item of the termination task node; if there is a starting task node in the third data set that is the same as the element of the first data set, then the termination task node of the connection is inserted in the next item of the starting task node; wherein the element of the first data set is any set element in the preset array;
[0249] Step S2446: determine the superior-subordinate relationship between task nodes according to the fourth data set, the first data set, the second data set, and the third data set.
[0250] In steps S2444-S2446, the first link is taken from the third data set, and the starting task node 1 and the ending task node 2 of the link are each put into the declared empty array result as a set element to obtain result{[1],[2]}.
[0251] First, use [1] to traverse the third data set. If there is no other [1] in the third data set, the first traversal ends.
[0252] Then, use [2] to traverse the third data set. The starting task node in the second link of the third data set is 2, so insert the ending task node 6 of the link next to the starting task node 2, and get result {[1], [2], [6]}.
[0253] Next, use [6] to traverse the third data set. The starting task node of the third link of the third data set is 6, so insert the ending task node 7 of the link into the next item of the starting task node 6, and get result {[1], [2], [6], [7]}.
[0254] Next, use [7] to traverse the third data set. The end task node of the fifth link of the third data set is 7. Then insert the start task node 4 of the link before the end task node 7, and get result{[1],[2],[6,4],[7]}. It should be noted here that when inserting, it is necessary to determine whether the current position to be inserted exists. If it exists, it is a push operation. If it does not exist, it is an array assignment operation, that is, result[result.length]=target.
[0255] In addition, the terminating task node of the 7th link of the third data set is 7, so the starting task node 9 of the link is inserted before the terminating task node 7, and result {[1], [2], [6, 4, 9], [7]} is obtained.
[0256] The starting task node of the 8th link of the third data set is 7, so the ending task node 8 of the link is inserted next to the starting task node 7, and the result is {[1], [2], [6, 4, 9], [7], [8]}.
[0257] Next, use [8] to traverse the third data set. If there is no other [8] in the third data set, the traversal of [8] ends.
[0258] Next, use [4] to traverse the third data set. The end task node of the fourth link of the third data set is 4, so insert the start task node 3 of the link into the previous item of the end task node 4, and get result {[1], [2, 3], [6, 4, 9], [7], [8]}.
[0259] Next, use [9] to traverse the third data set. The end task node of the sixth link of the third data set is 9, so insert the start task node 5 of the link into the previous item of the end task node 9, and get result {[1], [2, 3, 5], [6, 4, 9], [7], [8]}, which is the fourth data set.
[0260] In the fourth data set, multiple task nodes of the same level and independent task nodes of different levels from other task nodes exist as a set element. In the above result array, multiple task nodes of the same level are [2,3,5], [6,4,9], and independent task nodes are [1], [7], [8].
[0261] According to the hierarchical relationship of the fourth data set, the superior-subordinate relationship of the third data set can be obtained as follows: 1→2→6→7→8, 3→4→7→8, 5→9→7→8.
[0262] In steps S2444-S2446, the set elements in the preset array are used to traverse the third data set respectively, and the corresponding task nodes in the third data set are inserted into the preset array according to the result of the traversal to obtain a fourth data set. In the fourth data set, multiple task nodes of the same level and independent task nodes with different levels from other task nodes exist as a set element respectively, which can be directly used to determine the positional relationship between task nodes, such as task nodes of the same level are arranged horizontally on the graphic drawing interface, and task nodes of different levels are arranged vertically on the graphic drawing interface. Steps S2441-S2443 can only determine the superior-subordinate relationship between task nodes, and steps S25-S26 need to be executed according to the superior-subordinate relationship to obtain the information of task nodes of the same level and independent task nodes. Steps S2444-S2446 further simplify the complexity of the algorithm and improve the execution efficiency.
[0263] Figure 7 FIG. 1 is a flowchart of the steps of a second method for drawing graphics according to an exemplary embodiment. Figure 7 As shown, the method comprises the following steps:
[0264] In step S31, based on the information of each task node and its corresponding next-level task node information, a connection line corresponding to two task nodes having a superior-subordinate relationship is determined, wherein the connection line includes a start task node and an end task node.
[0265] In the embodiment of the present invention, step S31 may refer to step S21 and will not be described in detail here.
[0266] In step S32, the starting task node information and the ending task node information of the connection are stored in a connection information set.
[0267] In the embodiment of the present invention, step S32 may refer to step S22 and will not be described in detail here.
[0268] In step S33, the in-degree port identifier and the out-degree port identifier corresponding to each task node are stored in the task node information set.
[0269] In the embodiment of the present invention, step S33 may refer to step S23, which will not be described in detail here.
[0270] In step S34, the task nodes in the task node information set are traversed, and if the in-degree port identifier and the out-degree port identifier of the traversed task node do not exist in the connection information set, the task node is stored in the first data set.
[0271] In the embodiment of the present invention, step S34 may refer to step S241 and will not be described in detail here.
[0272] In step S35, the links in the link information set are traversed, and if the start task node and the end task node of the traversed link only appear once in the link information set, the combination of the two task nodes corresponding to the link is stored in the second data set.
[0273] In the embodiment of the present invention, step S35 may refer to step S242 and will not be described in detail here.
[0274] In step S36, the links associated with the remaining task nodes in the task node information set are stored in a third data set.
[0275] In the embodiment of the present invention, step S36 may refer to step S243 and will not be described in detail here.
[0276] In step S37, the superior-subordinate relationship between task nodes is determined according to the first data set, the second data set, and the third data set.
[0277] In the embodiment of the present invention, step S37 may refer to step S244 and will not be described in detail here.
[0278] In step S38, a plurality of task nodes of the same level and independent task nodes of different levels from other task nodes are obtained.
[0279] In the third data set, the levels of all task nodes can be obtained by calculating upward from the last level task node. For example, task node 8 is the fifth level, and after calculating upward, task node 7 is the fourth level, task nodes 6, 4, and 9 are the third level, task nodes 2, 3, and 5 are the second level, and task node 1 is the first level.
[0280] Thus, in the third data set, the multiple task nodes with the same level are [2, 3, 5], [6, 4, 9], and the independent task nodes are [1], [7], [8].
[0281] In step S39, the plurality of task nodes of the same level and the independent task nodes are stored in a fourth data set.
[0282] Specifically, the fourth data set obtained according to the above example is: {[1], [2, 3, 5], [6, 4, 9], [7], [8]}.
[0283] In step S40, the position relationship of each task node in the first data set in the graphic drawing interface is determined to be a horizontal parallel relationship.
[0284] The task nodes in the first data set are isolated task nodes, and there is no superior-subordinate relationship between them, so the position relationship can be determined as a horizontal parallel relationship.
[0285] In step S41, the positional relationship of each upper-level task node in the second data set in the graphic drawing interface is determined as a horizontal parallel relationship, and the relative position between the upper-level task node and its corresponding lower-level task node is determined as a vertical arrangement relationship, wherein the upper-level task node is located above the corresponding lower-level task node.
[0286] The execution time period or priority of each upper task node in the second data set is the same, and they can be arranged horizontally in parallel. The execution order of the lower task node is the next step of its corresponding upper task node, so the position should be below the upper task node.
[0287] For example, the upper-level task nodes 12 and 14 in the second data set are in a horizontal parallel relationship, task node 13 is located below task node 12 , and task node 15 is located below task node 14 .
[0288] In step S42, the position relationship of the task nodes of the same level in the fourth data set in the graphic drawing interface is determined as a horizontal parallel relationship, and the position of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes.
[0289] Task nodes of the same level can be arranged horizontally in the graphic drawing interface and located in the same row of the graphic drawing interface, that is, arranged horizontally in parallel, so that the work tasks corresponding to these task nodes can be executed in the same time period or at the same priority.
[0290] For an independent task node, if it is located at the lower level of a certain task node, the position of the independent task node is set below the certain task node; if it is located at the upper level of a certain task node, the position of the independent task node is set above the certain task node.
[0291] For example, in the fourth data set, the position relationship of task nodes 5, 2, 3 is a horizontal parallel relationship, the position relationship of task nodes 9, 4, 6 is a horizontal parallel relationship, task node 7 is located below task node 9, 6, 4, and task node 8 is located below task node 7. In addition, task node 9, 4, 6 is the next level of task node 5, 2, 3 and should be located below task node 5, 2, 3.
[0292] In step S43, the task nodes in the horizontal parallel relationship located in the same data set are assigned the same vertical coordinate value, and are assigned different horizontal coordinate values according to a first preset interval distance; the task nodes in the vertical arrangement relationship located in the same data set are assigned the same horizontal coordinate value, and are assigned different vertical coordinate values according to a second preset interval distance.
[0293] By assigning the same vertical coordinate value to task nodes in a horizontally parallel relationship in the same array, these task nodes can be located in the same row on the graphics drawing interface. By assigning different horizontal coordinate values according to the first preset interval distance, the interval distances between these task nodes can be equal, which can make the graphics drawing interface more beautiful.
[0294] Assigning the same horizontal coordinate value to the task nodes in the vertical arrangement relationship can make these task nodes in the same column on the graphic drawing interface, so that the superior-subordinate relationship between the task nodes can be reflected. Assigning different vertical coordinate values according to the second preset interval distance can make the interval distance between these task nodes equal, so that the graphic drawing interface can be more beautiful.
[0295] Of course, the preset interval distances between task nodes of the same level may also be different, as long as different interval distance settings have no impact on the hierarchical relationship between the task nodes.
[0296] In the process of processing the task node position, you can follow the idea of finding the optimal solution rather than the most accurate solution. Because different people have different rendering methods for a picture, there is no most accurate rendering solution, but there is an optimal and beautiful solution.
[0297] In step S44, for the independent task node, the ordinate value of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes, and the abscissa value of the independent task node is determined according to the principle of symmetry.
[0298] The independent task node is located below its upper-level task node and above its lower-level task node, thereby determining the ordinate value of the independent task node, and then determining the abscissa value of the independent task node in accordance with the same symmetry principle.
[0299] In a possible implementation manner, assigning different horizontal coordinate values according to the first preset interval distance includes:
[0300] According to the principle that the task nodes in the horizontal parallel relationship are symmetrically distributed on both sides of the central axis of the graphic drawing interface, the first preset interval distance and the horizontal coordinate value between the task nodes in the horizontal parallel relationship are determined.
[0301] The central axis of the graphic drawing interface refers to the center line of the graphic drawing interface, which can divide the graphic drawing interface into two identical parts. In order to make the task structure diagram more beautiful on the graphic drawing interface, the horizontal parallel task nodes can be symmetrically arranged on both sides of the central axis, and the first preset interval distance and horizontal coordinate value between each task node are determined according to the principle of symmetry.
[0302] If there are m task nodes in a horizontal parallel relationship, if m is an odd number, a task node is set on the central axis, and m / 2 task nodes are arranged on both sides of the central axis; if m is an even number, no task node is set on the central axis, and [m / 2] task nodes are arranged on both sides of the central axis. [m / 2] refers to rounding m / 2. Then, by multiplying [m / 2] by the first preset interval distance, the horizontal coordinate value of each task node is obtained.
[0303] For example, for the task nodes [5, 2, 3] in a horizontal parallel relationship, m is 3, [3 / 2] = 1. At this time, a task node is placed on the central axis, and a task node is arranged on each side of the central axis to achieve symmetry.
[0304] In a possible implementation manner, determining the horizontal coordinate value of the independent task node according to the symmetry principle includes:
[0305] The horizontal coordinate value of the independent task node is determined on the central axis of the graphic drawing interface.
[0306] In the embodiment of the present invention, there is only one independent task node, and the independent task node can be directly set on the central axis to achieve a symmetrical arrangement of the task nodes.
[0307] For example, for task nodes [1], [7], and [8], their horizontal coordinate values may be the central axis, and their vertical coordinate values may be determined according to the hierarchical relationship with other task nodes.
[0308] In an embodiment of the present invention, the same ordinate value is assigned to task nodes in a horizontal parallel relationship, and different ordinate values are assigned according to a first preset interval; the same ordinate value is assigned to task nodes in a vertical arrangement relationship, and different ordinate values are assigned according to a second preset interval. For independent task nodes, the ordinate value of the independent task node is determined according to the principle of symmetry. In this way, the task nodes are no longer simply arranged according to their positional relationship, but the order of the task nodes is adjusted according to their relationship, and then the arrangement with the best visual effect is obtained, which can improve the efficiency of users in analyzing and understanding the task structure diagram.
[0309] In step S45, a first offset of the task node from the leftmost side of the graphic drawing interface and a second offset of the task node from the topmost side of the graphic drawing interface are determined according to the coordinates of the task node.
[0310] The front end does not understand the specific data structure, and can only render the task node according to where a task node should appear and the offset from the left and top of the graphic drawing interface. Therefore, the front end can determine the first offset of the task node from the leftmost side of the graphic drawing interface and the second offset from the top of the graphic drawing interface according to the horizontal coordinate value and vertical coordinate value of the task node determined in the above steps.
[0311] In step S46, the task node is rendered in the graphic drawing interface according to the first offset and the second offset to obtain a UI task node, where the UI task node is a drawing display result of the task node on the graphic drawing interface.
[0312] The UI task node refers to the drawing display result of the task node on the graphic drawing interface. After the front end renders the task node according to the first offset and the second offset, the UI task node can be obtained.
[0313] In step S47, the superior-subordinate relationship of the UI task nodes is determined according to the superior-subordinate relationship of the task nodes, the UI task nodes with the superior-subordinate relationship in the graphic drawing interface are connected with lines, and arrows are added to the in-degree ports of the UI task nodes to obtain the structure diagram of the tasks to be executed of the project.
[0314] After the task node is rendered, traverse all the connections, match the out-degree and in-degree of the connections with the task nodes in the graph, and then draw arrows on the in-degree task nodes to complete the construction process of the task structure diagram to be executed.
[0315] Please refer to the specific task structure diagram Figure 4 .
[0316] Figure 8 FIG. 1 is a structural block diagram of a graphics drawing device according to an exemplary embodiment. Figure 8 As shown, the graphics drawing device 50 includes:
[0317] The relationship determination module 51 is configured to obtain original task node information and determine the superior-subordinate relationship between the task nodes based on the original task node information; the task node is a task to be executed in the project, and the original task node information includes: each task node information and its corresponding next-level task node information;
[0318] A relative position determination module 52 is configured to determine the relative position of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes;
[0319] A coordinate determination module 53 is configured to assign position coordinates to the task node according to the relative position to obtain the coordinates of the task node in the graphic drawing interface;
[0320] The drawing module 54 is configured to draw a structure diagram of the tasks to be executed of the project in the graphic drawing interface according to the coordinates of the task nodes and the superior-subordinate relationships.
[0321] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0322] Fig. 9 FIG. 1 is a block diagram of an electronic device for graphic drawing according to an exemplary embodiment. Fig. 9As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a graphics drawing method is implemented.
[0323] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0324] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the graphics drawing method as in the embodiment of the present disclosure.
[0325] In an exemplary embodiment, a computer-readable storage medium is also provided, and when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the graphics drawing method in the embodiment of the present disclosure. The computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0326] In an exemplary embodiment, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer is enabled to execute the graphics drawing method in the embodiment of the present disclosure.
[0327] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0328] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0329] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A graphics drawing method, characterized in that: The method comprises: Obtaining original task node information, and determining the superior-subordinate relationship between task nodes based on the original task node information; the task node is a task to be executed in the project, and the original task node information includes: information of each task node and its corresponding next-level task node information; the task node information includes: an in-degree port identifier and an out-degree port identifier corresponding to the task node; the in-degree port refers to the task node pointed to by the arrow of the connection line, and the out-degree port refers to the task node pointed out by the arrow of the connection line; the connection line refers to the connection line corresponding to two task nodes having a superior-subordinate relationship; Determine the relative position of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes; Assigning position coordinates to the task node according to the relative position to obtain the coordinates of the task node in the graphic drawing interface; According to the coordinates of the task nodes and the superior-subordinate relationships, a structure diagram of the tasks to be executed of the project is drawn in the graphic drawing interface; the structure diagram of the tasks to be executed includes each task node, the connection lines between each task node, and the direction arrow from the in-degree port to the out-degree port located on the connection lines.
2. The method according to claim 1, characterized in that The determining, based on the original task node information, the superior-subordinate relationship between the task nodes includes: Based on the information of each task node and its corresponding next-level task node information, determining a connection line corresponding to two task nodes having a superior-subordinate relationship, wherein the connection line includes a starting task node and an ending task node; Storing the starting task node information and the ending task node information of the connection into a connection information set; The in-degree port identifier and out-degree port identifier corresponding to each task node are stored in the task node information set; The superior-subordinate relationship between the task nodes is determined by using the connection information set and the task node information set.
3. The method according to claim 2, characterized in that The determining the superior-subordinate relationship between the task nodes by using the connection information set and the task node information set includes: Traversing the task nodes in the task node information set, if the in-degree port identifier and the out-degree port identifier of the traversed task node do not exist in the connection information set, storing the task node in the first data set; Traversing the links in the link information set, if the starting task node and the ending task node of the traversed link only appear once in the link information set, storing the combination of the two task nodes corresponding to the link in the second data set; Storing the links associated with the remaining task nodes in the task node information set into a third data set; The superior-subordinate relationship between task nodes is determined according to the first data set, the second data set, and the third data set.
4. The method according to claim 3, characterized in that: The determining the superior-subordinate relationship between task nodes according to the first data set, the second data set, and the third data set includes: Determine the task nodes in the first data set as isolated task nodes that have no connection relationship with other task nodes; Determine a starting task node and an ending task node in a combination of two task nodes of the second data set as an upper-level task node and a lower-level task node, respectively; By using the starting task node and the ending task node of any link in the third data set, traversing the third data set, the superior-subordinate relationship between the task nodes corresponding to the link in the third data set is obtained, wherein: If the starting task node of any link is the same as the starting task node of any other link in the third data set, determining the ending task node of any other link as the subordinate task node of the starting task node of any link; If the starting task node of any link is the same as the ending task node of any other link in the third data set, the starting task node of any other link is determined as the upper-level task node of the starting task node of any link; If the termination task node of any of the links is the same as the start task node of any other link in the third data set, the termination task node of any other link is determined as a subordinate task node of the termination task node of any of the links; If the termination task node of any link is the same as the termination task node of any other link in the third data set, the start task node of any other link is determined as the upper-level task node of the termination task node of any link.
5. The method according to claim 4, characterized in that After obtaining the superior-subordinate relationship between the task nodes corresponding to the links in the third data set, the method further includes: Acquire multiple task nodes of the same level, and independent task nodes of different levels from other task nodes; The multiple task nodes of the same level and the independent task nodes are stored in a fourth data set.
6. The method according to claim 5, characterized in that Determining the relative positions of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes includes: Determine the positional relationship of each task node in the first data set in the graphic drawing interface as a horizontal parallel relationship; Determine the positional relationship of each upper-level task node in the second data set in the graphic drawing interface as a horizontal parallel relationship, and determine the relative position between the upper-level task node and its corresponding lower-level task node as a vertical arrangement relationship, wherein the upper-level task node is located above the corresponding lower-level task node; The position relationship of the task nodes of the same level in the fourth data set in the graphic drawing interface is determined as a horizontal parallel relationship, and the position of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes.
7. The method according to claim 6, characterized in that The step of assigning position coordinates to the task node according to the relative position to obtain the coordinates of the task node in the graphic drawing interface includes: The same ordinate value is assigned to the task nodes in the horizontal parallel relationship in the same data set, and different ordinate values are assigned according to the first preset interval distance; the same ordinate value is assigned to the task nodes in the vertical arrangement relationship in the same data set, and different ordinate values are assigned according to the second preset interval distance; For the independent task node, the vertical coordinate value of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes, and the horizontal coordinate value of the independent task node is determined according to the principle of symmetry.
8. The method according to claim 7, characterized in that The assigning different horizontal coordinate values according to the first preset interval distance includes: According to the principle that the task nodes in the horizontal parallel relationship are symmetrically distributed on both sides of the central axis of the graphic drawing interface, the first preset interval distance and the horizontal coordinate value between the task nodes in the horizontal parallel relationship are determined.
9. The method according to claim 7, characterized in that: Determining the horizontal coordinate value of the independent task node according to the symmetry principle includes: The horizontal coordinate value of the independent task node is determined on the central axis of the graphic drawing interface.
10. The method according to claim 1, characterized in that Drawing a structure diagram of tasks to be executed of the project in the graphic drawing interface according to the coordinates of the task nodes and the superior-subordinate relationship includes: Determine, according to the coordinates of the task node, a first offset of the task node from the leftmost side of the graphic drawing interface and a second offset of the task node from the topmost side of the graphic drawing interface; Rendering the task node in the graphic drawing interface according to the first offset and the second offset to obtain a UI task node, where the UI task node is a drawing display result of the task node on the graphic drawing interface; The superior-subordinate relationship of the UI task nodes is determined according to the superior-subordinate relationship of the task nodes, the UI task nodes with the superior-subordinate relationship in the graphic drawing interface are connected with lines, and arrows are added to the in-degree ports of the UI task nodes to obtain the task structure diagram to be executed of the project.
11. A graphics drawing device, characterized in that: The device comprises: The relationship determination module is configured to execute and obtain original task node information, and determine the superior-subordinate relationship between the task nodes based on the original task node information; the task node is a task to be executed in the project, and the original task node information includes: each task node information and its corresponding next-level task node information; the task node information includes: an in-degree port identifier and an out-degree port identifier corresponding to the task node; the in-degree port refers to the task node pointed to by the arrow of the connection line, and the out-degree port refers to the task node pointed out by the arrow of the connection line; the connection line refers to the connection line corresponding to two task nodes having a superior-subordinate relationship; A relative position determination module is configured to determine the relative position of the task nodes in the graphic drawing interface according to the superior-subordinate relationship between the task nodes; A coordinate determination module, configured to assign position coordinates to the task node according to the relative position, and obtain the coordinates of the task node in the graphic drawing interface; A drawing module is configured to draw a structure diagram of tasks to be executed for the project in the graphic drawing interface according to the coordinates of the task nodes and the superior-subordinate relationships; the structure diagram of tasks to be executed includes each task node, the connection lines between each task node, and the direction arrow from the in-degree port to the out-degree port on the connection lines.
12. The device according to claim 11, characterized in that The relationship determination module is specifically configured to execute: Based on the information of each task node and its corresponding next-level task node information, determining a connection line corresponding to two task nodes having a superior-subordinate relationship, wherein the connection line includes a starting task node and an ending task node; Storing the starting task node information and the ending task node information of the connection into a connection information set; The in-degree port identifier and out-degree port identifier corresponding to each task node are stored in the task node information set; The superior-subordinate relationship between the task nodes is determined by using the connection information set and the task node information set.
13. The device according to claim 12, characterized in that The relationship determination module is specifically configured to execute: Traversing the task nodes in the task node information set, if the in-degree port identifier and the out-degree port identifier of the traversed task node do not exist in the connection information set, storing the task node in the first data set; Traversing the links in the link information set, if the starting task node and the ending task node of the traversed link only appear once in the link information set, storing the combination of the two task nodes corresponding to the link in the second data set; Storing the links associated with the remaining task nodes in the task node information set into a third data set; The superior-subordinate relationship between task nodes is determined according to the first data set, the second data set, and the third data set.
14. The device according to claim 13, characterized in that The relationship determination module is specifically configured to execute: Determine the task nodes in the first data set as isolated task nodes that have no connection relationship with other task nodes; Determine a starting task node and an ending task node in a combination of two task nodes of the second data set as an upper-level task node and a lower-level task node, respectively; By using the starting task node and the ending task node of any link in the third data set, traversing the third data set, the superior-subordinate relationship between the task nodes corresponding to the link in the third data set is obtained, wherein: If the starting task node of any link is the same as the starting task node of any other link in the third data set, determining the ending task node of any other link as the subordinate task node of the starting task node of any link; If the starting task node of any link is the same as the ending task node of any other link in the third data set, the starting task node of any other link is determined as the upper-level task node of the starting task node of any link; If the termination task node of any of the links is the same as the start task node of any other link in the third data set, the termination task node of any other link is determined as a subordinate task node of the termination task node of any of the links; If the termination task node of any link is the same as the termination task node of any other link in the third data set, the start task node of any other link is determined as the upper-level task node of the termination task node of any link.
15. The device according to claim 14, characterized in that The device also includes: A task node acquisition module is configured to execute acquisition of multiple task nodes of the same level and independent task nodes of different levels from other task nodes; The fourth data set determination module is configured to execute storing the plurality of task nodes of the same level and the independent task nodes into a fourth data set.
16. The device according to claim 15, characterized in that The relative position determination module is specifically configured to execute: Determine the positional relationship of each task node in the first data set in the graphic drawing interface as a horizontal parallel relationship; Determine the positional relationship of each upper-level task node in the second data set in the graphic drawing interface as a horizontal parallel relationship, and determine the relative position between the upper-level task node and its corresponding lower-level task node as a vertical arrangement relationship, wherein the upper-level task node is located above the corresponding lower-level task node; The position relationship of the task nodes of the same level in the fourth data set in the graphic drawing interface is determined as a horizontal parallel relationship, and the position of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes.
17. The device according to claim 16, characterized in that The coordinate determination module is specifically configured to execute: The same ordinate value is assigned to the task nodes in the horizontal parallel relationship in the same data set, and different ordinate values are assigned according to the first preset interval distance; the same ordinate value is assigned to the task nodes in the vertical arrangement relationship in the same data set, and different ordinate values are assigned according to the second preset interval distance; For the independent task node, the vertical coordinate value of the independent task node is determined according to the superior-subordinate relationship between the independent task node and other task nodes, and the horizontal coordinate value of the independent task node is determined according to the principle of symmetry.
18. The device according to claim 17, characterized in that The coordinate determination module is specifically configured to execute: According to the principle that the task nodes in the horizontal parallel relationship are symmetrically distributed on both sides of the central axis of the graphic drawing interface, the first preset interval distance and the horizontal coordinate value between the task nodes in the horizontal parallel relationship are determined.
19. The device according to claim 17, characterized in that The coordinate determination module is specifically configured to execute: The horizontal coordinate value of the independent task node is determined on the central axis of the graphic drawing interface.
20. The device according to claim 11, characterized in that The drawing module is specifically configured to execute: Determine, according to the coordinates of the task node, a first offset of the task node from the leftmost side of the graphic drawing interface and a second offset of the task node from the topmost side of the graphic drawing interface; Rendering the task node in the graphic drawing interface according to the first offset and the second offset to obtain a UI task node, where the UI task node is a drawing display result of the task node on the graphic drawing interface; The superior-subordinate relationship of the UI task nodes is determined according to the superior-subordinate relationship of the task nodes, the UI task nodes with the superior-subordinate relationship in the graphic drawing interface are connected with lines, and arrows are added to the in-degree ports of the UI task nodes to obtain the task structure diagram to be executed of the project.
21. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the graphics drawing method according to any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute the graphics drawing method according to any one of claims 1 to 10.
23. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the graphics drawing method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Method and device for processing location information of visualized warehouse
CN102819533A
Project group management topological graph generation method, device, equipment and storage medium
CN111192342A
Method and device for drawing service dependency graph
CN113014674A