Version: 6.3.1

src/SVTK/SVTK_Renderer.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME VTKViewer : build VTK viewer into Salome desktop
00024 //  File   : 
00025 //  Author : 
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/GUI/GUI_SRC/src/SVTK/SVTK_Renderer.h,v 1.7.2.1.8.3.2.1 2011-06-01 13:53:41 vsr Exp $
00028 //
00029 #ifndef SVTK_Renderer_h
00030 #define SVTK_Renderer_h
00031 
00032 #include "SVTK.h"
00033 #include "VTKViewer.h"
00034 
00035 #include <vtkObject.h>
00036 #include <vtkSmartPointer.h>
00037 
00038 class vtkRenderer;
00039 class vtkCallbackCommand;
00040 class vtkRenderWindowInteractor;
00041 
00042 class vtkPicker;
00043 class vtkPointPicker;
00044 class vtkCellPicker;
00045 class vtkProperty;
00046 
00047 class SVTK_RectPicker;
00048 
00049 class VTKViewer_Trihedron;
00050 class VTKViewer_Transform;
00051 class SVTK_CubeAxesActor2D;
00052 class VTKViewer_Actor;
00053 class SVTK_Selector;
00054 
00055 #ifdef WIN32
00056 #pragma warning ( disable:4251 )
00057 #endif
00058 
00066 class SVTK_EXPORT SVTK_Renderer : public vtkObject
00067 {
00068  public:
00069   vtkTypeMacro(SVTK_Renderer,vtkObject);
00070   static SVTK_Renderer* New();
00071 
00072   //----------------------------------------------------------------------------
00074   vtkRenderer* 
00075   GetDevice();
00076 
00078   virtual
00079   void 
00080   Initialize(vtkRenderWindowInteractor* theInteractor,
00081              SVTK_Selector* theSelector);
00082 
00083   //----------------------------------------------------------------------------
00085   virtual
00086   void 
00087   AddActor(VTKViewer_Actor* theActor, bool theIsAdjustActors = true);
00088 
00090   virtual
00091   void 
00092   RemoveActor(VTKViewer_Actor* theActor, bool theIsAdjustActors = true);
00093 
00095   VTKViewer_Transform* 
00096   GetTransform();
00097 
00099   virtual
00100   void
00101   SetScale( double theScale[3] );
00102 
00104   void
00105   GetScale( double theScale[3] );
00106 
00107   //----------------------------------------------------------------------------
00109   void
00110   SetSelectionProp(const double& theRed = 1, 
00111                    const double& theGreen = 1,
00112                    const double& theBlue = 0, 
00113                    const int& theWidth = 5);
00114 
00116   void
00117   SetPreselectionProp(const double& theRed = 0, 
00118                       const double& theGreen = 1,
00119                       const double& theBlue = 1, 
00120                       const int& theWidth = 5);
00121 
00123   void
00124   SetSelectionTolerance(const double& theTolNodes = 0.025, 
00125                         const double& theTolCell = 0.001,
00126                         const double& theTolObjects = 0.025);
00127 
00128   //----------------------------------------------------------------------------
00130   void
00131   AdjustActors();
00132 
00134   void
00135   SetTrihedronSize(vtkFloatingPointType theSize, const bool theRelative = true);
00136  
00138   vtkFloatingPointType  
00139   GetTrihedronSize() const;
00140 
00142   bool  
00143   IsTrihedronRelative() const;
00144 
00145   //----------------------------------------------------------------------------
00147   VTKViewer_Trihedron* 
00148   GetTrihedron();
00149 
00151   bool 
00152   IsTrihedronDisplayed();
00153 
00155   void 
00156   OnViewTrihedron(); 
00157 
00159   void 
00160   OnAdjustTrihedron();
00161 
00162   //----------------------------------------------------------------------------
00164   SVTK_CubeAxesActor2D* 
00165   GetCubeAxes();
00166 
00168   bool 
00169   IsCubeAxesDisplayed();
00170 
00172   void 
00173   OnViewCubeAxes();
00174 
00176   void 
00177   OnAdjustCubeAxes();
00178 
00179   //----------------------------------------------------------------------------
00181   void OnFitAll(); 
00182   
00184   void OnResetView(); 
00185 
00187   void OnResetClippingRange(); 
00188 
00190   void OnFrontView(); 
00191 
00193   void OnBackView(); 
00194 
00196   void OnTopView();
00197 
00199   void OnBottomView();
00200 
00202   void OnRightView(); 
00203 
00205   void OnLeftView();     
00206 
00208   void onClockWiseView();
00209 
00211   void onAntiClockWiseView();
00212 
00213 protected:
00214   SVTK_Renderer();
00215   ~SVTK_Renderer();
00216 
00217   virtual
00218   bool
00219   OnAdjustActors();
00220 
00221   //----------------------------------------------------------------------------
00222   // Priority at which events are processed
00223   vtkFloatingPointType myPriority;
00224 
00225   // Used to process events
00226   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
00227 
00228   // Description:
00229   // Main process event method
00230   static void ProcessEvents(vtkObject* object, 
00231                             unsigned long event,
00232                             void* clientdata, 
00233                             void* calldata);
00234   
00235   vtkSmartPointer<vtkRenderer> myDevice;
00236   vtkRenderWindowInteractor* myInteractor;
00237   vtkSmartPointer<SVTK_Selector> mySelector;
00238 
00239   //----------------------------------------------------------------------------
00240   vtkSmartPointer<VTKViewer_Transform> myTransform;
00241 
00242   //----------------------------------------------------------------------------
00243   // Highlight/ Prehighlight devices
00244   vtkSmartPointer<vtkPointPicker> myPointPicker;
00245   vtkSmartPointer<vtkCellPicker> myCellPicker;
00246 
00247   vtkSmartPointer<SVTK_RectPicker> myPointRectPicker;
00248   vtkSmartPointer<SVTK_RectPicker> myCellRectPicker;
00249 
00250   vtkSmartPointer<vtkProperty> myPreHighlightProperty;
00251   vtkSmartPointer<vtkProperty> myHighlightProperty;
00252 
00253   //----------------------------------------------------------------------------
00254   vtkSmartPointer<SVTK_CubeAxesActor2D> myCubeAxes;
00255   vtkSmartPointer<VTKViewer_Trihedron> myTrihedron;  
00256   vtkFloatingPointType myTrihedronSize;
00257   bool myIsTrihedronRelative;
00258   vtkFloatingPointType myBndBox[6];
00259 };
00260 
00261 #ifdef WIN32
00262 #pragma warning ( default:4251 )
00263 #endif
00264 
00265 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS