Family tree rendering method and apparatus, and storage medium
Patent Information
- Application Number
- CN202610524680.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-20
- Publication Date
- 2026-10-30
AI Technical Summary
相关技术中的家族图谱中,每个家族成员对应的节点通常仅能展示家族成员的姓名、性别等基础数据信息,而家族成员的健康状态(如是否患有心血管疾病、是否有遗传病史)、行为特征(如是否酗酒、是否有法律纠纷)、关系质量(如夫妻关系是否疏远、是否存在暴力倾向)等大量数据信息无法在节点或连线上直观呈现
[0015]本申请实施例提供的家族图谱渲染方法、装置及存储介质,通过将所述数据信息中的第一维度的数据渲染为节点的形态符号、将所述数据信息中第二维度的数据渲染为节点的形态符号的填色或/和附加标记、将所述数据信息中第三维度的数据渲染为节点的形态符号的文本标签、将所述数据信息中的第四维度的数据映射为节点的形态符号之间的连线形态,与相关技术中,家族图谱仅能展示家族成员的身份信息和家族关系相比,本申请能够将家族成员多维度数据自动映射为多样化的图形符号,并在节点和连线上直观呈现。用户无需查阅外部记录或手动添加标注,即可从家族图谱中直接获取丰富的分析信息,提高了家族图谱的分析效率和信息密度。
Smart Images

Figure CN123012219A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a family tree rendering method, apparatus, and storage medium. Background Technology
[0002] Family trees are important analytical tools in fields such as psychology, sociology, and genetics, used to display information such as blood relations and marital relationships among family members.
[0003] In related technologies, family tree rendering methods mainly focus on the layout and positioning of nodes corresponding to family members, such as using algorithms like sibling node priority sorting and hyperbolic tree projection to automatically calculate node positions. However, these technologies still have the following shortcomings: In family tree diagrams used in related technologies, the nodes corresponding to each family member typically only display basic data such as the member's name and gender. A significant amount of data, including the member's health status (e.g., whether they suffer from cardiovascular disease or have a history of genetic disorders), behavioral characteristics (e.g., whether they are alcoholics or involved in legal disputes), and relationship quality (e.g., whether their marital relationship is strained or whether they exhibit violent tendencies), cannot be visually represented on the nodes or lines. Users need to repeatedly review the original data records or manually add annotations to the diagram to complete the analysis, resulting in low efficiency in family tree analysis. Summary of the Invention
[0004] To address the aforementioned technical problems, embodiments of this application provide a family tree rendering method, apparatus, and storage medium.
[0005] In a first aspect, embodiments of this application provide a family tree rendering method, which includes: Obtain data information of each family member in the target family; the family members include at least the party concerned and at least one generation of family members associated with the party concerned, and each generation of family members includes at least one family member, and the data information includes at least one dimension of data of the corresponding family member; The center position of the node corresponding to the party is determined as the origin of the coordinate system. The center position of the node corresponding to each family member is determined according to the preset vertical positioning rule and horizontal positioning rule. The vertical positioning rule is used to indicate the distance relationship between the vertical coordinate of the center position of the node corresponding to the family member of different generations and the vertical coordinate of the origin of the coordinate system. The horizontal positioning rule is used to indicate the distance relationship between the horizontal coordinate of the center position of the node belonging to the family member of the same generation and the horizontal coordinate of the origin of the coordinate system. Based on the center position of the node corresponding to each family member and the preset mapping relationship between data information and rendering symbols, a family map of the target family is generated; the mapping relationship includes at least one of the following: rendering the data in the first dimension of the data information as the shape symbol of the node, rendering the data in the second dimension of the data information as the fill color and / or additional mark of the shape symbol of the node, rendering the data in the third dimension of the data information as the text label of the shape symbol of the node, and rendering the data in the fourth dimension of the data information as the line shape between the shape symbols of the nodes.
[0006] In some embodiments, the vertical positioning rules include: Each family member is divided into eleven vertical levels, each vertical level corresponds to an initial ordinate, and the distance between the ordinates of adjacent levels is the first distance. The eleven vertical levels are: great-grandparent level, great-grandparent siblings level, grandparent level, children of grandparents' ex-partners level, grandparent siblings level, parents siblings level, parents level, children of parents' ex-partners level, siblings level, party involved level, and party involved children level.
[0007] In some embodiments, the horizontal positioning rules include: For the party member layer in the vertical hierarchy, the x-coordinate of the center position of the node corresponding to the current spouse of the party member is the product of the gender direction coefficient and the second distance, and the x-coordinate of the center position of the node corresponding to the former spouse of the party member is the product of the gender direction coefficient, the marriage order index and the second distance; wherein, the gender direction coefficient includes male direction coefficient and female direction coefficient with equal magnitude and opposite sign; For any of the following vertical levels in the vertical hierarchy: great-grandparent siblings level, grandparent siblings level, siblings level, children of the grandparent's ex-partner, children of the parents' ex-partner, and children of the party concerned, the nodes corresponding to family members in the vertical level are sorted by age and arranged sequentially from the center position of the two nodes corresponding to the father and mother of the family members included in the current vertical level to both sides, and the distance between the horizontal coordinates of adjacent family member nodes in the current vertical level is the third distance; the third distance is less than the second distance.
[0008] In some embodiments, the text label is rendered below the morphological symbol of the corresponding node; The process of generating a family map of the target family based on the center position of the nodes corresponding to each family member and the preset mapping relationship between data information and rendering symbols includes: Traverse each of the vertical levels and update the x-coordinate of the center position of the node corresponding to each family member in each of the vertical levels according to the preset traversal rules; Based on the updated x-coordinate of the center position of the node corresponding to each family member, and the coordinate of the center position of the corresponding node, a family map of the target family is generated. The preset traversal rules are as follows: For the currently traversed vertical hierarchy, obtain the width of each node in the vertical hierarchy; the width of the node refers to the larger value between the width of the corresponding node's morphological symbol and the width of the text label. Starting from the two adjacent nodes in the vertical hierarchy, traverse the two adjacent nodes in the vertical hierarchy in turn. Based on the width of each node in the two adjacent nodes being traversed and the x-coordinate of the center position of the two adjacent nodes being traversed, determine whether there is an overlap between the two adjacent nodes being traversed. If the judgment result is yes, for nodes that overlap, the overlapping nodes are offset according to the preset offset rule; the preset offset rule is: the node on the right side of the overlapping nodes is offset to the right by a preset offset step; For the offset node, update the horizontal coordinate of the center position of the offset node according to the preset offset step size until there are no overlapping nodes in the currently traversed vertical level.
[0009] In some embodiments, the process for determining the width of the text label is as follows: Determine the width of each line of text labels in the text labels; Determine the width of the text label that has the largest width; The process for determining the width of the text label line is as follows: Obtain the Unicode range of each character in the text label line; The character type of each character is determined based on its Unicode range. Based on the character type of each character, determine the number of characters contained in each character type; The width of the text label line is determined based on the number of characters contained in each character type and the preset width coefficient of each character type.
[0010] In some embodiments, the third dimension data includes at least one of the following data types: The corresponding family members' names, ages and / or death information, occupations, key events and / or key experiences, family relationships, and remarks; The text label that renders the third-dimensional data in the data information as the morphological symbol of a node includes: The text labels are rendered line by line according to the data type in the third dimension. During the rendering process, it is determined whether the width of the currently rendered text label line is greater than the preset width. One data type corresponds to one text label line. If the width of the currently rendered text label line is greater than the preset width, then the currently rendered text label line is split into multiple lines. The splitting operation is as follows: determine whether there is a preset breakpoint character in the currently rendered text label line; if there is, split the line at the breakpoint character; if there is not, force a split at the position exceeding the preset width, and add a hyphen to the end of the split text label line.
[0011] In some embodiments, the method provided by the first aspect further includes: In response to a change in the data information of any family member, the rendering symbol of the corresponding family member is updated based on the preset mapping relationship between data information and rendering symbols.
[0012] In some embodiments, the first dimension is gender, and the morphological symbols of the nodes corresponding to family members of different genders are different; The second dimension is the medical dimension and / or behavioral characteristics dimension, with different color-filled areas and / or additional markers corresponding to family members with different diseases; The fourth dimension is the family relationship dimension, where the connection patterns between family members of different family relationships are different.
[0013] Secondly, embodiments of this application provide a family tree rendering apparatus, which includes: The acquisition module is used to acquire data information of each family member in the target family; the family members include at least the party concerned and at least one generation of family members associated with the party concerned, and each generation of family members includes at least one family member, and the data information includes at least one dimension of data of the corresponding family member; The node center position determination module is used to determine the center position of the node corresponding to the party concerned as the origin of the coordinate system, and to determine the center position of the node corresponding to each family member according to the preset vertical positioning rules and horizontal positioning rules; the vertical positioning rules are used to indicate the distance relationship between the vertical coordinate of the center position of the node corresponding to the family members of different generations and the vertical coordinate of the origin of the coordinate system, and the horizontal positioning rules are used to indicate the distance relationship between the horizontal coordinate of the center position of the node belonging to the family members of the same generation and the horizontal coordinate of the origin of the coordinate system. The rendering module is used to generate a family map of the target family based on the center position of the node corresponding to each family member and the preset mapping relationship between data information and rendering symbols; the mapping relationship includes at least one of the following: rendering the data in the first dimension of the data information as the shape symbol of the node, rendering the data in the second dimension of the data information as the fill color and / or additional mark of the shape symbol of the node, rendering the data in the third dimension of the data information as the text label of the shape symbol of the node, and rendering the data in the fourth dimension of the data information as the line shape between the shape symbols of the nodes.
[0014] In a second aspect, embodiments of this application provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method described in any one of the first aspects.
[0015] The family tree rendering method, apparatus, and storage medium provided in this application render the first dimension of the data information as node morphological symbols, the second dimension of the data information as color fills and / or additional markers for the node morphological symbols, the third dimension of the data information as text labels for the node morphological symbols, and the fourth dimension of the data information as line shapes between the node morphological symbols. Compared with related technologies, where family trees can only display the identity information and family relationships of family members, this application can automatically map multi-dimensional data of family members into diverse graphic symbols and present them intuitively on nodes and lines. Users can directly obtain rich analytical information from the family tree without consulting external records or manually adding annotations, thus improving the analysis efficiency and information density of the family tree.
[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are merely embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort, and this application can be applied to other similar scenarios based on the provided drawings.
[0018] Figure 1 A flowchart illustrating a family tree rendering method provided in an embodiment of this application; Figure 2 A flowchart illustrating the method for generating a family map of a target family provided in an embodiment of this application; Figure 3 A flowchart illustrating the preset traversal rules provided in the embodiments of this application; Figure 4 A flowchart illustrating the process for determining the width of a text label line as provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a family tree rendering device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. The described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0020] It should be noted that the terms "system," "device," "unit," and / or "module" used in this application are methods of distinguishing different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they can be replaced by other expressions.
[0021] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.
[0022] Family trees are important analytical tools in fields such as psychology, sociology, and genetics, used to display information such as blood relations and marital relationships among family members.
[0023] In related technologies, family tree rendering methods mainly focus on the layout and positioning of nodes corresponding to family members, such as using algorithms like sibling node priority sorting and hyperbolic tree projection to automatically calculate node positions. However, these technologies still have the following shortcomings: First, the rendering dimensions are limited: In family trees of related technologies, the nodes corresponding to each family member typically only display basic data such as the member's name and gender. A wealth of data, including the member's health status (e.g., whether they suffer from cardiovascular disease, have a history of genetic diseases), behavioral characteristics (e.g., whether they are alcoholics, have legal disputes), and relationship quality (e.g., whether their marital relationship is strained, whether they have violent tendencies), cannot be visually presented on the nodes or lines. Users need to repeatedly consult the original data records or manually add annotations to the graph to complete the analysis, resulting in low efficiency in family tree analysis. Second, the node layout algorithm is incompatible with the multi-dimensional data display of family members: the node layout algorithm in related technologies only considers the basic size of the node (such as the size of the corresponding shape symbol) during the design, without considering the impact of multi-dimensional data display on the node size. When it is necessary to display text labels (name, age, occupation, experience, relationship, remarks) below a node, the actual width of the node will dynamically change with the width of the text label line. The fixed-position node layout algorithm cannot adapt to this change and is prone to node overlap.
[0024] To address at least one of the aforementioned technical problems, embodiments of this application provide a family tree rendering method, apparatus, and storage medium.
[0025] Figure 1 This is a flowchart illustrating a family tree rendering method provided in an embodiment of this application. The family tree rendering method provided in this embodiment can be executed by a family tree rendering device.
[0026] like Figure 1 As shown, the method includes the following steps: Step 101: Obtain data information of each family member in the target family; In some embodiments, the family members include at least the party concerned and at least one generation of family members associated with the party concerned, with each generation of family members including at least one family member. Preferably, the family members include the party concerned and four generations of direct and collateral relatives associated with the party concerned.
[0027] The data information includes data on at least one dimension of the corresponding family members. The dimensions include, but are not limited to: name, gender, medical history, age, death information, occupation, key events, key experiences, behavioral characteristics, family relationship, and remarks.
[0028] The medical dimension includes at least one of the following: cardiovascular disease markers, mental health disease markers, cancer markers, genetic disease markers, carrier markers, patient markers, and proband markers.
[0029] The family relationship dimension includes at least one of the following: relationship type with the party concerned, relationship quality with the party concerned, marital status, spouse information, parent information, and children information.
[0030] In some embodiments, users can fill in the data information of each family member through a family member information form in a graphical user interface. The family member information form includes input controls corresponding to each dimension of the data information, including but not limited to: text input boxes, radio buttons, check boxes, drop-down menus, date pickers, etc.
[0031] For example, a user can enter "Zhang San" in the name input box, select "male" in the gender drop-down menu, check "cardiovascular disease" and "cancer" in the medical marker checkbox, and select "dependence" in the alcohol use status drop-down menu. The family tree rendering device will then generate the corresponding data information based on the user's input.
[0032] In some embodiments, users can also import data from external files, including but not limited to CSV files, Excel files, JSON files, and XML files. After the user uploads the external file, the family tree rendering device converts the columns or fields in the file into data information for each family member according to preset field mapping rules.
[0033] For example, users can upload an Excel spreadsheet containing information about family members. The first column of the spreadsheet is name, the second column is gender, the third column is age, and the fourth column is disease markers, etc. The family map rendering device reads each row of data according to the preset field mapping rules and generates data information for each family member.
[0034] In some embodiments, users can also receive data from external systems via an Application Programming Interface (API). The external system calls the API provided by the family tree rendering device, carrying family member data in JSON or XML format in the request body. The family tree rendering device receives and parses this data as input.
[0035] For example, after completing the collection of a patient's family history, the hospital information system automatically calls the API interface to send the collected family member data information to the family map rendering device in JSON format.
[0036] Step 102: Determine the center position of the node corresponding to the party as the origin of the coordinate system, and determine the center position of the node corresponding to each family member according to the preset vertical positioning rules and horizontal positioning rules. In some embodiments, a Cartesian coordinate system is established with the center position of the node corresponding to the party as the origin (0,0). The positive direction of the horizontal axis (X-axis) is horizontal to the right, and the negative direction is horizontal to the left; the positive direction of the vertical axis (Y-axis) is vertically downward or vertically upward. This application uses vertically upward as an example for illustration.
[0037] In some embodiments, the vertical positioning rule is used to indicate the distance relationship between the ordinate of the center position of the node corresponding to different generation family members and the ordinate of the coordinate origin.
[0038] Specifically, vertical positioning rules can be based on generational distance. For example: Let the vertical coordinate of the party's level be 0, then: The vertical coordinate of the level where the parties' parents are located is +V_GAP1 (offset upwards by the first distance); The vertical coordinate of the level where the party's children are located is -V_GAP1 (offset downwards by the first distance); The vertical coordinate of the level where the person's grandparents are located is +2V_GAP1 (offset upwards by twice the first distance); The vertical coordinate of the level where the grandchildren of the party concerned are located is -2×V_GAP1 (downward offset by 2 times the first distance); The first distance V_GAP1 is a preset generation interval, with a value ranging from 80px to 120px, preferably 100px.
[0039] Specifically, vertical positioning rules can also be based on multi-level partitioning. For example: Family members are divided into multiple vertical levels according to their family relationships, with each level corresponding to a fixed ordinate offset. Taking a division of family members into 11 vertical levels as an example, if the ordinate of the individual's vertical level (let's say the 10th level) is 0, then the ordinate of the center position of the node corresponding to each family member in each vertical level is: Y_n = -(n-10) × V_GAP2; Where n is the vertical level number (1 to 11), and V_GAP2 is the vertical level spacing.
[0040] For example, when V_GAP2 = 100px: Level 1 (Great-grandparent level): Y_1 = -(1-10)×100 = 900px; The 4th layer (the children of ancestors and predecessors): Y_4 = -(4-10) × 100 = 600px; 7th layer (parent layer): Y_7 = -(7-10)×100 = 300px; Level 10 (the party involved): Y_10=0px; Level 11 (Children of the parties involved): Y_11=-(11-10)×100=-100px.
[0041] In some embodiments, the horizontal positioning rule is used to indicate the horizontal coordinate distance relationship between the horizontal coordinate of the center position of a node belonging to the same generation of family members and the origin of the coordinate system.
[0042] For example, if the spouse of the party concerned is at the same vertical level as the party concerned (the vertical coordinates of the center positions of the nodes are the same), with the center position of the node corresponding to the party concerned as the origin (0,0), the horizontal coordinate of the center position of the node corresponding to the current spouse is determined according to the following rules: X_spouse=D×SLOT; Wherein, SLOT is the preset second distance (the value ranges from 150px to 200px, preferably 180px), and D is the gender direction coefficient: when the spouse is female, D=+1 (shift to the right), and when the spouse is male, D=-1 (shift to the left).
[0043] For example, if the current spouse of the person (male) is female, the coordinates of the node center are (SLOT,0), which is (180px,0).
[0044] For example, if the person's ex-spouse is at the same vertical level as the person, and the origin of the coordinate system is the center of the node corresponding to the person (0,0), the x-coordinate of the center of the node corresponding to the ex-spouse is determined according to the following rules: X_ex = D × (2 + k) × SLOT; Where k is the marriage order index (k=0 represents the first ex-partner, k=1 represents the second ex-partner, and so on).
[0045] For example, if the first ex-spouse of the person (male) is female, the coordinates of the center position of the node corresponding to the first ex-spouse are (2SLOT,0), which is (360px,0); if the second ex-spouse is female, the coordinates of the center position of the node corresponding to the second ex-spouse are (3SLOT,0), which is (540px,0).
[0046] If family members at a vertical level are not spouses, for example, if they are siblings, then: The x-coordinate of the center position of the sibling node is based on the center point of the parent node pair, and arranged to both sides after being sorted by age: X_sibling=X_parent_center+offset; Where X_parent_center is the x-coordinate of the parent node relative to the center point, and offset is the offset relative to the center point, determined by the age order of siblings. It's important to understand that the x-coordinates of the center positions of two adjacent nodes are equidistant.
[0047] For example, the center point of the parents has an x-coordinate of 0, and the three siblings are arranged in descending order of age: the oldest sibling is on the left, the youngest sibling is on the right, and the middle-aged sibling is near the center. The distance between adjacent sibling nodes is a preset third distance V_GAP3 (the value ranges from 8px to 20px, preferably 12px).
[0048] Based on this, in some embodiments, the vertical positioning rules include: Each family member is divided into eleven vertical levels, each vertical level corresponds to an initial ordinate, and the distance between the ordinates of adjacent levels is the first distance. The eleven vertical levels are: great-grandparent level, great-grandparent siblings level, grandparent level, children of grandparents' ex-partners level, grandparent siblings level, parents siblings level, parents level, children of parents' ex-partners level, siblings level, party involved level, and party involved children level.
[0049] The horizontal positioning rules include: For the party member layer in the vertical hierarchy, the x-coordinate of the center position of the node corresponding to the current spouse of the party member is the product of the gender direction coefficient and the second distance, and the x-coordinate of the center position of the node corresponding to the former spouse of the party member is the product of the gender direction coefficient, the marriage order index and the second distance; wherein, the gender direction coefficient includes male direction coefficient and female direction coefficient with equal magnitude and opposite sign; For any of the following vertical levels in the vertical hierarchy: great-grandparent siblings level, grandparent siblings level, siblings level, children of the grandparent's ex-partner, children of the parents' ex-partner, and children of the party concerned, the nodes corresponding to family members in the vertical level are sorted by age and arranged sequentially from the center position of the two nodes corresponding to the father and mother of the family members included in the current vertical level to both sides, and the distance between the horizontal coordinates of adjacent family member nodes in the current vertical level is the third distance; the third distance is less than the second distance.
[0050] Step 103: Based on the center position of the node corresponding to each family member and the preset mapping relationship between data information and rendering symbols, generate the family map of the target family.
[0051] In some embodiments, the mapping relationship includes at least one of the following: The data in the first dimension of the data information is rendered as the shape symbol of a node; The data in the second dimension of the data information is rendered as the color fill and / or additional markers of the node's shape symbol; The data in the third dimension of the data information is rendered as text labels of the morphological symbols of nodes; The fourth dimension of the data information is rendered as a line shape between the morphological symbols of the nodes.
[0052] In some embodiments, the first dimension is gender, and the morphological symbols of the nodes corresponding to family members of different genders are different.
[0053] Specifically, when the gender data is male, the corresponding node's shape symbol is rendered as a square; when the gender data is female, the corresponding node's shape symbol is rendered as a circle; when the gender data is unknown, the corresponding node's shape symbol is rendered as a rhombus; when the gender data is MtF transgender, the corresponding node's shape symbol is rendered as a combination of a circle and a square; when the gender data is FtM transgender, the corresponding node's shape symbol is rendered as a combination of a square and a circle; when the gender data is non-binary, the corresponding node's shape symbol is rendered as a rounded rectangle; when the gender data is intergender, the corresponding node's shape symbol is rendered as a combination of a circle and a vertical line; when the gender data is pending, the corresponding node's shape symbol is rendered as a combination of a rhombus and a question mark.
[0054] In some embodiments, the second dimension is a medical dimension, where family members with different diseases have different filled-in areas and / or additional markers. The data in the medical dimension includes at least one of cardiovascular disease markers, mental health disease markers, cancer markers, hereditary disease markers, and carrier markers.
[0055] Specifically, when the medical data contains a cardiovascular disease marker, the upper left quadrant of the node shape symbol is filled with red; when the medical data contains a mental illness marker, the upper right quadrant is filled with purple; when the medical data contains a cancer marker, the lower left quadrant is filled with blue; and when the medical data contains a hereditary disease marker, the lower right quadrant is filled with green.
[0056] When the medical data further includes carrier markers, the lower half of the corresponding quadrant is filled with gray.
[0057] In some embodiments, the second dimension is a behavioral characteristic dimension. The behavioral characteristic data includes at least one of legal status data, mental health data, death status data, family role data, and specific occupation data.
[0058] When the legal status data contains an imprisonment marker, a horizontal stripe pattern is rendered at the bottom of the node shape symbol; When the legal status data contains a legal dispute marker, the first symbol is rendered in the upper right corner of the node morphological symbol; When the mental health data contains markers of self-harm behavior, an orange dashed circle is rendered outside the border of the node morphological symbol; When the mental health data contains suicide attempt markers, render the “SA” text marker inside the node morphological symbol; When the mental health data contains a suicide completion marker, render an "S" text marker inside the node morphological symbol and overlay a diagonal cross line; When the death status data contains a death marker, a diagonal cross line is superimposed on the node morphological symbol; When the death marker is further defined as presumed death, the diagonal intersection is rendered as a dashed line, and an additional question mark is rendered. When the family role data contains a family role marker, if the family role marker is a first role, a second symbol is rendered on top of the node shape symbol; if the family role marker is a second role, a third symbol is rendered on top of the node shape symbol; if the family role marker is a third role, a fourth symbol is rendered on top of the node shape symbol; if the family role marker is a fourth role, a fifth symbol is rendered on top of the node shape symbol; and if the family role marker is a fifth role, a sixth symbol is rendered on top of the node shape symbol. When the special occupation data contains a special occupation marker, if the special occupation marker is a military occupation, then the seventh symbol is rendered in the lower right corner of the node morphological symbol; if the special occupation marker is a medical occupation, then the eighth symbol is rendered in the lower right corner of the node morphological symbol.
[0059] In some embodiments, the third dimension data includes at least one of the following data types: The corresponding family members' names, ages and / or death information, occupations, key events and / or key experiences, family relationships, and remarks; among which, the remarks can be substance use data. For example, when the substance use data includes an alcohol abuse marker, the text label "alcohol" is rendered below the node morphological symbol; when it includes an alcohol dependence marker, the text label "alcohol D" is rendered; when it includes an alcohol withdrawal recovery marker, the text label "alcohol R" is rendered. When it includes a drug abuse marker, the text label "drug" is rendered; when it includes a drug dependence marker, the text label "drug D" is rendered; when it includes a drug withdrawal recovery marker, the text label "drug R" is rendered. When it includes a smoking marker, the text label "smoking" is rendered.
[0060] The above data will be rendered line by line below the node shape symbol in the following order: The first row renders the name data, the second row renders the age data or death information data, the third row renders the occupation data, the fourth row renders the key event data and / or key experience data, the fifth row renders the family relationship data, and the sixth row renders the remarks data.
[0061] Understandably, multiple lines of text labels can be rendered below the node's shape symbol, but the total number of text labels should meet the requirement of the first distance between vertical levels. That is, the sum of the product of the total number of text labels and the height of each text label line, and half the height of the node's shape symbol, should be less than the first distance. Understandably, a maximum number of text labels can also be preset based on the first distance and the height of the node's shape symbol; data in the third dimension exceeding the maximum number of lines will not be rendered.
[0062] Understandably, during the rendering of text tags, the width of each line of text tags needs to be estimated. If the width of the currently rendered text tag line is greater than the preset width, then the currently rendered text tag line is split into multiple lines. The preset width is determined based on the distance between nodes in the vertical hierarchy of the node: for example, if the distance between nodes in the vertical hierarchy of the node is a second distance, then half of the preset width is no greater than the second distance; for example, if the distance between nodes in the vertical hierarchy of the node is a third distance, then half of the preset width is no greater than the third distance.
[0063] The line splitting operation is as follows: determine whether there is a preset breakpoint character in the currently rendered text label line; if there is, split the line at the breakpoint character; if there is not, force a line split at a position exceeding the preset width, and add a hyphen to the end of the split text label line.
[0064] The breakpoint characters can be spaces, Chinese commas, Chinese periods, Chinese exclamation marks, Chinese question marks, Chinese semicolons, Chinese colons, etc.
[0065] In some embodiments, the fourth dimension is the family relationship dimension, where the connection patterns between family members of different family relationships are different.
[0066] Specifically, the fourth dimension of data includes at least one of the following: marital status data among family members, relationship quality data, and parent-child relationship type data.
[0067] When two family members are married, the connection pattern is determined based on the marital status data and the relationship quality data: a solid line is rendered between the two nodes when the marital status data indicates a normal marriage; a jagged line is rendered when the marital status data indicates a divorce; a dashed line is rendered when the marital status data indicates separation; a double line is rendered when the relationship quality data indicates an entangled relationship; a gray dashed line is rendered when the relationship quality data indicates a distant relationship; a red line with an arrow is rendered when the relationship quality data indicates a conflicted relationship or contains a violent tendency marker; and a thick black line is rendered when the relationship quality data indicates a broken relationship.
[0068] When two family members are in a parent-child relationship, the connection pattern is determined based on the parent-child relationship type data: when the parent-child relationship type data is a biological relationship, a solid vertical polyline is rendered between the parent node and the child node; when the parent-child relationship type data contains an adoption mark, a dashed line is rendered; when the parent-child relationship type data contains a foster care mark, a dotted line is rendered.
[0069] When multiple child nodes belong to the same multiple birth group, the connection pattern is determined based on the multiple birth type data: an inverted V-shaped connection is rendered between the parent node and the multiple birth nodes, and a beam is rendered on top of the multiple birth nodes. When the multiple birth type data is identical twins, the beam is rendered as a solid line; when it is fraternal twins, the beam is rendered as a solid line with two parallel short vertical lines; when it is twins of unknown type, the beam is rendered as a dashed line.
[0070] It should be noted that the above-mentioned morphological symbols of nodes, the coloring and / or additional markings of the morphological symbols of nodes, and the connection patterns between the morphological symbols of nodes are all illustrative examples and are not limited in this application.
[0071] The family tree rendering method provided in this application has the following beneficial effects: First, by rendering the first dimension of the data information as node morphological symbols, rendering the second dimension of the data information as color fills and / or additional markers for the node morphological symbols, rendering the third dimension of the data information as text labels for the node morphological symbols, and mapping the fourth dimension of the data information as line shapes between the node morphological symbols, this application can automatically map multi-dimensional data of family members into diverse graphic symbols and present them intuitively on nodes and lines, compared to related technologies where family charts can only display the identity information and family relationships of family members. Users can directly obtain rich analytical information from the family chart without consulting external records or manually adding annotations, thus improving the analytical efficiency and information density of the family chart.
[0072] Secondly, by using the preset mapping relationship between data information and rendering symbols, data of different dimensions can be rendered into different types of graphic symbols. Users only need to provide or enter multi-dimensional data of family members, and the corresponding graphic symbols can be automatically generated according to the preset mapping relationship. Users do not need to manually draw or edit the family map, thus realizing fully automatic rendering from data to graphics, significantly reducing the user's operational burden and avoiding human omissions or errors.
[0073] In some embodiments, as described above, the text label is rendered below the morphological symbol of the corresponding node; therefore, the width of the text label may be greater than the width of the morphological symbol of the node, leading to node overlap. To avoid node overlap, such as... Figure 2 As shown, Figure 2 This is a flowchart illustrating the method for generating a family tree of a target family according to an embodiment of this application. Step 103 further includes the following steps: Step 201: Traverse each vertical level and update the horizontal coordinate of the center position of the node corresponding to each family member in each vertical level according to the preset traversal rules; In some embodiments, the vertical hierarchy includes the eleven vertical hierarchies described above, namely, the great-grandparent level, the great-grandparent sibling level, the grandparent level, the grandparent's ex-children level, the grandparent sibling level, the parents sibling level, the parents level, the parents' ex-children level, the sibling level, the party involved level, and the party involved's children level.
[0074] In some embodiments, each vertical level can be traversed sequentially from top to bottom, starting from the great-grandparent level, then proceeding to the great-grandparent sibling level, the grandparent level, the grandparent's predecessor's children level, the grandparent sibling level, the parent sibling level, the parent's predecessor's children level, the sibling level, the party involved level, and the party involved's children level. For each traversed vertical level, the x-coordinate of the center position of each family member node within that vertical level is detected and updated according to a preset traversal rule to eliminate overlap between nodes within that vertical level.
[0075] In some embodiments, the traversal order can also be from bottom to top, that is, starting from the child level and traversing upwards to the great-grandparent level. Both traversal orders can achieve the detection and elimination of overlapping nodes within the same vertical level, and this application does not limit the traversal order.
[0076] in, Figure 3 A flowchart illustrating the preset traversal rules provided in the embodiments of this application is shown below. Figure 3 As shown, the preset traversal rule includes the following steps: Step 301: For the currently traversed vertical hierarchy, obtain the width of each node in the vertical hierarchy; the width of the node refers to the larger value between the width of the corresponding node's morphological symbol and the width of the text label. In some embodiments, for each node in the currently traversed vertical hierarchy, the width of the morphological symbol of that node is first obtained. The width of the morphological symbol (which is a preset width) is determined according to the gender type: when the gender is male, female, unknown, non-binary, intersex, etc., the width of the morphological symbol is 36px; when the gender is MtF transgender or FtM transgender, the width of the morphological symbol is 40px.
[0077] Then, the width of the text label of the node is obtained, and the width of the text label is determined according to the methods described in steps 401 to 404. The system compares the width of the morphological symbol and the width of the text label, and takes the larger value as the width of the node.
[0078] For example, if the width of a male node's morphic symbol is 36px and the maximum line width of its text tag is 50px, then the width of that node is 50px. Similarly, if the width of a female node's morphic symbol is 36px and the maximum line width of its text tag is 30px, then the width of that node is 36px.
[0079] In one embodiment, the process for determining the width of the text label is as follows: Determine the width of each line of text labels in the text labels; Determine the width of the text label that has the largest width.
[0080] In some embodiments, the text label of a node corresponding to a family member includes one or more text label lines. For example, the first line of the text label may contain the name, the second line may contain age or death information, the third line may contain occupation, the fourth line may contain key events or experiences, the fifth line may contain family relationships, and the sixth line may contain remarks. Since the content length of each text label line is different, their rendered widths are also different. Therefore, the width of each text label line can be calculated separately, and then the width of the text label line with the largest width can be selected as the width of the entire text label. In subsequent collision detection, the width of the node is taken as the larger value between the width of the node's morphological symbol and the width of the text label. Taking the maximum line width of the text label ensures that all text label lines do not exceed the boundary of the node.
[0081] in, Figure 4 This is a flowchart illustrating the process for determining the width of a text label line as provided in an embodiment of this application. Figure 4 As shown, the process for determining the width of the text label line includes the following steps: Step 401: Obtain the Unicode range of each character in the text label line; In some embodiments, each character in the current text label line is read character by character, and the Unicode code value of the character is obtained. For example, the Unicode code of the Chinese character "Zhang" is 0x5F20, the Unicode code of the English character "A" is 0x41, the Unicode code of the numeric character "1" is 0x31, and the Unicode code of the space character is 0x20. The system determines the Unicode range to which the character belongs by reading the Unicode code value of each character.
[0082] Step 402: Determine the character type of each of the characters according to the Unicode range of each of the characters; In some embodiments, the character type of each character is determined according to the Unicode range obtained in step 401.
[0083] Specifically, when the Unicode range of a character is between 0x4E00 and 0x9FFF, the character is determined to be a Chinese character; when the Unicode range of a character is between 0x41 and 0x5A or between 0x61 and 0x7A, the character is determined to be an English character; when the Unicode range of a character is 0x20, the character is determined to be a space; when the Unicode range of a character is between 0x30 and 0x39, the character is determined to be a numeric character; for characters not belonging to the above ranges, they are determined to be other characters.
[0084] In some embodiments, the character types further include Japanese characters and Korean characters. When the Unicode range of a character is between 0x3040 and 0x30FF, the character is determined to be a Japanese Kana character; when the Unicode range of a character is between 0xAC00 and 0xD7AF, the character is determined to be a Korean character.
[0085] Step 403: Determine the number of characters contained in each of the character types according to the character type of each of the characters; In some embodiments, the characters belonging to each character type determined in step 402 are counted respectively. For example, if the current text label line is "30 years old", where "Zhang", "San" and "Sui" are Chinese characters, the count is 3; "3" and "0" in "30" are numeric characters, and the count is 2.
[0086] Step 404: Determine the width of the text label line according to the number of characters contained in each of the character types and the preset width coefficient of each of the character types.
[0087] In some embodiments, a width factor is pre-set for each character type. The width factor is used to represent the relative width of that character type per unit font size. Specifically, the width factor for Chinese (Chinese, Japanese, and Korean) characters is 0.6, the width factor for English characters is 0.5, the width factor for numeric characters is 0.5, the width factor for spaces is 0.25, and the width factor for other characters is 0.4.
[0088] The formula for calculating the width of a text label line is: Line width = Font size × (Number of Chinese characters × 0.6 + Number of English characters × 0.5 + Number of numeric characters × 0.5 + Number of spaces × 0.25 + Number of other characters × 0.4).
[0089] For example, if the current text tag is “Zhang San is 30 years old”, the font size is 12px, there are 3 Chinese characters and 2 numeric characters, then the line width = 12 × (3 × 0.6 + 2 × 0.5) = 12 × (1.8 + 1.0) = 12 × 2.8 = 33.6px.
[0090] In other embodiments, the font size varies depending on the line number of the text label line. For example, the font size of the first line (name line) is 14px, and the font size of the second to sixth lines is 12px.
[0091] Step 302: Starting from the two adjacent nodes in the vertical hierarchy, traverse the two adjacent nodes in the vertical hierarchy in turn. Based on the width of each node in the two adjacent nodes being traversed and the x-coordinate of the center position of the two adjacent nodes being traversed, determine whether there is an overlap between the two adjacent nodes being traversed. In some embodiments, for the currently traversed vertical level, all nodes within that vertical level can be sorted in ascending order according to the x-coordinate of their center position to obtain the node sequence for that vertical level. Starting from the first and second nodes in the node sequence, each pair of adjacent nodes is traversed sequentially.
[0092] For the two adjacent nodes currently being traversed, let the x-coordinate of the center position of the left node be X_left and its width be W_left; let the x-coordinate of the center position of the right node be X_right and its width be W_right. The right boundary of the left node is X_left + W_left / 2, and the left boundary of the right node is X_right - W_right / 2. If the right boundary of the left node is greater than the left boundary of the right node, i.e., the inequality X_left + W_left / 2 > X_right - W_right / 2 is satisfied, then the two adjacent nodes are considered to overlap. Conversely, if the right boundary of the left node is less than or equal to the left boundary of the right node, then the two adjacent nodes are considered not to overlap.
[0093] For example, the left node has a center x-coordinate of 100px, a width of 40px, and a right boundary of 120px; the right node has a center x-coordinate of 130px, a width of 40px, and a left boundary of 110px. Since 120px > 110px, the two nodes are determined to overlap.
[0094] Step 303: If the judgment result is yes, for overlapping nodes, offset the overlapping nodes according to the preset offset rule; the preset offset rule is: offset the rightmost node among the overlapping nodes to the right by a preset offset step. In some embodiments, when step 302 determines that two adjacent nodes overlap, the node on the right is shifted to the right by a preset offset step size. The preset offset step size can be a fixed pixel value, such as 2px, 5px, or 10px. Alternatively, the preset offset step size can be a dynamically set value according to an offset rule; for example, the offset rule might be that the preset step size is greater than the node overlap width; where the node overlap width is the absolute value of the difference between the right boundary of the left node and the left boundary of the right node.
[0095] In one embodiment, when adjacent nodes overlap, the left node may not be offset in order to keep the adjusted node position relatively stable.
[0096] For example, the left node has a center x-coordinate of 100px, a width of 40px, and a right boundary of 120px; the right node has a center x-coordinate of 130px, a width of 40px, and a left boundary of 110px. Step 302 determines that there is overlap, with an overlap width of 10px. At this point, the center x-coordinate of the right node is shifted 20px to the right from 130px, updating to 150px. After the shift, the left boundary of the right node changes from 110px to 130px, while the right boundary of the left node remains at 120px. Since 120px < 130px, there is no overlap.
[0097] In some embodiments, the preset offset rule may also be: offsetting two overlapping nodes to the left and right by half a preset offset step, that is, the left node is offset to the left and the right node is offset to the right. This application does not limit this.
[0098] Step 304: For the offset node, update the horizontal coordinate of the center position of the offset node according to the preset offset step size until there are no overlapping nodes in the currently traversed vertical level.
[0099] In some embodiments, steps 301 to 303 are repeated to perform multiple rounds of iterative detection and offset of nodes in the vertical level until there are no overlapping nodes in the currently traversed vertical level. When all adjacent node pairs do not meet the overlap condition in a certain iteration, the system determines that there are no overlapping nodes in the current vertical level, ends the traversal of the vertical level, and proceeds to the processing of the next vertical level.
[0100] Step 202: Generate the family map of the target family based on the updated x-coordinate of the center position of the node corresponding to each family member and the coordinate of the center position of the corresponding node.
[0101] In some embodiments, after updating the x-coordinates of the center positions of nodes in all vertical levels, the center position of each family member node is determined, including the y-coordinate determined according to the vertical positioning rules and the x-coordinate updated according to the preset traversal rules. Based on the mapping relationship described in step 103, the data information of each family member is rendered into corresponding rendering symbols, and lines between nodes are drawn to generate a complete family map.
[0102] In some embodiments, before generating the family tree, the canvas size can be automatically calculated based on the minimum x-coordinate, maximum x-coordinate, minimum y-coordinate, and maximum y-coordinate of all nodes. The canvas width is equal to the difference between the maximum and minimum x-coordinates plus twice the canvas margin, and the canvas height is equal to the difference between the maximum and minimum y-coordinates plus twice the canvas margin. The canvas margin can be preset to 50px to 100px to ensure an appropriate blank area between the edge of the family tree and the canvas boundary.
[0103] In some embodiments, the generated family tree can be output as a Scalable Vector Graphics (SVG) file. The SVG file employs a layered structure: the bottom layer contains the connections between nodes, the middle layer contains the node morphological symbols, the top layer contains the color fills and additional markers for the morphological symbols, and the top layer contains text labels. This layered rendering order ensures that the upper-layer graphics do not obscure the lower-layer graphics, guaranteeing the clear readability of the family tree.
[0104] The family tree rendering method provided in this application embodiment also provides a rendering symbol linkage mechanism, which is used to realize real-time synchronous updates of data information and rendering symbols; that is, the family tree rendering method provided in this application embodiment further includes: In response to a change in the data information of any family member, the rendering symbol of the corresponding family member is updated based on the preset mapping relationship between data information and rendering symbols.
[0105] In some embodiments, the change in data information includes: a user modifying the data of a certain dimension of a family member through input controls in a graphical user interface, an external system pushing updated data through an API interface, or reading updated data from a database. When the above changes are detected, the update process of rendering symbols is automatically triggered, without requiring the user to manually refresh the map or re-execute the complete layout calculation.
[0106] In some embodiments, the observer pattern can be used to monitor the data information of each family member node. Specifically, a listener is registered for each data dimension (such as gender, medical markers, alcohol use status, marital status, etc.). When the data of a certain dimension changes, the listener corresponding to that dimension is triggered, thereby obtaining the updated data value.
[0107] For example, if a user changes a family member's alcohol usage status from "none" to "dependent," the system detects this change and retrieves the original value "none" and the new value "dependent." Then, it simply adds an "Alcohol D" label below the node corresponding to that family member, without changing the node's center position or any rendering symbols of its spouse, parent, or child nodes.
[0108] To implement the family tree rendering method provided in this application embodiment, this application embodiment also provides a family tree rendering apparatus. For example... Figure 5 As shown, Figure 5 A schematic diagram of a family tree rendering apparatus provided in an embodiment of this application. The family tree rendering apparatus includes: The acquisition module 501 is used to acquire data information of each family member in the target family; the family members include at least the party concerned and at least one generation of family members associated with the party concerned, and each generation of family members includes at least one family member, and the data information includes at least one dimension of data of the corresponding family member; The node center position determination module 502 is used to determine the center position of the node corresponding to the party concerned as the origin of the coordinate system, and to determine the center position of the node corresponding to each family member according to the preset vertical positioning rules and horizontal positioning rules; the vertical positioning rules are used to indicate the distance relationship between the vertical coordinate of the center position of the node corresponding to the family members of different generations and the vertical coordinate of the origin of the coordinate system, and the horizontal positioning rules are used to indicate the distance relationship between the horizontal coordinate of the center position of the node belonging to the family members of the same generation and the horizontal coordinate of the origin of the coordinate system. The rendering module 503 is used to generate a family map of the target family based on the center position of the node corresponding to each family member and the preset mapping relationship between data information and rendering symbols; the mapping relationship includes at least one of the following: rendering the data in the first dimension of the data information as the shape symbol of the node, rendering the data in the second dimension of the data information as the fill color and / or additional mark of the shape symbol of the node, rendering the data in the third dimension of the data information as the text label of the shape symbol of the node, and rendering the data in the fourth dimension of the data information as the line shape between the shape symbols of the nodes.
[0109] In some embodiments, the vertical positioning rules include: Each family member is divided into eleven vertical levels, each vertical level corresponds to an initial ordinate, and the distance between the ordinates of adjacent levels is the first distance. The eleven vertical levels are: great-grandparent level, great-grandparent siblings level, grandparent level, children of grandparents' ex-partners level, grandparent siblings level, parents siblings level, parents level, children of parents' ex-partners level, siblings level, party involved level, and party involved children level.
[0110] In some embodiments, the horizontal positioning rules include: For the party member layer in the vertical hierarchy, the x-coordinate of the center position of the node corresponding to the current spouse of the party member is the product of the gender direction coefficient and the second distance, and the x-coordinate of the center position of the node corresponding to the former spouse of the party member is the product of the gender direction coefficient, the marriage order index and the second distance; wherein, the gender direction coefficient includes male direction coefficient and female direction coefficient with equal magnitude and opposite sign; For any of the following vertical levels in the vertical hierarchy: great-grandparent siblings level, grandparent siblings level, siblings level, children of the grandparent's ex-partner, children of the parents' ex-partner, and children of the party concerned, the nodes corresponding to family members in the vertical level are sorted by age and arranged sequentially from the center position of the two nodes corresponding to the father and mother of the family members included in the current vertical level to both sides, and the distance between the horizontal coordinates of adjacent family member nodes in the current vertical level is the third distance; the third distance is less than the second distance.
[0111] In some embodiments, the text label is rendered below the morphological symbol of the corresponding node; Accordingly, the rendering module 503 is specifically used for: Traverse each of the vertical levels and update the x-coordinate of the center position of the node corresponding to each family member in each of the vertical levels according to the preset traversal rules; Based on the updated x-coordinate of the center position of the node corresponding to each family member, and the coordinate of the center position of the corresponding node, a family map of the target family is generated. The preset traversal rules are as follows: For the currently traversed vertical hierarchy, obtain the width of each node in the vertical hierarchy; the width of the node refers to the larger value between the width of the corresponding node's morphological symbol and the width of the text label. Starting from the two adjacent nodes in the vertical hierarchy, traverse the two adjacent nodes in the vertical hierarchy in turn. Based on the width of each node in the two adjacent nodes being traversed and the x-coordinate of the center position of the two adjacent nodes being traversed, determine whether there is an overlap between the two adjacent nodes being traversed. If the judgment result is yes, for nodes that overlap, the overlapping nodes are offset according to the preset offset rule; the preset offset rule is: the node on the right side of the overlapping nodes is offset to the right by a preset offset step; For the offset node, update the horizontal coordinate of the center position of the offset node according to the preset offset step size until there are no overlapping nodes in the currently traversed vertical level.
[0112] In some embodiments, the process for determining the width of the text label is as follows: Determine the width of each line of text labels in the text labels; Determine the width of the text label that has the largest width; The process for determining the width of the text label line is as follows: Obtain the Unicode range of each character in the text label line; The character type of each character is determined based on its Unicode range. Based on the character type of each character, determine the number of characters contained in each character type; The width of the text label line is determined based on the number of characters contained in each character type and the preset width coefficient of each character type.
[0113] In some embodiments, the third dimension data includes at least one of the following data types: The corresponding family members' names, ages and / or death information, occupations, key events and / or key experiences, family relationships, and remarks; The text label that renders the third-dimensional data in the data information as the morphological symbol of a node includes: The text labels are rendered line by line according to the data type in the third dimension. During the rendering process, it is determined whether the width of the currently rendered text label line is greater than the preset width. One data type corresponds to one text label line. If the width of the currently rendered text label line is greater than the preset width, then the currently rendered text label line is split into multiple lines. The splitting operation is as follows: determine whether there is a preset breakpoint character in the currently rendered text label line; if there is, split the line at the breakpoint character; if there is not, force a split at the position exceeding the preset width, and add a hyphen to the end of the split text label line.
[0114] In some embodiments, the family tree rendering apparatus further includes a linkage module, the linkage module being used for: In response to a change in the data information of any family member, the rendering symbol of the corresponding family member is updated based on the preset mapping relationship between data information and rendering symbols.
[0115] In some embodiments, the first dimension is gender, and the morphological symbols of the nodes corresponding to family members of different genders are different; The second dimension is the medical dimension and / or behavioral characteristics dimension, with different color-filled areas and / or additional markers corresponding to family members with different diseases; The fourth dimension is the family relationship dimension, where the connection patterns between family members of different family relationships are different.
[0116] The above embodiments of this application describe the apparatus provided in the embodiments of this application. To implement the functions of the methods provided in the above embodiments of this application, the family tree rendering apparatus may include hardware structures and software modules, implementing the above functions in the form of hardware structures, software modules, or a combination of hardware structures and software modules. One of the above functions may be executed in the form of hardware structures, software modules, or a combination of hardware structures and software modules.
[0117] Figure 6 This is a block diagram illustrating an electronic device 600 for implementing the aforementioned family tree rendering method, according to an exemplary embodiment. For example, the electronic device 600 may be a computer, a personal digital assistant, etc.
[0118] Reference Figure 6The electronic device 600 may include a communication interface 601, capable of interacting with other devices; a processor 602, connected to the communication interface 601 to interact with other devices, used to execute the methods provided by one or more of the above-described technical solutions when running a computer program; and a memory 603, on which the computer program is stored. Specifically, the specific processing operations of the processor 602 can refer to the family tree rendering method described in the above embodiments of this disclosure.
[0119] Of course, in practical applications, the various components in electronic device 600 are coupled together through bus system 604. It can be understood that bus system 604 is used to realize the connection and communication between these components. In addition to a data bus, bus system 604 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in... Figure 6 The general designated all buses as Bus System 604.
[0120] The memory 603 in this embodiment is used to store various types of data to support the operation of the electronic device 600. Examples of such data include any computer program used to operate on the electronic device 600.
[0121] The methods disclosed in the embodiments of this application can be applied to processor 602, or implemented by processor 602. Processor 602 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 602 or by instructions in software form. The processor 602 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 602 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 603. Processor 602 reads information from memory 603 and combines it with its hardware to complete the steps of the aforementioned method.
[0122] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.
[0123] Embodiments of this disclosure also propose a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the family map rendering method described in the above embodiments of this disclosure.
[0124] Embodiments of this disclosure also propose a computer program product, including a computer program that, when executed by a processor, implements the family tree rendering method described in the above embodiments of this disclosure.
[0125] Embodiments of this disclosure also propose a chip including one or more interface circuits and one or more processors; the interface circuits are used to receive signals from the memory of an electronic device and send signals to the processors, the signals including computer instructions stored in the memory, which, when executed by the processor, cause the electronic device to perform the family map rendering method described in the above embodiments of this disclosure.
[0126] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0127] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0128] Any description of operation or method in the flowchart or otherwise described herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or operation, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0129] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processing module, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (control method), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic device, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0130] It should be understood that various parts of the embodiments of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0131] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by instructing related hardware through an operation sequence, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.
[0132] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc.
[0133] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A family tree rendering method, characterized in that, The method includes: Obtain data information of each family member in the target family; the family members include at least the party concerned and at least one generation of family members associated with the party concerned, and each generation of family members includes at least one family member, and the data information includes at least one dimension of data of the corresponding family member; The center position of the node corresponding to the party is determined as the origin of the coordinate system. The center position of the node corresponding to each family member is determined according to the preset vertical positioning rule and horizontal positioning rule. The vertical positioning rule is used to indicate the distance relationship between the vertical coordinate of the center position of the node corresponding to the family member of different generations and the vertical coordinate of the origin of the coordinate system. The horizontal positioning rule is used to indicate the distance relationship between the horizontal coordinate of the center position of the node belonging to the family member of the same generation and the horizontal coordinate of the origin of the coordinate system. Based on the center position of the node corresponding to each family member and the preset mapping relationship between data information and rendering symbols, a family map of the target family is generated; the mapping relationship includes at least one of the following: rendering the data in the first dimension of the data information as the shape symbol of the node, rendering the data in the second dimension of the data information as the fill color and / or additional mark of the shape symbol of the node, rendering the data in the third dimension of the data information as the text label of the shape symbol of the node, and rendering the data in the fourth dimension of the data information as the line shape between the shape symbols of the nodes.
2. The method according to claim 1, characterized in that, The vertical positioning rules include: Each family member is divided into eleven vertical levels, each vertical level corresponds to an initial ordinate, and the distance between the ordinates of adjacent levels is the first distance. The eleven vertical levels are: great-grandparent level, great-grandparent siblings level, grandparent level, children of grandparents' ex-partners level, grandparent siblings level, parents siblings level, parents level, children of parents' ex-partners level, siblings level, party involved level, and party involved children level.
3. The method according to claim 2, characterized in that, The horizontal positioning rules include: For the party member layer in the vertical hierarchy, the x-coordinate of the center position of the node corresponding to the current spouse of the party member is the product of the gender direction coefficient and the second distance, and the x-coordinate of the center position of the node corresponding to the former spouse of the party member is the product of the gender direction coefficient, the marriage order index and the second distance; wherein, the gender direction coefficient includes male direction coefficient and female direction coefficient with equal magnitude and opposite sign; For any of the following vertical levels in the vertical hierarchy: great-grandparent siblings level, grandparent siblings level, siblings level, children of the grandparent's ex-partner, children of the parents' ex-partner, and children of the party concerned, the nodes corresponding to family members in the vertical level are sorted by age and arranged sequentially from the center position of the two nodes corresponding to the father and mother of the family members included in the current vertical level to both sides, and the distance between the horizontal coordinates of adjacent family member nodes in the current vertical level is the third distance; the third distance is less than the second distance.
4. The method according to claim 3, characterized in that, The text label is rendered below the morphological symbol of the corresponding node; The process of generating a family map of the target family based on the center position of the nodes corresponding to each family member and the preset mapping relationship between data information and rendering symbols includes: Traverse each of the vertical levels and update the x-coordinate of the center position of the node corresponding to each family member in each of the vertical levels according to the preset traversal rules; Based on the updated x-coordinate of the center position of the node corresponding to each family member, and the coordinate of the center position of the corresponding node, a family map of the target family is generated. The preset traversal rules are as follows: For the currently traversed vertical hierarchy, obtain the width of each node in the vertical hierarchy; the width of the node refers to the larger value between the width of the corresponding node's morphological symbol and the width of the text label. Starting from the two adjacent nodes in the vertical hierarchy, traverse the two adjacent nodes in the vertical hierarchy in turn. Based on the width of each node in the two adjacent nodes being traversed and the x-coordinate of the center position of the two adjacent nodes being traversed, determine whether there is an overlap between the two adjacent nodes being traversed. If the judgment result is yes, for nodes that overlap, the overlapping nodes are offset according to the preset offset rule; the preset offset rule is: the node on the right side of the overlapping nodes is offset to the right by a preset offset step; For the offset node, update the horizontal coordinate of the center position of the offset node according to the preset offset step size until there are no overlapping nodes in the currently traversed vertical level.
5. The method according to claim 4, characterized in that, The process for determining the width of the text label is as follows: Determine the width of each line of text labels in the text labels; Determine the width of the text label that has the largest width; The process for determining the width of the text label line is as follows: Obtain the Unicode range of each character in the text label line; The character type of each character is determined based on its Unicode range. Based on the character type of each character, determine the number of characters contained in each character type; The width of the text label line is determined based on the number of characters contained in each character type and the preset width coefficient of each character type.
6. The method according to any one of claims 1 to 5, characterized in that, The data in the third dimension includes at least one of the following data types: The corresponding family members' names, ages and / or death information, occupations, key events and / or key experiences, family relationships, and remarks; The text label that renders the third-dimensional data in the data information as a morphological symbol of a node includes: The text labels are rendered line by line according to the data type in the third dimension. During the rendering process, it is determined whether the width of the currently rendered text label line is greater than the preset width. One data type corresponds to one text label line. If the width of the currently rendered text label line is greater than the preset width, then the currently rendered text label line is split into multiple lines. The splitting operation is as follows: determine whether there is a preset breakpoint character in the currently rendered text label line; if there is, split the line at the breakpoint character; if there is not, force a split at the position exceeding the preset width, and add a hyphen to the end of the split text label line.
7. The method according to any one of claims 1 to 5, characterized in that, The method further includes: In response to a change in the data information of any family member, the rendering symbol of the corresponding family member is updated based on the preset mapping relationship between data information and rendering symbols.
8. The method according to any one of claims 1 to 5, characterized in that, The first dimension is gender, and the morphological symbols of the nodes corresponding to family members of different genders are different; The second dimension is the medical dimension and / or behavioral characteristics dimension, with different color-filled areas and / or additional markers corresponding to family members with different diseases; The fourth dimension is the family relationship dimension, where the connection patterns between family members of different family relationships are different.
9. A family tree rendering device, characterized in that, The device includes: The acquisition module is used to acquire data information of each family member in the target family; the family members include at least the party concerned and at least one generation of family members associated with the party concerned, and each generation of family members includes at least one family member, and the data information includes at least one dimension of data of the corresponding family member; The node center position determination module is used to determine the center position of the node corresponding to the party concerned as the origin of the coordinate system, and to determine the center position of the node corresponding to each family member according to the preset vertical positioning rules and horizontal positioning rules; the vertical positioning rules are used to indicate the distance relationship between the vertical coordinate of the center position of the node corresponding to the family members of different generations and the vertical coordinate of the origin of the coordinate system, and the horizontal positioning rules are used to indicate the distance relationship between the horizontal coordinate of the center position of the node belonging to the family members of the same generation and the horizontal coordinate of the origin of the coordinate system. The rendering module is used to generate a family map of the target family based on the center position of the node corresponding to each family member and the preset mapping relationship between data information and rendering symbols; the mapping relationship includes at least one of the following: rendering the data in the first dimension of the data information as the shape symbol of the node, rendering the data in the second dimension of the data information as the fill color and / or additional mark of the shape symbol of the node, rendering the data in the third dimension of the data information as the text label of the shape symbol of the node, and rendering the data in the fourth dimension of the data information as the line shape between the shape symbols of the nodes.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 8.
