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:
com.google.common.base.Function<V,,Point2D> Layout<V,,E> Function<V,Point2D>
- Direct Known Subclasses:
CircleLayout,FRLayout,FRLayout2,ISOMLayout,KKLayout,SpringLayout,StaticLayout
Abstract class for implementations of
Layout. It handles some of the
basic functions: storing coordinates, maintaining the dimensions, initializing
the locations, maintaining locked vertices.- Author:
- Danyel Fisher, Scott White, Tom Nelson - converted to jung2
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractLayout(Graph<V, E> graph) Creates an instance forgraphwhich does not initialize the vertex locations.protectedCreates an instance forgraphwhich initializes the vertex locations usinginitializer.protectedAbstractLayout(Graph<V, E> graph, com.google.common.base.Function<V, Point2D> initializer, Dimension size) Creates an instance forgraphwhich initializes the vertex locations usinginitializerand sets the size of the layout tosize.protectedAbstractLayout(Graph<V, E> graph, Dimension size) Creates an instance forgraphwhich sets the size of the layout tosize. -
Method Summary
Modifier and TypeMethodDescriptiongetGraph()getSize()Returns the current size of the visualization space, accoring to the last call to resize().doubleReturns the x coordinate of the vertex from the Coordinates object.doubleReturns the y coordinate of the vertex from the Coordinates object.booleanvoidlock(boolean lock) voidLocksvin place ifstateistrue, otherwise unlocks it.protected voidoffsetVertex(V v, double xOffset, double yOffset) voidvoidsetInitializer(com.google.common.base.Function<V, Point2D> initializer) 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 specified location.voidsetLocation(V picked, Point2D p) Changes the layout coordinates ofvtolocation.voidWhen a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.common.base.Function
equalsMethods inherited from interface edu.uci.ics.jung.algorithms.layout.Layout
initialize, reset
-
Field Details
-
size
-
graph
-
initialized
protected boolean initialized -
locations
-
-
Constructor Details
-
AbstractLayout
Creates an instance forgraphwhich does not initialize the vertex locations.- Parameters:
graph- the graph on which the layout algorithm is to operate
-
AbstractLayout
Creates an instance forgraphwhich initializes the vertex locations usinginitializer.- Parameters:
graph- the graph on which the layout algorithm is to operateinitializer- specifies the starting positions of the vertices
-
AbstractLayout
Creates an instance forgraphwhich sets the size of the layout tosize.- Parameters:
graph- the graph on which the layout algorithm is to operatesize- the dimensions of the region in which the layout algorithm will place vertices
-
AbstractLayout
protected AbstractLayout(Graph<V, E> graph, com.google.common.base.Function<V, Point2D> initializer, Dimension size) Creates an instance forgraphwhich initializes the vertex locations usinginitializerand sets the size of the layout tosize.- Parameters:
graph- the graph on which the layout algorithm is to operateinitializer- specifies the starting positions of the verticessize- the dimensions of the region in which the layout algorithm will place vertices
-
-
Method Details
-
setGraph
-
setSize
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
-
setInitializer
- Specified by:
setInitializerin interfaceLayout<V,E> - Parameters:
initializer- a function that specifies initial locations for all vertices
-
getSize
Returns the current size of the visualization space, accoring to the last call to resize(). -
apply
-
getX
Returns the x coordinate of the vertex from the Coordinates object. in most cases you will be better off calling transform(v).- Parameters:
v- the vertex whose x coordinate is to be returned- Returns:
- the x coordinate of
v
-
getY
Returns the y coordinate of the vertex from the Coordinates object. In most cases you will be better off calling transform(v).- Parameters:
v- the vertex whose y coordinate is to be returned- Returns:
- the y coordinate of
v
-
offsetVertex
- Parameters:
v- the vertex whose coordinates are to be offsetxOffset- the change to apply to this vertex's x coordinateyOffset- the change to apply to this vertex's y coordinate
-
getGraph
-
setLocation
Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the specified 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.- Parameters:
picked- the vertex whose location is being setx- the x coordinate of the location to sety- the y coordinate of the location to set
-
setLocation
Description copied from interface:LayoutChanges the layout coordinates ofvtolocation.- Specified by:
setLocationin interfaceLayout<V,E> - Parameters:
picked- the vertex whose location is to be specifiedp- the coordinates of the specified location
-
lock
Locksvin place ifstateistrue, otherwise unlocks it. -
lock
public void lock(boolean lock) - Parameters:
lock-trueto lock all vertices in place,falseto unlock all vertices
-