|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.uci.ics.jung.visualization.AbstractLayout
public abstract class 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.
| Field Summary | |
|---|---|
protected ChangeEventSupport |
changeSupport
|
protected VertexLocationFunction |
vertex_locations
|
| Constructor Summary | |
|---|---|
AbstractLayout(Graph g)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener. |
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)
Deprecated. As of version 1.7.5, superseded by Layout.isLocked(Vertex). |
void |
fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. |
void |
forceMove(Vertex picked,
double x,
double y)
Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location. |
protected Vertex |
getAVertex(Edge e)
Utility method, gets a single vertex from this edge. |
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. |
ChangeListener[] |
getChangeListeners()
Returns an array of all the ChangeListeners added
with addChangeListener(). |
Coordinates |
getCoordinates(ArchetypeVertex v)
Returns the Coordinates object that stores the vertex' x and y location. |
Dimension |
getCurrentSize()
Returns the current size of the visualization space, accoring to the last call to resize(). |
Edge |
getEdge(double x,
double y)
Deprecated. Use PickSupport instead |
Edge |
getEdge(double x,
double y,
double maxDistance)
Deprecated. Use PickSupport instead |
Graph |
getGraph()
Accessor for the graph that represets all vertices. |
Point2D |
getLocation(ArchetypeVertex v)
|
String |
getStatus()
Returns the current status of the sytem, or null if there is no particular status to report.By default, an AbstractLayout returns null for its status. |
Vertex |
getVertex(double x,
double y)
Deprecated. Use PickSupport instead |
Vertex |
getVertex(double x,
double y,
double maxDistance)
Deprecated. Use PickSupport instead |
Iterator |
getVertexIterator()
|
Set |
getVisibleEdges()
Returns the set of edges from the original getGraph that are now visible. |
protected Graph |
getVisibleGraph()
Accessor for the graph that represets all visible vertices. |
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 Coordinates object. |
double |
getY(Vertex v)
Returns the y coordinate of the vertex from the Coordinates object. |
protected abstract void |
initialize_local_vertex(Vertex v)
Initializes the local information on a single vertex. |
protected void |
initialize_local()
Initializes all local information, and is called immediately within the initialize() process. |
void |
initialize(Dimension size)
Initializer, calls intialize_local and initializeLocations to start construction process. |
void |
initialize(Dimension size,
VertexLocationFunction v_locations)
|
protected void |
initializeLocation(Vertex v,
Coordinates coord,
Dimension d)
Sets random locations for a vertex within the dimensions of the space. |
protected void |
initializeLocations()
This method calls initialize_local_vertex for each vertex, and also adds initial coordinate information for each vertex. |
boolean |
isLocked(Vertex v)
Returns true if the position of vertex v
is locked. |
void |
lockVertex(Vertex v)
Adds the vertex to the DontMove list |
protected void |
offsetVertex(Vertex v,
double xOffset,
double yOffset)
|
protected void |
postInitialize()
may be overridden to do something after initializeLocations call |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener. |
void |
resize(Dimension size)
When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data. |
void |
restart()
Resets the vertex positions to their initial locations. |
void |
unlockVertex(Vertex v)
Removes the vertex from the DontMove list |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.uci.ics.jung.visualization.Layout |
|---|
incrementsAreDone, isIncremental |
| Field Detail |
|---|
protected ChangeEventSupport changeSupport
protected VertexLocationFunction vertex_locations
| Constructor Detail |
|---|
public AbstractLayout(Graph g)
g - | Method Detail |
|---|
public boolean dontMove(Vertex v)
Layout.isLocked(Vertex).
if (dontmove( v )) { ... }
public boolean isLocked(Vertex v)
Layouttrue if the position of vertex v
is locked.
isLocked in interface LayoutLayout.lockVertex(Vertex),
Layout.unlockVertex(Vertex)public Iterator getVertexIterator()
getVertexIterator in interface VertexLocationFunctionpublic void initialize(Dimension size)
initialize in interface Layout
public void initialize(Dimension size,
VertexLocationFunction v_locations)
protected void initialize_local()
protected void postInitialize()
protected abstract void initialize_local_vertex(Vertex v)
public Object getBaseKey()
protected void initializeLocations()
protected void initializeLocation(Vertex v,
Coordinates coord,
Dimension d)
coord - d - public String getStatus()
getStatus in interface Layoutpublic 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 LayoutLayout.advancePositions()protected Graph getVisibleGraph()
getVisibleEdges(),
getVisibleVertices()public Dimension getCurrentSize()
getCurrentSize in interface Layoutprotected Vertex getAVertex(Edge e)
public Coordinates getCoordinates(ArchetypeVertex v)
v - A Vertex that is a part of the Graph being visualized.
public double getX(Vertex v)
getX in interface Layoutv - The vertex being examined
Layout.getX(edu.uci.ics.jung.graph.Vertex)public double getY(Vertex v)
getY in interface Layoutv - The vertex being examined
Layout.getX(edu.uci.ics.jung.graph.Vertex)public Point2D getLocation(ArchetypeVertex v)
getLocation in interface LayoutgetLocation in interface VertexLocationFunctionv - a Vertex of interest
public void resize(Dimension size)
resize in interface Layout
protected void offsetVertex(Vertex v,
double xOffset,
double yOffset)
v - xOffset - yOffset - public void restart()
Layout
restart in interface LayoutLayout.restart()
public Vertex getVertex(double x,
double y)
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)
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 Edge getEdge(double x,
double y)
public Edge getEdge(double x,
double y,
double maxDistance)
x - y - maxDistance -
public Graph getGraph()
getGraph in interface Layoutpublic Set getVisibleEdges()
getVisibleEdges in interface Layoutpublic Set getVisibleVertices()
getVisibleVertices in interface Layout
public void forceMove(Vertex picked,
double x,
double y)
forceMove in interface Layoutpublic void lockVertex(Vertex v)
lockVertex in interface Layoutv - vertexLayout.unlockVertex(Vertex),
Layout.isLocked(Vertex)public void unlockVertex(Vertex v)
unlockVertex in interface Layoutv - vertexLayout.lockVertex(Vertex),
Layout.isLocked(Vertex)public void applyFilter(Graph g)
applyFilter in interface Layoutg - a filtered graph that is a subgraph of the Graph returned by getGraphLayout.applyFilter(Graph g)public void addChangeListener(ChangeListener l)
ChangeListener.
addChangeListener in interface ChangeEventSupportl - the listener to be addedpublic void removeChangeListener(ChangeListener l)
removeChangeListener in interface ChangeEventSupportl - the listener to be removedpublic ChangeListener[] getChangeListeners()
ChangeListeners added
with addChangeListener().
getChangeListeners in interface ChangeEventSupportChangeListeners added or an empty
array if no listeners have been addedpublic void fireStateChanged()
fireStateChanged in interface ChangeEventSupportEventListenerList
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||