Class TidierTreeLayoutAlgorithm<V,E>
- java.lang.Object
-
- org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.TidierTreeLayoutAlgorithm<V,E>
-
- Type Parameters:
V- vertex typeE- edge type
- All Implemented Interfaces:
Consumer<Function<V,Rectangle>>,EdgeAwareLayoutAlgorithm<V,E>,EdgePredicated<E>,EdgeSorting<E>,LayoutAlgorithm<V>,TreeLayout<V>,AfterRunnable,VertexBoundsFunctionConsumer<V>,VertexPredicated<V>,VertexSorting<V>
- Direct Known Subclasses:
TidierRadialTreeLayoutAlgorithm
public class TidierTreeLayoutAlgorithm<V,E> extends AbstractTreeLayoutAlgorithm<V> implements LayoutAlgorithm<V>, TreeLayout<V>, VertexBoundsFunctionConsumer<V>, EdgeAwareLayoutAlgorithm<V,E>, EdgeSorting<E>, EdgePredicated<E>, VertexSorting<V>, VertexPredicated<V>
A more compact tree layout algorithm. This implementation has been extended to allow multiple roots and to allow drawing of any directed graph for which a root or roots can be discerned.- See Also:
- "Tidier Drawings of Trees, EDWARD M. REINGOLD AND JOHN S. TILFORD"
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTidierTreeLayoutAlgorithm.Builder<V,E,T extends TidierTreeLayoutAlgorithm<V,E>,B extends TidierTreeLayoutAlgorithm.Builder<V,E,T,B>>a Builder to create a configured instance of an AnotherTreeLayoutAlgorithm-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
LayoutAlgorithm.NoOp<V>
-
-
Field Summary
Fields Modifier and Type Field Description protected Rectangleboundsprotected Predicate<V>builderRootPredicateprotected Comparator<E>edgeComparatorprotected Predicate<E>edgePredicateprotected List<Integer>heightsprotected LayoutModel<V>layoutModelprotected org.jgrapht.alg.util.NeighborCache<V,E>neighborCacheprotected List<V>rootsprotected org.jgrapht.Graph<V,E>treeprotected Comparator<V>vertexComparatorprotected Predicate<V>vertexPredicate-
Fields inherited from class org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm
baseBounds, correctOverlap, defaultRootPredicate, expandLayout, horizontalVertexSpacing, rootComparator, rootPredicate, vertexBoundsFunction, verticalVertexSpacing
-
Fields inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm
after
-
Fields inherited from interface org.jungrapht.visualization.layout.algorithms.TreeLayout
TREE_LAYOUT_HORIZONTAL_SPACING, TREE_LAYOUT_VERTICAL_SPACING
-
-
Constructor Summary
Constructors Modifier Constructor Description TidierTreeLayoutAlgorithm()protectedTidierTreeLayoutAlgorithm(TidierTreeLayoutAlgorithm.Builder<V,E,?,?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildTree(LayoutModel<V> layoutModel)protected voidclearMetadata()static <V,E>
TidierTreeLayoutAlgorithm.Builder<V,E,?,?>edgeAwareBuilder()Map<V,Rectangle>getBaseBounds()voidsetEdgeComparator(Comparator<E> edgeComparator)voidsetEdgePredicate(Predicate<E> edgePredicate)voidsetVertexComparator(Comparator<V> vertexComparator)voidsetVertexPredicate(Predicate<V> vertexPredicate)voidvisit(LayoutModel<V> layoutModel)visit aLayoutModelto set all of the graph vertex positions according to the LayoutAlgorithm logic.-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm
adjustToFill, constrained, expandToFill, moveVerticesThatOverlapVerticalEdges, setRootComparator, setRootPredicate, setVertexBoundsFunction
-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm
computeAverageVertexDimension, computeLayoutExtent, expandToFill, runAfter, setAfter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.util.AfterRunnable
runAfter, setAfter
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
cancel, constrained
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.TreeLayout
setRootComparator, setRootPredicate
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.util.VertexBoundsFunctionConsumer
accept, setVertexBoundsFunction
-
-
-
-
Field Detail
-
bounds
protected Rectangle bounds
-
vertexComparator
protected Comparator<V> vertexComparator
-
edgeComparator
protected Comparator<E> edgeComparator
-
layoutModel
protected LayoutModel<V> layoutModel
-
-
Constructor Detail
-
TidierTreeLayoutAlgorithm
public TidierTreeLayoutAlgorithm()
-
TidierTreeLayoutAlgorithm
protected TidierTreeLayoutAlgorithm(TidierTreeLayoutAlgorithm.Builder<V,E,?,?> builder)
-
-
Method Detail
-
edgeAwareBuilder
public static <V,E> TidierTreeLayoutAlgorithm.Builder<V,E,?,?> edgeAwareBuilder()
- Type Parameters:
V- vertex typeE- edge type- Returns:
- a Builder ready to configure
-
clearMetadata
protected void clearMetadata()
-
setEdgePredicate
public void setEdgePredicate(Predicate<E> edgePredicate)
- Specified by:
setEdgePredicatein interfaceEdgePredicated<V>
-
setEdgeComparator
public void setEdgeComparator(Comparator<E> edgeComparator)
- Specified by:
setEdgeComparatorin interfaceEdgeSorting<V>
-
setVertexPredicate
public void setVertexPredicate(Predicate<V> vertexPredicate)
- Specified by:
setVertexPredicatein interfaceVertexPredicated<V>
-
setVertexComparator
public void setVertexComparator(Comparator<V> vertexComparator)
- Specified by:
setVertexComparatorin interfaceVertexSorting<V>
-
getBaseBounds
public Map<V,Rectangle> getBaseBounds()
- Specified by:
getBaseBoundsin interfaceTreeLayout<V>- Overrides:
getBaseBoundsin classAbstractTreeLayoutAlgorithm<V>- Returns:
- the
Mapof vertex toRectanglethat will hold all of the subtree rooted at the vertex
-
visit
public void visit(LayoutModel<V> layoutModel)
Description copied from class:AbstractTreeLayoutAlgorithmvisit aLayoutModelto set all of the graph vertex positions according to the LayoutAlgorithm logic.- Specified by:
visitin interfaceEdgeAwareLayoutAlgorithm<V,E>- Specified by:
visitin interfaceLayoutAlgorithm<V>- Overrides:
visitin classAbstractTreeLayoutAlgorithm<V>- Parameters:
layoutModel- the mediator between the container for vertices (the Graph) and the mapping
-
buildTree
protected void buildTree(LayoutModel<V> layoutModel)
-
-