Package ghidra.graph.viewer.event.mouse
Class JungPickingGraphMousePlugin<V,E>
java.lang.Object
edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
ghidra.graph.viewer.event.mouse.JungPickingGraphMousePlugin<V,E>
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
edu.uci.ics.jung.visualization.control.GraphMousePlugin
,MouseListener
,MouseMotionListener
,EventListener
- Direct Known Subclasses:
VisualGraphPickingGraphMousePlugin
public class JungPickingGraphMousePlugin<V,E>
extends edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
implements MouseListener, MouseMotionListener
PickingGraphMousePlugin supports the picking of graph elements
with the mouse. MouseButtonOne picks a single vertex
or edge, and MouseButtonTwo adds to the set of selected Vertices
or EdgeType. If a Vertex is selected and the mouse is dragged while
on the selected Vertex, then that Vertex will be repositioned to
follow the mouse until the button is released.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
additional modifiers for the action of adding to an existing selectionprotected E
the picked Edge, if anyprotected Color
color for the picking rectangleprotected edu.uci.ics.jung.visualization.VisualizationServer.Paintable
the Paintable for the lens picking rectangleprotected boolean
controls whether the Vertices may be moved with the mouseprotected double
the x distance from the picked vertex center to the mouse pointprotected double
the y distance from the picked vertex center to the mouse pointprotected Rectangle2D
used to draw a rectangle to contain picked verticesprotected V
the picked Vertex, if anyFields inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
cursor, down, modifiers
-
Constructor Summary
ConstructorDescriptioncreate an instance with default settingsJungPickingGraphMousePlugin
(int selectionModifiers, int addToSelectionModifiers) create an instance with overrides -
Method Summary
Modifier and TypeMethodDescriptionboolean
isLocked()
void
void
If the mouse is over a picked vertex, drag all picked vertices with the mouse.void
void
void
void
For primary modifiers (default, MouseButton1): pick a single Vertex or Edge that is under the mouse pointer.void
If the mouse is dragging a rectangle, pick the Vertices contained in that rectangle clean up settings from mousePressedprotected void
pickContainedVertices
(edu.uci.ics.jung.visualization.VisualizationViewer<V, E> vv, Point2D down, Point2D out, boolean clear) pick the vertices inside the rectangle created from points 'down' and 'out' (two diagonally opposed corners of the rectangle)void
setLensColor
(Color lensColor) void
setLocked
(boolean locked) Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiers, setCursor, setModifiers
-
Field Details
-
vertex
the picked Vertex, if any -
edge
the picked Edge, if any -
offsetx
protected double offsetxthe x distance from the picked vertex center to the mouse point -
offsety
protected double offsetythe y distance from the picked vertex center to the mouse point -
locked
protected boolean lockedcontrols whether the Vertices may be moved with the mouse -
addToSelectionModifiers
protected int addToSelectionModifiersadditional modifiers for the action of adding to an existing selection -
rect
used to draw a rectangle to contain picked vertices -
lensPaintable
protected edu.uci.ics.jung.visualization.VisualizationServer.Paintable lensPaintablethe Paintable for the lens picking rectangle -
lensColor
color for the picking rectangle
-
-
Constructor Details
-
JungPickingGraphMousePlugin
public JungPickingGraphMousePlugin()create an instance with default settings -
JungPickingGraphMousePlugin
public JungPickingGraphMousePlugin(int selectionModifiers, int addToSelectionModifiers) create an instance with overrides- Parameters:
selectionModifiers
- for primary selectionaddToSelectionModifiers
- for additional selection
-
-
Method Details
-
getLensColor
- Returns:
- Returns the lensColor.
-
setLensColor
- Parameters:
lensColor
- The lensColor to set.
-
mousePressed
For primary modifiers (default, MouseButton1): pick a single Vertex or Edge that is under the mouse pointer. If no Vertex or edge is under the pointer, unselect all picked Vertices and edges, and set up to draw a rectangle for multiple selection of contained Vertices. For additional selection (default Shift+MouseButton1): Add to the selection, a single Vertex or Edge that is under the mouse pointer. If a previously picked Vertex or Edge is under the pointer, it is un-picked. If no vertex or Edge is under the pointer, set up to draw a multiple selection rectangle (as above) but do not unpick previously picked elements.- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
- the event
-
mouseReleased
If the mouse is dragging a rectangle, pick the Vertices contained in that rectangle clean up settings from mousePressed- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseDragged
If the mouse is over a picked vertex, drag all picked vertices with the mouse. If the mouse is not over a Vertex, draw the rectangle to select multiple Vertices- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
pickContainedVertices
protected void pickContainedVertices(edu.uci.ics.jung.visualization.VisualizationViewer<V, E> vv, Point2D down, Point2D out, boolean clear) pick the vertices inside the rectangle created from points 'down' and 'out' (two diagonally opposed corners of the rectangle)- Parameters:
vv
- the viewer containing the layout and picked statedown
- one corner of the rectangleout
- the other corner of the rectangleclear
- whether to reset existing picked state
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
isLocked
public boolean isLocked()- Returns:
- Returns the locked.
-
setLocked
public void setLocked(boolean locked) - Parameters:
locked
- The locked to set.
-