ViewerProperties.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00057
00058 #ifndef VIEWERPROPERTIES_HH
00059 #define VIEWERPROPERTIES_HH
00060
00061
00062 #include <QObject>
00063 #include <QColor>
00064 #include <OpenFlipper/common/GlobalDefines.hh>
00065 #include <ACG/Math/VectorT.hh>
00066 #include <ACG/Scenegraph/SceneGraph.hh>
00067 #include <ACG/Scenegraph/DrawModes.hh>
00068 #include <ACG/GL/GLState.hh>
00069
00070
00071 class ViewObjectMarker;
00072
00073 namespace Viewer {
00074
00076 enum ActionMode {
00077
00078 ExamineMode,
00082 PickingMode,
00083
00084 QuestionMode,
00085
00086 LightMode
00087 };
00088
00089 class DLLEXPORT ViewerProperties : public QObject {
00090
00091 Q_OBJECT
00092
00093 public:
00094 ViewerProperties();
00095 ~ViewerProperties();
00096
00097
00100
00101
00102 public:
00104 void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode) { currentDrawMode_ = _mode; emit updated(); };
00105
00107 ACG::SceneGraph::DrawModes::DrawMode drawMode() { return currentDrawMode_; };
00108
00109 private:
00110
00111 ACG::SceneGraph::DrawModes::DrawMode currentDrawMode_;
00112
00115
00118
00119
00120 public slots:
00132 void snapshotBaseFileName(const QString& _fname);
00133
00135 QString snapshotName() { return snapshotName_; };
00136
00138 int snapshotCounter() { return snapshotCounter_++; };
00139
00140 private:
00141 QString snapshotName_;
00142 int snapshotCounter_;
00143
00146
00147
00150
00151
00152
00153
00154 public slots:
00156 double wheelZoomFactor() { return wZoomFactor_; };
00157
00159 double wheelZoomFactorShift() { return wZoomFactorShift_; };
00160
00162 void wheelZoomFactor(double _factor) { wZoomFactor_ = _factor; };
00163
00165 void wheelZoomFactorShift(double _factor) { wZoomFactorShift_ = _factor; };
00166
00167 private:
00168 double wZoomFactor_;
00169
00170 double wZoomFactorShift_;
00171
00174
00175
00178
00179
00180
00183
00184
00187
00188
00189
00190 public slots:
00193 bool isCCWFront(){ return CCWFront_; };
00194
00196 void ccwFront() { CCWFront_ = true; emit updated(); };
00198 void cwFront() { CCWFront_ = false; emit updated(); };
00199
00200 private:
00201 bool CCWFront_;
00202
00203
00204
00205
00206 public slots:
00207
00209 ACG::Vec4f backgroundColor() { return backgroundColor_; }
00210
00212 QRgb backgroundColorRgb(){ QColor c;
00213 c.setRedF( backgroundColor_[0]);
00214 c.setGreenF(backgroundColor_[1]);
00215 c.setBlueF( backgroundColor_[2]);
00216 c.setAlphaF(backgroundColor_[3]);
00217 return c.rgba(); };
00218
00221 void backgroundColor( ACG::Vec4f _color ) { backgroundColor_ = _color; emit updated(); };
00222
00225 void backgroundColor( QRgb _color ) { QColor c(_color);
00226 backgroundColor_[0] = c.redF();
00227 backgroundColor_[1] = c.greenF();
00228 backgroundColor_[2] = c.blueF();
00229 backgroundColor_[3] = c.alphaF();
00230 emit updated(); };
00231
00232 private:
00233 ACG::Vec4f backgroundColor_;
00234
00235
00236
00237 public slots:
00238
00240 bool renderPicking() { return renderPicking_; };
00241
00243 ACG::SceneGraph::PickTarget renderPickingMode() { return pickRendererMode_; };
00244
00245 void renderPickin(bool _mode ) { renderPicking_ = _mode; emit updated(); };
00246
00251 void renderPicking(bool _renderPicking, ACG::SceneGraph::PickTarget _mode) {
00252 pickRendererMode_ = _mode ; renderPicking_ = _renderPicking; emit updated();
00253 }
00254
00255 private:
00258 bool renderPicking_;
00259
00264 ACG::SceneGraph::PickTarget pickRendererMode_;
00265
00266
00267
00268
00269 public slots:
00275 void lockUpdate() { locked_++; };
00276
00278 void unLockUpdate(){
00279 locked_-- ;
00280 if ( locked_ <0 ) {
00281 std::cerr << "More unlocks then locks" << std::endl;
00282 locked_ = 0;
00283 }
00284 };
00285
00288 bool updateLocked() { return (locked_ != 0); };
00289
00290 private:
00291 int locked_;
00292
00293
00294
00295
00296 public slots:
00298 bool backFaceCulling() { return backFaceCulling_; };
00299
00301 void backFaceCulling(bool _state ) { backFaceCulling_ = _state; emit updated(); }
00302
00303 private:
00304 bool backFaceCulling_;
00305
00306
00307
00308 public slots:
00310 void twoSidedLighting(bool _state ) { twoSidedLighting_ = _state; emit updated(); }
00311
00313 bool twoSidedLighting() { return twoSidedLighting_; };
00314
00315 private:
00316 bool twoSidedLighting_;
00317
00318
00319
00320 public slots:
00322 void multisampling(bool _state ) { multisampling_ = _state; emit updated(); }
00323
00325 bool multisampling() { return multisampling_; };
00326
00327 private:
00328 bool multisampling_;
00329
00330
00331
00332 public slots:
00334 void animation(bool _state ) { animation_ = _state; emit updated(); }
00335
00337 bool animation() { return animation_; };
00338
00339 private:
00340 bool animation_;
00341
00342
00343
00344
00345 public:
00347 ACG::GLState& glState() { return (*glState_); };
00348
00349 void setglState(ACG::GLState* _glState) { glState_ = _glState; };
00350
00351 private:
00353 ACG::GLState* glState_;
00354
00355
00356
00357 public slots:
00359 void objectMarker (ViewObjectMarker* _marker) { objectMarker_ = _marker; emit updated(); }
00360
00362 ViewObjectMarker* objectMarker() { return objectMarker_; };
00363
00364 private:
00365 ViewObjectMarker *objectMarker_;
00366
00367
00368
00369 public:
00370 int currentViewingDirection();
00371
00372 void currentViewingDirection(int _dir);
00373
00374 private:
00375 int currentViewingDirection_;
00376
00377
00378
00381 signals:
00384 void updated();
00385
00386 void getPickMode(std::string& _mode );
00387 void setPickMode(const std::string _mode );
00388
00389 void getActionMode(Viewer::ActionMode& _am);
00390 void setActionMode(const Viewer::ActionMode _am);
00391
00392 public:
00393
00395 std::string pickMode();
00396
00398 void pickMode(const std::string _name);
00399
00401 Viewer::ActionMode actionMode();
00402
00404 void actionMode(const Viewer::ActionMode _am);
00405
00406 };
00407
00408 }
00409
00410
00411 #endif //VIEWERPROPERTIES_HH
00412