• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Filtering/vtkViewport.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkViewport.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00034 #ifndef __vtkViewport_h
00035 #define __vtkViewport_h
00036 
00037 #include "vtkObject.h"
00038 
00039 class vtkActor2DCollection;
00040 class vtkAssemblyPath;
00041 class vtkProp;
00042 class vtkPropCollection;
00043 class vtkWindow;
00044 
00045 class VTK_FILTERING_EXPORT vtkViewport : public vtkObject
00046 {
00047 public:
00048   vtkTypeRevisionMacro(vtkViewport,vtkObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00053   void AddViewProp(vtkProp *);
00054 
00056   vtkPropCollection *GetViewProps() {return this->Props;};
00057 
00059   int HasViewProp(vtkProp *);
00060 
00062   void RemoveViewProp(vtkProp *);
00063 
00065   void RemoveAllViewProps(void);
00066 
00068 
00071   void AddActor2D(vtkProp* p);
00072   void RemoveActor2D(vtkProp* p);
00073   vtkActor2DCollection *GetActors2D();
00075 
00077 
00079   vtkSetVector3Macro(Background,double);
00080   vtkGetVector3Macro(Background,double);
00082 
00084 
00086   vtkSetVector3Macro(Background2,double);
00087   vtkGetVector3Macro(Background2,double);
00089 
00091 
00093   vtkSetMacro(GradientBackground,bool);
00094   vtkGetMacro(GradientBackground,bool);
00095   vtkBooleanMacro(GradientBackground,bool);
00097 
00099 
00101   vtkSetVector2Macro(Aspect,double);
00102   vtkGetVectorMacro(Aspect,double,2);
00103   virtual void ComputeAspect();
00105   
00107 
00110   vtkSetVector2Macro(PixelAspect,double);
00111   vtkGetVectorMacro(PixelAspect,double,2);
00113 
00115 
00118   vtkSetVector4Macro(Viewport,double);
00119   vtkGetVectorMacro(Viewport,double,4);
00121 
00123 
00126   vtkSetVector3Macro(DisplayPoint,double);
00127   vtkGetVectorMacro(DisplayPoint,double,3);
00129 
00131 
00134   vtkSetVector3Macro(ViewPoint,double);
00135   vtkGetVectorMacro(ViewPoint,double,3);
00137 
00139 
00141   vtkSetVector4Macro(WorldPoint,double);
00142   vtkGetVectorMacro(WorldPoint,double,4);
00144    
00146   virtual double *GetCenter();
00147 
00149   virtual int IsInViewport(int x,int y); 
00150 
00152   virtual vtkWindow *GetVTKWindow() = 0;
00153 
00155   virtual void DisplayToView(); // these get modified in subclasses
00156 
00158   virtual void ViewToDisplay(); // to handle stereo rendering
00159 
00161   virtual void WorldToView();
00162 
00164   virtual void ViewToWorld();
00165 
00167   void DisplayToWorld() {this->DisplayToView(); this->ViewToWorld();};
00168 
00170   void WorldToDisplay() {this->WorldToView(); this->ViewToDisplay();};
00171 
00173 
00178   virtual void LocalDisplayToDisplay(double &x, double &y);
00179   virtual void DisplayToNormalizedDisplay(double &u, double &v);
00180   virtual void NormalizedDisplayToViewport(double &x, double &y);
00181   virtual void ViewportToNormalizedViewport(double &u, double &v);
00182   virtual void NormalizedViewportToView(double &x, double &y, double &z);
00183   virtual void ViewToWorld(double &, double &, double &) {};
00184   virtual void DisplayToLocalDisplay(double &x, double &y);
00185   virtual void NormalizedDisplayToDisplay(double &u, double &v);
00186   virtual void ViewportToNormalizedDisplay(double &x, double &y);
00187   virtual void NormalizedViewportToViewport(double &u, double &v);
00188   virtual void ViewToNormalizedViewport(double &x, double &y, double &z);
00189   virtual void WorldToView(double &, double &, double &) {};
00191 
00193 
00196   virtual int *GetSize();
00197   virtual int *GetOrigin();
00198   void GetTiledSize(int *width, int *height);
00199   virtual void GetTiledSizeAndOrigin(int *width, int *height, 
00200                                      int *lowerLeftX, int *lowerLeftY);
00202   
00203   // The following methods describe the public pick interface for picking
00204   // Props in a viewport.
00205 
00211   virtual vtkAssemblyPath* PickProp(double selectionX, double selectionY) = 0;
00212 
00214 
00217   vtkAssemblyPath* PickPropFrom(double selectionX, double selectionY, 
00218                                 vtkPropCollection*);
00220   
00222 
00224   double GetPickX() const {return (this->PickX1 + this->PickX2)*0.5;}
00225   double GetPickY() const {return (this->PickY1 + this->PickY2)*0.5;}
00226   double GetPickWidth() const {return this->PickX2 - this->PickX1 + 1;};
00227   double GetPickHeight() const {return this->PickY2 - this->PickY1 + 1;};
00228   double GetPickX1() const {return this->PickX1;}
00229   double GetPickY1() const {return this->PickY1;}
00230   double GetPickX2() const {return this->PickX2;}
00231   double GetPickY2() const {return this->PickY2;}
00232   vtkGetMacro(IsPicking, int);
00233   vtkGetObjectMacro(PickResultProps, vtkPropCollection);
00235 
00237   virtual double GetPickedZ() = 0;
00238 
00239 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00240 # define RemovePropA RemoveProp
00241 # define RemovePropW RemoveProp
00242 #endif
00243 
00245   VTK_LEGACY(void RemoveProp(vtkProp*));
00246 
00247 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00248 # undef RemovePropA
00249 # undef RemovePropW
00250   //BTX
00251   VTK_LEGACY(void RemovePropA(vtkProp*));
00252   VTK_LEGACY(void RemovePropW(vtkProp*));
00253   //ETX
00254 #endif
00255 
00257   VTK_LEGACY(void AddProp(vtkProp *));
00258 
00260   VTK_LEGACY(vtkPropCollection *GetProps());
00261 
00263   VTK_LEGACY(int HasProp(vtkProp *));
00264 
00267   VTK_LEGACY(void RemoveAllProps());
00268 
00269 protected:
00270   // Create a vtkViewport with a black background, a white ambient light, 
00271   // two-sided lighting turned on, a viewport of (0,0,1,1), and back face 
00272   // culling turned off.
00273   vtkViewport();
00274   ~vtkViewport();
00275 
00276   //BTX
00277   // Picking functions to be implemented by sub-classes
00278   // Perform the main picking loop
00279   virtual void DevicePickRender() = 0;
00280   // Enter a pick mode
00281   virtual void StartPick(unsigned int pickFromSize) = 0;
00282   // Set the pick id to the next id before drawing an object
00283   virtual void UpdatePickId() = 0;
00284   // Exit Pick mode
00285   virtual void DonePick() = 0; 
00286   // Return the id of the picked object, only valid after a call to DonePick
00287   virtual unsigned int GetPickedId() = 0;
00288   // Return the number of objects picked, only valid after a call to DonePick
00289   virtual unsigned int GetNumPickedIds() = 0;
00290   // Put no more than atMost picked object ids into the callerBuffer and
00291   // return the number of picked objects returned.
00292   virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer) = 0;
00293   //ETX
00294 
00295   // Ivars for picking
00296   // Store a picked Prop (contained in an assembly path)
00297   vtkAssemblyPath* PickedProp;
00298   vtkPropCollection* PickFromProps;
00299   vtkPropCollection* PickResultProps;
00300   // Boolean flag to determine if picking is enabled for this render
00301   int IsPicking;
00302   unsigned int CurrentPickId;
00303   double PickX1;
00304   double PickY1;
00305   double PickX2;
00306   double PickY2;
00307   // End Ivars for picking
00308 
00309   vtkPropCollection *Props;
00310   vtkActor2DCollection *Actors2D;
00311   vtkWindow *VTKWindow;
00312   double Background[3];  
00313   double Background2[3];  
00314   double Viewport[4];
00315   double Aspect[2];
00316   double PixelAspect[2];
00317   double Center[2];
00318   bool GradientBackground;
00319 
00320   int Size[2];
00321   int Origin[2];
00322   double DisplayPoint[3];
00323   double ViewPoint[3];
00324   double WorldPoint[4];
00325 
00326 private:
00327   vtkViewport(const vtkViewport&);  // Not implemented.
00328   void operator=(const vtkViewport&);  // Not implemented.
00329 };
00330 
00331 
00332 
00333 #endif

Generated by  doxygen 1.7.1