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
ALayoutimplementation 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.Point2Dapply(V v)Returns the location of the vertex.booleandone()java.awt.geom.Point2Dget(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.DimensiongetSize()voidinitialize()Initializes fields in the node that may not have been set during the constructor.booleanisLocked(V v)voidlock(V v, boolean state)Locks this vertex in the main layout and in any sublayouts whose graph contains this vertex.voidput(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.voidremove(Layout<V,E> layout)Removeslayoutfrom this instance.voidremoveAll()Removes all layouts from this instance.voidreset()voidsetDelegate(Layout<V,E> delegate)voidsetGraph(Graph<V,E> graph)voidsetInitializer(com.google.common.base.Function<V,java.awt.geom.Point2D> initializer)voidsetLocation(V v, java.awt.geom.Point2D location)Changes the layout coordinates ofvtolocation.voidsetSize(java.awt.Dimension d)voidstep()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)
Removeslayoutfrom 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:LayoutInitializes fields in the node that may not have been set during the constructor. Must be called before the iterations begin.- Specified by:
initializein 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:
setInitializerin 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:LayoutChanges the layout coordinates ofvtolocation.- Specified by:
setLocationin 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
Layoutinstance 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:
donein interfaceIterativeContext- Returns:
trueiff 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:
stepin interfaceIterativeContext
-
-