Debian Codegraph @

vcg/wrap/gui/activecoordinateframe.h

raw symbols SCIP
1 /****************************************************************************
2 * MeshLab o o *
3 * A versatile mesh processing toolbox o o *
4 * _ O _ *
5 * Copyright(C) 2008 \/)\/ *
6 * Visual Computing Lab /\/| *
7 * ISTI - Italian National Research Council | *
8 * \ *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
20 * for more details. *
21 * *
22 ****************************************************************************/
23 /****************************************************************************
24 History
25 $Log: activecoordinateframe.h,v $
26 Revision 1.2 2008/03/21 16:08:43 benedetti
27 Added doxygen documentation
28
29 Revision 1.1 2008/03/02 16:44:18 benedetti
30 moved ActiveCoordinateFrame to its own files
31
32
33 ****************************************************************************/
34 #ifndef ACTIVECOORDINATEFRAME_H
35 #define ACTIVECOORDINATEFRAME_H
36
37 #include "coordinateframe.h"
38 #include <wrap/gui/trackball.h>
39 #include <QGLWidget>
40
41 namespace vcg {
42
43 /*!
44 @brief The ActiveCoordinateFrame class.
45
46 This class implements an eulerian trackball over a Movable Coordinate Frame.
47 */
48 class ActiveCoordinateFrame: public MovableCoordinateFrame
49 {
50 public:
51 /*!
52 @brief The constructor.
53
54 Initialize the ActiveCoordinateFrame data.
55 @param size the distance from the origin to the endpoint of the arrows.
56 */
57 ActiveCoordinateFrame(float size);
58
59 /*!
60 @brief The destructor.
61
62 The destructor.
63 */
64 virtual ~ActiveCoordinateFrame();
65
66 /*!
67 @brief Render the active coordinate frame in its position.
68
69 @param glw the GL widget.
70 */
71 virtual void Render(QGLWidget* glw);
72
73 /*!
74 @brief Reset the position and/or the rotation of the coordinate frame.
75
76 @param reset_position set to true to reset the position.
77 @param reset_alignment set to true to reset the rotation.
78 */
79 virtual void Reset(bool reset_position,bool reset_alignment);
80 /*!
81 @brief Set the position of the coordinate frame.
82
83 @param new_position the new position of the coordinate frame.
84 */
85 virtual void SetPosition(const Point3f new_position);
86
87 /*!
88 @brief Set the rotation of the coordinate frame.
89
90 @param new_rotation the new rotation of the coordinate frame.
91 */
92 virtual void SetRotation(const Quaternionf rotation);
93
94 /*!
95 @brief Align the coordinate frame to one or two directions.
96
97 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.
98
99 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.
100
101 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.
102
103 @param primary the primary direction of alignment.
104 @param secondary the secondary direction of alignment.
105 @param axis_1 the name of the axis to align to the primary direction, must be a char choosen from 'X', 'Y' and 'Z'
106 @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.
107 */
108 virtual void AlignWith(const Point3f primary, const Point3f secondary, const char axis_1, const char axis_2);
109
110 /*!
111 @brief Interface function relative to mouse down event in QT.
112
113 @param x the x coordinate of the cursor.
114 @param y the y coordinate of the cursor.
115 @param button the keyboard modifiers state.
116 */
117 void MouseDown(int x, int y, int button);
118
119 /*!
120 @brief Interface function relative to mouse move event in QT.
121
122 @param x the x coordinate of the cursor.
123 @param y the y coordinate of the cursor.
124 */
125 void MouseMove(int x, int y);
126
127 /*!
128 @brief Interface function relative to mouse up event in QT.
129
130 @param x the x coordinate of the cursor.
131 @param y the y coordinate of the cursor.
132 @param button the keyboard modifiers state.
133 */
134 void MouseUp(int x, int y, int button);
135
136 /*!
137 @brief Interface function relative to keyboard up event in QT.
138
139 @param button the keyboard modifiers state.
140 */
141 void ButtonUp(int button);
142
143 /*!
144 @brief Interface function relative to keyboard down event in QT.
145
146 @param button the keyboard modifiers state.
147 */
148 void ButtonDown(int button);
149
150 /*!
151 @brief Set rotational snap value.
152
153 @param value the new rotational snap value, in degrees.
154 */
155 void SetSnap(float value);
156
157 /// The eulerian trackball.
158 Trackball *manipulator;
159
160 /// The flag that enables moves feedback rendering
161 bool drawmoves;
162
163 /// The flag that enables rotations feedback rendering
164 bool drawrotations;
165 protected:
166 // data:
167 const int move_button,rotate_button;
168 const int x_modifier,y_modifier,z_modifier;
169 Point3f x_axis,y_axis,z_axis;
170 float rot_snap_rad,mov_snap;
171 // functions:
172 virtual void Move(const Similarityf);
173 void Update();
174 private:
175 int movx,movy,movz,rotx,roty,rotz;
176 };
177
178 }//namespace
179 #endif /*ACTIVECOORDINATEFRAME_H*/