public class FamilyTreeLayout extends MultiStageLayout
Basic Family Tree
In order to determine whether a node represents an individual or a partnership, a IDataProvider has to be
registered with key FAMILY_TYPE_DPKEY. If this IDataProvider is missing, an IllegalArgumentException
will be thrown.
This IDataProvider provides:
FamilyType.MALE for a node representing a male individual.FamilyType.FEMALE for a node representing a female individual.FamilyType.FAMILY for a node representing a family.All other values will be interpreted as if the node represents an individual.
A FamilyType.FAMILY node links all members of a family. It can only have two incoming edges from the parents.
Two nodes of the same type (families or individuals) cannot be directly connected. If the input graph violates these
specifications, a InvalidGraphStructureException exception will be thrown.
The layout is calculated basically in two steps:
top layout algorithm.
The distances between nodes in the same generation as well as between individuals and family nodes
can be adjusted.
Nodes in the same generation can be aligned at three different coordinates:
top, center, bottom.
The location of FamilyType.FAMILY nodes can be specified
in relation to the partners. This placement can be set independently for
parents.
| Modifier and Type | Field and Description |
|---|---|
static NodeDpKey<FamilyType> |
FAMILY_TYPE_DPKEY
A
DataProvider key for assigning a node type for each node
The layout algorithm will handle the nodes according to this type. |
| Constructor and Description |
|---|
FamilyTreeLayout()
Creates a new instance of
FamilyTreeLayout with default settings. |
| Modifier and Type | Method and Description |
|---|---|
void |
applyLayoutCore(LayoutGraph graph)
Applies a family tree layout to the given graph.
|
VerticalNodeAlignment |
getAlignment()
Gets the vertical alignment of the individual nodes in the same generation.
|
FamilyMembersSortingPolicy |
getFamilyMembersSortingPolicy()
Gets the order of individuals in the same generation (siblings, partners) based on their sex.
|
double |
getOffsetForFamilyNodes()
Gets the offset by which a
FamilyType.FAMILY node is shifted down if its parents are not direct neighbors. |
double |
getSpacingBetweenFamilyMembers()
Gets the spacing between two nodes representing members of the same family in one generation.
|
ILayoutAlgorithm |
getTopLayout()
Gets the
layout algorithm that is responsible for the layout between family groups. |
boolean |
isPlacingFamilyNodesAlwaysBelowEnabled()
Gets whether or not
FamilyType.FAMILY nodes are placed between or below the partners. |
boolean |
isPlacingPartnerlessBelowEnabled()
Gets whether or not
FamilyType.FAMILY nodes of individuals that have only children but no partners are placed
below this individual or next to it. |
void |
setAlignment(VerticalNodeAlignment value)
Sets the vertical alignment of the individual nodes in the same generation.
|
void |
setFamilyMembersSortingPolicy(FamilyMembersSortingPolicy value)
Sets the order of individuals in the same generation (siblings, partners) based on their sex.
|
void |
setOffsetForFamilyNodes(double value)
Sets the offset by which a
FamilyType.FAMILY node is shifted down if its parents are not direct neighbors. |
void |
setParallelEdgeRouterEnabled(boolean value)
Sets whether or not the
ILayoutStage used for routing parallel edges is activated. |
void |
setPlacingFamilyNodesAlwaysBelowEnabled(boolean value)
Sets whether or not
FamilyType.FAMILY nodes are placed between or below the partners. |
void |
setPlacingPartnerlessBelowEnabled(boolean value)
Sets whether or not
FamilyType.FAMILY nodes of individuals that have only children but no partners are placed
below this individual or next to it. |
void |
setSelfLoopRouterEnabled(boolean value)
Sets whether or not the
ILayoutStage used for routing self-loops is activated. |
void |
setSpacingBetweenFamilyMembers(double value)
Sets the spacing between two nodes representing members of the same family in one generation.
|
void |
setTopLayout(ILayoutAlgorithm value)
Sets the
layout algorithm that is responsible for the layout between family groups. |
appendStage, applyLayout, checkNodeSize, disableAllStages, getComponentLayout, getHideGroupsStage, getLabeling, getLayoutOrientation, getOrientationLayout, getParallelEdgeRouter, getSelfLoopRouter, getSubgraphLayout, isComponentLayoutEnabled, isHideGroupsStageEnabled, isLabelingEnabled, isOrientationLayoutEnabled, isParallelEdgeRouterEnabled, isSelfLoopRouterEnabled, isSubgraphLayoutEnabled, prependStage, removeStage, setComponentLayout, setComponentLayoutEnabled, setHideGroupsStage, setHideGroupsStageEnabled, setLabeling, setLabelingEnabled, setLayoutOrientation, setOrientationLayout, setOrientationLayoutEnabled, setParallelEdgeRouter, setSelfLoopRouter, setSubgraphLayout, setSubgraphLayoutEnabledpublic static final NodeDpKey<FamilyType> FAMILY_TYPE_DPKEY
DataProvider key for assigning a node type for each node
The layout algorithm will handle the nodes according to this type.
public FamilyTreeLayout()
FamilyTreeLayout with default settings.public void applyLayoutCore(LayoutGraph graph)
applyLayoutCore in class MultiStageLayoutIllegalStateException - if no IDataProvider is registered using FAMILY_TYPE_DPKEYInvalidGraphStructureException - if a FamilyType.FAMILY node has more than two parents or two nodes of the same type are linked togethergraph - the input graphpublic VerticalNodeAlignment getAlignment()
IllegalArgumentException - if the specified alignment is unknownVerticalNodeAlignment.CENTERsetAlignment(VerticalNodeAlignment)public FamilyMembersSortingPolicy getFamilyMembersSortingPolicy()
IllegalArgumentException - if the specified order is unknownFamilyMembersSortingPolicy.NO_SORTINGsetFamilyMembersSortingPolicy(FamilyMembersSortingPolicy)public double getOffsetForFamilyNodes()
FamilyType.FAMILY node is shifted down if its parents are not direct neighbors.
Values should be non-negative.
IllegalArgumentException - if the given offset is negativeFamilyType.FAMILY nodes to their parentssetOffsetForFamilyNodes(double)public double getSpacingBetweenFamilyMembers()
Values should be non-negative.
IllegalArgumentException - if the given spacing is negativesetSpacingBetweenFamilyMembers(double)public ILayoutAlgorithm getTopLayout()
layout algorithm that is responsible for the layout between family groups.
If the specified layout algorithm is null, fallback algorithm HierarchicLayout is used.
HierarchicLayoutsetTopLayout(ILayoutAlgorithm)public boolean isPlacingFamilyNodesAlwaysBelowEnabled()
FamilyType.FAMILY nodes are placed between or below the partners.false. FamilyType.FAMILY nodes are placed between the partners.true if FamilyType.FAMILY nodes are placed below the partners, false otherwiseFamilyType.FAMILY,
setPlacingFamilyNodesAlwaysBelowEnabled(boolean)public boolean isPlacingPartnerlessBelowEnabled()
FamilyType.FAMILY nodes of individuals that have only children but no partners are placed
below this individual or next to it.true. FamilyType.FAMILY nodes are placed below single parents.true if FamilyType.FAMILY nodes with only one parent will be placed below this individual, false
otherwisesetPlacingPartnerlessBelowEnabled(boolean)public void setAlignment(VerticalNodeAlignment value)
IllegalArgumentException - if the specified alignment is unknownVerticalNodeAlignment.CENTERvalue - one of the valid alignment specifiersgetAlignment()public void setFamilyMembersSortingPolicy(FamilyMembersSortingPolicy value)
IllegalArgumentException - if the specified order is unknownFamilyMembersSortingPolicy.NO_SORTINGvalue - one of the valid order specifiersgetFamilyMembersSortingPolicy()public void setOffsetForFamilyNodes(double value)
FamilyType.FAMILY node is shifted down if its parents are not direct neighbors.
Values should be non-negative.
IllegalArgumentException - if the given offset is negativevalue - the offset for FamilyType.FAMILY nodes to their parentsgetOffsetForFamilyNodes()public void setParallelEdgeRouterEnabled(boolean value)
ILayoutStage used for routing parallel edges is activated.setParallelEdgeRouterEnabled in class MultiStageLayoutFamilyTreeLayout cannot handle parallel edges. Disabling ParallelEdgeRouter
will lead to errors during execution.true. The stage that routes parallel edges is activated.value - true if the stage responsible for routing parallel edges is activated, false otherwiseMultiStageLayout.isParallelEdgeRouterEnabled(),
MultiStageLayout.setParallelEdgeRouter(ILayoutStage),
ParallelEdgeRouterpublic void setPlacingFamilyNodesAlwaysBelowEnabled(boolean value)
FamilyType.FAMILY nodes are placed between or below the partners.false. FamilyType.FAMILY nodes are placed between the partners.value - true if FamilyType.FAMILY nodes are placed below the partners, false otherwiseFamilyType.FAMILY,
isPlacingFamilyNodesAlwaysBelowEnabled()public void setPlacingPartnerlessBelowEnabled(boolean value)
FamilyType.FAMILY nodes of individuals that have only children but no partners are placed
below this individual or next to it.true. FamilyType.FAMILY nodes are placed below single parents.value - true if FamilyType.FAMILY nodes with only one parent will be placed below this individual, false
otherwiseisPlacingPartnerlessBelowEnabled()public void setSelfLoopRouterEnabled(boolean value)
ILayoutStage used for routing self-loops is activated.setSelfLoopRouterEnabled in class MultiStageLayoutFamilyTreeLayout cannot handle self-loops. Disabling SelfLoopRouter will lead
to errors during execution.true. The stage that routes self-loops is activated.value - true if the stage responsible for routing self-loops is activated, false otherwiseMultiStageLayout.isSelfLoopRouterEnabled(),
MultiStageLayout.setSelfLoopRouter(ILayoutStage),
SelfLoopRouterpublic void setSpacingBetweenFamilyMembers(double value)
Values should be non-negative.
IllegalArgumentException - if the given spacing is negativevalue - the spacing between family membersgetSpacingBetweenFamilyMembers()public void setTopLayout(ILayoutAlgorithm value)
layout algorithm that is responsible for the layout between family groups.
If the specified layout algorithm is null, fallback algorithm HierarchicLayout is used.
HierarchicLayoutvalue - the layout algorithmgetTopLayout()