iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::AbstractVTKViewer Class Reference

Subclasses viewer for the VTK rendering back-end. More...

#include <imstkAbstractVTKViewer.h>

Inheritance diagram for imstk::AbstractVTKViewer:
Inheritance graph
[legend]
Collaboration diagram for imstk::AbstractVTKViewer:
Collaboration graph
[legend]

Public Types

enum  VTKLoggerMode { SHOW, MUTE, WRITE }
 
- Public Types inherited from imstk::Module
enum  ExecutionType { SEQUENTIAL, PARALLEL, ADAPTIVE }
 Currently 3 execution types are provided. These inform the driver on how it should run.
 
- Public Types inherited from imstk::EventObject
using Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> >
 

Public Member Functions

Renderer::Mode getRenderingMode () const override
 Get the current renderer mode.
 
vtkSmartPointer< vtkRenderWindow > getVtkRenderWindow () const
 Get pointer to the vtkRenderWindow rendering.
 
void setSize (const int width, const int height) override
 Set the render window size.
 
void setWindowTitle (const std::string &title) override
 Set the render window title.
 
void setUseVsync (const bool useVsync) override
 Set whether to vertical sync. Sync framerate to the refresh of the monitor.
 
virtual void setBackgroundColors (const Color color1, const Color color2=Color(0.0, 0.0, 0.0), const bool gradientBackground=false) override
 Set the coloring of the screen background If 'gradientBackground' is false or not supplied color1 will fill the entire background.
 
void processEvents () override
 Processes VTK events, includes OS events.
 
void setVtkLoggerMode (VTKLoggerMode loggerMode)
 Set the logger mode.
 
std::shared_ptr< VTKRenderergetActiveVtkRenderer () const
 Retrieve the renderer associated with the current scene.
 
- Public Member Functions inherited from imstk::Viewer
std::shared_ptr< ScenegetActiveScene () const
 Get scene currently being rendered.
 
void setDebugAxesLength (double x, double y, double z)
 Set the length of the debug axes.
 
virtual void setActiveScene (std::shared_ptr< Scene > scene)=0
 Set scene to be rendered.
 
virtual void setRenderingMode (const Renderer::Mode mode)=0
 Setup the current renderer to render what's needed based on the mode chosen.
 
void setSize (Vec2i size)
 
virtual const Vec2i getSize () const
 
std::shared_ptr< RenderergetActiveRenderer () const
 Retrieve the renderer associated with the current scene.
 
virtual void setInfoLevel (const int level)
 Set the info level, usually means display framerates and other viewer related information.
 
int getInfoLevel () const
 Get the current info level.
 
virtual const int getInfoLevelCount () const
 Get the number of info levels for a viewer, varies on implementation.
 
std::shared_ptr< ScreenCaptureUtilitygetScreenCaptureUtility () const
 access screen shot utility
 
virtual std::shared_ptr< KeyboardDeviceClientgetKeyboardDevice () const
 Returns the device that emits key events.
 
virtual std::shared_ptr< MouseDeviceClientgetMouseDevice () const
 Returns the device that emits mouse events.
 
double getVisualFps () const
 
- Public Member Functions inherited from imstk::Module
virtual const std::string getTypeName () const =0
 Returns collision detection type string name.
 
 SIGNAL (Module, preUpdate)
 Posted before updateModule is called.
 
 SIGNAL (Module, postUpdate)
 Posted after updateModule is called.
 
 SIGNAL (Module, end)
 Posted when module wants to end.
 
double getDt () const
 Get/Set the time step.
 
void setDt (const double dt)
 
bool getInit () const
 Get whether the module is initialized yet.
 
bool getPaused () const
 Set/Get whether the module is currently paused.
 
void setPaused (const bool paused)
 
void setMuteUpdateEvents (const bool mute)
 Set/Get whether the module should post pre/post update events.
 
bool getMuteUpdateEvents () const
 
ExecutionType getExecutionType () const
 Set/Get the execution type (see imstk::ExecutionType)
 
void setExecutionType (const ExecutionType type)
 
void setSleepDelay (const double ms)
 
double getSleepDelay () const
 
void pause ()
 
void resume ()
 
void init ()
 
void update ()
 
void uninit ()
 
- Public Member Functions inherited from imstk::EventObject
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 Member Functions

 AbstractVTKViewer (std::string name)
 
bool initModule () override
 
void uninitModule () override
 
- Protected Member Functions inherited from imstk::Viewer
 Viewer (std::string name)
 
void updateFps ()
 Called before render to push back and measure time.
 
void updateModule () override
 

Protected Attributes

vtkSmartPointer< vtkRenderWindow > m_vtkRenderWindow
 
vtkSmartPointer< vtkInteractorStyle > m_vtkInteractorStyle
 
vtkSmartPointer< vtkCallbackCommand > exitCallback
 
bool m_useVsync = false
 
- Protected Attributes inherited from imstk::Viewer
std::unordered_map< std::shared_ptr< Scene >, std::shared_ptr< Renderer > > m_rendererMap
 
std::shared_ptr< Scenem_activeScene
 
std::shared_ptr< Entitym_debugEntity
 
std::shared_ptr< Cameram_debugCamera
 
std::shared_ptr< ScreenCaptureUtilitym_screenCapturer
 Screen shot utility.
 
std::shared_ptr< ViewerConfigm_config
 
int m_infoLevel = 0
 Info level.
 
std::chrono::high_resolution_clock::time_point m_pre
 time point pre-rendering
 
std::chrono::high_resolution_clock::time_point m_post
 time point post-rendering
 
std::chrono::high_resolution_clock::time_point m_lastFpsUpdate
 time point for last framerate display update
 
double m_visualFps = 0.0
 
double m_lastFps = 0.0
 
- Protected Attributes inherited from imstk::Module
std::atomic< bool > m_init = ATOMIC_VAR_INIT(false)
 
std::atomic< bool > m_paused = ATOMIC_VAR_INIT(false)
 
double m_dt = 0.0
 
ExecutionType m_executionType = ExecutionType::PARALLEL
 
bool m_muteUpdateEvents = false
 
double m_sleepDelay = 0.0
 
- Protected Attributes inherited from imstk::EventObject
ParallelUtils::SpinLock eventQueueLock
 
std::deque< CommandeventQueue
 
std::vector< std::pair< std::string, std::vector< Observer > > > queuedObservers
 
std::vector< std::pair< std::string, std::vector< Observer > > > directObservers
 

Detailed Description

Subclasses viewer for the VTK rendering back-end.

Todo:
: Implement pausing/resuming

Definition at line 27 of file imstkAbstractVTKViewer.h.


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