Class CircleLayoutAlgorithm<V>
- java.lang.Object
-
- org.jungrapht.visualization.layout.algorithms.CircleLayoutAlgorithm<V>
-
- All Implemented Interfaces:
LayoutAlgorithm<V>,AfterRunnable,ExecutorConsumer,Threaded
public class CircleLayoutAlgorithm<V> extends Object implements LayoutAlgorithm<V>, AfterRunnable, Threaded, ExecutorConsumer
ALayoutimplementation that positions vertices equally spaced on a regular circle.- Author:
- Masanori Harada, Tom Nelson - adapted to an algorithm
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCircleLayoutAlgorithm.Builder<V,T extends CircleLayoutAlgorithm<V>,B extends CircleLayoutAlgorithm.Builder<V,T,B>>-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
LayoutAlgorithm.NoOp<V>
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.util.Threaded
Threaded.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description protected Runnableafterprotected booleancancelledprotected static StringCIRCLE_REDUCE_EDGE_CROSSINGprotected static StringCIRCLE_REDUCE_EDGE_CROSSING_MAX_EDGESprotected static StringCIRCLE_THREADEDprotected Executorexecutorprotected LayoutModel<V>layoutModelprotected doubleradiusprotected booleanreduceEdgeCrossingprotected intreduceEdgeCrossingMaxEdgesprotected List<V>vertexOrderedList
-
Constructor Summary
Constructors Modifier Constructor Description CircleLayoutAlgorithm()protectedCircleLayoutAlgorithm(CircleLayoutAlgorithm.Builder<V,?,?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> CircleLayoutAlgorithm.Builder<V,?,?>builder()voidcancel()booleanconstrained()<E> intcountCrossings()intgetCrossingCount()ExecutorgetExecutor()doublegetRadius()booleanisThreaded()voidrunAfter()voidsetAfter(Runnable after)voidsetExecutor(Executor executor)voidsetRadius(double radius)Sets the radius of the circle.voidsetThreaded(boolean threaded)voidsetVertexOrder(LayoutModel<V> layoutModel, List<V> vertexList)Sets the order of the vertices in the layout according to the ordering ofvertex_list.voidvisit(LayoutModel<V> layoutModel)visit the passed layoutModel and set its locations
-
-
-
Field Detail
-
CIRCLE_REDUCE_EDGE_CROSSING
protected static final String CIRCLE_REDUCE_EDGE_CROSSING
- See Also:
- Constant Field Values
-
CIRCLE_REDUCE_EDGE_CROSSING_MAX_EDGES
protected static final String CIRCLE_REDUCE_EDGE_CROSSING_MAX_EDGES
- See Also:
- Constant Field Values
-
CIRCLE_THREADED
protected static final String CIRCLE_THREADED
- See Also:
- Constant Field Values
-
layoutModel
protected LayoutModel<V> layoutModel
-
executor
protected Executor executor
-
radius
protected double radius
-
reduceEdgeCrossing
protected boolean reduceEdgeCrossing
-
after
protected Runnable after
-
reduceEdgeCrossingMaxEdges
protected int reduceEdgeCrossingMaxEdges
-
cancelled
protected boolean cancelled
-
-
Constructor Detail
-
CircleLayoutAlgorithm
protected CircleLayoutAlgorithm(CircleLayoutAlgorithm.Builder<V,?,?> builder)
-
CircleLayoutAlgorithm
public CircleLayoutAlgorithm()
-
-
Method Detail
-
builder
public static <V> CircleLayoutAlgorithm.Builder<V,?,?> builder()
-
getRadius
public double getRadius()
- Returns:
- the radius of the circle.
-
setRadius
public void setRadius(double radius)
Sets the radius of the circle. Must be called beforeinitialize()is called.- Parameters:
radius- the radius of the circle
-
setExecutor
public void setExecutor(Executor executor)
- Specified by:
setExecutorin interfaceExecutorConsumer
-
getExecutor
public Executor getExecutor()
- Specified by:
getExecutorin interfaceExecutorConsumer
-
getCrossingCount
public int getCrossingCount()
-
isThreaded
public boolean isThreaded()
- Specified by:
isThreadedin interfaceThreaded
-
setThreaded
public void setThreaded(boolean threaded)
- Specified by:
setThreadedin interfaceThreaded
-
setVertexOrder
public void setVertexOrder(LayoutModel<V> layoutModel, List<V> vertexList)
Sets the order of the vertices in the layout according to the ordering ofvertex_list.- Parameters:
vertexList- a list specifying the ordering of the vertices
-
visit
public void visit(LayoutModel<V> layoutModel)
Description copied from interface:LayoutAlgorithmvisit the passed layoutModel and set its locations- Specified by:
visitin interfaceLayoutAlgorithm<V>- Parameters:
layoutModel- the mediator between the container for vertices (the Graph) and the mapping from Vertex to Point
-
cancel
public void cancel()
- Specified by:
cancelin interfaceLayoutAlgorithm<V>- Specified by:
cancelin interfaceThreaded
-
runAfter
public void runAfter()
- Specified by:
runAfterin interfaceAfterRunnable
-
setAfter
public void setAfter(Runnable after)
- Specified by:
setAfterin interfaceAfterRunnable
-
countCrossings
public <E> int countCrossings()
-
constrained
public boolean constrained()
- Specified by:
constrainedin interfaceLayoutAlgorithm<V>
-
-