Image generation method, device and electronic device based on tree structure graph

By determining the image area range of each node in the tree structure diagram and generating neatly distributed tree structure diagrams, the problems of confusing image layout and high resource consumption in large-scale data display are solved, and efficient and beautiful data display is achieved.

CN118710768BActive Publication Date: 2024-11-01INTELLIGENT IMITATION TECHNOLOGY (ZHEJIANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411193881.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-11-01
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

When generating tree structure diagrams, it is difficult to efficiently generate neat and clear images when facing large-scale data, resulting in confusion in layout, high resource consumption, and affect efficiency and aesthetics.

Method used

By obtaining tree structure diagram data, determine the image area range of each node, and generate a tree structure diagram based on node relationships and identifications to ensure that the nodes are arranged neatly and evenly distributed, and avoid waste of resources for manpower to determine the node location.

Benefits of technology

It improves the efficiency and viewing of tree structure diagrams, ensures that the images are neat and clear, reduces resource consumption, and improves the visualization of data display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710768B_ABST
    Figure CN118710768B_ABST
Patent Text Reader

Abstract

The present specification discloses an image generation method, device and electronic device based on a tree structure diagram, which specifically includes: obtaining tree structure diagram data containing node data corresponding to each node in the tree structure diagram to be generated. According to the tree structure diagram data, for each node in the tree structure diagram to be generated, determine the image area range information corresponding to each node. Then, according to the image area range information corresponding to each node and the node identifier in the node data, generate a tree structure diagram. Through this method, a neatly arranged and evenly distributed tree structure diagram can be generated, and the overall framework of the tree structure diagram data and the relationship between each node can be displayed in a more beautiful and neat way. It effectively avoids the resource consumption and time waste when manually determining the position of each node in the tree structure diagram, effectively improves the generation efficiency of the tree structure diagram, and also improves the ornamental and visualization of the tree structure diagram.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device and electronic device for generating an image based on a tree structure diagram. Background Art

[0002] At present, tree-structured data display technology is widely used in various technical fields. Through this technology, data content with large scale and volume can be flattened into one or more neat and orderly tree structure diagrams. The clear hierarchical structure and highly visual presentation provide users with great convenience in both using and understanding the data content.

[0003] While the benefits of tree structure diagrams are so significant, it is extremely important to generate a correct and neat tree structure diagram based on the data content. At present, the means of implementing tree structure visualization for data content are mostly for some lightweight data content. When facing large-scale data, it is impossible to efficiently generate the corresponding tree structure diagram, and the generated tree structure diagram often has problems such as uneven distribution of data nodes and unbalanced distribution of data node sizes, resulting in abnormal phenomena such as chaotic layout, over-concentration or over-dispersion of data nodes, and lack of orderliness in the final displayed tree structure diagram. If the node position is determined manually, when processing large amounts of data content, it will take up a lot of human resources to determine the node position of the tree structure diagram, which seriously affects the execution efficiency and occupies a lot of resource costs, affecting the normal development of other work.

[0004] Therefore, how to efficiently generate a tree structure diagram with a neat and clear interface based on the data content is a very important issue. Summary of the invention

[0005] The present specification provides an image generation method, device and electronic device based on a tree structure diagram to partially solve the above-mentioned problems existing in the prior art.

[0006] This manual adopts the following technical solutions:

[0007] This specification provides an image generation method based on a tree structure graph, comprising:

[0008] Acquire tree structure graph data, wherein the tree structure graph data includes node data corresponding to each node in the tree structure graph to be generated corresponding to the tree structure graph data, wherein the node data corresponding to each node includes at least node relationship information for representing the parent-child relationship between each node in the tree structure graph to be generated, and a node identifier and node image area information corresponding to each node, and for any node, the node image area information of the node is used to represent the image area occupied by the node in the tree structure graph to be generated;

[0009] For each node, according to the node relationship information corresponding to the node, determine the associated node corresponding to the node, and according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, determine the image area range of the node in the tree structure diagram to be generated as the image area range information corresponding to the node, the image area range information corresponding to the node is used to characterize the size of the area range within which the image area occupied by the node in the tree structure diagram to be generated falls;

[0010] A tree structure diagram is generated according to the image area range information corresponding to each node and the node identifier corresponding to each node.

[0011] Optionally, for each node, the node image area information of the node includes a node image width and a node image height corresponding to the node in the tree structure diagram to be generated;

[0012] For each node, according to the node relationship information corresponding to the node, the associated node corresponding to the node is determined, and according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, the image area range of the node in the tree structure diagram to be generated is determined as the image area range information corresponding to the node, which specifically includes:

[0013] For each node, the image area width range of the node in the tree structure diagram to be generated is determined based on the node image width corresponding to the associated node and the node image width corresponding to the node, and the image area height range of the node in the tree structure diagram to be generated is determined based on the node image height corresponding to the associated node and the node image height corresponding to the node, and the image area width range and image area height range corresponding to the node are used as the image area range information corresponding to the node.

[0014] Optionally, for each node, according to the node image width corresponding to the associated node and the node image width corresponding to the node, determining the width range of the image region where the node is located in the tree structure diagram to be generated specifically includes:

[0015] For each node, when the node is a leaf node, the node image width corresponding to the leaf node is used as the width range of the image region where the leaf node is located in the tree structure diagram to be generated;

[0016] When the node is a non-leaf node, the child node layer width range corresponding to the non-leaf node is determined based on the image area width range corresponding to the child nodes of the non-leaf node and the preset same-layer node interval width, and the maximum value between the node image width corresponding to the non-leaf node and the child node layer width range corresponding to the non-leaf node is used as the image area width range of the node in the tree structure diagram to be generated.

[0017] Optionally, for each node, according to the node image height corresponding to the associated node and the node image height corresponding to the node, determining the image area height range of the node in the tree structure diagram to be generated specifically includes:

[0018] For each node, when the node is a root node, the node image height corresponding to the root node is used as the image area height range where the root node is located in the tree structure diagram to be generated;

[0019] When the node is not a root node, the height range of the child node layer corresponding to the parent node of the node is determined according to the node image height corresponding to the brother node of the node, and is used as the height range of the image area corresponding to the node.

[0020] Optionally, generating a tree structure diagram according to the image area range information corresponding to each node and the node identifier corresponding to each node specifically includes:

[0021] For each node except the root node in the tree structure diagram to be generated, according to the image area width range corresponding to the parent node of the node and the node image width corresponding to the parent node of the node, determine the width range offset distance of the node with respect to the parent node of the node;

[0022] For each node except the root node, the root node is used as the coordinate origin, and the horizontal coordinate corresponding to the node is determined according to the horizontal coordinate corresponding to the parent node of the node and the width range offset distance corresponding to the node, and the vertical coordinate corresponding to the node is determined according to the vertical coordinate corresponding to the parent node of the node and the image area height range corresponding to the parent node of the node, and the horizontal coordinate and the vertical coordinate corresponding to the node are used as the node coordinates corresponding to the node;

[0023] The tree structure diagram is generated by taking the root node as the coordinate origin and according to the node coordinates corresponding to each node except the root node and the node identifier corresponding to each node.

[0024] Optionally, for each node except the root node, the root node is used as the coordinate origin, and the horizontal coordinate corresponding to the node is determined according to the horizontal coordinate corresponding to the parent node of the node and the width range offset distance corresponding to the node, specifically including:

[0025] For each node except the root node, determine the node coordinate offset distance corresponding to the node according to the difference between the node image width corresponding to the node and the width range of the image area corresponding to the node;

[0026] Taking the root node as the coordinate origin, the horizontal coordinate corresponding to the node is determined according to the horizontal coordinate corresponding to the parent node of the node, the width range offset distance corresponding to the node, and the node coordinate offset distance corresponding to the node.

[0027] Optionally, for each node except the root node, taking the root node as the coordinate origin, determining the vertical coordinate corresponding to the node according to the vertical coordinate corresponding to the parent node of the node and the image area height range corresponding to the parent node of the node, specifically includes:

[0028] For each node except the root node, the root node is used as the coordinate origin, and the vertical coordinate corresponding to the node is determined according to the vertical coordinate corresponding to the parent node of the node, the image area height range corresponding to the parent node of the node, and the preset upper and lower node interval height.

[0029] This specification provides an image generation device based on a tree structure graph, comprising:

[0030] An acquisition module, used for acquiring tree structure graph data, wherein the tree structure graph data includes node data corresponding to each node in the tree structure graph to be generated corresponding to the tree structure graph data, wherein the node data corresponding to each node includes at least node relationship information for representing the parent-child relationship between each node in the tree structure graph to be generated, and a node identifier and node image area information corresponding to each node, and for any node, the node image area information of the node is used to represent the image area occupied by the node in the tree structure graph to be generated;

[0031] A determination module is used to determine, for each node, an associated node corresponding to the node according to the node relationship information corresponding to the node, and determine, according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, an image area range of the node in the tree structure diagram to be generated as the image area range information corresponding to the node, the image area range information corresponding to the node is used to characterize the size of the area range within which the image area occupied by the node in the tree structure diagram to be generated falls;

[0032] The generation module is used to generate a tree structure diagram according to the image area range information corresponding to each node and the node identifier corresponding to each node.

[0033] The present specification provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned image generation method based on a tree structure diagram is implemented.

[0034] The present specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned tree structure diagram-based image generation method when executing the program.

[0035] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0036] It can be seen from the above method that in the tree structure diagram-based image generation method provided in this specification, tree structure diagram data containing node data corresponding to each node in the tree structure diagram to be generated can be obtained, and according to the tree structure diagram data, for each node in the tree structure diagram to be generated, the image area range information corresponding to each node is determined. Then, the tree structure diagram is generated according to the image area range information corresponding to each node and the node identifier in the node data.

[0037] From the above content, it can be seen that the image generation method based on the tree structure diagram provided in this specification can determine the image area range corresponding to each node in the tree structure diagram to be generated according to the acquired tree structure diagram data, and then generate the corresponding tree structure diagram according to the image area range of each node. This method can generate a neatly arranged and evenly distributed tree structure diagram, and show the overall framework of the tree structure diagram data and the relationship between each node to the user in a more beautiful and neat way. It effectively avoids the resource consumption and time waste when actively determining the position of each node in the tree structure diagram through manpower, effectively improves the generation efficiency of the tree structure diagram, and also improves the ornamental and visualization of the tree structure diagram. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0039] Figure 1 A schematic diagram of a process of an image generation method based on a tree structure diagram provided in this specification;

[0040] Figure 2This is an example schematic diagram of a key-value pair table corresponding to a tree structure graph data provided in this specification;

[0041] Figure 3a , Figure 3b A schematic diagram of a process for determining a width range offset distance of a leftmost node in a subnode layer of a non-leaf node provided in the present application;

[0042] Figure 4a , Figure 4b A schematic diagram of an update process for a tree structure diagram provided in this specification;

[0043] Figure 5 A schematic diagram of an image generation device based on a tree structure diagram provided in this specification;

[0044] Figure 6 A method provided in this specification corresponding to Figure 1 Schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0046] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0047] Figure 1 A schematic diagram of a process of generating an image based on a tree structure diagram provided in this specification includes the following steps:

[0048] S101: Obtain tree structure diagram data.

[0049] At present, the technology of using tree structure diagrams to display data content is widely used in various technical fields due to its significant advantages of high visualization and clear hierarchical structure. However, when processing large-scale data, the tree structure diagram generated by the current tree structure diagram generation technology often has some abnormal problems such as uneven node position distribution and unreasonable node arrangement, which may cause the overall tree structure diagram to have unclear hierarchy and affect the appearance. Even if the node position and arrangement method are determined manually, the generation efficiency of the corresponding tree structure diagram will be seriously reduced when facing large amounts of data, and it will also take up a lot of human resources and time costs. Therefore, how to generate a clear and beautiful tree structure diagram based on the data content with high efficiency is a crucial issue.

[0050] To this end, this specification provides an image generation method based on a tree structure diagram, wherein the execution subject adopted by the method provided in this specification can be a terminal device such as a desktop computer, a laptop computer, or a server. In addition, the execution subject of this specification can also be a subject in the form of software, such as a client installed in a terminal device, etc. For the sake of convenience of description, this specification below only takes the terminal device as the execution subject to describe the provided image generation method based on a tree structure diagram.

[0051] Based on this, the terminal device that applies the tree structure graph-based image generation method provided in this specification can determine the image area range corresponding to each node in the tree structure graph to be generated corresponding to the tree structure graph data based on the acquired tree structure graph data, and then generate the corresponding tree structure graph based on the image area range corresponding to each node and the tree structure graph data.

[0052] Among them, the specific application scenario in which the terminal device generates a tree structure diagram based on the acquired tree structure diagram data can be determined according to the actual application needs. For example, in the field of education and learning, teaching staff can input the tree structure diagram data related to the teaching content into the terminal device, and the terminal device can determine the image area range of each node in the tree structure diagram in the tree structure diagram to be generated based on the acquired tree structure diagram data, thereby constructing a tree structure diagram with clear hierarchy and displaying it to the corresponding teaching staff. Teaching staff can quickly and clearly understand the hierarchical display in the educational content and the relationship between the levels based on the content displayed by the generated tree structure diagram, which effectively improves the efficiency and comprehensibility of the teaching plan.

[0053] For another example, in the field of biological sciences, researchers in the biological field can input the tree structure diagram data corresponding to the population relationship and classification system between various organisms into the terminal device, and the terminal device can generate a tree structure diagram that can clearly show the population relationship between various organisms based on the acquired tree structure diagram data. Both researchers and other non-professionals can clearly know the hierarchical relationship and distribution between various biological populations by observing the generated tree structure diagram, which provides favorable help for understanding and handling complex biological population relationships.

[0054] In this specification, the terminal device can obtain the tree structure diagram data input by the user, and the tree structure diagram data includes the node data corresponding to each node in the tree structure diagram to be generated. The node data corresponding to each node may at least include the node relationship information used to represent the parent-child relationship between each node in the tree structure diagram to be generated, as well as the node identification and node image area information corresponding to each node. Among them, for any node in the tree structure diagram to be generated, the node image area information of the node is used to represent the image area occupied by the node in the tree structure diagram to be generated. Specifically, it may include the node image width and node image height corresponding to the node in the tree structure diagram to be generated.

[0055] The node relationship information mentioned above can be recorded separately in the tree structure diagram data. In order to save the data volume corresponding to the entire tree structure diagram data when the data scale is large or the number of nodes is large, the parent-child relationship between each node can also be reflected in the form of nested data in this manual.

[0056] Specifically, for each node in the tree structure diagram to be generated, the node data corresponding to each node may at least include the node identifier corresponding to the node (similar to the node name, ID, etc.), the node image area information of the node in the tree structure diagram to be generated (the node image width and node image height mentioned above), and the node data corresponding to the single or multiple child nodes corresponding to the node.

[0057] The above data format can be understood as that the node data corresponding to the nodes except the root node in the tree structure diagram to be generated will be embedded in the node data of the parent node to which it belongs, and the overall tree structure diagram data can be simply understood as the node data corresponding to the root node in the tree structure diagram to be generated. The node data of the root node not only includes the node identification and node image area information of the root node, but also includes the node data corresponding to the single or multiple child nodes corresponding to the root node. And so on, until the leaf node in the tree structure diagram to be generated. It should be noted that the leaf nodes in the tree structure diagram do not have corresponding child nodes, so the child node data in the node data corresponding to the leaf nodes can be empty or not stored.

[0058] In order to facilitate understanding of the specific data representation of the above nested tree structure data, the following uses the JSON data format (JavaScript Object Notation, JSON) as an example to illustrate the nested tree structure data. Assume that the tree structure diagram to be generated contains a root node root, the node image width is 10, and the node image height is 30. The root node root corresponds to two child nodes, namely child node i and child node k, and the node image width and node image height are the same as the root node root. The child node i of the root node root also corresponds to a child node i1, and the node image width and node image height are also the same as the root node root.

[0059] The tree structure data corresponding to the tree structure diagram can be represented in JSON data format as follows:

[0060] {

[0061] "id": "root",

[0062] "width": 10,

[0063] "height": 30,

[0064] "children": [

[0065] {

[0066] "id": "i",

[0067] "width": 10,

[0068] "height": 30,

[0069] "children": [

[0070] {

[0071] "id": "i1",

[0072] "width": 10,

[0073] "height": 30

[0074] } ]

[0076] }

[0077] {

[0078] "id": "k",

[0079] "width": 10,

[0080] "height": 30

[0081] } ]

[0083] }

[0084] As shown above, id can be used to represent the node identifier in the node data, width can be used to represent the node image width in the node image area information, height can be used to represent the node image height in the node image area information, and children can be used to represent the node data corresponding to the child node. The tree structure graph data in JSON data format contains the node data of the root node root, and the node data of the root node root contains the node data corresponding to each child node (node ​​i and node k), and the node data of node i contains the node data corresponding to the child node i1 of node i. Through the nested inclusion relationship of the tree structure graph data like the above, the parent-child relationship between the nodes in the tree structure graph to be generated can be clearly reflected, and the data volume of the tree structure graph data can be effectively reduced to a certain extent.

[0085] It should be noted that the tree structure diagram data in the above-mentioned JSON data format is only used for example description to reflect the nested representation between parent and child node data in the tree structure diagram data. The specific data format of the tree structure diagram data is not strictly limited in this specification and can be flexibly set according to the actual application scenario.

[0086] In addition, based on the above content, in order to make the tree structure diagram data in nested form more convenient for subsequent data processing and data acquisition, the terminal device can use the node identifier in the node data as the key (key) and the node data as the value (value) to establish a key-value pair table (Key-value) corresponding to the tree structure diagram data in nested form. The node data corresponding to each node in the tree structure diagram to be generated in the key-value pair table may only include the node identifier and the node image area information (node ​​image width and node image height), and may not include the node data of the corresponding child node, but may add a node identifier corresponding to the parent node of the current node to represent the association relationship between the parent and child nodes.

[0087] In order to facilitate understanding of the specific expression of the corresponding key-value pair table generated according to the nested tree structure data, based on the tree structure data example in JSON data format in the above steps, a key-value pair representation corresponding to the tree structure data is used for explanation, as shown in the following figure: Figure 2 shown.

[0088] Figure 2This is an example schematic diagram of a key-value pair table corresponding to a tree structure graph data provided in this specification.

[0089] like Figure 2 As shown in , the terminal device can convert the tree structure graph data corresponding to the tree structure graph with the root node root to be generated in the above example into a corresponding key-value pair table, that is, Figure 2 The node information query table in . The node ID of each node is used as the key and the corresponding node data is used as the value. Figure 2 In the key-value pair table shown, the node data of the node root can be determined by querying the key root. The terminal device can also record the node identifier corresponding to the parent node of other nodes except the root node as the node relationship information representing the parent-child node relationship in the value, that is, Figure 2 The "parentid" shown in .

[0090] Through the data format conversion in the above steps, the terminal device can flatly convert the tree structure diagram data in the form of nested data into a query table for the corresponding node data of the tree structure diagram to be generated, and also write the relationship information between parent and child nodes into the corresponding node data, effectively improving the efficiency of determining the node image area information corresponding to each subsequent node.

[0091] S102: For each node, determine the associated node corresponding to the node based on the node relationship information corresponding to the node, and determine the image area range of the node in the tree structure diagram to be generated based on the node image area information corresponding to the associated node and the node image area information corresponding to the node, as the image area range information corresponding to the node.

[0092] In this specification, for each node in the tree structure diagram to be generated, the terminal device can determine the parent node, child node and brother node corresponding to the node according to the node relationship information corresponding to the node in the tree structure diagram data, as the associated node corresponding to the node. At the same time, the terminal device can determine the image area range of the node in the tree structure diagram to be generated according to the node image area information corresponding to the node and the node image area information corresponding to the associated node of the node, as the image area range information corresponding to the node. The image area range information corresponding to each node is used to characterize the size of the area range in which the image area occupied by the node in the tree structure diagram to be generated falls, which can be simply understood as that the image area range of the node is not less than the node image area corresponding to the node itself, so that in the subsequent process, it can be ensured that the node itself and the descendant nodes will not have the problem of node image overlap due to the arrangement layout.

[0093] Among them, for each node in the tree structure diagram to be generated, the image area range information may specifically include the image area width range and image area height range of the node in the tree structure diagram to be generated. Regarding the determination of the image area width range, the terminal device may determine the image area width range of the node in the tree structure diagram to be generated based on the node image width corresponding to the node and the node image width corresponding to the node associated with the node.

[0094] Specifically, in this specification, the process of determining the image area width range can be divided into two different situations according to the node type of the node. For each node in the tree structure diagram to be generated, when the node is a leaf node (a node without child nodes in the tree structure diagram), the terminal device can use the node image width corresponding to the leaf node as the image area width range corresponding to the node in the tree structure diagram to be generated.

[0095] When the node is a non-leaf node (a node with at least one child node in the tree structure diagram), the terminal device can determine the child node layer width range corresponding to the non-leaf node based on the image area width range corresponding to the child nodes of the non-leaf node and the preset spacing distance between nodes in the same layer. Then, the terminal device can use the maximum value between the node image width corresponding to the non-leaf node and the child node layer width range corresponding to the non-leaf node as the image area width range of the node in the tree structure diagram to be generated. The above-mentioned child node layer width range can be specifically used to characterize the occupied area width range of the child node layer where the child nodes of the non-leaf node are located, and can specifically be the sum of the image area width ranges corresponding to each child node.

[0096] The specific process of determining the width range of the image area corresponding to each of the above nodes can refer to the following formula:

[0097]

[0098]

[0099] Among them, for each node, Used to represent the width of the image area of ​​the node. Used to indicate the number of child nodes of this node. Used to indicate that the node The width range of the image area corresponding to the child nodes, It is used to indicate the width range of the node's child node layer. The width of the node image used to represent the node. Used to indicate the preset spacing width between nodes on the same layer.

[0100] It can be seen from the above formula that when the node has no child nodes, that is, the node is a leaf node in the tree structure diagram to be generated, the terminal device can directly set the node image width of the node to As the width of the image area of ​​this node , and the width range of the sub-node layer corresponding to the node When the node has at least one child node, it means that the node is a non-leaf node in the tree structure diagram. The terminal device can The preset width of the interval between nodes on the same layer , determine the width range of the sub-node layer corresponding to the node , that is, Then, the terminal device can select the node image width of the node The width range of the sub-node layer corresponding to this node The maximum value among the two is used as the image area width range of the node .

[0101] In addition, in the present specification, while determining the width range of the image area corresponding to each node, the terminal device can also determine, for each node in the tree structure diagram to be generated, the image area height range of the node in the tree structure diagram to be generated based on the node image height corresponding to the node and the node image height corresponding to the associated node of the node.

[0102] Similar to the above-mentioned image area width range determination process, regarding the image area height range corresponding to the node, there are two cases according to the position of the node in the tree structure diagram. For each node in the tree structure diagram to be generated, when the node is a root node, the terminal device can directly use the node image height corresponding to the root node as the image area height range where the root node is located in the tree structure diagram to be generated.

[0103] When the node is not the root node, but any node other than the root node in the tree structure diagram to be generated, the terminal device can determine the height range of the child node layer corresponding to the parent node of the node based on the node image height of the node and the node image height of the node's sibling nodes, and use it as the image area height range corresponding to the node. Specifically, it can be the maximum value of the node image height of the node and the node's sibling nodes. The child node layer height range is similar to the above-mentioned child node layer width range, and is used to represent the height range of the occupied area of ​​the child node layer where the child nodes of each non-leaf node are located.

[0104] The specific process of determining the height range of the sub-node layer corresponding to each non-leaf node can refer to the following formula:

[0105]

[0106] Among them, for each non-leaf node, The node image height used to represent each child node of the node. ≥1, It is used to indicate the height range of the node's child nodes, that is, the maximum value of the node image height of each child node of the node. The height range of the image area that can be used as the child node of the non-leaf node.

[0107] In addition, after determining the image area width range corresponding to each node and the child node layer height range corresponding to each non-leaf node through the above steps, the terminal device can record each image area width range and each child node layer height range in the value of the corresponding node in the key-value pair table determined in the above steps, that is, record them in the corresponding node data, to facilitate the subsequent generation of a tree structure diagram.

[0108] For ease of understanding, the example mentioned in the above steps is still used as an example to illustrate that the terminal device can set the image area width range corresponding to each node The height range of the child node layer corresponding to the non-leaf nodes root and i Stored in the corresponding node data in the key-value pair. Because the leaf nodes in the tree structure diagram have no child nodes, there is no need to determine the height range of the child nodes of the leaf nodes. The height range of the image area corresponding to it corresponds to the height range of the child nodes in the parent node. In the example, it is represented as leaf nodes k and i1 have no corresponding child node height range , and the corresponding child node layer height range in the parent node It can be expressed as the height range of the image area corresponding to the node itself.

[0109] S103: Generate a tree structure diagram according to the image area range information corresponding to each node and the node identifier corresponding to each node.

[0110] In this specification, after the above steps, the terminal device can construct a tree structure diagram corresponding to the tree structure diagram data according to the image area range information corresponding to each node and the node identifier corresponding to each node.

[0111] It should be noted in advance that in the present specification, the node image corresponding to each node in the tree structure diagram can be a square structure image, and no matter whether it is the width range offset distance, the node coordinate offset distance or the finally determined node coordinates mentioned in the subsequent process, they can all be determined relative to the upper left corner position of the node image corresponding to each node, that is, the upper left corner vertex corresponding to the square structure node image.

[0112] Regarding the generation process of the tree structure diagram, specifically, the terminal device can determine the width range offset distance of the node relative to the parent node of the node according to the image area width range corresponding to the node and the node image width corresponding to the parent node of the node for each node in the tree structure diagram to be generated except the root node. The so-called width range offset distance can be specifically understood as the width distance and offset direction between the image area width range occupied by the child node in the tree structure diagram to be generated and the node image width actually occupied by the node image corresponding to its parent node.

[0113] It should be noted that the width range of the image area of ​​a child node may be larger than the node image width of the child node itself. The width range offset distance determined here is not the offset distance between the node image width actually occupied by the node image of the child node and the parent node. Therefore, in the subsequent process, it is also necessary to determine the node coordinate offset distance between the node image width and the image area width range for a single node.

[0114] Specifically, the terminal device can use each non-leaf node in the tree structure diagram to be generated as the horizontal axis origin of the child node of the non-leaf node, and then for the leftmost node in the child node layer where the child node of each non-leaf node is located, when the image area width range corresponding to the non-leaf node is greater than the node image width corresponding to the non-leaf node, it means that the width occupied by the descendant nodes of the non-leaf node is greater than the node image width of the non-leaf node. The terminal device can determine the width range offset distance of the leftmost node in the child node layer for the non-leaf node based on the width difference between the image area width range corresponding to the non-leaf node and the node image width corresponding to the non-leaf node.

[0115] When the width range of the image area corresponding to the non-leaf node is equal to the node image width corresponding to the non-leaf node, it means that the width occupied by the descendant nodes of the non-leaf node is not greater than the node image width of the non-leaf node. The terminal device can determine the width range offset distance of the leftmost node in the sub-node layer with respect to the non-leaf node based on the width difference between the sub-node layer width range corresponding to the non-leaf node and the node image width corresponding to the non-leaf node.

[0116] For each non-leftmost node in the child node layer where the child nodes of each non-leaf node are located, the terminal device can determine the width range offset distance of the non-leftmost node relative to the parent node on the horizontal axis with the parent node as the origin based on the preset node interval width in the same layer, the width range offset distance corresponding to the left adjacent node of the non-leftmost node, and the image area width range corresponding to the left adjacent node of the node.

[0117] The specific determination process of the width range offset distance in various situations can be specifically referred to the following formula:

[0118]

[0119] Among them, for each node except the root node in the tree structure diagram, It is used to indicate the width range offset distance of each node in the tree structure diagram to be generated relative to the parent node on the horizontal axis with the parent node as the origin. It is used to indicate the order of the node in the sub-node layer. The order of sub-nodes can be defaulted to the order in the tree structure data. , it indicates that the node is the leftmost node in the child node layer. Used to indicate the width range of the image area corresponding to the parent node of this node. Used to indicate the width range of the child node layer corresponding to the parent node of the node. The width of the node image corresponding to the parent node of this node.

[0120] The first two lines of the above formulas correspond to the process of determining the width range offset distance of the leftmost node in the child node layer. When the image area width range of the parent node is Node image width larger than the parent node , that is, the width range of the image area of ​​the parent node Equal to the width range of the child node layer corresponding to the parent node When the terminal device can set the image area width range of the parent node Node image width relative to parent node The negative value of half of the width difference is used as the width range offset distance of the leftmost node. .

[0121] When the parent node image width Equal to the width of the image area of ​​the parent node , which means the width range of the image area of ​​the parent node Greater than the width range of the child node layer corresponding to the parent node When the terminal device can set the width range of the child node layer corresponding to the parent node Node image width relative to parent node Half of the width difference between the two is used as the width range offset distance of the leftmost node .

[0122] In order to facilitate understanding of the determination process and formula principle of the width range offset distance of the leftmost node in the sub-node layer in the above process, the following is a schematic diagram of the determination process of the width range offset distance of the leftmost node in the sub-node layer for explanation, such as Figure 3a , Figure 3b as shown in .

[0123] Figure 3a , Figure 3b This is a schematic diagram of a process for determining a width range offset distance of a leftmost node in a subnode layer of a non-leaf node provided in the present application.

[0124] like Figure 3a As shown, when the image area width of the parent node is Node image width larger than the parent node When the image area width of the parent node is Equal to the width range of the child node layer corresponding to the parent node The leftmost node in the subnode layer is Figure 3a The child node 1 in the horizontal axis is located in the negative direction of the horizontal axis compared to the parent node in the horizontal axis with the left side of the parent node as the origin, so the image area width range of the parent node can be Node image width relative to parent node The negative value of half of the width difference is used as the offset distance of child node 1 relative to the width range of the parent node in the horizontal axis with the parent node as the origin. .

[0125] like Figure 3b As shown, when the node image width of the parent node Equal to the width of the image area of ​​the parent node When the width range of the child node layer corresponding to the parent node is Is smaller than the node image width of the parent node The leftmost node in the child node layer is Figure 3b The child node 1 in the horizontal axis is located in the positive direction of the horizontal axis compared to the parent node in the horizontal axis with the left side of the parent node as the origin. Therefore, the width range of the child node layer corresponding to the parent node can be Node image width relative to parent node Half of the width difference is directly used as the width offset distance of child node 1 relative to the parent node in the horizontal axis with the left side of the parent node as the origin. .

[0126] Regarding the third line of formula in the above formula, this formula is used to represent a formula for determining the width range offset distance corresponding to each non-leftmost node of the child node layer. It is used to indicate the width range offset distance of the adjacent node on the left side of the node. It is used to represent the width of the image area of ​​the node adjacent to the left side of the node. It is used to represent the preset width interval of nodes in the same layer. Through this formula, the terminal device can determine the offset distance of each non-leftmost node in the child node layer from the left to the right on the horizontal axis with the parent node as the origin compared to the width range of the parent node. .

[0127] At this point, the terminal device can determine the width range offset distance of each node in the tree structure diagram except the root node relative to the parent node one by one through the above steps. The root node is a special non-leaf node in the tree structure diagram and does not have a corresponding parent node. Therefore, there is no need to determine the width range offset distance corresponding to the root node.

[0128] In addition, similar to the above steps, the terminal device can also store the width range offset distance corresponding to each node in the key-value pair table corresponding to the tree structure diagram data determined by the above steps, so as to facilitate data query and use in subsequent processes.

[0129] After determining the width range offset distance corresponding to each node except the root node in the tree structure diagram to be generated through the above steps, the terminal device can use the root node in the tree structure diagram to be generated as the coordinate origin of the coordinate axis, and establish a plane rectangular coordinate system with the horizontal right direction of the root node as the positive direction of the horizontal axis and the vertical downward direction of the root node as the positive direction of the vertical axis.

[0130] Then, for each node except the root node, the terminal device can use the root node as the coordinate origin, and determine the horizontal coordinate corresponding to the node according to the horizontal coordinate corresponding to the parent node of the node and the width range offset distance corresponding to the node. At the same time, the terminal device can determine the vertical coordinate corresponding to the node according to the vertical coordinate corresponding to the parent node of the node and the image area height range corresponding to the parent node of the node. Then, the terminal device can use the horizontal and vertical coordinates of the node as the node coordinates corresponding to the node in the tree structure diagram to be generated, that is, the coordinate position of the upper left corner vertex of the node image mentioned in the above steps, and generate a tree structure diagram based on the coordinate origin of the root node and the node coordinates and node identifiers corresponding to each node except the root node.

[0131] Specifically, regarding the process of determining the horizontal coordinate corresponding to each node except the root node, the terminal device can determine the node coordinate offset distance corresponding to the node based on the width difference between the node image width corresponding to the node and the width range of the image area corresponding to the node. Then, the terminal device can determine the horizontal coordinate of the node based on the horizontal coordinate of the parent node of the node, the width range offset distance of the node, and the node coordinate offset distance corresponding to the node. Among them, regarding the process of determining the node coordinate offset distance, it is divided into two different situations according to the size relationship between the image area width range corresponding to the node and the node image width. Specifically, it can be as follows:

[0132]

[0133]

[0134] Among them, for each node except the root node, Used to indicate the width range of the image area corresponding to the node. Used to indicate the width of the node image corresponding to the node. It is used to indicate the node coordinate offset distance corresponding to the node. Used to represent the horizontal coordinate of the parent node of this node. Used to indicate the width range offset distance of the node determined by the above steps.

[0135] It is not difficult to see from the above formula that when the image area width range corresponding to the node Equal to the node image width corresponding to the node When the node coordinate offset distance corresponding to the node is 0, the terminal device can determine that the node coordinate offset distance corresponding to the node is 0, that is, there is no need to calculate the offset distance. Greater than the node image width corresponding to the node In this case, the node needs to determine the real coordinate position and image area width range in addition. The offset distance between the left boundary positions of the corresponding virtual area range, the terminal device can adjust the image area width range With node image width Half of the difference between the two is used as the node coordinate offset distance of the node .

[0136] In the above formula Used to represent the horizontal coordinate of the node, which can be determined by offsetting the width range of the node , the horizontal coordinate of the parent node of the node And the node coordinate offset distance corresponding to the node Add and sum.

[0137] The above content is the process of determining the horizontal axis coordinates in the node coordinates. Regarding the process of determining the vertical coordinates, the terminal device can use the root node as the coordinate origin for each node except the root node, and determine the vertical coordinate corresponding to the node based on the vertical coordinate corresponding to the node, the image area height range of the node's parent node, and the preset upper and lower node interval height.

[0138] Specifically, in this specification, the process of determining the vertical coordinate can be divided into two different situations according to the different positions of the nodes in the tree structure diagram.

[0139] First, one is each child node of the root node in the tree structure diagram. Such nodes have a direct parent-child relationship with the root node. As mentioned in the above process, the height range of the image area of ​​the root node is the height of its own node image. For each child node of the root node, the terminal device can determine the vertical coordinate corresponding to each child node of the root node according to the node image height corresponding to the root node and the preset upper and lower node height intervals.

[0140] Secondly, the other is other nodes except the root node and the child nodes of the root node in the tree structure diagram. The parent node of such nodes is not the root node, and all of them have corresponding grandparent nodes. For each node except the root node and the child nodes of the root node in the tree structure diagram, the terminal device can determine the corresponding vertical coordinate of the node according to the vertical coordinate of the parent node of the node, the image area height range corresponding to the parent node of the node (that is, the child node layer height range of the grandparent node), and the preset upper and lower layer node height intervals.

[0141] Regarding the determination process of the above node ordinate, please refer to the following formula:

[0142]

[0143] Among them, for each node except the root node, Indicates the vertical coordinate corresponding to the node. The height of the node image used to represent the root node. Used to indicate the preset upper and lower node height intervals. It means that when the parent node of the node is not the root node, the vertical coordinate of the parent node is It is used to indicate the height range of the child node layer corresponding to the grandparent node of the node, that is, the height range of the image area corresponding to the parent node of the node or the maximum value of the node image height in the child node layer where the parent node of the node is located.

[0144] When the parent node of the node is the root node, that is, the node is the child node of the root node, the terminal device can Height interval between upper and lower nodes When the parent node of the node is not the root node, that is, the node is not a child node of the root node, the terminal device can use the parent node of the node as the vertical coordinate of the node. , the height range of the child node layer of the node's grandparent node (the height range of the image area corresponding to the node's parent node) And the height interval between the upper and lower nodes The sum of the values ​​is taken as the vertical coordinate of the node.

[0145] So far, the node coordinates corresponding to each node except the root node in the tree structure diagram to be generated are determined. Then, the terminal device can use the root node as the coordinate origin, and render and generate a tree structure diagram corresponding to the tree structure diagram data according to the node coordinates and corresponding node identifiers corresponding to each node except the root node.

[0146] Specifically, the terminal device can arrange and combine the node images of each node in an orderly manner according to the node coordinates corresponding to each node and the node image width and node image height corresponding to each node, and finally render the corresponding tree structure diagram. Among them, the node data corresponding to each node can also include other types of node content data, such as text, images, hyperlinks, etc. After determining the overall architecture of the tree structure diagram, the terminal device can display the node content data corresponding to each node in the node image. The specific data content and type of the node content data are not strictly limited in this specification and can be flexibly set according to the actual application scenario.

[0147] In addition, the terminal device can store the generated tree structure diagram in a preset storage space for subsequent reuse. In addition, the terminal device can also monitor the tree structure diagram data. If it is detected that the node data in the tree structure diagram data has changed, such as changing the width or height of the node image, deleting or adding a node, etc., the terminal device can update the tree structure diagram accordingly according to the changed tree structure diagram data.

[0148] Specifically, when it is determined based on the updated tree structure diagram data that a node in the tree structure diagram has been subjected to a node image width change, for each node whose node image width is changed except the root node, the updated tree structure diagram data is used to determine the updated image area range corresponding to the node, all predecessor nodes of the node, all nodes to the right of the node in the node layer, and all descendant nodes of all nodes to the right of the node in the node layer, and then the corresponding updated node coordinates are determined, and the tree structure diagram is updated according to the updated coordinates.

[0149] When it is determined based on the updated tree structure diagram data that the nodes in the tree structure diagram have been subjected to node image height change, similarly, for each node whose node image height is changed except the root node, the updated tree structure diagram data is used to determine the updated image area range of the node, all nodes in the node layer where the child nodes of the node are located, and all descendant nodes of all nodes in the node layer where the child nodes of the node are located, and the corresponding updated node coordinates are also determined, and the tree structure diagram is updated according to the updated coordinates.

[0150] In order to facilitate understanding of the above-mentioned updating process for the tree structure diagram, the following is an explanation with a schematic diagram of the updating process of the tree structure diagram, such as Figure 4a , Figure 4b as shown in .

[0151] Figure 4a , Figure 4b This is a schematic diagram of an update process for a tree structure diagram provided in this specification.

[0152] Figure 4a It is used to indicate the update process of the tree structure diagram when the width of the node image corresponding to the node in the tree structure diagram changes. Among them, the node image filled with dark color is used to indicate the node whose node image width changes in the node data. When the node image width of the node changes, the terminal device can update the node and all the predecessor nodes of the node (such as Figure 4a The image area range of all nodes to the right of the node and all descendant nodes of all nodes to the right of the node in the node layer are re-determined ( Figure 4a In the example, all grid-filled nodes are retrieved, and the display position of the node image of the corresponding node in the tree structure diagram is readjusted according to the corresponding updated node coordinates to update the tree structure diagram.

[0153] Figure 4b It is used to indicate the update process of the tree structure diagram when the width of the node image corresponding to the node in the tree structure diagram changes. Figure 4b The node image filled with a dark color is used to represent the node whose node image height has changed in the node data. When the node image height of the node changes, the terminal device can redefine the image area range of the node, all nodes of the node layer where the node's child nodes are located, and all descendant nodes of all nodes of the node layer where the node's child nodes are located ( Figure 4b In the example, all grid-filled nodes are retrieved, and the display position of the node image of the corresponding node in the tree structure diagram is readjusted according to the corresponding updated node coordinates to update the tree structure diagram.

[0154] Through the above-mentioned updating process for the tree structure diagram, the terminal device can adjust the image area range of some nodes to achieve the update of the entire tree structure diagram, which effectively improves the updating efficiency of the tree structure diagram when the tree structure diagram data changes.

[0155] In addition, in this specification, considering that the tree structure diagram data may sometimes be too large in size, each data calculation for a single node will more or less affect the generation efficiency of the overall tree structure diagram. Therefore, in this specification, the terminal device can pre-set a node threshold for the number of nodes in a single node layer. When it is determined that the number of nodes in the same layer exceeds the set node threshold based on the acquired tree structure diagram data, if the pre-device conditions permit, the terminal device can perform multi-threaded processing calculations on the nodes in the same layer that exceed the set node threshold, thereby effectively improving the generation efficiency of the overall tree structure diagram.

[0156] From the above content, it can be seen that the image generation method based on the tree structure diagram provided in this specification can determine the image area range corresponding to each node in the tree structure diagram to be generated according to the acquired tree structure diagram data, and then generate the corresponding tree structure diagram according to the image area range of each node. The method provided in this specification can generate a neatly arranged and evenly distributed tree structure diagram, and show the overall framework of the tree structure diagram data and the connection relationship between each node to the user in a more beautiful and neat way. It avoids the resource consumption and time waste when determining the node position by manpower, and effectively improves the generation efficiency of the tree structure diagram.

[0157] The above are one or more implementation methods of this specification. Based on the same idea, this specification also provides corresponding devices, such as Figure 5 shown.

[0158] Figure 5 A schematic diagram of an image generation device based on a tree structure diagram provided in this specification, comprising:

[0159] The acquisition module 501 is used to acquire tree structure diagram data, wherein the tree structure diagram data includes node data corresponding to each node in the tree structure diagram to be generated corresponding to the tree structure diagram data, wherein the node data corresponding to each node includes at least node relationship information for indicating the parent-child relationship between each node in the tree structure diagram to be generated, and a node identifier and node image area information corresponding to each node. For any node, the node image area information of the node is used to indicate the image area occupied by the node in the tree structure diagram to be generated;

[0160] A determination module 502 is used to determine, for each node, an associated node corresponding to the node according to the node relationship information corresponding to the node, and determine, according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, an image area range of the node in the tree structure diagram to be generated as the image area range information corresponding to the node, the image area range information corresponding to the node is used to represent the size of the area range within which the image area occupied by the node in the tree structure diagram to be generated falls;

[0161] The generating module 503 is used to generate a tree structure diagram according to the image area range information corresponding to each node and the node identifier corresponding to each node.

[0162] Optionally, for each node, the node image area information of the node includes a node image width and a node image height corresponding to the node in the tree structure diagram to be generated;

[0163] The determination module 502 is specifically used to determine, for each node, the image area width range of the node in the tree structure diagram to be generated based on the node image width corresponding to the associated node and the node image width corresponding to the node, and determine the image area height range of the node in the tree structure diagram to be generated based on the node image height corresponding to the associated node and the node image height corresponding to the node, and use the image area width range and image area height range corresponding to the node as the image area range information corresponding to the node.

[0164] Optionally, the determination module 502 is specifically used to, for each node, when the node is a leaf node, use the node image width corresponding to the leaf node as the image area width range of the leaf node in the tree structure diagram to be generated; when the node is a non-leaf node, determine the child node layer width range corresponding to the non-leaf node based on the image area width range corresponding to the child nodes of the non-leaf node and the preset same-layer node interval width, and use the maximum value between the node image width corresponding to the non-leaf node and the child node layer width range corresponding to the non-leaf node as the image area width range of the node in the tree structure diagram to be generated.

[0165] Optionally, the determination module 502 is specifically used to, for each node, when the node is a root node, use the node image height corresponding to the root node as the image area height range of the root node in the tree structure diagram to be generated; when the node is not a root node, determine the child node layer height range corresponding to the parent node of the node based on the node image height corresponding to the node's brother nodes, and use it as the image area height range corresponding to the node.

[0166] Optionally, the generation module 503 is specifically used to determine, for each node except the root node in the tree structure diagram to be generated, the width range offset distance of the node relative to the parent node of the node according to the image area width range corresponding to the parent node of the node and the node image width corresponding to the parent node of the node; for each node except the root node, taking the root node as the coordinate origin, determining the horizontal coordinate corresponding to the node according to the horizontal coordinate corresponding to the parent node of the node and the width range offset distance corresponding to the node, and determining the vertical coordinate corresponding to the node according to the vertical coordinate corresponding to the parent node of the node and the image area height range corresponding to the parent node of the node, and using the horizontal and vertical coordinates corresponding to the node as the node coordinates corresponding to the node; taking the root node as the coordinate origin, generating the tree structure diagram according to the node coordinates corresponding to each node except the root node and the node identifier corresponding to each node.

[0167] Optionally, the generation module 503 is specifically used to determine, for each node except the root node, a node coordinate offset distance corresponding to the node based on a width difference between a node image width corresponding to the node and a width range of an image area corresponding to the node; taking the root node as the coordinate origin, determining the horizontal coordinate corresponding to the node based on the horizontal coordinate corresponding to the parent node of the node, the width range offset distance corresponding to the node, and the node coordinate offset distance corresponding to the node.

[0168] Optionally, the generation module 503 is specifically used to determine, for each node except the root node, the vertical coordinate corresponding to the node based on the root node as the coordinate origin, the vertical coordinate corresponding to the parent node of the node, the image area height range corresponding to the parent node of the node, and the preset upper and lower node interval height.

[0169] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 The provided image generation method is based on a tree structure graph.

[0170] This manual also provides Figure 6 The one shown corresponds to Figure 1 A schematic diagram of the electronic device. Figure 6 As shown, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The image generation method based on the tree structure diagram.

[0171] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0172] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0173] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0174] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0175] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0176] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0177] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0178] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0179] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0180] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0181] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0182] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0183] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0184] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0185] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0186] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A method for generating an image based on a tree structure graph, characterized in that: include: Acquire tree structure graph data, wherein the tree structure graph data includes node data corresponding to each node in the tree structure graph to be generated corresponding to the tree structure graph data, wherein the node data corresponding to each node includes at least node relationship information for representing the parent-child relationship between each node in the tree structure graph to be generated, and a node identifier and node image area information corresponding to each node, and for any node, the node image area information of the node is used to represent the image area occupied by the node in the tree structure graph to be generated; For each node, according to the node relationship information corresponding to the node, determine the associated node corresponding to the node, and according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, determine the image area range of the node in the tree structure diagram to be generated as the image area range information corresponding to the node, the image area range information corresponding to the node is used to characterize the size of the area range within which the image area occupied by the node in the tree structure diagram to be generated falls; A tree structure diagram is generated according to the image area range information corresponding to each node and the node identifier corresponding to each node.

2. The method according to claim 1, characterized in that For each node, the node image region information of the node includes the node image width and the node image height corresponding to the node in the tree structure diagram to be generated; For each node, according to the node relationship information corresponding to the node, the associated node corresponding to the node is determined, and according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, the image area range of the node in the tree structure diagram to be generated is determined as the image area range information corresponding to the node, which specifically includes: For each node, the image area width range of the node in the tree structure diagram to be generated is determined based on the node image width corresponding to the associated node and the node image width corresponding to the node, and the image area height range of the node in the tree structure diagram to be generated is determined based on the node image height corresponding to the associated node and the node image height corresponding to the node, and the image area width range and image area height range corresponding to the node are used as the image area range information corresponding to the node.

3. The method according to claim 2, characterized in that For each node, according to the node image width corresponding to the associated node and the node image width corresponding to the node, determine the image area width range of the node in the tree structure diagram to be generated, specifically including: For each node, when the node is a leaf node, the node image width corresponding to the leaf node is used as the width range of the image region where the leaf node is located in the tree structure diagram to be generated; When the node is a non-leaf node, the child node layer width range corresponding to the non-leaf node is determined based on the image area width range corresponding to the child nodes of the non-leaf node and the preset same-layer node interval width, and the maximum value between the node image width corresponding to the non-leaf node and the child node layer width range corresponding to the non-leaf node is used as the image area width range of the node in the tree structure diagram to be generated.

4. The method according to claim 2, characterized in that For each node, according to the node image height corresponding to the associated node and the node image height corresponding to the node, determine the image area height range of the node in the tree structure diagram to be generated, specifically including: For each node, when the node is a root node, the node image height corresponding to the root node is used as the image area height range where the root node is located in the tree structure diagram to be generated; When the node is not a root node, the height range of the child node layer corresponding to the parent node of the node is determined according to the node image height corresponding to the brother node of the node, and is used as the height range of the image area corresponding to the node.

5. The method according to claim 2, characterized in that According to the image area range information corresponding to each node and the node identifier corresponding to each node, a tree structure diagram is generated, which specifically includes: For each node except the root node in the tree structure diagram to be generated, according to the image area width range corresponding to the parent node of the node and the node image width corresponding to the parent node of the node, determine the width range offset distance of the node with respect to the parent node of the node; For each node except the root node, the root node is used as the coordinate origin, and the horizontal coordinate corresponding to the node is determined according to the horizontal coordinate corresponding to the parent node of the node and the width range offset distance corresponding to the node, and the vertical coordinate corresponding to the node is determined according to the vertical coordinate corresponding to the parent node of the node and the image area height range corresponding to the parent node of the node, and the horizontal coordinate and the vertical coordinate corresponding to the node are used as the node coordinates corresponding to the node; The tree structure diagram is generated by taking the root node as the coordinate origin and according to the node coordinates corresponding to each node except the root node and the node identifier corresponding to each node.

6. The method according to claim 5, characterized in that For each node except the root node, the root node is used as the coordinate origin, and the horizontal coordinate corresponding to the node is determined according to the horizontal coordinate corresponding to the parent node of the node and the width range offset distance corresponding to the node, specifically including: For each node except the root node, determine the node coordinate offset distance corresponding to the node according to the difference between the node image width corresponding to the node and the width range of the image area corresponding to the node; Taking the root node as the coordinate origin, the horizontal coordinate corresponding to the node is determined according to the horizontal coordinate corresponding to the parent node of the node, the width range offset distance corresponding to the node, and the node coordinate offset distance corresponding to the node.

7. The method according to claim 5, characterized in that For each node except the root node, taking the root node as the coordinate origin, determining the vertical coordinate corresponding to the node according to the vertical coordinate corresponding to the parent node of the node and the image area height range corresponding to the parent node of the node, specifically including: For each node except the root node, the root node is used as the coordinate origin, and the vertical coordinate corresponding to the node is determined according to the vertical coordinate corresponding to the parent node of the node, the image area height range corresponding to the parent node of the node, and the preset upper and lower node interval height.

8. An image generation device based on a tree structure graph, characterized in that: include: An acquisition module, used for acquiring tree structure graph data, wherein the tree structure graph data includes node data corresponding to each node in the tree structure graph to be generated corresponding to the tree structure graph data, wherein the node data corresponding to each node includes at least node relationship information for representing the parent-child relationship between each node in the tree structure graph to be generated, and a node identifier and node image area information corresponding to each node, and for any node, the node image area information of the node is used to represent the image area occupied by the node in the tree structure graph to be generated; A determination module is used to determine, for each node, an associated node corresponding to the node according to the node relationship information corresponding to the node, and determine, according to the node image area information corresponding to the associated node and the node image area information corresponding to the node, an image area range of the node in the tree structure diagram to be generated as the image area range information corresponding to the node, the image area range information corresponding to the node is used to characterize the size of the area range within which the image area occupied by the node in the tree structure diagram to be generated falls; The generation module is used to generate a tree structure diagram according to the image area range information corresponding to each node and the node identifier corresponding to each node.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method described in any one of claims 1 to 7 is implemented.