|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.ksu.cis.bnj.gui.components.AbstractLayouter
edu.ksu.cis.bnj.gui.components.AutoLayouter
An implementation of a directed-force layout using logarithmic springs and electrical forces, as discussed in Chapter 10 of the book "Graph Drawing".
However, note that the implementation is a bit different to the equation 10.2 in the book such that:
Adapted for BNJ auto-layouter by: Roby Joehanes
List of changes:
| Field Summary | |
protected double |
electricalRepulsion
|
protected java.util.ArrayList |
fixedVertexList
|
protected double |
increment
|
protected boolean |
initialized
|
protected double |
springLength
|
protected double |
stiffness
|
| Fields inherited from class edu.ksu.cis.bnj.gui.components.AbstractLayouter |
vGraph |
| Constructor Summary | |
AutoLayouter(salvo.jesus.graph.visual.VisualGraph vGraph)
|
|
| Method Summary | |
void |
addEdge(salvo.jesus.graph.visual.VisualEdge vEdge)
|
void |
addFixedVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
Adds a VisuaLVertex that will not be moved from its position during the layout operation of ForceDirectedLayout. |
void |
addVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
|
void |
drawLayout()
This method is called to actually paint or draw the layout of the graph. |
double |
getEletricalRepulsion()
Returns the eletrical repulsion between all vertices The default value is 400. |
double |
getIncrement()
Returns the increment by which the vertices gets closer to the equilibrium or closer to the force. |
double |
getSpringLength()
Returns the desired spring length for all edges. |
double |
getStiffness()
Returns the stiffness for all edges. |
boolean |
isInitialized()
Determines if the graph has been initially laid out. |
boolean |
isVertexFixed(salvo.jesus.graph.visual.VisualVertex vVertex)
Returns true if the specified VisualVertex has a fixed position. |
void |
layout()
This method is called to layout the vertices in the graph, running a thread to perform the layout if the thread is not running, or stopping the thread if the thread is running. |
protected double |
relax(salvo.jesus.graph.visual.VisualVertex vVertex)
"Relax" the force on the VisualVertex. |
void |
removeEdge(salvo.jesus.graph.visual.VisualEdge vEdge)
|
void |
removeFixedVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
Removes a VisualVertex from the list of VisualVertices that has a fixed position. |
void |
removeVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
|
void |
setEletricalRepulsion(double repulsion)
Sets the value of the electrical repulsion between all vertices |
void |
setIncrement(double increment)
Sets the increment by which the vertices gets close to the equilibrium or gets closer to the direction of the force. |
void |
setSpringLength(double length)
Sets the desired length of the spring among all edges |
void |
setStiffness(double stiffness)
Sets the value of stiffness among all edges |
| Methods inherited from class edu.ksu.cis.bnj.gui.components.AbstractLayouter |
paintEdge, routeEdge |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected double springLength
protected double stiffness
protected double electricalRepulsion
protected double increment
protected boolean initialized
protected java.util.ArrayList fixedVertexList
| Constructor Detail |
public AutoLayouter(salvo.jesus.graph.visual.VisualGraph vGraph)
| Method Detail |
public double getSpringLength()
public double getStiffness()
public double getEletricalRepulsion()
public double getIncrement()
public void setSpringLength(double length)
public void setStiffness(double stiffness)
public void setEletricalRepulsion(double repulsion)
public void setIncrement(double increment)
public void addFixedVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
public boolean isVertexFixed(salvo.jesus.graph.visual.VisualVertex vVertex)
public void removeFixedVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
public boolean isInitialized()
isInitialized in interface salvo.jesus.graph.visual.layout.GraphLayoutManagerisInitialized in class AbstractLayouterGraphLayoutManager.isInitialized()public void layout()
This method is called to layout the vertices in the graph, running a thread to perform the layout if the thread is not running, or stopping the thread if the thread is running.
Adapted by Roby Joehanes
layout in interface salvo.jesus.graph.visual.layout.GraphLayoutManagerlayout in class AbstractLayouterGraphLayoutManager.layout()protected double relax(salvo.jesus.graph.visual.VisualVertex vVertex)
This method will:
public void drawLayout()
drawLayout in interface salvo.jesus.graph.visual.layout.GraphLayoutManagerdrawLayout in class AbstractLayouterGraphLayoutManager.drawLayout()public void addVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
addVertex in interface salvo.jesus.graph.visual.layout.GraphLayoutManageraddVertex in class AbstractLayouterGraphLayoutManager.addVertex(salvo.jesus.graph.visual.VisualVertex)public void removeEdge(salvo.jesus.graph.visual.VisualEdge vEdge)
removeEdge in interface salvo.jesus.graph.visual.layout.GraphLayoutManagerremoveEdge in class AbstractLayouterGraphLayoutManager.removeEdge(salvo.jesus.graph.visual.VisualEdge)public void removeVertex(salvo.jesus.graph.visual.VisualVertex vVertex)
removeVertex in interface salvo.jesus.graph.visual.layout.GraphLayoutManagerremoveVertex in class AbstractLayouterGraphLayoutManager.removeVertex(salvo.jesus.graph.visual.VisualVertex)public void addEdge(salvo.jesus.graph.visual.VisualEdge vEdge)
addEdge in interface salvo.jesus.graph.visual.layout.GraphLayoutManageraddEdge in class AbstractLayouterGraphLayoutManager.addEdge(salvo.jesus.graph.visual.VisualEdge)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||