SOFA API  b3f2f2a4
Open source framework for multi-physics simuation
sofa::gui::qt::viewer::SofaViewer Class Referenceabstract

#include <SofaViewer.h>

Inheritance diagram for sofa::gui::qt::viewer::SofaViewer:

Protected Attributes

std::unique_ptr< EngineBackendm_backend
 
QTimer captureTimer
 
bool m_isControlPressed
 
ColourPickingRenderCallBack colourPickingRenderCallBack
 
- Protected Attributes inherited from sofa::gui::common::BaseViewer
sofa::simulation::Node::SPtr groot
 the sofa root note of the current scene More...
 
sofa::component::visual::BaseCamera::SPtr currentCamera
 
std::string sceneFileName
 
bool _video
 
bool m_isVideoButtonPressed
 
bool m_bShowAxis
 
bool _fullScreen
 
int _background
 
bool initTexturesDone
 
sofa::type::Vec3 backgroundColour
 
std::string backgroundImageFile
 
sofa::type::Vec3 ambientColour
 
PickHandlerpick
 
int _navigationMode
 
bool _mouseInteractorMoving
 
int _mouseInteractorSavedPosX
 
int _mouseInteractorSavedPosY
 
std::string _screenshotDirectory
 

Public Member Functions

 SofaViewer ()
 
 ~SofaViewer () override
 
virtual void removeViewerTab (QTabWidget *)
 Optional QTabWidget GUI for a concreate viewer. More...
 
virtual void configureViewerTab (QTabWidget *)
 Optional QTabWidget GUI for a concreate viewer. More...
 
virtual QWidgetgetQWidget ()=0
 
virtual QString helpString () const =0
 
void captureEvent () override
 
virtual void keyPressEvent (QKeyEvent *e)
 
virtual void keyReleaseEvent (QKeyEvent *e)
 
bool isControlPressed () const
 
virtual void wheelEvent (QWheelEvent *e)
 
virtual void mouseMoveEvent (QMouseEvent *e)
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual void mouseReleaseEvent (QMouseEvent *e)
 
virtual bool mouseEvent (QMouseEvent *e)
 
virtual void configure (sofa::component::setting::ViewerSetting *viewerConf) override
 
const std::string screenshotName () override
 
void setPrefix (const std::string &prefix, bool prependDirectory=true) override
 
virtual void screenshot (const std::string &filename, int compression_level=-1) override
 
virtual void setBackgroundImage (std::string imageFileName=std::string("textures/SOFA_logo.bmp")) override
 
- Public Member Functions inherited from sofa::gui::common::BaseViewer
 BaseViewer ()
 
virtual ~BaseViewer ()
 
virtual void drawColourPicking (ColourPickingVisitor::ColourCode)
 
virtual sofa::simulation::NodegetScene ()
 
virtual const std::string & getSceneFileName ()
 
virtual void setSceneFileName (const std::string &f)
 
virtual void setScene (sofa::simulation::Node::SPtr scene, const char *filename=nullptr, bool=false)
 
virtual void setCameraMode (core::visual::VisualParams::CameraType)
 
virtual bool ready ()
 
virtual void wait ()
 ask the viewer to resume its activity More...
 
virtual bool load (void)
 Load the viewer. It's the initialisation. More...
 
virtual bool unload (void)
 unload the viewer without delete More...
 
virtual void viewAll (void)=0
 Recompute viewer's home position so it encompass the whole scene and apply it. More...
 
virtual void getView (sofa::type::Vec3 &pos, sofa::type::Quat< SReal > &ori) const
 
virtual void setView (const sofa::type::Vec3 &pos, const sofa::type::Quat< SReal > &ori)
 
virtual void moveView (const sofa::type::Vec3 &pos, const sofa::type::Quat< SReal > &ori)
 
virtual void newView ()
 
virtual void resetView ()
 
virtual void setBackgroundColour (float r, float g, float b)
 
std::string getBackgroundImage ()
 
virtual void saveView ()=0
 
virtual void setSizeW (int)=0
 
virtual void setSizeH (int)=0
 
virtual int getWidth ()=0
 
virtual int getHeight ()=0
 
virtual void fitObjectBBox (sofa::core::objectmodel::BaseObject *)
 
virtual void fitNodeBBox (sofa::core::objectmodel::BaseNode *)
 
virtual void setFullScreen (bool)
 
virtual void moveRayPickInteractor (int, int)
 RayCasting PickHandler. More...
 
PickHandlergetPickHandler ()
 
virtual void drawScene (void)=0
 the rendering pass is done here (have to be called in a loop) More...
 

Protected Member Functions

void redraw () override
 internally called while the actual viewer needs a redraw (ie the camera changed) More...
 

Signals

virtual void redrawn ()=0
 
virtual void resizeW (int)=0
 
virtual void resizeH (int)=0
 

Attribute details

◆ captureTimer

QTimer sofa::gui::qt::viewer::SofaViewer::captureTimer
protected

◆ colourPickingRenderCallBack

ColourPickingRenderCallBack sofa::gui::qt::viewer::SofaViewer::colourPickingRenderCallBack
protected

◆ m_backend

std::unique_ptr<EngineBackend> sofa::gui::qt::viewer::SofaViewer::m_backend
protected

◆ m_isControlPressed

bool sofa::gui::qt::viewer::SofaViewer::m_isControlPressed
protected

Constructor details

◆ SofaViewer()

sofa::gui::qt::viewer::SofaViewer::SofaViewer ( )

◆ ~SofaViewer()

sofa::gui::qt::viewer::SofaViewer::~SofaViewer ( )
override

Function details

◆ captureEvent()

void sofa::gui::qt::viewer::SofaViewer::captureEvent ( )
overridevirtual

Reimplemented from sofa::gui::common::BaseViewer.

◆ configure()

void sofa::gui::qt::viewer::SofaViewer::configure ( sofa::component::setting::ViewerSetting viewerConf)
overridevirtual

Reimplemented from sofa::gui::common::BaseViewer.

◆ configureViewerTab()

virtual void sofa::gui::qt::viewer::SofaViewer::configureViewerTab ( QTabWidget *  )
inlinevirtual

Optional QTabWidget GUI for a concreate viewer.

◆ getQWidget()

virtual QWidget* sofa::gui::qt::viewer::SofaViewer::getQWidget ( )
pure virtual

◆ helpString()

virtual QString sofa::gui::qt::viewer::SofaViewer::helpString ( ) const
pure virtual

◆ isControlPressed()

bool sofa::gui::qt::viewer::SofaViewer::isControlPressed ( ) const

◆ keyPressEvent()

void sofa::gui::qt::viewer::SofaViewer::keyPressEvent ( QKeyEvent *  e)
virtual

◆ keyReleaseEvent()

void sofa::gui::qt::viewer::SofaViewer::keyReleaseEvent ( QKeyEvent *  e)
virtual

◆ mouseEvent()

bool sofa::gui::qt::viewer::SofaViewer::mouseEvent ( QMouseEvent *  e)
virtual

◆ mouseMoveEvent()

void sofa::gui::qt::viewer::SofaViewer::mouseMoveEvent ( QMouseEvent *  e)
virtual

◆ mousePressEvent()

void sofa::gui::qt::viewer::SofaViewer::mousePressEvent ( QMouseEvent *  e)
virtual

◆ mouseReleaseEvent()

void sofa::gui::qt::viewer::SofaViewer::mouseReleaseEvent ( QMouseEvent *  e)
virtual

◆ redraw()

void sofa::gui::qt::viewer::SofaViewer::redraw ( )
overrideprotectedvirtual

internally called while the actual viewer needs a redraw (ie the camera changed)

Implements sofa::gui::common::BaseViewer.

◆ redrawn

virtual void sofa::gui::qt::viewer::SofaViewer::redrawn ( )
pure virtualsignal

◆ removeViewerTab()

virtual void sofa::gui::qt::viewer::SofaViewer::removeViewerTab ( QTabWidget *  )
inlinevirtual

Optional QTabWidget GUI for a concreate viewer.

◆ resizeH

virtual void sofa::gui::qt::viewer::SofaViewer::resizeH ( int  )
pure virtualsignal

◆ resizeW

virtual void sofa::gui::qt::viewer::SofaViewer::resizeW ( int  )
pure virtualsignal

◆ screenshot()

void sofa::gui::qt::viewer::SofaViewer::screenshot ( const std::string &  filename,
int  compression_level = -1 
)
overridevirtual

◆ screenshotName()

const std::string sofa::gui::qt::viewer::SofaViewer::screenshotName ( )
overridevirtual

Reimplemented from sofa::gui::common::BaseViewer.

◆ setBackgroundImage()

void sofa::gui::qt::viewer::SofaViewer::setBackgroundImage ( std::string  imageFileName = std::string("textures/SOFA_logo.bmp"))
overridevirtual

Reimplemented from sofa::gui::common::BaseViewer.

◆ setPrefix()

void sofa::gui::qt::viewer::SofaViewer::setPrefix ( const std::string &  prefix,
bool  prependDirectory = true 
)
overridevirtual

Reimplemented from sofa::gui::common::BaseViewer.

◆ wheelEvent()

void sofa::gui::qt::viewer::SofaViewer::wheelEvent ( QWheelEvent *  e)
virtual