|
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 class implements a layout algorithm for genealogical data (family trees).
To be suitable for this layouter the graphs have to be organized in the following way: Individuals as well as their marriage or partnership are represented by nodes, in the following referred to as INDI nodes for individuals and FAM nodes for family nodes, corresponding to the INDI and FAM entries in Gedcom encoded genealogical data (GEDCOM is a widely used format to store genealogical data, see http://www.phpgedview.net/ged551-5.pdf for the most recent specifications).
In order to determine whether a node represents an individual or a partnership, the data provider
DP_KEY_FAMILY_TYPE
has to be registered, otherwise an IllegalArgumentException
will be thrown.
That data provider should return:
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 FAM node is linked to the INDI nodes representing husband and wife by ingoing edges and to INDI nodes representing
the children by outgoing edges. Two nodes of the same type (INDI or FAM) which are linked directly together
will cause a WrongGraphStructure
exception. A FAM node with more than two parents
will also cause a WrongGraphStructure
exception.
getTopLayouter()
and setTopLayouter(y.layout.Layouter)
.
By default, an IncrementalHierarchicLayouter
is used.
Field Summary | |
---|---|
static int |
ALIGN_BOTTOM
|
static int |
ALIGN_CENTER
|
static int |
ALIGN_TOP
|
static int |
DO_NOT_SORT_BY_SEX
Disables sorting the individuals according to their sex. |
static String |
DP_KEY_FAMILY_TYPE
Data provider key which defines a data provider for nodes which returns a String which defines the type of the node as defined in TYPE_FAMILY , TYPE_MALE , TYPE_FEMALE . |
static int |
FEMALE_ALWAYS_FIRST
Places female individuals before their male siblings and partners. |
static int |
FEMALE_FIRST
Places female individuals before their male siblings and partners if possible. |
static int |
MALE_ALWAYS_FIRST
Places female individuals before their male siblings and partners. |
static int |
MALE_FIRST
Places female individuals before their male siblings and partners if possible. |
static String |
TYPE_FAMILY
Returned by the DataProvider DP_KEY_FAMILY_TYPE for nodes which represent a family. |
static String |
TYPE_FEMALE
Returned by the DataProvider DP_KEY_FAMILY_TYPE for nodes which represent a female individual. |
static String |
TYPE_MALE
Returned by the DataProvider DP_KEY_FAMILY_TYPE for nodes which represent a male individual. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
FamilyTreeLayouter()
Creates a new instance of this |
Method Summary | |
---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Returns true if the given graph can be laid out by this algorithm. |
protected void |
doLayoutCore(LayoutGraph graph)
Main layout routine that assigns new layout information to the given graph. |
int |
getAlignment()
Gets the vertical alignment of the individual nodes |
double |
getOffsetForFamilyNodes()
Gets the offset by which a family node will be shifted down if its parents are not direct neighbours. |
int |
getSortFamilyMembers()
Gets the policy the individuals of a family will be sorted by their sex. |
double |
getSpacingBetweenFamilyMembers()
Gets the (horizontal) space between two nodes representing members of the same family. |
Layouter |
getTopLayouter()
Returns the layouter which is responsible for the layout between the family groups. |
boolean |
isFamilyNodesAlwaysBelow()
Determines whether family/marriage nodes will be placed between the partners or below them. |
boolean |
isPartnerlessBelow()
Determines the treatment of individuals who have only children but no partners. |
void |
setAlignment(int alignment)
Sets the vertical alignment of the individual nodes |
void |
setFamilyNodesAlwaysBelow(boolean fnab)
Determines whether family/marriage nodes will be placed between the partners or below them. |
void |
setOffsetForFamilyNodes(double vSpace)
Sets the offset by which a family node will be shifted down if its parents are not direct neighbours. |
void |
setPartnerlessBelow(boolean pb)
Determines the treatment of individuals who have only children but no partners. |
void |
setSortFamilyMembers(int sortFamilyMembers)
Sets the policy the individuals of a family will be sorted by their sex. |
void |
setSpacingBetweenFamilyMembers(double hSpace)
Sets the (horizontal) space between two nodes representing members of the same family. |
void |
setTopLayouter(Layouter topLayouter)
Sets the layouter which is responsible for the layout between the 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 String DP_KEY_FAMILY_TYPE
TYPE_FAMILY
, TYPE_MALE
, TYPE_FEMALE
.
Nodes for which null
is returned will be treated like nodes which represent individuals.
public static final String TYPE_FAMILY
DP_KEY_FAMILY_TYPE
for nodes which represent a family.
public static final String TYPE_MALE
DP_KEY_FAMILY_TYPE
for nodes which represent a male individual.
public static final String TYPE_FEMALE
DP_KEY_FAMILY_TYPE
for nodes which represent a female individual.
public static final int ALIGN_TOP
getAlignment()
,
setAlignment(int)
,
Constant Field Valuespublic static final int ALIGN_CENTER
getAlignment()
,
setAlignment(int)
,
Constant Field Valuespublic static final int ALIGN_BOTTOM
getAlignment()
,
setAlignment(int)
,
Constant Field Valuespublic static final int DO_NOT_SORT_BY_SEX
getSortFamilyMembers()
,
setSortFamilyMembers(int)
,
Constant Field Valuespublic static final int FEMALE_FIRST
getSortFamilyMembers()
,
setSortFamilyMembers(int)
,
Constant Field Valuespublic static final int FEMALE_ALWAYS_FIRST
getSortFamilyMembers()
,
setSortFamilyMembers(int)
,
Constant Field Valuespublic static final int MALE_FIRST
getSortFamilyMembers()
,
setSortFamilyMembers(int)
,
Constant Field Valuespublic static final int MALE_ALWAYS_FIRST
getSortFamilyMembers()
,
setSortFamilyMembers(int)
,
Constant Field ValuesConstructor Detail |
---|
public FamilyTreeLayouter()
Method Detail |
---|
public Layouter getTopLayouter()
IncrementalHierarchicLayouter
is created.
public void setTopLayouter(Layouter topLayouter)
topLayouter
- the top layouter to set.public void setSpacingBetweenFamilyMembers(double hSpace)
hSpace
- The space to set.public double getSpacingBetweenFamilyMembers()
public void setOffsetForFamilyNodes(double vSpace)
vSpace
- The offset for the family nodepublic double getOffsetForFamilyNodes()
public void setPartnerlessBelow(boolean pb)
pb
- if true, FAM nodes which have only one parent will be placed below the individualpublic boolean isPartnerlessBelow()
public void setFamilyNodesAlwaysBelow(boolean fnab)
fnab
- true, if FAM nodes are to be placed below the partners.public boolean isFamilyNodesAlwaysBelow()
public int getAlignment()
ALIGN_TOP
, ALIGN_CENTER
, ALIGN_BOTTOM
.public void setAlignment(int alignment)
IllegalArgumentException
- if the given value is not defined.alignment
- the vertical alignment, one of ALIGN_TOP
, ALIGN_CENTER
, ALIGN_BOTTOM
.public boolean canLayoutCore(LayoutGraph graph)
true
if the given graph can be laid out by this algorithm. Calling doLayout
with the given graph as it's argument will only succeed if this method returns true
.
canLayoutCore
in class CanonicMultiStageLayouter
public int getSortFamilyMembers()
DO_NOT_SORT_BY_SEX
).
setSortFamilyMembers(int)
public void setSortFamilyMembers(int sortFamilyMembers)
DO_NOT_SORT_BY_SEX
).
sortFamilyMembers
- The sorting policy of the family members.getSortFamilyMembers()
protected void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
IllegalStateException
- If the data provider DP_KEY_FAMILY_TYPE
is not registered
WrongGraphStructure
- If a family node has more than two parents, or two nodes of the same type are linked togethergraph
- The graph to run the layout on
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |