00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Thibaut Andrieu (Jan 2011) 00022 **=======================================================================*/ 00023 00024 #if !defined _SO_SCREEN_DRAWER_H_ 00025 #define _SO_SCREEN_DRAWER_H_ 00026 00027 #include <Inventor/nodes/SoNode.h> 00028 #include <Inventor/SbVec.h> 00029 #include <Inventor/fields/SoSFNode.h> 00030 #include <Inventor/SbBox.h> 00031 00032 class SoHandleEventAction; 00033 class SoOrthographicCamera; 00034 class SoSeparator; 00035 class SbViewportRegion; 00036 00084 class SoScreenDrawer : public SoNode 00085 { 00086 SO_NODE_HEADER( SoScreenDrawer ); 00087 00088 public: 00089 00091 SoSFNode sceneGraph; 00092 00094 SoScreenDrawer(); 00095 00101 virtual void reset(); 00102 00103 private: 00104 00106 static void initClass(); 00107 00109 static void exitClass(); 00110 00112 virtual void notify( SoNotList *list ); 00113 00114 private: 00119 virtual void handleEvent( SoHandleEventAction* action ); 00120 00121 // Implement actions to redirect to m_root 00122 00124 virtual void doAction( SoAction *action ); 00125 00127 virtual void callback( SoCallbackAction *action ); 00128 00130 virtual void GLRender( SoGLRenderAction *action ); 00131 00133 virtual void rayPick( SoRayPickAction *action ); 00134 00136 virtual void getBoundingBox( SoGetBoundingBoxAction *action ); 00137 00139 virtual void getPrimitiveCount( SoGetPrimitiveCountAction *action ); 00140 00142 SbVec2f normalizePoint(const SbVec2f& point, const SbViewportRegion& viewport); 00143 00144 SoEXTENDER_Documented private: 00145 00147 virtual void onKeyDown( SoHandleEventAction* ) {}; 00148 00150 virtual void onMouseDown( SoHandleEventAction* ) {}; 00151 00153 virtual void onMouseMove( SoHandleEventAction* ) {}; 00154 00156 virtual void onMouseDblClick( SoHandleEventAction* ) {}; 00157 00159 virtual void onMouseDragging( SoHandleEventAction* ) {}; 00160 00162 virtual void onMouseUp( SoHandleEventAction* ) {}; 00163 00165 inline const SbVec2f& getLastMouseDown() const { return m_lastMouseDown; } 00166 00167 private: 00168 00170 virtual ~SoScreenDrawer(); 00171 00172 private: 00173 00178 SoSeparator* m_root; 00179 00184 SoSeparator* m_userGraphContainer; 00185 00187 SoOrthographicCamera* m_camera; 00188 00190 bool m_mouseLeftDown; 00191 00193 SbVec2f m_lastMouseDown; 00194 00195 }; 00196 00197 00198 #endif // _SO_SCREEN_DRAWER_H_ 00199 00200 00201