anatomist  5.1.2
3D neuroimaging data viewer
control3D.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_CONTROL3D_H
36 #define ANATOMIST_WINDOW3D_CONTROL3D_H
37 
38 
41 #include <qglobal.h>
42 
43 class AWindow3D;
44 class PinchGesture;
45 
46 namespace anatomist
47 {
48 
49  class Control3D : public Control
50  {
51  public:
52  static Control * creator( ) ;
53 
54  Control3D( int priority = 100,
55  const std::string & name = QT_TRANSLATE_NOOP( "ControlledWindow",
56  "Default 3D control" ) );
57  Control3D( const Control3D & c );
58  virtual ~Control3D();
59 
60  virtual std::string description() const;
61 
62  virtual void eventAutoSubscription( ActionPool * actionPool );
63  virtual void doAlsoOnDeselect( ActionPool * actionPool );
64 
65  protected:
66 
67  private:
68  };
69 
70  class Select3DControl : public Control
71  {
72  public:
73  static Control * creator( ) ;
74  Select3DControl( const std::string & name = "Selection 3D" );
76  virtual ~Select3DControl();
77 
78  virtual std::string description() const;
79 
80  virtual void eventAutoSubscription( ActionPool * actionPool );
81  virtual void doAlsoOnSelect( ActionPool * actionPool );
82  virtual void doAlsoOnDeselect( ActionPool * actionPool );
83  };
84 
85 
86  class FlightControl : public Control
87  {
88  public:
89  static Control * creator( ) ;
92  virtual ~FlightControl();
93 
94  virtual std::string description() const;
95 
96  virtual void eventAutoSubscription( ActionPool * actionPool );
97  virtual void doAlsoOnDeselect( ActionPool * actionPool );
98  };
99 
100 
101  class ObliqueControl : public Control
102  {
103  public:
104  static Control * creator();
105  ObliqueControl( const std::string & name = "ObliqueControl" );
107  virtual ~ObliqueControl();
108 
109  virtual std::string description() const;
110 
111  virtual void eventAutoSubscription( ActionPool * actionPool );
112  };
113 
114 
115  class TransformControl : public Control
116  {
117  public:
118  static Control * creator();
121  virtual ~TransformControl();
122 
123  virtual std::string description() const;
124 
125  virtual void eventAutoSubscription( ActionPool * actionPool );
126  virtual void doAlsoOnSelect( ActionPool * actionPool );
127  virtual void doAlsoOnDeselect( ActionPool * actionPool );
128  };
129 
130 
131  class CutControl : public Control
132  {
133  public:
134  static Control * creator();
136  CutControl( const CutControl & c );
137  virtual ~CutControl();
138 
139  virtual std::string description() const;
140 
141  virtual void eventAutoSubscription( ActionPool * actionPool );
142  };
143 
144 
145  class WindowActions : public Action
146  {
147  public:
148  static Action * creator() ;
151  virtual ~WindowActions();
152 
153  virtual std::string name() const;
154 
155  void close();
158  void focusView();
162 
163  QWidget* actionView( QWidget* parent );
164  bool viewableAction() const;
165  };
166 
167 
168  class LinkAction : public Action
169  {
170  public:
171  static Action * creator() ;
173  LinkAction( const LinkAction & a );
174  virtual ~LinkAction();
175 
176  virtual std::string name() const;
177 
178  void execLink( int x, int y, int globalX, int globalY );
179  void endLink( int x, int y, int globalX, int globalY );
180 
181  QWidget* actionView( QWidget* parent );
182  bool viewableAction() const;
183 
184  protected:
185  private:
186  };
187 
188 
189  class MenuAction : public Action
190  {
191  public:
192  static Action * creator() ;
193 
195  MenuAction( const MenuAction & a );
196  virtual ~MenuAction();
197 
198  virtual std::string name() const;
199 
200  void execMenu( int x, int y, int globalX, int globalY );
201 
202  QWidget* actionView( QWidget* parent );
203  bool viewableAction() const;
204  };
205 
206 
207  class SelectAction : public Action
208  {
209  public:
210  static Action * creator() ;
211 
214  virtual ~SelectAction();
215 
216  virtual std::string name() const;
217 
218  void select( int modifier, int x, int y );
219  void execSelect( int x, int y, int globalX, int globalY );
220  void execSelectAdding( int x, int y, int globalX, int globalY );
221  void execSelectToggling( int x, int y, int globalX, int globalY );
222 
227 
228  QWidget* actionView( QWidget* parent );
229  bool viewableAction() const;
230  };
231 
232 
233  class Zoom3DAction : public Action
234  {
235  public:
236  static Action * creator() ;
237 
240  virtual ~Zoom3DAction();
241 
242  virtual std::string name() const;
243 
244  void beginZoom( int x, int y, int globalX, int globalY );
245  void moveZoom( int x, int y, int globalX, int globalY );
246  void endZoom( int x, int y, int globalX, int globalY );
247  void endZoomKey();
249  void zoomInOnce();
251  void zoomOutOnce();
253  void zoomWheel( int, int, int, int, int );
254  void zoom( int distance );
255 
256  QWidget* actionView( QWidget* parent );
257  bool viewableAction() const;
258 
259  private:
260  int _beginpos;
261  float _orgzoom;
262  };
263 
264 
265  class Translate3DAction : public Action
266  {
267  public:
268  static Action * creator() ;
269 
273 
274  virtual std::string name() const;
275 
276  void beginTranslate( int x, int y, int globalX, int globalY );
277  void moveTranslate( int x, int y, int globalX, int globalY );
278  void endTranslate( int x, int y, int globalX, int globalY );
280 
281  QWidget* actionView( QWidget* parent );
282  bool viewableAction() const;
283 
284  private:
285  bool _started;
286  int _beginx;
287  int _beginy;
288  };
289 
290 
291  class Sync3DAction : public Action
292  {
293  public:
294  static Action * creator() ;
295 
298  virtual ~Sync3DAction();
299 
300  virtual std::string name() const;
301 
302  void execSync();
304 
305  QWidget* actionView( QWidget* parent );
306  bool viewableAction() const;
307  };
308 
309 
310  class MovieAction : public QObject, public Action
311  {
312  Q_OBJECT
313 
314  public:
315  enum RunMode
316  {
322  };
323 
325  virtual ~MovieAction() ;
326 
327  virtual std::string name() const { return "MovieAction" ; }
328 
329  static Action * creator() ;
330 
331  void sliceOn() ;
332  void timeOn() ;
333  void nextMode();
336 
337  void startOrStop() ;
338  bool isRunning() const { return myIsRunning; }
339 
340  private slots:
341  void timeout() ;
342 
343  private:
344  bool mySliceAndNotTime;
345  bool myIsRunning;
346  RunMode myRunMode;
347  bool myForward;
348  QTimer * myTimer;
349  int myTimeInterval;
350  } ;
351 
352 
353  class SliceAction : public Action
354  {
355  public:
357  virtual ~SliceAction();
358 
359  virtual std::string name() const { return "SliceAction" ; }
360  static Action * creator() ;
361 
362  void nextSlice();
364  void nextTime();
365  void previousTime();
367  void invertSlice();
368  };
369 
370 
371  class DragObjectAction : public Action
372  {
373  public:
375  virtual ~DragObjectAction();
376 
377  virtual std::string name() const { return "DragObjectAction" ; }
378  static Action * creator() ;
379 
380  void dragAll( int x, int y, int globalX, int globalY );
381  void dragSelected( int x, int y, int globalX, int globalY );
382  };
383 
384 
386  {
387  public:
390 
391  virtual std::string name() const { return "SortMeshesPolygonsAction"; }
392  static Action * creator();
393 
394  void sort();
397  };
398 
399 
400  class ObjectStatAction : public Action
401  {
402  public:
404  virtual ~ObjectStatAction();
405 
406  virtual std::string name() const { return "ObjectStatAction"; }
407  static Action * creator();
408 
409  void displayStat();
410  };
411 
412 
413 #if QT_VERSION >= 0x040600
414  class PinchZoomAction : public Action
415  {
416  public:
417  PinchZoomAction();
418  virtual ~PinchZoomAction();
419 
420  virtual std::string name() const { return "PinchZoomAction"; }
421  static Action* creator();
422 
423  void pinchStart( QPinchGesture *gesture );
424  void pinchMove( QPinchGesture *gesture );
425  void pinchStop( QPinchGesture *gesture );
426 
427  private:
428  struct Private;
429  Private *d;
430  };
431 #endif
432 
433 }
434 
435 
436 #endif
#define slots
3D window, OpenGL rendering
Definition: window3D.h:74
static Control * creator()
virtual void eventAutoSubscription(ActionPool *actionPool)
virtual std::string description() const
Control3D(const Control3D &c)
virtual void doAlsoOnDeselect(ActionPool *actionPool)
Control3D(int priority=100, const std::string &name=QT_TRANSLATE_NOOP("ControlledWindow", "Default 3D control"))
const std::string & name() const
Definition: control.h:108
static Control * creator()
virtual void eventAutoSubscription(ActionPool *actionPool)
virtual std::string description() const
CutControl(const CutControl &c)
static Action * creator()
virtual std::string name() const
Definition: control3D.h:377
void dragSelected(int x, int y, int globalX, int globalY)
void dragAll(int x, int y, int globalX, int globalY)
virtual void doAlsoOnDeselect(ActionPool *actionPool)
virtual std::string description() const
static Control * creator()
virtual void eventAutoSubscription(ActionPool *actionPool)
FlightControl(const FlightControl &c)
QWidget * actionView(QWidget *parent)
void execLink(int x, int y, int globalX, int globalY)
bool viewableAction() const
void endLink(int x, int y, int globalX, int globalY)
static Action * creator()
LinkAction(const LinkAction &a)
virtual std::string name() const
virtual std::string name() const
static Action * creator()
MenuAction(const MenuAction &a)
bool viewableAction() const
QWidget * actionView(QWidget *parent)
void execMenu(int x, int y, int globalX, int globalY)
static Action * creator()
bool isRunning() const
Definition: control3D.h:338
virtual std::string name() const
Definition: control3D.h:327
virtual std::string name() const
Definition: control3D.h:406
static Action * creator()
ObliqueControl(const std::string &name="ObliqueControl")
ObliqueControl(const ObliqueControl &c)
static Control * creator()
virtual std::string description() const
virtual void eventAutoSubscription(ActionPool *actionPool)
static Control * creator()
virtual void eventAutoSubscription(ActionPool *actionPool)
Select3DControl(const std::string &name="Selection 3D")
virtual std::string description() const
virtual void doAlsoOnSelect(ActionPool *actionPool)
virtual void doAlsoOnDeselect(ActionPool *actionPool)
Select3DControl(const Select3DControl &c)
void toggleSelectAll()
key action for select all / unselect all objects
bool viewableAction() const
void execSelectToggling(int x, int y, int globalX, int globalY)
void select(int modifier, int x, int y)
static Action * creator()
QWidget * actionView(QWidget *parent)
virtual std::string name() const
void execSelect(int x, int y, int globalX, int globalY)
void execSelectAdding(int x, int y, int globalX, int globalY)
SelectAction(const SelectAction &a)
static Action * creator()
virtual std::string name() const
Definition: control3D.h:359
virtual std::string name() const
Definition: control3D.h:391
Sync3DAction(const Sync3DAction &a)
static Action * creator()
virtual std::string name() const
bool viewableAction() const
QWidget * actionView(QWidget *parent)
virtual void eventAutoSubscription(ActionPool *actionPool)
virtual void doAlsoOnDeselect(ActionPool *actionPool)
virtual void doAlsoOnSelect(ActionPool *actionPool)
TransformControl(const TransformControl &c)
virtual std::string description() const
static Control * creator()
void beginTranslate(int x, int y, int globalX, int globalY)
static Action * creator()
void endTranslate(int x, int y, int globalX, int globalY)
virtual std::string name() const
Translate3DAction(const Translate3DAction &a)
QWidget * actionView(QWidget *parent)
void moveTranslate(int x, int y, int globalX, int globalY)
QWidget * actionView(QWidget *parent)
static Action * creator()
bool viewableAction() const
WindowActions(const WindowActions &a)
virtual std::string name() const
void zoomOutOnce()
zomms a fixed amount (ie 10%) on a key event
virtual std::string name() const
void zoomWheel(int, int, int, int, int)
zoom for a wheel event
Zoom3DAction(const Zoom3DAction &a)
QWidget * actionView(QWidget *parent)
static Action * creator()
void endZoom(int x, int y, int globalX, int globalY)
void zoom(int distance)
void zoomInOnce()
zomms a fixed amount (ie 10%) on a key event
void beginZoom(int x, int y, int globalX, int globalY)
bool viewableAction() const
void moveZoom(int x, int y, int globalX, int globalY)