gepetto::viewer::WindowManager Class Reference

Manage a window that renders a scene. More...

#include <gepetto/viewer/window-manager.h>

Inheritance diagram for gepetto::viewer::WindowManager:
[legend]
Collaboration diagram for gepetto::viewer::WindowManager:
[legend]

Public Types

enum  TextAlignment {
  TOP = 0,
  CENTER = 1,
  BOTTOM = 2,
  RIGHT = 0,
  LEFT = 2
}
 
- Public Types inherited from gepetto::viewer::Properties
typedef std::map< std::string, WrapperPropertyMap_t
 

Public Member Functions

virtual WindowManagerPtr_t clone (void) const
 Proceed to a clonage of the current object defined by the copy constructor. More...
 
WindowManagerPtr_t self (void) const
 Return a shared pointer of the current object. More...
 
virtual bool addNode (NodePtr_t graphical_object_ptr)
 Add a graphical object to the scene. More...
 
virtual GroupNodePtr_t getScene () const
 Return the scene group. More...
 
virtual bool done ()
 Return the current doing of procedure. More...
 
virtual bool frame ()
 Generate a new frame rendering. More...
 
virtual bool run ()
 Run the scene process. More...
 
virtual void setWindowDimension (const osgVector2 &size)
 Define dimension of the window. More...
 
virtual void setWindowPosition (const osgVector2 &position)
 Define the window position. More...
 
osgVector2 getWindowPosition () const
 Return the window x and y position as a 2D vector. More...
 
osgVector2 getWindowDimension () const
 Return the window width and height as a 2D vector. More...
 
std::string getText (TextAlignment verticalPos, TextAlignment horizontalPos) const
 
void setText (TextAlignment verticalPos, TextAlignment horizontalPos, const std::string &text, float size=20)
 Set the HUD text. More...
 
::osgViewer::ViewerRefPtr getViewerClone ()
 Return a ref to the viewer. More...
 
virtual ~WindowManager ()
 
void captureFrame (const std::string &filename)
 
void startCapture (const std::string &filename, const std::string &extension)
 
void stopCapture ()
 
bool writeNodeFile (const std::string &filename)
 
void setBackgroundColor1 (const osg::Vec4 &color)
 
void setBackgroundColor2 (const osg::Vec4 &color)
 
void getCameraTransform (osg::Vec3d &pos, osg::Quat &rot)
 
void setCameraTransform (const osg::Vec3d &pos, const osg::Quat &rot)
 
void attachCameraToNode (NodePtr_t node)
 
void detachCamera ()
 
- Public Member Functions inherited from gepetto::viewer::GroupNode
GroupNodePtr_t clone (void) const
 Proceed to a clonage of the current object defined by the copy constructor. More...
 
GroupNodePtr_t self (void) const
 Return a shared pointer of the current object. More...
 
virtual bool addChild (NodePtr_t child_ptr)
 Add a GraphicalObject to the list. More...
 
virtual bool removeChild (NodePtr_t child_ptr)
 Remove a GraphicalObject from the list. More...
 
virtual bool hasChild (NodePtr_t child_ptr) const
 Return true if this group contains this child. More...
 
virtual void removeAllChildren ()
 Remove all children. More...
 
virtual size_t getNumOfChildren () const
 
virtual NodePtr_t getChild (size_t i) const
 
virtual void setLightingMode (const LightingMode &lighting_state)
 Virtual method for setting the lighting mode of the object : influence by light or not. More...
 
virtual void setWireFrameMode (const WireFrameMode &wireframe_state)
 Virtual method for setting the wireframe mode of the object : visible or not. More...
 
virtual void setAlpha (const float &alpha)
 Replace the old transparency value with alpha Note : alpha must be in [0,1]. More...
 
void setColor (const osgVector4 &color)
 Set the color of the object. More...
 
void traverse (NodeVisitor &visitor)
 
virtual osg::ref_ptr< osg::Node > getOsgNode () const
 
virtual ~GroupNode ()
 
- Public Member Functions inherited from gepetto::viewer::Node
const ConfigurationgetGlobalTransform () const
 returns rotation and position of the node in word frame More...
 
std::string getID () const
 getID is a public method for getting the id_name of the Object More...
 
bool isDirty () const
 
void setDirty (bool dirty=true)
 Called when a property is modified. More...
 
void applyConfiguration (const osgVector3 &position, const osgQuat &quat)
 Apply a new global configuration. More...
 
void applyConfiguration (const Configuration &cfg)
 Apply a new global configuration. More...
 
void setStaticTransform (const osgVector3 &position, const osgQuat &quat)
 Set Static transformation. More...
 
osgQuat getStaticRotation () const
 Get Static rotation. More...
 
osgVector3 getStaticPosition () const
 Get Static position. More...
 
virtual void setVisibilityMode (const VisibilityMode &visibility_state)
 Virtual method for setting the visibility mode of the object : visible or not visible. More...
 
virtual const VisibilityModegetVisibilityMode () const
 
virtual LightingMode getLightingMode () const
 
virtual const WireFrameModegetWireFrameMode () const
 
void setScale (float scale)
 Set scale value of the OSG object. More...
 
void setScale (const osgVector3 &scale)
 Set scales value of the OSG object. More...
 
osgVector3 getScale () const
 Get scale. More...
 
virtual ::osg::GroupRefPtr asGroup () const
 Return the root node to include it in the scene. More...
 
virtual void addLandmark (const float &size)
 
bool hasLandmark () const
 
::osg::StateSetRefPtr getOrCreateRootStateSet ()
 
void deleteLandmark ()
 
bool getHighlightEnabled () const
 
void setHighlightEnabled (bool enabled)
 
void setHighlightState (unsigned int state)
 
const std::size_t & getHighlightState () const
 
virtual float getAlpha () const
 
void setTransparency (const float &transparency)
 
float getTransparency () const
 
virtual ~Node ()
 
- Public Member Functions inherited from gepetto::viewer::Properties
Propertyproperty (const std::string &name) const
 Access a property. More...
 
bool callVoidProperty (const std::string &name) const
 
template<typename T >
bool getProperty (const std::string &name, T &value) const
 
template<typename T >
bool setProperty (const std::string &name, const T &value)
 Set a property and set this object as dirty. More...
 
bool hasProperty (const std::string &name) const
 
const PropertyMap_tproperties () const
 
void addProperty (const PropertyPtr_t &prop)
 Add a property and take ownership. More...
 
void addProperty (const std::string &name, const PropertyPtr_t &prop)
 Add a property and take ownership. More...
 
void addProperty (Property *prop)
 Add a property and leave ownership. More...
 
void addProperty (const std::string &name, Property *prop)
 Add a property and leave ownership. More...
 
QWidget * guiEditor ()
 

Static Public Member Functions

static WindowManagerPtr_t create ()
 Create and initialize a graphical engine of type OSG. More...
 
static WindowManagerPtr_t create (osg::GraphicsContext *gc)
 Create and initialize a graphical engine with a GraphicsContext. More...
 
static WindowManagerPtr_t create (osgViewer::Viewer *v, osg::GraphicsContext *gc)
 
static WindowManagerPtr_t create (const unsigned int &x, const unsigned int &y, const unsigned int &width, const unsigned int &height)
 Create and initialize a graphical engine of type OSG with some parameters : position + dimension. More...
 
static WindowManagerPtr_t createCopy (WindowManagerPtr_t other)
 Static method for creating a clone of box other with the copy constructor. More...
 
- Static Public Member Functions inherited from gepetto::viewer::GroupNode
static GroupNodePtr_t create (const std::string &name)
 Static method which create a new box defined by the half_axis vector. More...
 
static GroupNodePtr_t createCopy (GroupNodePtr_t other)
 Static method for creating a clone of box other with the copy constructor. More...
 

Additional Inherited Members

- Public Attributes inherited from gepetto::viewer::GroupNode
 SCENE_VIEWER_ACCEPT_VISITOR
 
- Public Attributes inherited from gepetto::viewer::Node
 SCENE_VIEWER_ACCEPT_VISITOR
 
- Static Public Attributes inherited from gepetto::viewer::Node
static const float TransparencyRenderingBinThreshold
 
- Protected Member Functions inherited from gepetto::viewer::GroupNode
 GroupNode (const std::string &name)
 Default constructor. More...
 
 GroupNode (const GroupNode &other)
 Copy constructor. More...
 
void initWeakPtr (GroupNodeWeakPtr other_weak_ptr)
 Initialize weak_ptr. More...
 
- Protected Member Functions inherited from gepetto::viewer::Node
 Node (const std::string &name)
 Default constructor. More...
 
 Node (const Node &other)
 Copy constructor. More...
 
::osg::GroupRefPtr asQueue () const
 Return the root node to include it in the scene. More...
 
void setID (const std::string &id_name)
 
void setTransparentRenderingBin (bool transparent=true, osg::StateSet *ss=NULL)
 
- Protected Attributes inherited from gepetto::viewer::Node
::osg::GeodeRefPtr landmark_geode_ptr_
 protected because it's used in LeafNodeCapsule More...
 
::osg::GeodeRefPtr geode_ptr_
 Geode pointer for landmarks. More...
 
float alpha_
 Alpha value. More...
 
- Protected Attributes inherited from gepetto::viewer::Properties
PropertyMap_t properties_
 

Detailed Description

Manage a window that renders a scene.

The root of the rendered scene is a GroupNode.

Member Enumeration Documentation

◆ TextAlignment

Enumerator
TOP 
CENTER 
BOTTOM 
RIGHT 
LEFT 

Constructor & Destructor Documentation

◆ ~WindowManager()

virtual gepetto::viewer::WindowManager::~WindowManager ( )
virtual

Referenced by getScene().

Member Function Documentation

◆ addNode()

virtual bool gepetto::viewer::WindowManager::addNode ( NodePtr_t  graphical_object_ptr)
virtual

Add a graphical object to the scene.

◆ attachCameraToNode()

void gepetto::viewer::WindowManager::attachCameraToNode ( NodePtr_t  node)

Referenced by setBackgroundColor2().

◆ captureFrame()

void gepetto::viewer::WindowManager::captureFrame ( const std::string &  filename)

Referenced by getScene().

◆ clone()

virtual WindowManagerPtr_t gepetto::viewer::WindowManager::clone ( void  ) const
virtual

Proceed to a clonage of the current object defined by the copy constructor.

◆ create() [1/4]

static WindowManagerPtr_t gepetto::viewer::WindowManager::create ( )
static

Create and initialize a graphical engine of type OSG.

◆ create() [2/4]

static WindowManagerPtr_t gepetto::viewer::WindowManager::create ( osg::GraphicsContext *  gc)
static

Create and initialize a graphical engine with a GraphicsContext.

◆ create() [3/4]

static WindowManagerPtr_t gepetto::viewer::WindowManager::create ( osgViewer::Viewer *  v,
osg::GraphicsContext *  gc 
)
static

◆ create() [4/4]

static WindowManagerPtr_t gepetto::viewer::WindowManager::create ( const unsigned int &  x,
const unsigned int &  y,
const unsigned int &  width,
const unsigned int &  height 
)
static

Create and initialize a graphical engine of type OSG with some parameters : position + dimension.

◆ createCopy()

static WindowManagerPtr_t gepetto::viewer::WindowManager::createCopy ( WindowManagerPtr_t  other)
static

Static method for creating a clone of box other with the copy constructor.

◆ detachCamera()

void gepetto::viewer::WindowManager::detachCamera ( )

Referenced by setBackgroundColor2().

◆ done()

virtual bool gepetto::viewer::WindowManager::done ( )
virtual

Return the current doing of procedure.

Referenced by getScene().

◆ frame()

virtual bool gepetto::viewer::WindowManager::frame ( )
virtual

Generate a new frame rendering.

Referenced by getScene().

◆ getCameraTransform()

void gepetto::viewer::WindowManager::getCameraTransform ( osg::Vec3d &  pos,
osg::Quat &  rot 
)

Referenced by setBackgroundColor2().

◆ getScene()

virtual GroupNodePtr_t gepetto::viewer::WindowManager::getScene ( ) const
inlinevirtual

◆ getText()

std::string gepetto::viewer::WindowManager::getText ( TextAlignment  verticalPos,
TextAlignment  horizontalPos 
) const

Referenced by getScene().

◆ getViewerClone()

::osgViewer::ViewerRefPtr gepetto::viewer::WindowManager::getViewerClone ( )

Return a ref to the viewer.

Referenced by getScene().

◆ getWindowDimension()

osgVector2 gepetto::viewer::WindowManager::getWindowDimension ( ) const

Return the window width and height as a 2D vector.

Referenced by getScene().

◆ getWindowPosition()

osgVector2 gepetto::viewer::WindowManager::getWindowPosition ( ) const

Return the window x and y position as a 2D vector.

Referenced by getScene().

◆ run()

virtual bool gepetto::viewer::WindowManager::run ( )
virtual

Run the scene process.

Referenced by getScene().

◆ self()

WindowManagerPtr_t gepetto::viewer::WindowManager::self ( void  ) const

Return a shared pointer of the current object.

◆ setBackgroundColor1()

void gepetto::viewer::WindowManager::setBackgroundColor1 ( const osg::Vec4 &  color)
inline

◆ setBackgroundColor2()

void gepetto::viewer::WindowManager::setBackgroundColor2 ( const osg::Vec4 &  color)
inline

◆ setCameraTransform()

void gepetto::viewer::WindowManager::setCameraTransform ( const osg::Vec3d &  pos,
const osg::Quat &  rot 
)

Referenced by setBackgroundColor2().

◆ setText()

void gepetto::viewer::WindowManager::setText ( TextAlignment  verticalPos,
TextAlignment  horizontalPos,
const std::string &  text,
float  size = 20 
)

Set the HUD text.

Referenced by getScene().

◆ setWindowDimension()

virtual void gepetto::viewer::WindowManager::setWindowDimension ( const osgVector2 size)
virtual

Define dimension of the window.

Parameters
size(width, height)

Referenced by getScene().

◆ setWindowPosition()

virtual void gepetto::viewer::WindowManager::setWindowPosition ( const osgVector2 position)
virtual

Define the window position.

Parameters
position(x_pos, y_pos)

Referenced by getScene().

◆ startCapture()

void gepetto::viewer::WindowManager::startCapture ( const std::string &  filename,
const std::string &  extension 
)

Referenced by getScene().

◆ stopCapture()

void gepetto::viewer::WindowManager::stopCapture ( )

Referenced by getScene().

◆ writeNodeFile()

bool gepetto::viewer::WindowManager::writeNodeFile ( const std::string &  filename)

Referenced by getScene().