|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.CanonicMultiStageLayouter y.layout.genealogy.FamilyTreeLayouter
public class FamilyTreeLayouter
This layout algorithm arranges genealogical graphs (family trees).
The family trees consist of nodes that represent individuals and nodes that represent families. Individuals are connected via these family nodes. The graph is arranged in layers that describe generations.
In order to determine whether a node represents an individual or a partnership, a DataProvider
has to be
registered with key DP_KEY_FAMILY_TYPE
. If this DataProvider
is missing, an
IllegalArgumentException
will be thrown.
DataProvider
provides:
TYPE_MALE
for a node representing a male individual.TYPE_FEMALE
for a node representing a female individual.TYPE_FAMILY
for a node representing a family.
A TYPE_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 WrongGraphStructure
exception will be thrown.
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 TYPE_FAMILY
nodes can be specified
in
relation to the partners. This placement can be set independently for parents
.
Field Summary | |
---|---|
static int |
ALIGN_BOTTOM
Alignment specifier that defines that all nodes in the same layer (generation) are aligned based on their bottom coordinate. |
static int |
ALIGN_CENTER
Alignment specifier that defines that all nodes in the same layer (generation) are aligned based on their center coordinate. |
static int |
ALIGN_TOP
Alignment specifier that defines that all nodes in the same layer (generation) are aligned based on their top coordinate. |
static int |
DO_NOT_SORT_BY_SEX
Order specifier that disables sorting of individuals according to their sex. |
static java.lang.String |
DP_KEY_FAMILY_TYPE
A DataProvider key for assigning a node type for each node
The layout algorithm will handle the nodes according to this type. |
static int |
FEMALE_ALWAYS_FIRST
Order specifier that places female individuals before their male siblings and partners. |
static int |
FEMALE_FIRST
Order specifier that places female individuals before their male siblings and partners, if possible. |
static int |
MALE_ALWAYS_FIRST
Order specifier that places male individuals before their female siblings and partners. |
static int |
MALE_FIRST
Order specifier that places male individuals before their female siblings and partners, if possible. |
static java.lang.String |
TYPE_FAMILY
Type specifier for nodes that connect partners with each other and their children. |
static java.lang.String |
TYPE_FEMALE
Type specifier for nodes that represent women. |
static java.lang.String |
TYPE_MALE
Type specifier for nodes that represent men. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
FamilyTreeLayouter()
Creates a new instance of FamilyTreeLayouter with default settings. |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts graphs that have a family tree structure. |
protected void |
doLayoutCore(LayoutGraph graph)
Applies a family tree layout to the given graph. |
int |
getAlignment()
Returns the vertical alignment of the individual nodes in the same generation. |
double |
getOffsetForFamilyNodes()
Returns the offset by which a TYPE_FAMILY node is shifted down if its parents are not direct neighbors. |
int |
getSortFamilyMembers()
Returns the order of individuals in the same generation (siblings, partners) based on their sex. |
double |
getSpacingBetweenFamilyMembers()
Returns the spacing between two nodes representing members of the same family in one generation. |
Layouter |
getTopLayouter()
Returns the layout algorithm that is responsible for the layout between family groups. |
boolean |
isFamilyNodesAlwaysBelow()
Returns whether or not TYPE_FAMILY nodes are placed between or below the partners. |
boolean |
isPartnerlessBelow()
Returns whether or not TYPE_FAMILY nodes of individuals that have only children but no partners are placed
below this individual or next to it. |
void |
setAlignment(int alignment)
Specifies the vertical alignment of the individual nodes in the same generation. |
void |
setFamilyNodesAlwaysBelow(boolean familyNodesAlwaysBelow)
Specifies whether or not TYPE_FAMILY nodes are placed between or below the partners. |
void |
setOffsetForFamilyNodes(double vSpace)
Specifies the offset by which a TYPE_FAMILY node is shifted down if its parents are not direct neighbors. |
void |
setParallelEdgeLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing parallel edges is activated. |
void |
setPartnerlessBelow(boolean partnerlessBelow)
Specifies whether or not TYPE_FAMILY nodes of individuals that have only children but no partners are placed
below this individual or next to it. |
void |
setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated. |
void |
setSortFamilyMembers(int sortFamilyMembers)
Specifies the order of individuals in the same generation (siblings, partners) based on their sex. |
void |
setSpacingBetweenFamilyMembers(double hSpace)
Specifies the spacing between two nodes representing members of the same family in one generation. |
void |
setTopLayouter(Layouter topLayouter)
Specifies the layout algorithm that is responsible for the layout between family groups. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DP_KEY_FAMILY_TYPE
DataProvider
key for assigning a node type for each node
The layout algorithm will handle the nodes according to this type.
public static final java.lang.String TYPE_FAMILY
DP_KEY_FAMILY_TYPE
,
Constant Field Valuespublic static final java.lang.String TYPE_MALE
DP_KEY_FAMILY_TYPE
,
Constant Field Valuespublic static final java.lang.String TYPE_FEMALE
DP_KEY_FAMILY_TYPE
,
Constant Field Valuespublic static final int ALIGN_TOP
The descriptions of the directions are based on LayoutOrientation.TOP_TO_BOTTOM
.
public static final int ALIGN_CENTER
The descriptions of the directions are based on LayoutOrientation.TOP_TO_BOTTOM
.
public static final int ALIGN_BOTTOM
The descriptions of the directions are based on LayoutOrientation.TOP_TO_BOTTOM
.
public static final int DO_NOT_SORT_BY_SEX
setSortFamilyMembers(int)
,
Constant Field Valuespublic static final int FEMALE_FIRST
public static final int FEMALE_ALWAYS_FIRST
public static final int MALE_FIRST
public static final int MALE_ALWAYS_FIRST
Constructor Detail |
---|
public FamilyTreeLayouter()
FamilyTreeLayouter
with default settings.
Method Detail |
---|
public Layouter getTopLayouter()
layout algorithm
that is responsible for the layout between family groups.
If the specified layout algorithm is null
, fallback algorithm IncrementalHierarchicLayouter
is used.
setTopLayouter(Layouter)
public void setTopLayouter(Layouter topLayouter)
layout algorithm
that is responsible for the layout between family groups.
If the specified layout algorithm is null
, fallback algorithm IncrementalHierarchicLayouter
is used.
IncrementalHierarchicLayouter
topLayouter
- the layout algorithmpublic void setSpacingBetweenFamilyMembers(double hSpace)
Values should be non-negative.
public double getSpacingBetweenFamilyMembers()
Values should be non-negative.
setSpacingBetweenFamilyMembers(double)
public void setOffsetForFamilyNodes(double vSpace)
TYPE_FAMILY
node is shifted down if its parents are not direct neighbors.
Values should be non-negative.
public double getOffsetForFamilyNodes()
TYPE_FAMILY
node is shifted down if its parents are not direct neighbors.
Values should be non-negative.
TYPE_FAMILY
nodes to their parentssetOffsetForFamilyNodes(double)
public void setPartnerlessBelow(boolean partnerlessBelow)
TYPE_FAMILY
nodes of individuals that have only children but no partners are placed
below this individual or next to it.
TYPE_FAMILY
nodes are placed below single parents.partnerlessBelow
- true
if TYPE_FAMILY
nodes with only one parent will be placed below this individual,
false
otherwisetrue | false |
public boolean isPartnerlessBelow()
TYPE_FAMILY
nodes of individuals that have only children but no partners are placed
below this individual or next to it.
TYPE_FAMILY
nodes are placed below single parents.true
if TYPE_FAMILY
nodes with only one parent will be placed below this individual,
false
otherwisesetPartnerlessBelow(boolean)
public void setFamilyNodesAlwaysBelow(boolean familyNodesAlwaysBelow)
TYPE_FAMILY
nodes are placed between or below the partners.
public boolean isFamilyNodesAlwaysBelow()
TYPE_FAMILY
nodes are placed between or below the partners.
true
if TYPE_FAMILY
nodes are placed below the partners, false
otherwisesetFamilyNodesAlwaysBelow(boolean)
,
TYPE_FAMILY
public int getAlignment()
setAlignment(int)
public void setAlignment(int alignment)
ALIGN_CENTER
alignment
- one of the valid alignment specifiers
java.lang.IllegalArgumentException
- if the specified alignment is unknownpublic void setParallelEdgeLayouterEnabled(boolean enabled)
LayoutStage
used for routing parallel edges is activated.
setParallelEdgeLayouterEnabled
in class CanonicMultiStageLayouter
FamilyTreeLayouter
cannot handle parallel edges. Disabling ParallelEdgeLayouter
will lead to errors during execution.enabled
- true
if the stage responsible for routing parallel edges is activated,
false
otherwiseCanonicMultiStageLayouter.isParallelEdgeLayouterEnabled()
,
CanonicMultiStageLayouter.setParallelEdgeLayouter(LayoutStage)
,
ParallelEdgeLayouter
public void setSelfLoopLayouterEnabled(boolean enabled)
LayoutStage
used for routing self-loops is activated.
setSelfLoopLayouterEnabled
in class CanonicMultiStageLayouter
FamilyTreeLayouter
cannot handle self-loops. Disabling SelfLoopLayouter
will
lead to errors during execution.enabled
- true
if the stage responsible for routing self-loops is activated, false
otherwiseCanonicMultiStageLayouter.isSelfLoopLayouterEnabled()
,
CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage)
,
SelfLoopLayouter
public boolean canLayoutCore(LayoutGraph graph)
A family tree graph must have a DataProvider
registered with DP_KEY_FAMILY_TYPE
key which provides
the types of the nodes.
Each node of TYPE_FAMILY
must have at most two predecessors and cannot be followed by other
TYPE_FAMILY
nodes. All other node types represent individuals which can only be connected to
TYPE_FAMILY
nodes.
canLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
true
if the graph has a family tree structure, false
otherwiseDP_KEY_FAMILY_TYPE
,
TYPE_FAMILY
,
TYPE_FEMALE
,
TYPE_MALE
public int getSortFamilyMembers()
setSortFamilyMembers(int)
public void setSortFamilyMembers(int sortFamilyMembers)
DO_NOT_SORT_BY_SEX
sortFamilyMembers
- one of the valid order specifiers
java.lang.IllegalArgumentException
- if the specified order is unknownprotected void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
graph
- the input graph
java.lang.IllegalStateException
- if no DataProvider
is registered using DP_KEY_FAMILY_TYPE
WrongGraphStructure
- if a TYPE_FAMILY
node has more than two parents or two nodes of the same type
are linked togethercanLayoutCore(LayoutGraph)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |