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