00001 #ifndef RenderAreaInteractive_H 00002 #define RenderAreaInteractive_H 00003 00004 #include <Inventor/ViewerComponents/Qt/RenderArea.h> 00005 #include <Inventor/ViewerComponents/Qt/QtEventToSoEvent.h> 00006 00007 class QRenderAreaCore; 00008 class QMouseEvent; 00009 class QWheelEvent; 00010 class QKeyEvent; 00011 00012 class SceneInteractor; 00013 class SoGroup; 00014 00021 class QTVIEWERCOMPONENTS_API RenderAreaInteractive : public RenderArea, public SiRenderAreaInteractive 00022 { 00023 00024 public: 00025 00034 enum ClippingPlanesAdjustMode 00035 { 00036 AUTO, 00037 MANUAL 00038 }; 00039 00043 RenderAreaInteractive( QWidget* parent ); 00044 00048 virtual ~RenderAreaInteractive(); 00049 00050 /* 00051 * Sets the scene graph to render. 00052 */ 00053 virtual void setSceneGraph( SoNode* sceneGraph ); 00054 00066 void setClippingPlanesAdjustMode(ClippingPlanesAdjustMode mode); 00067 00071 ClippingPlanesAdjustMode getClippingPlanesAdjustMode(); 00072 SoDEPRECATED 00077 SceneInteractor* getRootSceneGraph() const; 00078 00082 virtual SceneInteractor* getSceneInteractor() const; 00083 00088 virtual void viewAll( const SbViewportRegion &viewport ); 00089 00095 virtual void viewAxis( const SbVec3f& direction, const SbVec3f& up ); 00096 00100 virtual void activateStereo( bool activated ); 00101 00105 virtual bool isStereoSupported() const; 00106 00110 void setStereoCameraOffset( float offset ); 00111 00115 void setStereoCameraBalance( float balance ); 00116 00117 #if 1 SoDEPRECATED 00122 void setInteractiveMode(SoInteractiveComplexity::InteractiveMode mode); 00123 SoDEPRECATED 00128 virtual SoInteractiveComplexity::InteractiveMode getInteractiveMode() const; 00129 #endif 00138 virtual SbBool processEvent(const SoEvent *event); 00139 00147 virtual SbBool processEvents(const std::vector<const SoEvent*>& eventList); 00148 00149 private: 00150 00151 RenderAreaInteractive( QWidget* parent, bool buildRootSceneGraph ); 00152 00156 virtual SoRenderAreaCore::RenderStatus render(); 00157 00162 virtual void initializeGL(); 00163 00172 virtual void mousePressEvent( QMouseEvent* event ); 00173 00178 virtual void mouseReleaseEvent( QMouseEvent* event ); 00179 00184 virtual void mouseMoveEvent( QMouseEvent* event ); 00185 00190 virtual void wheelEvent( QWheelEvent* event ); 00191 00195 virtual void keyPressEvent ( QKeyEvent * event ); 00196 00200 virtual void keyReleaseEvent ( QKeyEvent * event ); 00201 00205 virtual void enterEvent(QEvent * event); 00206 00210 virtual void leaveEvent(QEvent * event); 00211 00215 virtual void mouseDoubleClickEvent(QMouseEvent * event); 00216 00221 virtual bool event(QEvent * qevent); 00222 00226 void buildSceneGraph(); 00227 00228 SceneInteractor* m_rootSceneGraph; 00229 // Auto interactive mode 00230 bool m_isAutoInteractive; 00231 00232 private: 00233 00234 void init( bool buildRootSceneGraph ); 00235 00236 void startRender( SiRenderArea::RenderEventArg& arg ); 00237 00242 static SbBool s_abortRenderCallback( SoAction* action, void* ); 00243 00244 SoGroup* m_appSceneGraph; 00245 ClippingPlanesAdjustMode m_clippingMode; 00246 SoInteractiveComplexity::InteractiveMode m_interactiveMode; 00247 00248 QtEventToSoEvent m_eventbuilder; 00249 00250 bool m_isDragging; 00251 }; 00252 00253 #endif // RenderAreaInteractive_H 00254