Class RotatingGraphMousePlugin
java.lang.Object
edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
edu.uci.ics.jung.visualization.control.RotatingGraphMousePlugin
- All Implemented Interfaces:
GraphMousePlugin
,MouseListener
,MouseMotionListener
,EventListener
- Direct Known Subclasses:
SatelliteRotatingGraphMousePlugin
public class RotatingGraphMousePlugin
extends AbstractGraphMousePlugin
implements MouseListener, MouseMotionListener
RotatingGraphMouse provides the abiity to rotate the graph using
the mouse. By default, it is activated by mouse button one drag
with the shift key pressed. The modifiers can be overridden so that
a different mouse/key combination activates the rotation
-
Field Summary
Fields inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
cursor, down, modifiers
-
Constructor Summary
ConstructorsConstructorDescriptioncreate an instance with default modifier valuesRotatingGraphMousePlugin
(int modifiers) create an instance with passed zoom in/out values -
Method Summary
Modifier and TypeMethodDescriptionprotected double
angleBetween
(Point2D v1, Point2D v2) Returns the angle between two vectors from the origin to points v1 and v2.void
void
check the modifiers.void
void
void
void
save the 'down' point and check the modifiers.void
unset the down point and change the cursor back to the defaultMethods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiers, setCursor, setModifiers
-
Constructor Details
-
RotatingGraphMousePlugin
public RotatingGraphMousePlugin()create an instance with default modifier values -
RotatingGraphMousePlugin
public RotatingGraphMousePlugin(int modifiers) create an instance with passed zoom in/out values- Parameters:
modifiers
- the event modifiers to trigger rotation
-
-
Method Details
-
mousePressed
save the 'down' point and check the modifiers. If the modifiers are accepted, set the cursor to the 'hand' cursor- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
- the event
-
mouseReleased
unset the down point and change the cursor back to the default- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseDragged
check the modifiers. If accepted, use the mouse drag motion to rotate the graph- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
angleBetween
Returns the angle between two vectors from the origin to points v1 and v2.- Parameters:
v1
- the first pointv2
- the second point- Returns:
- the angle between two vectors from the origin through points v1 and v2
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-