Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkRenderWindowInteractor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRenderWindowInteractor.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00071 #ifndef __vtkRenderWindowInteractor_h
00072 #define __vtkRenderWindowInteractor_h
00073 
00074 #include "vtkObject.h"
00075 #include "vtkRenderWindow.h"
00076 #include "vtkAbstractPropPicker.h"
00077 
00078 // Timer flags for win32/X compatibility
00079 #define VTKI_TIMER_FIRST  0
00080 #define VTKI_TIMER_UPDATE 1
00081 
00082 class vtkInteractorStyle;
00083 
00084 class VTK_RENDERING_EXPORT vtkRenderWindowInteractor : public vtkObject
00085 {
00086 public:
00087   static vtkRenderWindowInteractor *New();
00088   vtkTypeMacro(vtkRenderWindowInteractor,vtkObject);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090 
00092 
00094   virtual void Initialize() {this->Initialized=1; this->Enable();
00095                              this->RenderWindow->Render();}
00096   void ReInitialize() {  this->Initialized = 0; this->Enabled = 0;
00097                         this->Initialize(); } 
00099 
00102   void UnRegister(vtkObject *o);
00103 
00107   virtual void Start() {};
00108 
00110 
00117   virtual void Enable() { this->Enabled = 1; this->Modified();};
00118   virtual void Disable() { this->Enabled = 0; this->Modified();};
00119   vtkGetMacro(Enabled, int);
00121 
00123 
00124   void SetRenderWindow(vtkRenderWindow *aren);
00125   vtkGetObjectMacro(RenderWindow,vtkRenderWindow);
00127 
00129   virtual void UpdateSize(int x,int y);
00130 
00132 
00137   vtkSetVector2Macro(Size,int);
00138   vtkGetVector2Macro(Size,int);
00140 
00142 
00147   virtual int CreateTimer(int )  { return 1; };
00148   virtual int DestroyTimer()    { return 1; };
00150 
00154   virtual void TerminateApp(void) {};
00155 
00157 
00158   virtual void SetInteractorStyle(vtkInteractorStyle *);
00159   vtkGetObjectMacro(InteractorStyle,vtkInteractorStyle);
00161 
00163 
00165   vtkSetMacro(LightFollowCamera,int);
00166   vtkGetMacro(LightFollowCamera,int);
00167   vtkBooleanMacro(LightFollowCamera,int);
00169 
00171 
00173   vtkSetVector2Macro(EventPosition,int);
00174   vtkGetVectorMacro(EventPosition,int,2);
00176 
00178 
00182   vtkSetClampMacro(DesiredUpdateRate,float,0.0001,VTK_LARGE_FLOAT);
00183   vtkGetMacro(DesiredUpdateRate,float);
00185 
00187 
00189   vtkSetClampMacro(StillUpdateRate,float,0.0001,VTK_LARGE_FLOAT);
00190   vtkGetMacro(StillUpdateRate,float);
00192 
00194 
00195   vtkGetMacro(Initialized,int);
00197 
00199 
00203   vtkSetObjectMacro(Picker,vtkAbstractPicker);
00204   vtkGetObjectMacro(Picker,vtkAbstractPicker);
00206 
00209   virtual vtkAbstractPropPicker *CreateDefaultPicker();
00210 
00212   void SetStartPickMethod(void (*f)(void *), void *arg);
00213 
00216   void SetStartPickMethodArgDelete(void (*f)(void *));
00217 
00219   void SetEndPickMethod(void (*f)(void *), void *arg);
00220 
00223   void SetEndPickMethodArgDelete(void (*f)(void *));
00224 
00226   void SetUserMethod(void (*f)(void *), void *arg);
00227 
00230   void SetUserMethodArgDelete(void (*f)(void *));
00231 
00233   void SetExitMethod(void (*f)(void *), void *arg);
00234 
00237   void SetExitMethodArgDelete(void (*f)(void *));
00238 
00240 
00242   virtual void ExitCallback();
00243   virtual void UserCallback();
00244   virtual void StartPickCallback();
00245   virtual void EndPickCallback();
00247   
00249   virtual void GetMousePosition(int *x, int *y) { *x = 0 ; *y = 0; };
00250 
00252 
00254   void HideCursor() { this->RenderWindow->HideCursor(); };
00255   void ShowCursor() { this->RenderWindow->ShowCursor(); };
00257 
00260   void Render();
00261 
00263 
00266   void FlyTo(vtkRenderer *ren, float x, float y, float z);
00267   void FlyTo(vtkRenderer *ren, float *x)
00268     {this->FlyTo(ren, x[0], x[1], x[2]);}
00270 
00272 
00273   vtkSetClampMacro(NumberOfFlyFrames,int,1,VTK_LARGE_INTEGER);
00274   vtkGetMacro(NumberOfFlyFrames,int);
00276 
00278 
00280   vtkSetMacro(Dolly,float);
00281   vtkGetMacro(Dolly,float);
00283 
00284 protected:
00285   vtkRenderWindowInteractor();
00286   ~vtkRenderWindowInteractor();
00287 
00288   vtkRenderWindow    *RenderWindow;
00289   vtkInteractorStyle *InteractorStyle;
00290 
00291   // Used as a helper object to pick instances of vtkProp
00292   vtkAbstractPicker          *Picker;
00293 
00294   //
00295   int   Initialized;
00296   int   Enabled;
00297   int   Style;
00298   int   LightFollowCamera;
00299   int   ActorMode;
00300   float DesiredUpdateRate;
00301   float StillUpdateRate;
00302   int   EventPosition[2];
00303   int   Size[2];
00304   
00305   // user methods that can be used to override default behavior
00306   unsigned long StartPickTag;
00307   unsigned long EndPickTag;
00308   unsigned long UserTag;
00309   unsigned long ExitTag;
00310   
00311   // control the fly to
00312   int NumberOfFlyFrames;
00313   float Dolly;
00314   
00315 private:
00316   vtkRenderWindowInteractor(const vtkRenderWindowInteractor&);  // Not implemented.
00317   void operator=(const vtkRenderWindowInteractor&);  // Not implemented.
00318 };
00319 
00320 #endif

Generated on Thu Mar 28 14:19:34 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001