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
68
69namespace Viewer {
70
82
92
99
105 };
106
107 class DLLEXPORT ViewerProperties : public QObject {
108
109 Q_OBJECT
110
111 public:
112 explicit ViewerProperties(int _id);
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:
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:
200
202
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:
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:
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
450 float getDevicePixelRatio() const;
451
453 void setDevicePixelRatio(float dpr);
454
456 QPoint adjustForDevicePixelRatio(QPoint const & point) const;
457
458 QPointF adjustForDevicePixelRatio(QPointF const & point) const;
459
460 private:
461
464
467
469 double farPlane_;
470
473
476
479
482
484 float device_pixel_ratio_ = 1.f;
485
486
489 //===========================================================================
490 //===========================================================================
493 //===========================================================================
494 //===========================================================================
495
496 public:
497
498 void stereo(bool _stereo);
499 bool stereo();
500
501 private:
504
505
508 //===========================================================================
509 //===========================================================================
512 //===========================================================================
513 //===========================================================================
514
515 public:
516 CursorPainter* cursorPainter();
517 void cursorPainter( CursorPainter* _painter );
518
519 ACG::Vec3d cursorPoint3D();
520 void cursorPoint3D(ACG::Vec3d _pos);
521
522 bool cursorPositionValid();
523 void cursorPositionValid(bool _valid);
524
525 private:
526
527 // Used to draw the current cursor in the scene
529
530 // position of the cursor picked into the scenegraph
532
533 // indicates that we successfully mapped the cursor into the scene
535
538 signals:
539
543 void updated();
544
548 void drawModeChanged(int _viewerId );
549
550 void getPickMode(std::string& _mode );
551 void setPickMode(const std::string& _mode );
552
553 void getActionMode(Viewer::ActionMode& _am);
554 void setActionMode(const Viewer::ActionMode _am);
555
556 public:
557
559 std::string pickMode();
560
562 void pickMode(const std::string& _name);
563
565 Viewer::ActionMode actionMode();
566
568 void actionMode(const Viewer::ActionMode _am);
569
570 //===========================================================================
571 //===========================================================================
574 //===========================================================================
575 //===========================================================================
576
578 int viewerId();
579
581 void viewerId(int _id);
582
583 private:
584
587
590
593 };
594
595}
596
597
598
#define DLLEXPORT
ActionMode
Enum listing action modes of the viewers.
@ ExamineMode
Examine or Move mode.
@ QuestionMode
Question Mode.
@ PickingMode
Picking Mode.
@ LightMode
Light mode.
ACG::Vec4f backgroundColor_
Pointer to the glState of the Viewer.
void updated()
This signal is emitted when the configuration has been changed.
bool twoSidedLighting_
Pointer to the glState of the Viewer.
bool wInvert_
Zoom factor when using mouse wheel.
bool CCWFront_
Pointer to the glState of the Viewer.
bool cursorPositionValid_
Flag if stereo should be enabled for the current viewer.
int viewerId_
Stores the id of the viewer this property belongs to.
ACG::SceneGraph::DrawModes::DrawMode currentDrawMode_
set draw mode (No test if this mode is available!)
bool multisampling_
Pointer to the glState of the Viewer.
bool animation_
Pointer to the glState of the Viewer.
ACG::GLState * glState_
Pointer to the glState of the Viewer.
bool stereo_
Flag if stereo should be enabled for the current viewer.
double orthoWidth_
Width of the gl scene in orthogonal mode ( defaults to 2.0 )
bool backFaceCulling_
Pointer to the glState of the Viewer.
double wZoomFactor_
Zoom factor when using mouse wheel.
bool rotationLocked_
Pointer to the glState of the Viewer.
double trackballRadius_
trackball radius (rotation sphere when using mouse)
double sceneRadius_
Radius of the current scene.
void drawModeChanged(int _viewerId)
This signal is emitted when the drawmode changed.
ViewObjectMarker * objectMarker_
Pointer to the glState of the Viewer.
double farPlane_
distance to far Plane
QString settingsSection_
String for the Settings storage.
double nearPlane_
Distance to near Plane.
double wZoomFactorShift_
Zoom factor when using mouse wheel.
int locked_
Pointer to the glState of the Viewer.
int currentViewingDirection_
Pointer to the glState of the Viewer.
ACG::Vec3d sceneCenter_
Current scene center (rendering center)
ACG::Vec3d trackballCenter_
Virtual trackball center (rotation center when using mouse)
ACG::Vec3d cursorPoint3D_
Flag if stereo should be enabled for the current viewer.
bool mipmapping_
Pointer to the glState of the Viewer.
CursorPainter * cursorPainter_
Flag if stereo should be enabled for the current viewer.