version 3.3

VRS::InteractionTechnique Class Reference

Abstract base class for Interaction Techniques. More...

#include <vrs/sg/interactiontechnique.h>

Inheritance diagram for VRS::InteractionTechnique:

VRS::SharedObj VRS::Visitable VRS::AreaSelector VRS::BookmarkNavigation VRS::CameraPathEditor VRS::GroundPlateNavigation VRS::ScenePicker VRS::SpaceMouseNavigation VRS::TransformEditor VRS::UndoNavigation

List of all members.

Public Types

typedef
InteractionConcept::ViewParameterSet 
ViewParameterSet
typedef int KeyFunctionID
typedef int MouseButtonFunctionID

Public Member Functions

SO< ViewParameterSetgetViewParameters () const
 Provides access to the current view parameters.
SO< ViewParameterSetgetPreviousViewParameters () const
 Provides access to the last applied view parameters.
virtual void onTimer (SO< TimeEvent > event, double secondsSinceLastTimeEvent)
 If the InteractionTechnique is active (i.e.
SO< ConstraintHint > getConstraintHint ()
 Some InteractionTechniques provide additional information that is used by certain constraints to find appropriate coorections if necessary.
void assignKey (KeyFunctionID id, unsigned int key, InputEvent::Modifier mustModifier=InputEvent::NoModifier, InputEvent::Modifier mustNotModifier=InputEvent::AllKeys)
 Each InteractionTechnique defines functions that can be accessed via control keys or specific mouse buttons.
void assignMouseButton (MouseButtonFunctionID id, InputEvent::Button button, InputEvent::Modifier mustModifier=InputEvent::NoModifier, InputEvent::Modifier mustNotModifier=InputEvent::AllKeys, InputEvent::Change mustChange=InputEvent::NoChange, InputEvent::Change mustNotChange=InputEvent::DoubleClick)
void disableKeyFunction (KeyFunctionID id)
 These methods disable KeyFunctions or MouseButtonFunctions until they are newly assigned.
void disableMouseButtonFunction (MouseButtonFunctionID id)
bool getAssignedKey (KeyFunctionID id, unsigned int &key, InputEvent::Modifier &mustModifier, InputEvent::Modifier &mustNotModifier) const
 Puts the currently assigned key for 'id' in the three call-by-ref parameters 'key', 'mustModifier' and 'mustNotModifier' and returns true.
bool getAssignedMouseButton (MouseButtonFunctionID id, InputEvent::Button &button, InputEvent::Modifier &mustModifier, InputEvent::Modifier &mustNotModifier, InputEvent::Change &mustChange, InputEvent::Change &mustNotChange) const
 Puts the currently assigned mouse button for 'id' in the five call-by-ref parameters 'button', 'mustModifier', 'mustNotModifier', 'mustChange' and 'mustNotChange' and returns true.
void setWheelEnable (bool onOff)
 Disables or enable the mouse wheel for a certain InteractionTechnique.
virtual void onKey (SO< KeyEvent > event, KeyFunctionID id)
 Called once for each key event.
virtual void onDragStart (int x, int y, SO< ButtonEvent >, MouseButtonFunctionID id)
 Called for each mouse interaction (more exactly when a MouseButton is pressed).
virtual void onDragMotion (int x, int y, SO< MotionEvent >, MouseButtonFunctionID id, int startX, int startY)
 During a mouse interaction (i.e.
virtual void onDragEnd (int x, int y, SO< ButtonEvent >, MouseButtonFunctionID id, int startX, int startY)
 Called at the end of each mouse interaction, i.e. when a mouse button is released.
virtual void onWheelEvent (SO< WheelEvent > we)
 For each incoming event the base class checks the event type and passes the event to the corresponding virtual method.
virtual void onEvent (SO< Event > e)
 For each incoming event the base class checks the event type and passes the event to the corresponding virtual method.
virtual void onEventPassive (SO< Event > e, bool modeActive)
 The aforementioned event handling methods are only called if the technique is active.
virtual void onActivation ()
 Called each time a InteractionTechnique is activated, i.e.
virtual void onDeactivation ()
 Called each time a InteractionTechnique is deactivated, i.e.
virtual bool checkEventRelevance (SO< Event > event) const
 A Interaction is chosen as active Interaction (i.e.
bool canWork () const
 Used by an orientation constraint to check whether a interaction technique can work based on the current view parameters.
virtual bool preservingViewDirectionRequired () const
 Used to determine whether the view direction must be preserved after a constraintchecker has refused or corrected a movement of this technique.
virtual void setEnabled (bool yesNo=true)
 Disables/Enables the technique within an InteractionMode.
virtual bool enabled () const
 VRS_TYPEINFO (InteractionTechnique, SharedObj)
 VRS_SERIALIZABLE (InteractionTechnique)

Protected Member Functions

 InteractionTechnique ()
void brake ()
 Should be used by InteractionTechniques if the user obviously wants to stop movement as fast as possible.
void registerMouseButtonFunction (MouseButtonFunctionID id)
 Most interaction techniques define functions that can be called by assignable keys or mouse buttons.
void registerKeyFunction (KeyFunctionID id)
bool dragging (MouseButtonFunctionID id)
 Returns true if a dragging interaction is in progress (i.e.
bool pressed (KeyFunctionID id)
 Returns true if a function key is currently pressed.
SO< InteractionConceptgetParent () const
 Provides access to the parent interaction concept.

Friends

class InteractionMode

Classes

struct  ButtonAssignment
struct  KeyAssignment


Detailed Description

Abstract base class for Interaction Techniques.

A InteractionTechnique converts user events (e.g. from mouse, keyboard or other devices) into changes on the current view parameters.

To use a InteractionTechnique:

Only one InteractionTechnique of a InteractionMode, the active InteractionTechnique, has control over the view parameters. onTimer() is only called for the active Interaction.

Note: A InteractionTechnique must not used in multiple InteractionModes simulataneously.

Once per time event the current view parameters are applied. it is left to a derived techniqe whether to change the view parameters directly with each event or later in each onTimer() call.


Member Typedef Documentation


Constructor & Destructor Documentation

VRS::InteractionTechnique::InteractionTechnique (  )  [protected]


Member Function Documentation

SO<ViewParameterSet> VRS::InteractionTechnique::getViewParameters (  )  const

Provides access to the current view parameters.

The current ViewParameterSet is either the last one that have been applied, or it may be changed by the InteractionTechnique by user events since the last time event.

SO<ViewParameterSet> VRS::InteractionTechnique::getPreviousViewParameters (  )  const

Provides access to the last applied view parameters.

It is used by Constraints to check what have been changed in the current cycle.

virtual void VRS::InteractionTechnique::onTimer ( SO< TimeEvent event,
double  secondsSinceLastTimeEvent 
) [virtual]

If the InteractionTechnique is active (i.e.

has control of the view parameters) it receives user events and time events. The time event has a special meaning, because after the onTimer() call the current view parameters are finally applied. I.e. all view parameter states between two onTimer()-calls are not relevant. For convenience the time since the last time event is added, which could be alternatively calculated from the time event.

Reimplemented in VRS::CameraPathEditor, VRS::MoveFocusGroundPlateNavigation, VRS::SpaceMouseNavigation, and VRS::UndoNavigation.

SO<ConstraintHint> VRS::InteractionTechnique::getConstraintHint (  ) 

Some InteractionTechniques provide additional information that is used by certain constraints to find appropriate coorections if necessary.

The InteractionHint refers to the change between the last and the last but one call of onTimer().

void VRS::InteractionTechnique::assignKey ( KeyFunctionID  id,
unsigned int  key,
InputEvent::Modifier  mustModifier = InputEvent::NoModifier,
InputEvent::Modifier  mustNotModifier = InputEvent::AllKeys 
)

Each InteractionTechnique defines functions that can be accessed via control keys or specific mouse buttons.

The assignment of keys and mouse buttons is managed by the InteractionTechnique base class. Each derived InteractionTechnique can register functions for control keys or mouse buttons. For this it must define an integer identifier for each such function. Only functionIDs that have been registered in the constructor of a derived class are accepted for assignment. If a modifier flag appears in both mustModifier and mustNotModifier, it is ignored as mustNotModifier.

void VRS::InteractionTechnique::assignMouseButton ( MouseButtonFunctionID  id,
InputEvent::Button  button,
InputEvent::Modifier  mustModifier = InputEvent::NoModifier,
InputEvent::Modifier  mustNotModifier = InputEvent::AllKeys,
InputEvent::Change  mustChange = InputEvent::NoChange,
InputEvent::Change  mustNotChange = InputEvent::DoubleClick 
)

void VRS::InteractionTechnique::disableKeyFunction ( KeyFunctionID  id  ) 

These methods disable KeyFunctions or MouseButtonFunctions until they are newly assigned.

void VRS::InteractionTechnique::disableMouseButtonFunction ( MouseButtonFunctionID  id  ) 

bool VRS::InteractionTechnique::getAssignedKey ( KeyFunctionID  id,
unsigned int &  key,
InputEvent::Modifier mustModifier,
InputEvent::Modifier mustNotModifier 
) const

Puts the currently assigned key for 'id' in the three call-by-ref parameters 'key', 'mustModifier' and 'mustNotModifier' and returns true.

If the key is disabled, this method returns false.

bool VRS::InteractionTechnique::getAssignedMouseButton ( MouseButtonFunctionID  id,
InputEvent::Button button,
InputEvent::Modifier mustModifier,
InputEvent::Modifier mustNotModifier,
InputEvent::Change mustChange,
InputEvent::Change mustNotChange 
) const

Puts the currently assigned mouse button for 'id' in the five call-by-ref parameters 'button', 'mustModifier', 'mustNotModifier', 'mustChange' and 'mustNotChange' and returns true.

If the button is disabled, this method returns false.

void VRS::InteractionTechnique::setWheelEnable ( bool  onOff  ) 

Disables or enable the mouse wheel for a certain InteractionTechnique.

virtual void VRS::InteractionTechnique::onKey ( SO< KeyEvent event,
KeyFunctionID  id 
) [virtual]

Called once for each key event.

virtual void VRS::InteractionTechnique::onDragStart ( int  x,
int  y,
SO< ButtonEvent ,
MouseButtonFunctionID  id 
) [virtual]

Called for each mouse interaction (more exactly when a MouseButton is pressed).

The MouseButtonFunctionID can be used to decide which function to activate.

virtual void VRS::InteractionTechnique::onDragMotion ( int  x,
int  y,
SO< MotionEvent ,
MouseButtonFunctionID  id,
int  startX,
int  startY 
) [virtual]

During a mouse interaction (i.e.

while a mouse button is hold)) dragMotion() is called. For convenience, the mouse coordinates of the previous dragMotion() call and the coordinates during the last dragStart() are passed as additional parameters.

virtual void VRS::InteractionTechnique::onDragEnd ( int  x,
int  y,
SO< ButtonEvent ,
MouseButtonFunctionID  id,
int  startX,
int  startY 
) [virtual]

Called at the end of each mouse interaction, i.e. when a mouse button is released.

virtual void VRS::InteractionTechnique::onWheelEvent ( SO< WheelEvent we  )  [virtual]

For each incoming event the base class checks the event type and passes the event to the corresponding virtual method.

In addition each event() method is called for each event.

Reimplemented in VRS::ZoomGroundPlateNavigation.

virtual void VRS::InteractionTechnique::onEvent ( SO< Event e  )  [virtual]

For each incoming event the base class checks the event type and passes the event to the corresponding virtual method.

In addition each event() method is called for each event.

Reimplemented in VRS::ScenePicker, and VRS::SpaceMouseNavigation.

virtual void VRS::InteractionTechnique::onEventPassive ( SO< Event e,
bool  modeActive 
) [virtual]

The aforementioned event handling methods are only called if the technique is active.

onEventPassive() is called for all techniques of the current InteractionConcept. The parameter modeActive says if the mode of the technique is currently selected. Note: For a controlled access of the view, onEventPassive must not change the view parameters. It can be used to update internal states, e.g., to observe the current viewing position.

Reimplemented in VRS::AreaSelector, VRS::CameraPathEditor, and VRS::UndoNavigation.

virtual void VRS::InteractionTechnique::onActivation (  )  [virtual]

Called each time a InteractionTechnique is activated, i.e.

selected as active Interaction of a InteractionMode. It can be implemented by derivatives to initialize internal parameters.

Reimplemented in VRS::ScenePicker.

virtual void VRS::InteractionTechnique::onDeactivation (  )  [virtual]

Called each time a InteractionTechnique is deactivated, i.e.

deselected as active Interaction of a InteractionMode. It can be implemented by derivatives to reset internal parameters.

Reimplemented in VRS::BookmarkNavigation, and VRS::ScenePicker.

virtual bool VRS::InteractionTechnique::checkEventRelevance ( SO< Event event  )  const [virtual]

A Interaction is chosen as active Interaction (i.e.

the one which has currently control) automatically when an event occurs that is relevant for the interaction. Registered keys or mouse buttons activate a technique automatically. In addition, a derived InteractionTechnique can be woken up at certain events, when checkEventRelevance() returns true. The default implementation returns always false.

Reimplemented in VRS::SpaceMouseNavigation.

bool VRS::InteractionTechnique::canWork (  )  const

Used by an orientation constraint to check whether a interaction technique can work based on the current view parameters.

By default, the method returns always 'true'. It must be overloaded, e.g., by focus-point based techniques and then return 'false' if no valid focus point is defined.

virtual bool VRS::InteractionTechnique::preservingViewDirectionRequired (  )  const [virtual]

Used to determine whether the view direction must be preserved after a constraintchecker has refused or corrected a movement of this technique.

By default, the method returns always 'false'. It must be overloaded, and return 'true' to force preserving of the view direction.

Reimplemented in VRS::PanGroundPlateNavigation.

virtual void VRS::InteractionTechnique::setEnabled ( bool  yesNo = true  )  [virtual]

Disables/Enables the technique within an InteractionMode.

Disabled Techniques are ignored by InteractionModes. The default state is 'enabled'.

virtual bool VRS::InteractionTechnique::enabled (  )  const [virtual]

VRS::InteractionTechnique::VRS_TYPEINFO ( InteractionTechnique  ,
SharedObj   
)

VRS::InteractionTechnique::VRS_SERIALIZABLE ( InteractionTechnique   ) 

void VRS::InteractionTechnique::brake (  )  [protected]

Should be used by InteractionTechniques if the user obviously wants to stop movement as fast as possible.

If a physical engine is used, this information is passed to it, so that the slow down is shortened.

void VRS::InteractionTechnique::registerMouseButtonFunction ( MouseButtonFunctionID  id  )  [protected]

Most interaction techniques define functions that can be called by assignable keys or mouse buttons.

The InteractionTechnique base class controls the assignment of keys and mouse buttons for the derived classes. Each InteractionTechnique defines int-constants for all functions that can be assigned to keys or mouse buttons. The assign-methods are only valid for registered FuncionIDs. Note: FunctionIDs can be specified arbitrarily, but all functionIDs for a class and the same purpose (i.e. mouse button or key) must be different.

void VRS::InteractionTechnique::registerKeyFunction ( KeyFunctionID  id  )  [protected]

bool VRS::InteractionTechnique::dragging ( MouseButtonFunctionID  id  )  [protected]

Returns true if a dragging interaction is in progress (i.e.

the corresponding mouse button is currently hold down.

bool VRS::InteractionTechnique::pressed ( KeyFunctionID  id  )  [protected]

Returns true if a function key is currently pressed.

SO<InteractionConcept> VRS::InteractionTechnique::getParent (  )  const [protected]

Provides access to the parent interaction concept.


Friends And Related Function Documentation

friend class InteractionMode [friend]


The documentation for this class was generated from the following file:

Generated on Mon May 21 06:00:26 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact