src/OBJECT/VISU_Actor.h

Go to the documentation of this file.
00001 //  VISU OBJECT : interactive object for VISU entities implementation
00002 //
00003 //  Copyright (C) 2003  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 //
00024 //  File   : 
00025 //  Author : 
00026 //  Module : VISU
00027 //  $Header: /home/server/cvs/VISU/VISU_SRC/src/OBJECT/VISU_Actor.h,v 1.13 2006/06/01 11:36:04 jfa Exp $
00028 
00029 #ifndef VISU_ACTOR_H
00030 #define VISU_ACTOR_H
00031 
00032 #include "SALOME_Actor.h"
00033 #include "VISU_ActorFactory.h"
00034 #include "VISU_BoostSignals.h"
00035 
00036 #include <string>
00037 #include <vtkSmartPointer.h>
00038 
00039 class vtkProp;
00040 class vtkProperty;
00041 class vtkDataSetMapper;
00042 class vtkTextMapper;
00043 class vtkTextActor;
00044 class vtkInteractorStyle;
00045 class VTKViewer_ShrinkFilter;
00046 class VISU_PipeLine;
00047 
00048 #ifdef _WIN_32
00049 #define VTKOCC_EXPORT __declspec (dllexport)
00050 #else
00051 #define VTKOCC_EXPORT VTK_EXPORT
00052 #endif
00053 
00054 namespace VISU 
00055 {
00056   class Prs3d_i;
00057 }
00058 
00059 //----------------------------------------------------------------------------
00060 class VTKOCC_EXPORT VISU_Actor : 
00061   public SALOME_Actor,
00062   public boost::signalslib::trackable
00063 {
00064  public:
00065   vtkTypeMacro(VISU_Actor,SALOME_Actor);
00066 
00067   static 
00068   VISU_Actor* 
00069   New();
00070 
00071   void
00072   ShallowCopy(vtkProp *prop);
00073 
00074   virtual
00075   void
00076   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00077 
00078   //----------------------------------------------------------------------------
00079   virtual
00080   void
00081   setIO(const Handle(SALOME_InteractiveObject)& theIO);
00082 
00083   //----------------------------------------------------------------------------
00084   VISU::Prs3d_i* 
00085   GetPrs3d();
00086 
00087   virtual
00088   void
00089   SetPrs3d(VISU::Prs3d_i* thePrs3d);
00090 
00091   //----------------------------------------------------------------------------
00092   VISU::TActorFactory* 
00093   GetFactory();
00094 
00095   virtual
00096   void
00097   SetFactory(VISU::TActorFactory* theActorFactory);
00098 
00099   //----------------------------------------------------------------------------
00100   virtual
00101   void
00102   UpdateFromFactory();
00103 
00104   virtual
00105   void
00106   RemoveFromRender();
00107 
00108   //----------------------------------------------------------------------------
00109   virtual
00110   VISU_PipeLine* 
00111   GetPipeLine();
00112 
00113   virtual 
00114   void
00115   SetPipeLine(VISU_PipeLine* thePipeLine);
00116 
00117   //----------------------------------------------------------------------------
00118   virtual
00119   void
00120   SetRepresentation(int theMode);
00121 
00122   //----------------------------------------------------------------------------
00123   virtual
00124   bool
00125   IsShrunkable();
00126 
00127   virtual
00128   bool
00129   IsShrunk();
00130 
00131   virtual
00132   void
00133   SetShrink();
00134 
00135   virtual
00136   void
00137   UnShrink(); 
00138 
00139   virtual
00140   void
00141   SetShrinkable(bool theIsShrinkable);
00142 
00143   virtual
00144   void
00145   SetShrinkFactor(vtkFloatingPointType theFactor = 0.8); 
00146 
00147   virtual
00148   vtkFloatingPointType
00149   GetShrinkFactor();
00150 
00151   //----------------------------------------------------------------------------
00152   virtual
00153   void
00154   SetOpacity(vtkFloatingPointType theValue);
00155 
00156   virtual
00157   vtkFloatingPointType
00158   GetOpacity();
00159 
00160   virtual
00161   void
00162   SetLineWidth(vtkFloatingPointType theLineWidth);
00163 
00164   virtual
00165   vtkFloatingPointType
00166   GetLineWidth();
00167  
00168   //----------------------------------------------------------------------------
00169   virtual
00170   void
00171   AddToRender( vtkRenderer* ); 
00172 
00173   virtual
00174   void
00175   RemoveFromRender( vtkRenderer* );
00176 
00177   //----------------------------------------------------------------------------
00178   virtual
00179   bool
00180   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
00181             SVTK_SelectionEvent* theSelectionEvent,
00182             bool theIsHighlight);
00183 
00184   virtual
00185   void 
00186   SetVTKMapping(bool theIsVTKMapping); 
00187 
00188   virtual
00189   bool 
00190   IsVTKMapping() const;
00191 
00192   virtual
00193   vtkDataSet* 
00194   GetInput(); 
00195 
00196   //----------------------------------------------------------------------------
00197   virtual
00198   vtkIdType
00199   GetNodeObjId(vtkIdType theID);
00200 
00201   virtual
00202   vtkIdType
00203   GetNodeVTKID(vtkIdType theID);
00204 
00205   virtual
00206   vtkFloatingPointType* 
00207   GetNodeCoord(vtkIdType theObjID);
00208 
00209   virtual
00210   vtkIdType
00211   GetElemObjId(vtkIdType theID);
00212 
00213   virtual
00214   vtkIdType
00215   GetElemVTKID(vtkIdType theID);
00216 
00217   virtual
00218   vtkCell* 
00219   GetElemCell(vtkIdType theObjID);
00220 
00221   //----------------------------------------------------------------------------
00222  protected:
00223   VISU_Actor();
00224 
00225   virtual
00226   ~VISU_Actor();
00227  
00228   virtual 
00229   void
00230   SetMapperInput(vtkDataSet* theDataSet);
00231 
00232   virtual
00233   VISU_PipeLine* 
00234   GetCurrentPL();
00235 
00236   //----------------------------------------------------------------------------
00237   bool myIsVTKMapping;
00238   VISU::Prs3d_i* myPrs3d;
00239   vtkSmartPointer<VISU_PipeLine> myPipeLine;
00240   vtkSmartPointer<vtkDataSetMapper> myMapper;
00241 
00242   VISU::TActorFactory* myActorFactory;
00243   boost::signal1<void,VISU_Actor*> myDestroySignal;
00244 
00245   vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
00246   bool myIsShrinkable;
00247   bool myIsShrunk;
00248 
00249   vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
00250   vtkSmartPointer<vtkTextActor>  myAnnotationActor;
00251 };
00252 
00253 #endif //VISU_ACTOR_H