manipulatedFrame.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  Copyright (C) 2002-2013 Gilles Debunne. All rights reserved.
4 
5  This file is part of the QGLViewer library version 2.4.0.
6 
7  http://www.libqglviewer.com - contact@libqglviewer.com
8 
9  This file may be used under the terms of the GNU General Public License
10  versions 2.0 or 3.0 as published by the Free Software Foundation and
11  appearing in the LICENSE file included in the packaging of this file.
12  In addition, as a special exception, Gilles Debunne gives you certain
13  additional rights, described in the file GPL_EXCEPTION in this package.
14 
15  libQGLViewer uses dual licensing. Commercial/proprietary software must
16  purchase a libQGLViewer Commercial License.
17 
18  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
19  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 
21 *****************************************************************************/
22 
23 #ifndef QGLVIEWER_MANIPULATED_FRAME_H
24 #define QGLVIEWER_MANIPULATED_FRAME_H
25 
26 #include "frame.h"
27 #include "mouseGrabber.h"
28 
29 #if QT_VERSION >= 0x040000
30 # include <QString>
31 # include <QTimer>
32 # include <QDateTime>
33 #else
34 # include <qstring.h>
35 # include <qtimer.h>
36 # include <qdatetime.h>
37 #endif
38 
39 namespace qglviewer {
101  {
102 #ifndef DOXYGEN
103  friend class Camera;
104  friend class ::QGLViewer;
105 #endif
106 
107  Q_OBJECT
108 
109  public:
112  virtual ~ManipulatedFrame() {};
113 
115  ManipulatedFrame& operator=(const ManipulatedFrame& mf);
116 
117  Q_SIGNALS:
129  void manipulated();
130 
141  void spun();
142 
145  public Q_SLOTS:
147  void setRotationSensitivity(float sensitivity) { rotSensitivity_ = sensitivity; };
149  void setTranslationSensitivity(float sensitivity) { transSensitivity_ = sensitivity; };
151  void setSpinningSensitivity(float sensitivity) { spinningSensitivity_ = sensitivity; };
153  void setWheelSensitivity(float sensitivity) { wheelSensitivity_ = sensitivity; };
154  public:
163  float rotationSensitivity() const { return rotSensitivity_; };
182  float translationSensitivity() const { return transSensitivity_; };
194  float spinningSensitivity() const { return spinningSensitivity_; };
202  float wheelSensitivity() const { return wheelSensitivity_; };
204 
205 
208  public:
215  bool isSpinning() const { return isSpinning_; };
224  Quaternion spinningQuaternion() const { return spinningQuaternion_; }
225  public Q_SLOTS:
228  void setSpinningQuaternion(const Quaternion& spinningQuaternion) { spinningQuaternion_ = spinningQuaternion; }
229  virtual void startSpinning(int updateInterval);
232  virtual void stopSpinning() { spinningTimer_.stop(); isSpinning_ = false; };
233  protected Q_SLOTS:
234  virtual void spin();
235  private Q_SLOTS:
236  void spinUpdate();
238 
241  protected:
242  virtual void mousePressEvent (QMouseEvent* const event, Camera* const camera);
243  virtual void mouseMoveEvent (QMouseEvent* const event, Camera* const camera);
244  virtual void mouseReleaseEvent (QMouseEvent* const event, Camera* const camera);
245  virtual void mouseDoubleClickEvent(QMouseEvent* const event, Camera* const camera);
246  virtual void wheelEvent (QWheelEvent* const event, Camera* const camera);
248 
249  public:
252  bool isManipulated() const;
254 
257  public:
258  virtual void checkIfGrabsMouse(int x, int y, const Camera* const camera);
260 
263  public:
264  virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
265  public Q_SLOTS:
266  virtual void initFromDOMElement(const QDomElement& element);
268 
269 #ifndef DOXYGEN
270  protected:
271  Quaternion deformedBallQuaternion(int x, int y, float cx, float cy, const Camera* const camera);
272 
273  int action_; // Should be a QGLViewer::MouseAction, but include loop
274  Constraint* previousConstraint_; // When manipulation is without Contraint.
275 
276  virtual void startAction(int ma, bool withConstraint=true); // int is really a QGLViewer::MouseAction
277  void computeMouseSpeed(const QMouseEvent* const e);
278  int mouseOriginalDirection(const QMouseEvent* const e);
279 
280  // Previous mouse position (used for incremental updates) and mouse press position.
281  QPoint prevPos_, pressPos_;
282 #endif // DOXYGEN
283 
284  private:
285  // Sensitivity
290 
291  // Mouse speed and spinning
293  float mouseSpeed_;
294  int delay_;
298 
299  // Whether the SCREEN_TRANS direction (horizontal or vertical) is fixed or not.
301 
302  // MouseGrabber
304  };
305 
306 } // namespace qglviewer
307 
308 #endif // QGLVIEWER_MANIPULATED_FRAME_H
void setTranslationSensitivity(float sensitivity)
A ManipulatedFrame is a Frame that can be rotated and translated using the mouse. ...
void setWheelSensitivity(float sensitivity)
float translationSensitivity() const
void setRotationSensitivity(float sensitivity)
Abstract class for objects that grab mouse focus in a QGLViewer.
Definition: mouseGrabber.h:134
#define Q_SLOTS
Definition: config.h:119
#define QGLVIEWER_EXPORT
Definition: config.h:75
#define Q_SIGNALS
Definition: config.h:120
void setSpinningQuaternion(const Quaternion &spinningQuaternion)
void setSpinningSensitivity(float sensitivity)
A perspective or orthographic camera.
Definition: camera.h:81
The Quaternion class represents 3D rotations and orientations.
Definition: quaternion.h:66
The Frame class represents a coordinate system, defined by a position and an orientation.
Definition: frame.h:126
Quaternion spinningQuaternion() const
An interface class for Frame constraints.
Definition: constraint.h:117


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:25