public class SpringLayoutAlgorithm extends java.lang.Object implements ILayoutAlgorithm
Constructor and Description |
---|
SpringLayoutAlgorithm() |
Modifier and Type | Method and Description |
---|---|
void |
applyLayout(boolean clean)
Makes this algorithm perform layout computation and apply it to its
context.
|
protected void |
computeForces()
Computes the force for each node in this SpringLayoutAlgorithm.
|
protected void |
computeOneIteration()
Computes one iteration (forces, positions) and increases the iteration
counter.
|
protected void |
computePositions()
Computes the position for each node in this SpringLayoutAlgorithm.
|
protected int |
getCurrentLayoutStep()
Returns the current iteration.
|
int |
getIterations()
Returns the number of iterations to be used.
|
LayoutContext |
getLayoutContext()
Returns the previously set
LayoutContext . |
boolean |
getRandom()
Returns whether or not this
SpringLayoutAlgorithm will layout the
nodes randomly before beginning iterations. |
double |
getSpringGravitation()
Returns the gravitation-control value of this SpringLayoutAlgorithm in
double precision.
|
double |
getSpringLength()
Returns the length-control value of this
SpringLayoutAlgorithm in
double precision. |
double |
getSpringMove()
Returns the move-control value of this SpringLayoutAlgorithm in double
precision.
|
double |
getSpringStrain()
Returns the strain-control value of this SpringLayoutAlgorithm in double
precision.
|
long |
getSpringTimeout()
Gets the max time this algorithm will run for
|
protected int |
getTotalNumberOfLayoutSteps()
Returns the maximum number of iterations.
|
boolean |
isResizing() |
protected boolean |
performAnotherNonContinuousIteration()
Performs one iteration based on time.
|
void |
performNIteration(int n)
Performs the given number of iterations.
|
void |
performOneIteration()
Performs one single iteration.
|
protected void |
placeRandomly()
Puts vertices in random places, all between (0,0) and (1,1).
|
void |
setIterations(int iterations)
Sets the number of iterations to be used.
|
void |
setLayoutContext(LayoutContext context)
Sets the layout context for this algorithm.
|
void |
setRandom(boolean random)
Sets whether or not this SpringLayoutAlgorithm will layout the nodes
randomly before beginning iterations.
|
void |
setResizing(boolean resizing) |
void |
setSpringGravitation(double gravitation)
Sets the spring layout gravitation-control.
|
void |
setSpringLength(double length)
Sets the spring layout length-control.
|
void |
setSpringMove(double move)
Sets the spring layout move-control.
|
void |
setSpringStrain(double strain)
Sets the spring layout strain-control.
|
void |
setSpringTimeout(long timeout)
Sets the spring timeout to the given value (in millis).
|
public void applyLayout(boolean clean)
ILayoutAlgorithm
applyLayout
in interface ILayoutAlgorithm
clean
- if true the receiver should assume that the layout context has
changed significantly and recompute the whole layout even if
it keeps track of changes with listeners. False can be used
after dynamic layout in a context is turned back on so that
layout algorithm working in background can apply accumulated
changes. Static layout algorithm can ignore this call entirely
if clean is false.public void setLayoutContext(LayoutContext context)
ILayoutAlgorithm
setLayoutContext
in interface ILayoutAlgorithm
context
- a new layout context or null if this algorithm should not
perform any layoutpublic LayoutContext getLayoutContext()
ILayoutAlgorithm
LayoutContext
.getLayoutContext
in interface ILayoutAlgorithm
LayoutContext
public void performNIteration(int n)
n
- The number of iterations to perform.public void performOneIteration()
public boolean isResizing()
public void setResizing(boolean resizing)
resizing
- true if this algorithm should resize elements (default is
false)public void setSpringMove(double move)
move
- The move-control value.public double getSpringMove()
public void setSpringStrain(double strain)
strain
- The strain-control value.public double getSpringStrain()
public void setSpringLength(double length)
length
- The length-control value.public long getSpringTimeout()
public void setSpringTimeout(long timeout)
timeout
- The new spring timeout (in millis).public double getSpringLength()
SpringLayoutAlgorithm
in
double precision.public void setSpringGravitation(double gravitation)
gravitation
- The gravitation-control value.public double getSpringGravitation()
public void setIterations(int iterations)
iterations
- The number of iterations.public int getIterations()
public void setRandom(boolean random)
random
- The random placement value.public boolean getRandom()
SpringLayoutAlgorithm
will layout the
nodes randomly before beginning iterations.true
if this algorithm will layout the nodes
randomly before iterating, otherwise false
.protected boolean performAnotherNonContinuousIteration()
true
if the maximum number of iterations was not
reached yet, otherwise false
.protected int getCurrentLayoutStep()
protected int getTotalNumberOfLayoutSteps()
protected void computeOneIteration()
protected void placeRandomly()
protected void computeForces()
protected void computePositions()
Copyright (c) 2014 itemis AG and others. All rights reserved.