SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::gui::qt::viewer::qt::QtViewer Class Reference

#include <QtViewer.h>

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

Public Attributes

bool _mouseInteractorTranslationMode
 
bool _mouseInteractorRotationMode
 
int _translationMode
 
Quaternion _mouseInteractorCurrentQuat
 
Vector3 _mouseInteractorAbsolutePosition
 
Trackball _mouseInteractorTrackball
 

Static Public Attributes

static const std::string VIEW_FILE_EXTENSION = "view"
 TODO: standardize .view file parameters. More...
 
static Quaternion _mouseInteractorNewQuat
 
static bool _mouseTrans = false
 
static bool _mouseRotate = false
 

Public Member Functions

 QtViewer (QWidget *parent, const char *name="", const unsigned int nbMSAASamples=1)
 
 ~QtViewer () override
 
QWidgetgetQWidget () override
 
bool ready () override
 
void wait () override
 ask the viewer to resume its activity More...
 
sofa::simulation::NodegetScene () override
 
int getWidth () override
 
int getHeight () override
 
void UpdateOBJ (void)
 
void moveRayPickInteractor (int eventX, int eventY) override
 RayCasting PickHandler. More...
 
void ApplyMouseInteractorTransformation (int x, int y)
 
QString helpString () const override
 
void screenshot (const std::string &filename, int compression_level=-1) override
 
- Public Member Functions inherited from sofa::gui::qt::viewer::CustomPolicySofaViewer< VisualModelPolicyType >
 CustomPolicySofaViewer ()
 
 ~CustomPolicySofaViewer () override
 
- Public Member Functions inherited from sofa::gui::qt::viewer::SofaViewer
 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...
 
void captureEvent () override
 
bool isControlPressed () const
 
virtual void configure (sofa::component::configurationsetting::ViewerSetting *viewerConf) override
 
const std::string screenshotName () override
 
void setPrefix (const std::string &prefix, bool prependDirectory=true) override
 
virtual void setBackgroundImage (std::string imageFileName=std::string("textures/SOFA_logo.bmp")) override
 
- Public Member Functions inherited from sofa::gui::BaseViewer
 BaseViewer ()
 
virtual ~BaseViewer ()
 
virtual void drawColourPicking (ColourPickingVisitor::ColourCode)
 
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 load (void)
 Load the viewer. It's the initialisation. More...
 
virtual bool unload (void)
 unload the viewer without delete More...
 
virtual void getView (sofa::defaulttype::Vector3 &pos, sofa::defaulttype::Quat &ori) const
 
virtual void setView (const sofa::defaulttype::Vector3 &pos, const sofa::defaulttype::Quat &ori)
 
virtual void moveView (const sofa::defaulttype::Vector3 &pos, const sofa::defaulttype::Quat &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 void fitObjectBBox (sofa::core::objectmodel::BaseObject *)
 
virtual void fitNodeBBox (sofa::core::objectmodel::BaseNode *)
 
virtual void setFullScreen (bool)
 
PickHandlergetPickHandler ()
 

Static Public Member Functions

static QtViewercreate (QtViewer *, BaseViewerArgument &arg)
 
static const char * viewerName ()
 
static const char * acceleratedName ()
 
static int EnableViewer ()
 
static int DisableViewer ()
 
static QGLFormat setupGLFormat (const unsigned int nbMSAASamples=1)
 

Protected Member Functions

void calcProjection (int width=0, int height=0)
 
void initializeGL () override
 
void paintGL () override
 
void paintEvent (QPaintEvent *qpe) override
 
void resizeGL (int w, int h) override
 
virtual void viewAll () override
 Overloaded from SofaViewer. More...
 
- Protected Member Functions inherited from sofa::gui::qt::viewer::SofaViewer
void redraw () override
 internally called while the actual viewer needs a redraw (ie the camera changed) More...
 

Signals

void redrawn () override
 
void resizeW (int) override
 
void resizeH (int) override
 
void quit ()
 
- Signals inherited from sofa::gui::qt::viewer::SofaViewer
virtual void redrawn ()=0
 
virtual void resizeW (int)=0
 
virtual void resizeH (int)=0
 

Public Slots

void resetView () override
 
virtual void saveView () override
 
virtual void setSizeW (int) override
 
virtual void setSizeH (int) override
 
virtual void getView (defaulttype::Vector3 &pos, defaulttype::Quat &ori) const override
 
virtual void setView (const defaulttype::Vector3 &pos, const defaulttype::Quat &ori) override
 
virtual void newView () override
 
virtual void moveView (const defaulttype::Vector3 &pos, const defaulttype::Quat &ori) override
 
virtual void captureEvent () override
 
virtual void drawColourPicking (ColourPickingVisitor::ColourCode code) override
 
virtual void fitNodeBBox (sofa::core::objectmodel::BaseNode *node) override
 
virtual void fitObjectBBox (sofa::core::objectmodel::BaseObject *obj) override
 

Additional Inherited Members

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

Attribute details

Vector3 sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorAbsolutePosition
Quaternion sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorCurrentQuat
Quaternion sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorNewQuat
static
bool sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorRotationMode
Trackball sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorTrackball
bool sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorTranslationMode
bool sofa::gui::qt::viewer::qt::QtViewer::_mouseRotate = false
static
bool sofa::gui::qt::viewer::qt::QtViewer::_mouseTrans = false
static
int sofa::gui::qt::viewer::qt::QtViewer::_translationMode
const std::string sofa::gui::qt::viewer::qt::QtViewer::VIEW_FILE_EXTENSION = "view"
static

TODO: standardize .view file parameters.

Constructor details

sofa::gui::qt::viewer::qt::QtViewer::QtViewer ( QWidget parent,
const char *  name = "",
const unsigned int  nbMSAASamples = 1 
)
sofa::gui::qt::viewer::qt::QtViewer::~QtViewer ( )
override

Function details

static const char* sofa::gui::qt::viewer::qt::QtViewer::acceleratedName ( )
inlinestatic
void sofa::gui::qt::viewer::qt::QtViewer::ApplyMouseInteractorTransformation ( int  x,
int  y 
)
void sofa::gui::qt::viewer::qt::QtViewer::calcProjection ( int  width = 0,
int  height = 0 
)
protected
virtual void sofa::gui::qt::viewer::qt::QtViewer::captureEvent ( )
inlineoverridevirtualslot
static QtViewer* sofa::gui::qt::viewer::qt::QtViewer::create ( QtViewer ,
BaseViewerArgument arg 
)
inlinestatic
static int sofa::gui::qt::viewer::qt::QtViewer::DisableViewer ( )
static

Disable this class of viewer. This method is called after the viewer is destroyed and can be used to unregister classes associated with in the the ObjectFactory.

void sofa::gui::qt::viewer::qt::QtViewer::drawColourPicking ( ColourPickingVisitor::ColourCode  code)
overridevirtualslot
static int sofa::gui::qt::viewer::qt::QtViewer::EnableViewer ( )
static

Activate this class of viewer. This method is called before the viewer is actually created and can be used to register classes associated with in the the ObjectFactory.

virtual void sofa::gui::qt::viewer::qt::QtViewer::fitNodeBBox ( sofa::core::objectmodel::BaseNode node)
inlineoverridevirtualslot
virtual void sofa::gui::qt::viewer::qt::QtViewer::fitObjectBBox ( sofa::core::objectmodel::BaseObject obj)
inlineoverridevirtualslot
int sofa::gui::qt::viewer::qt::QtViewer::getHeight ( )
inlineoverridevirtual

Implements sofa::gui::BaseViewer.

QWidget* sofa::gui::qt::viewer::qt::QtViewer::getQWidget ( )
inlineoverridevirtual
sofa::simulation::Node* sofa::gui::qt::viewer::qt::QtViewer::getScene ( )
inlineoverridevirtual

Reimplemented from sofa::gui::BaseViewer.

void sofa::gui::qt::viewer::qt::QtViewer::getView ( defaulttype::Vector3 &  pos,
defaulttype::Quat ori 
) const
overridevirtualslot
int sofa::gui::qt::viewer::qt::QtViewer::getWidth ( )
inlineoverridevirtual

Implements sofa::gui::BaseViewer.

QString sofa::gui::qt::viewer::qt::QtViewer::helpString ( ) const
overridevirtual
void sofa::gui::qt::viewer::qt::QtViewer::initializeGL ( void  )
overrideprotected
void sofa::gui::qt::viewer::qt::QtViewer::moveRayPickInteractor ( int  ,
int   
)
overridevirtual

RayCasting PickHandler.

Reimplemented from sofa::gui::BaseViewer.

void sofa::gui::qt::viewer::qt::QtViewer::moveView ( const defaulttype::Vector3 &  pos,
const defaulttype::Quat ori 
)
overridevirtualslot
void sofa::gui::qt::viewer::qt::QtViewer::newView ( )
overridevirtualslot
void sofa::gui::qt::viewer::qt::QtViewer::paintEvent ( QPaintEvent *  qpe)
overrideprotected
void sofa::gui::qt::viewer::qt::QtViewer::paintGL ( )
overrideprotected
void sofa::gui::qt::viewer::qt::QtViewer::quit ( )
signal
bool sofa::gui::qt::viewer::qt::QtViewer::ready ( )
inlineoverridevirtual

true when the viewer keep the hand on the render false when it's not in activity

Reimplemented from sofa::gui::BaseViewer.

void sofa::gui::qt::viewer::qt::QtViewer::redrawn ( )
overridesignal
void sofa::gui::qt::viewer::qt::QtViewer::resetView ( )
overrideslot
void sofa::gui::qt::viewer::qt::QtViewer::resizeGL ( int  w,
int  h 
)
overrideprotected
void sofa::gui::qt::viewer::qt::QtViewer::resizeH ( int  )
overridesignal
void sofa::gui::qt::viewer::qt::QtViewer::resizeW ( int  )
overridesignal
void sofa::gui::qt::viewer::qt::QtViewer::saveView ( )
overridevirtualslot
void sofa::gui::qt::viewer::qt::QtViewer::screenshot ( const std::string &  filename,
int  compression_level = -1 
)
overridevirtual

Reimplemented from sofa::gui::qt::viewer::SofaViewer.

void sofa::gui::qt::viewer::qt::QtViewer::setSizeH ( int  size)
overridevirtualslot
void sofa::gui::qt::viewer::qt::QtViewer::setSizeW ( int  size)
overridevirtualslot
QGLFormat sofa::gui::qt::viewer::qt::QtViewer::setupGLFormat ( const unsigned int  nbMSAASamples = 1)
static
void sofa::gui::qt::viewer::qt::QtViewer::setView ( const defaulttype::Vector3 &  pos,
const defaulttype::Quat ori 
)
overridevirtualslot
void sofa::gui::qt::viewer::qt::QtViewer::UpdateOBJ ( void  )
virtual void sofa::gui::qt::viewer::qt::QtViewer::viewAll ( void  )
inlineoverrideprotectedvirtual

Overloaded from SofaViewer.

Implements sofa::gui::BaseViewer.

static const char* sofa::gui::qt::viewer::qt::QtViewer::viewerName ( )
inlinestatic
void sofa::gui::qt::viewer::qt::QtViewer::wait ( )
inlineoverridevirtual

ask the viewer to resume its activity

Reimplemented from sofa::gui::BaseViewer.