diff --git a/wrap/gui/activecoordinateframe.h b/wrap/gui/activecoordinateframe.h index 0ba6cb21..d5a1dc8b 100644 --- a/wrap/gui/activecoordinateframe.h +++ b/wrap/gui/activecoordinateframe.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.1 2008/03/02 16:44:18 benedetti +moved ActiveCoordinateFrame to its own files + ****************************************************************************/ #ifndef ACTIVECOORDINATEFRAME_H @@ -34,25 +37,127 @@ $Log: not supported by cvs2svn $ namespace vcg { +/*! + @brief The ActiveCoordinateFrame class. + + This class implements an eulerian trackball over a Movable Coordinate Frame. +*/ class ActiveCoordinateFrame: public MovableCoordinateFrame { public: - ActiveCoordinateFrame(float); - virtual ~ActiveCoordinateFrame(); - virtual void Render(QGLWidget*); - virtual void Reset(bool, bool); - virtual void SetPosition(const Point3f); - virtual void SetRotation(const Quaternionf); - virtual void AlignWith(const Point3f, const Point3f,const char,const char); - void MouseDown(int, int, int); - void MouseMove(int, int); - void MouseUp(int, int, int); - void ButtonUp(int); - void ButtonDown(int); - void SetSnap(float); + /*! + @brief The constructor. + Initialize the ActiveCoordinateFrame data. + @param size the distance from the origin to the endpoint of the arrows. + */ + ActiveCoordinateFrame(float size); + + /*! + @brief The destructor. + + The destructor. + */ + virtual ~ActiveCoordinateFrame(); + + /*! + @brief Render the active coordinate frame in its position. + + @param glw the GL widget. + */ + virtual void Render(QGLWidget* glw); + + /*! + @brief Reset the position and/or the rotation of the coordinate frame. + + @param reset_position set to true to reset the position. + @param reset_alignment set to true to reset the rotation. + */ + virtual void Reset(bool reset_position,bool reset_alignment); + /*! + @brief Set the position of the coordinate frame. + + @param new_position the new position of the coordinate frame. + */ + virtual void SetPosition(const Point3f new_position); + + /*! + @brief Set the rotation of the coordinate frame. + + @param new_rotation the new rotation of the coordinate frame. + */ + virtual void SetRotation(const Quaternionf rotation); + + /*! + @brief Align the coordinate frame to one or two directions. + + If the primary direction of alignment is null this function does nothing, otherwise two rotations are performed: the first rotation aligns the axis named axis_1 to the primary direction of alignment, the second rotation never moves axis_1 away from the primary direction. + + If the secondary direction of alignment is not null and is not parallel to the primary direction the axis named axis_2 is rotated as much as possible to be aligned to secondary direction. + + If the secondary direction of alignment is null the axis named axis_2 is rotated as much as possible to be realigned to its old direction, if this is impossible the remaining axis is used. + + @param primary the primary direction of alignment. + @param secondary the secondary direction of alignment. + @param axis_1 the name of the axis to align to the primary direction, must be a char choosen from 'X', 'Y' and 'Z' + @param axis_2 the name of the axis to align to the secondary direction, must be different from axis_1 and must be a char choosen from 'X', 'Y', 'Z' and ' '; if the char is ' ' the axis is choosen automatically. + */ + virtual void AlignWith(const Point3f primary, const Point3f secondary, const char axis_1, const char axis_2); + + /*! + @brief Interface function relative to mouse down event in QT. + + @param x the x coordinate of the cursor. + @param y the y coordinate of the cursor. + @param button the keyboard modifiers state. + */ + void MouseDown(int x, int y, int button); + + /*! + @brief Interface function relative to mouse move event in QT. + + @param x the x coordinate of the cursor. + @param y the y coordinate of the cursor. + */ + void MouseMove(int x, int y); + + /*! + @brief Interface function relative to mouse up event in QT. + + @param x the x coordinate of the cursor. + @param y the y coordinate of the cursor. + @param button the keyboard modifiers state. + */ + void MouseUp(int x, int y, int button); + + /*! + @brief Interface function relative to keyboard up event in QT. + + @param button the keyboard modifiers state. + */ + void ButtonUp(int button); + + /*! + @brief Interface function relative to keyboard down event in QT. + + @param button the keyboard modifiers state. + */ + void ButtonDown(int button); + + /*! + @brief Set rotational snap value. + + @param value the new rotational snap value, in degrees. + */ + void SetSnap(float value); + + /// The eulerian trackball. Trackball *manipulator; + + /// The flag that enables moves feedback rendering bool drawmoves; + + /// The flag that enables rotations feedback rendering bool drawrotations; protected: // data: