Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

cosme.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *    Copyright (C) 2005 by Loïc Duviquet & Nicolas Rémond                 *
00003  *        duviquet@isia.cma.fr    remond@isia.cma.fr                       *
00004  *                                                                         *
00005  * This software is governed by the CeCILL  license under French law and   *
00006  * abiding by the rules of distribution of free software.  You can  use,   *
00007  * modify and/ or redistribute the software under the terms of the CeCILL  *
00008  * license as circulated by CEA, CNRS and INRIA at the following URL       *
00009  * "http://www.cecill.info".                                               *
00010  *                                                                         *
00011  * As a counterpart to the access to the source code and  rights to copy,  *
00012  * modify and redistribute granted by the license, users are provided only *
00013  * with a limited warranty  and the software's author,  the holder of the  *
00014  * economic rights,  and the successive licensors  have only  limited      *
00015  * liability.                                                              *
00016  *                                                                         *
00017  * In this respect, the user's attention is drawn to the risks associated  *
00018  * with loading,  using,  modifying and/or developing or reproducing the   *
00019  * software by the user in light of its specific status of free software,  *
00020  * that may mean  that it is complicated to manipulate,  and  that  also   *
00021  * therefore means  that it is reserved for developers  and  experienced   *
00022  * professionals having in-depth computer knowledge. Users are therefore   *
00023  * encouraged to load and test the software's suitability as regards their *
00024  * requirements in conditions enabling the security of their systems and/or*
00025  * data to be ensured and,  more generally, to use and operate it in the   *
00026  * same conditions as regards security.                                    *
00027  *                                                                         *
00028  * The fact that you are presently reading this means that you have had    *
00029  * knowledge of the CeCILL license and that you accept its terms.          *
00030  *                                                                         *
00031  ***************************************************************************/ 
00032 
00033 #ifndef COSME_H
00034 #define COSME_H
00035 
00036 // This application
00037 #include "ring.h"
00038 
00039 // OpenInventor
00040 #include <Inventor/Qt/SoQt.h>
00041 #include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
00042 #include <Inventor/fields/SoSFFloat.h>
00043 #include <Inventor/nodes/SoEventCallback.h>
00044 #include <Inventor/SbLinear.h>
00045 #include <Inventor/nodes/SoTransform.h>
00046 #include <Inventor/nodes/SoTranslation.h>
00047 #include <Inventor/draggers/SoDragPointDragger.h>
00048 
00049 // QT
00050 #include <qmainwindow.h>
00051 #include <qpushbutton.h>
00052 
00053 typedef void (*CB)(void*, SoEventCallback*);
00054 
00067 class Cosme: public QMainWindow
00068 {
00069     Q_OBJECT
00070 
00071 public:
00072     // Enable to make more tests
00073     friend class cosmeTest;
00074     
00075 // Define this class as a singleton
00076 public:
00077     static Cosme* getInstance();    
00078 private:
00079     Cosme();
00080     ~Cosme();
00081     static Cosme* cosme_instance;     
00083 // Each Qt slots
00084 private slots:
00085     void newDoc();
00086     void importTool();
00087     void importOrgan();
00088     void save();
00089     void about();
00090     void insertRing(int type_transform);
00091     void eraseRing();
00092     void setTransform();
00093     void validTransform();
00094     
00095 private:
00096     static Ring* pickedRing;
00097     
00098 // QT        
00099 protected:
00100     QPushButton* tranform_ok;
00101     void closeEvent( QCloseEvent* );
00102 
00103 // Static parameters
00104 private:
00105     static const SbVec3f x_axis;         
00106     static const SbVec3f y_axis;         
00107     static const SbVec3f z_axis;         
00108     static bool rotationBool;            
00109     static bool translationBool;         
00110     static bool toolAngleBool;           
00112 // Callback functions
00113 private:
00114     static void eventCB( void*, SoEventCallback* ev );
00115     static void replaceDraggerCB( void*);
00116     
00117 // Private methods    
00118 private:    
00119     SbBox3f getObjectBoundingBox( SoNode* node );
00120     void import(QString, SoSeparator*);
00121     void setToolInitialPosition();
00122     SoDragPointDragger* reshapeDragger(SoDragPointDragger *dragger);
00123     void setRotationManipulator(bool action);
00124     void setTranslationDragger(bool action);
00125     
00126 // Private attributes
00127 private:    
00128     QString filename;                     
00129     SbVec3f lastClickedPos;               
00131     SoQtExaminerViewer *viewer;           
00133     SoSeparator *root;                    
00135     // ------------------------------
00136     
00137     SoSeparator *scene;                   
00139     SoCamera *cameraSc;                   
00141     SoSeparator *containCB;               
00142     SoEventCallback *rotationCB;          
00143     SoEventCallback *translationCB;       
00145     SoSeparator *containTool;             
00146     SoSeparator *geometryObjects;         
00147     SoSeparator *containDragger;          
00148     SoTranslation *topToolTranslation;    
00149     SoTransform *manipulatorTransform;    
00150     SoSeparator *tool;                    
00151     SoSFFloat *toolAngle;                 
00153     SoSeparator *organ;
00154     
00155     // ------------------------------
00156     
00157     SoSeparator *timeline;                 
00159     SoCamera *cameraTl;                    
00160     SoSeparator *tl_base;
00161 
00162 };
00163 
00164 
00165 #endif

Generated on Tue Jul 12 16:40:18 2005 for CosmeProject by  doxygen 1.4.3