]> SALOME platform Git repositories - modules/visu.git/blob - src/OBJECT/VISU_GaussPtsDeviceActor.h
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / OBJECT / VISU_GaussPtsDeviceActor.h
1 //  SMESH OBJECT : interactive object for SMESH visualization
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 : 
27 //  $Header$
28
29 #ifndef VISU_GAUSS_PTS_DEVICE_ACTOR_H
30 #define VISU_GAUSS_PTS_DEVICE_ACTOR_H
31
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
47
48 //============================================================================
49 namespace VISU
50 {
51   typedef vtkSmartPointer<vtkImageData> TTextureValue;
52
53   VTKOCC_EXPORT
54   TTextureValue
55   GetTexture(const std::string& theMainTexture, 
56              const std::string& theAlphaTexture);
57 }
58
59
60 //============================================================================
61 class VISU_GaussDeviceActorBase: public vtkLODActor
62 {
63  public:
64   vtkTypeMacro(VISU_GaussDeviceActorBase, vtkLODActor);
65   
66   static 
67   VISU_GaussDeviceActorBase* 
68   New();
69
70   virtual
71   void
72   Render(vtkRenderer *, vtkMapper *);
73
74   //----------------------------------------------------------------------------
75   void
76   SetTransform(VTKViewer_Transform* theTransform); 
77
78   //----------------------------------------------------------------------------
79   void
80   SetPointSpriteMapper(VISU_OpenGLPointSpriteMapper* theMapper) ;
81
82   virtual
83   void
84   DoMapperShallowCopy( vtkMapper* theMapper,
85                        bool theIsCopyInput );
86
87   VISU_OpenGLPointSpriteMapper*
88   GetPointSpriteMapper();
89
90   //----------------------------------------------------------------------------
91   //! Gets memory size used by the instance (bytes).
92   virtual
93   unsigned long int
94   GetMemorySize();
95  
96  protected:
97   //----------------------------------------------------------------------------
98   vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myMapper;
99   vtkSmartPointer<VTKViewer_TransformFilter> myTransformFilter;
100
101   typedef vtkSmartPointer<vtkPassThroughFilter> PPassThroughFilter;
102   std::vector<PPassThroughFilter> myPassFilter;
103
104   VISU_GaussDeviceActorBase();
105   ~VISU_GaussDeviceActorBase();
106
107  private:
108   VISU_GaussDeviceActorBase(const VISU_GaussDeviceActorBase&); // Not implemented
109   void operator=(const VISU_GaussDeviceActorBase&); // Not implemented
110 };
111
112
113 //============================================================================
114 class VISU_GaussPtsDeviceActor: public VISU_GaussDeviceActorBase
115 {
116  public:
117   vtkTypeMacro(VISU_GaussPtsDeviceActor, VISU_GaussDeviceActorBase);
118
119   static 
120   VISU_GaussPtsDeviceActor* 
121   New();
122
123   //----------------------------------------------------------------------------
124   void
125   AddToRender(vtkRenderer* theRenderer); 
126
127   void
128   RemoveFromRender(vtkRenderer* theRenderer);
129
130   //----------------------------------------------------------------------------
131   VISU_GaussPointsPL* 
132   GetPipeLine();
133
134   void
135   SetPipeLine(VISU_GaussPointsPL* thePipeLine) ;
136
137   void
138   ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
139
140   virtual
141   int
142   GetPickable();
143
144   //----------------------------------------------------------------------------
145   //! Gets memory size used by the instance (bytes).
146   virtual
147   unsigned long int
148   GetMemorySize();
149  
150  protected:
151   //----------------------------------------------------------------------------
152   vtkSmartPointer<VISU_GaussPointsPL> myPipeLine;
153
154   VISU_GaussPtsDeviceActor();
155   ~VISU_GaussPtsDeviceActor();
156
157  private:
158   VISU_GaussPtsDeviceActor(const VISU_GaussPtsDeviceActor&); // Not implemented
159   void operator=(const VISU_GaussPtsDeviceActor&); // Not implemented
160 };
161
162
163 //============================================================================
164 class vtkActor;
165 class vtkConeSource;
166 class vtkAppendPolyData;
167 class vtkPolyDataMapper;
168
169 #include <vtkLODActor.h>
170
171 class VISU_CursorPyramid : public vtkLODActor 
172 {
173 public:
174   vtkTypeMacro(VISU_CursorPyramid, vtkObject);
175
176   static
177   VISU_CursorPyramid* 
178   New();
179
180   virtual
181   void
182   Render(vtkRenderer *, vtkMapper *);
183
184   void
185   AddToRender(vtkRenderer* theRenderer);
186
187   void
188   RemoveFromRender(vtkRenderer* theRenderer);
189
190   void
191   Init(vtkFloatingPointType theHeight,
192        vtkFloatingPointType theCursorSize,
193        vtkFloatingPointType theRadius,
194        vtkFloatingPointType theMagnification,
195        vtkFloatingPointType theClamp,
196        vtkFloatingPointType thePos[3],
197        vtkFloatingPointType theColor[3]);
198
199   void SetPreferences(vtkFloatingPointType theHeight,
200                       vtkFloatingPointType theCursorSize);
201
202 protected:
203   VISU_CursorPyramid();
204
205   void
206   Init(vtkFloatingPointType theHeight,
207        vtkFloatingPointType theRadius);
208
209   int myNbCones;
210   vtkSmartPointer<vtkConeSource> mySources[6];
211   vtkSmartPointer<vtkAppendPolyData> myAppendFilter;
212   vtkSmartPointer<vtkPolyDataMapper> myMapper;
213   //
214   vtkFloatingPointType myHeight;
215   vtkFloatingPointType myCursorSize;
216   vtkFloatingPointType myRadius;
217   vtkFloatingPointType myMagnification;
218   vtkFloatingPointType myClamp;
219
220  private:
221   VISU_CursorPyramid(const VISU_CursorPyramid&); // Not implemented
222   void operator=(const VISU_CursorPyramid&); // Not implemented
223 };
224
225
226 //==================================================================
227 // class VISU_FramedTextActor
228 //
229 #include <vtkActor2D.h>
230 //
231 class vtkViewport;
232 class vtkProp;
233 class vtkWindow;
234 class vtkPolyData;
235 class vtkPolyDataMapper2D;
236 class vtkActor2D;
237 class vtkTimeStamp;
238 class vtkTextProperty;
239 class vtkTextMapper;
240
241 class VISU_FramedTextActor : public vtkActor2D
242 {
243 public:
244   // vtks
245   vtkTypeRevisionMacro(VISU_FramedTextActor,vtkActor2D);
246   static VISU_FramedTextActor *New();
247   //
248   virtual int  RenderOpaqueGeometry(vtkViewport* viewport);
249   virtual int  RenderTranslucentGeometry(vtkViewport*) { return 0; };
250   virtual int  RenderOverlay(vtkViewport* viewport);
251   virtual void ReleaseGraphicsResources(vtkWindow *);
252   virtual void SetVisibility (int );
253   virtual int  GetVisibility() ;
254   virtual void SetPickable (int ) ;
255   virtual int GetPickable();
256   //
257   // selectors
258   void SetText(const char* theText);
259   char* GetText();
260   //
261   void SetModePosition(const int theMode);
262   int  GetModePosition()const;
263   //
264   void SetWorldPoint(const vtkFloatingPointType theWorldPoint[4]);
265   const vtkFloatingPointType* GetWorldPoint()const;
266   //
267   void  SetDistance(const vtkFloatingPointType theDistance);
268   vtkFloatingPointType GetDistance()const;
269   //
270   void  SetTransparency(const vtkFloatingPointType theTransparency);
271   vtkFloatingPointType GetTransparency()const;
272   //
273 protected:
274   VISU_FramedTextActor();
275   ~VISU_FramedTextActor();
276
277 protected:
278   vtkPolyData         *myBar;
279   vtkPolyDataMapper2D *myBarMapper;
280   vtkActor2D          *myBarActor;
281   //
282   vtkTextProperty *myTextProperty;
283   vtkTextMapper   *myTextMapper;
284   vtkActor2D      *myTextActor;
285   //
286   vtkTimeStamp  myBuildTime;
287   //
288   int   myModePosition;
289   vtkFloatingPointType myWorldPoint[4];
290   vtkFloatingPointType myDistance;
291   vtkFloatingPointType myTransparency;
292   
293 private:
294  VISU_FramedTextActor(const VISU_FramedTextActor&);  // Not implemented.
295   void operator=(const VISU_FramedTextActor&);  // Not implemented.
296 };
297
298 #endif //VISU_GAUSS_PTS_DEVICE_ACTOR_H