Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/visu.git] / src / VISU_I / VISU_GaussPoints_i.hh
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 //  VISU OBJECT : interactive object for VISU entities implementation
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_ColoredPrs3d_i.hh"
31 #include "VISU_GaussPtsActorFactory.h"
32
33 class VISU_LookupTable;
34 class VISU_ScalarBarActor;
35
36 class VISU_GaussPointsPL;
37
38 #include <QColor>
39
40 namespace VISU
41 {
42   //! Class of the Gauss Points presentation.
43   class VISU_I_EXPORT GaussPoints_i : public virtual POA_VISU::GaussPoints,
44                                       public virtual TGaussPtsActorFactory,
45                                       public virtual ColoredPrs3d_i
46   {
47     static int myNbPresent;
48     GaussPoints_i(const GaussPoints_i&);
49
50   public:
51     //----------------------------------------------------------------------------
52     typedef ColoredPrs3d_i TSuperClass;
53     typedef VISU::GaussPoints TInterface;
54
55     explicit
56     GaussPoints_i(EPublishInStudyMode thePublishInStudyModep);
57
58     virtual
59     ~GaussPoints_i();
60
61     virtual 
62     VISU::VISUType 
63     GetType() 
64     {
65       return VISU::TGAUSSPOINTS;
66     }
67
68     //----------------------------------------------------------------------------
69     //! Gets memory size actually used by the presentation (Mb).
70     virtual
71     CORBA::Float
72     GetMemorySize();
73
74     //----------------------------------------------------------------------------
75     CORBA::Long
76     GetFaceLimit();
77
78     void
79     SetFaceLimit( CORBA::Long theFaceLimit );
80
81     CORBA::Boolean 
82     GetIsDeformed();
83
84     void
85     SetIsDeformed( CORBA::Boolean theIsDeformed );
86
87     CORBA::Double
88     GetScaleFactor();
89
90     void
91     SetScaleFactor( CORBA::Double theScaleFactor );
92
93     //! Get color for Geometry mode of the presentation.
94     SALOMEDS::Color
95     GetColor();
96
97     QColor
98     GetQColor();
99
100     //! Set color for Geometry mode of the presentation.
101     void
102     SetColor( const SALOMEDS::Color& theColor );
103
104     void
105     SetQColor( const QColor& theColor );
106
107     //! Get flag indicating which mode of the presentation is active.
108     /*! When Results mode is active, returns true. Geometry - false. */
109     bool 
110     GetIsColored();
111
112     //! Get flag indicating which mode of the presentation is active.
113     void
114     SetIsColored( bool theIsColored );
115
116     //! Set path to the image using for Main Point Sprite texture.
117     bool
118     SetMainTexture( const QString& theMainTexture );
119
120     //! Get path to the image using for Main Point Sprite texture.
121     QString
122     GetQMainTexture();
123
124     char*
125     GetMainTexture();
126
127     //! Set path to the image using for Alpha Point Sprite texture.
128     bool
129     SetAlphaTexture( const QString& theAlphaTexture );
130
131     //! Get path to the image using for Alpha Point Sprite texture.
132     QString
133     GetQAlphaTexture();
134
135     char*
136     GetAlphaTexture();
137
138     //! Convert Main and AlphaMask images to VTI format and set them to pipeline.
139     void
140     SetQTextures( const QString& theMainTexture,
141                   const QString& theAlphaTexture );
142
143     void
144     SetTextures( const char* theMainTexture, 
145                  const char* theAlphaTexture );
146
147     //! Redirect the request to VISU_GaussPointsPL::SetAlphaThreshold.
148     void
149     SetAlphaThreshold(CORBA::Double theAlphaThreshold);
150
151     //! Redirect the request to VISU_GaussPointsPL::GetAlphaThreshold.
152     CORBA::Double
153     GetAlphaThreshold();
154
155     //! Redirect the request to VISU_GaussPointsPL::SetResolution.
156     void
157     SetResolution(CORBA::Long theResolution);
158
159     //! Redirect the request to VISU_GaussPointsPL::GetResolution.
160     CORBA::Long
161     GetResolution();
162
163     void
164     SetPrimitiveType(VISU::GaussPoints::PrimitiveType thePrimitiveType);
165
166     VISU::GaussPoints::PrimitiveType
167     GetPrimitiveType();
168
169     //! Redirect the request to VISU_GaussPointsPL::GetMaximumSupportedSize.
170     vtkFloatingPointType 
171     GetMaximumSupportedSize();
172
173     //! Redirect the request to VISU_GaussPointsPL::SetClamp.
174     void
175     SetClamp(CORBA::Double theClamp);
176
177     //! Redirect the request to VISU_GaussPointsPL::GetClamp.
178     CORBA::Double
179     GetClamp();
180
181     //! Redirect the request to VISU_GaussPointsPL::SetSize.
182     void
183     SetGeomSize(CORBA::Double theGeomSize);
184
185     //! Redirect the request to VISU_GaussPointsPL::GetSize.
186     CORBA::Double 
187     GetGeomSize();
188
189     //! Redirect the request to VISU_GaussPointsPL::SetMinSize.
190     void
191     SetMinSize(CORBA::Double theMinSize);
192
193     //! Redirect the request to VISU_GaussPointsPL::GetMinSize.
194     CORBA::Double 
195     GetMinSize();
196
197     //! Redirect the request to VISU_GaussPointsPL::SetMaxSize.
198     void
199     SetMaxSize(CORBA::Double theMaxSize);
200
201     //! Redirect the request to VISU_GaussPointsPL::GetMaxSize.
202     CORBA::Double 
203     GetMaxSize();
204
205     //! Redirect the request to VISU_GaussPointsPL::SetMagnification.
206     void
207     SetMagnification(CORBA::Double theMagnification);
208
209     //! Redirect the request to VISU_GaussPointsPL::GetMagnification.
210     CORBA::Double
211     GetMagnification();
212
213     //! Redirect the request to VISU_GaussPointsPL::SetMagnificationIncrement.
214     void
215     SetMagnificationIncrement(CORBA::Double theIncrement);
216
217     //! Redirect the request to VISU_GaussPointsPL::GetMagnificationIncrement.
218     CORBA::Double
219     GetMagnificationIncrement();
220
221     //! Set flag indicating which scalar bar is active.
222     void
223     SetIsActiveLocalScalarBar(CORBA::Boolean theIsActiveLocalScalarBar);
224
225     //! Get flag indicating which scalar bar is active.
226     CORBA::Boolean
227     GetIsActiveLocalScalarBar();
228
229     //! Set flag indicating visibility of global scalar bar.
230     void
231     SetIsDispGlobalScalarBar(CORBA::Boolean theIsDispGlobalScalarBar);
232
233     //! Get flag indicating visibility of global scalar bar.
234     CORBA::Boolean
235     GetIsDispGlobalScalarBar();
236
237     //! Redirect the request to VISU_GaussPointsPL::SetBicolor.
238     void
239     SetBiColor(CORBA::Boolean theIsBiColor);
240
241     //! Redirect the request to VISU_GaussPointsPL::GetBicolor.
242     CORBA::Boolean
243     GetBiColor();
244
245     //! Set value of the distance between global and local scalar bars.
246     void
247     SetSpacing(CORBA::Double theSpacing);
248
249     //! Get value of the distance between global and local scalar bars.
250     CORBA::Double
251     GetSpacing();
252
253     //! Let know is the global range is already calculated
254     bool
255     IsGlobalRangeDefined() const;
256
257     virtual
258     CORBA::Double 
259     GetSourceMin();
260
261     virtual
262     CORBA::Double 
263     GetSourceMax();
264
265     virtual 
266     void
267     SetSourceRange();
268
269     VISU_GaussPointsPL* 
270     GetSpecificPL() const
271     { 
272       return myGaussPointsPL; 
273     }
274
275     //----------------------------------------------------------------------------
276     //! Sets initial source geometry
277     virtual
278     void
279     SetSourceGeometry();
280
281     //! Add geometry of mesh as group. \retval the id of added group.
282     virtual 
283     void
284     AddMeshOnGroup(const char* theGroupName);
285     
286     //! Removes all geometries.
287     virtual
288     void
289     RemoveAllGeom();
290
291     virtual
292     vtkFloatingPointType
293     GetComponentMin(vtkIdType theCompID);
294
295     virtual
296     vtkFloatingPointType
297     GetComponentMax(vtkIdType theCompID);
298     
299   protected:
300     //! Redefines VISU_ColoredPrs3d_i::DoSetInput
301     virtual
302     void
303     DoSetInput(bool theIsInitilizePipe, bool theReInit);
304
305     //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine
306     virtual
307     void
308     CreatePipeLine(VISU_PipeLine* thePipeLine);
309
310     //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible
311     virtual 
312     bool 
313     CheckIsPossible();
314
315     virtual 
316     const char* 
317     GetIconName();
318
319     virtual 
320     VISU_PipeLine* 
321     GetActorPipeLine();
322     
323     bool
324     OnCreateActor(VISU_GaussPtsAct* theActor);
325
326     VISU_GaussPtsAct1* 
327     OnCreateActor1();
328
329     VISU_GaussPtsAct2* 
330     OnCreateActor2();
331
332     void
333     UpdateScalarBar(VISU_ScalarBarActor *theScalarBar,
334                     VISU_LookupTable* theLookupTable);
335
336   protected:
337     VISU_GaussPointsPL *myGaussPointsPL;
338     
339     bool myIsDispGlobalScalarBar;
340     bool myIsActiveLocalScalarBar;
341     QColor myColor;
342     vtkFloatingPointType mySpacing;
343     int myFaceLimit;
344
345     QString myMainTexture;
346     QString myAlphaTexture;
347
348   public:
349     static 
350     size_t
351     IsPossible(Result_i* theResult, 
352                const std::string& theMeshName, 
353                VISU::Entity theEntity,
354                const std::string& theFieldName, 
355                CORBA::Long theTimeStampNumber,
356                bool theIsMemoryCheck);
357     virtual
358     Storable* 
359     Create(const std::string& theMeshName, 
360            VISU::Entity theEntity,
361            const std::string& theFieldName, 
362            CORBA::Long theTimeStampNumber);
363
364     virtual 
365     void
366     SameAs(const Prs3d_i* theOrigin);
367
368     static const std::string myComment;
369
370     virtual
371     const char* 
372     GetComment() const;
373
374     virtual
375     QString
376     GenerateName();
377
378     virtual
379     void
380     ToStream(std::ostringstream& theStr);
381
382     virtual 
383     Storable* 
384     Restore(SALOMEDS::SObject_ptr theSObject,
385             const Storable::TRestoringMap& theMap);
386
387     //----------------------------------------------------------------------------
388     virtual 
389     VISU_Actor* 
390     CreateActor();
391
392     virtual 
393     VISU_GaussPtsAct2* 
394     CloneActor(VISU_GaussPtsAct1* theActor);
395
396     virtual
397     void
398     UpdateActor(VISU_ActorBase* theActor);
399
400     virtual 
401     void
402     UpdateFromActor(VISU_GaussPtsAct* theActor);
403   };
404 }
405
406 #endif