|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.jung.visualization.AbstractLayout
Implements some of the dirty work of writing a layout algorithm, allowing the user to express their major intent more simply. When writing a Layout, there are many shared tasks: handling tracking locked nodes, applying filters, and tracing nearby vertices. This package automates all of those.
Constructor Summary | |
AbstractLayout(Graph g)
Constructor. |
Method Summary | |
abstract void |
advancePositions()
Implementors must override this method in order to create a Layout. |
void |
applyFilter(Graph g)
Applies the filter to the current graph. |
boolean |
dontMove(Vertex v)
The set of vertices that have been locked. |
void |
forceMove(Vertex picked,
int x,
int y)
Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location. |
java.lang.Object |
getBaseKey()
Returns a visualization-specific key (that is, specific both to this instance and AbstractLayout) that can be used to access UserData related to the AbstractLayout. |
Coordinates |
getCoordinates(Vertex v)
Returns the Coordinates object that stores the vertex' x and y location. |
java.awt.Dimension |
getCurrentSize()
Returns the current size of the visualization space, accoring to the last call to resize(). |
Edge |
getEdge(double x,
double y)
Gets the edge nearest to the location of the (x,y) location selected. |
Edge |
getEdge(double x,
double y,
double maxDistance)
Gets the edge nearest to the location of the (x,y) location selected, within a distance of maxDistance, Iterates through all visible edges and checks their distance from the click. |
Graph |
getGraph()
Accessor for the graph that represets all vertices. |
java.lang.String |
getStatus()
Returns the current status of the sytem, or null if there is no particular status to report. Useful for reporting things like number of iterations passed, temperature, and so on.By default, an AbstractLayout returns null for its status. |
Vertex |
getVertex(double x,
double y)
Gets the vertex nearest to the location of the (x,y) location selected. |
Vertex |
getVertex(double x,
double y,
double maxDistance)
Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance. |
java.util.Set |
getVisibleEdges()
Returns the set of edges from the original getGraph that are now visible. |
java.util.Set |
getVisibleVertices()
Returns the set of vertices from the original getGraph that are now visible. |
double |
getX(Vertex v)
Returns the x coordinate of the vertex from the Coordiantes object. |
double |
getY(Vertex v)
Returns the y coordinate of the vertex from the Coordiantes object. |
void |
initialize(java.awt.Dimension size)
Initializer, calls intialize_local and initializeLocations to start construction process. |
void |
lockVertex(Vertex v)
Adds the vertex to the DontMove list |
void |
resize(java.awt.Dimension size)
When a visualizetion is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data. |
void |
restart()
Restarts the visualization entirely, as if the the user had pressed the "scramble" button. |
void |
unlockVertex(Vertex v)
Removes the vertex from the DontMove list |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.uci.ics.jung.visualization.Layout |
incrementsAreDone, isIncremental |
Constructor Detail |
public AbstractLayout(Graph g)
g
- Method Detail |
public boolean dontMove(Vertex v)
if (dontmove( v )) { ... }
public void initialize(java.awt.Dimension size)
initialize
in interface Layout
public java.lang.Object getBaseKey()
public java.lang.String getStatus()
getStatus
in interface Layout
public abstract void advancePositions()
Note that "locked" vertices are not to be moved; however, it is the policy of the visualization to decide how to handle them, and what to do with the vertices around them. Prototypical code might include a clipping like
for (Iterator i = getVertices().iterator(); i.hasNext() ) { Vertex v = (Vertex) i.next(); if (! dontmove.contains( v ) ) { ... // handle the node } else { // ignore the node } }
advancePositions
in interface Layout
Layout.advancePositions()
public java.awt.Dimension getCurrentSize()
getCurrentSize
in interface Layout
public Coordinates getCoordinates(Vertex v)
v
- A Vertex that is a part of the Graph being visualized.
public double getX(Vertex v)
getX
in interface Layout
v
- The vertex being examined
Layout.getX(edu.uci.ics.jung.graph.Vertex)
public double getY(Vertex v)
getY
in interface Layout
v
- The vertex being examined
Layout.getX(edu.uci.ics.jung.graph.Vertex)
public void resize(java.awt.Dimension size)
resize
in interface Layout
size
- public void restart()
restart
in interface Layout
public Vertex getVertex(double x, double y)
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)
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 Edge getEdge(double x, double y)
public Edge getEdge(double x, double y, double maxDistance)
x
- y
- maxDistance
-
public Graph getGraph()
getGraph
in interface Layout
public java.util.Set getVisibleEdges()
getVisibleEdges
in interface Layout
public java.util.Set getVisibleVertices()
getVisibleVertices
in interface Layout
public void forceMove(Vertex picked, int x, int y)
forceMove
in interface Layout
picked
- x
- y
- public void lockVertex(Vertex v)
lockVertex
in interface Layout
v
- vertexLayout.unlockVertex(Vertex)
public void unlockVertex(Vertex v)
unlockVertex
in interface Layout
v
- vertexLayout.lockVertex(Vertex)
public void applyFilter(Graph g)
applyFilter
in interface Layout
g
- a filtered graph that is a subgraph of the Graph returned by getGraph
Layout.applyFilter(Graph g)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |