Image Component Library (ICL)
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
icl::geom::SceneMouseHandler Class Reference

Class providing a mouse handler for class scene. More...

#include <SceneMouseHandler.h>

Inheritance diagram for icl::geom::SceneMouseHandler:
icl::qt::MouseHandler icl::physics::PhysicsMouseHandler

Public Member Functions

ICLGeom_API SceneMouseHandler (const int pCameraIndex, Scene *pParentScene)
 Constructor. More...
 
 SceneMouseHandler (const SceneMouseHandler &pSceneMouseHandler)
 Copy constructor. More...
 
ICLGeom_API ~SceneMouseHandler ()
 Destructor. More...
 
ICLGeom_API SceneMouseHandleroperator= (const SceneMouseHandler &pSceneMouseHandler)
 Assignment operator. More...
 
void setParentScene (Scene *pParentScene)
 Set parent scene. More...
 
ScenegetParentScene ()
 Get parent scene. More...
 
ICLGeom_API void setSensitivities (const float pTranslation, const float pRotation=1.0, const float pMouse=1.0, const float pWheel=0.001, const float pModifier=10.0)
 Set mouse & wheel sensitivities, modifier factor and factors for rotation and translation. More...
 
MouseSensitivities getSensitivities (MouseSensitivitiesModifier pMouseSensitivitiesModifier)
 Get mouse and wheel sensitivities (low, normal, high). More...
 
void setCameraIndex (const int pCameraIndex)
 Set camera index. More...
 
int getCameraIndex ()
 Get camera index. More...
 
virtual ICLGeom_API void setMouseMappings ()
 Set mouse mappings. More...
 
ICLGeom_API void setMouseMapping (const qt::MouseEventType pMouseEventType, const bool pLeftMouseButton, const bool pMiddleMouseButton, const bool pRightMouseButton, const bool pShift, const bool pControl, const bool pAlt, MouseActionCallback pMouseActionCallback, void *pData=0)
 Set one mouse mapping. More...
 
virtual ICLGeom_API void process (const qt::MouseEvent &pMouseEvent)
 Process mouse event using mouse mapping table. More...
 
- Public Member Functions inherited from icl::qt::MouseHandler
 MouseHandler (mouse_handler handler)
 Create a mouse handler with given callback function. More...
 

Static Public Member Functions

static ICLGeom_API void freeView (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData, bool pInverseX, bool pInverseY)
 Free view. More...
 
static void freeView (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Free view with normal axes. More...
 
static void freeViewInverseMouseX (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Free view with inversed x-axis. More...
 
static void freeViewInverseMouseY (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Free view with inversed y-axis. More...
 
static void freeViewInverseBoth (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Free view with inversed axes. More...
 
static ICLGeom_API void rotateAroundOrigin (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Rotate around origin and correct camera orientation. More...
 
static ICLGeom_API void strafe (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Strafe (camera movement up, down, left, right). More...
 
static ICLGeom_API void rollAndDistance (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Roll and distance (camera movement forward and backward). More...
 
static ICLGeom_API void placeCursor (const qt::MouseEvent &pMouseEvent, const utils::Point32f &pCurrentMousePosition, const utils::Point32f &pDeltaMousePosition, Camera &pCamera, Scene &pScene, void *pData)
 Place the cursor for rotational Origin. More...
 

Protected Attributes

MouseMappingTableEntry mMouseMappingTable [qt::MAX_MOUSE_EVENT+1][2][2][2][2][2][2]
 Mouse mapping table: More...
 
MouseSensitivities mMouseSensitivities [MAX_MOUSE_SENSITIVITY+1]
 mouse sensitivities More...
 
Camera mCameraBackup
 backup of old camera More...
 
utils::Point32f mAnchor
 starting mouse position for dragging More...
 
ScenemParentScene
 pointer to parent scene More...
 
int mCameraIndex
 index of camera in scene More...
 
int mKeyboardModifiersBackup
 backup of old keyboard modifiers More...
 
qt::GUImGUI
 GUI for the adaption of scene properties. More...
 

Additional Inherited Members

- Public Types inherited from icl::qt::MouseHandler
typedef void(* mouse_handler) (const MouseEvent &event)
 mouse_handler function type More...
 
- Public Slots inherited from icl::qt::MouseHandler
void handleEvent (const MouseEvent &event)
 connected to the ICLWidget's signal mouseEventOccured More...
 
- Protected Member Functions inherited from icl::qt::MouseHandler
 MouseHandler ()
 This constructor can be called from derived classes. More...
 

Detailed Description

Class providing a mouse handler for class scene.

Create your own mouse handler by inherting from this class and overloading function setMouseMappings().

Default mouse mappings for scene objects

Mouse sensitivity modifiers in combination with mouse actions

New mouse mappings

Constructor & Destructor Documentation

◆ SceneMouseHandler() [1/2]

ICLGeom_API icl::geom::SceneMouseHandler::SceneMouseHandler ( const int  pCameraIndex,
Scene pParentScene 
)

Constructor.

Parameters
pCameraIndexindex of camera in scene
pParentScenepointer to parent scene

◆ SceneMouseHandler() [2/2]

icl::geom::SceneMouseHandler::SceneMouseHandler ( const SceneMouseHandler pSceneMouseHandler)
inline

Copy constructor.

Parameters
pSceneMouseHandlersource

◆ ~SceneMouseHandler()

ICLGeom_API icl::geom::SceneMouseHandler::~SceneMouseHandler ( )

Destructor.

Member Function Documentation

◆ freeView() [1/2]

static ICLGeom_API void icl::geom::SceneMouseHandler::freeView ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData,
bool  pInverseX,
bool  pInverseY 
)
static

Free view.

Vertical mouse movement: pitch. Horizontal mouse movement: yaw.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity
pInverseXinverse x-axis
pInverseYinverse y-axis

◆ freeView() [2/2]

static void icl::geom::SceneMouseHandler::freeView ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
inlinestatic

Free view with normal axes.

Vertical mouse movement: pitch. Horizontal mouse movement: yaw.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ freeViewInverseBoth()

static void icl::geom::SceneMouseHandler::freeViewInverseBoth ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
inlinestatic

Free view with inversed axes.

Vertical mouse movement: pitch. Horizontal mouse movement: yaw.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ freeViewInverseMouseX()

static void icl::geom::SceneMouseHandler::freeViewInverseMouseX ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
inlinestatic

Free view with inversed x-axis.

Vertical mouse movement: pitch. Horizontal mouse movement: yaw.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ freeViewInverseMouseY()

static void icl::geom::SceneMouseHandler::freeViewInverseMouseY ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
inlinestatic

Free view with inversed y-axis.

Vertical mouse movement: pitch. Horizontal mouse movement: yaw.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ getCameraIndex()

int icl::geom::SceneMouseHandler::getCameraIndex ( )
inline

Get camera index.

Returns
camera index

◆ getParentScene()

Scene* icl::geom::SceneMouseHandler::getParentScene ( )
inline

Get parent scene.

◆ getSensitivities()

MouseSensitivities icl::geom::SceneMouseHandler::getSensitivities ( MouseSensitivitiesModifier  pMouseSensitivitiesModifier)
inline

Get mouse and wheel sensitivities (low, normal, high).

  • Returns
    sensitivity

◆ operator=()

ICLGeom_API SceneMouseHandler& icl::geom::SceneMouseHandler::operator= ( const SceneMouseHandler pSceneMouseHandler)

Assignment operator.

◆ placeCursor()

static ICLGeom_API void icl::geom::SceneMouseHandler::placeCursor ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
static

Place the cursor for rotational Origin.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ process()

virtual ICLGeom_API void icl::geom::SceneMouseHandler::process ( const qt::MouseEvent pMouseEvent)
virtual

Process mouse event using mouse mapping table.

Parameters
pMouseEventmouse event

Reimplemented from icl::qt::MouseHandler.

Reimplemented in icl::physics::PhysicsMouseHandler.

◆ rollAndDistance()

static ICLGeom_API void icl::geom::SceneMouseHandler::rollAndDistance ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
static

Roll and distance (camera movement forward and backward).

Vertical mouse movement: move camera along front vector. Horizontal mouse movement: roll camera.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ rotateAroundOrigin()

static ICLGeom_API void icl::geom::SceneMouseHandler::rotateAroundOrigin ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
static

Rotate around origin and correct camera orientation.

Vertical mouse movement: vertical rotation. Horizontal mouse movement: horizontal rotation.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

◆ setCameraIndex()

void icl::geom::SceneMouseHandler::setCameraIndex ( const int  pCameraIndex)
inline

Set camera index.

Parameters
pCameraIndexnew camera index

◆ setMouseMapping()

ICLGeom_API void icl::geom::SceneMouseHandler::setMouseMapping ( const qt::MouseEventType  pMouseEventType,
const bool  pLeftMouseButton,
const bool  pMiddleMouseButton,
const bool  pRightMouseButton,
const bool  pShift,
const bool  pControl,
const bool  pAlt,
MouseActionCallback  pMouseActionCallback,
void *  pData = 0 
)

Set one mouse mapping.

Parameters
pMouseEventTypetype of mouse event
pLeftMouseButtonleft mouse button
pMiddleMouseButtonmiddle mouse button
pRightMouseButtonright mouse button
pShiftshift
pControlcontrol
pAltalt
pMouseActionCallbackfunction pointer that should be called
pDatapointer to additional data

◆ setMouseMappings()

virtual ICLGeom_API void icl::geom::SceneMouseHandler::setMouseMappings ( )
virtual

Set mouse mappings.

Inherit from this class and overload this function to define new mouse mappings.

◆ setParentScene()

void icl::geom::SceneMouseHandler::setParentScene ( Scene pParentScene)
inline

Set parent scene.

◆ setSensitivities()

ICLGeom_API void icl::geom::SceneMouseHandler::setSensitivities ( const float  pTranslation,
const float  pRotation = 1.0,
const float  pMouse = 1.0,
const float  pWheel = 0.001,
const float  pModifier = 10.0 
)

Set mouse & wheel sensitivities, modifier factor and factors for rotation and translation.

Parameters
pTranslationsensitivity factor for translation (e.g. mParentScene->getMaxSceneDim())
pRotationsensitivity factor for rotations (e.g. 1.0)
pMousesensitivity of mouse movements (e.g. 1.0)
pWheelsensitivity of mouse wheel (e.g. 0.001)
pModifierfactor to modify sensitivity (e.g. 10.0)

◆ strafe()

static ICLGeom_API void icl::geom::SceneMouseHandler::strafe ( const qt::MouseEvent pMouseEvent,
const utils::Point32f pCurrentMousePosition,
const utils::Point32f pDeltaMousePosition,
Camera pCamera,
Scene pScene,
void *  pData 
)
static

Strafe (camera movement up, down, left, right).

Vertical mouse movement: move camera along right vector. Horizontal mouse movement: move camera along up vector.

Parameters
pMouseEventmouse event
pCurrentMousePositioncurrent mouse position
pDeltaMousePositiondelta compared to last mouse position
pCameracamera
pDatapointer for additional data used to set sensitivity

Member Data Documentation

◆ mAnchor

utils::Point32f icl::geom::SceneMouseHandler::mAnchor
protected

starting mouse position for dragging

◆ mCameraBackup

Camera icl::geom::SceneMouseHandler::mCameraBackup
protected

backup of old camera

◆ mCameraIndex

int icl::geom::SceneMouseHandler::mCameraIndex
protected

index of camera in scene

◆ mGUI

qt::GUI* icl::geom::SceneMouseHandler::mGUI
protected

GUI for the adaption of scene properties.

◆ mKeyboardModifiersBackup

int icl::geom::SceneMouseHandler::mKeyboardModifiersBackup
protected

backup of old keyboard modifiers

◆ mMouseMappingTable

MouseMappingTableEntry icl::geom::SceneMouseHandler::mMouseMappingTable[qt::MAX_MOUSE_EVENT+1][2][2][2][2][2][2]
protected

Mouse mapping table:

  • array dimensions: [MouseEventType] [LeftMouseButton] [MiddleMouseButton] [RightMouseButton] [Shift] [Control] [Alt]
  • qt::MouseEventType: MouseMoveEvent, MouseDragEvent, MousePressEvent, MouseReleaseEvent, MouseEnterEvent, MouseLeaveEvent
  • Mouse buttons, keyboard modifiers: true, false

◆ mMouseSensitivities

MouseSensitivities icl::geom::SceneMouseHandler::mMouseSensitivities[MAX_MOUSE_SENSITIVITY+1]
protected

mouse sensitivities

◆ mParentScene

Scene* icl::geom::SceneMouseHandler::mParentScene
protected

pointer to parent scene


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