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 : Frederic FRATANI (MMM yyyy) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef SOTVIZNAVIGATIONTOOLBASE_H 00026 #define SOTVIZNAVIGATIONTOOLBASE_H 00027 00028 00049 #include <Inventor/nodes/SoSeparator.h> 00050 #include <TerrainViz/viewer/SoTVizCameraManager.h> 00051 #include <TerrainViz/viewer/SoTVizViewer.h> 00052 #include <Inventor/nodes/SoTranslation.h> 00053 #include <Inventor/nodes/SoScale.h> 00054 #include <Inventor/nodes/SoRotation.h> 00055 #ifdef _WIN32 00056 # ifdef _SO_QT_ 00057 # include <wingdi.h> 00058 # else 00059 # include <Inventor/Win/SoWinDef.h> 00060 # endif 00061 #endif 00062 class SoDEPRECATED SoTVizNavigationToolBase 00064 { 00065 public: 00066 00070 SoTVizNavigationToolBase (); 00071 00075 virtual ~SoTVizNavigationToolBase (); 00076 00080 virtual void loadFile (const char* fileName) = 0; 00081 00082 00086 virtual void enableMouseMoveAndResize (SbBool onOff); 00087 00091 virtual SbBool isMouseMoveAndResizeEnabled () const; 00092 00093 00097 virtual void enableCustomInteraction (SbBool onOff); 00098 00102 virtual SbBool isCustomInteractionEnabled () const; 00103 00104 00108 virtual void setOrigin (SbVec2f& newOrigin); 00109 00113 virtual SbVec2f getOrigin () const; 00114 00115 00119 virtual void setSize (float newSize); 00120 00121 00125 virtual float getSize () const; 00126 00132 virtual void notifyOrientation (float newOrientation); 00133 00138 virtual void notifyElevation (float newRelativeElevation, float newGroundElevation, SoTVizCameraManager::lengthUnits newLengthUnit); 00139 00144 virtual void notifySpeed (float newSpeed, SoTVizViewer::speedUnits newSpeedUnit); 00145 00150 virtual void notifyPosition (SbVec3f& newPosition); 00151 00152 private: 00153 00154 // method used by SoTVizNavigationTools to connect this tool to the sceneraph 00155 SoSeparator * getRoot () const {return m_toolRoot;} 00156 00157 // method used by SoTVizNavigationTools when windows size changes 00158 void setViewport (SbVec2s newViewport); 00159 00160 // method called in SoTVizNavigationTools::processEvent to enable 00161 // interface interactivity. Three mouse events are take in account: 00162 // simple click calls the specific interaction tool method if implemented 00163 // click with control or shift button moves the picked tool 00164 // click with both control and shift buttons resizes the picked tool 00165 virtual SbBool processEvent (XAnyEvent * mouseEvent, SbBool ctrl, SbBool shft); 00166 00167 private: 00168 00169 // this method must be called from loadFile function in derivated classes 00170 // it appends a transform node to make default size 1 and set default position 00171 // at the center of the render area 00172 virtual void preTransformTool(); 00173 00174 // position depends on window and tool size. It can be corrected in order 00175 // to stay visible. That's why this method is called by setOrigin, setSize 00176 // and setViewport functions to recompute position. 00177 void geometryChanged (); 00178 00179 // called in processEvent to check mouse location 00180 virtual SoPickedPoint* isMouseOver (SbVec2s mouseLocation); 00181 00182 // this method must be redefined in derivated classes 00183 // it will be called by processEvent on simple click events 00184 virtual void processSpecificInteraction (SbVec2s mouseLocation, SoPickedPoint* pickPoint) =0; 00185 00186 // that node is set in loadFile function 00187 SoSeparator * m_shapeSptr; 00188 // window size in pixels 00189 SbVec2s m_viewport; 00190 00191 // viewer data path for compass.... 00192 const char* dataPath; 00193 00194 private: 00195 00196 // is interaction enabled? 00197 SbBool m_mouseMoveAndResize; 00198 SbBool m_customInteraction; 00199 00200 // internal scenegraph nodes 00201 SoSeparator * m_toolRoot; 00202 SoTranslation * m_translation; 00203 SoScale * m_scale; 00204 SoTransform * m_preTransform; 00205 00206 // processEvent method variables 00207 SbBool m_onResize; 00208 SbBool m_onMove; 00209 SbVec2f m_startPoint; 00210 float m_startSize; 00211 float m_startOffset; 00212 SbVec2f m_startOrigin; 00213 00214 // size and position 00215 float m_size; 00216 SbVec2f m_origin; 00217 // displayed position can be corrected in geometryChanged method 00218 SbVec2f m_actualOrigin; 00219 00220 char* m_newPath; 00221 char* m_currentPath; 00222 }; 00223 00224 00225 inline void 00226 SoTVizNavigationToolBase::notifyOrientation (float ) 00227 {} 00228 00229 inline void 00230 SoTVizNavigationToolBase::notifyElevation (float , float , SoTVizCameraManager::lengthUnits) 00231 {} 00232 00233 inline void 00234 SoTVizNavigationToolBase::notifySpeed (float , SoTVizViewer::speedUnits) 00235 {} 00236 00237 inline void 00238 SoTVizNavigationToolBase::notifyPosition (SbVec3f& ) 00239 {} 00240 00241 00242 #endif // SOTVIZNAVIGATIONTOOLBASE_H 00243 00244