|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscratch.scott.AestheticSpringVisualizer
public class AestheticSpringVisualizer
The SpringVisualizer package represents a visualization of a set of nodes. The SpringVisualizer, which is initialized with a Graph, assigns X/Y locations to each node. When called relax(), the SpringVisualizer moves the visualization forward one step.
| Nested Class Summary | |
|---|---|
static interface |
AestheticSpringVisualizer.LengthFunction
If the edge is weighted, then override this method to show what the visualized length is. |
class |
AestheticSpringVisualizer.SpringDimensionChecker
|
static class |
AestheticSpringVisualizer.SpringEdgeData
|
static class |
AestheticSpringVisualizer.SpringVertexData
|
| Field Summary | |
|---|---|
protected Dimension |
currentSize
|
protected Set |
dontmove
|
static int |
RANGE
|
static Object |
SPRING_KEY
|
static int |
STRETCH
|
static AestheticSpringVisualizer.LengthFunction |
UNITLENGTHFUNCTION
|
| Constructor Summary | |
|---|---|
AestheticSpringVisualizer(Graph g)
Constructor for a SpringVisualizer for a raw graph with associated dimension--the input knows how big the graph is. |
|
AestheticSpringVisualizer(Graph g,
AestheticSpringVisualizer.LengthFunction f,
Dimension d)
Constructor for a SpringVisualizer for a raw graph with associated component. |
|
AestheticSpringVisualizer(Graph g,
AestheticSpringVisualizer.LengthFunction f,
JComponent jc)
Constructor for a SpringVisualizer for a raw graph with associated component. |
|
AestheticSpringVisualizer(Graph g,
Dimension d)
Constructor for a SpringVisualizer for a raw graph with associated dimension--the input knows how big the graph is. |
|
AestheticSpringVisualizer(Graph g,
JComponent jc)
Constructor for a SpringVisualizer for a raw graph with associated component. |
|
| Method Summary | |
|---|---|
void |
advancePositions()
Relaxation step. |
void |
applyFilter(Graph subgraph)
Sets this filtered graph to be the applicable graph. |
protected void |
calcEdgeLength(AestheticSpringVisualizer.SpringEdgeData sed,
AestheticSpringVisualizer.LengthFunction f)
|
void |
forceMove(Vertex picked,
double x,
double y)
Forces a node to be moved to location x,y |
protected Iterator |
getAllEdges()
|
protected Iterator |
getAllVertices()
|
protected Vertex |
getAVertex(Edge e)
|
Dimension |
getCurrentSize()
Returns the current size of the visualization's space. |
Graph |
getGraph()
Returns the full graph (the one that was passed in at construction time) that this Layout refers to. |
double |
getLength(Edge e)
|
Point2D |
getLocation(ArchetypeVertex v)
|
AestheticSpringVisualizer.SpringEdgeData |
getSpringData(Edge e)
|
AestheticSpringVisualizer.SpringVertexData |
getSpringData(Vertex v)
|
String |
getStatus()
Returns the current status of the sytem, or null if there is no particular status to report. |
Vertex |
getVertex(double x,
double y)
Finds the closest vertex to an input (x,y) coordinate. |
Vertex |
getVertex(double x,
double y,
double maxDistance)
Finds the closest vertex to an input (x,y) coordinate. |
Iterator |
getVertexIterator()
|
Set |
getVisibleEdges()
Returns all currently showing edges |
Set |
getVisibleVertices()
Returns all currently visible vertices |
double |
getX(Vertex v)
Returns the x coordinate of vertex v at this stage in the iteration. |
double |
getY(Vertex v)
Returns the y coordinate of vertex v at this stage in the iteration. |
boolean |
incrementsAreDone()
This incremental version doesn't end. |
void |
initialize(Dimension d)
Initializes fields in the node that may not have been set during the constructor. |
boolean |
isIncremental()
This is an incremental visualization. |
boolean |
isLocked(Vertex v)
Returns true if the position of vertex v
is locked. |
void |
lockVertex(Vertex v)
Sets a flag which fixes this vertex in place. |
protected void |
moveNodes()
|
void |
resize(Dimension size)
Resets the size of the visualization. |
void |
restart()
Resets the vertex positions to their initial locations. |
void |
unlockVertex(Vertex v)
Allows this vertex to be moved. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int RANGE
protected Set dontmove
public static final Object SPRING_KEY
protected Dimension currentSize
public static int STRETCH
public static final AestheticSpringVisualizer.LengthFunction UNITLENGTHFUNCTION
| Constructor Detail |
|---|
public AestheticSpringVisualizer(Graph g,
JComponent jc)
public AestheticSpringVisualizer(Graph g)
public AestheticSpringVisualizer(Graph g,
Dimension d)
public AestheticSpringVisualizer(Graph g,
AestheticSpringVisualizer.LengthFunction f,
JComponent jc)
g - the input Graphf - the Graph length functionjc - the component to be registered
public AestheticSpringVisualizer(Graph g,
AestheticSpringVisualizer.LengthFunction f,
Dimension d)
g - the input Graphf - the Graph length functiond - the dimension to be registered| Method Detail |
|---|
public Dimension getCurrentSize()
Layout
getCurrentSize in interface Layoutpublic void applyFilter(Graph subgraph)
Layout
applyFilter in interface Layoutsubgraph - a filtered graph that is a subgraph of the Graph returned by getGraphpublic String getStatus()
Layout
getStatus in interface Layoutpublic void initialize(Dimension d)
Layout
initialize in interface Layoutpublic Graph getGraph()
Layout
getGraph in interface Layout
protected void calcEdgeLength(AestheticSpringVisualizer.SpringEdgeData sed,
AestheticSpringVisualizer.LengthFunction f)
public void advancePositions()
advancePositions in interface Layoutprotected Vertex getAVertex(Edge e)
protected Iterator getAllEdges()
protected void moveNodes()
public AestheticSpringVisualizer.SpringVertexData getSpringData(Vertex v)
public AestheticSpringVisualizer.SpringEdgeData getSpringData(Edge e)
public double getX(Vertex v)
Layout
getX in interface Layoutv - The vertex being examined
public double getY(Vertex v)
Layout
getY in interface Layoutv - The vertex being examined
public double getLength(Edge e)
public void resize(Dimension size)
LayoutLayout l = new XXXLayout( g ) l.initialize(); l.resize( this.getSize() );
resize in interface Layoutpublic void restart()
Layout
restart in interface Layoutprotected Iterator getAllVertices()
public Vertex getVertex(double x,
double y)
Layout
getVertex in interface Layoutx - The x coordinate of the inputy - The y coordinate of the input
public Vertex getVertex(double x,
double y,
double maxDistance)
Layout
getVertex in interface Layoutx - The x coordinate of the inputy - The y coordinate of the inputmaxDistance - The maximum acceptable distance. Beyond this, vertices are ignored.
public void forceMove(Vertex picked,
double x,
double y)
Layout
forceMove in interface Layoutpublic void lockVertex(Vertex v)
Layout
lockVertex in interface Layoutv - vertexLayout.unlockVertex(Vertex),
Layout.isLocked(Vertex)public void unlockVertex(Vertex v)
Layout
unlockVertex in interface Layoutv - vertexLayout.lockVertex(Vertex),
Layout.isLocked(Vertex)public boolean isLocked(Vertex v)
Layouttrue if the position of vertex v
is locked.
isLocked in interface LayoutLayout.isLocked(Vertex)public Set getVisibleEdges()
Layout
getVisibleEdges in interface Layoutpublic Set getVisibleVertices()
Layout
getVisibleVertices in interface Layoutpublic boolean isIncremental()
isIncremental in interface LayoutLayout.isIncremental()public boolean incrementsAreDone()
incrementsAreDone in interface LayoutLayout.incrementsAreDone()public Point2D getLocation(ArchetypeVertex v)
getLocation in interface LayoutgetLocation in interface VertexLocationFunctionpublic Iterator getVertexIterator()
getVertexIterator in interface VertexLocationFunction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||