Class AggregateLayout<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.AggregateLayout<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
com.google.common.base.Function<V,java.awt.geom.Point2D>
,Layout<V,E>
,IterativeContext
,java.util.function.Function<V,java.awt.geom.Point2D>
public class AggregateLayout<V,E> extends java.lang.Object implements Layout<V,E>, IterativeContext
ALayout
implementation that combines multiple other layouts so that they may be manipulated as one layout. The relaxer thread will step each layout in sequence.
-
-
Constructor Summary
Constructors Constructor Description AggregateLayout(Layout<V,E> delegate)
Creates an instance backed by the specifieddelegate
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Point2D
apply(V v)
Returns the location of the vertex.boolean
done()
java.awt.geom.Point2D
get(Layout<V,E> layout)
Layout<V,E>
getDelegate()
Graph<V,E>
getGraph()
java.util.Map<Layout<V,E>,java.awt.geom.Point2D>
getLayouts()
java.awt.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 this vertex in the main layout and in any sublayouts whose graph contains this vertex.void
put(Layout<V,E> layout, java.awt.geom.Point2D center)
Adds the passed layout as a sublayout, and specifies the center of where this sublayout should appear.void
remove(Layout<V,E> layout)
Removeslayout
from this instance.void
removeAll()
Removes all layouts from this instance.void
reset()
void
setDelegate(Layout<V,E> delegate)
void
setGraph(Graph<V,E> graph)
void
setInitializer(com.google.common.base.Function<V,java.awt.geom.Point2D> initializer)
void
setLocation(V v, java.awt.geom.Point2D location)
Changes the layout coordinates ofv
tolocation
.void
setSize(java.awt.Dimension d)
void
step()
Call step on any sublayout that is also an IterativeContext and is not done
-
-
-
Method Detail
-
setDelegate
public void setDelegate(Layout<V,E> delegate)
- Parameters:
delegate
- the delegate to set
-
put
public void put(Layout<V,E> layout, java.awt.geom.Point2D center)
Adds the passed layout as a sublayout, and specifies the center of where this sublayout should appear.- Parameters:
layout
- the layout algorithm to use as a sublayoutcenter
- the center of the coordinates for the sublayout
-
get
public java.awt.geom.Point2D get(Layout<V,E> layout)
- Parameters:
layout
- the layout whose center is to be returned- Returns:
- the center of the passed layout
-
remove
public void remove(Layout<V,E> layout)
Removeslayout
from this instance.- Parameters:
layout
- the layout to remove
-
removeAll
public void removeAll()
Removes all layouts from this instance.
-
getSize
public java.awt.Dimension 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
public boolean isLocked(V v)
-
lock
public void lock(V v, boolean state)
Locks this vertex in the main layout and in any sublayouts whose graph contains this vertex.
-
setInitializer
public void setInitializer(com.google.common.base.Function<V,java.awt.geom.Point2D> initializer)
- Specified by:
setInitializer
in interfaceLayout<V,E>
- Parameters:
initializer
- a function that specifies initial locations for all vertices
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location)
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
-
setSize
public void setSize(java.awt.Dimension d)
-
getLayouts
public java.util.Map<Layout<V,E>,java.awt.geom.Point2D> getLayouts()
- Returns:
- a map from each
Layout
instance to its center point.
-
apply
public java.awt.geom.Point2D apply(V v)
Returns the location of the vertex. The location is specified first by the sublayouts, and then by the base layout if no sublayouts operate on this vertex.
-
done
public boolean done()
- Specified by:
done
in interfaceIterativeContext
- Returns:
true
iff the delegate layout and all sublayouts are done
-
step
public void step()
Call step on any sublayout that is also an IterativeContext and is not done- Specified by:
step
in interfaceIterativeContext
-
-