Class RotatingGraphMousePlugin
- java.lang.Object
-
- edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
-
- edu.uci.ics.jung.visualization.control.RotatingGraphMousePlugin
-
- All Implemented Interfaces:
GraphMousePlugin
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.util.EventListener
- Direct Known Subclasses:
SatelliteRotatingGraphMousePlugin
public class RotatingGraphMousePlugin extends AbstractGraphMousePlugin implements java.awt.event.MouseListener, java.awt.event.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
Constructors Constructor Description RotatingGraphMousePlugin()
create an instance with default modifier valuesRotatingGraphMousePlugin(int modifiers)
create an instance with passed zoom in/out values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
angleBetween(java.awt.geom.Point2D v1, java.awt.geom.Point2D v2)
Returns the angle between two vectors from the origin to points v1 and v2.void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseDragged(java.awt.event.MouseEvent e)
check the modifiers.void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mouseMoved(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
save the 'down' point and check the modifiers.void
mouseReleased(java.awt.event.MouseEvent e)
unset the down point and change the cursor back to the default-
Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiers, setCursor, setModifiers
-
-
-
-
Constructor Detail
-
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 Detail
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
save the 'down' point and check the modifiers. If the modifiers are accepted, set the cursor to the 'hand' cursor- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
- Parameters:
e
- the event
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
unset the down point and change the cursor back to the default- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
check the modifiers. If accepted, use the mouse drag motion to rotate the graph- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
angleBetween
protected double angleBetween(java.awt.geom.Point2D v1, java.awt.geom.Point2D v2)
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
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
-