VTK
dox/Views/vtkRenderView.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkRenderView.h
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 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00039 #ifndef __vtkRenderView_h
00040 #define __vtkRenderView_h
00041 
00042 #include "vtkView.h"
00043 #include "vtkSmartPointer.h" // For SP ivars
00044 
00045 class vtkAbstractTransform;
00046 class vtkActor2D;
00047 class vtkAlgorithmOutput;
00048 class vtkArrayCalculator;
00049 class vtkBalloonRepresentation;
00050 class vtkDynamic2DLabelMapper;
00051 class vtkHardwareSelector;
00052 class vtkHoverWidget;
00053 class vtkInteractorObserver;
00054 class vtkLabelPlacementMapper;
00055 class vtkPolyDataMapper2D;
00056 class vtkRenderer;
00057 class vtkRenderWindow;
00058 class vtkRenderWindowInteractor;
00059 class vtkSelection;
00060 class vtkTextProperty;
00061 class vtkTexture;
00062 class vtkTexturedActor2D;
00063 class vtkTransformCoordinateSystems;
00064 
00065 class VTK_VIEWS_EXPORT vtkRenderView : public vtkView
00066 {
00067 public:
00068   static vtkRenderView* New();
00069   vtkTypeMacro(vtkRenderView, vtkView);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071   
00073 
00074   vtkGetObjectMacro(Renderer, vtkRenderer);
00076   
00078 
00079   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00081 
00083 
00084   virtual vtkRenderWindowInteractor* GetInteractor();
00085   virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00087 
00089 
00090   virtual void SetInteractorStyle(vtkInteractorObserver* style);
00091   virtual vtkInteractorObserver* GetInteractorStyle();
00093   
00094   //BTX
00095   enum
00096     {
00097     INTERACTION_MODE_2D,
00098     INTERACTION_MODE_3D,
00099     INTERACTION_MODE_UNKNOWN
00100     };
00101   //ETX
00102 
00104 
00107   virtual void SetInteractionMode(int mode);
00108   vtkGetMacro(InteractionMode, int);
00109   virtual void SetInteractionModeTo2D()
00110     { this->SetInteractionMode(INTERACTION_MODE_2D); }
00111   virtual void SetInteractionModeTo3D()
00112     { this->SetInteractionMode(INTERACTION_MODE_3D); }
00114 
00116   virtual void ApplyViewTheme(vtkViewTheme* theme);
00117 
00119 
00121   virtual void SetTransform(vtkAbstractTransform* transform);
00122   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00124 
00126 
00127   virtual void SetDisplayHoverText(bool b);
00128   vtkGetMacro(DisplayHoverText, bool);
00129   vtkBooleanMacro(DisplayHoverText, bool);
00131 
00132   //BTX
00133   enum {
00134     SURFACE = 0,
00135     FRUSTUM = 1
00136   };
00137   //ETX
00138 
00140 
00144   vtkSetClampMacro(SelectionMode, int, 0, 1);
00145   vtkGetMacro(SelectionMode, int);
00146   void SetSelectionModeToSurface() { this->SetSelectionMode(SURFACE); }
00147   void SetSelectionModeToFrustum() { this->SetSelectionMode(FRUSTUM); }
00149 
00152   virtual void Render();
00153   
00156   virtual void ResetCamera();
00157   
00160   virtual void ResetCameraClippingRange();
00161   
00165   virtual void AddLabels(vtkAlgorithmOutput* conn);
00166 
00168   virtual void RemoveLabels(vtkAlgorithmOutput* conn);
00169 
00171 
00172   virtual void SetIconTexture(vtkTexture* texture);
00173   vtkGetObjectMacro(IconTexture, vtkTexture);
00175 
00177 
00178   vtkSetVector2Macro(IconSize, int);
00179   vtkGetVector2Macro(IconSize, int);
00181 
00182   //BTX
00183   enum
00184     {
00185     NO_OVERLAP,
00186     ALL
00187     };
00188   //ETX
00189 
00191 
00195   virtual void SetLabelPlacementMode(int mode);
00196   virtual int GetLabelPlacementMode();
00197   virtual void SetLabelPlacementModeToNoOverlap()
00198     { this->SetLabelPlacementMode(NO_OVERLAP); }
00199   virtual void SetLabelPlacementModeToAll()
00200     { this->SetLabelPlacementMode(ALL); }
00202 
00203   //BTX
00204   enum
00205     {
00206     FREETYPE,
00207     QT
00208     };
00209   //ETX
00210 
00212 
00214   virtual void SetLabelRenderMode(int mode);
00215   virtual int GetLabelRenderMode();
00216   virtual void SetLabelRenderModeToFreetype()
00217     { this->SetLabelRenderMode(FREETYPE); }
00218   virtual void SetLabelRenderModeToQt()
00219     { this->SetLabelRenderMode(QT); }
00221 
00222 protected:
00223   vtkRenderView();
00224   ~vtkRenderView();
00225   
00227 
00230   virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, 
00231     void* callData);
00233 
00235 
00237   virtual void GenerateSelection(
00238     void* callData, vtkSelection* selection);
00240 
00242   virtual void PrepareForRendering();
00243   
00245   virtual void UpdateHoverText();
00246 
00249   virtual void UpdateHoverWidgetState();
00250 
00253   void UpdatePickRender();
00254 
00256 
00257   void SetRenderOnMouseMove(bool b);
00258   vtkGetMacro(RenderOnMouseMove, bool);
00259   vtkBooleanMacro(RenderOnMouseMove, bool);
00261 
00262   vtkRenderer* Renderer;
00263   vtkRenderer* LabelRenderer;
00264   vtkRenderWindow* RenderWindow;
00265   int SelectionMode;
00266   int InteractionMode;
00267   int LabelRenderMode;
00268   bool DisplayHoverText;
00269   bool Interacting;
00270   bool InHoverTextRender;
00271   bool InPickRender;
00272   bool PickRenderNeedsUpdate;
00273 
00274   vtkAbstractTransform* Transform;
00275   vtkTexture* IconTexture;
00276   int IconSize[2];
00277 
00278   //BTX
00279   vtkSmartPointer<vtkBalloonRepresentation>    Balloon;
00280   vtkSmartPointer<vtkLabelPlacementMapper>     LabelPlacementMapper;
00281   vtkSmartPointer<vtkTexturedActor2D>          LabelActor;
00282   vtkSmartPointer<vtkHoverWidget>              HoverWidget;
00283   vtkSmartPointer<vtkHardwareSelector>         Selector;
00284   //ETX
00285 
00286 private:
00287   vtkRenderView(const vtkRenderView&);  // Not implemented.
00288   void operator=(const vtkRenderView&);  // Not implemented.
00289 
00290   bool RenderOnMouseMove;
00291 };
00292 
00293 #endif