]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_GaussPoints_i.hh
Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VISU_I / VISU_GaussPoints_i.hh
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //  File   : VISU_PrsObject_i.hxx
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef VISU_GaussPoints_i_HeaderFile
28 #define VISU_GaussPoints_i_HeaderFile
29
30 #include "VISU_Result_i.hh"
31 #include "VISU_ColoredPrs3d_i.hh"
32 #include "VISU_GaussPtsActorFactory.h"
33
34 class vtkLookupTable;
35 class vtkScalarBarActor;
36
37 class VISU_GaussPointsPL;
38
39 namespace VISU
40 {
41   //! Class of the Gauss Points presentation.
42   class GaussPoints_i : public virtual POA_VISU::GaussPoints,
43                         public virtual VISU::TGaussPtsActorFactory,
44                         public virtual MinMaxCunsomer,
45                         public virtual ColoredPrs3d_i
46   {
47     static int myNbPresent;
48     GaussPoints_i();
49     GaussPoints_i(const GaussPoints_i&);
50
51   public:
52     //----------------------------------------------------------------------------
53     typedef ColoredPrs3d_i TSuperClass;
54
55     explicit
56     GaussPoints_i(Result_i* theResult,
57                   bool theAddToStudy);
58     explicit
59     GaussPoints_i(Result_i* theResult,
60                   SALOMEDS::SObject_ptr theSObject);
61
62     virtual
63     ~GaussPoints_i();
64
65     virtual 
66     VISU::VISUType 
67     GetType() 
68     {
69       return VISU::TGAUSSPOINTS;
70     }
71
72     typedef VISU::GaussPoints TInterface;
73
74     //! Get the Gauss Points Pipeline.
75     VISU_GaussPointsPL* 
76     GetGaussPointsPL();
77
78     int
79     GetFaceLimit() { return myFaceLimit; }
80
81     void
82     SetFaceLimit( int theFaceLimit ) { myFaceLimit = theFaceLimit; }
83
84     bool 
85     GetIsDeformed();
86
87     void
88     SetIsDeformed( bool theIsDeformed );
89
90     float
91     GetScaleFactor();
92
93     void
94     SetScaleFactor( float theScaleFactor );
95
96     //! Get color for Geometry mode of the presentation.
97     QColor
98     GetColor() { return myColor; }
99
100     //! Set color for Geometry mode of the presentation.
101     void
102     SetColor( const QColor& theColor ) { myColor = theColor; }
103
104     //! Get flag indicating which mode of the presentation is active.
105     /*! When Results mode is active, returns true. Geometry - false. */
106     bool 
107     GetIsColored() { return myIsColored; }
108
109     //! Get flag indicating which mode of the presentation is active.
110     void
111     SetIsColored( bool theIsColored );
112
113     //! Set path to the image using for Main Point Sprite texture.
114     bool
115     SetMainTexture( const QString& theMainTexture );
116
117     //! Get path to the image using for Main Point Sprite texture.
118     const QString&
119     GetMainTexture();
120
121     //! Set path to the image using for Alpha Point Sprite texture.
122     bool
123     SetAlphaTexture( const QString& theAlphaTexture );
124
125     //! Get path to the image using for Alpha Point Sprite texture.
126     const QString&
127     GetAlphaTexture();
128
129     //! Convert Main and AlphaMask images to VTI format and set them to pipeline.
130     void
131     SetTextures( const QString& theMainTexture,
132                  const QString& theAlphaTexture );
133
134     //! Redirect the request to VISU_GaussPointsPL::SetAlphaThreshold.
135     void
136     SetAlphaThreshold(float theAlphaThreshold);
137
138     //! Redirect the request to VISU_GaussPointsPL::GetAlphaThreshold.
139     float
140     GetAlphaThreshold();
141
142     //! Redirect the request to VISU_GaussPointsPL::SetResolution.
143     void
144     SetResolution(int theResolution);
145
146     //! Redirect the request to VISU_GaussPointsPL::GetResolution.
147     int
148     GetResolution();
149
150     void
151     SetPrimitiveType(int thePrimitiveType);
152
153     int
154     GetPrimitiveType();
155
156     //! Redirect the request to VISU_GaussPointsPL::GetMaximumSupportedSize.
157     float 
158     GetMaximumSupportedSize();
159
160     //! Redirect the request to VISU_GaussPointsPL::SetClamp.
161     void
162     SetClamp(float theClamp);
163
164     //! Redirect the request to VISU_GaussPointsPL::GetClamp.
165     float
166     GetClamp();
167
168     //! Redirect the request to VISU_GaussPointsPL::SetSize.
169     void
170     SetGeomSize(float theGeomSize);
171
172     //! Redirect the request to VISU_GaussPointsPL::GetSize.
173     float 
174     GetGeomSize();
175
176     //! Redirect the request to VISU_GaussPointsPL::SetMinSize.
177     void
178     SetMinSize(float theMinSize);
179
180     //! Redirect the request to VISU_GaussPointsPL::GetMinSize.
181     float 
182     GetMinSize();
183
184     //! Redirect the request to VISU_GaussPointsPL::SetMaxSize.
185     void
186     SetMaxSize(float theMaxSize);
187
188     //! Redirect the request to VISU_GaussPointsPL::GetMaxSize.
189     float 
190     GetMaxSize();
191
192     //! Redirect the request to VISU_GaussPointsPL::SetMagnification.
193     void
194     SetMagnification(float theMagnification);
195
196     //! Redirect the request to VISU_GaussPointsPL::GetMagnification.
197     float
198     GetMagnification();
199
200     //! Redirect the request to VISU_GaussPointsPL::SetMagnificationIncrement.
201     void
202     SetMagnificationIncrement(float theIncrement);
203
204     //! Redirect the request to VISU_GaussPointsPL::GetMagnificationIncrement.
205     float
206     GetMagnificationIncrement();
207
208     //! Set flag indicating which scalar bar is active.
209     void
210     SetIsActiveLocalScalarBar(const bool theFlag);
211
212     //! Get flag indicating which scalar bar is active.
213     bool
214     GetIsActiveLocalScalarBar() const;
215
216     //! Set flag indicating visibility of global scalar bar.
217     void
218     SetIsDispGlobalScalarBar(const bool theFlag);
219
220     //! Get flag indicating visibility of global scalar bar.
221     bool
222     GetIsDispGlobalScalarBar() const;
223
224     //! Redirect the request to VISU_GaussPointsPL::SetBicolor.
225     void
226     SetBiColor(bool theIsBiColor);
227
228     //! Redirect the request to VISU_GaussPointsPL::GetBicolor.
229     bool
230     GetBiColor();
231
232     //! Set value of the distance between global and local scalar bars.
233     void
234     SetSpacing(const float theSpacing);
235
236     //! Get value of the distance between global and local scalar bars.
237     float
238     GetSpacing() const;
239
240     //! Let know is the global range is already calculated
241     bool
242     IsGlobalRangeDefined() const;
243
244     //! To update the min / max automatically
245     virtual
246     void
247     UpdateMinMax();
248
249   protected:
250     virtual
251     void
252     DoSetInput(Result_i* theResult);
253
254     virtual
255     void
256     DoHook();
257
258     virtual 
259     VISU_PipeLine* 
260     GetPipeLine();
261     
262     bool
263     OnCreateActor(VISU_GaussPtsAct* theActor,
264                   const Handle(SALOME_InteractiveObject)& theIO = NULL);
265
266     VISU_GaussPtsAct1* 
267     OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO = NULL);
268
269     VISU_GaussPtsAct2* 
270     OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO = NULL);
271
272     void
273     UpdateScalarBar(vtkScalarBarActor *theScalarBar,
274                     vtkLookupTable* theLookupTable);
275
276
277     VISU_GaussPointsPL *myGaussPointsPL;
278
279     bool myIsColored;
280     bool myIsDispGlobalScalarBar;
281     bool myIsActiveLocalScalarBar;
282     QColor myColor;
283     float mySpacing;
284     int myFaceLimit;
285
286     QString myMainTexture;
287     QString myAlphaTexture;
288
289   public:
290     static 
291     int
292     IsPossible(Result_i* theResult, 
293                const char* theMeshName, 
294                VISU::Entity theEntity,
295                const char* theFieldName, 
296                int theIteration, 
297                int isMemoryCheck = true);
298     virtual
299     Storable* 
300     Create(const char* theMeshName, 
301            VISU::Entity theEntity,
302            const char* theFieldName, 
303            int theIteration);
304
305     static const std::string myComment;
306
307     virtual
308     const char* 
309     GetComment() const;
310
311     virtual
312     QString
313     GenerateName();
314
315     virtual
316     void
317     ToStream(std::ostringstream& theStr);
318
319     virtual 
320     Storable* 
321     Restore(const Storable::TRestoringMap& theMap);
322
323     //----------------------------------------------------------------------------
324     virtual 
325     VISU_Actor* 
326     CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
327
328     virtual 
329     VISU_GaussPtsAct2* 
330     CloneActor(VISU_GaussPtsAct1* theActor);
331
332     virtual
333     void
334     UpdateActor(VISU_Actor* theActor);
335
336     virtual 
337     void
338     UpdateFromActor(VISU_GaussPtsAct* theActor);
339   };
340 }
341
342 #endif
343