|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscratch.danyel.sample.CircleLayout
public class CircleLayout
The CircleLayout package represents a visualization of a set of nodes. CircleLayouts simply place all nodes in a circle around a center. This is a rather trivial algorithm, and fails in a few cases. In particular, it re-places nodes poorly. [Possible: Steps attempt to swap pairs of vertices to improve the layout]
| Nested Class Summary | |
|---|---|
static class |
CircleLayout.CircleEdgeData
|
static class |
CircleLayout.CircleVertexData
|
static interface |
CircleLayout.LengthFunction
If the edge is weighted, then override this method to show what the visualized length is. |
class |
CircleLayout.SpringDimensionChecker
|
| Field Summary | |
|---|---|
protected Dimension |
currentSize
|
protected Set |
dontmove
|
static CircleLayout.LengthFunction |
UNITLENGTHFUNCTION
|
| Constructor Summary | |
|---|---|
CircleLayout(Graph g)
Constructor for a SpringVisualizer for a raw graph with associated dimension--the input knows how big the graph is. |
|
| Method Summary | |
|---|---|
void |
advancePositions()
Does nothing: this method is non-incremental.' |
void |
advanceVisualization()
Relaxation step. |
void |
applyFilter(Graph g)
Sets this filtered graph to be the applicable graph. |
void |
forceMove(Vertex picked,
double x,
double y)
Forces a node to be moved to location x,y |
protected Iterator |
getAllVertices()
|
protected Vertex |
getAVertex(Edge e)
|
CircleLayout.CircleVertexData |
getCircleData(Vertex v)
|
Object |
getCircleKey()
|
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. |
Point2D |
getLocation(ArchetypeVertex v)
|
Point2D |
getLocation(Vertex v)
|
CircleLayout.CircleEdgeData |
getSpringData(Edge e)
|
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 |
getVertexIter()
|
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()
Shouldn't be used. |
void |
initialize(Dimension d)
Initializes fields in the node that may not have been set during the constructor. |
boolean |
isIncremental()
Returns false. |
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. |
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 |
|---|
protected Set dontmove
protected Dimension currentSize
public static final CircleLayout.LengthFunction UNITLENGTHFUNCTION
| Constructor Detail |
|---|
public CircleLayout(Graph g)
| Method Detail |
|---|
public Object getCircleKey()
public Dimension getCurrentSize()
Layout
getCurrentSize in interface Layoutpublic Graph getGraph()
Layout
getGraph in interface Layoutpublic String getStatus()
Layout
getStatus in interface Layoutpublic void initialize(Dimension d)
Layout
initialize in interface Layoutpublic void advanceVisualization()
protected Vertex getAVertex(Edge e)
public CircleLayout.CircleVertexData getCircleData(Vertex v)
public CircleLayout.CircleEdgeData 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 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.lockVertex(Vertex),
Layout.unlockVertex(Vertex)public void applyFilter(Graph g)
Layout
applyFilter in interface Layoutg - a filtered graph that is a subgraph of the Graph returned by getGraphpublic Set getVisibleEdges()
Layout
getVisibleEdges in interface Layoutpublic Set getVisibleVertices()
Layout
getVisibleVertices in interface Layoutpublic Iterator getVertexIter()
public void advancePositions()
advancePositions in interface LayoutLayout.advancePositions()public boolean isIncremental()
isIncremental in interface LayoutLayout.isIncremental()public boolean incrementsAreDone()
incrementsAreDone in interface LayoutLayout.incrementsAreDone()public Point2D getLocation(Vertex v)
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 | |||||||||