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
FieldsModifier and TypeFieldDescriptionprotected List<ChangeListener>protected edu.uci.ics.jung.visualization.util.ChangeEventSupportprotected Seta set of vertices that should not move in relation to the other verticesprotected JungVertexLocationFunctionprotected Networkprotected intprotected intFields inherited from class repast.simphony.visualization.AbstractNetworkLayout
baseGraph, layoutName, locationData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a change listener to listen for change events produced by network layout.This gets the edges or vertices from the networkabstract voidImplementors must override this method in order to create a Layout.voidApplies the filter to the current network and network g.booleanThe set of nodes that have been locked.voidNotifies all listeners that have registered interest for notification on this event type.voidForcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location.voidprotected ObjectUtility 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 NetworkAccessor for the graph that represets all visible verticesGets vertices that are equivalent to the ones passed in from the argument to applyFilter().doubleReturns the x coordinate of the vertex from the Coordinates object.intgetXSize()doubleReturns the y coordinate of the vertex from the Coordinates object.intgetYSize()voidinitialize(Dimension size) voidinitialize(Dimension size, JungVertexLocationFunction v_locations) protected voidInitializes all local information, and is called immediately within the initialize() process.protected abstract voidInitializes the local information on a single vertex.protected voidinitializeLocation(Object o, double[] coord, Dimension d) Sets random locations for a vertex within the dimensions of the space.protected voidvoidlockVertex(Object o) Adds the vertex to the DontMove listprotected voidoffsetVertex(Object o, double xOffset, double yOffset) Offset the object based on the inputsprotected voidmay be overridden to do something after initializeLocations callvoidRemoves a change listenervoidvoidWhen a visualization is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.voidrestart()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.voidsetProjection(Network projection) Sets the projection associated with this Layout.voidsetXSize(int size) voidsetYSize(int size) voidRemoves the vertex from the DontMove listvoidupdate()set update by default to advance positionsMethods inherited from class repast.simphony.visualization.AbstractNetworkLayout
getLayoutProperties, getLocationData, setLayoutPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getLocationin 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:
getGraphin 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:
addChangeListenerin interfaceedu.uci.ics.jung.visualization.util.ChangeEventSupport- Parameters:
arg0- the listener to add
-
removeChangeListener
Removes a change listener- Specified by:
removeChangeListenerin interfaceedu.uci.ics.jung.visualization.util.ChangeEventSupport- Parameters:
arg0- the listener to remove
-
getChangeListeners
Returns an array of change listener objects- Specified by:
getChangeListenersin 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:
fireStateChangedin 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:LayoutSets the projection associated with this Layout.- Specified by:
setProjectionin interfaceLayout<T,Network<T>> - Overrides:
setProjectionin 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:LayoutGets the name of the layout
-