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 "vtkRenderViewBase.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 vtkSelection;
00057 class vtkTextProperty;
00058 class vtkTexture;
00059 class vtkTexturedActor2D;
00060 class vtkTransformCoordinateSystems;
00061 
00062 class VTK_VIEWS_EXPORT vtkRenderView : public vtkRenderViewBase
00063 {
00064 public:
00065   static vtkRenderView* New();
00066   vtkTypeMacro(vtkRenderView, vtkRenderViewBase);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00072   virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00073 
00075   virtual void SetInteractorStyle(vtkInteractorObserver* style);
00076 
00078   virtual vtkInteractorObserver* GetInteractorStyle();
00079 
00083   virtual void SetRenderWindow(vtkRenderWindow *win);
00084 
00085   //BTX
00086   enum
00087     {
00088     INTERACTION_MODE_2D,
00089     INTERACTION_MODE_3D,
00090     INTERACTION_MODE_UNKNOWN
00091     };
00092   //ETX
00093   void SetInteractionMode(int mode);
00094   vtkGetMacro(InteractionMode, int);
00095 
00097 
00100   virtual void SetInteractionModeTo2D()
00101     { this->SetInteractionMode(INTERACTION_MODE_2D); }
00102   virtual void SetInteractionModeTo3D()
00103     { this->SetInteractionMode(INTERACTION_MODE_3D); }
00105 
00108   virtual void Render();
00109 
00111   virtual void ApplyViewTheme(vtkViewTheme* theme);
00112 
00114 
00116   virtual void SetTransform(vtkAbstractTransform* transform);
00117   vtkGetObjectMacro(Transform, vtkAbstractTransform);
00119 
00121 
00122   virtual void SetDisplayHoverText(bool b);
00123   vtkGetMacro(DisplayHoverText, bool);
00124   vtkBooleanMacro(DisplayHoverText, bool);
00126 
00127   //BTX
00128   enum {
00129     SURFACE = 0,
00130     FRUSTUM = 1
00131   };
00132   //ETX
00133 
00135 
00139   vtkSetClampMacro(SelectionMode, int, 0, 1);
00140   vtkGetMacro(SelectionMode, int);
00141   void SetSelectionModeToSurface() { this->SetSelectionMode(SURFACE); }
00142   void SetSelectionModeToFrustum() { this->SetSelectionMode(FRUSTUM); }
00144 
00148   virtual void AddLabels(vtkAlgorithmOutput* conn);
00149 
00151   virtual void RemoveLabels(vtkAlgorithmOutput* conn);
00152 
00154 
00155   virtual void SetIconTexture(vtkTexture* texture);
00156   vtkGetObjectMacro(IconTexture, vtkTexture);
00158 
00160 
00161   vtkSetVector2Macro(IconSize, int);
00162   vtkGetVector2Macro(IconSize, int);
00164 
00166 
00169   vtkSetVector2Macro(DisplaySize, int);
00170   int* GetDisplaySize();
00171   void GetDisplaySize(int &dsx, int &dsy);
00173 
00174   //BTX
00175   enum
00176     {
00177     NO_OVERLAP,
00178     ALL
00179     };
00180   //ETX
00181 
00183 
00187   virtual void SetLabelPlacementMode(int mode);
00188   virtual int GetLabelPlacementMode();
00189   virtual void SetLabelPlacementModeToNoOverlap()
00190     { this->SetLabelPlacementMode(NO_OVERLAP); }
00191   virtual void SetLabelPlacementModeToAll()
00192     { this->SetLabelPlacementMode(ALL); }
00194 
00195   //BTX
00196   enum
00197     {
00198     FREETYPE,
00199     QT
00200     };
00201   //ETX
00202 
00204 
00206   virtual void SetLabelRenderMode(int mode);
00207   virtual int GetLabelRenderMode();
00208   virtual void SetLabelRenderModeToFreetype()
00209     { this->SetLabelRenderMode(FREETYPE); }
00210   virtual void SetLabelRenderModeToQt()
00211     { this->SetLabelRenderMode(QT); }
00213 
00215 
00216   void SetRenderOnMouseMove(bool b);
00217   vtkGetMacro(RenderOnMouseMove, bool);
00218   vtkBooleanMacro(RenderOnMouseMove, bool);
00219 protected:
00220   vtkRenderView();
00221   ~vtkRenderView();
00223 
00225 
00228   virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
00229     void* callData);
00231 
00233 
00235   virtual void GenerateSelection(
00236     void* callData, vtkSelection* selection);
00238 
00240   virtual void PrepareForRendering();
00241 
00243   virtual void UpdateHoverText();
00244 
00247   virtual void UpdateHoverWidgetState();
00248 
00251   void UpdatePickRender();
00252 
00253   int SelectionMode;
00254   int LabelRenderMode;
00255   bool DisplayHoverText;
00256   bool Interacting;
00257   bool InHoverTextRender;
00258   bool InPickRender;
00259   bool PickRenderNeedsUpdate;
00260 
00261   vtkAbstractTransform* Transform;
00262   vtkTexture* IconTexture;
00263   int IconSize[2];
00264   int DisplaySize[2];
00265 
00266   int InteractionMode;
00267   bool RenderOnMouseMove;
00268 
00269   //BTX
00270   vtkSmartPointer<vtkRenderer>                 LabelRenderer;
00271   vtkSmartPointer<vtkBalloonRepresentation>    Balloon;
00272   vtkSmartPointer<vtkLabelPlacementMapper>     LabelPlacementMapper;
00273   vtkSmartPointer<vtkTexturedActor2D>          LabelActor;
00274   vtkSmartPointer<vtkHoverWidget>              HoverWidget;
00275   vtkSmartPointer<vtkHardwareSelector>         Selector;
00276   //ETX
00277 
00278 private:
00279   vtkRenderView(const vtkRenderView&);  // Not implemented.
00280   void operator=(const vtkRenderView&);  // Not implemented.
00281 };
00282 
00283 #endif