CN102467535B - Method, device and system for acquiring tree data output coordinate - Google Patents

Method, device and system for acquiring tree data output coordinate Download PDF

Info

Publication number
CN102467535B
CN102467535B CN201010542307.6A CN201010542307A CN102467535B CN 102467535 B CN102467535 B CN 102467535B CN 201010542307 A CN201010542307 A CN 201010542307A CN 102467535 B CN102467535 B CN 102467535B
Authority
CN
China
Prior art keywords
tree data
node
output area
data node
described tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201010542307.6A
Other languages
Chinese (zh)
Other versions
CN102467535A (en
Inventor
李馥龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201010542307.6A priority Critical patent/CN102467535B/en
Publication of CN102467535A publication Critical patent/CN102467535A/en
Application granted granted Critical
Publication of CN102467535B publication Critical patent/CN102467535B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention is applicable to the technical field of computers and provides a method, a device and a system to output the graphic. The method comprises the following steps of: receiving a coordinate calculation instruction of a tree data node output area, wherein the instruction carries tree data; acquiring position information of each tree data node output area in the tree data, and determining a coordinate of each tree data node output area according to the position information; and outputting coordinate information comprising the tree data node output area graphic of the tree data. The problem that the size and position of a tree data graph output area cannot be customized and are not compact is solved, and a user can simply and conveniently customize graph output of the tree data; therefore, the output tree data is more compact, and a space occupied by the output tree data is effectively reduced.

Description

A kind of Graphics Output Method of tree data, Apparatus and system
Technical field
The invention belongs to field of computer technology, relate in particular to a kind of Graphics Output Method, Apparatus and system of tree data.
Background technology
Conventionally tree data use be similar to window explorer indentation list represent form, or adopt naturally from top and under tree-shaped outward appearance, can show intuitively hierarchical relationship, comprise, gather the application scenarioss such as relation.At present, while using computer graphical interface to carry out the tree-shaped outward appearance of output display, be to be manually depicted as picture by instrument, write as the static Html page, or use the function of the insertion figure of similar Word to carry out the graphical interfaces output of tree data.But, in enterprise's application scenarios, as ERP system, data are unpredictable, need to dynamically complete by computer program graphic plotting and the output of tree data, use tree data figure output area size, the position of existing method output to customize, not compact.
Summary of the invention
The object of the embodiment of the present invention is to provide a kind of Graphics Output Method, Apparatus and system of tree data, be intended to solve due in enterprise's application scenarios, data are unpredictable, need to dynamically complete by computer program graphic plotting and the output of tree data, use tree data figure output area size, the position of existing method output to customize, not compact problem.
The embodiment of the present invention is achieved in that a kind of Graphics Output Method of tree data, and described method comprises the steps:
The coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Obtain the positional information of each tree type data node output area in described tree data, according to described positional information, determine the coordinate of each tree data node output area, described positional information is the height, width of tree data node output area, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area;
Output packet is containing the tree data node output area figure of described tree data;
According to described positional information, determine that the step of the coordinate of each tree data node output area specifically comprises the steps:
The postorder traversal that described tree data is set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
When complete described tree data postorder traversal time, the preorder traversal that described tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area;
The described postorder traversal that described tree data is set, obtains the width of tree data node output area and the pitch information with brotgher of node output area, determines that the step of the horizontal ordinate of this tree data node output area comprises step:
According to described output area width and with the pitch information of brotgher of node output area, determine the boundary set of described tree data node and the initial horizontal coordinate of output area, described boundary set comprises the border of described tree data node, and the border of the every one deck of described tree data descendant of node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
In the time there is the left brotgher of node in described tree data node, according to the boundary set of the boundary set of described tree data node and its left brotgher of node merging body, to merge take described tree data node as the subtree of root node with take its left brotgher of node as the subtree of root node, upgrade the horizontal ordinate of tree data node after merging;
The step of determining the boundary set of described tree data node and the horizontal ordinate of output area comprises step:
In the time that described tree data node is leaf node, determine the boundary set of described tree data node, described boundary set only comprises the border of described tree data node, if the width of described tree data node output area is k, the left margin of described tree data node output area is 0, right margin is k, and the horizontal ordinate of described tree data node output area is 0;
In the time that described tree data node is not leaf node, determine the boundary set of described tree data node, the boundary set of described tree data node comprises the border of described tree data node, and the border of every one deck of described tree data descendant of node, if the width of described tree data node output area is k, the left margin of the ground floor of described tree data descendant of node is l, right margin is r, (r-l) is the width of the ground floor output area of described tree data descendant of node, the horizontal ordinate of described tree data node output area is l+ (r-l)/2-k/2, the left margin of described tree data node output area is l+ (r-l)/2-k/2, right margin is l+ (r-l)/2+k/2.
Another object of the embodiment of the present invention is to provide a kind of figure output unit of tree data, and described device comprises:
Coordinate computations receiving element, for the coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Output area coordinate determining unit, for obtaining the positional information of each tree type data node output area of tree data, according to described positional information, determine the coordinate of each tree data node output area, described positional information is the height, width of tree data node output area, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area; And
Unit for output packet containing the tree data node output area figure of described tree data,
Wherein, described output area coordinate determining unit specifically comprises:
Horizontal ordinate determining unit, for the postorder traversal that tree data is set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in postorder traversal; And
Ordinate determining unit, when completing the postorder traversal to described tree data when horizontal ordinate determining unit, the preorder traversal that described tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in preorder traversal;
Described horizontal ordinate determining unit comprises:
Initial horizontal coordinate determining unit, for according to the output area width of tree data node and with the pitch information of brotgher of node output area, determine the boundary set of this tree data node and the initial horizontal coordinate of output area, described boundary set comprises the border of described tree data node, and the border of the every one deck of described tree data descendant of node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal; And
Horizontal ordinate updating block, for in the time there is the left brotgher of node in tree data node, according to the boundary set of the boundary set of described tree data node and its left brotgher of node merging body, to merge take described tree data node as the subtree of root node with take its left brotgher of node as the subtree of root node, upgrade merge after the horizontal ordinate of tree data node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
Wherein, described initial horizontal coordinate determining unit determines that the boundary set of tree data node and the initial horizontal coordinate of output area comprise:
In the time that described tree data node is leaf node, determine the boundary set of described tree data node, described boundary set only comprises the border of described tree data node, if the width of described tree data node output area is k, the left margin of described tree data node output area is 0, right margin is k, and the horizontal ordinate of described tree data node output area is 0;
In the time that described tree data node is not leaf node, determine the boundary set of described tree data node, the boundary set of described tree data node comprises the border of described tree data node, and the border of every one deck of described tree data descendant of node, if the width of described tree data node output area is k, the left margin of the ground floor of described tree data descendant of node is l, right margin is r, (r-l) is the width of the ground floor output area of described tree data descendant of node, the horizontal ordinate of described tree data node output area is l+ (r-l)/2-k/2, the left margin of described tree data node output area is l+ (r-l)/2-k/2, right margin is l+ (r-l)/2+k/2.
Another object of the embodiment of the present invention is to provide a kind of graphical output system of tree data, and described system comprises the figure output unit of tree data, and described device comprises:
Coordinate computations receiving element, for the coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Output area coordinate determining unit, for obtaining the positional information of each tree type data node output area of tree data, according to described positional information, determine the coordinate of each tree data node output area, described positional information is the height, width of tree data node output area, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area; And
Unit for output packet containing the tree data node output area figure of described tree data,
Wherein, described output area coordinate determining unit specifically comprises:
Horizontal ordinate determining unit, for the postorder traversal that tree data is set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in postorder traversal; And
Ordinate determining unit, when completing the postorder traversal to described tree data when horizontal ordinate determining unit, the preorder traversal that described tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in preorder traversal;
Described horizontal ordinate determining unit comprises:
Initial horizontal coordinate determining unit, for according to the output area width of tree data node and with the pitch information of brotgher of node output area, determine the boundary set of this tree data node and the initial horizontal coordinate of output area, described boundary set comprises the border of described tree data node, and the border of the every one deck of described tree data descendant of node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal; And
Horizontal ordinate updating block, for in the time there is the left brotgher of node in tree data node, according to the boundary set of the boundary set of described tree data node and its left brotgher of node merging body, to merge take described tree data node as the subtree of root node with take its left brotgher of node as the subtree of root node, upgrade merge after the horizontal ordinate of tree data node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
Wherein, described initial horizontal coordinate determining unit determines that the boundary set of tree data node and the initial horizontal coordinate of output area comprise:
In the time that described tree data node is leaf node, determine the boundary set of described tree data node, described boundary set only comprises the border of described tree data node, if the width of described tree data node output area is k, the left margin of described tree data node output area is 0, right margin is k, and the horizontal ordinate of described tree data node output area is 0;
In the time that described tree data node is not leaf node, determine the boundary set of described tree data node, the boundary set of described tree data node comprises the border of described tree data node, and the border of every one deck of described tree data descendant of node, if the width of described tree data node output area is k, the left margin of the ground floor of described tree data descendant of node is l, right margin is r, (r-l) is the width of the ground floor output area of described tree data descendant of node, the horizontal ordinate of described tree data node output area is l+ (r-l)/2-k/2, the left margin of described tree data node output area is l+ (r-l)/2-k/2, right margin is l+ (r-l)/2+k/2.
The embodiment of the present invention is in the time receiving the coordinate computations of tree data node output area, obtain the positional information of the output area of each tree type data node of tree data in instruction, according to the positional information of obtaining, thereby determine the coordinate of the figure output area of each tree data node, overcome tree data figure output area size, position cannot customize, not compact problem, make the user can be simple, customize easily the figure output of tree data, make the tree data of output compacter, effectively reduce the space that the tree data of output takies.
Accompanying drawing explanation
Fig. 1 is the realization flow figure of the Graphics Output Method of the tree data that provides of first embodiment of the invention;
Fig. 2 is the realization flow figure of the Graphics Output Method of the tree data that provides of second embodiment of the invention;
Fig. 3 a, Fig. 3 b, Fig. 3 c and Fig. 3 d are the instantiation figure of the Graphics Output Method of the tree data that provides of third embodiment of the invention;
Fig. 4 is the structural drawing of the figure output unit of the tree data that provides of fourth embodiment of the invention.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
The embodiment of the present invention is in the time receiving the coordinate computations of tree data node output area, obtain the positional information of the output area of each tree type data node of tree data in instruction, according to the positional information of obtaining, thereby determine the coordinate of the figure output area of each tree data node, overcome tree data figure output area size, position cannot customize, not compact problem, make the user can be simple, customize easily the figure output of tree data, make the tree data of output compacter, effectively reduce the space that the tree data of output takies.
The embodiment of the present invention provides a kind of Graphics Output Method of tree data, and described method comprises the steps:
The coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Obtain the positional information of each tree type data node output area in described tree data, according to described positional information, determine the coordinate of each tree data node output area;
Output packet is containing the tree data node output area figure of described tree data.
The embodiment of the present invention also provides a kind of figure output unit of tree data, and described device comprises:
Coordinate computations receiving element, for the coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Output area coordinate determining unit, for obtaining the positional information of each tree type data node output area of tree data, according to described positional information, determines the coordinate of each tree data node output area; And
Unit for output packet containing the tree data node output area figure of described tree data.
The embodiment of the present invention also provides a kind of graphical output system of tree data, and described system comprises the figure output unit of tree data, and described device comprises:
Coordinate computations receiving element, for the coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Output area coordinate determining unit, for obtaining the positional information of each tree type data node output area of tree data, according to described positional information, determines the coordinate of each tree data node output area; And
Unit for output packet containing the tree data node output area figure of described tree data.
The embodiment of the present invention is in the time receiving the coordinate computations of tree data node output area, obtain the positional information of the output area of each tree type data node of tree data in instruction, according to the positional information of obtaining, thereby determine the coordinate of each tree data node output area, overcome existing tree data and exported the problem that cannot customize, make user can customize simply, easily the output of tree data, the tree data of output is compacter, has effectively reduced the space that the tree data of output takies.
Below in conjunction with specific embodiment, specific implementation of the present invention is described in detail:
embodiment mono-:
Fig. 1 shows the realization flow of the Graphics Output Method of the tree data that first embodiment of the invention provides, and details are as follows:
The coordinate computations of S101, sink tree graphic data node output area, this instruction carries tree data;
In embodiments of the present invention, data represent with the form of tree form data structure, node in tree data comprises the information of its child node and father node, and in concrete implementation process, coordinate computations and the tree data of tree data node output area also can separately receive.
The positional information of each tree type data node output area in tree data in the instruction that S102, obtaining step S101 receive, according to described positional information, determines the coordinate of each tree data node output area;
In embodiments of the present invention, can obtain according to the kind of data in tree data node or its positional information of its output area for No. ID, positional information comprises the height of tree data node output area, width, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area, for example, the height of the node output area of same division data, width is identical, the height of the output area of different division datas, width is all different, thereby the data to different departments are distinguished, positional information can be stored with the form of configuration file or database table in advance.
In concrete implementation process, can, by tree data being traveled through to the coordinate of determining each tree data node output area, not invent in order to limit this at this, for example, adopt postorder traversal to determine the horizontal ordinate of tree data, adopt preorder traversal to determine the ordinate of tree data.
In embodiments of the present invention, adopt postorder traversal to determine the horizontal ordinate of tree data, adopt preorder traversal to determine in the ordinate process of tree data, first the postorder traversal of tree data being set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, this tree data node is the tree data node of accessing in tree data process described in postorder traversal.
When complete tree data postorder traversal time, the preorder traversal that tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area, this tree data node is the tree data node of accessing in preorder traversal tree data process.
S103, output packet are containing tree data and tree data node output area coordinate information thereof.
In embodiments of the present invention, by obtaining the positional information of each tree type data node output area of tree data, the height of the tree data node output area comprising according to positional information, width, with the spacing of brotgher of node output area, and with the interlamellar spacing information of father node output area, by traveling through the coordinate of determining each tree data node figure output area.
embodiment bis-:
Fig. 2 shows the realization flow of the Graphics Output Method of the tree data that second embodiment of the invention provides, and details are as follows:
In step S201, postorder traversal tree data, the tree data node in access traverse tree graphic data process;
In embodiments of the present invention, receiving after the coordinate computations of tree data node output area, by the process of postorder traversal tree data, the tree data node of access is processed.
In step S202, obtain the positional information of this tree data node output area, this tree data node is the tree data node of accessing in postorder traversal tree data process;
In embodiments of the present invention, can obtain according to the kind of data in tree data node or its positional information of its output area for No. ID, positional information comprises the height of tree data node output area, width, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area, for example, the height of the node output area of same division data, width is identical, the height of the output area of different division datas, width is all different, thereby the data to different departments are distinguished, positional information can be stored with the form of configuration file or database table in advance.
In step S203, detect whether tree data node is leaf node, when for leaf node, perform step S204, otherwise execution step S205;
In embodiments of the present invention, can whether exist left and right subtree to determine whether this node is leaf node by detecting this tree data node.
In step S204, boundary set and the horizontal ordinate of this tree data node of initialization, if the width of tree data node output area is k, the left margin of this tree data node output area is 0, right margin is k, and the initialization horizontal ordinate of this tree data node output area is 0;
In embodiments of the present invention, the width value of the tree data node output area obtaining according to step S202 carries out initialization to the boundary set of this tree data leaf node, boundary set comprises the border of tree data node, and the border of the every one deck of tree data descendant of node, border comprises left margin and right margin, represent respectively the horizontal ordinate of single or multiple tree data node output area left margins and the horizontal ordinate of right margin, merge the border of body for merging the left margin of leftmost tree data node output area in body, and the right margin of rightmost tree data node output area in merging body.In the time that tree data node is leaf node, its boundary set only includes the border of himself.
In step S205, the boundary set of this tree data node of initialization, the border that its boundary set comprises each straton node and the border of himself, if the width of this tree data node output area is k, the left margin of the ground floor of this tree data descendant of node is l, right margin is r, (r-l) is the width of the ground floor output area of this tree data descendant of node, the relative horizontal ordinate of this tree data node output area is l+ (r-l)/2-k/2, the left margin of this tree data node output area is l+ (r-l)/2-k/2, right margin is l+ (r-l)/2+k/2.
In step S206, detect this tree data node and whether have the left brotgher of node, exist the left brotgher of node to perform step S207, otherwise execution step S209;
In step S207, this tree data node is merged in the merging body at left brotgher of node place;
In embodiments of the present invention, this tree data node is merged in the merging body at left brotgher of node place, can there is various ways, can fix the subtree take this tree data node as root node, the arbitrary subtree of subtree with its left brotgher of node merging body place, mobile loose subtree, in embodiments of the present invention, the left brotgher of node of fixing this tree data node merges the subtree at body place, the subtree moving to right take this tree data node as root node, until all nodes do not overlap, spacing between node arranges according to the spacing of the brotgher of node output area obtaining.In concrete implementation process, can be according to two subtrees that merge, or every one deck boundary set of subtree and merging body calculates mobile distance.
In step S208, according in merging process, the moving direction of subtree and displacement, the horizontal ordinate of tree data node output area in the subtree moving in the merging body boundary set after the tree data node of renewal access and its left brotgher of node merge and merging process;
In embodiments of the present invention, this tree data node is merged to its left brotgher of node and merge after body, the horizontal ordinate of all nodes in mobile subtree is added to mobile distance, thereby obtain the new horizontal ordinate of the child node of this tree data node.
In step S209, detect whether the postorder traversal of tree data is completed, be to perform step S210, otherwise execution step S201;
In embodiments of the present invention, detect whether the postorder traversal of tree data is completed, can judge access tree data node whether there is father node, if there is father node, postorder traversal not yet completes, if there is not father node, the tree data node that can draw access is the root node of tree, traversal completes, thereby finishes whole traversal of tree.
In step S210, the preorder traversal of the breadth First that tree data is set, determines the ordinate of tree data node output area in preorder traversal tree data process;
In embodiments of the present invention, after the postorder traversal of the depth-first to tree data completes, the preorder traversal of the breadth First that this tree data is set, according to the height of tree data node output area in the every one deck of this tree data and with the interlamellar spacing of its father node output area, add the height of access tree layer, thereby obtain the ordinate of this tree data node output area.
In step S211, output is comprised to tree data and tree data node output area coordinate information.
In embodiments of the present invention, by tree data being carried out to the postorder traversal of depth-first, the boundary set of initialization access node and horizontal ordinate in ergodic process, when detecting that it exists after the left brotgher of node, merged in the merging body of left sibling, upgrade boundary set and the horizontal ordinate of this node, thereby complete determining of horizontal ordinate to tree data output area, finally pass through the preorder traversal of the breadth First of tree, according to the height of the number form back end output area of the every one deck of tree data and with the interlamellar spacing of father node, obtain the height of this tree layer, thereby determine the ordinate of tree data node output area.
One of ordinary skill in the art will appreciate that all or part of step realizing in above-described embodiment method is can carry out the hardware that instruction is relevant by program to complete, described program can be stored in a computer read/write memory medium, described storage medium, as ROM/RAM, disk, CD etc.
embodiment tri-:
According to embodiment mono-, two, Fig. 3 a, Fig. 3 b, Fig. 3 c, Fig. 3 d show the instantiation of the Graphics Output Method of the tree data that third embodiment of the invention provides, and details are as follows:
Fig. 3 a, Fig. 3 b have described Node B and have merged to the process of its brotgher of node A, in embodiments of the present invention, in order to be illustrated more clearly in this process, the width of supposing each node is all 100, spacing between the brotgher of node is 0, node output area is a rectangular area, and the summit in the upper left corner that the horizontal ordinate of node output area is rectangular area adopts the mode moving to right to realize the merging of node.
Fig. 3 a has described Node B and has joined its left brotgher of node A position relationship of node before, and now, the boundary set of node A, B and horizontal ordinate are as shown in table 1 the 2nd row, and wherein the boundary set of A comprises the border of himself, and the border of its each layer of offspring.[50,150] are the border of node A, and [0,200] is the border of the ground floor descendent node of node A, and [50,250] are the border of the second layer descendent node of node A, and the horizontal ordinate of node A is 50.Node B is leaf node, therefore only includes the border [0,100] of himself, and horizontal ordinate is 0, and now node A, B not yet merge.
Fig. 3 b has described Node B and has joined the position relationship of its left brotgher of node A posterior nodal point, and now, the boundary set of node A, B and horizontal ordinate are as shown in table 1 the 3rd row, and boundary set and the horizontal ordinate of A are constant.Because Node B is leaf node, its boundary set is the set that only includes itself border, is updated to the boundary set that comprises [150,250], now, an interim merging body AB boundary set of node A, B merging generation is { [50,250], [0,200], [50,250] }, wherein [50,250] are the boundary value of node A, B place layer, [0,200] is for merging body AB ground floor offspring's border, [50,250] for merging body AB second layer offspring's border, because node has moved to right 150, its horizontal ordinate becomes 150.
Table 1:
Table 2:
Fig. 3 c shows node C and merges to the process that its brotgher of node B place merges body, and Fig. 3 d has described node C and merged to the position relationship that its brotgher of node B place merges body posterior nodal point.In embodiments of the present invention, fixing to merge, in body AB, tree data node is as the subtree of root node, and therefore its boundary set and relative horizontal ordinate are all constant.Because node C is not leaf node, by traveling through after its three child nodes, the initialization boundary set of C node comprises himself border [100,200], with and the border [0,300] of node C offspring ground floor, the relative horizontal ordinate of node C is 100, as shown in table 2 the 2nd row.When detecting it, node C there is the left brotgher of node, trial merges to while merging body AB, should consider that self and its child node all can not superpose with the node that merges each layer of body AB, now can determine the distance moving to right by the border of each node layer of two parts relatively merging, the concrete boundary set of body AB and the boundary set of node C of relatively merging, the boundary set that merges body AB is { [50, 250], [0, 200], [50, 250] }, the boundary set of node C is { [100, 200], [0, 300] }, by the border of the corresponding sublayer of the subtree that relatively merges, can obtain egress C need to move to right 150 just not can with merge body AB stack, and the child node of node C need to move to right 200 just not can with merge the stack of body AB ground floor child node, therefore the subtree take node C as root node need to move to right and 200 just can complete merging, the node correlation attribute value of tree after merging is as shown in table 2 the 3rd row.After merging, the relative horizontal ordinate of C is: 300, and the boundary set of the merging body ABC after node A, B, C merge is { [50,400], [0,500], [50,250] }, also needs the horizontal ordinate of the child node to node C to upgrade after merging.
embodiment tetra-:
Fig. 4 shows the structure of the figure output unit of the tree data that fourth embodiment of the invention provides, and for convenience of explanation, only shows the part relevant to the embodiment of the present invention.
This position calculating apparatus can be for ERP system, or has the application system of figure outgoing position computing function, for example, in drafting system, can be the software unit that runs on these systems, also can be used as independently suspension member and is integrated in these systems, wherein:
The coordinate computations of coordinate computations receiving element 41 sink tree graphic data node output areas, this instruction carries tree data; Output area coordinate determining unit 42 is obtained the positional information of each tree type data node output area in tree data, determine the coordinate of each tree data node output area, output area coordinate determining unit 42 is specifically made up of horizontal ordinate determining unit 421 and ordinate determining unit 422;
Horizontal ordinate determining unit 421, for the postorder traversal that tree data is set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, this tree data node is the tree data node of accessing in tree data process described in postorder traversal.Horizontal ordinate determining unit 421 specifically can be made up of initial horizontal coordinate determining unit and horizontal ordinate updating block, wherein:
Initial horizontal coordinate determining unit according to the output area width of tree data node and with the pitch information of brotgher of node output area, determine the boundary set of this tree data node and the initial horizontal coordinate of output area, this boundary set comprises the border of described tree data node, and the border of the every one deck of described tree data descendant of node, this tree data node is the tree data node of accessing in postorder traversal tree data process;
Horizontal ordinate updating block is in the time there is the left brotgher of node in tree data node, according to the boundary set of the boundary set of tree data node and its left brotgher of node merging body, merge by the subtree take tree data node as root node with take its left brotgher of node as the subtree of root node, the horizontal ordinate that upgrades tree data node after merging, this tree data node is the tree data node of accessing in postorder traversal tree data process;
Ordinate determining unit 422 is in the time that horizontal ordinate determining unit 421 completes the postorder traversal to tree data, the preorder traversal that tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area, this tree data node is the tree data node of accessing in preorder traversal tree data process.
Coordinate output unit 43 output packets are containing the coordinate information of tree data and tree data node output area thereof.
Above are only system embodiment of the present invention, the function of its each unit, as described in above-mentioned embodiment of the method, does not repeat them here, but not in order to limit the present invention.
The embodiment of the present invention is in the time receiving the coordinate computations of tree data node output area, obtain the positional information of the output area of each tree type data node of tree data in instruction, by the postorder traversal of tree, determine the horizontal ordinate of tree data output area, finally pass through the preorder traversal of the breadth First of tree, obtain the ordinate of tree data node output area, thereby obtain the coordinate of tree data node figure output area, overcome tree data figure output area size, position cannot customize, not compact problem, make the user can be simple, customize easily the figure output of tree data, make the tree data of output compacter, effectively reduce the space that the tree data of output takies.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.

Claims (3)

1. a Graphics Output Method for tree data, is characterized in that, described method comprises the steps:
The coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Obtain the positional information of each tree type data node output area in described tree data, according to described positional information, determine the coordinate of each tree data node output area, described positional information is the height, width of tree data node output area, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area;
Output packet is containing the tree data node output area figure of described tree data;
According to described positional information, determine that the step of the coordinate of each tree data node output area specifically comprises the steps:
The postorder traversal that described tree data is set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
When complete described tree data postorder traversal time, the preorder traversal that described tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area;
The described postorder traversal that described tree data is set, obtains the width of tree data node output area and the pitch information with brotgher of node output area, determines that the step of the horizontal ordinate of this tree data node output area comprises step:
According to described output area width and with the pitch information of brotgher of node output area, determine the boundary set of described tree data node and the initial horizontal coordinate of output area, described boundary set comprises the border of described tree data node, and the border of the every one deck of described tree data descendant of node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
In the time there is the left brotgher of node in described tree data node, according to the boundary set of the boundary set of described tree data node and its left brotgher of node merging body, to merge take described tree data node as the subtree of root node with take its left brotgher of node as the subtree of root node, upgrade the horizontal ordinate of tree data node after merging;
The step of determining the boundary set of described tree data node and the horizontal ordinate of output area comprises step:
In the time that described tree data node is leaf node, determine the boundary set of described tree data node, described boundary set only comprises the border of described tree data node, if the width of described tree data node output area is k, the left margin of described tree data node output area is 0, right margin is k, and the horizontal ordinate of described tree data node output area is 0;
In the time that described tree data node is not leaf node, determine the boundary set of described tree data node, the boundary set of described tree data node comprises the border of described tree data node, and the border of every one deck of described tree data descendant of node, if the width of described tree data node output area is k, the left margin of the ground floor of described tree data descendant of node is l, right margin is r, (r-l) is the width of the ground floor output area of described tree data descendant of node, the horizontal ordinate of described tree data node output area is l+ (r-l)/2-k/2, the left margin of described tree data node output area is l+ (r-l)/2-k/2, right margin is l+ (r-l)/2+k/2.
2. a figure output unit for tree data, is characterized in that, described device comprises:
Coordinate computations receiving element, for the coordinate computations of sink tree graphic data node output area, described instruction carries tree data;
Output area coordinate determining unit, for obtaining the positional information of each tree type data node output area of tree data, according to described positional information, determine the coordinate of each tree data node output area, described positional information is the height, width of tree data node output area, spacing with brotgher of node output area, and with the interlamellar spacing of father node output area; And
Unit for output packet containing the tree data node output area figure of described tree data,
Wherein, described output area coordinate determining unit specifically comprises:
Horizontal ordinate determining unit, for the postorder traversal that tree data is set, obtain the width of tree data node output area and the pitch information with brotgher of node output area, determine the horizontal ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in postorder traversal; And
Ordinate determining unit, when completing the postorder traversal to described tree data when horizontal ordinate determining unit, the preorder traversal that described tree data is set, according to tree data node output area height, with the interlamellar spacing information of father node output area, determine the ordinate of this tree data node output area, described tree data node is the tree data node of accessing in tree data process described in preorder traversal;
Described horizontal ordinate determining unit comprises:
Initial horizontal coordinate determining unit, for according to the output area width of tree data node and with the pitch information of brotgher of node output area, determine the boundary set of this tree data node and the initial horizontal coordinate of output area, described boundary set comprises the border of described tree data node, and the border of the every one deck of described tree data descendant of node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal; And
Horizontal ordinate updating block, for in the time there is the left brotgher of node in tree data node, according to the boundary set of the boundary set of described tree data node and its left brotgher of node merging body, to merge take described tree data node as the subtree of root node with take its left brotgher of node as the subtree of root node, upgrade merge after the horizontal ordinate of tree data node, described tree data node is the tree data node of accessing in tree data process described in postorder traversal;
Wherein, described initial horizontal coordinate determining unit determines that the boundary set of tree data node and the initial horizontal coordinate of output area comprise:
In the time that described tree data node is leaf node, determine the boundary set of described tree data node, described boundary set only comprises the border of described tree data node, if the width of described tree data node output area is k, the left margin of described tree data node output area is 0, right margin is k, and the horizontal ordinate of described tree data node output area is 0;
In the time that described tree data node is not leaf node, determine the boundary set of described tree data node, the boundary set of described tree data node comprises the border of described tree data node, and the border of every one deck of described tree data descendant of node, if the width of described tree data node output area is k, the left margin of the ground floor of described tree data descendant of node is l, right margin is r, (r-l) is the width of the ground floor output area of described tree data descendant of node, the horizontal ordinate of described tree data node output area is l+ (r-l)/2-k/2, the left margin of described tree data node output area is l+ (r-l)/2-k/2, right margin is l+ (r-l)/2+k/2.
3. a graphical output system for tree data, is characterized in that, described system comprises the figure output unit of tree data claimed in claim 2.
CN201010542307.6A 2010-11-12 2010-11-12 Method, device and system for acquiring tree data output coordinate Active CN102467535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010542307.6A CN102467535B (en) 2010-11-12 2010-11-12 Method, device and system for acquiring tree data output coordinate

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010542307.6A CN102467535B (en) 2010-11-12 2010-11-12 Method, device and system for acquiring tree data output coordinate

Publications (2)

Publication Number Publication Date
CN102467535A CN102467535A (en) 2012-05-23
CN102467535B true CN102467535B (en) 2014-07-09

Family

ID=46071178

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010542307.6A Active CN102467535B (en) 2010-11-12 2010-11-12 Method, device and system for acquiring tree data output coordinate

Country Status (1)

Country Link
CN (1) CN102467535B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106445931B (en) * 2015-08-04 2019-06-28 阿里巴巴集团控股有限公司 Database node incidence relation methods of exhibiting and device
CN106294686B (en) * 2016-08-05 2021-04-02 董涛 Method for rapidly updating tree node position coordinates in thought guide graph applied to computer technical field
CN108319991B (en) * 2017-01-16 2021-02-09 航天信息股份有限公司 Node engineering wiring diagram determining method and device
CN108153826B (en) * 2017-12-07 2021-10-22 北京大学 Method and system for comparing hierarchical structure data in visual form based on bar code tree
CN108536837B (en) * 2018-04-13 2022-04-01 上海渠杰信息科技有限公司 Knowledge tree generation method, device, equipment and storage medium
CN111581534B (en) * 2020-05-22 2022-12-13 哈尔滨工程大学 Rumor propagation tree structure optimization method based on consistency of vertical place
CN112003729B (en) * 2020-07-25 2022-12-27 苏州浪潮智能科技有限公司 Heterogeneous cloud platform resource topology display method, system, terminal and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1983257A (en) * 2006-05-11 2007-06-20 华为技术有限公司 Method and system for demonstrating data by tree-mode structure
CN101042643A (en) * 2006-03-24 2007-09-26 国际商业机器公司 Method and device for regulating graphical user interface
CN101063972A (en) * 2006-04-28 2007-10-31 国际商业机器公司 Method and apparatus for enhancing visuality of image tree

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101042643A (en) * 2006-03-24 2007-09-26 国际商业机器公司 Method and device for regulating graphical user interface
CN101063972A (en) * 2006-04-28 2007-10-31 国际商业机器公司 Method and apparatus for enhancing visuality of image tree
CN1983257A (en) * 2006-05-11 2007-06-20 华为技术有限公司 Method and system for demonstrating data by tree-mode structure

Also Published As

Publication number Publication date
CN102467535A (en) 2012-05-23

Similar Documents

Publication Publication Date Title
CN102467535B (en) Method, device and system for acquiring tree data output coordinate
US10319125B2 (en) Method, system, and computer-readable medium for creating and laying out a graphic within an application program
US20150089355A1 (en) Graphical tile-based layout
US7750924B2 (en) Method and computer-readable medium for generating graphics having a finite number of dynamically sized and positioned shapes
JP4856237B2 (en) Declarative definitions that allow graphic designers to be reused
TWI697790B (en) Method and equipment for reuse of mixed model list items
US20160342678A1 (en) Manipulation of arbitrarily related data
CN110069257A (en) A kind of interface processing method, device and terminal
US9513783B1 (en) Determining available screen area
US11327643B2 (en) Rule-based user in interface layout rearrangement
US10261898B1 (en) Concurrent marking of location and shape changing objects
KR20190079354A (en) Partitioned space based spatial data object query processing apparatus and method, storage media storing the same
CN102566849B (en) Method and device for acquiring tree-form data drawing output positions and ERP (enterprise resource planning) system
CN106484388A (en) The implementation method of user interface and device
US11539594B2 (en) Diagramming chlid nodes with multiple parent nodes
US10559105B2 (en) Implementing interactive hierarachical chart legend data display
CN115563355A (en) Nebula Graph database query method, system, electronic device and medium
US8271458B2 (en) Construction and analysis of markup language document representing computing architecture having computing elements
CN114186155A (en) Page rendering method and device, electronic terminal and storage medium
CN102591660B (en) Method and device for constructing flash program object
CN112966481A (en) Data table display method and device
WO2011157011A1 (en) Method and apparatus for drawing topological graph
US20190317939A1 (en) Hierarchical window function
WO2022228209A1 (en) Method and apparatus for constructing visual view
US11586603B1 (en) Index sheets for robust spreadsheet-based applications

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant