anatomist  5.0.5
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" );
75  Select3DControl( const Select3DControl & c );
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( ) ;
90  FlightControl();
91  FlightControl( const FlightControl & c );
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" );
106  ObliqueControl( const ObliqueControl & c );
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();
120  TransformControl( const TransformControl & c );
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();
135  CutControl();
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() ;
149  WindowActions();
150  WindowActions( const WindowActions & a );
151  virtual ~WindowActions();
152 
153  virtual std::string name() const;
154 
155  void close();
156  void toggleShowTools();
157  void toggleFullScreen();
158  void focusView();
159  void focusAxialView();
160  void focusCoronalView();
161  void focusSagittelView();
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() ;
172  LinkAction();
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 
194  MenuAction();
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 
212  SelectAction();
213  SelectAction( const SelectAction & a );
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 
224  void toggleSelectAll();
225  void removeFromWindow();
226  void removeFromGroup();
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 
238  Zoom3DAction();
239  Zoom3DAction( const Zoom3DAction & a );
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 
272  virtual ~Translate3DAction();
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 );
279  void endTranslateKey();
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 
296  Sync3DAction();
297  Sync3DAction( const Sync3DAction & a );
298  virtual ~Sync3DAction();
299 
300  virtual std::string name() const;
301 
302  void execSync();
303  void execSyncOrientation();
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 
324  MovieAction() ;
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();
334  void increaseSpeed();
335  void decreaseSpeed();
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:
356  SliceAction();
357  virtual ~SliceAction();
358 
359  virtual std::string name() const { return "SliceAction" ; }
360  static Action * creator() ;
361 
362  void nextSlice();
363  void previousSlice();
364  void nextTime();
365  void previousTime();
366  void toggleLinkedOnSlider();
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:
389  virtual ~SortMeshesPolygonsAction();
390 
391  virtual std::string name() const { return "SortMeshesPolygonsAction"; }
392  static Action * creator();
393 
394  void sort();
395  void toggleAutoSort();
396  void toggleSortDirection();
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
virtual std::string name() const
Definition: control3D.h:406
virtual void eventAutoSubscription(ActionPool *actionPool)
3D window, OpenGL rendering
Definition: window3D.h:69
#define slots
virtual std::string name() const
Definition: control3D.h:391
virtual std::string name() const
Definition: control3D.h:359
static Control * creator()
virtual std::string description() const
virtual std::string name() const
Definition: control3D.h:327
Control3D(int priority=100, const std::string &name=QT_TRANSLATE_NOOP("ControlledWindow", "Default 3D control"))
bool isRunning() const
Definition: control3D.h:338
virtual void doAlsoOnDeselect(ActionPool *actionPool)
virtual std::string name() const
Definition: control3D.h:377
virtual void doAlsoOnSelect(ActionPool *)
Definition: control.h:106
const std::string & name() const
Definition: control.h:108