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>
59 #include <OpenFlipper/common/GlobalDefines.hh>
60 #include <ACG/Math/VectorT.hh>
61 #include <ACG/Scenegraph/SceneGraph.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 {
81 ExamineMode,
82
91 PickingMode,
92
98 QuestionMode,
99
104 LightMode
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
125 ACG::SceneGraph::DrawModes::DrawMode drawMode();
126
127 private:
128
129 ACG::SceneGraph::DrawModes::DrawMode currentDrawMode_;
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_;
166 QString snapshotFileType_;
167 int snapshotCounter_;
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
201 double wZoomFactorShift_;
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:
263 ACG::Vec4f backgroundColor_;
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:
297 bool backFaceCulling_;
298
299 //===========================================================================
300
301 public slots:
303 void twoSidedLighting(bool _state );
304
306 bool twoSidedLighting();
307
308 private:
309 bool twoSidedLighting_;
310
311 //===========================================================================
312
313 public slots:
315 void multisampling(bool _state );
316
318 bool multisampling();
319
320 private:
321 bool multisampling_;
322
323 //===========================================================================
324
325 public slots:
327 void mipmapping(bool _state );
328
330 bool mipmapping();
331
332 private:
333 bool mipmapping_;
334
335 //===========================================================================
336
337 public slots:
339 void animation(bool _state );
340
342 bool animation();
343
344 private:
345 bool animation_;
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:
359 ACG::GLState* glState_;
360
361 //===========================================================================
362
363 public slots:
365 void objectMarker (ViewObjectMarker* _marker);
366
368 ViewObjectMarker* objectMarker();
369
370 private:
371 ViewObjectMarker *objectMarker_;
372
373 //===========================================================================
374
375 public:
376 int currentViewingDirection();
377
378 void currentViewingDirection(int _dir);
379
380 private:
381 int currentViewingDirection_;
382
383 //===========================================================================
384
385 public:
386 bool rotationLocked();
387
388 void rotationLocked(bool _lock);
389
390 private:
391 bool rotationLocked_;
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
461 ACG::Vec3d sceneCenter_;
462
464 double sceneRadius_;
465
467 ACG::Vec3d trackballCenter_;
468
470 double trackballRadius_;
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
513 CursorPainter *cursorPainter_;
514
515 // position of the cursor picked into the scenegraph
516 ACG::Vec3d cursorPoint3D_;
517
518 // indicates that we successfully mapped the cursor into the scene
519 bool cursorPositionValid_;
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
571 int viewerId_;
572
574 QString settingsSection_;
575
578 };
579
580 }
581
582
583
Viewer::ViewerProperties::wZoomFactor_
double wZoomFactor_
Zoom factor when using mouse wheel.
Definition: ViewerProperties.hh:199
Viewer::ViewerProperties::nearPlane_
double nearPlane_
Distance to near Plane.
Definition: ViewerProperties.hh:455
Viewer::ViewerProperties::settingsSection_
QString settingsSection_
String for the Settings storage.
Definition: ViewerProperties.hh:574
Viewer::ViewerProperties::currentViewingDirection_
int currentViewingDirection_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:381
Viewer::ViewerProperties::multisampling_
bool multisampling_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:321
Viewer::ViewerProperties::trackballCenter_
ACG::Vec3d trackballCenter_
Virtual trackball center (rotation center when using mouse)
Definition: ViewerProperties.hh:467
CursorPainter
Definition: CursorPainter.hh:68
GlobalDefines.hh
Viewer::ViewerProperties::twoSidedLighting_
bool twoSidedLighting_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:309
Viewer::ViewerProperties::wZoomFactorShift_
double wZoomFactorShift_
Zoom factor when using mouse wheel.
Definition: ViewerProperties.hh:201
Viewer::ViewerProperties::stereo_
bool stereo_
Flag if stereo should be enabled for the current viewer.
Definition: ViewerProperties.hh:488
Viewer::ViewerProperties::objectMarker_
ViewObjectMarker * objectMarker_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:371
Viewer::ViewerProperties::snapshotName_
QString snapshotName_
Definition: ViewerProperties.hh:165
Viewer::ViewerProperties
Definition: ViewerProperties.hh:107
Viewer::ViewerProperties::mipmapping_
bool mipmapping_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:333
Viewer::ViewerProperties::glState_
ACG::GLState * glState_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:359
Viewer
Definition: ViewerProperties.cc:51
Viewer::ViewerProperties::currentDrawMode_
ACG::SceneGraph::DrawModes::DrawMode currentDrawMode_
set draw mode (No test if this mode is available!)
Definition: ViewerProperties.hh:129
Viewer::LightMode
Light mode.
Definition: ViewerProperties.hh:104
Viewer::ViewerProperties::CCWFront_
bool CCWFront_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:234
Viewer::ActionMode
ActionMode
Enum listing action modes of the viewers.
Definition: ViewerProperties.hh:75
ACG::GLState
Definition: GLState.hh:213
Viewer::ViewerProperties::cursorPoint3D_
ACG::Vec3d cursorPoint3D_
Flag if stereo should be enabled for the current viewer.
Definition: ViewerProperties.hh:516
Viewer::ViewerProperties::locked_
int locked_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:284
Viewer::ViewerProperties::trackballRadius_
double trackballRadius_
trackball radius (rotation sphere when using mouse)
Definition: ViewerProperties.hh:470
Viewer::ViewerProperties::cursorPainter_
CursorPainter * cursorPainter_
Flag if stereo should be enabled for the current viewer.
Definition: ViewerProperties.hh:513
Viewer::ViewerProperties::sceneCenter_
ACG::Vec3d sceneCenter_
Current scene center (rendering center)
Definition: ViewerProperties.hh:461
Viewer::ViewerProperties::backFaceCulling_
bool backFaceCulling_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:297
Viewer::ViewerProperties::rotationLocked_
bool rotationLocked_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:391
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:288
Viewer::ViewerProperties::animation_
bool animation_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:345
Viewer::ViewerProperties::snapshotCounter_
int snapshotCounter_
Definition: ViewerProperties.hh:167
ViewObjectMarker
Definition: ViewObjectMarker.hh:82
Viewer::ViewerProperties::sceneRadius_
double sceneRadius_
Radius of the current scene.
Definition: ViewerProperties.hh:464
OpenMesh::VectorT
Definition: Vector11T.hh:83
Viewer::PickingMode
Picking Mode.
Definition: ViewerProperties.hh:91
Viewer::QuestionMode
Question Mode.
Definition: ViewerProperties.hh:98
Viewer::ViewerProperties::viewerId_
int viewerId_
Stores the id of the viewer this property belongs to.
Definition: ViewerProperties.hh:571
Viewer::ExamineMode
Examine or Move mode.
Definition: ViewerProperties.hh:81
Viewer::ViewerProperties::backgroundColor_
ACG::Vec4f backgroundColor_
Pointer to the glState of the Viewer.
Definition: ViewerProperties.hh:263
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:95
Viewer::ViewerProperties::wInvert_
bool wInvert_
Zoom factor when using mouse wheel.
Definition: ViewerProperties.hh:203
Viewer::ViewerProperties::cursorPositionValid_
bool cursorPositionValid_
Flag if stereo should be enabled for the current viewer.
Definition: ViewerProperties.hh:519
Viewer::ViewerProperties::snapshotFileType_
QString snapshotFileType_
Definition: ViewerProperties.hh:166
Viewer::ViewerProperties::farPlane_
double farPlane_
distance to far Plane
Definition: ViewerProperties.hh:458
SceneGraph.hh
Viewer::ViewerProperties::orthoWidth_
double orthoWidth_
Width of the gl scene in orthogonal mode ( defaults to 2.0 )
Definition: ViewerProperties.hh:452