Salome HOME
Fix for Bug IPAL8945
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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 "VTKViewer_GeometryFilter.h"
33
34 #include <vtkLODActor.h>
35 #include <vtkSmartPointer.h>
36
37 class VTKViewer_Transform;
38 class VTKViewer_TransformFilter;
39 class VTKViewer_PassThroughFilter;
40
41 class VISU_OpenGLPointSpriteMapper;
42 class VISU_GaussPointsPL;
43
44
45 //============================================================================
46 class VISU_GaussPtsDeviceActor: public vtkLODActor
47 {
48  public:
49   vtkTypeMacro(VISU_GaussPtsDeviceActor,vtkLODActor);
50
51   static 
52   VISU_GaussPtsDeviceActor* 
53   New();
54
55   virtual
56   void
57   Render(vtkRenderer *, vtkMapper *);
58
59   //----------------------------------------------------------------------------
60   void
61   AddToRender(vtkRenderer* theRenderer); 
62
63   void
64   RemoveFromRender(vtkRenderer* theRenderer);
65
66   void
67   SetTransform(VTKViewer_Transform* theTransform); 
68
69   //----------------------------------------------------------------------------
70   VISU_GaussPointsPL* 
71   GetPipeLine();
72
73   void
74   SetPipeLine(VISU_GaussPointsPL* thePipeLine) ;
75
76   void
77   ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
78
79   VISU_OpenGLPointSpriteMapper*
80   GetPSMapper();
81
82  protected:
83   //----------------------------------------------------------------------------
84   vtkSmartPointer<VISU_GaussPointsPL> myPipeLine;
85   vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myMapper;
86   vtkSmartPointer<VTKViewer_GeometryFilter> myGeomFilter;
87   vtkSmartPointer<VTKViewer_TransformFilter> myTransformFilter;
88
89   typedef vtkSmartPointer<VTKViewer_PassThroughFilter> PPassThroughFilter;
90   std::vector<PPassThroughFilter> myPassFilter;
91
92   VISU_GaussPtsDeviceActor();
93   ~VISU_GaussPtsDeviceActor();
94
95  private:
96   VISU_GaussPtsDeviceActor(const VISU_GaussPtsDeviceActor&); // Not implemented
97   void operator=(const VISU_GaussPtsDeviceActor&); // Not implemented
98 };
99
100
101 //============================================================================
102 class vtkActor;
103 class vtkConeSource;
104 class vtkAppendPolyData;
105 class vtkPolyDataMapper;
106
107 #include <vtkLODActor.h>
108
109 class VISU_CursorPyramid : public vtkLODActor 
110 {
111 public:
112   vtkTypeMacro(VISU_CursorPyramid, vtkObject);
113
114   static
115   VISU_CursorPyramid* 
116   New();
117
118   virtual
119   void
120   Render(vtkRenderer *, vtkMapper *);
121
122   void
123   AddToRender(vtkRenderer* theRenderer);
124
125   void
126   RemoveFromRender(vtkRenderer* theRenderer);
127
128   void
129   Init(float theHeight,
130        float theCursorSize,
131        float theRadius,
132        float theMagnification,
133        float theClamp,
134        float thePos[3],
135        float theColor[3]);
136
137   void SetPreferences(float theHeight,
138                       float theCursorSize);
139
140 protected:
141   VISU_CursorPyramid();
142
143   void
144   Init(float theHeight,
145        float theRadius);
146
147   int myNbCones;
148   vtkSmartPointer<vtkConeSource> mySources[6];
149   vtkSmartPointer<vtkAppendPolyData> myAppendFilter;
150   vtkSmartPointer<vtkPolyDataMapper> myMapper;
151   //
152   float myHeight;
153   float myCursorSize;
154   float myRadius;
155   float myMagnification;
156   float myClamp;
157
158  private:
159   VISU_CursorPyramid(const VISU_CursorPyramid&); // Not implemented
160   void operator=(const VISU_CursorPyramid&); // Not implemented
161 };
162
163
164 //==================================================================
165 // class VISU_FramedTextActor
166 //
167 #include <vtkActor2D.h>
168 //
169 class vtkViewport;
170 class vtkProp;
171 class vtkWindow;
172 class vtkPolyData;
173 class vtkPolyDataMapper2D;
174 class vtkActor2D;
175 class vtkTimeStamp;
176 class vtkTextProperty;
177 class vtkTextMapper;
178
179 class VISU_FramedTextActor : public vtkActor2D
180 {
181 public:
182   // vtks
183   vtkTypeRevisionMacro(VISU_FramedTextActor,vtkActor2D);
184   static VISU_FramedTextActor *New();
185   //
186   virtual int  RenderOpaqueGeometry(vtkViewport* viewport);
187   virtual int  RenderTranslucentGeometry(vtkViewport*) { return 0; };
188   virtual int  RenderOverlay(vtkViewport* viewport);
189   virtual void ReleaseGraphicsResources(vtkWindow *);
190   virtual void SetVisibility (int );
191   virtual int  GetVisibility() ;
192   virtual void SetPickable (int ) ;
193   virtual int GetPickable();
194   //
195   // selectors
196   void SetText(const char* theText);
197   char* GetText();
198   //
199   void SetModePosition(const int theMode);
200   int  GetModePosition()const;
201   //
202   void SetWorldPoint(const float theWorldPoint[4]);
203   const float* GetWorldPoint()const;
204   //
205   void  SetDistance(const float theDistance);
206   float GetDistance()const;
207   //
208   void  SetTransparency(const float theTransparency);
209   float GetTransparency()const;
210   //
211 protected:
212   VISU_FramedTextActor();
213   ~VISU_FramedTextActor();
214
215 protected:
216   vtkPolyData         *myBar;
217   vtkPolyDataMapper2D *myBarMapper;
218   vtkActor2D          *myBarActor;
219   //
220   vtkTextProperty *myTextProperty;
221   vtkTextMapper   *myTextMapper;
222   vtkActor2D      *myTextActor;
223   //
224   vtkTimeStamp  myBuildTime;
225   //
226   int   myModePosition;
227   float myWorldPoint[4];
228   float myDistance;
229   float myTransparency;
230   
231 private:
232  VISU_FramedTextActor(const VISU_FramedTextActor&);  // Not implemented.
233   void operator=(const VISU_FramedTextActor&);  // Not implemented.
234 };
235
236 #endif //VISU_GAUSS_PTS_DEVICE_ACTOR_H