SOFA API  1a4bb3e7
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
 
Quat< SReal > _mouseInteractorCurrentQuat
 
Vec3 _mouseInteractorAbsolutePosition
 
Trackball _mouseInteractorTrackball
 

Static Public Attributes

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

Public Member Functions

 QtViewer (QWidget *parent, const char *name="")
 
 ~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::setting::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::common::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::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 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 *, common::BaseViewerArgument &arg)
 
static const charviewerName ()
 
static const characceleratedName ()
 
static int EnableViewer ()
 
static int DisableViewer ()
 

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 (type::Vec3 &pos, type::Quat< SReal > &ori) const override
 
virtual void setView (const type::Vec3 &pos, const type::Quat< SReal > &ori) override
 
virtual void newView () override
 
virtual void moveView (const type::Vec3 &pos, const type::Quat< SReal > &ori) override
 
virtual void captureEvent () override
 
virtual void drawColourPicking (common::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::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
 

Attribute details

◆ _mouseInteractorAbsolutePosition

Vec3 sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorAbsolutePosition

◆ _mouseInteractorCurrentQuat

Quat<SReal> sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorCurrentQuat

◆ _mouseInteractorNewQuat

Quat< SReal > sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorNewQuat
static

◆ _mouseInteractorRotationMode

bool sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorRotationMode

◆ _mouseInteractorTrackball

Trackball sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorTrackball

◆ _mouseInteractorTranslationMode

bool sofa::gui::qt::viewer::qt::QtViewer::_mouseInteractorTranslationMode

◆ _mouseRotate

bool sofa::gui::qt::viewer::qt::QtViewer::_mouseRotate = false
static

◆ _mouseTrans

bool sofa::gui::qt::viewer::qt::QtViewer::_mouseTrans = false
static

◆ _translationMode

int sofa::gui::qt::viewer::qt::QtViewer::_translationMode

◆ VIEW_FILE_EXTENSION

const std::string sofa::gui::qt::viewer::qt::QtViewer::VIEW_FILE_EXTENSION = "view"
static

TODO: standardize .view file parameters.

Constructor details

◆ QtViewer()

sofa::gui::qt::viewer::qt::QtViewer::QtViewer ( QWidget parent,
const char name = "" 
)

◆ ~QtViewer()

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

Function details

◆ acceleratedName()

static const char* sofa::gui::qt::viewer::qt::QtViewer::acceleratedName ( )
inlinestatic

◆ ApplyMouseInteractorTransformation()

void sofa::gui::qt::viewer::qt::QtViewer::ApplyMouseInteractorTransformation ( int  x,
int  y 
)

◆ calcProjection()

void sofa::gui::qt::viewer::qt::QtViewer::calcProjection ( int  width = 0,
int  height = 0 
)
protected

◆ captureEvent

virtual void sofa::gui::qt::viewer::qt::QtViewer::captureEvent ( )
inlineoverridevirtualslot

◆ create()

static QtViewer* sofa::gui::qt::viewer::qt::QtViewer::create ( QtViewer ,
common::BaseViewerArgument arg 
)
inlinestatic

◆ DisableViewer()

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 ObjectFactory.

◆ drawColourPicking

void sofa::gui::qt::viewer::qt::QtViewer::drawColourPicking ( common::ColourPickingVisitor::ColourCode  code)
overridevirtualslot

◆ EnableViewer()

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 ObjectFactory.

◆ fitNodeBBox

virtual void sofa::gui::qt::viewer::qt::QtViewer::fitNodeBBox ( sofa::core::objectmodel::BaseNode node)
inlineoverridevirtualslot

◆ fitObjectBBox

virtual void sofa::gui::qt::viewer::qt::QtViewer::fitObjectBBox ( sofa::core::objectmodel::BaseObject obj)
inlineoverridevirtualslot

◆ getHeight()

int sofa::gui::qt::viewer::qt::QtViewer::getHeight ( )
inlineoverridevirtual

◆ getQWidget()

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

◆ getScene()

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

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

◆ getView

void sofa::gui::qt::viewer::qt::QtViewer::getView ( type::Vec3 pos,
type::Quat< SReal > &  ori 
) const
overridevirtualslot

◆ getWidth()

int sofa::gui::qt::viewer::qt::QtViewer::getWidth ( )
inlineoverridevirtual

◆ helpString()

QString sofa::gui::qt::viewer::qt::QtViewer::helpString ( ) const
overridevirtual

◆ initializeGL()

void sofa::gui::qt::viewer::qt::QtViewer::initializeGL ( void  )
overrideprotected

◆ moveRayPickInteractor()

void sofa::gui::qt::viewer::qt::QtViewer::moveRayPickInteractor ( int  ,
int   
)
overridevirtual

RayCasting PickHandler.

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

◆ moveView

void sofa::gui::qt::viewer::qt::QtViewer::moveView ( const type::Vec3 pos,
const type::Quat< SReal > &  ori 
)
overridevirtualslot

◆ newView

void sofa::gui::qt::viewer::qt::QtViewer::newView ( )
overridevirtualslot

◆ paintEvent()

void sofa::gui::qt::viewer::qt::QtViewer::paintEvent ( QPaintEvent *  qpe)
overrideprotected

◆ paintGL()

void sofa::gui::qt::viewer::qt::QtViewer::paintGL ( )
overrideprotected

◆ quit

void sofa::gui::qt::viewer::qt::QtViewer::quit ( )
signal

◆ ready()

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::common::BaseViewer.

◆ redrawn

void sofa::gui::qt::viewer::qt::QtViewer::redrawn ( )
overridesignal

◆ resetView

void sofa::gui::qt::viewer::qt::QtViewer::resetView ( )
overrideslot

◆ resizeGL()

void sofa::gui::qt::viewer::qt::QtViewer::resizeGL ( int  w,
int  h 
)
overrideprotected

◆ resizeH

void sofa::gui::qt::viewer::qt::QtViewer::resizeH ( int  )
overridesignal

◆ resizeW

void sofa::gui::qt::viewer::qt::QtViewer::resizeW ( int  )
overridesignal

◆ saveView

void sofa::gui::qt::viewer::qt::QtViewer::saveView ( )
overridevirtualslot

◆ screenshot()

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

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

◆ setSizeH

void sofa::gui::qt::viewer::qt::QtViewer::setSizeH ( int  size)
overridevirtualslot

◆ setSizeW

void sofa::gui::qt::viewer::qt::QtViewer::setSizeW ( int  size)
overridevirtualslot

◆ setView

void sofa::gui::qt::viewer::qt::QtViewer::setView ( const type::Vec3 pos,
const type::Quat< SReal > &  ori 
)
overridevirtualslot

◆ UpdateOBJ()

void sofa::gui::qt::viewer::qt::QtViewer::UpdateOBJ ( void  )

◆ viewAll()

virtual void sofa::gui::qt::viewer::qt::QtViewer::viewAll ( void  )
inlineoverrideprotectedvirtual

Overloaded from SofaViewer.

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

◆ viewerName()

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

◆ wait()

void sofa::gui::qt::viewer::qt::QtViewer::wait ( )
inlineoverridevirtual

ask the viewer to resume its activity

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