]> SALOME platform Git repositories - modules/visu.git/blob - src/OBJECT/VISU_Actor.h
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / OBJECT / VISU_Actor.h
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //
23 //
24 //  File   : 
25 //  Author : 
26 //  Module : VISU
27 //  $Header$
28
29 #ifndef VISU_ACTOR_H
30 #define VISU_ACTOR_H
31
32 #include "SALOME_Actor.h"
33 #include "VISU_ActorFactory.h"
34 #include "VISU_BoostSignals.h"
35 #include "SVTK_DeviceActor.h"
36
37 #include <string>
38 #include <vtkTimeStamp.h>
39 #include <vtkSmartPointer.h>
40
41 class vtkProp;
42 class vtkProperty;
43 class vtkTextMapper;
44 class vtkTextActor;
45 class vtkInteractorStyle;
46 class VTKViewer_ShrinkFilter;
47 class VISU_PipeLine;
48
49 #ifdef _WIN32
50 #define VTKOCC_EXPORT __declspec (dllexport)
51 #else
52 #define VTKOCC_EXPORT VTK_EXPORT
53 #endif
54
55 namespace SVTK
56 {
57   namespace Representation
58   {
59     const Type Surfaceframe = Insideframe + 1;
60   }
61 }
62
63 namespace VISU 
64 {
65   class Prs3d_i;
66 }
67
68 //----------------------------------------------------------------------------
69 class VTKOCC_EXPORT VISU_Actor : 
70   public SALOME_Actor,
71   public boost::signalslib::trackable
72 {
73  public:
74   vtkTypeMacro(VISU_Actor,SALOME_Actor);
75
76   //static 
77   //VISU_Actor* 
78   //New();
79
80   //! Copies all properties from the given actor
81   virtual
82   void
83   DeepCopy(VISU_Actor *theActor);
84
85   virtual
86   void
87   ShallowCopyPL(VISU_PipeLine* thePipeLine);
88
89   //----------------------------------------------------------------------------
90   virtual
91   void
92   setIO(const Handle(SALOME_InteractiveObject)& theIO);
93
94   //----------------------------------------------------------------------------
95   VISU::Prs3d_i* 
96   GetPrs3d();
97
98   virtual
99   void
100   SetPrs3d(VISU::Prs3d_i* thePrs3d);
101
102   //----------------------------------------------------------------------------
103   VISU::TActorFactory* 
104   GetFactory();
105
106   virtual
107   void
108   SetFactory(VISU::TActorFactory* theActorFactory);
109
110   //----------------------------------------------------------------------------
111   virtual
112   void
113   UpdateFromFactory();
114
115   virtual
116   void
117   RemoveFromRender();
118
119   //----------------------------------------------------------------------------
120   virtual
121   VISU_PipeLine* 
122   GetPipeLine();
123
124   virtual 
125   void
126   SetPipeLine(VISU_PipeLine* thePipeLine);
127
128   //----------------------------------------------------------------------------
129   virtual
130   void
131   SetRepresentation(int theMode);
132
133   //----------------------------------------------------------------------------
134   virtual
135   bool
136   IsShrunkable();
137
138   virtual
139   bool
140   IsShrunk();
141
142   virtual
143   void
144   SetShrink();
145
146   virtual
147   void
148   UnShrink(); 
149
150   virtual
151   void
152   SetShrinkable(bool theIsShrinkable);
153
154   virtual
155   void
156   SetShrinkFactor(vtkFloatingPointType theFactor = 0.8); 
157
158   virtual
159   vtkFloatingPointType
160   GetShrinkFactor();
161
162   //----------------------------------------------------------------------------
163   virtual
164   void
165   SetOpacity(vtkFloatingPointType theValue);
166
167   virtual
168   vtkFloatingPointType
169   GetOpacity();
170
171   virtual
172   void
173   SetLineWidth(vtkFloatingPointType theLineWidth);
174
175   virtual
176   vtkFloatingPointType
177   GetLineWidth();
178  
179   //----------------------------------------------------------------------------
180   virtual
181   void
182   AddToRender( vtkRenderer* ); 
183
184   virtual
185   void
186   RemoveFromRender( vtkRenderer* );
187
188   //----------------------------------------------------------------------------
189   virtual
190   bool
191   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
192                SVTK_SelectionEvent* theSelectionEvent,
193                bool theIsHighlight);
194
195   virtual
196   void 
197   SetVTKMapping(bool theIsVTKMapping); 
198
199   virtual
200   bool 
201   IsVTKMapping() const;
202
203   virtual
204   vtkDataSet* 
205   GetInput(); 
206
207   //! Gets memory size used by the instance (bytes).
208   virtual
209   unsigned long int
210   GetMemorySize();
211  
212   //----------------------------------------------------------------------------
213   virtual
214   vtkIdType
215   GetNodeObjId(vtkIdType theID);
216
217   virtual
218   vtkIdType
219   GetNodeVTKID(vtkIdType theID);
220
221   virtual
222   vtkFloatingPointType* 
223   GetNodeCoord(vtkIdType theObjID);
224
225   virtual
226   vtkIdType
227   GetElemObjId(vtkIdType theID);
228
229   virtual
230   vtkIdType
231   GetElemVTKID(vtkIdType theID);
232
233   virtual
234   vtkCell* 
235   GetElemCell(vtkIdType theObjID);
236
237   //----------------------------------------------------------------------------
238  protected:
239   VISU_Actor();
240
241   virtual
242   ~VISU_Actor();
243  
244   virtual 
245   void
246   SetMapperInput(vtkDataSet* theDataSet) = 0;
247
248   virtual
249   VISU_PipeLine* 
250   GetCurrentPL();
251
252   //----------------------------------------------------------------------------
253   bool myIsVTKMapping;
254   VISU::Prs3d_i* myPrs3d;
255   vtkSmartPointer<VISU_PipeLine> myPipeLine;
256
257   VISU::TActorFactory* myActorFactory;
258   vtkTimeStamp myUpdateFromFactoryTime;
259   boost::signal1<void,VISU_Actor*> myDestroySignal;
260
261   vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
262   bool myIsShrinkable;
263   bool myIsShrunk;
264
265   vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
266   vtkSmartPointer<vtkTextActor>  myAnnotationActor;
267 };
268
269 #endif //VISU_ACTOR_H