hep.wired.interaction
Class DragRectangleToScale

java.lang.Object
  extended by hep.wired.interaction.AbstractInteractionHandler
      extended by hep.wired.interaction.DefaultInteractionHandler
          extended by hep.wired.interaction.DragRectangleToScale
All Implemented Interfaces:
InteractionHandler, WiredRegistry.ID, org.freehep.xml.io.XMLIO

public class DragRectangleToScale
extends DefaultInteractionHandler

Drag/click to define a rectangle to scale and translate the plot.

Version:
$Id: DragRectangleToScale.java 13826 2011-05-05 03:05:38Z onoprien $
Author:
Mark Donszelmann

Field Summary
 
Fields inherited from class hep.wired.interaction.DefaultInteractionHandler
command, fixedTranslate, multiplyScale, multiplyTranslate
 
Constructor Summary
DragRectangleToScale()
          Create a rectangle handler to generate scale edits.
 
Method Summary
 boolean altKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the alt key is pressed.
 boolean altKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the alt key is released.
 void changeCursor(RecordPlot plot, InputEvent event)
          Called to allow the InteractionHandler to change the cursor.
 String getDescription()
          Returns a one line description.
 Icon getIcon(int size)
          Returns associated icon
 boolean isSupportedBy(GraphicsPanel panel)
          Returns true if this Interaction Handler is supported by this Graphics Panel.
 void mouseButton1Clicked(RecordPlot plot, MouseEvent event)
          Translate point to center and zoom in (or out if alt key pressed).
 void mouseButton1DragEnded(RecordPlot plot, MouseEvent event)
          Update end point of rectangle, translate and scale, and remove rectangle.
 void mouseButton1Dragged(RecordPlot plot, MouseEvent event)
          Update moving point of rectangle and draw.
 void mouseButton1DragStarted(RecordPlot plot, MouseEvent event)
          Store starting point of rectangle.
 void mouseButton1Released(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is released
 void mouseEntered(RecordPlot plot, MouseEvent event)
          Called when the mouse is entering the component
 void reset(RecordPlot plot, InputEvent event)
          Called to reset the interaction handler in its initial state.
 boolean shiftKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the shift key is pressed.
 boolean shiftKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the esc key is released.
 String toString()
           
static void translateAndScale(RecordPlot plot, Rectangle2D rectangle, boolean fixedRatio)
           
 
Methods inherited from class hep.wired.interaction.DefaultInteractionHandler
getInstance, getLastScale, isControlMetaDown, isMac, mouseWheelMoved, otherKeyPressed
 
Methods inherited from class hep.wired.interaction.AbstractInteractionHandler
ctrlKeyPressed, ctrlKeyReleased, ctrlMetaKeyPressed, ctrlMetaKeyReleased, equals, escKeyPressed, escKeyReleased, getHeight, getID, getName, getWidth, hashCode, keyTyped, metaKeyPressed, metaKeyReleased, mouseButton1Pressed, mouseExited, mouseMoved, otherKeyReleased, restore, save, setRecord, setSelected, setSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DragRectangleToScale

public DragRectangleToScale()
Create a rectangle handler to generate scale edits.

Method Detail

getIcon

public Icon getIcon(int size)
Description copied from interface: InteractionHandler
Returns associated icon

Specified by:
getIcon in interface InteractionHandler
Overrides:
getIcon in class AbstractInteractionHandler

getDescription

public String getDescription()
Description copied from interface: InteractionHandler
Returns a one line description.

Specified by:
getDescription in interface InteractionHandler
Overrides:
getDescription in class DefaultInteractionHandler

isSupportedBy

public boolean isSupportedBy(GraphicsPanel panel)
Description copied from interface: InteractionHandler
Returns true if this Interaction Handler is supported by this Graphics Panel.

Specified by:
isSupportedBy in interface InteractionHandler
Overrides:
isSupportedBy in class DefaultInteractionHandler

changeCursor

public void changeCursor(RecordPlot plot,
                         InputEvent event)
Description copied from interface: InteractionHandler
Called to allow the InteractionHandler to change the cursor.

Specified by:
changeCursor in interface InteractionHandler
Overrides:
changeCursor in class DefaultInteractionHandler

reset

public void reset(RecordPlot plot,
                  InputEvent event)
Description copied from interface: InteractionHandler
Called to reset the interaction handler in its initial state.

Specified by:
reset in interface InteractionHandler
Overrides:
reset in class AbstractInteractionHandler

mouseEntered

public void mouseEntered(RecordPlot plot,
                         MouseEvent event)
Description copied from interface: InteractionHandler
Called when the mouse is entering the component

Specified by:
mouseEntered in interface InteractionHandler
Overrides:
mouseEntered in class DefaultInteractionHandler

mouseButton1DragStarted

public void mouseButton1DragStarted(RecordPlot plot,
                                    MouseEvent event)
Store starting point of rectangle.

Specified by:
mouseButton1DragStarted in interface InteractionHandler
Overrides:
mouseButton1DragStarted in class AbstractInteractionHandler

mouseButton1Dragged

public void mouseButton1Dragged(RecordPlot plot,
                                MouseEvent event)
Update moving point of rectangle and draw.

Specified by:
mouseButton1Dragged in interface InteractionHandler
Overrides:
mouseButton1Dragged in class AbstractInteractionHandler

mouseButton1DragEnded

public void mouseButton1DragEnded(RecordPlot plot,
                                  MouseEvent event)
Update end point of rectangle, translate and scale, and remove rectangle.

Specified by:
mouseButton1DragEnded in interface InteractionHandler
Overrides:
mouseButton1DragEnded in class AbstractInteractionHandler

translateAndScale

public static void translateAndScale(RecordPlot plot,
                                     Rectangle2D rectangle,
                                     boolean fixedRatio)

mouseButton1Released

public void mouseButton1Released(RecordPlot plot,
                                 MouseEvent event)
Description copied from interface: InteractionHandler
Called when mouse button 1 is released

Specified by:
mouseButton1Released in interface InteractionHandler
Overrides:
mouseButton1Released in class AbstractInteractionHandler

shiftKeyPressed

public boolean shiftKeyPressed(RecordPlot plot,
                               KeyEvent event)
Description copied from interface: InteractionHandler
Called when the shift key is pressed. Return true if the event is handled.

Specified by:
shiftKeyPressed in interface InteractionHandler
Overrides:
shiftKeyPressed in class AbstractInteractionHandler

shiftKeyReleased

public boolean shiftKeyReleased(RecordPlot plot,
                                KeyEvent event)
Description copied from interface: InteractionHandler
Called when the esc key is released. Return true if the event is handled.

Specified by:
shiftKeyReleased in interface InteractionHandler
Overrides:
shiftKeyReleased in class AbstractInteractionHandler

altKeyPressed

public boolean altKeyPressed(RecordPlot plot,
                             KeyEvent event)
Description copied from interface: InteractionHandler
Called when the alt key is pressed. Return true if the event is handled.

Specified by:
altKeyPressed in interface InteractionHandler
Overrides:
altKeyPressed in class AbstractInteractionHandler

altKeyReleased

public boolean altKeyReleased(RecordPlot plot,
                              KeyEvent event)
Description copied from interface: InteractionHandler
Called when the alt key is released. Return true if the event is handled.

Specified by:
altKeyReleased in interface InteractionHandler
Overrides:
altKeyReleased in class AbstractInteractionHandler

mouseButton1Clicked

public void mouseButton1Clicked(RecordPlot plot,
                                MouseEvent event)
Translate point to center and zoom in (or out if alt key pressed).

Specified by:
mouseButton1Clicked in interface InteractionHandler
Overrides:
mouseButton1Clicked in class AbstractInteractionHandler

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2013 FreeHEP. All Rights Reserved.