Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
jafar::viewer3d::View3D Class Reference

This class provides a simple View for 3D objects. More...


Detailed Description

This class provides a simple View for 3D objects.

Definition at line 29 of file View3D.hpp.

#include <View3D.hpp>

List of all members.

Public Types

enum  CameraMode { CAMERA_PERSPECTIVE, CAMERA_ORTHO }

Public Slots

void setManipulatorIndex (int _index)
void setCameraMode (int _index)
void setDistance (double _distance)
void stepMovie ()
 Call this function to manually take the next frame of a movie.

Signals

void movieFrameNextIndex (int _index)
 This signal is emited each time a frame has been saved.
void cameraPositionChanged ()

Public Member Functions

 View3D (QWidget *parent=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=0)
void setBackgroundColor (double r, double g, double b, double a=1.0)
 Convenient function to change the background color of a view.
image::Image snapshot ()
 This function will copy the content of the view to an image::Image .
void saveSnapshot (const std::string &_fileName)
 This function will save the content of the view to an image.
void startMovie (const std::string &_fileNamePrefix, const std::string &_fileNameSuffix, int _interval, int _startIndex=0, unsigned int _digits=5)
 This function is used to start creating a movie of the view.
void stopMovie ()
 Stop taking snapshot for a movie.
bool isMovieRunning () const

Protected Member Functions

void init ()
virtual void paintGL ()
virtual void resizeGL (int width, int height)
virtual void keyPressEvent (QKeyEvent *event)
virtual void keyReleaseEvent (QKeyEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
virtual void mouseReleaseEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)

Private Slots

void timeout ()

Private Member Functions

osgGA::GUIEventAdapter * transferKeyModifier (QKeyEvent *event)
int qtKeyToOsgCode (QKeyEvent *event)

Private Attributes

Private *const d

Member Function Documentation

Returns:
true if the movie is running
void jafar::viewer3d::View3D::movieFrameNextIndex ( int  _index) [signal]

This signal is emited each time a frame has been saved.

With the next index.

void jafar::viewer3d::View3D::saveSnapshot ( const std::string &  _fileName)

This function will save the content of the view to an image.

Parameters:
_fileNamename of the file

Example of use:

 v = Viewer3d::View3D.new
 root = Viewer3d::Group.new
 ss = Viewer3d::SphereSegment.new( [0.0, 0.0, 0.0], 10.0, -Math::PI, Math::PI, -Math::PI, Math::PI, 60 )
 ss.setAllColors([1.0,1.0,1.0,0.5])
 ss.setSideColor([0.0,1.0,1.0,0.1])
 root.addChild( ss )
 v.setSceneData( root )
 v.saveSnapshot( "snap.png" )
void jafar::viewer3d::View3D::startMovie ( const std::string &  _fileNamePrefix,
const std::string &  _fileNameSuffix,
int  _interval,
int  _startIndex = 0,
unsigned int  _digits = 5 
)

This function is used to start creating a movie of the view.

The images are saved as " @p _fileNamePrefix frameIndex @p _fileNameSuffix ".

Parameters:
_fileNamePrefixprefix of the image (for instance "images.")
_fileNameSuffixsuffix of the image (for instance ".png")
_intervalthe interval in ms between two snapshots, an interval of 0 means that no timer is set, and that you have to call stepMovie to takes a snapshot (there is no guarantee that the _interval will be respected, the snapshot will be taken as soon as possible, which is next time the Qt eventLoop is executed)
_startIndexthe first index used for the snapshots
_digitsthe number of digits used for the frame index

Example of use:

 v = Viewer3d::View3D.new
 root = Viewer3d::Group.new
 ss = Viewer3d::SphereSegment.new( [0.0, 0.0, 0.0], 10.0, -Math::PI, Math::PI, -Math::PI, Math::PI, 60 )
 ss.setAllColors([1.0,1.0,1.0,0.5])
 ss.setSideColor([0.0,1.0,1.0,0.1])
 root.addChild( ss )
 v.setSceneData( root )
 v.startMovie( "image.", ".png", 100 )

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:52 for Jafar by doxygen 1.7.6.1
LAAS-CNRS