iMSTK
Interactive Medical Simulation Toolkit
|
Controls the camera using trackball controls Left click rotate, middle click pan. More...
#include <imstkMouseSceneControl.h>
Public Types | |
enum | Mode { None, Pan, Rotate } |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
Public Member Functions | |
MouseSceneControl (const std::string &name="MouseSceneControl") | |
void | setZoomSpeed (const double zoomSpeed) |
Set the scroll controlled zoom speed. | |
void | setRotateSpeed (const double rotateSpeed) |
Set the mouse controlled rotate speed. | |
void | setPanSpeed (const double panSpeed) |
Set the pan speed. | |
void | setSceneManager (std::shared_ptr< SceneManager > manager) |
Set the scene manager to be controlled The active scene's camera will be controllable depending on SceneManager's mode, or the. | |
void | setEnabled (bool enable) |
Enable the mouse control, independent of the debug mode. | |
bool | getEnabled () const |
void | printControls () override |
Prints the controls. | |
void | OnButtonPress (const int key) override |
On the mouse scene control button press. | |
void | OnButtonRelease (const int key) override |
void | OnScroll (const double dx) override |
void | OnMouseMove (const Vec2d &pos) override |
![]() | |
MouseControl (const std::string &name="MouseControl") | |
void | setDevice (std::shared_ptr< DeviceClient > device) override |
virtual void | OnButtonPress (const int imstkNotUsed(key)) |
virtual void | OnButtonRelease (const int imstkNotUsed(key)) |
virtual void | OnScroll (const double imstkNotUsed(dx)) |
virtual void | OnMouseMove (const Vec2d &imstkNotUsed(pos)) |
![]() | |
SIGNAL (DeviceControl, modified) | |
std::shared_ptr< DeviceClient > | getDevice () const |
Set/Get the device client used in the control. | |
![]() | |
virtual void | update (const UpdateInfo &imstkNotUsed(updateData)) |
virtual void | visualUpdate (const UpdateInfo &imstkNotUsed(updateData)) |
void | initTaskGraphEdges () |
Setup the edges/connections of the TaskGraph. | |
std::shared_ptr< TaskGraph > | getTaskGraph () const |
![]() | |
const std::string & | getName () const |
void | setName (const std::string &name) |
std::weak_ptr< Entity > | getEntity () const |
Get parent entity. | |
void | initialize () |
Initialize the component, called at a later time after all component construction is complete. | |
![]() | |
template<typename T > | |
void | postEvent (const T &e) |
Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent. | |
template<typename T > | |
void | queueEvent (const T &e) |
Queues event directly to this. | |
void | doEvent () |
Do an event, if none exists return. | |
void | doAllEvents () |
Do all the events in the event queue. | |
void | foreachEvent (std::function< void(Command cmd)> func) |
Thread safe loop over all event commands, one can implement a custom handler. | |
void | rforeachEvent (std::function< void(Command cmd)> func) |
thread safe reverse loop over all event commands, one can implement a custom handler | |
void | clearEvents () |
Removes all events from queue cleans up copies of the event. | |
Protected Attributes | |
std::shared_ptr< SceneManager > | m_sceneManager |
Mode | m_mode = Mode::None |
Vec2d | m_prevPos |
Vec2d | m_pos |
double | m_zoomSpeed = 1.0 |
double | m_rotateSpeed = 1.0 |
double | m_panSpeed = 1.0 |
double | m_zoomFactor = 1.0 |
double | m_rotateFactor = 5.0 |
double | m_panFactor = 1.0 |
bool | m_enabled = false |
![]() | |
std::shared_ptr< MouseDeviceClient > | m_mouseDevice = nullptr |
![]() | |
std::shared_ptr< DeviceClient > | m_deviceClient |
![]() | |
std::shared_ptr< TaskGraph > | m_taskGraph = nullptr |
![]() | |
std::string | m_name |
std::weak_ptr< Entity > | m_entity |
Parent entity this component exists on. | |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Additional Inherited Members | |
![]() | |
DeviceControl (const std::string &name="DeviceControl") | |
![]() | |
Behaviour (const std::string &name="Behaviour") | |
Behaviour (const bool useTaskGraph, const std::string &name="Behaviour") | |
virtual void | initGraphEdges (std::shared_ptr< TaskNode > imstkNotUsed(source), std::shared_ptr< TaskNode > imstkNotUsed(sink)) |
Setup the edges/connections of the TaskGraph. More... | |
![]() | |
Component (const std::string &name="Component") | |
virtual void | init () |
Initialize the component, called at a later time after all component construction is complete. | |
Controls the camera using trackball controls Left click rotate, middle click pan.
Definition at line 24 of file imstkMouseSceneControl.h.
bool imstk::MouseSceneControl::getEnabled | ( | ) | const |
Definition at line 152 of file imstkMouseSceneControl.cpp.