|
||||||||||
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 Layout
public Graph getGraph()
Layout
getGraph
in interface Layout
public String getStatus()
Layout
getStatus
in interface Layout
public void initialize(Dimension d)
Layout
initialize
in interface Layout
public 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 Layout
v
- The vertex being examined
public double getY(Vertex v)
Layout
getY
in interface Layout
v
- The vertex being examined
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.lockVertex(Vertex)
,
Layout.unlockVertex(Vertex)
public void applyFilter(Graph g)
Layout
applyFilter
in interface Layout
g
- a filtered graph that is a subgraph of the Graph returned by getGraph
public Set getVisibleEdges()
Layout
getVisibleEdges
in interface Layout
public Set getVisibleVertices()
Layout
getVisibleVertices
in interface Layout
public Iterator getVertexIter()
public void advancePositions()
advancePositions
in interface Layout
Layout.advancePositions()
public boolean isIncremental()
isIncremental
in interface Layout
Layout.isIncremental()
public boolean incrementsAreDone()
incrementsAreDone
in interface Layout
Layout.incrementsAreDone()
public Point2D getLocation(Vertex v)
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 |