CMS 3D CMS Logo

Ig3DBaseBrowser.h

Go to the documentation of this file.
00001 #ifndef IGUANA_GL_BROWSERS_IG3D_BROWSER_H
00002 # define IGUANA_GL_BROWSERS_IG3D_BROWSER_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/GLBrowsers/interface/config.h"
00007 # include "Iguana/Framework/interface/IgBrowser.h"
00008 # include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
00009 # include <qobject.h>
00010 # include <string>
00011 
00012 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00013 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00014 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00015 
00016 class IgState;
00017 class IgSite;
00018 class IgSelectionMessage;
00019 class IgQtObjectMenuMessage;
00020 
00021 class Ig3DViewpoints;
00022 
00023 class Ig3DBaseModel;
00024 class Ig3DBaseModelEvent;
00025 class Ig3DBaseRep;
00026 
00027 class SoPickedPoint;
00028 class SoPath;
00029 class SoSelection;
00030 class SoGroup;
00031 class SoFieldSensor;
00032 
00033 class QString;
00034 class QPopupMenu;
00035 class QEvent;
00036 
00037 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00038 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00039 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00040 
00041 class IGUANA_GL_BROWSERS_API Ig3DBaseBrowser : public QObject,
00042                                                public SoQtExaminerViewer,
00043                                                public IgBrowser
00044 {
00045     Q_OBJECT
00046 
00047 public:
00048     static const int    MENU_ID_3D              = 3000;
00049     static const int    MENU_ID_3D_FILESEP      = 3003;
00050     static const int    MENU_ID_3D_TOOLBAR      = 3004;
00051     static const int    MENU_ID_3D_TOOLBAR_SEP  = 3005;
00052     static const int    MENU_ID_3D_VIEW_PROPERTIES= 3006;
00053     static const int    MENU_ID_3D_MISCSEP      = 3007;
00054     static const int    MENU_ID_3D_Z_SLICE      = 3008;
00055     static const int    MENU_ID_3D_CLIPS        = 3009;
00056     static const int    MENU_ID_3D_LIGHTS       = 3010;
00057     static const int    MENU_ID_3D_LGHT_MANIP   = 3101;
00058     static const int    MENU_ID_3D_LGHT_NEW     = 3102;
00059     static const int    MENU_ID_3D_LGHT_NEW_DIR = 3103;
00060     static const int    MENU_ID_3D_LGHT_NEW_PNT = 3104;
00061     static const int    MENU_ID_3D_LGHT_NEW_SPT = 3105;
00062     static const int    MENU_ID_3D_LGHT_SEP     = 3110;
00063     static const int    MENU_ID_3D_LGHT_BASE    = 3113;
00064     static const int    MENU_ID_3D_ANIMS        = 3011;
00065     static const int    MENU_ID_3D_2D_VIEW_PROPERTIES = 3014;
00066     static const int    MENU_ID_3D_VIEWPOINTS   = 3012;
00067     static const int    MENU_ID_3D_FIELDPLANES  = 3015;
00068     static const int    MENU_ID_3D_NODEMANIP    = 3016;
00069     static const int    MENU_ID_3D_GRIDS        = 3017;
00070     static const int    MENU_ID_3D_VP_NEW       = 3201;
00071     static const int    MENU_ID_3D_VP_SEP       = 3202;
00072     static const int    MENU_ID_3D_VP_BASE      = 3203;
00073     static const int    MENU_ID_3D_LEGO_VIEW_PROPERTIES = 3112;
00074     static const int    MENU_ID_3D_RZ_VIEW_PROPERTIES = 3113;
00075     static const int    MENU_ID_3D_RPHI_VIEW_PROPERTIES = 3114;
00076     static const int    MENU_ID_3D_SPARE_VIEW_PROPERTIES = 3115;
00077 
00078     static const int    MENU_3D_OPS             = 100;
00079     static const int    MENU_SEEKTO             = 101;
00080     static const int    MENU_SLICE              = 102;
00081     static const int    MENU_CLIP               = 103;
00082 
00083 
00084     Ig3DBaseBrowser (IgState *state, IgSite *site, Ig3DBaseModel *model);
00085     ~Ig3DBaseBrowser (void);
00086 
00087     void setAutoClipping (SbBool enable);
00088 
00089     virtual void                 browse (IgRepresentable *object);
00090     virtual void                 select (Ig3DBaseRep *rep);
00091 
00092     virtual Ig3DBaseRep *        getCurrentPick (void) const;
00093     virtual Ig3DBaseRep *        getSelection (void) const;
00094     virtual const SoPickedPoint* getCurrentPickPoint (void) const;
00095 
00096     virtual Ig3DBaseModel *      model (void) const;
00097     virtual IgState *            state (void) const;
00098 
00099     virtual void   printBitmap (QString file, float ppi,
00100                                              float dpi, QString format);
00101     virtual void   printVector (QString file, QString format, int level);
00102 
00103     virtual void   focusIn (void);
00104     virtual void   focusOut (void);
00105 
00106     Ig3DBaseRep*   menuRep (void);
00107     void           repMenu (IgQtObjectMenuMessage message);
00108     int            getGL2PSOptions (void);
00109     bool           isGridVisible (void);
00110     bool           isWhatsThisPicking (void);
00111     
00112     static bool    saveNode (SoNode *node, const QString& title,
00113                                           QWidget *parent = 0, const char* file = 0);
00114     static bool    writeNode (SoNode *node, const QString& file, bool binary,
00115                                           QWidget *parent = 0);
00116     static SoNode* openNode (const QString& nodeName, const QString& title,
00117                                           QWidget *parent = 0, const char* file = 0);
00118     static SoNode* findGroup (SoNode *node, const char* name);
00119 
00120 public slots:
00121     void         zoomIn (void);
00122     void         zoomOut (void);
00123     void         zoom (const float diffvalue);
00124     void         resetToHomePosition (void);
00125     void         saveHomePosition (void);
00126     void         viewAll (void);
00127     void         seek (void);    
00128     void         setFeedbackVisibility (bool enable);
00129     virtual void setGridVisibility (bool enable);
00130     void         view (void);
00131     void         pick (void);
00132     void         setWhatsThisPicking (bool enable = true);
00133     void         setGL2PSOptions (int options);
00134     
00135     virtual void autoPrint (void);
00136     virtual void autoPrint (const std::string text);
00137     virtual void viewPlaneX (void);
00138     virtual void viewPlaneY (void);
00139     virtual void viewPlaneZ (void);
00140     virtual void toggleCameraType (void);
00141     virtual void invertCamera (void);    
00142     
00143 protected:
00144     
00145     virtual void     initWidget (IgSite *site);        
00146     virtual void     selectMessage (IgSelectionMessage message);
00147     virtual void     modelChanged (Ig3DBaseModelEvent event);
00148     virtual void     setCurrentPick (Ig3DBaseRep *rep);
00149     virtual void     setCurrentPickPoint (const SoPickedPoint *pick);
00151     virtual void     createViewerButtons (QWidget* parent, SbPList* buttonlist);
00152     virtual QWidget* buildLeftTrim (QWidget *parent);
00153     virtual QWidget* buildBottomTrim (QWidget *parent);
00154     virtual QWidget* buildRightTrim (QWidget *parent);
00155 
00156 private slots:
00157     void save (void);
00158     void print (void);
00159     void repSeekTo (void);
00160     void leftWheelPressed (void);
00161     void leftWheelChanged (float by);
00162     void leftWheelReleased (void);
00163 
00164 signals:
00165     void cameraToggled (void);
00166 
00167 protected:
00168     static QWidget* initialise (IgState *state, IgSite *site);
00169     static SbBool   eventCallback (void *closure, QEvent *event);
00170 
00171 private:
00172     static void    onStartPick (void *cb, SoQtViewer *viewer);
00173     static void    onFinishPick (void *cb, SoQtViewer *viewer);
00174     static SoPath* onPick (void *cb, const SoPickedPoint *pick);
00175     static void    onSelect (void *cb, SoPath *selection);
00176     static void    onDeselect (void *cb, SoPath *selection);
00177     
00178     //FIXME: remove these Callback method once the SoQt fixes the continuous
00179     //rendering problem
00180     static void    farDistanceSensorCB (void *me, SoSensor *sensor);
00181     static void    nearDistanceSensorCB (void *me, SoSensor *sensor);
00182 
00183     virtual void   drawGrid (const bool enable);
00184 
00185     IgState             *m_state;
00186     IgSite              *m_site;
00187     Ig3DBaseModel       *m_model;
00188     QPopupMenu          *m_menu;
00189     Ig3DBaseRep         *m_selection;
00190     Ig3DBaseRep         *m_menuRep;
00191     const SoPickedPoint *m_pick;
00192     bool                 m_first_time;
00193     bool                 m_grid;
00194     int                  m_gl2psOptions;
00195     Ig3DBaseRep         *m_currentPick;
00196     bool                 m_whatsThisPicking;
00197     bool                 m_oldView;
00198     bool                 m_oldSeek;
00199     int                  m_gl2psFBBufferSize;
00200     
00201     //FIXME: remove these two sensors once the SoQt fixes the continuous
00202     //rendering problem
00203     SoFieldSensor       *m_farDistanceSensor;
00204     SoFieldSensor       *m_nearDistanceSensor;
00205     
00206     // undefined semantics
00207     Ig3DBaseBrowser (const Ig3DBaseBrowser &);
00208     Ig3DBaseBrowser &operator= (const Ig3DBaseBrowser &);
00209 };
00210 
00211 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00212 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00213 
00214 #endif // IGUANA_GL_BROWSERS_IG3D_BROWSER_H

Generated on Tue Jun 9 17:38:30 2009 for CMSSW by  doxygen 1.5.4