Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ViewerProperties.hh
Go to the documentation of this file.
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 
52 
53 //=============================================================================
54 //
55 // Property storage Class for glWidgets
56 //
57 //=============================================================================
58 
64 //
65 #ifndef VIEWERPROPERTIES_HH
66 #define VIEWERPROPERTIES_HH
67 
68 
69 #include <QObject>
70 #include <QColor>
72 #include <ACG/Math/VectorT.hh>
74 #include <ACG/Scenegraph/DrawModes.hh>
75 #include <ACG/GL/GLState.hh>
76 #include <OpenFlipper/widgets/glWidget/CursorPainter.hh>
77 
78 // forward declaration
79 class ViewObjectMarker;
80 
81 namespace Viewer {
82 
87  enum ActionMode {
93  ExamineMode,
94 
103  PickingMode,
104 
110  QuestionMode,
111 
116  LightMode
117  };
118 
119  class DLLEXPORT ViewerProperties : public QObject {
120 
121  Q_OBJECT
122 
123  public:
124  ViewerProperties(int _id);
125  ~ViewerProperties();
126 
127  //===========================================================================
130  //===========================================================================
131 
132  public:
134  void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode);
135 
138 
139  private:
140 
142 
145  //===========================================================================
148  //===========================================================================
149 
150  public slots:
159  void snapshotBaseFileName(const QString& _fname);
160 
162  void snapshotFileType(const QString& _type);
163 
165  void snapshotCounter(const int _counter);
166 
168  QString snapshotFileType();
169 
171  QString snapshotName();
172 
174  int snapshotCounter();
175 
176  private:
177  QString snapshotName_;
180 
183  //===========================================================================
184  //===========================================================================
187  //===========================================================================
188  //===========================================================================
189 
190 
191  public slots:
193  double wheelZoomFactor();
194 
196  double wheelZoomFactorShift();
197 
199  void wheelZoomFactor(double _factor);
200 
202  void wheelZoomFactorShift(double _factor);
203 
205  bool wheelInvert();
206 
208  void wheelInvert(bool _invert);
209 
210  private:
211  double wZoomFactor_;
212 
214 
215  bool wInvert_;
216 
219  //===========================================================================
220  //===========================================================================
223  //===========================================================================
224  //===========================================================================
225 
228  //===========================================================================
229  //===========================================================================
232  //===========================================================================
233  //===========================================================================
234 
235  public slots:
238  bool isCCWFront();
239 
241  void ccwFront();
243  void cwFront();
244 
245  private:
246  bool CCWFront_;
247 
248 
249  //===========================================================================
250 
251  public slots:
252 
254  ACG::Vec4f backgroundColor();
255 
257  QRgb backgroundColorRgb();
258 
260  QColor backgroundQColor();
261 
264  void backgroundColor( ACG::Vec4f _color );
265 
268  void backgroundColor( QRgb _color );
269 
272  void backgroundColor( QColor _color );
273 
274  private:
276 
277 
278  //===========================================================================
279 
280  public slots:
286  void lockUpdate();
287 
289  void unLockUpdate();
290 
293  bool updateLocked();
294 
295  private:
296  int locked_;
297 
298 
299  //===========================================================================
300 
301  public slots:
303  bool backFaceCulling();
304 
306  void backFaceCulling(bool _state );
307 
308  private:
310 
311  //===========================================================================
312 
313  public slots:
315  void twoSidedLighting(bool _state );
316 
318  bool twoSidedLighting();
319 
320  private:
322 
323  //===========================================================================
324 
325  public slots:
327  void multisampling(bool _state );
328 
330  bool multisampling();
331 
332  private:
334 
335  //===========================================================================
336 
337  public slots:
339  void mipmapping(bool _state );
340 
342  bool mipmapping();
343 
344  private:
346 
347  //===========================================================================
348 
349  public slots:
351  void animation(bool _state );
352 
354  bool animation();
355 
356  private:
358 
359 
360  //===========================================================================
361 
362  public:
364  ACG::GLState& glState();
365  const ACG::GLState& glState() const;
366 
367  void setglState(ACG::GLState* _glState);
368 
369  private:
372 
373  //===========================================================================
374 
375  public slots:
377  void objectMarker (ViewObjectMarker* _marker);
378 
380  ViewObjectMarker* objectMarker();
381 
382  private:
384 
385  //===========================================================================
386 
387  public:
388  int currentViewingDirection();
389 
390  void currentViewingDirection(int _dir);
391 
392  private:
394 
395  //===========================================================================
396 
397  public:
398  bool rotationLocked();
399 
400  void rotationLocked(bool _lock);
401 
402  private:
404 
405  //===========================================================================
406 
409  //===========================================================================
410  //===========================================================================
413  //===========================================================================
414  //===========================================================================
415 
416  public:
417 
419  double orthoWidth();
420 
422  void orthoWidth(double _width);
423 
424 
426  double nearPlane();
427 
429  void setPlanes( double _near, double _far );
430 
432  double farPlane();
433 
435  ACG::Vec3d sceneCenter();
436 
438  void sceneCenter(ACG::Vec3d _center);
439 
440 
442  double sceneRadius();
443 
445  void sceneRadius(double _radius );
446 
447 
449  ACG::Vec3d trackballCenter();
450 
452  void trackballCenter(ACG::Vec3d _center);
453 
454 
456  double trackballRadius();
457 
459  void trackballRadius(double _radius );
460 
461  private:
462 
464  double orthoWidth_;
465 
467  double nearPlane_;
468 
470  double farPlane_;
471 
474 
476  double sceneRadius_;
477 
480 
483 
486  //===========================================================================
487  //===========================================================================
490  //===========================================================================
491  //===========================================================================
492 
493  public:
494 
495  void stereo(bool _stereo);
496  bool stereo();
497 
498  private:
500  bool stereo_;
501 
502 
505  //===========================================================================
506  //===========================================================================
509  //===========================================================================
510  //===========================================================================
511 
512  public:
513  CursorPainter* cursorPainter();
514  void cursorPainter( CursorPainter* _painter );
515 
516  ACG::Vec3d cursorPoint3D();
517  void cursorPoint3D(ACG::Vec3d _pos);
518 
519  bool cursorPositionValid();
520  void cursorPositionValid(bool _valid);
521 
522  private:
523 
524  // Used to draw the current cursor in the scene
526 
527  // position of the cursor picked into the scenegraph
529 
530  // indicates that we successfully mapped the cursor into the scene
532 
535  signals:
536 
540  void updated();
541 
545  void drawModeChanged(int _viewerId );
546 
547  void getPickMode(std::string& _mode );
548  void setPickMode(const std::string& _mode );
549 
550  void getActionMode(Viewer::ActionMode& _am);
551  void setActionMode(const Viewer::ActionMode _am);
552 
553  public:
554 
556  std::string pickMode();
557 
559  void pickMode(const std::string& _name);
560 
562  Viewer::ActionMode actionMode();
563 
565  void actionMode(const Viewer::ActionMode _am);
566 
567  //===========================================================================
568  //===========================================================================
571  //===========================================================================
572  //===========================================================================
573 
575  int viewerId();
576 
578  void viewerId(int _id);
579 
580  private:
581 
584 
587 
590  };
591 
592 }
593 
594 
595 #endif //VIEWERPROPERTIES_HH
596 
bool backFaceCulling_
Pointer to the glState of the Viewer.
ACG::GLState * glState_
Pointer to the glState of the Viewer.
bool mipmapping_
Pointer to the glState of the Viewer.
ACG::Vec3d trackballCenter_
Virtual trackball center (rotation center when using mouse)
QString settingsSection_
String for the Settings storage.
bool twoSidedLighting_
Pointer to the glState of the Viewer.
double wZoomFactorShift_
Zoom factor when using mouse wheel.
bool stereo_
Flag if stereo should be enabled for the current viewer.
CursorPainter * cursorPainter_
Flag if stereo should be enabled for the current viewer.
int locked_
Pointer to the glState of the Viewer.
int currentViewingDirection_
Pointer to the glState of the Viewer.
double sceneRadius_
Radius of the current scene.
bool wInvert_
Zoom factor when using mouse wheel.
double orthoWidth_
Width of the gl scene in orthogonal mode ( defaults to 2.0 )
ACG::Vec4f backgroundColor_
Pointer to the glState of the Viewer.
double wZoomFactor_
Zoom factor when using mouse wheel.
bool animation_
Pointer to the glState of the Viewer.
ACG::SceneGraph::DrawModes::DrawMode currentDrawMode_
set draw mode (No test if this mode is available!)
#define DLLEXPORT
bool CCWFront_
Pointer to the glState of the Viewer.
double farPlane_
distance to far Plane
bool multisampling_
Pointer to the glState of the Viewer.
double trackballRadius_
trackball radius (rotation sphere when using mouse)
double nearPlane_
Distance to near Plane.
bool rotationLocked_
Pointer to the glState of the Viewer.
ViewObjectMarker * objectMarker_
Pointer to the glState of the Viewer.
bool cursorPositionValid_
Flag if stereo should be enabled for the current viewer.
ACG::Vec3d cursorPoint3D_
Flag if stereo should be enabled for the current viewer.
ACG::Vec3d sceneCenter_
Current scene center (rendering center)
int viewerId_
Stores the id of the viewer this property belongs to.