ViewerProperties.hh

Go to the documentation of this file.
00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 6849 $                                                         *
00038  *   $Author: moebius $                                                      *
00039  *   $Date: 2009-08-11 19:04:50 +0200 (Di, 11. Aug 2009) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 
00044 
00045 
00046 //=============================================================================
00047 //
00048 //  Property storage Class for glWidgets
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/GL/GLState.hh>
00068 
00069 // forward declaration
00070 class ViewObjectMarker;
00071 
00072 namespace Viewer {
00073 
00075   enum ActionMode {
00076     // examine geometry, get transformations from mouse events
00077     ExamineMode,
00081     PickingMode,
00082     // same as picking, but emit signalMouseEventIdentify()
00083     QuestionMode,
00084     // Ligh rotation mode
00085     LightMode
00086   };
00087 
00088   class DLLEXPORT ViewerProperties : public QObject {
00089 
00090     Q_OBJECT
00091 
00092     public:
00093       ViewerProperties();
00094       ~ViewerProperties();
00095       
00096     //===========================================================================
00099     //===========================================================================      
00100 
00101     public:
00103       void drawMode(unsigned int _mode) { currentDrawMode_ = _mode; emit updated(); };
00104       
00106       unsigned int drawMode() { return currentDrawMode_; };
00107       
00108     private:
00109       
00110       unsigned int currentDrawMode_;
00111 
00114     //===========================================================================
00117     //===========================================================================
00118 
00119     public slots:
00131       void snapshotBaseFileName(const QString& _fname);
00132 
00134       QString snapshotName() { return snapshotName_; };
00135 
00137       int snapshotCounter() { return snapshotCounter_++; };
00138 
00139     private:
00140       QString                      snapshotName_;
00141       int                          snapshotCounter_;
00142 
00145     //===========================================================================
00146     //===========================================================================
00149     //===========================================================================
00150     //===========================================================================
00151 
00152 
00153     public slots:
00155       double wheelZoomFactor() { return wZoomFactor_; };
00156 
00158       double wheelZoomFactorShift() { return wZoomFactorShift_; };
00159 
00161       void wheelZoomFactor(double _factor) { wZoomFactor_ = _factor; };
00162 
00164       void wheelZoomFactorShift(double _factor) { wZoomFactorShift_ = _factor; }; 
00165 
00166     private:
00167       double wZoomFactor_;
00168 
00169       double wZoomFactorShift_;
00170 
00173     //===========================================================================
00174     //===========================================================================
00177     //===========================================================================
00178     //===========================================================================
00179 
00182     //===========================================================================
00183     //===========================================================================
00186     //===========================================================================
00187     //===========================================================================
00188 
00189     public slots:
00192       bool isCCWFront(){ return CCWFront_; };
00193 
00195       void ccwFront() { CCWFront_ = true; emit updated(); };
00197       void cwFront() { CCWFront_ = false; emit updated(); };
00198 
00199     private:
00200       bool CCWFront_;
00201 
00202 
00203     //===========================================================================
00204 
00205     public slots:
00206 
00208       ACG::Vec4f backgroundColor() { return backgroundColor_; }
00209 
00211       QRgb backgroundColorRgb(){ QColor c;
00212                                  c.setRedF(  backgroundColor_[0]);
00213                                  c.setGreenF(backgroundColor_[1]);
00214                                  c.setBlueF( backgroundColor_[2]);
00215                                  c.setAlphaF(backgroundColor_[3]);
00216                                  return c.rgba(); };
00217 
00220       void backgroundColor( ACG::Vec4f _color ) { backgroundColor_ = _color; emit updated(); };
00221 
00224       void backgroundColor( QRgb _color ) { QColor c(_color);
00225                                             backgroundColor_[0] = c.redF();
00226                                             backgroundColor_[1] = c.greenF();
00227                                             backgroundColor_[2] = c.blueF();
00228                                             backgroundColor_[3] = c.alphaF();
00229                                             emit updated(); };
00230 
00231     private:
00232       ACG::Vec4f backgroundColor_;
00233 
00234     //===========================================================================
00235 
00236     public slots:
00237 
00239       bool renderPicking() { return renderPicking_; };
00240 
00242       ACG::SceneGraph::PickTarget renderPickingMode() { return pickRendererMode_; };
00243 
00244       void renderPickin(bool _mode ) { renderPicking_ = _mode; emit updated(); };
00245 
00250       void renderPicking(bool _renderPicking, ACG::SceneGraph::PickTarget _mode) {
00251         pickRendererMode_ = _mode ; renderPicking_ = _renderPicking; emit updated();
00252       }
00253 
00254     private:
00257       bool renderPicking_;
00258 
00263       ACG::SceneGraph::PickTarget pickRendererMode_;
00264 
00265 
00266     //===========================================================================
00267 
00268     public slots:
00274       void lockUpdate()  { locked_++; };
00275 
00277       void unLockUpdate(){
00278         locked_-- ;
00279         if ( locked_ <0 ) {
00280           std::cerr << "More unlocks then locks" << std::endl;
00281           locked_ = 0;
00282         }
00283       };
00284 
00287       bool updateLocked() { return (locked_ != 0); };
00288 
00289     private:
00290       int locked_;
00291 
00292 
00293     //===========================================================================
00294 
00295     public slots:
00297       bool backFaceCulling() { return backFaceCulling_; };
00298 
00300       void backFaceCulling(bool _state ) { backFaceCulling_ = _state; emit updated(); }
00301 
00302     private:
00303       bool backFaceCulling_;
00304 
00305     //===========================================================================
00306 
00307     public slots:
00309       void twoSidedLighting(bool _state ) { twoSidedLighting_ = _state; emit updated(); }
00310 
00312       bool twoSidedLighting() { return twoSidedLighting_; };
00313 
00314     private:
00315       bool twoSidedLighting_;
00316       
00317     //===========================================================================
00318 
00319     public slots:
00321       void multisampling(bool _state ) { multisampling_ = _state; emit updated(); }
00322 
00324       bool multisampling() { return multisampling_; };
00325 
00326     private:
00327       bool multisampling_;      
00328 
00329     //===========================================================================
00330 
00331     public slots:
00333       void animation(bool _state ) { animation_ = _state; emit updated(); }
00334 
00336       bool animation() { return animation_; };
00337 
00338     private:
00339       bool animation_;
00340 
00341 
00342     //===========================================================================
00343 
00344     public:
00346       ACG::GLState& glState() { return (*glState_); };
00347 
00348       void setglState(ACG::GLState* _glState) { glState_ = _glState; };
00349 
00350     private:
00352       ACG::GLState* glState_;
00353 
00354     //===========================================================================
00355 
00356     public slots:
00358       void objectMarker (ViewObjectMarker* _marker) { objectMarker_ = _marker; emit updated(); }
00359 
00361       ViewObjectMarker* objectMarker() { return objectMarker_; };
00362 
00363     private:
00364       ViewObjectMarker *objectMarker_;
00365 
00366     //===========================================================================
00367 
00368     public:
00369       int currentViewingDirection();
00370 
00371       void currentViewingDirection(int _dir);
00372 
00373     private:
00374       int currentViewingDirection_;
00375 
00376     //===========================================================================
00377 
00380     signals:
00383       void updated();
00384 
00385       void getPickMode(std::string& _mode );
00386       void setPickMode(const std::string  _mode );
00387 
00388       void getActionMode(Viewer::ActionMode& _am);
00389       void setActionMode(const Viewer::ActionMode  _am);
00390 
00391     public:
00392 
00394       std::string pickMode();
00395 
00397       void pickMode(const std::string _name);
00398 
00400       Viewer::ActionMode actionMode();
00401 
00403       void actionMode(const Viewer::ActionMode _am);
00404 
00405   };
00406 
00407 }
00408 
00409 
00410 #endif //VIEWERPROPERTIES_HH
00411 

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .