|
||||||||||
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 registeredpublic AestheticSpringVisualizer(Graph g, AestheticSpringVisualizer.LengthFunction f, Dimension d)
g
- the input Graphf
- the Graph length functiond
- the dimension to be registeredMethod Detail |
---|
public Dimension getCurrentSize()
Layout
getCurrentSize
in interface Layout
public void applyFilter(Graph subgraph)
Layout
applyFilter
in interface Layout
subgraph
- a filtered graph that is a subgraph of the Graph returned by getGraph
public String getStatus()
Layout
getStatus
in interface Layout
public void initialize(Dimension d)
Layout
initialize
in interface Layout
public Graph getGraph()
Layout
getGraph
in interface Layout
protected void calcEdgeLength(AestheticSpringVisualizer.SpringEdgeData sed, AestheticSpringVisualizer.LengthFunction f)
public void advancePositions()
advancePositions
in interface Layout
protected 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 Layout
v
- The vertex being examined
public double getY(Vertex v)
Layout
getY
in interface Layout
v
- The vertex being examined
public double getLength(Edge e)
public void resize(Dimension size)
Layout
Layout l = new XXXLayout( g ) l.initialize(); l.resize( this.getSize() );
resize
in interface Layout
public void restart()
Layout
restart
in interface Layout
protected Iterator getAllVertices()
public Vertex getVertex(double x, double y)
Layout
getVertex
in interface Layout
x
- 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 Layout
x
- 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 Layout
public void lockVertex(Vertex v)
Layout
lockVertex
in interface Layout
v
- vertexLayout.unlockVertex(Vertex)
,
Layout.isLocked(Vertex)
public void unlockVertex(Vertex v)
Layout
unlockVertex
in interface Layout
v
- vertexLayout.lockVertex(Vertex)
,
Layout.isLocked(Vertex)
public boolean isLocked(Vertex v)
Layout
true
if the position of vertex v
is locked.
isLocked
in interface Layout
Layout.isLocked(Vertex)
public Set getVisibleEdges()
Layout
getVisibleEdges
in interface Layout
public Set getVisibleVertices()
Layout
getVisibleVertices
in interface Layout
public boolean isIncremental()
isIncremental
in interface Layout
Layout.isIncremental()
public boolean incrementsAreDone()
incrementsAreDone
in interface Layout
Layout.incrementsAreDone()
public Point2D getLocation(ArchetypeVertex v)
getLocation
in interface Layout
getLocation
in interface VertexLocationFunction
public Iterator getVertexIterator()
getVertexIterator
in interface VertexLocationFunction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |