ged2doc.ancestor_tree¶
Module containing methods/classes for laying out ancestor trees.
Classes
|
Class implementing layout of ancestor trees. |
Interface for tree visitors. |
|
|
Class representing node in a tree, which is a box with a person name. |
-
class
ged2doc.ancestor_tree.AncestorTree(person, max_gen=4, width='5in', gen_dist='12pt', font_size='10pt')[source]¶ Bases:
objectClass implementing layout of ancestor trees.
- Parameters
- person
ged4py.model.Individual Corresponding individual, may be
None.- max_gen
int Maximum number of generations to plot, default is 4.
- width
ged2doc.size.Size, optional Specification for plot width, accepts anything convertible to
ged2doc.size.Size.- gen_dist
ged2doc.size.Size, optional Distance between generations, accepts anything convertible to
ged2doc.size.Size.- font_size
ged2doc.size.Size, optional Font size, accepts anything convertible to
ged2doc.size.Size.
- person
- Attributes
heightFull height of the tree (
ged2doc.size.Size)widthFull width of the tree (
ged2doc.size.Size)
Methods
visit(visitor)Visit every node and edge in a tree.
-
property
width¶ Full width of the tree (
ged2doc.size.Size)
-
property
height¶ Full height of the tree (
ged2doc.size.Size)
-
visit(visitor)[source]¶ Visit every node and edge in a tree.
- Parameters
- visitor
AncestorTreeVisitor Tree visitor.
- visitor
-
class
ged2doc.ancestor_tree.AncestorTreeVisitor[source]¶ Bases:
objectInterface for tree visitors.
Instances of this class can be passed to
AncestorTree.visit()method to iterate over all nodes and edges in an ancestor tree.Methods
visitFatherEdge(node, parentNode)Visitor method for an edge leading from node to its mother.
visitMotherEdge(node, parentNode)Visitor method for an edge leading from node to its mother.
visitNode(node)Visitor method for a node in tree.
-
_abc_impl= <_abc_data object>¶
-
abstract
visitNode(node)[source]¶ Visitor method for a node in tree.
- Parameters
- node
TreeNode Tree node.
- node
-
-
class
ged2doc.ancestor_tree.TreeNode(person, gen, motherNode, fatherNode, box_width, max_box_width, font_size, gen_dist)[source]¶ Bases:
objectClass representing node in a tree, which is a box with a person name.
- Parameters
- person
ged4py.model.Individual Corresponding individual, may be
None.- gen
int Generation number, 0 for the tree root.
- motherNode
TreeNode Node for mother, can be
None.- fatherNode
TreeNode Node for father, can be
None.- box_width
ged2doc.size.Size Desired width of this node, actual width can grow.
- max_box_width
ged2doc.size.Size Maximum width this node can grow to.
- font_size
ged2doc.size.Size Size of the font for the text.
- gen_dist
ged2doc.size.Size Horiz. distance between generations.
- person
- Attributes
personPerson corresponding to this node, can be None (
ged4py.model.Individual).subTreeHeightThe height of the whole tree including parent boxes (
Size).textboxTextbox for this node (
TextBox).
Methods
setY0(y0)Recalculate Y position of box tree so that topmost box is at
y0.-
_vpadding= Size(0.027777777777777776in)¶
-
property
person¶ Person corresponding to this node, can be None (
ged4py.model.Individual).
-
property
textbox¶ Textbox for this node (
TextBox).
-
property
subTreeHeight¶ The height of the whole tree including parent boxes (
Size).
-
setY0(y0)[source]¶ Recalculate Y position of box tree so that topmost box is at
y0.- Parameters
- y0
ged2doc.size.Size New topmost box position, accepts anything convertible to
ged2doc.size.Size.
- y0