de.jreality.scene.tool
Class AbstractTool

java.lang.Object
  extended by de.jreality.scene.tool.AbstractTool
All Implemented Interfaces:
Tool
Direct Known Subclasses:
ActionTool, AirplaneTool, AnimatedRotateTool, AnimatorTool, AxisTranslationTool, BeanShellTool, ClickWheelCameraZoomTool, DampedDraggingTool, DragEventTool, DraggingTool, DuplicateTriplyPeriodicTool, EncompassTool, FlyTool, FlyTool, FlyToPickTool, HeadTransformationTool, LookAtTool, PickShowTool, PointerDisplayTool, RotateTool, SelectionTool, ShipNavigationTool, ShipRotateTool, ShipScaleTool, ShowPropertiesTool, SliceBoxFactory.SimpleDragTool, TrackballRotateTool, TranslateTool

public abstract class AbstractTool
extends Object
implements Tool


Constructor Summary
AbstractTool(InputSlot... activationSlots)
           
 
Method Summary
 void activate(ToolContext tc)
          This method is called when the tool gets activated.
 void addCurrentSlot(InputSlot slot)
           
 void deactivate(ToolContext tc)
          this method is called when the tool was activate and the AxisState of the activation slot changes to AxisState.RELEASED - to zero.
 boolean equals(Object obj)
           
 String fullDescription()
           
 List<InputSlot> getActivationSlots()
          If the result is empty, then the tool is always active.
 List<InputSlot> getCurrentSlots()
          This method will only be called for active tools.
 String getDescription()
          Gives an overall description of this Tool.
 String getDescription(InputSlot slot)
          Gives a description of the meaning of the given InputSlot.
 int hashCode()
           
 void perform(ToolContext tc)
          This method is called when the tool is activated and any AxisState or TransformationMatrix of the current slots changes.
 void removeCurrentSlot(InputSlot slot)
           
 void setDescription(String description)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTool

public AbstractTool(InputSlot... activationSlots)
Method Detail

getActivationSlots

public List<InputSlot> getActivationSlots()
Description copied from interface: Tool
If the result is empty, then the tool is always active. If the result is not empty, then the tool becomes active as soon as the axis of one activation slot is pressed. This implies that the InputSlots must be associated to AxisStates, otherwise the Tool will never become active.
The tool gets deactivated, as soon as the InputSlot that caused activation changes its state to AxisState.RELEASED.
When the tool is active, other activation axes are ignored and passed to other Tools down the path. The result must remain constant.

Specified by:
getActivationSlots in interface Tool
Returns:
List of InputSlots for activating the tool

getCurrentSlots

public List<InputSlot> getCurrentSlots()
Description copied from interface: Tool
This method will only be called for active tools. The currentSlots may change after each call of activate(..) or perform(..).

Specified by:
getCurrentSlots in interface Tool
Returns:
list of currently relevant input slots

addCurrentSlot

public void addCurrentSlot(InputSlot slot)

removeCurrentSlot

public void removeCurrentSlot(InputSlot slot)

activate

public void activate(ToolContext tc)
Description copied from interface: Tool
This method is called when the tool gets activated. Note that it will never be called if the tool is always active.

Specified by:
activate in interface Tool
Parameters:
tc - The current tool context

perform

public void perform(ToolContext tc)
Description copied from interface: Tool
This method is called when the tool is activated and any AxisState or TransformationMatrix of the current slots changes.

Specified by:
perform in interface Tool
Parameters:
tc - The current tool context

deactivate

public void deactivate(ToolContext tc)
Description copied from interface: Tool
this method is called when the tool was activate and the AxisState of the activation slot changes to AxisState.RELEASED - to zero. Note that it will never be called for always active tools.

Specified by:
deactivate in interface Tool
Parameters:
tc - The current tool context

fullDescription

public String fullDescription()

getDescription

public String getDescription(InputSlot slot)
Description copied from interface: Tool
Gives a description of the meaning of the given InputSlot. This may depend on the current state of the Tool.

Specified by:
getDescription in interface Tool
Parameters:
slot - to describe
Returns:
A description of the current meaning of the given InputSlot.

getDescription

public String getDescription()
Description copied from interface: Tool
Gives an overall description of this Tool.

Specified by:
getDescription in interface Tool
Returns:
A description of the Tool including information about activation and overall behaviour.

setDescription

public void setDescription(String description)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object