00001 /* Modified by Christopher Steinbach 00002 Modified March 2002 00003 Modified to add the functions which must be overridden in 00004 order for the Key Frame Animator to work with the method 00005 (getcamera, drawagain, drawfromimage, get image). 00006 00007 Modified By Christopher Steinbach 00008 Modified April 2002 00009 00010 Modified to use the IsReRendering functions of the volume 00011 tree to provide correct behaviour. 00012 00013 Also modified to add IsReRendering and setIsReRendering 00014 functions tro this tree so that the key frame animatore will work. 00015 00016 Will now work with the splatter. 00017 */ 00018 00019 #ifndef _vuBasicUtility_h_ 00020 #define _vuBasicUtility_h_ 00021 00022 #include "../vuUtilityWindow.h" 00023 #include "../wxUIElements/vuGLCanvas.h" 00024 #include "../wxUIElements/vuHelpPanel.h" 00025 #include "../wxUIElements/vuKeyFramerDialog/vuKeyFramerDialog.h" 00026 00027 #include "vuCamera.h" 00028 #include "vuPerspectiveCamera.h" 00029 #include "vuParallelCamera.h" 00030 00031 #include "vuImage.h" 00032 #include "../../Volume/volume.h" 00033 00034 #include "../wxUIElements/vuTransferCanvas.h" //for transfer function. 00035 00036 class vuBasicGLCanvas; 00037 00038 class vuKeyFramerDialog; 00039 00040 // this is the namespace of the vuImage class 00041 // it is needed to properely compile.... 00042 //using namespace ns_vu1112113; 00043 00045 00081 class vuBasicUtility : public vuUtilityWindow 00082 { 00083 public: 00085 vuBasicUtility(); 00087 virtual ~vuBasicUtility(); 00088 00090 virtual bool init(const char* DataFile) { return true; }; 00092 00093 virtual void close(); 00094 00095 public: // functions that need to be overridden for the derived 00096 // method to work with the key frame animator. 00097 00098 00101 virtual void DrawAgain() = 0; 00102 00107 virtual void DrawFromImage() = 0; 00108 00113 virtual vuCamera* getCamera () = 0; 00114 00118 virtual vuImage* getCurrentImage() = 0; 00119 00122 virtual bool IsReRendering (); 00123 00126 virtual void setIsReRendering (bool isit); 00127 00128 public: 00129 00131 virtual void notifyDataChanged (); 00132 00134 static const char* getFileType() { return ""; }; 00135 00140 void useOpenGL(bool yesorno); 00141 00142 public: 00143 //The following methods are overridden to add controls to the window. 00145 virtual void addTop(wxSizer *sizer) {}; 00147 virtual void addBottom(wxSizer *sizer) {}; 00149 virtual void addLeft(wxSizer *sizer) {}; 00151 virtual void addRight(wxSizer *sizer) {}; 00152 00153 protected: 00155 00159 virtual bool glInit() { return true; }; 00161 00167 virtual void glRender(); 00169 00173 virtual void glResize() {}; 00175 00179 virtual void glOnMouse(wxMouseEvent &ev); 00180 00184 virtual void OnChar(wxKeyEvent& event); 00185 00186 private: 00188 00193 bool init(vuMainWindow *main,const char* DataFile); 00194 00195 public: 00196 const vuBasicGLCanvas *getCanvas(); 00197 00198 protected: 00200 vuBasicGLCanvas *m_glCanvas; 00202 vuMainWindow *m_Main; 00203 00205 vuCamera *m_camera; 00206 00208 vuKeyFramerDialog *m_keyframer; 00209 00211 vuHelpPanel m_helpPanel; 00212 00214 friend class vuBasicGLCanvas; 00215 00217 vuTFDesign m_TFunc; 00218 00219 protected: 00221 virtual vu1 *getVolume(); 00222 00224 int m_MouseX, m_MouseY; 00226 bool m_DrawPreview; 00227 00229 virtual void onMouse(wxMouseEvent& event); 00230 // These functions are mouse 'subhandlers': 00231 //virtual void onLeftDoubleClick(wxMouseEvent &event); 00232 virtual void onMouseRightMoving(wxMouseEvent &event); 00233 virtual void onMouseLeftMoving(wxMouseEvent &event); 00235 void storeMousePosition(wxMouseEvent &event); 00236 00238 virtual void onKeyboard(wxKeyEvent& event); 00239 // These functions are keyboard 'subhandlers': 00240 virtual void onKeyboardHelp(wxKeyEvent& event); 00241 virtual void onKeyboardKeyframer(wxKeyEvent& event); 00242 virtual void onKeyboardZoom(wxKeyEvent& event); 00243 virtual void onKeyboardRotate(wxKeyEvent& event); 00244 00248 virtual void onRender(); 00249 00251 virtual wxString helpText(); 00252 }; 00253 00254 //---------------------------------------------------------------------------- 00255 //------------------------- Internal vuBasicGLCanvas class ------------------- 00256 //---------------------------------------------------------------------------- 00257 00259 00263 class vuBasicGLCanvas : public vuGLCanvas 00264 { 00265 public: 00266 friend class vuBasicUtility; 00267 protected: 00276 virtual void OnChar(wxKeyEvent& event); 00277 private: 00282 vuBasicGLCanvas(vuBasicUtility *parent); 00284 virtual bool glInit(); 00295 virtual void render(); 00297 virtual void resize(); 00299 virtual void OnMouse(wxMouseEvent &ev); 00300 00301 DECLARE_EVENT_TABLE() 00302 00303 private: 00304 00306 vuBasicUtility *m_Parent; 00307 }; 00308 00309 #endif