public class TreeLayout<V,E> extends Object implements Layout<V,E>
Modifier and Type | Field and Description |
---|---|
protected Set<V> |
alreadyDone |
protected Map<V,Integer> |
basePositions |
static int |
DEFAULT_DISTX
The default horizontal vertex spacing.
|
static int |
DEFAULT_DISTY
The default vertical vertex spacing.
|
protected int |
distX
The horizontal vertex spacing.
|
protected int |
distY
The vertical vertex spacing.
|
protected Forest<V,E> |
graph |
protected com.google.common.cache.LoadingCache<V,Point2D> |
locations |
protected Point |
m_currentPoint |
protected Dimension |
size |
Constructor and Description |
---|
TreeLayout(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.
|
Modifier and Type | Method and Description |
---|---|
Point2D |
apply(V v) |
protected void |
buildTree() |
protected void |
buildTree(V v,
int x) |
Point2D |
getCenter() |
Graph<V,E> |
getGraph() |
Dimension |
getSize() |
void |
initialize()
Initializes fields in the node that may not have
been set during the constructor.
|
boolean |
isLocked(V v) |
void |
lock(V v,
boolean state)
Locks or unlocks the specified vertex.
|
void |
reset() |
protected void |
setCurrentPositionFor(V vertex) |
void |
setGraph(Graph<V,E> graph) |
void |
setInitializer(com.google.common.base.Function<V,Point2D> initializer) |
void |
setLocation(V v,
Point2D location)
Changes the layout coordinates of
v to location . |
void |
setSize(Dimension size)
This method is not supported by this class.
|
protected Dimension size
public static int DEFAULT_DISTX
public static int DEFAULT_DISTY
protected int distX
DEFAULT_XDIST
.protected int distY
DEFAULT_YDIST
.protected transient Point m_currentPoint
public TreeLayout(Forest<V,E> g)
g
- the graph on which the layout algorithm is to operatepublic TreeLayout(Forest<V,E> g, int distx)
g
- the graph on which the layout algorithm is to operatedistx
- the horizontal spacing between adjacent siblingspublic TreeLayout(Forest<V,E> g, int distx, int disty)
g
- the graph on which the layout algorithm is to operatedistx
- the horizontal spacing between adjacent siblingsdisty
- the vertical spacing between adjacent siblingsprotected void buildTree()
protected void buildTree(V v, int x)
public void setSize(Dimension size)
protected void setCurrentPositionFor(V vertex)
public Dimension getSize()
public void initialize()
Layout
initialize
in interface Layout<V,E>
public boolean isLocked(V v)
public void lock(V v, boolean state)
Layout
public void setInitializer(com.google.common.base.Function<V,Point2D> initializer)
setInitializer
in interface Layout<V,E>
initializer
- a function that specifies initial locations for all verticespublic Point2D getCenter()
public void setLocation(V v, Point2D location)
Layout
v
to location
.setLocation
in interface Layout<V,E>
v
- the vertex whose location is to be specifiedlocation
- the coordinates of the specified locationCopyright © 2015. All rights reserved.