Developer Documentation
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 //=============================================================================
45 //
46 // Property storage Class for glWidgets
47 //
48 //=============================================================================
49 
55 #pragma once
56 
57 #include <QObject>
58 #include <QColor>
60 #include <ACG/Math/VectorT.hh>
62 #include <ACG/Scenegraph/DrawModes.hh>
63 #include <ACG/GL/GLState.hh>
64 #include <OpenFlipper/widgets/glWidget/CursorPainter.hh>
65 
66 // forward declaration
67 class ViewObjectMarker;
68 
69 namespace Viewer {
70 
75  enum ActionMode {
82 
92 
99 
105  };
106 
107  class DLLEXPORT ViewerProperties : public QObject {
108 
109  Q_OBJECT
110 
111  public:
112  explicit ViewerProperties(int _id);
113  ~ViewerProperties();
114 
115  //===========================================================================
118  //===========================================================================
119 
120  public:
122  void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode);
123 
126 
127  private:
128 
130 
133  //===========================================================================
136  //===========================================================================
137 
138  public slots:
147  void snapshotBaseFileName(const QString& _fname);
148 
150  void snapshotFileType(const QString& _type);
151 
153  void snapshotCounter(const int _counter);
154 
156  QString snapshotFileType();
157 
159  QString snapshotName();
160 
162  int snapshotCounter();
163 
164  private:
165  QString snapshotName_;
168 
171  //===========================================================================
172  //===========================================================================
175  //===========================================================================
176  //===========================================================================
177 
178 
179  public slots:
181  double wheelZoomFactor();
182 
184  double wheelZoomFactorShift();
185 
187  void wheelZoomFactor(double _factor);
188 
190  void wheelZoomFactorShift(double _factor);
191 
193  bool wheelInvert();
194 
196  void wheelInvert(bool _invert);
197 
198  private:
199  double wZoomFactor_;
200 
202 
203  bool wInvert_;
204 
207  //===========================================================================
208  //===========================================================================
211  //===========================================================================
212  //===========================================================================
213 
216  //===========================================================================
217  //===========================================================================
220  //===========================================================================
221  //===========================================================================
222 
223  public slots:
226  bool isCCWFront();
227 
229  void ccwFront();
231  void cwFront();
232 
233  private:
234  bool CCWFront_;
235 
236 
237  //===========================================================================
238 
239  public slots:
240 
242  ACG::Vec4f backgroundColor();
243 
245  QRgb backgroundColorRgb();
246 
248  QColor backgroundQColor();
249 
252  void backgroundColor( ACG::Vec4f _color );
253 
256  void backgroundColor( QRgb _color );
257 
260  void backgroundColor( QColor _color );
261 
262  private:
264 
265 
266  //===========================================================================
267 
268  public slots:
274  void lockUpdate();
275 
277  void unLockUpdate();
278 
281  bool updateLocked();
282 
283  private:
284  int locked_;
285 
286 
287  //===========================================================================
288 
289  public slots:
291  bool backFaceCulling();
292 
294  void backFaceCulling(bool _state );
295 
296  private:
298 
299  //===========================================================================
300 
301  public slots:
303  void twoSidedLighting(bool _state );
304 
306  bool twoSidedLighting();
307 
308  private:
310 
311  //===========================================================================
312 
313  public slots:
315  void multisampling(bool _state );
316 
318  bool multisampling();
319 
320  private:
322 
323  //===========================================================================
324 
325  public slots:
327  void mipmapping(bool _state );
328 
330  bool mipmapping();
331 
332  private:
334 
335  //===========================================================================
336 
337  public slots:
339  void animation(bool _state );
340 
342  bool animation();
343 
344  private:
346 
347 
348  //===========================================================================
349 
350  public:
352  ACG::GLState& glState();
353  const ACG::GLState& glState() const;
354 
355  void setglState(ACG::GLState* _glState);
356 
357  private:
360 
361  //===========================================================================
362 
363  public slots:
365  void objectMarker (ViewObjectMarker* _marker);
366 
368  ViewObjectMarker* objectMarker();
369 
370  private:
372 
373  //===========================================================================
374 
375  public:
376  int currentViewingDirection();
377 
378  void currentViewingDirection(int _dir);
379 
380  private:
382 
383  //===========================================================================
384 
385  public:
386  bool rotationLocked();
387 
388  void rotationLocked(bool _lock);
389 
390  private:
392 
393  //===========================================================================
394 
397  //===========================================================================
398  //===========================================================================
401  //===========================================================================
402  //===========================================================================
403 
404  public:
405 
407  double orthoWidth();
408 
410  void orthoWidth(double _width);
411 
412 
414  double nearPlane();
415 
417  void setPlanes( double _near, double _far );
418 
420  double farPlane();
421 
423  ACG::Vec3d sceneCenter();
424 
426  void sceneCenter(ACG::Vec3d _center);
427 
428 
430  double sceneRadius();
431 
433  void sceneRadius(double _radius );
434 
435 
437  ACG::Vec3d trackballCenter();
438 
440  void trackballCenter(ACG::Vec3d _center);
441 
442 
444  double trackballRadius();
445 
447  void trackballRadius(double _radius );
448 
449  private:
450 
452  double orthoWidth_;
453 
455  double nearPlane_;
456 
458  double farPlane_;
459 
462 
464  double sceneRadius_;
465 
468 
471 
474  //===========================================================================
475  //===========================================================================
478  //===========================================================================
479  //===========================================================================
480 
481  public:
482 
483  void stereo(bool _stereo);
484  bool stereo();
485 
486  private:
488  bool stereo_;
489 
490 
493  //===========================================================================
494  //===========================================================================
497  //===========================================================================
498  //===========================================================================
499 
500  public:
501  CursorPainter* cursorPainter();
502  void cursorPainter( CursorPainter* _painter );
503 
504  ACG::Vec3d cursorPoint3D();
505  void cursorPoint3D(ACG::Vec3d _pos);
506 
507  bool cursorPositionValid();
508  void cursorPositionValid(bool _valid);
509 
510  private:
511 
512  // Used to draw the current cursor in the scene
514 
515  // position of the cursor picked into the scenegraph
517 
518  // indicates that we successfully mapped the cursor into the scene
520 
523  signals:
524 
528  void updated();
529 
533  void drawModeChanged(int _viewerId );
534 
535  void getPickMode(std::string& _mode );
536  void setPickMode(const std::string& _mode );
537 
538  void getActionMode(Viewer::ActionMode& _am);
539  void setActionMode(const Viewer::ActionMode _am);
540 
541  public:
542 
544  std::string pickMode();
545 
547  void pickMode(const std::string& _name);
548 
550  Viewer::ActionMode actionMode();
551 
553  void actionMode(const Viewer::ActionMode _am);
554 
555  //===========================================================================
556  //===========================================================================
559  //===========================================================================
560  //===========================================================================
561 
563  int viewerId();
564 
566  void viewerId(int _id);
567 
568  private:
569 
572 
575 
578  };
579 
580 }
581 
582 
583 
double wZoomFactor_
Zoom factor when using mouse wheel.
double nearPlane_
Distance to near Plane.
QString settingsSection_
String for the Settings storage.
int currentViewingDirection_
Pointer to the glState of the Viewer.
bool multisampling_
Pointer to the glState of the Viewer.
ACG::Vec3d trackballCenter_
Virtual trackball center (rotation center when using mouse)
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.
ViewObjectMarker * objectMarker_
Pointer to the glState of the Viewer.
bool mipmapping_
Pointer to the glState of the Viewer.
ACG::GLState * glState_
Pointer to the glState of the Viewer.
ACG::SceneGraph::DrawModes::DrawMode currentDrawMode_
set draw mode (No test if this mode is available!)
bool CCWFront_
Pointer to the glState of the Viewer.
ActionMode
Enum listing action modes of the viewers.
ACG::Vec3d cursorPoint3D_
Flag if stereo should be enabled for the current viewer.
int locked_
Pointer to the glState of the Viewer.
double trackballRadius_
trackball radius (rotation sphere when using mouse)
CursorPainter * cursorPainter_
Flag if stereo should be enabled for the current viewer.
ACG::Vec3d sceneCenter_
Current scene center (rendering center)
bool backFaceCulling_
Pointer to the glState of the Viewer.
bool rotationLocked_
Pointer to the glState of the Viewer.
bool animation_
Pointer to the glState of the Viewer.
double sceneRadius_
Radius of the current scene.
int viewerId_
Stores the id of the viewer this property belongs to.
Examine or Move mode.
ACG::Vec4f backgroundColor_
Pointer to the glState of the Viewer.
#define DLLEXPORT
bool wInvert_
Zoom factor when using mouse wheel.
bool cursorPositionValid_
Flag if stereo should be enabled for the current viewer.
double farPlane_
distance to far Plane
double orthoWidth_
Width of the gl scene in orthogonal mode ( defaults to 2.0 )