Class JungNetworkLayout<T>
java.lang.Object
repast.simphony.visualization.AbstractNetworkLayout<T>
repast.simphony.visualization.visualization3D.layout.JungNetworkLayout<T>
- All Implemented Interfaces:
edu.uci.ics.jung.visualization.util.ChangeEventSupport
,Layout<T,
Network<T>>
- Direct Known Subclasses:
FR3DLayout
public abstract class JungNetworkLayout<T>
extends AbstractNetworkLayout<T>
implements edu.uci.ics.jung.visualization.util.ChangeEventSupport
Abstract class to construct various types of JUNG graph layouts
- Author:
- M. Altaweel
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<ChangeListener>
protected edu.uci.ics.jung.visualization.util.ChangeEventSupport
protected Set
a set of vertices that should not move in relation to the other verticesprotected JungVertexLocationFunction
protected Network
protected int
protected int
Fields inherited from class repast.simphony.visualization.AbstractNetworkLayout
baseGraph, layoutName, locationData
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a change listener to listen for change events produced by network layout.This gets the edges or vertices from the networkabstract void
Implementors must override this method in order to create a Layout.void
Applies the filter to the current network and network g.boolean
The set of nodes that have been locked.void
Notifies all listeners that have registered interest for notification on this event type.void
Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location.void
protected Object
Utility method, gets a single vertex from this edgeReturns a visualization-specific key, not currently usedReturns an array of change listener objectsdouble[]
Returns the coordinates (float[2]) that stores the vertex' x and y location.Returns the current size of the visualization space, same as JUNG AbstractLayout.getCurrentSize()getEdge
(double x, double y) Deprecated.getEdge
(double x, double y, double maxDistance) Deprecated.getGraph()
Accessor for the graph that represets all vertices.float[]
getLocation
(Object obj) Finds the location of the objectfloat[]
getLocation
(Object obj, boolean threeD) getName()
Gets the name of the layoutBy default, an AbstractLayout returns null for its status.getVertex
(double x, double y) Deprecated.getVertex
(double x, double y, double maxDistance) Deprecated.Gets edges that are equivalent to the ones passed in from the argument to applyFilter().protected Network
Accessor for the graph that represets all visible verticesGets vertices that are equivalent to the ones passed in from the argument to applyFilter().double
Returns the x coordinate of the vertex from the Coordinates object.int
getXSize()
double
Returns the y coordinate of the vertex from the Coordinates object.int
getYSize()
void
initialize
(Dimension size) void
initialize
(Dimension size, JungVertexLocationFunction v_locations) protected void
Initializes all local information, and is called immediately within the initialize() process.protected abstract void
Initializes the local information on a single vertex.protected void
initializeLocation
(Object o, double[] coord, Dimension d) Sets random locations for a vertex within the dimensions of the space.protected void
void
lockVertex
(Object o) Adds the vertex to the DontMove listprotected void
offsetVertex
(Object o, double xOffset, double yOffset) Offset the object based on the inputsprotected void
may be overridden to do something after initializeLocations callvoid
Removes a change listenervoid
void
When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.void
restart()
returnEqualSet
(Set<Object> thisVertices, Set<Object> thatVertices) two vertices or edges to compare to see if they are equaldouble[]
Returns a visualization-specific key that can be used to access UserData related to the AbstractLayout.void
setProjection
(Network projection) Sets the projection associated with this Layout.void
setXSize
(int size) void
setYSize
(int size) void
Removes the vertex from the DontMove listvoid
update()
set update by default to advance positionsMethods inherited from class repast.simphony.visualization.AbstractNetworkLayout
getLayoutProperties, getLocationData, setLayoutProperties
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface repast.simphony.visualization.Layout
getBoundingBox
-
Field Details
-
changeListeners
-
changeSupport
protected edu.uci.ics.jung.visualization.util.ChangeEventSupport changeSupport -
dontmove
a set of vertices that should not move in relation to the other vertices -
visibleGraph
-
vertex_locations
-
visibleVertices
-
visibleEdges
-
objectData
-
xSize
protected int xSize -
ySize
protected int ySize
-
-
Constructor Details
-
JungNetworkLayout
public JungNetworkLayout()
-
-
Method Details
-
dontMove
The set of nodes that have been locked. When running layout, it is important to checkif (dontmove( n )) { ... }
- Returns:
- whether this node may be legally moved or not
-
initialize
-
initialize
- Parameters:
size
- is a given dimensionv_locations
- is the calculated location for the node
-
initialize_local
protected void initialize_local()Initializes all local information, and is called immediately within the initialize() process. The user is responsible for overriding this method to do any construction that may be necessary: for example, to initialize local per-edge or graph-wide data. -
postInitialize
protected void postInitialize()may be overridden to do something after initializeLocations call -
initialize_local_vertex
Initializes the local information on a single vertex. The user is responsible for overriding this method to do any vertex-level construction that may be necessary: for example, to attach vertex-level information to each vertex. -
getBaseKey
Returns a visualization-specific key, not currently used -
initializeLocations
protected void initializeLocations() -
returnMatchingCoordinate
Returns a visualization-specific key that can be used to access UserData related to the AbstractLayout. Same as JUNG AbstractLayout.getBaseKey() -
initializeLocation
Sets random locations for a vertex within the dimensions of the space. If you want to initialize in some different way, override this method.- Parameters:
coord
-o
-d
-
-
getStatus
By default, an AbstractLayout returns null for its status. -
update
public void update()set update by default to advance positions -
advancePositions
public abstract void advancePositions()Implementors must override this method in order to create a Layout. -
getVisibleGraph
Accessor for the graph that represets all visible vertices- Returns:
- the current visible graph (i.e. network).
- See Also:
-
getCurrentSize
Returns the current size of the visualization space, same as JUNG AbstractLayout.getCurrentSize()- Returns:
- the current size of the screen
-
getAVertex
Utility method, gets a single vertex from this edge- Parameters:
an
- edge object that you want a vertex from- Returns:
- a vertex object or null
-
getCoordinates
Returns the coordinates (float[2]) that stores the vertex' x and y location.- Parameters:
o
- = the object to get coordinates from- Returns:
- a coordinate float with x and y locations.
-
getX
Returns the x coordinate of the vertex from the Coordinates object. -
getY
Returns the y coordinate of the vertex from the Coordinates object. -
getLocation
Finds the location of the object- Specified by:
getLocation
in interfaceLayout<T,
Network<T>> - Parameters:
obj
- you want to find location of- Returns:
- the float[] containing the location
-
getLocation
-
resize
When a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.- Parameters:
size
- represents the dimension that will set the current size
-
offsetVertex
Offset the object based on the inputs- Parameters:
o
- object to offsetxOffset
-yOffset
-
-
restart
public void restart()- See Also:
-
in JUNG
-
getVertex
Deprecated.Calls get vertex to get object of nearest location to x and y- Parameters:
x
- and y represent location you want object to be near
-
getVertex
Deprecated.Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance. Iterates through all visible vertices and checks their distance from the click. Override this method to provde a more efficient implementation. -
getEdge
Deprecated.Gets the edge nearest to the location of the (x,y) location selected. Calls the longer form of the call. -
getEdge
Deprecated.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. Override this method to provide a more efficient implementation.- Parameters:
x
-y
-maxDistance
-- Returns:
- Edge closest to the click.
-
getGraph
Accessor for the graph that represets all vertices. must match the nodes in the graph with the vertices created- Overrides:
getGraph
in classAbstractNetworkLayout<T>
- Returns:
- the graph that contains all vertices.
-
getVisibleEdges
Gets edges that are equivalent to the ones passed in from the argument to applyFilter().- Returns:
- set of edges from the original
-
getVisibleVertices
Gets vertices that are equivalent to the ones passed in from the argument to applyFilter().- Returns:
- set of vertices from the original
-
forceMove
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. -
forceMove
-
lockVertex
Adds the vertex to the DontMove list -
unlockVertex
Removes the vertex from the DontMove list -
applyFilter
Applies the filter to the current network and network g. Shared vertices and edges are set to the visible edges and vertices -
addChangeListener
Adds a change listener to listen for change events produced by network layout.- Specified by:
addChangeListener
in interfaceedu.uci.ics.jung.visualization.util.ChangeEventSupport
- Parameters:
arg0
- the listener to add
-
removeChangeListener
Removes a change listener- Specified by:
removeChangeListener
in interfaceedu.uci.ics.jung.visualization.util.ChangeEventSupport
- Parameters:
arg0
- the listener to remove
-
getChangeListeners
Returns an array of change listener objects- Specified by:
getChangeListeners
in interfaceedu.uci.ics.jung.visualization.util.ChangeEventSupport
-
fireStateChanged
public void fireStateChanged()Notifies all listeners that have registered interest for notification on this event type. The primary listeners will be views that need to be repainted because of changes in this model instance- Specified by:
fireStateChanged
in interfaceedu.uci.ics.jung.visualization.util.ChangeEventSupport
- See Also:
-
listener list
-
returnEqualSet
two vertices or edges to compare to see if they are equal- Parameters:
thisEdges
-thatEdges
-- Returns:
- the equal vertices between the two compared
-
addEdgesOrVertices
This gets the edges or vertices from the network- Parameters:
it
- represents the iterable object- Returns:
- the return set of the object used for edges or vertices
-
setProjection
Description copied from interface:Layout
Sets the projection associated with this Layout.- Specified by:
setProjection
in interfaceLayout<T,
Network<T>> - Overrides:
setProjection
in classAbstractNetworkLayout<T>
- Parameters:
projection
- the associated projection.
-
resetVisibleEdgesAndVertices
public void resetVisibleEdgesAndVertices() -
getXSize
public int getXSize() -
setXSize
public void setXSize(int size) -
getYSize
public int getYSize() -
setYSize
public void setYSize(int size) -
getName
Description copied from interface:Layout
Gets the name of the layout
-