Class TreeLayout<V,E>
java.lang.Object
edu.uci.ics.jung.algorithms.layout.TreeLayout<V,E>
- All Implemented Interfaces:
com.google.common.base.Function<V,
,Point2D> Layout<V,
,E> Function<V,
Point2D>
- Direct Known Subclasses:
BalloonLayout
,RadialTreeLayout
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTreeLayout
(Forest<V, E> g) Creates an instance for the specified graph with default X and Y distances.TreeLayout
(Forest<V, E> g, int distx) Creates an instance for the specified graph and X distance with default Y distance.TreeLayout
(Forest<V, E> g, int distx, int disty) Creates an instance for the specified graph, X distance, and Y distance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
private int
calculateDimensionX
(Collection<V> roots) private int
getGraph()
getSize()
void
Initializes fields in the node that may not have been set during the constructor.boolean
void
Locks or unlocks the specified vertex.void
reset()
protected void
setCurrentPositionFor
(V vertex) void
void
setInitializer
(com.google.common.base.Function<V, Point2D> initializer) void
setLocation
(V v, Point2D location) Changes the layout coordinates ofv
tolocation
.void
This method is not supported by this class.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.common.base.Function
equals
-
Field Details
-
size
-
graph
-
basePositions
-
locations
-
alreadyDone
-
DEFAULT_DISTX
public static int DEFAULT_DISTXThe default horizontal vertex spacing. Initialized to 50. -
DEFAULT_DISTY
public static int DEFAULT_DISTYThe default vertical vertex spacing. Initialized to 50. -
distX
protected int distXThe horizontal vertex spacing. Defaults toDEFAULT_XDIST
. -
distY
protected int distYThe vertical vertex spacing. Defaults toDEFAULT_YDIST
. -
m_currentPoint
-
-
Constructor Details
-
TreeLayout
Creates an instance for the specified graph with default X and Y distances.- Parameters:
g
- the graph on which the layout algorithm is to operate
-
TreeLayout
Creates an instance for the specified graph and X distance with default Y distance.- Parameters:
g
- the graph on which the layout algorithm is to operatedistx
- the horizontal spacing between adjacent siblings
-
TreeLayout
Creates an instance for the specified graph, X distance, and Y distance.- Parameters:
g
- the graph on which the layout algorithm is to operatedistx
- the horizontal spacing between adjacent siblingsdisty
- the vertical spacing between adjacent siblings
-
-
Method Details
-
buildTree
protected void buildTree() -
buildTree
-
calculateDimensionX
-
calculateDimensionX
-
setSize
This method is not supported by this class. The size of the layout is determined by the topology of the tree, and by the horizontal and vertical spacing (optionally set by the constructor). -
setCurrentPositionFor
-
getGraph
-
getSize
-
initialize
public void initialize()Description copied from interface:Layout
Initializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.- Specified by:
initialize
in interfaceLayout<V,
E>
-
isLocked
-
lock
Description copied from interface:Layout
Locks or unlocks the specified vertex. Locking the vertex fixes it at its current position, so that it will not be affected by the layout algorithm. Unlocking it allows the layout algorithm to change the vertex's position. -
reset
public void reset() -
setGraph
-
setInitializer
- Specified by:
setInitializer
in interfaceLayout<V,
E> - Parameters:
initializer
- a function that specifies initial locations for all vertices
-
getCenter
- Returns:
- the center of this layout's area.
-
setLocation
Description copied from interface:Layout
Changes the layout coordinates ofv
tolocation
.- Specified by:
setLocation
in interfaceLayout<V,
E> - Parameters:
v
- the vertex whose location is to be specifiedlocation
- the coordinates of the specified location
-
apply
-