Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / VISU_I / VISU_GaussPoints_i.cc
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   :
24 //  Author :
25 //  Module :
26
27 #include "VISU_GaussPoints_i.hh"
28 #include "VISU_ScalarMap_i.hh"
29
30 #include "VISU_Result_i.hh"
31 #include "VISU_GaussPtsAct.h"
32 #include "VISU_GaussPointsPL.hxx"
33 #include "VVTK_SegmentationCursorDlg.h"
34
35 #include "VISU_OpenGLPointSpriteMapper.hxx"
36 #include "VISU_ScalarBarCtrl.hxx"
37
38 #include "SUIT_ResourceMgr.h"
39
40 #include <vtkImageData.h>
41 #include <vtkXMLImageDataReader.h>
42 #include <vtkScalarBarActor.h>
43 #include <vtkTextProperty.h>
44 #include <vtkProperty.h>
45
46 using namespace VISU;
47 using namespace std;
48
49 #ifdef _DEBUG_
50 static int MYDEBUG = 0;
51 #else
52 static int MYDEBUG = 0;
53 #endif
54
55 //----------------------------------------------------------------------------
56 int
57 VISU::GaussPoints_i
58 ::IsPossible(Result_i* theResult, 
59              const char* theMeshName, 
60              VISU::Entity theEntity, 
61              const char* theFieldName, 
62              int theIteration, 
63              int isMemoryCheck)
64 {
65   try{
66     if(theEntity != VISU::NODE)
67       return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
68     else
69       return false;
70   }catch(std::exception& exc){
71     INFOS("Follow exception was occured :\n"<<exc.what());
72   }catch(...){
73     INFOS("Unknown exception was occured!");
74   }
75   return 0;
76 }
77
78 //----------------------------------------------------------------------------
79 int VISU::GaussPoints_i::myNbPresent = 0;
80
81 QString 
82 VISU::GaussPoints_i
83 ::GenerateName()
84 {
85   return VISU::GenerateName("Gauss Points",myNbPresent++);
86 }
87
88 //----------------------------------------------------------------------------
89 const string VISU::GaussPoints_i::myComment = "GAUSSPOINTS";
90
91 const char* 
92 VISU::GaussPoints_i
93 ::GetComment() const 
94
95   return myComment.c_str();
96 }
97
98
99 //----------------------------------------------------------------------------
100 VISU::GaussPoints_i::
101 GaussPoints_i(Result_i* theResult, 
102               bool theAddToStudy) : 
103   PrsObject_i(theResult->GetStudyDocument()), 
104   Prs3d_i(theResult,theAddToStudy),
105   ColoredPrs3d_i(theResult,theAddToStudy),
106   myGaussPointsPL(NULL),
107   myIsColored(true),
108   myColor(Qt::blue),
109   myIsActiveLocalScalarBar(true),
110   myIsDispGlobalScalarBar(true),
111   mySpacing(0.01),
112   myFaceLimit(50000)
113 {
114   if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
115 }
116
117
118 //----------------------------------------------------------------------------
119 VISU::GaussPoints_i::
120 GaussPoints_i(Result_i* theResult, 
121               SALOMEDS::SObject_ptr theSObject) : 
122   PrsObject_i(theResult->GetStudyDocument()), 
123   Prs3d_i(theResult,theSObject),
124   ColoredPrs3d_i(theResult,theSObject),
125   myGaussPointsPL(NULL),
126   myIsColored(true),
127   myColor(Qt::blue),
128   myIsActiveLocalScalarBar(true),
129   myIsDispGlobalScalarBar(true),
130   myFaceLimit(50000)
131 {
132   if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
133 }
134
135
136 //----------------------------------------------------------------------------
137 VISU::Storable* 
138 VISU::GaussPoints_i
139 ::Create(const char* theMeshName, 
140          VISU::Entity theEntity, 
141          const char* theFieldName, 
142          int theIteration)
143 {
144   TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
145
146   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
147
148   int anActiveLocal = aResourceMgr->integerValue( "VISU", "scalar_bar_active_local", GetIsActiveLocalScalarBar() );
149   SetIsActiveLocalScalarBar( anActiveLocal == 0 );
150
151   bool aDisplayGlobal = aResourceMgr->booleanValue( "VISU", "scalar_bar_diplay_global", GetIsDispGlobalScalarBar() );
152   SetIsDispGlobalScalarBar( aDisplayGlobal );
153
154   int aBicolor = aResourceMgr->integerValue( "VISU", "scalar_bar_bicolor", GetBiColor() );
155   SetBiColor( aBicolor == 0 );
156
157   vtkFloatingPointType aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() );
158   SetSpacing( aSpacing );
159
160   vtkFloatingPointType aScaleFactor = aResourceMgr->doubleValue( "VISU", "deformed_shape_scale_factor", GetScaleFactor() );
161   SetScaleFactor( aScaleFactor );
162
163   int aPrimitiveType = aResourceMgr->integerValue( "VISU", "point_sprite_primitive_type", GetPrimitiveType() );
164   SetPrimitiveType( aPrimitiveType );
165
166   vtkFloatingPointType aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() );
167   SetClamp( aClamp );
168
169   int aMinSize = aResourceMgr->integerValue( "VISU", "point_sprite_min_size", ( int )( GetMinSize() * 100.0 ) );
170   SetMinSize( aMinSize / 100.0 );
171
172   int aMaxSize = aResourceMgr->integerValue( "VISU", "point_sprite_max_size", ( int )( GetMaxSize() * 100.0 ) );
173   SetMaxSize( aMaxSize / 100.0 );
174
175   int aGeomSize = aResourceMgr->integerValue( "VISU", "point_sprite_size", ( int )( GetGeomSize() * 100.0 ) );
176   SetGeomSize( aGeomSize / 100.0 );
177
178   int aMagnification = aResourceMgr->integerValue( "VISU", "point_sprite_magnification", ( int )( GetMagnification() * 100.0 ) );
179   SetMagnification( aMagnification / 100.0 );
180
181   vtkFloatingPointType anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() );
182   SetMagnificationIncrement( anIncrement );
183
184   bool isColored = aResourceMgr->booleanValue( "VISU", "point_sprite_results", GetIsColored() );
185   SetIsColored( isColored );
186
187   QColor aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", GetColor() );
188   SetColor( aColor );
189
190   vtkFloatingPointType anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() );
191   SetAlphaThreshold( anAlphaThreshold );
192
193   int aResolution = aResourceMgr->integerValue( "VISU", "geom_sphere_resolution", GetResolution() );
194   SetResolution( aResolution );
195
196   int aFaceLimit = aResourceMgr->integerValue( "VISU", "geom_sphere_face_limit", GetFaceLimit() );
197   SetFaceLimit( aFaceLimit );
198
199   QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
200   aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture );
201
202   QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
203   anAlphaTexture = aResourceMgr->stringValue( "VISU", "point_sprite_alpha_texture", anAlphaTexture );
204
205   SetTextures( aMainTexture, anAlphaTexture );
206
207   return this;
208 }
209
210
211 //----------------------------------------------------------------------------
212 VISU::Storable* 
213 VISU::GaussPoints_i
214 ::Restore(const Storable::TRestoringMap& theMap)
215 {
216   TSuperClass::Restore(theMap);
217
218   SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt());
219   SetIsDispGlobalScalarBar(Storable::FindValue(theMap,"myIsDispGlobalScalarBar").toInt());
220   SetBiColor(Storable::FindValue(theMap,"myIsBiColor").toInt());
221   SetSpacing(Storable::FindValue(theMap,"mySpacing").toDouble());
222
223   SetPrimitiveType(Storable::FindValue(theMap,"myPrimitiveType").toInt());
224   SetClamp(Storable::FindValue(theMap,"myClamp").toDouble());
225   SetMinSize(Storable::FindValue(theMap,"myMinSize").toDouble());
226   SetMaxSize(Storable::FindValue(theMap,"myMaxSize").toDouble());
227   SetGeomSize(Storable::FindValue(theMap,"myGeomSize").toDouble());
228
229   SetMagnification(Storable::FindValue(theMap,"myMagnification").toDouble());
230   SetMagnificationIncrement(Storable::FindValue(theMap,"myMagnificationIncrement").toDouble());
231
232   SetIsDeformed(Storable::FindValue(theMap,"myIsDeformed").toInt());
233   SetScaleFactor(Storable::FindValue(theMap,"myScaleFactor").toDouble());
234
235   SetFaceLimit(Storable::FindValue(theMap,"myFaceLimit").toInt());
236
237   SetIsColored(Storable::FindValue(theMap,"myIsColored").toInt());
238   int aRed = Storable::FindValue(theMap,"myColor.R").toInt();
239   int aGreen = Storable::FindValue(theMap,"myColor.G").toInt();
240   int aBlue = Storable::FindValue(theMap,"myColor.B").toInt();
241   SetColor( QColor(aRed,aGreen,aBlue) );
242
243   SetAlphaThreshold(Storable::FindValue(theMap,"myAlphaThreshold").toDouble());
244
245   SetTextures( Storable::FindValue(theMap,"myMainTexture"),
246                Storable::FindValue(theMap,"myAlphaTexture") );
247
248   SetResolution(Storable::FindValue(theMap,"myResolution").toInt());
249
250   return this;
251 }
252
253
254 //----------------------------------------------------------------------------
255 void
256 VISU::GaussPoints_i
257 ::ToStream(std::ostringstream& theStr)
258 {
259   TSuperClass::ToStream(theStr);
260
261   Storable::DataToStream( theStr, "myIsActiveLocalScalarBar", myIsActiveLocalScalarBar );
262   Storable::DataToStream( theStr, "myIsDispGlobalScalarBar", myIsDispGlobalScalarBar );
263   Storable::DataToStream( theStr, "myIsBiColor", GetBiColor() );
264   Storable::DataToStream( theStr, "mySpacing", GetSpacing() );
265
266   Storable::DataToStream( theStr, "myPrimitiveType", GetPrimitiveType() );
267   Storable::DataToStream( theStr, "myClamp", GetClamp() );
268   Storable::DataToStream( theStr, "myMinSize", GetMinSize() );
269   Storable::DataToStream( theStr, "myMaxSize", GetMaxSize() );
270   Storable::DataToStream( theStr, "myGeomSize", GetGeomSize() );
271
272   Storable::DataToStream( theStr, "myMagnification", GetMagnification() );
273   Storable::DataToStream( theStr, "myMagnificationIncrement", GetMagnificationIncrement() );
274
275   Storable::DataToStream( theStr, "myIsDeformed", GetIsDeformed() );
276   Storable::DataToStream( theStr, "myScaleFactor", GetScaleFactor() );
277
278   Storable::DataToStream( theStr, "myFaceLimit", GetFaceLimit() );
279
280   Storable::DataToStream( theStr, "myIsColored", GetIsColored() );
281   QColor aColor = GetColor();
282   Storable::DataToStream( theStr, "myColor.R", aColor.red() );
283   Storable::DataToStream( theStr, "myColor.G", aColor.green() );
284   Storable::DataToStream( theStr, "myColor.B", aColor.blue() );
285
286   Storable::DataToStream( theStr, "myAlphaThreshold", GetAlphaThreshold() );
287   Storable::DataToStream( theStr, "myMainTexture", GetMainTexture() );
288   Storable::DataToStream( theStr, "myAlphaTexture", GetAlphaTexture() );
289
290   Storable::DataToStream( theStr, "myResolution", GetResolution() );
291 }
292
293
294 VISU::GaussPoints_i
295 ::~GaussPoints_i()
296 {
297   if(MYDEBUG) MESSAGE("GaussPoints_i::~GaussPoints_i() - this = "<<this);
298 }
299
300
301 //----------------------------------------------------------------------------
302 VISU_GaussPointsPL* 
303 VISU::GaussPoints_i
304 ::GetGaussPointsPL()
305
306   return myGaussPointsPL; 
307 }
308
309 void
310 VISU::GaussPoints_i
311 ::SetIsDeformed( bool theIsDeformed )
312 {
313   myGaussPointsPL->SetIsDeformed( theIsDeformed );
314 }
315
316 bool
317 VISU::GaussPoints_i
318 ::GetIsDeformed()
319 {
320   return myGaussPointsPL->GetIsDeformed();
321 }
322
323 void
324 VISU::GaussPoints_i
325 ::SetScaleFactor( vtkFloatingPointType theScaleFactor )
326 {
327   myGaussPointsPL->SetScale( theScaleFactor );
328 }
329
330 vtkFloatingPointType
331 VISU::GaussPoints_i
332 ::GetScaleFactor()
333 {
334   return myGaussPointsPL->GetScale();
335 }
336
337 void
338 VISU::GaussPoints_i
339 ::SetIsColored( bool theIsColored )
340 {
341   myIsColored = theIsColored;
342   myGaussPointsPL->SetIsColored( theIsColored );
343 }
344
345 bool
346 VISU::GaussPoints_i
347 ::SetMainTexture( const QString& theMainTexture ) 
348 {
349   bool update = myMainTexture != theMainTexture;
350   myMainTexture = theMainTexture;
351   return update;
352 }
353
354 const QString&
355 VISU::GaussPoints_i
356 ::GetMainTexture() 
357
358   return myMainTexture; 
359 }
360
361 bool
362 VISU::GaussPoints_i
363 ::SetAlphaTexture( const QString& theAlphaTexture ) 
364 {
365   bool update = myAlphaTexture != theAlphaTexture;
366   myAlphaTexture = theAlphaTexture;
367   return update;
368 }
369
370 const QString&
371 VISU::GaussPoints_i
372 ::GetAlphaTexture() 
373
374   return myAlphaTexture; 
375 }
376
377 void
378 VISU::GaussPoints_i
379 ::SetAlphaThreshold( vtkFloatingPointType theAlphaThreshold )
380 {
381   myGaussPointsPL->SetAlphaThreshold( theAlphaThreshold );
382 }
383
384 vtkFloatingPointType
385 VISU::GaussPoints_i
386 ::GetAlphaThreshold()
387 {
388   return myGaussPointsPL->GetAlphaThreshold();
389 }
390
391 void
392 VISU::GaussPoints_i
393 ::SetResolution( int theResolution )
394 {
395   myGaussPointsPL->SetResolution( theResolution );
396 }
397
398 int
399 VISU::GaussPoints_i
400 ::GetResolution()
401 {
402   return myGaussPointsPL->GetResolution();
403 }
404
405 void
406 VISU::GaussPoints_i
407 ::SetPrimitiveType(int thePrimitiveType)
408 {
409   myGaussPointsPL->SetPrimitiveType( thePrimitiveType );
410 }
411
412 int
413 VISU::GaussPoints_i
414 ::GetPrimitiveType()
415 {
416   return myGaussPointsPL->GetPrimitiveType();
417 }
418
419 vtkFloatingPointType
420 VISU::GaussPoints_i
421 ::GetMaximumSupportedSize()
422 {
423   return myGaussPointsPL->GetMaximumSupportedSize();
424 }
425
426 void
427 VISU::GaussPoints_i
428 ::SetClamp(vtkFloatingPointType theClamp)
429 {
430   myGaussPointsPL->SetClamp( theClamp );
431 }
432
433 vtkFloatingPointType
434 VISU::GaussPoints_i
435 ::GetClamp()
436 {
437   return myGaussPointsPL->GetClamp();
438 }
439
440 void
441 VISU::GaussPoints_i
442 ::SetGeomSize( vtkFloatingPointType theGeomSize )
443 {
444   myGaussPointsPL->SetSize( theGeomSize );
445 }
446
447 vtkFloatingPointType
448 VISU::GaussPoints_i
449 ::GetGeomSize()
450 {
451   return myGaussPointsPL->GetSize();
452 }
453
454 void
455 VISU::GaussPoints_i
456 ::SetMinSize( vtkFloatingPointType theMinSize )
457 {
458   myGaussPointsPL->SetMinSize( theMinSize );
459 }
460
461 vtkFloatingPointType
462 VISU::GaussPoints_i
463 ::GetMinSize()
464 {
465   return myGaussPointsPL->GetMinSize();
466 }
467
468 void
469 VISU::GaussPoints_i
470 ::SetMaxSize( vtkFloatingPointType theMaxSize )
471 {
472   myGaussPointsPL->SetMaxSize( theMaxSize );
473 }
474
475 vtkFloatingPointType
476 VISU::GaussPoints_i
477 ::GetMaxSize()
478 {
479   return myGaussPointsPL->GetMaxSize();
480 }
481
482 void
483 VISU::GaussPoints_i
484 ::SetMagnification( vtkFloatingPointType theMagnification )
485 {
486   myGaussPointsPL->SetMagnification( theMagnification );
487 }
488
489 vtkFloatingPointType
490 VISU::GaussPoints_i
491 ::GetMagnification()
492 {
493   return myGaussPointsPL->GetMagnification();
494 }
495
496 void
497 VISU::GaussPoints_i
498 ::SetMagnificationIncrement( vtkFloatingPointType theIncrement )
499 {
500   myGaussPointsPL->SetMagnificationIncrement( theIncrement );
501 }
502
503 vtkFloatingPointType
504 VISU::GaussPoints_i
505 ::GetMagnificationIncrement()
506 {
507   return myGaussPointsPL->GetMagnificationIncrement();
508 }
509
510 //----------------------------------------------------------------------------
511 void
512 VISU::GaussPoints_i
513 ::DoSetInput(Result_i* theResult)
514 {
515   VISU::Result_i::TInput* anInput = theResult->GetInput();
516   if(!anInput)
517     throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!");
518
519   myField = anInput->GetField(myMeshName,myEntity,myFieldName);
520   if(!myField) 
521     throw std::runtime_error("There is no Field with the parameters !!!");
522
523   VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
524     anInput->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration);
525
526   if(!aGaussPtsIDMapper) 
527     throw std::runtime_error("There is no TimeStamp with the parameters !!!");
528
529   myGaussPointsPL->SetGaussPtsIDMapper(aGaussPtsIDMapper);
530   myGaussPointsPL->Init();
531   myGaussPointsPL->Build();
532
533   theResult->MinMaxConnect(this);
534 }
535
536
537 //----------------------------------------------------------------------------
538 void
539 VISU::GaussPoints_i
540 ::DoHook()
541 {
542   if(!myPipeLine) 
543     myPipeLine = VISU_GaussPointsPL::New();
544
545   myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(myPipeLine);
546
547   TSuperClass::DoHook();
548 }
549
550
551 //----------------------------------------------------------------------------
552 VISU_PipeLine* 
553 VISU::GaussPoints_i
554 ::GetPipeLine()
555 {
556   // We create a new PipeLine instance in order to provide
557   //   different representations for different actors (basic and segmented)
558   VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
559   aPipeLine->SetGaussPtsIDMapper(myGaussPointsPL->GetGaussPtsIDMapper());
560   aPipeLine->ShallowCopy(myPipeLine);
561   aPipeLine->Update();
562   return aPipeLine;
563 }
564
565
566 //----------------------------------------------------------------------------
567 bool 
568 VISU::GaussPoints_i
569 ::OnCreateActor(VISU_GaussPtsAct* theActor,
570                 const Handle(SALOME_InteractiveObject)& theIO)
571 {
572   try{
573     TSuperClass::CreateActor(theActor,theIO);
574     theActor->GetPipeLine()->Delete();
575     UpdateActor(theActor);
576     return true;
577   }catch(...){
578     theActor->Delete();
579     throw ;
580   }
581   return false;
582 }
583
584 VISU_GaussPtsAct1* 
585 VISU::GaussPoints_i
586 ::OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO)
587 {
588   VISU_GaussPtsAct1* anActor = VISU_GaussPtsAct1::New();
589   if(OnCreateActor(anActor,theIO))
590     return anActor;
591   return NULL;
592 }
593
594 VISU_GaussPtsAct2* 
595 VISU::GaussPoints_i
596 ::OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO)
597 {
598   VISU_GaussPtsAct2* anActor = VISU_GaussPtsAct2::New();
599   if(OnCreateActor(anActor,theIO))
600     return anActor;
601   return NULL;
602 }
603
604 VISU_Actor* 
605 VISU::GaussPoints_i
606 ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
607 {
608   return OnCreateActor1(theIO);
609 }
610
611 //----------------------------------------------------------------------------
612 VISU_GaussPtsAct2* 
613 VISU::GaussPoints_i
614 ::CloneActor(VISU_GaussPtsAct1* theActor) 
615 {
616   if(MYDEBUG) MESSAGE("GaussPoints_i::CloneActor - this = "<<this);
617   if(VISU_GaussPtsAct2* anActor = OnCreateActor2()){
618     theActor->Connect(anActor);
619     return anActor;
620   }
621   return NULL;
622 }
623
624
625 //----------------------------------------------------------------------------
626 void
627 VISU::GaussPoints_i
628 ::UpdateScalarBar(vtkScalarBarActor *theScalarBar,
629                   vtkLookupTable* theLookupTable)
630 {
631   theScalarBar->SetTitle(myTitle.c_str());
632   theScalarBar->SetOrientation(myOrientation);
633   theScalarBar->SetNumberOfLabels(myNumberOfLabels);
634
635   vtkLookupTable* aLookupTable = myScalarMapPL->GetBarTable();
636   
637   theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors());
638   theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors());
639
640   vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty();
641   aTitleProp->SetFontFamily(myTitFontType);
642   aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]);
643   (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
644   (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
645   (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
646   
647   vtkTextProperty* aLabelProp = theScalarBar->GetLabelTextProperty();
648   aLabelProp->SetFontFamily(myLblFontType);
649   aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]);
650   (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
651   (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
652   (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
653   
654   theScalarBar->Modified();
655 }
656
657
658 //----------------------------------------------------------------------------
659 void 
660 VISU::GaussPoints_i
661 ::UpdateActor(VISU_Actor* theActor) 
662 {
663   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
664     VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl();
665     if(GetIsColored()){
666       anActor->SetBarVisibility(true);
667       myPipeLine->GetMapper()->SetScalarVisibility(1);
668
669       vtkFloatingPointType aRange[2];
670       myScalarMapPL->GetSourceRange(aRange);
671       aScalarBarCtrl->SetRangeLocal(aRange);
672       
673       TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT);
674       bool anIsMinMaxDone = IsGlobalRangeDefined();
675       if(anIsMinMaxDone)
676         aTMinMax = myField->GetMinMax(GetScalarMode());
677       aScalarBarCtrl->SetGlobalRangeIsDefined(anIsMinMaxDone);
678       aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
679       
680       VISU_ScalarBarCtrl::EMode aScalarBarMode = VISU_ScalarBarCtrl::eGlobal;
681       if(myIsActiveLocalScalarBar){
682         if(myIsDispGlobalScalarBar){
683           aScalarBarMode = VISU_ScalarBarCtrl::eLocal; 
684         }else{
685           aScalarBarMode = VISU_ScalarBarCtrl::eSimple; 
686         }
687       }
688       
689       if(aScalarBarMode == VISU_ScalarBarCtrl::eGlobal){
690         vtkFloatingPointType aRangeGlobal[2];
691         //
692         aRangeGlobal[0] = aTMinMax.first;
693         aRangeGlobal[1] = aTMinMax.second;
694         
695         GetGaussPointsPL()->GetMapper()->SetScalarRange(aRangeGlobal);
696       }
697       
698       aScalarBarCtrl->SetMode(aScalarBarMode);
699       
700       // Position
701       aScalarBarCtrl->SetWidth(myWidth);
702       aScalarBarCtrl->SetHeight(myHeight);
703       aScalarBarCtrl->SetPosition(myPosition);
704       
705       aScalarBarCtrl->SetSpacing(mySpacing);
706       
707       // Bicolor
708       bool anIsBicolor = GetGaussPointsPL()->GetBicolor();
709       aScalarBarCtrl->SetBicolor(anIsBicolor);
710       
711       UpdateScalarBar(aScalarBarCtrl->GetLocalBar(),
712                       aScalarBarCtrl->GetLocalTable());
713       
714       UpdateScalarBar(aScalarBarCtrl->GetGlobalBar(),
715                       aScalarBarCtrl->GetGlobalTable());
716
717       aScalarBarCtrl->Update();
718     }else{
719       anActor->SetBarVisibility(false);
720
721       myPipeLine->GetMapper()->SetScalarVisibility(0);
722
723       anActor->GetProperty()->SetColor(myColor.red() / 255.0,
724                                        myColor.green() / 255.0,
725                                        myColor.blue() / 255.0);
726     }
727
728     if( GetGaussPointsPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
729       theActor->SetRepresentation( VTK_POINTS );
730     else
731       theActor->SetRepresentation( VTK_SURFACE );
732   }
733   TSuperClass::UpdateActor(theActor);
734 }
735
736 //----------------------------------------------------------------------------
737 void
738 VISU::GaussPoints_i
739 ::UpdateFromActor(VISU_GaussPtsAct* theActor) 
740 {
741   if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this);
742   myGaussPointsPL->ChangeMagnification(theActor->GetChangeMagnification());
743   UpdateActors();
744 }
745
746
747 //----------------------------------------------------------------------------
748 void
749 VISU::GaussPoints_i
750 ::SetTextures( const QString& theMainTexture, 
751                const QString& theAlphaTexture )
752 {
753   bool updateMainTexture = SetMainTexture( theMainTexture );
754   bool updateAlphaTexture = SetAlphaTexture( theAlphaTexture );
755   if( !updateMainTexture && !updateAlphaTexture )
756     return;
757
758   using namespace VISU;
759   TTextureValue aTextureValue = GetTexture(theMainTexture,theAlphaTexture);
760   myGaussPointsPL->SetImageData( aTextureValue.GetPointer() );
761 }
762
763
764 //----------------------------------------------------------------------------
765 void
766 VISU::GaussPoints_i
767 ::SetIsActiveLocalScalarBar(const bool theFlag)
768 {
769   myIsActiveLocalScalarBar = theFlag;
770 }
771
772 bool
773 VISU::GaussPoints_i
774 ::GetIsActiveLocalScalarBar() const 
775 {
776   return myIsActiveLocalScalarBar;
777 }
778
779 void
780 VISU::GaussPoints_i
781 ::SetIsDispGlobalScalarBar(const bool theFlag)
782 {
783   myIsDispGlobalScalarBar=theFlag;
784 }
785
786 bool
787 VISU::GaussPoints_i
788 ::IsGlobalRangeDefined() const 
789 {
790   return myResult->IsMinMaxDone();
791 }
792
793 bool
794 VISU::GaussPoints_i
795 ::GetIsDispGlobalScalarBar() const 
796 {
797   return myIsDispGlobalScalarBar;
798 }
799
800 void
801 VISU::GaussPoints_i
802 ::SetBiColor(bool theIsBiColor)
803 {
804   GetGaussPointsPL()->SetBicolor(theIsBiColor);
805 }
806
807 bool
808 VISU::GaussPoints_i
809 ::GetBiColor() 
810 {
811   return GetGaussPointsPL()->GetBicolor();
812 }
813
814 void
815 VISU::GaussPoints_i
816 ::SetSpacing(const vtkFloatingPointType theSpacing)
817 {
818   mySpacing = theSpacing;
819 }
820
821 vtkFloatingPointType
822 VISU::GaussPoints_i
823 ::GetSpacing() const 
824 {
825   return mySpacing;
826 }
827
828 //----------------------------------------------------------------------------
829 void
830 VISU::GaussPoints_i
831 ::UpdateMinMax()
832 {
833   MinMaxCunsomer::UpdateMinMax();
834   UpdateActors();
835 }