Package ghidra.graph.viewer
Class GraphViewerUtils
- java.lang.Object
-
- ghidra.graph.viewer.GraphViewerUtils
-
public class GraphViewerUtils extends java.lang.Object
This class houses various methods for translating location and size data from the various graph coordinate spaces. Graph Spaces Size and location information is represented in multiple coordinate spaces, as listed below. To translate from one to the other, useGraphViewerUtils
; for example, to see if a mouse click is on a given vertex.- Layout Space - the layout contains Point2D objects that represent positions of the vertices.
- Graph Space - the space where the Layout points are transformed as the view is moved around the screen (e.g., as the user pans)
- View Space - the coordinate system of Java 2D rendering; scaling (zooming) transformations are applied at this layer
Note: vertex relative means that the value is from inside the vertex, or the vertex's coordinate space (like a component that is inside the vertex), where it's coordinate values are relative to the component's parent.
-
-
Field Summary
Fields Modifier and Type Field Description static int
EDGE_COLUMN_SPACING
static int
EDGE_ROW_SPACING
static int
EXTRA_LAYOUT_COLUMN_SPACING
static int
EXTRA_LAYOUT_COLUMN_SPACING_CONDENSED
static int
EXTRA_LAYOUT_ROW_SPACING
static int
EXTRA_LAYOUT_ROW_SPACING_CONDENSED
static java.lang.String
GRAPH_BUILDER_THREAD_POOL_NAME
static java.lang.String
GRAPH_DECORATOR_THREAD_POOL_NAME
static double
INTERACTION_ZOOM_THRESHOLD
static double
PAINT_ZOOM_THRESHOLD
-
Constructor Summary
Constructors Constructor Description GraphViewerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addPaddingToRectangle(int padding, java.awt.Rectangle rectangle)
static <V,E>
voidadjustEdgePickSizeForZoom(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V extends VisualVertex,E extends VisualEdge<V>>
VertexMouseInfo<V,E>convertMouseEventToVertexMouseEvent(GraphViewer<V,E> viewer, java.awt.event.MouseEvent mouseEvent)
static <V extends VisualVertex>
java.util.List<V>createCollectionWithZOrderBySelection(java.util.Collection<V> vertices)
Moves the selected vertices to the end of the list of vertices so that when picked (or painted), we will prefer the selected vertices, since we have configured the algorithms for the graph stuff to prefer the last accessed vertex (like when picking and painting).static java.awt.Shape
createEgdeLoopInGraphSpace(java.awt.Shape vertexShape, double x, double y)
Creates a loop shape for a vertex that calls itself.static java.awt.Shape
createEgdeLoopInGraphSpace(java.awt.Shape edgeLoopShape, java.awt.Shape vertexShape, double x, double y)
Transforms the given edge loop shape to graph space, which includes updating the size and location of the loop to be relative to the vertex.static java.awt.Shape
createHollowEgdeLoop()
static java.awt.Shape
createHollowEgdeLoopInGraphSpace(java.awt.Shape vertexShape, double x, double y)
Creates a self-loop edge to be used with a vertex that calls itself.static <V,E>
java.awt.RectanglegetBoundsForVerticesInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.util.Collection<V> vertices)
Returns a rectangle that contains all give verticesstatic <V,E>
java.awt.RectanglegetBoundsForVerticesInLayoutSpace(java.util.Collection<V> vertices, com.google.common.base.Function<V,java.awt.Rectangle> vertexToBounds)
Returns a rectangle that contains all vertices, in the layout spacestatic <V,E>
EgetEdgeFromPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point point)
static <V,E>
java.awt.ShapegetEdgeShapeInGraphSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, E e)
static <V extends VisualVertex,E extends VisualEdge<V>>
java.awt.PointgetGraphCenterInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.lang.DoublegetGraphScale(edu.uci.ics.jung.visualization.VisualizationServer<V,E> vv)
static <V,E>
java.awt.geom.Point2D.DoublegetOffsetFromCenterForPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.geom.Point2D point)
static <V,E>
java.awt.geom.Point2D.DoublegetOffsetFromCenterInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point pointInLayoutSpace)
static <V,E>
java.awt.PointgetPointInViewSpaceForVertex(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
Get the upper-left point of vertex in the view space (Java component space)static java.lang.Double
getScaleRatioToFitInDimension(java.awt.Dimension currentSize, java.awt.Dimension targetSize)
static <V extends VisualVertex,E extends VisualEdge<V>>
java.awt.RectanglegetTotalGraphSizeInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V extends VisualVertex,E extends VisualEdge<V>>
java.awt.RectanglegetTotalGraphSizeInLayoutSpace(java.util.Collection<V> vertices, java.util.Collection<E> edges, com.google.common.base.Function<V,java.awt.Rectangle> vertexToBounds, com.google.common.base.Function<E,java.util.List<java.awt.geom.Point2D>> edgeToArticulations)
static <V,E>
java.awt.RectanglegetVertexBoundsInGraphSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.RectanglegetVertexBoundsInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.RectanglegetVertexBoundsInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.geom.Point2DgetVertexCenterPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V v)
static <V,E>
VgetVertexFromPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point point)
static <V,E>
java.awt.geom.Point2D.DoublegetVertexOffsetFromLayoutCenter(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.geom.Point2D.DoublegetVertexOffsetFromLayoutCenterTop(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.PointgetVertexUpperLeftCornerInGraphSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.PointgetVertexUpperLeftCornerInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V,E>
java.awt.PointgetVertexUpperLeftCornerInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
static <V extends VisualVertex,E extends VisualEdge<V>>
java.util.Collection<V>getVerticesOfHoveredEdges(edu.uci.ics.jung.graph.Graph<V,E> graph)
static <V extends VisualVertex,E extends VisualEdge<V>>
java.util.Collection<V>getVerticesOfSelectedEdges(edu.uci.ics.jung.graph.Graph<V,E> graph)
Returns a collection of vertices that are incident to selected edges.static <V extends VisualVertex,E extends VisualEdge<V>>
VisualGraphLayout<V,E>getVisualGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> graphLayout)
static <V,E>
booleanisScaledPastVertexInteractionThreshold(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V extends VisualVertex,E extends VisualEdge<V>>
booleanlayoutUsesEdgeArticulations(edu.uci.ics.jung.algorithms.layout.Layout<V,E> graphLayout)
static <V,E>
voidsetGraphScale(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, double scale)
static <V,E>
java.awt.PointtranslatePointFromGraphSpaceToLayoutSpace(java.awt.geom.Point2D pointInGraphSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.PointtranslatePointFromGraphSpaceToViewSpace(java.awt.geom.Point2D pointInGraphSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.PointtranslatePointFromLayoutSpaceToGraphSpace(java.awt.geom.Point2D pointInLayoutSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.PointtranslatePointFromLayoutSpaceToViewSpace(java.awt.geom.Point2D pointInLayoutSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.PointtranslatePointFromVertexRelativeSpaceToViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex, java.awt.Point startPoint)
static <V,E>
java.awt.PointtranslatePointFromViewSpaceToGraphSpace(java.awt.geom.Point2D pointInViewSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.PointtranslatePointFromViewSpaceToLayoutSpace(java.awt.geom.Point2D pointInViewSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.PointtranslatePointFromViewSpaceToVertexRelativeSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point startPoint)
static <V,E>
java.awt.PointtranslatePointFromViewSpaceToVertexRelativeSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point startPoint, V vertex)
static <V,E>
java.awt.RectangletranslateRectangleFromLayoutSpaceToViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Rectangle rectangle)
static <V,E>
java.awt.RectangletranslateRectangleFromVertexRelativeSpaceToViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex, java.awt.Rectangle rectangle)
static <V,E>
java.awt.ShapetranslateShapeFromLayoutSpaceToGraphSpace(java.awt.Shape shape, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.ShapetranslateShapeFromLayoutSpaceToViewSpace(java.awt.Shape shape, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
static <V,E>
java.awt.ShapetranslateShapeFromViewSpaceToLayoutSpace(java.awt.Shape shape, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
-
-
Field Detail
-
GRAPH_DECORATOR_THREAD_POOL_NAME
public static final java.lang.String GRAPH_DECORATOR_THREAD_POOL_NAME
- See Also:
- Constant Field Values
-
GRAPH_BUILDER_THREAD_POOL_NAME
public static final java.lang.String GRAPH_BUILDER_THREAD_POOL_NAME
- See Also:
- Constant Field Values
-
INTERACTION_ZOOM_THRESHOLD
public static final double INTERACTION_ZOOM_THRESHOLD
- See Also:
- Constant Field Values
-
PAINT_ZOOM_THRESHOLD
public static final double PAINT_ZOOM_THRESHOLD
- See Also:
- Constant Field Values
-
EDGE_ROW_SPACING
public static final int EDGE_ROW_SPACING
- See Also:
- Constant Field Values
-
EDGE_COLUMN_SPACING
public static final int EDGE_COLUMN_SPACING
- See Also:
- Constant Field Values
-
EXTRA_LAYOUT_ROW_SPACING
public static final int EXTRA_LAYOUT_ROW_SPACING
- See Also:
- Constant Field Values
-
EXTRA_LAYOUT_ROW_SPACING_CONDENSED
public static final int EXTRA_LAYOUT_ROW_SPACING_CONDENSED
- See Also:
- Constant Field Values
-
EXTRA_LAYOUT_COLUMN_SPACING
public static final int EXTRA_LAYOUT_COLUMN_SPACING
- See Also:
- Constant Field Values
-
EXTRA_LAYOUT_COLUMN_SPACING_CONDENSED
public static final int EXTRA_LAYOUT_COLUMN_SPACING_CONDENSED
- See Also:
- Constant Field Values
-
-
Method Detail
-
translatePointFromViewSpaceToVertexRelativeSpace
public static <V,E> java.awt.Point translatePointFromViewSpaceToVertexRelativeSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point startPoint)
-
translatePointFromViewSpaceToVertexRelativeSpace
public static <V,E> java.awt.Point translatePointFromViewSpaceToVertexRelativeSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point startPoint, V vertex)
-
getVertexUpperLeftCornerInLayoutSpace
public static <V,E> java.awt.Point getVertexUpperLeftCornerInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
getVertexUpperLeftCornerInViewSpace
public static <V,E> java.awt.Point getVertexUpperLeftCornerInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
getVertexBoundsInViewSpace
public static <V,E> java.awt.Rectangle getVertexBoundsInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
getVertexBoundsInGraphSpace
public static <V,E> java.awt.Rectangle getVertexBoundsInGraphSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
getVertexBoundsInLayoutSpace
public static <V,E> java.awt.Rectangle getVertexBoundsInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
convertMouseEventToVertexMouseEvent
public static <V extends VisualVertex,E extends VisualEdge<V>> VertexMouseInfo<V,E> convertMouseEventToVertexMouseEvent(GraphViewer<V,E> viewer, java.awt.event.MouseEvent mouseEvent)
-
getVertexUpperLeftCornerInGraphSpace
public static <V,E> java.awt.Point getVertexUpperLeftCornerInGraphSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
translatePointFromLayoutSpaceToGraphSpace
public static <V,E> java.awt.Point translatePointFromLayoutSpaceToGraphSpace(java.awt.geom.Point2D pointInLayoutSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translatePointFromLayoutSpaceToViewSpace
public static <V,E> java.awt.Point translatePointFromLayoutSpaceToViewSpace(java.awt.geom.Point2D pointInLayoutSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translatePointFromViewSpaceToGraphSpace
public static <V,E> java.awt.Point translatePointFromViewSpaceToGraphSpace(java.awt.geom.Point2D pointInViewSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translatePointFromViewSpaceToLayoutSpace
public static <V,E> java.awt.Point translatePointFromViewSpaceToLayoutSpace(java.awt.geom.Point2D pointInViewSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translatePointFromGraphSpaceToViewSpace
public static <V,E> java.awt.Point translatePointFromGraphSpaceToViewSpace(java.awt.geom.Point2D pointInGraphSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translatePointFromGraphSpaceToLayoutSpace
public static <V,E> java.awt.Point translatePointFromGraphSpaceToLayoutSpace(java.awt.geom.Point2D pointInGraphSpace, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translateShapeFromLayoutSpaceToViewSpace
public static <V,E> java.awt.Shape translateShapeFromLayoutSpaceToViewSpace(java.awt.Shape shape, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translateShapeFromLayoutSpaceToGraphSpace
public static <V,E> java.awt.Shape translateShapeFromLayoutSpaceToGraphSpace(java.awt.Shape shape, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translateShapeFromViewSpaceToLayoutSpace
public static <V,E> java.awt.Shape translateShapeFromViewSpaceToLayoutSpace(java.awt.Shape shape, edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
translateRectangleFromVertexRelativeSpaceToViewSpace
public static <V,E> java.awt.Rectangle translateRectangleFromVertexRelativeSpaceToViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex, java.awt.Rectangle rectangle)
-
translateRectangleFromLayoutSpaceToViewSpace
public static <V,E> java.awt.Rectangle translateRectangleFromLayoutSpaceToViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Rectangle rectangle)
-
getVertexFromPointInViewSpace
public static <V,E> V getVertexFromPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point point)
-
getPointInViewSpaceForVertex
public static <V,E> java.awt.Point getPointInViewSpaceForVertex(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
Get the upper-left point of vertex in the view space (Java component space)- Parameters:
viewer
- the viewer containing the UIvertex
- the vertex- Returns:
- the upper-left point of the vertex
-
translatePointFromVertexRelativeSpaceToViewSpace
public static <V,E> java.awt.Point translatePointFromVertexRelativeSpaceToViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex, java.awt.Point startPoint)
-
getEdgeFromPointInViewSpace
public static <V,E> E getEdgeFromPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point point)
-
getScaleRatioToFitInDimension
public static java.lang.Double getScaleRatioToFitInDimension(java.awt.Dimension currentSize, java.awt.Dimension targetSize)
-
setGraphScale
public static <V,E> void setGraphScale(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, double scale)
-
adjustEdgePickSizeForZoom
public static <V,E> void adjustEdgePickSizeForZoom(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
createCollectionWithZOrderBySelection
public static <V extends VisualVertex> java.util.List<V> createCollectionWithZOrderBySelection(java.util.Collection<V> vertices)
Moves the selected vertices to the end of the list of vertices so that when picked (or painted), we will prefer the selected vertices, since we have configured the algorithms for the graph stuff to prefer the last accessed vertex (like when picking and painting).- Parameters:
vertices
- the vertices to order- Returns:
- the given vertices, ordered by selected/emphasized state
-
createHollowEgdeLoop
public static java.awt.Shape createHollowEgdeLoop()
-
createHollowEgdeLoopInGraphSpace
public static java.awt.Shape createHollowEgdeLoopInGraphSpace(java.awt.Shape vertexShape, double x, double y)
Creates a self-loop edge to be used with a vertex that calls itself. The returned shape is hollow (not a filled loop) so that mouse hit detection does not occur in the middle of the circle.- Parameters:
vertexShape
- The shape of the vertex for which the edge is being created.x
- The x coordinate of the vertexy
- The y coordinate of the vertex- Returns:
- a self-loop edge to be used with a vertex that calls itself.
-
createEgdeLoopInGraphSpace
public static java.awt.Shape createEgdeLoopInGraphSpace(java.awt.Shape vertexShape, double x, double y)
Creates a loop shape for a vertex that calls itself. The loop is transformed to graph space, which includes updating the size and location of the loop to be relative to the vertex.- Parameters:
vertexShape
- The shape of the vertex for which the edge is being created.x
- The x coordinate of the vertexy
- The y coordinate of the vertex- Returns:
- a loop shape for a vertex that calls itself.
-
createEgdeLoopInGraphSpace
public static java.awt.Shape createEgdeLoopInGraphSpace(java.awt.Shape edgeLoopShape, java.awt.Shape vertexShape, double x, double y)
Transforms the given edge loop shape to graph space, which includes updating the size and location of the loop to be relative to the vertex.- Parameters:
edgeLoopShape
- The shape to transformvertexShape
- The shape of the vertex for which the edge is being createdx
- The x coordinate of the vertexy
- The y coordinate of the vertex- Returns:
- the transformed edge loop shape
-
getEdgeShapeInGraphSpace
public static <V,E> java.awt.Shape getEdgeShapeInGraphSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, E e)
-
getVertexCenterPointInViewSpace
public static <V,E> java.awt.geom.Point2D getVertexCenterPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V v)
-
getVertexOffsetFromLayoutCenter
public static <V,E> java.awt.geom.Point2D.Double getVertexOffsetFromLayoutCenter(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
getVertexOffsetFromLayoutCenterTop
public static <V,E> java.awt.geom.Point2D.Double getVertexOffsetFromLayoutCenterTop(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, V vertex)
-
getOffsetFromCenterForPointInViewSpace
public static <V,E> java.awt.geom.Point2D.Double getOffsetFromCenterForPointInViewSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.geom.Point2D point)
-
getOffsetFromCenterInLayoutSpace
public static <V,E> java.awt.geom.Point2D.Double getOffsetFromCenterInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.awt.Point pointInLayoutSpace)
-
getGraphScale
public static <V,E> java.lang.Double getGraphScale(edu.uci.ics.jung.visualization.VisualizationServer<V,E> vv)
-
isScaledPastVertexInteractionThreshold
public static <V,E> boolean isScaledPastVertexInteractionThreshold(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
getGraphCenterInLayoutSpace
public static <V extends VisualVertex,E extends VisualEdge<V>> java.awt.Point getGraphCenterInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
getTotalGraphSizeInLayoutSpace
public static <V extends VisualVertex,E extends VisualEdge<V>> java.awt.Rectangle getTotalGraphSizeInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer)
-
getTotalGraphSizeInLayoutSpace
public static <V extends VisualVertex,E extends VisualEdge<V>> java.awt.Rectangle getTotalGraphSizeInLayoutSpace(java.util.Collection<V> vertices, java.util.Collection<E> edges, com.google.common.base.Function<V,java.awt.Rectangle> vertexToBounds, com.google.common.base.Function<E,java.util.List<java.awt.geom.Point2D>> edgeToArticulations)
-
getBoundsForVerticesInLayoutSpace
public static <V,E> java.awt.Rectangle getBoundsForVerticesInLayoutSpace(edu.uci.ics.jung.visualization.VisualizationServer<V,E> viewer, java.util.Collection<V> vertices)
Returns a rectangle that contains all give vertices- Parameters:
viewer
- the viewer containing the UIvertices
- the vertices- Returns:
- a rectangle that contains all give vertices
-
getBoundsForVerticesInLayoutSpace
public static <V,E> java.awt.Rectangle getBoundsForVerticesInLayoutSpace(java.util.Collection<V> vertices, com.google.common.base.Function<V,java.awt.Rectangle> vertexToBounds)
Returns a rectangle that contains all vertices, in the layout space- Parameters:
vertices
- the vertices for which to calculate the boundsvertexToBounds
- a function that can turn a single vertex into a rectangle- Returns:
- the bounds
-
addPaddingToRectangle
public static void addPaddingToRectangle(int padding, java.awt.Rectangle rectangle)
-
layoutUsesEdgeArticulations
public static <V extends VisualVertex,E extends VisualEdge<V>> boolean layoutUsesEdgeArticulations(edu.uci.ics.jung.algorithms.layout.Layout<V,E> graphLayout)
-
getVisualGraphLayout
public static <V extends VisualVertex,E extends VisualEdge<V>> VisualGraphLayout<V,E> getVisualGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> graphLayout)
-
getVerticesOfHoveredEdges
public static <V extends VisualVertex,E extends VisualEdge<V>> java.util.Collection<V> getVerticesOfHoveredEdges(edu.uci.ics.jung.graph.Graph<V,E> graph)
-
getVerticesOfSelectedEdges
public static <V extends VisualVertex,E extends VisualEdge<V>> java.util.Collection<V> getVerticesOfSelectedEdges(edu.uci.ics.jung.graph.Graph<V,E> graph)
Returns a collection of vertices that are incident to selected edges.- Parameters:
graph
- the graph from which to retrieve vertices- Returns:
- a collection of vertices that are incident to selected edges.
-
-