Salome HOME
Merge from BR_WIN_INDUS_514 branch 21/03/2011 (Windows industrialization)
[modules/visu.git] / src / OBJECT / VISU_ActorBase.h
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  VISU OBJECT : interactive object for VISU entities implementation
21 //  File   : 
22 //  Author : 
23 //  Module : VISU
24 //  $Header$
25 //
26 #ifndef VISU_ACTOR_BASE_H
27 #define VISU_ACTOR_BASE_H
28
29 #include "VISU_OBJECT.h"
30 #include "SALOME_Actor.h"
31 #include "VISU_BoostSignals.h"
32 #include <boost/bind.hpp>
33
34 class VTKViewer_ShrinkFilter;
35
36 //----------------------------------------------------------------------------
37 namespace VISU 
38
39   struct TActorFactory;
40 }
41
42
43 //! This class defines an abstaract interface to manage actors
44 class VISU_OBJECT_EXPORT VISU_ActorBase: public SALOME_Actor,
45                                     public boost::signalslib::trackable
46 {
47  public:
48   vtkTypeMacro(VISU_ActorBase, SALOME_Actor);
49
50   //----------------------------------------------------------------------------
51   VISU::TActorFactory* GetFactory();
52   virtual void SetFactory(VISU::TActorFactory* theActorFactory);
53   
54   //----------------------------------------------------------------------------
55   virtual void UpdateFromFactory();
56
57   //----------------------------------------------------------------------------
58
59   virtual void SetLineWidth(vtkFloatingPointType theLineWidth);
60   virtual vtkFloatingPointType GetLineWidth();
61
62   virtual void SetShrink();
63   virtual void UnShrink(); 
64   virtual bool IsShrunkable();
65   virtual bool IsShrunk();
66   virtual void SetShrinkable(bool theIsShrinkable);
67
68   virtual void SetShrinkFactor(vtkFloatingPointType theFactor = 0.8); 
69   virtual vtkFloatingPointType GetShrinkFactor();
70   
71   virtual void SetRepresentation(int theMode);
72
73   virtual void RemoveFromRender(vtkRenderer* theRenderer);
74   virtual void RemoveFromRender();
75
76   virtual void ConnectToFactory(boost::signal0<void>& , boost::signal0<void>&);
77
78   //----------------------------------------------------------------------------
79   //! Return pointer to the dataset, which used to calculation of the bounding box of the actor
80   //! Redefined from VTKViewer_Actor
81   virtual vtkDataSet* GetHighlightedDataSet();
82   
83
84  protected:
85   VISU_ActorBase();
86   virtual  ~VISU_ActorBase();
87
88   VISU::TActorFactory*                 myActorFactory;
89   vtkTimeStamp                         myUpdateFromFactoryTime;
90   boost::signal1<void,VISU_ActorBase*> myDestroySignal;
91
92   boost::signalslib::connection        myUpdateActorsConnection;
93   boost::signalslib::connection        myRemoveFromRendererConnection;
94
95   vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
96
97   bool myIsShrinkable;
98   bool myIsShrunk;
99 };
100
101 #endif //VISU_ACTOR_BASE_H