Package ghidra.graph.viewer.layout
Class JungWrappingVisualGraphLayoutAdapter<V extends VisualVertex,E extends VisualEdge<V>>
- java.lang.Object
-
- ghidra.graph.viewer.layout.JungWrappingVisualGraphLayoutAdapter<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
com.google.common.base.Function<V,java.awt.geom.Point2D>
,edu.uci.ics.jung.algorithms.layout.Layout<V,E>
,VisualGraphLayout<V,E>
- Direct Known Subclasses:
JungLayout
public class JungWrappingVisualGraphLayoutAdapter<V extends VisualVertex,E extends VisualEdge<V>> extends java.lang.Object implements VisualGraphLayout<V,E>
A wrapper that allows for existing Jung layouts to be used inside of the Visual Graph system.
-
-
Constructor Summary
Constructors Constructor Description JungWrappingVisualGraphLayoutAdapter(edu.uci.ics.jung.algorithms.layout.Layout<V,E> jungLayout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLayoutListener(LayoutListener<V,E> listener)
Adds a layout listenerjava.awt.geom.Point2D
apply(V v)
LayoutPositions<V,E>
calculateLocations(VisualGraph<V,E> graph, TaskMonitor monitor)
Signals to again layout the current graph.protected edu.uci.ics.jung.algorithms.layout.Layout<V,E>
cloneJungLayout(VisualGraph<V,E> newGraph)
JungWrappingVisualGraphLayoutAdapter
cloneLayout(VisualGraph<V,E> newGraph)
Creates a new version of this layout using the given graph.void
dispose()
Cleanup any resource being managed by this layout.edu.uci.ics.jung.visualization.renderers.Renderer.EdgeLabel<V,E>
getEdgeLabelRenderer()
Returns an optional custom edge label renderer.edu.uci.ics.jung.visualization.renderers.BasicEdgeRenderer<V,E>
getEdgeRenderer()
Returns an optional edge renderer.com.google.common.base.Function<E,java.awt.Shape>
getEdgeShapeTransformer()
Returns an optional edge shape transformer.edu.uci.ics.jung.graph.Graph<V,E>
getGraph()
java.awt.Dimension
getSize()
VisualGraph<V,E>
getVisualGraph()
Returns the graph of this layoutvoid
initialize()
boolean
isLocked(V v)
void
lock(V v, boolean lock)
void
removeLayoutListener(LayoutListener<V,E> listener)
Removes a layout listenervoid
reset()
void
setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
void
setInitializer(com.google.common.base.Function<V,java.awt.geom.Point2D> t)
void
setLocation(V v, java.awt.geom.Point2D location)
void
setLocation(V v, java.awt.geom.Point2D location, LayoutListener.ChangeType changeType)
Allows the client to change the location while specifying the type of changevoid
setSize(java.awt.Dimension d)
boolean
usesEdgeArticulations()
Returns true if this layout uses articulated edges.
-
-
-
Field Detail
-
delegate
protected edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>> delegate
-
-
Method Detail
-
initialize
public void initialize()
- Specified by:
initialize
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
reset
public void reset()
- Specified by:
reset
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
calculateLocations
public LayoutPositions<V,E> calculateLocations(VisualGraph<V,E> graph, TaskMonitor monitor)
Description copied from interface:VisualGraphLayout
Signals to again layout the current graph. The locations generated by the layout will be returned, but not actually applied to the graph. This allows clients to generate new locations and then apply them in a delayed fashion, like for animation.- Specified by:
calculateLocations
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
graph
- the graph that contains the vertices to layoutmonitor
- the task monitor used to report progress or to cancel
-
cloneLayout
public JungWrappingVisualGraphLayoutAdapter cloneLayout(VisualGraph<V,E> newGraph)
Description copied from interface:VisualGraphLayout
Creates a new version of this layout using the given graph. Also, the new layout will have the same state as this layout (i.e., vertex positions (and edge articulations, if applicable)).- Specified by:
cloneLayout
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
newGraph
- the new graph for the new layout- Returns:
- the new layout
-
cloneJungLayout
protected edu.uci.ics.jung.algorithms.layout.Layout<V,E> cloneJungLayout(VisualGraph<V,E> newGraph)
-
usesEdgeArticulations
public boolean usesEdgeArticulations()
Description copied from interface:VisualGraphLayout
Returns true if this layout uses articulated edges. AllVisualEdge
s have the ability to articulate. This method servers as a shortcut for algorithms so that they need not loop over all edges to determine if they have articulations. (Looping over large graphs is time intensive.)- Specified by:
usesEdgeArticulations
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Returns:
- true if this layout uses articulated edges.
-
dispose
public void dispose()
Description copied from interface:VisualGraphLayout
Cleanup any resource being managed by this layout.- Specified by:
dispose
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
-
getGraph
public edu.uci.ics.jung.graph.Graph<V,E> getGraph()
- Specified by:
getGraph
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
getSize
public java.awt.Dimension getSize()
- Specified by:
getSize
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
isLocked
public boolean isLocked(V v)
- Specified by:
isLocked
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
lock
public void lock(V v, boolean lock)
- Specified by:
lock
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
setGraph
public void setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
- Specified by:
setGraph
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
setInitializer
public void setInitializer(com.google.common.base.Function<V,java.awt.geom.Point2D> t)
- Specified by:
setInitializer
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
setSize
public void setSize(java.awt.Dimension d)
- Specified by:
setSize
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
apply
public java.awt.geom.Point2D apply(V v)
- Specified by:
apply
in interfacecom.google.common.base.Function<V extends VisualVertex,E extends VisualEdge<V>>
-
getEdgeRenderer
public edu.uci.ics.jung.visualization.renderers.BasicEdgeRenderer<V,E> getEdgeRenderer()
Description copied from interface:VisualGraphLayout
Returns an optional edge renderer. This is used to render each edge.- Specified by:
getEdgeRenderer
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Returns:
- an optional edge renderer
-
getEdgeShapeTransformer
public com.google.common.base.Function<E,java.awt.Shape> getEdgeShapeTransformer()
Description copied from interface:VisualGraphLayout
Returns an optional edge shape transformer. This is used to create shapes for each edge.- Specified by:
getEdgeShapeTransformer
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Returns:
- an optional edge shape transformer
-
getEdgeLabelRenderer
public edu.uci.ics.jung.visualization.renderers.Renderer.EdgeLabel<V,E> getEdgeLabelRenderer()
Description copied from interface:VisualGraphLayout
Returns an optional custom edge label renderer. This is used to add labels to the edges.- Specified by:
getEdgeLabelRenderer
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Returns:
- an optional renderer
-
addLayoutListener
public void addLayoutListener(LayoutListener<V,E> listener)
Description copied from interface:VisualGraphLayout
Adds a layout listener- Specified by:
addLayoutListener
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
listener
- the listener
-
removeLayoutListener
public void removeLayoutListener(LayoutListener<V,E> listener)
Description copied from interface:VisualGraphLayout
Removes a layout listener- Specified by:
removeLayoutListener
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
listener
- the listener
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location)
- Specified by:
setLocation
in interfaceedu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>
-
setLocation
public void setLocation(V v, java.awt.geom.Point2D location, LayoutListener.ChangeType changeType)
Description copied from interface:VisualGraphLayout
Allows the client to change the location while specifying the type of change- Specified by:
setLocation
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Parameters:
v
- the vertexlocation
- the new locationchangeType
- the type of change
-
getVisualGraph
public VisualGraph<V,E> getVisualGraph()
Description copied from interface:VisualGraphLayout
Returns the graph of this layout- Specified by:
getVisualGraph
in interfaceVisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>
- Returns:
- the graph of this layout
-
-