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

graphics/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 =========================================================================*/
00065 #ifndef __vtkRenderWindowInteractor_h
00066 #define __vtkRenderWindowInteractor_h
00067 
00068 #include "vtkObject.h"
00069 #include "vtkRenderWindow.h"
00070 #include "vtkAbstractPropPicker.h"
00071 
00072 // Timer flags for win32/X compatibility
00073 #define VTKI_TIMER_FIRST  0
00074 #define VTKI_TIMER_UPDATE 1
00075 
00076 class vtkInteractorStyle;
00077 
00078 class VTK_EXPORT vtkRenderWindowInteractor : public vtkObject
00079 {
00080 public:
00081   static vtkRenderWindowInteractor *New();
00082   vtkTypeMacro(vtkRenderWindowInteractor,vtkObject);
00083   void PrintSelf(ostream& os, vtkIndent indent);
00084 
00087   virtual void Initialize() {this->Initialized=1; this->Enable();
00088                              this->RenderWindow->Render();}
00089 
00092   void UnRegister(vtkObject *o);
00093 
00097   virtual void Start() {};
00098 
00106   virtual void Enable() { this->Enabled = 1; this->Modified();};
00107   virtual void Disable() { this->Enabled = 0; this->Modified();};
00108   vtkGetMacro(Enabled, int);
00109 
00111   void SetRenderWindow(vtkRenderWindow *aren);
00112   vtkGetObjectMacro(RenderWindow,vtkRenderWindow);
00113 
00115   virtual void UpdateSize(int x,int y);
00116 
00122   vtkSetVector2Macro(Size,int);
00123   vtkGetVector2Macro(Size,int);
00124 
00130   virtual int CreateTimer(int )  { return 1; };
00131   virtual int DestroyTimer()    { return 1; };
00132 
00136   virtual void TerminateApp(void) {};
00137 
00139   virtual void SetInteractorStyle(vtkInteractorStyle *);
00140   vtkGetObjectMacro(InteractorStyle,vtkInteractorStyle);
00141 
00144   vtkSetMacro(LightFollowCamera,int);
00145   vtkGetMacro(LightFollowCamera,int);
00146   vtkBooleanMacro(LightFollowCamera,int);
00147 
00150   vtkSetVector2Macro(EventPosition,int);
00151   vtkGetVectorMacro(EventPosition,int,2);
00152 
00157   vtkSetClampMacro(DesiredUpdateRate,float,0.0001,VTK_LARGE_FLOAT);
00158   vtkGetMacro(DesiredUpdateRate,float);
00159 
00162   vtkSetClampMacro(StillUpdateRate,float,0.0001,VTK_LARGE_FLOAT);
00163   vtkGetMacro(StillUpdateRate,float);
00164 
00166   vtkGetMacro(Initialized,int);
00167 
00172   vtkSetObjectMacro(Picker,vtkAbstractPicker);
00173   vtkGetObjectMacro(Picker,vtkAbstractPicker);
00174 
00177   virtual vtkAbstractPropPicker *CreateDefaultPicker();
00178 
00180   void SetStartPickMethod(void (*f)(void *), void *arg);
00181 
00184   void SetStartPickMethodArgDelete(void (*f)(void *));
00185 
00187   void SetEndPickMethod(void (*f)(void *), void *arg);
00188 
00191   void SetEndPickMethodArgDelete(void (*f)(void *));
00192 
00194   void SetUserMethod(void (*f)(void *), void *arg);
00195 
00198   void SetUserMethodArgDelete(void (*f)(void *));
00199 
00201   void SetExitMethod(void (*f)(void *), void *arg);
00202 
00205   void SetExitMethodArgDelete(void (*f)(void *));
00206 
00209   virtual void ExitCallback();
00210   virtual void UserCallback();
00211   virtual void StartPickCallback();
00212   virtual void EndPickCallback();
00213   
00215   virtual void GetMousePosition(int *x, int *y) { *x = 0 ; *y = 0; };
00216 
00219   void HideCursor() { this->RenderWindow->HideCursor(); };
00220   void ShowCursor() { this->RenderWindow->ShowCursor(); };
00221 
00224   void Render();
00225 
00226 protected:
00227   vtkRenderWindowInteractor();
00228   ~vtkRenderWindowInteractor();
00229   vtkRenderWindowInteractor(const vtkRenderWindowInteractor&) {};
00230   void operator=(const vtkRenderWindowInteractor&) {};
00231 
00232   vtkRenderWindow    *RenderWindow;
00233   vtkInteractorStyle *InteractorStyle;
00234 
00235   // Used as a helper object to pick instances of vtkProp
00236   vtkAbstractPicker          *Picker;
00237 
00238   //
00239   int   Initialized;
00240   int   Enabled;
00241   int   Style;
00242   int   LightFollowCamera;
00243   int   ActorMode;
00244   float DesiredUpdateRate;
00245   float StillUpdateRate;
00246   int   EventPosition[2];
00247   int   Size[2];
00248   
00249   // user methods that can be used to override default behavior
00250   unsigned long StartPickTag;
00251   unsigned long EndPickTag;
00252   unsigned long UserTag;
00253   unsigned long ExitTag;
00254 };
00255 
00256 #endif

Generated on Wed Nov 21 12:27:03 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001