Class MultiRowEdgeAwareTreeLayoutAlgorithm<V,E>
- java.lang.Object
-
- org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.TreeLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.MultiRowTreeLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.MultiRowEdgeAwareTreeLayoutAlgorithm<V,E>
-
- 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>
public class MultiRowEdgeAwareTreeLayoutAlgorithm<V,E> extends MultiRowTreeLayoutAlgorithm<V> implements EdgeAwareLayoutAlgorithm<V,E>, TreeLayout<V>, EdgeSorting<E>, EdgePredicated<E>, VertexSorting<V>, VertexPredicated<V>
A Multi-RowTreeLayoutAlgorithmthat can be modified with comparators and predicates for both vertices and edges- Author:
- Tom Nelson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMultiRowEdgeAwareTreeLayoutAlgorithm.Builder<V,E,T extends MultiRowEdgeAwareTreeLayoutAlgorithm<V,E>,B extends MultiRowEdgeAwareTreeLayoutAlgorithm.Builder<V,E,T,B>>a Builder to create an instance of aMultiRowEdgeAwareTreeLayoutAlgorithm-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
LayoutAlgorithm.NoOp<V>
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalignFavoredEdgesprotected Comparator<E>edgeComparatoraComparatorto sort edgesprotected Predicate<E>edgePredicateaPredicateto filter edgesprotected Comparator<V>vertexComparatoraComparatorto sort verticesprotected Predicate<V>vertexPredicateaPredicateto filter vertices-
Fields inherited from class org.jungrapht.visualization.layout.algorithms.MultiRowTreeLayoutAlgorithm
rowCount
-
Fields inherited from class org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm
baseBounds, correctOverlap, defaultRootPredicate, expandLayout, horizontalVertexSpacing, neighborCache, rootComparator, rootPredicate, vertexBoundsFunction, verticalVertexSpacing, visitedVertices
-
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 MultiRowEdgeAwareTreeLayoutAlgorithm()protectedMultiRowEdgeAwareTreeLayoutAlgorithm(MultiRowEdgeAwareTreeLayoutAlgorithm.Builder<V,E,?,?> builder)create an instance with the passed builder's parameters
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<V>alignBuildTree(LayoutModel<V> layoutModel)After the tree is configured, visit all of the vertices that are on favored edges and adjust their position to the left side of their children's bounding box.protected Set<V>buildTree(LayoutModel<V> layoutModel)Build the entire forest, first measuring the width and height, then possibly expanding the layout area, then placing the vertices under rows of tree rootsprotected voidbuildTree(LayoutModel<V> layoutModel, V vertex, int x, int y, Set<V> seen)Build a subtree rooted at the passed vertex, placed at passed coordinates (x,y)protected intcalculateHeight(LayoutModel<V> layoutModel, V vertex, Set<V> seen)Calculate the height of the subtree rooted at the passed vertexprotected intcalculateWidth(LayoutModel<V> layoutModel, V vertex, Set<V> seen)Calculate the width of the subtree rooted at he passed vertexbooleanconstrained()static <V,E>
MultiRowEdgeAwareTreeLayoutAlgorithm.Builder<V,E,?,?>edgeAwareBuilder()voidsetEdgeComparator(Comparator<E> edgeComparator)voidsetEdgePredicate(Predicate<E> edgePredicate)voidsetVertexComparator(Comparator<V> vertexComparator)voidsetVertexPredicate(Predicate<V> vertexPredicate)-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.MultiRowTreeLayoutAlgorithm
builder, calculateOverallHeight, calculateWidth
-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.TreeLayoutAlgorithm
calculateHeight, getBaseBounds, getCenter, getInitialPosition, getSpanningTree, merge, visit
-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm
adjustToFill, 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.EdgeAwareLayoutAlgorithm
visit
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
cancel
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.TreeLayout
getBaseBounds, setRootComparator, setRootPredicate
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.util.VertexBoundsFunctionConsumer
accept, setVertexBoundsFunction
-
-
-
-
Field Detail
-
vertexComparator
protected Comparator<V> vertexComparator
aComparatorto sort vertices
-
edgeComparator
protected Comparator<E> edgeComparator
aComparatorto sort edges
-
alignFavoredEdges
protected boolean alignFavoredEdges
-
-
Constructor Detail
-
MultiRowEdgeAwareTreeLayoutAlgorithm
public MultiRowEdgeAwareTreeLayoutAlgorithm()
-
MultiRowEdgeAwareTreeLayoutAlgorithm
protected MultiRowEdgeAwareTreeLayoutAlgorithm(MultiRowEdgeAwareTreeLayoutAlgorithm.Builder<V,E,?,?> builder)
create an instance with the passed builder's parameters- Parameters:
builder- the builder that holds configuration parameters
-
-
Method Detail
-
edgeAwareBuilder
public static <V,E> MultiRowEdgeAwareTreeLayoutAlgorithm.Builder<V,E,?,?> edgeAwareBuilder()
- Type Parameters:
V-E-- Returns:
- a Builder for an
MultiRowEdgeAwareTreeLayoutAlgorithm
-
setVertexPredicate
public void setVertexPredicate(Predicate<V> vertexPredicate)
- Specified by:
setVertexPredicatein interfaceVertexPredicated<V>- Parameters:
vertexPredicate- property to set
-
setEdgePredicate
public void setEdgePredicate(Predicate<E> edgePredicate)
- Specified by:
setEdgePredicatein interfaceEdgePredicated<V>- Parameters:
edgePredicate- property to set
-
setVertexComparator
public void setVertexComparator(Comparator<V> vertexComparator)
- Specified by:
setVertexComparatorin interfaceVertexSorting<V>- Parameters:
vertexComparator- property to set
-
setEdgeComparator
public void setEdgeComparator(Comparator<E> edgeComparator)
- Specified by:
setEdgeComparatorin interfaceEdgeSorting<V>- Parameters:
edgeComparator- property to set
-
buildTree
protected void buildTree(LayoutModel<V> layoutModel, V vertex, int x, int y, Set<V> seen)
Build a subtree rooted at the passed vertex, placed at passed coordinates (x,y)- Overrides:
buildTreein classTreeLayoutAlgorithm<V>- Parameters:
layoutModel- theLayoutModelto hold the vertex positionsvertex- the vertex to place in positionx- the x positiony- the y positionseen- a set of vertices that were already 'seen' (and placed in the layoutModel)
-
calculateWidth
protected int calculateWidth(LayoutModel<V> layoutModel, V vertex, Set<V> seen)
Calculate the width of the subtree rooted at he passed vertex- Overrides:
calculateWidthin classTreeLayoutAlgorithm<V>- Parameters:
layoutModel- the source of the graph verticesvertex- the vertex at the root of the current subtreeseen- a set of vertices that were already measured- Returns:
-
calculateHeight
protected int calculateHeight(LayoutModel<V> layoutModel, V vertex, Set<V> seen)
Calculate the height of the subtree rooted at the passed vertex- Overrides:
calculateHeightin classTreeLayoutAlgorithm<V>- Parameters:
layoutModel- the source of the Graph and its verticesvertex- the vertex at the top of the current subtreeseen- a set of vertices that were already counted- Returns:
-
buildTree
protected Set<V> buildTree(LayoutModel<V> layoutModel)
Description copied from class:MultiRowTreeLayoutAlgorithmBuild the entire forest, first measuring the width and height, then possibly expanding the layout area, then placing the vertices under rows of tree roots- Overrides:
buildTreein classMultiRowTreeLayoutAlgorithm<V>- Parameters:
layoutModel- the model to hold vertex positions- Returns:
- the roots vertices of the tree
-
alignBuildTree
protected Set<V> alignBuildTree(LayoutModel<V> layoutModel)
After the tree is configured, visit all of the vertices that are on favored edges and adjust their position to the left side of their children's bounding box. This helps provide a more linear path for favored edge endpoints- Parameters:
layoutModel- the source of the graph and its vertices- Returns:
- the Set of root vertices
-
constrained
public boolean constrained()
- Specified by:
constrainedin interfaceLayoutAlgorithm<V>- Overrides:
constrainedin classMultiRowTreeLayoutAlgorithm<V>
-
-