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 class
TidierTreeLayoutAlgorithm.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 Rectangle
bounds
protected Predicate<V>
builderRootPredicate
protected Comparator<E>
edgeComparator
protected Predicate<E>
edgePredicate
protected List<Integer>
heights
protected LayoutModel<V>
layoutModel
protected org.jgrapht.alg.util.NeighborCache<V,E>
neighborCache
protected List<V>
roots
protected org.jgrapht.Graph<V,E>
tree
protected Comparator<V>
vertexComparator
protected 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()
protected
TidierTreeLayoutAlgorithm(TidierTreeLayoutAlgorithm.Builder<V,E,?,?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildTree(LayoutModel<V> layoutModel)
protected void
clearMetadata()
static <V,E>
TidierTreeLayoutAlgorithm.Builder<V,E,?,?>edgeAwareBuilder()
Map<V,Rectangle>
getBaseBounds()
void
setEdgeComparator(Comparator<E> edgeComparator)
void
setEdgePredicate(Predicate<E> edgePredicate)
void
setVertexComparator(Comparator<V> vertexComparator)
void
setVertexPredicate(Predicate<V> vertexPredicate)
void
visit(LayoutModel<V> layoutModel)
visit aLayoutModel
to 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:
setEdgePredicate
in interfaceEdgePredicated<V>
-
setEdgeComparator
public void setEdgeComparator(Comparator<E> edgeComparator)
- Specified by:
setEdgeComparator
in interfaceEdgeSorting<V>
-
setVertexPredicate
public void setVertexPredicate(Predicate<V> vertexPredicate)
- Specified by:
setVertexPredicate
in interfaceVertexPredicated<V>
-
setVertexComparator
public void setVertexComparator(Comparator<V> vertexComparator)
- Specified by:
setVertexComparator
in interfaceVertexSorting<V>
-
getBaseBounds
public Map<V,Rectangle> getBaseBounds()
- Specified by:
getBaseBounds
in interfaceTreeLayout<V>
- Overrides:
getBaseBounds
in classAbstractTreeLayoutAlgorithm<V>
- Returns:
- the
Map
of vertex toRectangle
that will hold all of the subtree rooted at the vertex
-
visit
public void visit(LayoutModel<V> layoutModel)
Description copied from class:AbstractTreeLayoutAlgorithm
visit aLayoutModel
to set all of the graph vertex positions according to the LayoutAlgorithm logic.- Specified by:
visit
in interfaceEdgeAwareLayoutAlgorithm<V,E>
- Specified by:
visit
in interfaceLayoutAlgorithm<V>
- Overrides:
visit
in classAbstractTreeLayoutAlgorithm<V>
- Parameters:
layoutModel
- the mediator between the container for vertices (the Graph) and the mapping
-
buildTree
protected void buildTree(LayoutModel<V> layoutModel)
-
-