Version: 6.3.1

src/SVTK/SALOME_Actor.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 OBJECT : implementation of interactive object visualization for OCC and VTK viewers
00024 //  File   : SALOME_Actor.h
00025 //  Author : Nicolas REJNERI
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/GUI/GUI_SRC/src/SVTK/SALOME_Actor.h,v 1.6.2.3.8.1.12.1 2011-06-01 13:53:40 vsr Exp $
00028 //
00029 #ifndef SALOME_ACTOR_H
00030 #define SALOME_ACTOR_H
00031 
00032 #include "SVTK_SelectionEvent.h"
00033 #include "SVTK_Selector.h"
00034 #include "SVTK.h"
00035 
00036 class Handle(SALOME_InteractiveObject);
00037 
00038 // undefining min and max because CASCADE's defines them and
00039 // it clashes with std::min(), std::max()
00040 #undef min
00041 #undef max
00042 
00043 #include <VTKViewer_Actor.h>
00044 #include <VTKViewer_MarkerDef.h>
00045 
00046 #include <vtkSmartPointer.h>
00047 
00048 class vtkAbstractPicker;
00049 class vtkPointPicker;
00050 class vtkCellPicker;
00051 class vtkOutlineSource;
00052 class vtkInteractorStyle;
00053 class vtkRenderWindowInteractor;
00054 
00055 class VTKViewer_FramedTextActor;
00056 
00057 class SVTK_Actor;
00058 class SVTK_RectPicker;
00059 class SVTK_InteractorStyle;
00060 
00061 SVTK_EXPORT extern int SALOME_POINT_SIZE;
00062 SVTK_EXPORT extern int SALOME_LINE_WIDTH;
00063 
00064 #ifdef WIN32
00065 #pragma warning ( disable:4251 )
00066 #endif
00067 
00069 
00074 class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor 
00075 {
00076  public:
00077   static SALOME_Actor* New();
00078   
00079   vtkTypeMacro(SALOME_Actor,VTKViewer_Actor);
00080 
00081   //----------------------------------------------------------------------------
00083   virtual
00084   Standard_Boolean 
00085   hasIO();
00086 
00088   virtual 
00089   const Handle(SALOME_InteractiveObject)& 
00090   getIO(); 
00091 
00093   virtual
00094   void
00095   setIO(const Handle(SALOME_InteractiveObject)& theIO);
00096 
00098   virtual
00099   void
00100   setName(const char* theName);
00101 
00102   //----------------------------------------------------------------------------
00104   virtual
00105   void
00106   SetTransform(VTKViewer_Transform* theTransform); 
00107 
00109   virtual
00110   void
00111   SetPosition(vtkFloatingPointType _arg1, 
00112               vtkFloatingPointType _arg2, 
00113               vtkFloatingPointType _arg3);
00114 
00116   virtual
00117   void
00118   SetPosition(vtkFloatingPointType _arg[3]);
00119 
00120   //----------------------------------------------------------------------------
00122   virtual
00123   void
00124   SetVisibility( int );
00125 
00127   virtual
00128   bool
00129   ShouldBeDisplayed();
00130 
00131   //----------------------------------------------------------------------------
00133   virtual
00134   void
00135   AddToRender(vtkRenderer* theRendere); 
00136 
00138   virtual
00139   void
00140   RemoveFromRender(vtkRenderer* theRendere);
00141 
00143   vtkRenderer*
00144   GetRenderer();
00145 
00146   //----------------------------------------------------------------------------
00148   virtual
00149   void
00150   SetInteractor(vtkRenderWindowInteractor* theInteractor);
00151 
00153   virtual
00154   void
00155   Update();
00156 
00157   //----------------------------------------------------------------------------
00159   virtual
00160   void
00161   SetSelector(SVTK_Selector* theSelector);
00162 
00164   virtual
00165   void
00166   highlight(bool theHighlight);  
00167 
00169   virtual
00170   void
00171   Highlight(bool theHighlight);  
00172 
00173   //----------------------------------------------------------------------------
00175   virtual
00176   bool
00177   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
00178                SVTK_SelectionEvent* theSelectionEvent,
00179                bool theIsHighlight);
00180 
00182   virtual 
00183   bool
00184   Highlight(vtkInteractorStyle* theInteractorStyle, 
00185             SVTK_SelectionEvent* theSelectionEvent,
00186             bool theIsHighlight);
00187 
00188   //----------------------------------------------------------------------------
00190   virtual
00191   bool
00192   IsDisplayNameActor() const;
00193 
00195   virtual
00196   void
00197   SetIsDisplayNameActor(bool theIsDisplayNameActor);
00198 
00200   virtual
00201   void
00202   SetNameActorText(const char* theText);
00203 
00205   virtual
00206   void
00207   SetNameActorOffset(int theOffset[2]);
00208 
00210   virtual
00211   void
00212   GetNameActorSize(vtkRenderer* theRenderer, int theSize[2]) const;
00213 
00215   virtual
00216   void
00217   UpdateNameActors();
00218 
00219   //----------------------------------------------------------------------------
00221   virtual
00222   void
00223   SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
00224 
00226   virtual
00227   void
00228   SetMarkerTexture( int, VTK::MarkerTexture );
00229 
00231   virtual
00232   VTK::MarkerType
00233   GetMarkerType();
00234 
00236   virtual
00237   VTK::MarkerScale
00238   GetMarkerScale();
00239 
00241   virtual
00242   int
00243   GetMarkerTexture();
00244 
00245   //----------------------------------------------------------------------------
00247   void
00248   SetPointPicker(vtkPointPicker* thePointPicker); 
00249 
00251   void
00252   SetCellPicker(vtkCellPicker* theCellPicker); 
00253 
00255   void
00256   SetPointRectPicker(SVTK_RectPicker* theRectPicker);
00257 
00259   void
00260   SetCellRectPicker(SVTK_RectPicker* theRectPicker);
00261 
00262   //----------------------------------------------------------------------------
00264   void
00265   SetPreHighlightProperty(vtkProperty* theProperty);
00266 
00268   void
00269   SetHighlightProperty(vtkProperty* theProperty);
00270 
00271  protected:
00272   //----------------------------------------------------------------------------
00273   vtkRenderWindowInteractor* myInteractor;
00274   vtkRenderer* myRenderer;
00275 
00276   Handle(SALOME_InteractiveObject) myIO;
00277 
00278   SALOME_Actor();
00279   ~SALOME_Actor();
00280 
00281  protected:
00282   Selection_Mode mySelectionMode;
00283   vtkSmartPointer<SVTK_Selector> mySelector;
00284 
00285   //----------------------------------------------------------------------------
00286   // Highlight/ Prehighlight devices
00287   vtkSmartPointer<vtkPointPicker> myPointPicker;
00288   vtkSmartPointer<vtkCellPicker> myCellPicker;
00289 
00290   vtkSmartPointer<SVTK_RectPicker> myPointRectPicker;
00291   vtkSmartPointer<SVTK_RectPicker> myCellRectPicker;
00292 
00293   vtkSmartPointer<SVTK_Actor> myPreHighlightActor;
00294   vtkSmartPointer<SVTK_Actor> myHighlightActor;
00295 
00296   vtkSmartPointer<VTKViewer_Actor> myOutlineActor;
00297   vtkSmartPointer<vtkOutlineSource> myOutline;
00298 
00299   bool myIsDisplayNameActor;
00300   vtkSmartPointer<VTKViewer_FramedTextActor> myNameActor;
00301 };
00302 
00303 namespace SVTK
00304 {
00305   class SVTK_EXPORT TPickLimiter
00306   {
00307     vtkAbstractPicker* myPicker;
00308   public:
00309     TPickLimiter(vtkAbstractPicker*, SALOME_Actor*);
00310     ~TPickLimiter();
00311   };
00312 }
00313 
00314 #ifdef WIN32
00315 #pragma warning ( default:4251 )
00316 #endif
00317 
00318 #endif // SALOME_ACTOR_H
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