anatomist 6.0.4
3D neuroimaging data viewer
trackball.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34
35#ifndef ANATOMIST_WINDOW3D_TRACKBALL_H
36#define ANATOMIST_WINDOW3D_TRACKBALL_H
37
38
40#include <aims/resampling/quaternion.h>
41#include <qobject.h>
42
43namespace aims
44{
45 class Quaternion;
46}
47
48
49namespace anatomist
50{
51
52 class Trackball : public Action
53 {
54 public:
55 static Action * creator() ;
56
58 Trackball( const Trackball & a );
59 virtual ~Trackball();
60
61 virtual std::string name() const;
62 QWidget* actionView( QWidget* );
63 bool viewableAction() const;
64
65 virtual void beginTrackball( int x, int y, int globalX, int globalY );
66 virtual void moveTrackball( int x, int y, int globalX, int globalY );
69 virtual bool moveTrackballInternal( int x, int y );
70 virtual void endTrackball( int x, int y, int globalX, int globalY );
71 void setCenter();
73 virtual aims::Quaternion rotation( int x, int y );
74
75 protected:
76 static aims::Quaternion initQuaternion( float x1, float y1, float x2,
77 float y2 );
78 static float tbProj2Sphere( float r, float x, float y );
79
83 };
84
85
86 class ContinuousTrackball : public QObject, public Trackball
87 {
88 Q_OBJECT
89
90 public:
91 static Action * creator() ;
92
96
97 virtual std::string name() const;
98
99 virtual void beginTrackball( int x, int y, int globalX, int globalY );
100 virtual void moveTrackball( int x, int y, int globalX, int globalY );
101 void endTrackball( int x, int y, int globalX, int globalY );
103 void stop();
104
105 public slots:
106 void goOn();
107
108 private:
109 struct Private;
110 Private *d;
111 };
112
113
114 class KeyFlightAction : public Action
115 {
116 public:
117 static Action* creator() ;
118
122
123 virtual std::string name() const;
124 QWidget* actionView( QWidget* );
125 bool viewableAction() const;
126
127 void up();
128 void down();
129 void left();
130 void right();
131 void spinLeft();
132 void spinRight();
133 void boost();
134 void brake();
135 void release();
136 void stop();
137 void runStep();
138 void reverse();
139
142
143 private:
144 float _angle;
145 float _speed;
146 bool _angleChanged;
147 bool _auto;
148 static float _maxAngle;
149 static float _maxSpeed;
150 };
151
152}
153
154
155#endif
#define slots
virtual std::string name() const
virtual void beginTrackball(int x, int y, int globalX, int globalY)
ContinuousTrackball(const ContinuousTrackball &a)
virtual void moveTrackball(int x, int y, int globalX, int globalY)
void endTrackball(int x, int y, int globalX, int globalY)
KeyFlightAction(const KeyFlightAction &a)
virtual std::string name() const
QWidget * actionView(QWidget *)
static Action * creator()
virtual void endTrackball(int x, int y, int globalX, int globalY)
QWidget * actionView(QWidget *)
static Action * creator()
Trackball(const Trackball &a)
aims::Quaternion _beginquat
Definition trackball.h:82
static float tbProj2Sphere(float r, float x, float y)
virtual void moveTrackball(int x, int y, int globalX, int globalY)
virtual std::string name() const
static aims::Quaternion initQuaternion(float x1, float y1, float x2, float y2)
bool viewableAction() const
virtual bool moveTrackballInternal(int x, int y)
Performs trackball calculations, but doesn't update view.
virtual aims::Quaternion rotation(int x, int y)
virtual void beginTrackball(int x, int y, int globalX, int globalY)