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 00096 private: 00097 00099 static void initClass(); 00100 00102 static void exitClass(); 00103 00104 private: 00109 virtual void handleEvent( SoHandleEventAction* action ); 00110 00111 // Implement actions to redirect to m_root 00112 00114 virtual void doAction( SoAction *action ); 00115 00117 virtual void callback( SoCallbackAction *action ); 00118 00120 virtual void GLRender( SoGLRenderAction *action ); 00121 00123 virtual void rayPick( SoRayPickAction *action ); 00124 00126 virtual void getBoundingBox( SoGetBoundingBoxAction *action ); 00127 00129 virtual void getPrimitiveCount( SoGetPrimitiveCountAction *action ); 00130 00132 SbVec2f normalizePoint(const SbVec2f& point, const SbViewportRegion& viewport); 00133 00134 SoEXTENDER_Documented private: 00135 00137 virtual void onKeyDown( SoHandleEventAction* ) {}; 00138 00140 virtual void onMouseDown( SoHandleEventAction* ) {}; 00141 00143 virtual void onMouseMove( SoHandleEventAction* ) {}; 00144 00146 virtual void onMouseDblClick( SoHandleEventAction* ) {}; 00147 00149 virtual void onMouseDragging( SoHandleEventAction* ) {}; 00150 00152 virtual void onMouseUp( SoHandleEventAction* ) {}; 00153 00155 inline const SbVec2f& getLastMouseDown() const { return m_lastMouseDown; } 00156 00157 private: 00158 00160 virtual ~SoScreenDrawer(); 00161 00163 virtual void notify( SoNotList *list ); 00164 00165 private: 00166 00171 SoSeparator* m_root; 00172 00177 SoSeparator* m_userGraphContainer; 00178 00180 SoOrthographicCamera* m_camera; 00181 00183 bool m_mouseLeftDown; 00184 00186 SbVec2f m_lastMouseDown; 00187 00188 }; 00189 00190 00191 #endif // _SO_SCREEN_DRAWER_H_ 00192 00193 00194