Salome HOME
6a9b650125e6efd9b664183be6984be80e871160
[modules/visu.git] / src / OBJECT / VISU_GaussPtsDeviceActor.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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 //  SMESH OBJECT : interactive object for SMESH visualization
23 //  File   : 
24 //  Author : 
25 //  Module : 
26 //  $Header$
27 //
28 #ifndef VISU_GAUSS_PTS_DEVICE_ACTOR_H
29 #define VISU_GAUSS_PTS_DEVICE_ACTOR_H
30
31 #include "VISU_OBJECT.h"
32 #include "VISU_Actor.h"
33 #include "VTKViewer_GeometryFilter.h"
34
35 #include <vtkLODActor.h>
36 #include <vtkSmartPointer.h>
37
38 class VTKViewer_Transform;
39 class VTKViewer_TransformFilter;
40
41 class VISU_OpenGLPointSpriteMapper;
42 class VISU_GaussPointsPL;
43
44 class vtkPassThroughFilter;
45 class vtkImageData;
46 class SALOME_ExtractPolyDataGeometry;
47
48
49 //============================================================================
50 namespace VISU
51 {
52   typedef vtkSmartPointer<vtkImageData> TTextureValue;
53
54   VISU_OBJECT_EXPORT
55   TTextureValue
56   GetTexture(const std::string& theMainTexture, 
57              const std::string& theAlphaTexture);
58 }
59
60
61 //============================================================================
62 class VISU_OBJECT_EXPORT VISU_GaussDeviceActorBase: public vtkLODActor
63 {
64  public:
65   vtkTypeMacro(VISU_GaussDeviceActorBase, vtkLODActor);
66   
67   static 
68   VISU_GaussDeviceActorBase* 
69   New();
70
71   virtual
72   void
73   Render(vtkRenderer *, vtkMapper *);
74
75   //----------------------------------------------------------------------------
76   void
77   SetTransform(VTKViewer_Transform* theTransform); 
78
79   //----------------------------------------------------------------------------
80   void
81   SetPointSpriteMapper(VISU_OpenGLPointSpriteMapper* theMapper) ;
82
83   virtual
84   void
85   DoMapperShallowCopy( vtkMapper* theMapper,
86                        bool theIsCopyInput );
87
88   VISU_OpenGLPointSpriteMapper*
89   GetPointSpriteMapper();
90
91   //----------------------------------------------------------------------------
92   //! Gets memory size used by the instance (bytes).
93   virtual
94   unsigned long int
95   GetMemorySize();
96
97   //----------------------------------------------------------------------------
98   void SetExtractor(SALOME_ExtractPolyDataGeometry* theExtractor) 
99     { myPolyDataExtractor = theExtractor; }
100
101   SALOME_ExtractPolyDataGeometry* GetExtractor() const
102     { return myPolyDataExtractor; }
103  
104  protected:
105   //----------------------------------------------------------------------------
106   vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myMapper;
107   vtkSmartPointer<VTKViewer_TransformFilter> myTransformFilter;
108
109   typedef vtkSmartPointer<vtkPassThroughFilter> PPassThroughFilter;
110   std::vector<PPassThroughFilter> myPassFilter;
111
112   SALOME_ExtractPolyDataGeometry* myPolyDataExtractor;
113
114   VISU_GaussDeviceActorBase();
115   ~VISU_GaussDeviceActorBase();
116
117  private:
118   VISU_GaussDeviceActorBase(const VISU_GaussDeviceActorBase&); // Not implemented
119   void operator=(const VISU_GaussDeviceActorBase&); // Not implemented
120 };
121
122
123 //============================================================================
124 class VISU_GaussPtsDeviceActor: public VISU_GaussDeviceActorBase
125 {
126  public:
127   vtkTypeMacro(VISU_GaussPtsDeviceActor, VISU_GaussDeviceActorBase);
128
129   static 
130   VISU_GaussPtsDeviceActor* 
131   New();
132
133   //----------------------------------------------------------------------------
134   void
135   AddToRender(vtkRenderer* theRenderer); 
136
137   void
138   RemoveFromRender(vtkRenderer* theRenderer);
139
140   //----------------------------------------------------------------------------
141   VISU_GaussPointsPL* 
142   GetPipeLine();
143
144   void
145   SetPipeLine(VISU_GaussPointsPL* thePipeLine) ;
146
147   void
148   ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
149
150   virtual
151   int
152   GetPickable();
153
154   //----------------------------------------------------------------------------
155   //! Gets memory size used by the instance (bytes).
156   virtual
157   unsigned long int
158   GetMemorySize();
159  
160  protected:
161   //----------------------------------------------------------------------------
162   vtkSmartPointer<VISU_GaussPointsPL> myPipeLine;
163
164   VISU_GaussPtsDeviceActor();
165   ~VISU_GaussPtsDeviceActor();
166
167  private:
168   VISU_GaussPtsDeviceActor(const VISU_GaussPtsDeviceActor&); // Not implemented
169   void operator=(const VISU_GaussPtsDeviceActor&); // Not implemented
170 };
171
172
173 //============================================================================
174 class vtkActor;
175 class vtkConeSource;
176 class vtkAppendPolyData;
177 class vtkPolyDataMapper;
178
179 #include <vtkLODActor.h>
180
181 class VISU_CursorPyramid : public vtkLODActor 
182 {
183 public:
184   vtkTypeMacro(VISU_CursorPyramid, vtkObject);
185
186   static
187   VISU_CursorPyramid* 
188   New();
189
190   virtual
191   void
192   Render(vtkRenderer *, vtkMapper *);
193
194   void
195   AddToRender(vtkRenderer* theRenderer);
196
197   void
198   RemoveFromRender(vtkRenderer* theRenderer);
199
200   void
201   Init(vtkFloatingPointType theHeight,
202        vtkFloatingPointType theCursorSize,
203        vtkFloatingPointType theRadius,
204        vtkFloatingPointType theMagnification,
205        vtkFloatingPointType theClamp,
206        vtkFloatingPointType thePos[3],
207        vtkFloatingPointType theColor[3]);
208
209   void SetPreferences(vtkFloatingPointType theHeight,
210                       vtkFloatingPointType theCursorSize);
211
212 protected:
213   VISU_CursorPyramid();
214
215   void
216   Init(vtkFloatingPointType theHeight,
217        vtkFloatingPointType theRadius);
218
219   int myNbCones;
220   vtkSmartPointer<vtkConeSource> mySources[6];
221   vtkSmartPointer<vtkAppendPolyData> myAppendFilter;
222   vtkSmartPointer<vtkPolyDataMapper> myMapper;
223   //
224   vtkFloatingPointType myHeight;
225   vtkFloatingPointType myCursorSize;
226   vtkFloatingPointType myRadius;
227   vtkFloatingPointType myMagnification;
228   vtkFloatingPointType myClamp;
229
230  private:
231   VISU_CursorPyramid(const VISU_CursorPyramid&); // Not implemented
232   void operator=(const VISU_CursorPyramid&); // Not implemented
233 };
234
235
236 #endif //VISU_GAUSS_PTS_DEVICE_ACTOR_H