00001 #ifndef RenderAreaInteractive_H 00002 #define RenderAreaInteractive_H 00003 00004 #include <Inventor/ViewerComponents/Qt/RenderArea.h> 00005 #include <Inventor/ViewerComponents/Qt/QEventToSoEvent.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 00076 SceneInteractor* getRootSceneGraph() const; 00077 00082 virtual void viewAll( const SbViewportRegion &viewport ); 00083 00089 virtual void viewAxis( const SbVec3f& direction, const SbVec3f& up ); 00090 00094 virtual void activateStereo( bool activated ); 00095 00099 virtual bool isStereoSupported() const; 00100 00104 void setStereoCameraOffset( float offset ); 00105 00109 void setStereoCameraBalance( float balance ); 00110 00114 void setInteractiveMode(SoInteractiveComplexity::InteractiveMode mode); 00115 00119 virtual SoInteractiveComplexity::InteractiveMode getInteractiveMode() const; 00120 00125 virtual SbBool processEvent(const SoEvent *event); 00126 00131 virtual SbBool processEvents(const std::vector<const SoEvent*>& eventList); 00132 00133 private: 00134 00135 RenderAreaInteractive( QWidget* parent, bool buildRootSceneGraph ); 00136 00140 virtual SoRenderAreaCore::RenderStatus render(); 00141 00146 virtual void initializeGL(); 00147 00156 virtual void mousePressEvent( QMouseEvent* event ); 00157 00162 virtual void mouseReleaseEvent( QMouseEvent* event ); 00163 00168 virtual void mouseMoveEvent( QMouseEvent* event ); 00169 00174 virtual void wheelEvent( QWheelEvent* event ); 00175 00179 virtual void keyPressEvent ( QKeyEvent * event ); 00180 00184 virtual void keyReleaseEvent ( QKeyEvent * event ); 00185 00189 virtual void enterEvent(QEvent * event); 00190 00194 virtual void leaveEvent(QEvent * event); 00195 00199 virtual void mouseDoubleClickEvent(QMouseEvent * event); 00200 00205 virtual bool event(QEvent * qevent); 00206 00210 void buildSceneGraph(); 00211 00212 SceneInteractor* m_rootSceneGraph; 00213 00214 private: 00215 00216 void init( bool buildRootSceneGraph ); 00217 00218 void startRender( SiRenderArea::RenderEventArg& arg ); 00219 00224 static SbBool s_abortRenderCallback( SoAction* action, void* ); 00225 00226 SoGroup* m_appSceneGraph; 00227 ClippingPlanesAdjustMode m_clippingMode; 00228 00229 QEventToSoEvent m_eventbuilder; 00230 00232 int m_interactiveCount; 00233 }; 00234 00235 #endif // RenderAreaInteractive_H 00236