Class AbstractLayout<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.algorithms.layout.AbstractLayout<V,E>
-
- Type Parameters:
V- the vertex typeE- the edge type
- All Implemented Interfaces:
Layout<V,E>,org.apache.commons.collections4.Transformer<V,java.awt.geom.Point2D>
- Direct Known Subclasses:
CircleLayout,FRLayout,FRLayout2,ISOMLayout,KKLayout,SpringLayout,StaticLayout
public abstract class AbstractLayout<V,E> extends java.lang.Object implements Layout<V,E>
Abstract class for implementations ofLayout. It handles some of the basic functions: storing coordinates, maintaining the dimensions, initializing the locations, maintaining locked vertices.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph)Creates an instance which does not initialize the vertex locations.protectedAbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph, java.awt.Dimension size)protectedAbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Transformer initializer)protectedAbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Transformer initializer, java.awt.Dimension size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description edu.uci.ics.jung.graph.Graph<V,E>getGraph()Accessor for the graph that represets all vertices.java.awt.DimensiongetSize()Returns the current size of the visualization space, accoring to the last call to resize().doublegetX(V v)Returns the x coordinate of the vertex from the Coordinates object.doublegetY(V v)Returns the y coordinate of the vertex from the Coordinates object.booleanisLocked(V v)Returnstrueif the position of vertexvis locked.voidlock(boolean lock)Locks all vertices in place iflockistrue, otherwise unlocks all vertices.voidlock(V v, boolean state)Locksvin place ifstateistrue, otherwise unlocks it.protected voidoffsetVertex(V v, double xOffset, double yOffset)voidsetGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)setter for graphvoidsetInitializer(org.apache.commons.collections4.Transformer initializer)provides initial locations for all vertices.voidsetLocation(V 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.voidsetLocation(V picked, java.awt.geom.Point2D p)set the location of a vertexvoidsetSize(java.awt.Dimension size)When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.java.awt.geom.Point2Dtransform(V v)-
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.algorithms.layout.Layout
initialize, reset
-
-
-
-
Constructor Detail
-
AbstractLayout
protected AbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph)
Creates an instance which does not initialize the vertex locations.- Parameters:
graph- the graph for which the layout algorithm is to be created.
-
AbstractLayout
protected AbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph, org.apache.commons.collections4.Transformer initializer)
-
AbstractLayout
protected AbstractLayout(edu.uci.ics.jung.graph.Graph<V,E> graph, java.awt.Dimension size)
-
-
Method Detail
-
setGraph
public void setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
Description copied from interface:Layoutsetter for graph
-
setSize
public void setSize(java.awt.Dimension size)
When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data. The current method calls initializeLocations followed by initialize_local.
-
isLocked
public boolean isLocked(V v)
Description copied from interface:LayoutReturnstrueif the position of vertexvis locked.
-
setInitializer
public void setInitializer(org.apache.commons.collections4.Transformer initializer)
Description copied from interface:Layoutprovides initial locations for all vertices.- Specified by:
setInitializerin interfaceLayout<V,E>
-
getSize
public java.awt.Dimension getSize()
Returns the current size of the visualization space, accoring to the last call to resize().
-
transform
public java.awt.geom.Point2D transform(V v)
-
getX
public double getX(V v)
Returns the x coordinate of the vertex from the Coordinates object. in most cases you will be better off calling transform(v).
-
getY
public double getY(V v)
Returns the y coordinate of the vertex from the Coordinates object. In most cases you will be better off calling transform(v).
-
offsetVertex
protected void offsetVertex(V v, double xOffset, double yOffset)
- Parameters:
v-xOffset-yOffset-
-
getGraph
public edu.uci.ics.jung.graph.Graph<V,E> getGraph()
Accessor for the graph that represets all vertices.
-
setLocation
public void setLocation(V 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. Does not add the vertex to the "dontmove" list, and (in the default implementation) does not make any adjustments to the rest of the graph.
-
setLocation
public void setLocation(V picked, java.awt.geom.Point2D p)
Description copied from interface:Layoutset the location of a vertex- Specified by:
setLocationin interfaceLayout<V,E>
-
lock
public void lock(V v, boolean state)
Locksvin place ifstateistrue, otherwise unlocks it.
-
lock
public void lock(boolean lock)
Locks all vertices in place iflockistrue, otherwise unlocks all vertices.
-
-