public class SpringLayout extends AbstractLayout implements LayoutMutable
relax()
, the SpringLayout moves the
visualization forward one step.Modifier and Type | Class and Description |
---|---|
static interface |
SpringLayout.LengthFunction
If the edge is weighted, then override this method to show what the
visualized length is.
|
class |
SpringLayout.SpringDimensionChecker |
protected static class |
SpringLayout.SpringEdgeData |
protected static class |
SpringLayout.SpringVertexData |
static class |
SpringLayout.UnitLengthFunction
Returns all edges as the same length: the input value
|
Modifier and Type | Field and Description |
---|---|
protected double |
force_multiplier |
protected SpringLayout.LengthFunction |
lengthFunction |
protected int |
repulsion_range |
protected double |
stretch |
static SpringLayout.LengthFunction |
UNITLENGTHFUNCTION |
changeSupport, vertex_locations
Constructor and Description |
---|
SpringLayout(Graph g)
Constructor for a SpringLayout for a raw graph with associated
dimension--the input knows how big the graph is.
|
SpringLayout(Graph g,
SpringLayout.LengthFunction f)
Constructor for a SpringLayout for a raw graph with associated component.
|
Modifier and Type | Method and Description |
---|---|
void |
advancePositions()
Relaxation step.
|
protected void |
calcEdgeLength(SpringLayout.SpringEdgeData sed,
SpringLayout.LengthFunction f) |
protected void |
calculateRepulsion() |
protected Vertex |
getAVertex(Edge e)
Utility method, gets a single vertex from this edge.
|
double |
getForceMultiplier() |
double |
getLength(Edge e) |
int |
getRepulsionRange() |
SpringLayout.SpringEdgeData |
getSpringData(Edge e) |
SpringLayout.SpringVertexData |
getSpringData(Vertex v) |
java.lang.Object |
getSpringKey() |
java.lang.String |
getStatus()
Returns the status.
|
double |
getStretch() |
boolean |
incrementsAreDone()
For now, we pretend it never finishes.
|
protected void |
initialize_local_vertex(Vertex v)
(non-Javadoc)
|
protected void |
initialize_local()
Initializes all local information, and is called immediately within the
initialize() process.
|
boolean |
isIncremental()
This one is an incremental visualization
|
protected void |
moveNodes() |
protected void |
relaxEdges() |
void |
setForceMultiplier(double force)
Sets the force multiplier for this instance.
|
void |
setRepulsionRange(int range)
Sets the node repulsion range (in drawing area units) for this instance.
|
void |
setStretch(double stretch)
Sets the stretch parameter for this instance.
|
void |
update() |
addChangeListener, applyFilter, dontMove, fireStateChanged, forceMove, getBaseKey, getChangeListeners, getCoordinates, getCurrentSize, getEdge, getEdge, getGraph, getLocation, getVertex, getVertex, getVertexIterator, getVisibleEdges, getVisibleGraph, getVisibleVertices, getX, getY, initialize, initialize, initializeLocation, initializeLocations, isLocked, lockVertex, offsetVertex, postInitialize, removeChangeListener, resize, restart, unlockVertex
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyFilter, forceMove, getCurrentSize, getGraph, getLocation, getVertex, getVertex, getVisibleEdges, getVisibleVertices, getX, getY, initialize, isLocked, lockVertex, resize, restart, unlockVertex
getVertexIterator
protected double stretch
protected SpringLayout.LengthFunction lengthFunction
protected int repulsion_range
protected double force_multiplier
public static final SpringLayout.LengthFunction UNITLENGTHFUNCTION
public SpringLayout(Graph g)
public SpringLayout(Graph g, SpringLayout.LengthFunction f)
g
- the input Graphf
- the length functionpublic java.lang.String getStatus()
getStatus
in interface Layout
getStatus
in class AbstractLayout
public double getStretch()
setStretch(double)
public void setStretch(double stretch)
Sets the stretch parameter for this instance. This value specifies how much the degrees of an edge's incident vertices should influence how easily the endpoints of that edge can move (that is, that edge's tendency to change its length).
The default value is 0.70. Positive values less than 1 cause high-degree vertices to move less than low-degree vertices, and values > 1 cause high-degree vertices to move more than low-degree vertices. Negative values will have unpredictable and inconsistent results.
stretch
- public int getRepulsionRange()
setRepulsionRange(int)
public void setRepulsionRange(int range)
range
- public double getForceMultiplier()
setForceMultiplier(double)
public void setForceMultiplier(double force)
protected void initialize_local()
AbstractLayout
initialize_local
in class AbstractLayout
public java.lang.Object getSpringKey()
protected void initialize_local_vertex(Vertex v)
initialize_local_vertex
in class AbstractLayout
AbstractLayout.initialize_local_vertex(edu.uci.ics.jung.graph.Vertex)
protected void calcEdgeLength(SpringLayout.SpringEdgeData sed, SpringLayout.LengthFunction f)
public void advancePositions()
advancePositions
in interface Layout
advancePositions
in class AbstractLayout
Layout.advancePositions()
protected Vertex getAVertex(Edge e)
AbstractLayout
getAVertex
in class AbstractLayout
protected void relaxEdges()
protected void calculateRepulsion()
protected void moveNodes()
public SpringLayout.SpringVertexData getSpringData(Vertex v)
public SpringLayout.SpringEdgeData getSpringData(Edge e)
public double getLength(Edge e)
public boolean isIncremental()
isIncremental
in interface Layout
public boolean incrementsAreDone()
incrementsAreDone
in interface Layout
public void update()
update
in interface LayoutMutable
LayoutMutable.update()