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:
Layout<V,E>
,IterativeContext
,org.apache.commons.collections4.Transformer<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 boolean
done()
Check all sublayouts.keySet() and the delegate layout, returning done == true iff all are done.java.awt.geom.Point2D
get(Layout<V,E> layout)
Returns the center of the passed layout.Layout<V,E>
getDelegate()
edu.uci.ics.jung.graph.Graph<V,E>
getGraph()
Returns the graph for which this layout is defined.java.util.Map<Layout<V,E>,java.awt.geom.Point2D>
getLayouts()
Returns a map from eachLayout
instance to its center point.java.awt.Dimension
getSize()
Returns the size of the underlying layout.void
initialize()
Initializes fields in the node that may not have been set during the constructor.boolean
isLocked(V v)
Override to test if the passed vertex is locked in any of the layouts.void
lock(V v, boolean state)
override to lock or unlock this vertex in any layout with a subgraph containing itvoid
put(Layout<V,E> layout, java.awt.geom.Point2D center)
adds the passed layout as a sublayout, also specifying the center of where this sublayout should appearvoid
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(edu.uci.ics.jung.graph.Graph<V,E> graph)
setter for graphvoid
setInitializer(org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D> initializer)
provides initial locations for all vertices.void
setLocation(V v, java.awt.geom.Point2D location)
set the location of a vertexvoid
setSize(java.awt.Dimension d)
void
step()
call step on any sublayout that is also an IterativeContext and is not donejava.awt.geom.Point2D
transform(V v)
Returns the location of the vertex.
-
-
-
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, also specifying the center of where this sublayout should appear- Parameters:
layout
-center
-
-
get
public java.awt.geom.Point2D get(Layout<V,E> layout)
Returns the center of the passed layout.- Parameters:
layout
-- Returns:
- the center of the passed layout
-
removeAll
public void removeAll()
Removes all layouts from this instance.
-
getGraph
public edu.uci.ics.jung.graph.Graph<V,E> getGraph()
Returns the graph for which this layout is defined.- Specified by:
getGraph
in interfaceLayout<V,E>
- Returns:
- the graph for which this layout is defined
- See Also:
Layout.getGraph()
-
getSize
public java.awt.Dimension getSize()
Returns the size of the underlying layout.- Specified by:
getSize
in interfaceLayout<V,E>
- Returns:
- the size of the underlying layout
- See Also:
Layout.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>
- See Also:
Layout.initialize()
-
isLocked
public boolean isLocked(V v)
Override to test if the passed vertex is locked in any of the layouts.- Specified by:
isLocked
in interfaceLayout<V,E>
- Parameters:
v
-- Returns:
- true if v is locked in any of the layouts, and false otherwise
- See Also:
Layout.isLocked(java.lang.Object)
-
lock
public void lock(V v, boolean state)
override to lock or unlock this vertex in any layout with a subgraph containing it- Specified by:
lock
in interfaceLayout<V,E>
- Parameters:
v
-state
-- See Also:
Layout.lock(java.lang.Object, boolean)
-
reset
public void reset()
- Specified by:
reset
in interfaceLayout<V,E>
- See Also:
Layout.reset()
-
setGraph
public void setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
Description copied from interface:Layout
setter for graph- Specified by:
setGraph
in interfaceLayout<V,E>
- Parameters:
graph
-- See Also:
Layout.setGraph(edu.uci.ics.jung.graph.Graph)
-
setInitializer
public void setInitializer(org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D> initializer)
Description copied from interface:Layout
provides initial locations for all vertices.- Specified by:
setInitializer
in interfaceLayout<V,E>
- Parameters:
initializer
-- See Also:
Layout.setInitializer(org.apache.commons.collections4.Transformer)
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location)
Description copied from interface:Layout
set the location of a vertex- Specified by:
setLocation
in interfaceLayout<V,E>
- Parameters:
v
-location
-- See Also:
Layout.setLocation(java.lang.Object, java.awt.geom.Point2D)
-
setSize
public void setSize(java.awt.Dimension d)
- Specified by:
setSize
in interfaceLayout<V,E>
- Parameters:
d
-- See Also:
Layout.setSize(java.awt.Dimension)
-
getLayouts
public java.util.Map<Layout<V,E>,java.awt.geom.Point2D> getLayouts()
Returns a map from eachLayout
instance to its center point.
-
transform
public java.awt.geom.Point2D transform(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()
Check all sublayouts.keySet() and the delegate layout, returning done == true iff all are done.- Specified by:
done
in interfaceIterativeContext
-
step
public void step()
call step on any sublayout that is also an IterativeContext and is not done- Specified by:
step
in interfaceIterativeContext
-
-