Salome HOME
Fix for the "0051899: curves are not shown in opened study" issue.
[modules/visu.git] / src / VISU_I / VISU_ColoredPrs3d_i.cc
1 // Copyright (C) 2007-2013  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
23 //  VISU OBJECT : interactive object for VISU entities implementation
24 //  File   : VISU_PrsObject_i.cxx
25 //  Author : Alexey PETROV
26 //  Module : VISU
27 //
28 #include "VISU_ColoredPrs3d_i.hh"
29 #include "VISU_Prs3dUtils.hh"
30
31 #include "VISU_Result_i.hh"
32 #include "VISU_ColoredPL.hxx"
33 #include "VISU_PipeLineUtils.hxx"
34 #include "VISU_Convertor.hxx"
35
36 #include "SUIT_ResourceMgr.h"
37 #include "SALOME_Event.h"
38
39 #include <sstream>
40 #include <vtkMapper.h>
41 #include <vtkDataSet.h>
42
43 #ifdef _DEBUG_
44 static int MYDEBUG = 0;
45 //#define _DEXCEPT_
46 #else
47 static int MYDEBUG = 0;
48 #endif
49
50 using namespace std;
51
52 //---------------------------------------------------------------
53 namespace
54 {
55   std::string
56   FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy)
57   {
58     static char aFolderName[] = "3D Presentations";
59     CORBA::String_var anEntry;
60     SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName);
61     if(!CORBA::is_nil(aSObject) && aSObject->Depth() == 3){
62       anEntry = aSObject->GetID();
63       return anEntry.in();
64     }
65     SALOMEDS::SComponent_var aSComponent = VISU::FindOrCreateVisuComponent(theStudy);
66     CORBA::String_var aFatherEntry = aSComponent->GetID();
67     anEntry = VISU::CreateAttributes(theStudy,
68                                      aFatherEntry.in(),
69                                      "",
70                                      "",
71                                      aFolderName,
72                                      "",
73                                      "",
74                                      true).c_str();
75     return anEntry.in();
76   }
77 }
78
79 //---------------------------------------------------------------
80 namespace VISU
81 {
82   //---------------------------------------------------------------
83   inline
84   TMinMax 
85   GetMinMax(VISU::Result_i* theResult,
86             VISU::PField theField,
87             vtkIdType theCompID)
88   {
89     if(!theResult->IsMinMaxDone())
90       theResult->GetInput()->BuildMinMax();
91     if(theField->myIsELNO)
92       return theField->GetMinMax(theCompID, VISU::TNames());
93     else
94       return theField->GetAverageMinMax(theCompID, VISU::TNames());
95   }
96
97   //---------------------------------------------------------------
98   void
99   TMinMaxController
100   ::UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d)
101   {}
102
103
104   //---------------------------------------------------------------
105   double
106   TMinMaxController
107   ::GetComponentMin(vtkIdType theCompID)
108   {
109     return VTK_LARGE_FLOAT;
110   }
111
112
113   //---------------------------------------------------------------
114   double
115   TMinMaxController
116   ::GetComponentMax(vtkIdType theCompID)
117   {
118     return -VTK_LARGE_FLOAT;
119   }
120
121
122   //---------------------------------------------------------------
123   struct TSimpleMinMaxController: virtual TVTKMinMaxController
124   {
125     VISU::Result_i* myResult;
126     VISU::ColoredPrs3d_i* myColoredPrs3d;
127     
128     TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d):
129       myResult(theColoredPrs3d->GetCResult()),
130       myColoredPrs3d(theColoredPrs3d)
131     {}
132     
133     ~TSimpleMinMaxController()
134     {}
135
136     virtual
137     double
138     GetComponentMin(vtkIdType theCompID)
139     {
140       if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) {
141         TMinMax aMinMax = GetMinMax(myResult, aField, theCompID);
142         return aMinMax.first;
143       }
144       return TMinMaxController::GetComponentMin(theCompID);
145     }
146
147     virtual
148     double
149     GetComponentMax(vtkIdType theCompID)
150     {
151       if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) {
152         TMinMax aMinMax = GetMinMax(myResult, aField, theCompID);
153         return aMinMax.second;
154       }
155       return TMinMaxController::GetComponentMax(theCompID);
156     }
157   };
158
159
160   //---------------------------------------------------------------
161   PMinMaxController
162   CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d)
163   {
164     return PMinMaxController(new TSimpleMinMaxController(theColoredPrs3d));
165   }
166
167
168   //---------------------------------------------------------------
169 }
170
171
172 //---------------------------------------------------------------
173 VISU::ColoredPrs3d_i::
174 ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
175   myIsRestored(true),
176   myRestoringSObject( SALOMEDS::SObject::_nil() ),
177   myEntity( VISU::Entity( -1 ) ),
178   myPreviousEntity( VISU::Entity( -1 ) ),
179   myTimeStampNumber( -1 ),
180   myPreviousTimeStampNumber( -1 ),
181   myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
182   myPublishInStudyMode(thePublishInStudyMode),
183   myIsUnits( true ),
184   myNumberOfLabels( -1 ),
185   myOrientation( VISU::ColoredPrs3dBase::HORIZONTAL ),
186   //myPosition[2], myWidth, myHeight, myTitleWidth, myTitleHeight,
187   //myLabelWidth, myLabelHeight, myBarWidth, myBarHeight,
188   //myIsBoldTitle, myIsItalicTitle, myIsShadowTitle, myTitFontType, myTitleColor[3],
189   //myIsBoldLabel, myIsItalicLabel, myIsShadowLabel, myLblFontType, myLabelColor[3],
190   myColoredPL(NULL),
191   myIsFixedRange(false),
192   myIsDistributionVisible(false)
193 {}
194
195 //---------------------------------------------------------------
196 VISU::ColoredPrs3d_i
197 ::~ColoredPrs3d_i()
198 {}
199
200 //---------------------------------------------------------------
201 void
202 VISU::ColoredPrs3d_i
203 ::Register()
204 {
205   TSuperClass::Register();
206 }
207
208 //---------------------------------------------------------------
209 void
210 VISU::ColoredPrs3d_i
211 ::UnRegister()
212 {
213   TSuperClass::UnRegister();
214 }
215
216 //---------------------------------------------------------------
217 void 
218 VISU::ColoredPrs3d_i
219 ::RemoveFromStudy()
220 {
221   struct TEvent: public SALOME_Event
222   {
223     VISU::ColoredPrs3d_i* myRemovable;
224
225     TEvent(VISU::ColoredPrs3d_i* theRemovable):
226       myRemovable(theRemovable)
227     {}
228     
229     virtual
230     void
231     Execute()
232     {
233       SALOMEDS::SObject_var aSObject = myRemovable->GetSObject();
234
235       if(!CORBA::is_nil(aSObject.in()))
236         VISU::RemoveFromStudy(aSObject,false);
237
238       myRemovable->TSuperClass::RemoveFromStudy();
239     }
240   };
241
242   ProcessVoidEvent(new TEvent(this));
243 }
244
245
246 //----------------------------------------------------------------------------
247 void
248 VISU::ColoredPrs3d_i
249 ::UpdateFromResult(Result_i* theResult)
250 {
251   struct TEvent: public SALOME_Event
252   {
253     VISU::ColoredPrs3d_i* myColoredPrs3d;
254
255     TEvent(VISU::ColoredPrs3d_i* theColoredPrs3d):
256       myColoredPrs3d(theColoredPrs3d)
257     {}
258     
259     virtual
260     void
261     Execute()
262     {
263       try{
264         myColoredPrs3d->DoSetInput(false, false);
265         myColoredPrs3d->UpdateActors();
266       }catch(std::exception& exc){
267         INFOS("Follow exception was occured :\n"<<exc.what());
268       }catch(...){
269         INFOS("Unknown exception was occured!");
270       }
271     }
272   };
273
274   if ( theResult == GetCResult() ) 
275     ProcessVoidEvent(new TEvent(this));
276 }
277
278
279 //---------------------------------------------------------------
280 bool 
281 VISU::ColoredPrs3d_i
282 ::SetInput(bool theReInit)
283 {
284   try{
285     if(TSuperClass::SetInput(theReInit)){
286       if(CheckIsPossible()){
287         if(OnSetInput(theReInit)){
288           if(Create(GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()))
289             return true;
290         }else
291           return true;
292       }
293     }
294   }catch(...){
295   }
296
297   return false;
298 }
299
300
301 //----------------------------------------------------------------------------
302 void 
303 VISU::ColoredPrs3d_i
304 ::OnRestoreInput()
305 {
306   TSuperClass::OnRestoreInput();
307   myEntity = myPreviousEntity;
308   myFieldName = myPreviousFieldName;
309   myTimeStampNumber = myPreviousTimeStampNumber;
310 }
311
312
313 //---------------------------------------------------------------
314 bool 
315 VISU::ColoredPrs3d_i
316 ::OnSetInput(bool theReInit)
317 {
318   bool anIsCreatNew = !IsPipeLineExists();
319   if(anIsCreatNew)
320     CreatePipeLine(NULL); // to create proper pipeline
321
322   try{
323     DoSetInput(anIsCreatNew, theReInit);
324
325     if(anIsCreatNew)
326       GetSpecificPL()->Init();
327
328     // To update scalar range according to the new input
329     if(!IsRangeFixed() && theReInit)
330       SetSourceRange();
331
332     if(GetPublishInStudyMode() != EDoNotPublish)
333       GetCResult()->ConnectObserver(this, myResultConnection);
334
335     myPreviousEntity = myEntity;
336     myPreviousFieldName = myFieldName;
337     myPreviousTimeStampNumber = myTimeStampNumber;
338   }catch(std::exception& exc){
339     INFOS("Follow exception was occured :\n"<<exc.what());
340     OnRestoreInput();
341     throw;
342   }catch(...){
343     INFOS("Unknown exception was occured!");
344     OnRestoreInput();
345     throw;
346   }
347
348   // To update title according to the new input
349   if(theReInit)
350     SetTitle(GetCFieldName().c_str());
351
352   return anIsCreatNew;
353 }
354
355
356 //---------------------------------------------------------------
357 void
358 VISU::ColoredPrs3d_i
359 ::SetEntity(VISU::Entity theEntity)
360 {
361   if ( myEntity == theEntity )
362     return;
363
364   VISU::TSetModified aModified(this);
365   
366   myEntity = theEntity;
367   myParamsTime.Modified();
368 }
369
370
371 //---------------------------------------------------------------
372 VISU::Entity
373 VISU::ColoredPrs3d_i
374 ::GetEntity()
375 {
376   return myEntity;
377 }
378
379
380 //----------------------------------------------------------------------------
381 VISU::TEntity
382 VISU::ColoredPrs3d_i
383 ::GetTEntity() const 
384
385   return VISU::TEntity(int(myEntity));
386 }
387
388
389 //----------------------------------------------------------------------------
390 void 
391 VISU::ColoredPrs3d_i
392 ::SetFieldName(const char* theFieldName)
393 {
394   if(myFieldName == theFieldName)
395     return;
396
397   VISU::TSetModified aModified(this);
398   
399   myFieldName = theFieldName;
400   myParamsTime.Modified();
401 }
402
403
404 //----------------------------------------------------------------------------
405 char*
406 VISU::ColoredPrs3d_i
407 ::GetFieldName()
408 {
409   return CORBA::string_dup(myFieldName.c_str());
410 }
411
412
413 //----------------------------------------------------------------------------
414 std::string
415 VISU::ColoredPrs3d_i
416 ::GetCFieldName() const
417 {
418   return myFieldName;
419 }
420
421
422 //----------------------------------------------------------------------------
423 VISU::PField
424 VISU::ColoredPrs3d_i
425 ::GetField()
426
427   return myField;
428 }
429
430
431 //---------------------------------------------------------------
432 void
433 VISU::ColoredPrs3d_i
434 ::SetField(VISU::PField theField)
435 {
436   myField = theField;
437 }
438
439
440 //----------------------------------------------------------------------------
441 void 
442 VISU::ColoredPrs3d_i
443 ::SetTimeStampNumber(CORBA::Long theTimeStampNumber)
444 {
445   if ( myTimeStampNumber == theTimeStampNumber )
446     return;
447
448   VISU::TSetModified aModified(this);
449   
450   myTimeStampNumber = theTimeStampNumber;
451   myParamsTime.Modified();
452 }
453
454
455 //----------------------------------------------------------------------------
456 CORBA::Long
457 VISU::ColoredPrs3d_i
458 ::GetTimeStampNumber()
459 {
460   return myTimeStampNumber;
461 }
462
463
464 //----------------------------------------------------------------------------
465 CORBA::Long
466 VISU::ColoredPrs3d_i
467 ::GetTimeStampNumberByIndex( CORBA::Long theIndex )
468 {
469   VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
470   CORBA::Long aLength = aTimeStampsRange->length();
471
472   if( theIndex >= 0 && theIndex < aLength )
473   {
474     VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ theIndex ];
475     return anInfo.myNumber;
476   }
477
478   return -1;
479 }
480
481
482 //----------------------------------------------------------------------------
483 CORBA::Long
484 VISU::ColoredPrs3d_i
485 ::GetTimeStampIndexByNumber( CORBA::Long theNumber )
486 {
487   VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
488   CORBA::Long aLength = aTimeStampsRange->length();
489
490   for( int index = 0; index < aLength; index++ )
491   {
492     VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ index ];
493
494     if( anInfo.myNumber == theNumber )
495       return index;
496   }
497
498   return -1;
499 }
500
501
502 //----------------------------------------------------------------------------
503 VISU::PField
504 VISU::ColoredPrs3d_i
505 ::GetScalarField()
506 {
507   return myField;
508 }
509
510
511 //----------------------------------------------------------------------------
512 VISU::PMinMaxController
513 VISU::ColoredPrs3d_i
514 ::GetMinMaxController()
515 {
516   return myMinMaxController;
517 }
518
519
520 //----------------------------------------------------------------------------
521 void
522 VISU::ColoredPrs3d_i
523 ::SetMinMaxController( const VISU::PMinMaxController& theController )
524 {
525   myMinMaxController = theController;
526
527   if(!IsRangeFixed())
528     SetSourceRange();
529 }
530
531
532 //----------------------------------------------------------------------------
533 void
534 VISU::ColoredPrs3d_i
535 ::SetMinMaxController( VISU::ColoredPrs3d_i* theOrigin )
536 {
537   VISU::PMinMaxController aController = theOrigin->GetMinMaxController();
538
539   if ( aController )
540     aController->UpdateReference( theOrigin, this );
541   
542   SetMinMaxController( aController );
543 }
544
545
546 //----------------------------------------------------------------------------
547 CORBA::Long
548 VISU::ColoredPrs3d_i
549 ::GetScalarTimeStampNumber() const
550 {
551   return myTimeStampNumber;
552 }
553
554
555 //----------------------------------------------------------------------------
556 VISU::ColoredPrs3dHolder::TimeStampsRange* 
557 VISU::ColoredPrs3d_i
558 ::GetTimeStampsRange()
559 {
560   VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange =
561     new VISU::ColoredPrs3dHolder::TimeStampsRange();
562   VISU::TValField& aValField = GetField()->myValField;
563   if(IsTimeStampFixed()){
564     aTimeStampsRange->length(1);
565     PValForTime& aValForTime = aValField[GetTimeStampNumber()];
566     std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
567     VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
568     anInfo.myNumber = GetTimeStampNumber();
569     anInfo.myTime = aTime.c_str();
570     aTimeStampsRange[0] = anInfo;
571     return aTimeStampsRange._retn();    
572   }
573
574   // To exclude timstamps with repeated time
575   typedef std::map<std::string, long> TTimeStampsRange;
576   TTimeStampsRange aRange;
577   {
578     VISU::TValField::const_iterator anIter = aValField.begin();
579     for(; anIter != aValField.end(); anIter++){
580       vtkIdType aTimeStampNumber = anIter->first;
581       const PValForTime& aValForTime = anIter->second;
582       std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
583       aRange[aTime] = aTimeStampNumber;
584     }
585   }
586
587   // To sort timestamps according to their timestamp number
588   typedef std::map<long, std::string> TTimeStampsSortedRange;
589   TTimeStampsSortedRange aSortedRange;
590   {
591     TTimeStampsRange::const_iterator anIter = aRange.begin();
592     for(size_t aCounter = 0; anIter != aRange.end(); anIter++, aCounter++){
593       vtkIdType aTimeStampNumber = anIter->second;
594       const std::string& aTime = anIter->first;
595       aSortedRange[aTimeStampNumber] = aTime;
596     }
597   }
598
599   // To map the C++ data structures to the corresponding CORBA ones
600   {
601     aTimeStampsRange->length(aRange.size());
602     TTimeStampsSortedRange::const_iterator anIter = aSortedRange.begin();
603     for(size_t aCounter = 0; anIter != aSortedRange.end(); anIter++, aCounter++){
604       vtkIdType aTimeStampNumber = anIter->first;
605       const std::string& aTime = anIter->second;
606       VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
607       anInfo.myNumber = aTimeStampNumber;
608       anInfo.myTime = aTime.c_str();
609       aTimeStampsRange[aCounter] = anInfo;
610     }
611   }
612   return aTimeStampsRange._retn();
613 }
614
615 CORBA::Float
616 VISU::ColoredPrs3d_i
617 ::GetMemorySize()
618 {
619   return TSuperClass::GetMemorySize();
620 }
621
622 VISU::ColoredPrs3dHolder::BasicInput*
623 VISU::ColoredPrs3d_i
624 ::GetBasicInput()
625 {
626   VISU::ColoredPrs3dHolder::BasicInput* aBasicInput = new VISU::ColoredPrs3dHolder::BasicInput();
627   aBasicInput->myResult = GetResultObject();
628   aBasicInput->myMeshName = GetMeshName();
629   aBasicInput->myEntity = GetEntity();
630   aBasicInput->myFieldName = GetFieldName();
631   aBasicInput->myTimeStampNumber = GetTimeStampNumber();
632
633   return aBasicInput;
634 }
635
636
637 //----------------------------------------------------------------------------
638 void
639 VISU::ColoredPrs3d_i
640 ::SetHolderEntry(const std::string& theEntry)
641 {
642   myHolderEntry = theEntry;
643 }
644
645
646 //----------------------------------------------------------------------------
647 std::string
648 VISU::ColoredPrs3d_i
649 ::GetHolderEntry()
650 {
651   return myHolderEntry;
652 }
653
654
655 //----------------------------------------------------------------------------
656 std::string
657 VISU::ColoredPrs3d_i
658 ::GetActorEntry()
659 {
660   if(myHolderEntry != "")
661     return myHolderEntry;
662   return TSuperClass::GetActorEntry();
663 }
664
665
666 //----------------------------------------------------------------------------
667 CORBA::Boolean 
668 VISU::ColoredPrs3d_i
669 ::IsTimeStampFixed()
670 {
671   return myIsTimeStampFixed;
672 }
673
674 //----------------------------------------------------------------------------
675 VISU::ColoredPrs3d_i::EPublishInStudyMode 
676 VISU::ColoredPrs3d_i
677 ::GetPublishInStudyMode()
678 {
679   return myPublishInStudyMode;
680 }
681
682 //---------------------------------------------------------------
683 void
684 VISU::ColoredPrs3d_i
685 ::SameAs(const Prs3d_i* theOrigin)
686 {
687   if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
688     ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
689
690     bool anIsCreatNew = OnSetInput(false);
691     if(anIsCreatNew)
692       Build(ESameAs);
693     
694     TSuperClass::SameAs(theOrigin);
695     
696     CORBA::Long aNbComp = GetScalarField()->myNbComp;
697     CORBA::Long anOriginNbComp = anOrigin->GetScalarField()->myNbComp;
698     if(anOriginNbComp < aNbComp)
699       SetScalarMode(0);
700     else
701       SetScalarMode(anOrigin->GetScalarMode());
702
703     SetNbColors(anOrigin->GetNbColors());
704     
705     SetUnitsVisible(anOrigin->IsUnitsVisible());
706     SetIsDistributionVisible(anOrigin->GetIsDistributionVisible());
707     SetLabelsFormat( anOrigin->GetLabelsFormat() );
708     
709     SetBarOrientation(anOrigin->GetBarOrientation());
710     
711     SetMinMaxController( anOrigin );
712
713     if ( anOrigin->IsRangeFixed() )
714       SetRange( anOrigin->GetMin(), anOrigin->GetMax() );
715     else
716       SetSourceRange();
717
718     SetScalarFilterRange( anOrigin->GetScalarFilterMin(), anOrigin->GetScalarFilterMax() );
719     UseScalarFiltering( anOrigin->IsScalarFilterUsed() );
720
721     SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
722     SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
723     SetRatios(anOrigin->GetTitleSize(), anOrigin->GetLabelSize(),
724               anOrigin->GetBarWidth(), anOrigin->GetBarHeight());
725     SetLabels(anOrigin->GetLabels());
726
727     SetTitle(anOrigin->GetTitle());   
728     SetBoldTitle(anOrigin->IsBoldTitle());
729     SetItalicTitle(anOrigin->IsItalicTitle());
730     SetShadowTitle(anOrigin->IsShadowTitle());
731     SetTitFontType(anOrigin->GetTitFontType());
732     double r,g,b;
733     anOrigin->GetTitleColor(r,g,b);
734     SetTitleColor(r,g,b);
735     
736     SetBoldLabel(anOrigin->IsBoldLabel());
737     SetItalicLabel(anOrigin->IsItalicLabel());
738     SetShadowLabel(anOrigin->IsShadowLabel());
739     SetLblFontType(anOrigin->GetLblFontType());
740     anOrigin->GetLabelColor(r,g,b);
741     SetLabelColor(r,g,b);
742
743     myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
744
745     SetHolderEntry( anOrigin->GetHolderEntry() );
746
747     myGroupNames = anOrigin->GetGroupNames();
748   }
749 }
750   
751 //----------------------------------------------------------------------------
752 void
753 VISU::ColoredPrs3d_i
754 ::UpdateActor(VISU_ActorBase* theActor) 
755 {
756   bool isOnGroups = myGroupNames.size() > 0;
757   if ( isOnGroups )
758   {
759     QStringList aList;
760     TGroupNames::const_iterator anIter = myGroupNames.begin();
761     for ( ; anIter != myGroupNames.end(); anIter++ )
762     {
763       const std::string aGroupName = *anIter;
764       aList << QString( aGroupName.c_str() );
765     }
766     theActor->SetNameActorText( aList.join( "\n" ).toLatin1().constData() );
767   }
768   theActor->SetIsDisplayNameActor( isOnGroups );
769
770   TSuperClass::UpdateActor(theActor);
771 }
772
773 //----------------------------------------------------------------------------
774 CORBA::Long 
775 VISU::ColoredPrs3d_i
776 ::GetScalarMode()
777 {
778   return myColoredPL->GetScalarMode();
779 }
780
781
782 //----------------------------------------------------------------------------
783 void
784 VISU::ColoredPrs3d_i
785 ::SetScalarMode(CORBA::Long theScalarMode) 
786 {
787   CORBA::Long aNbComp = GetScalarField()->myNbComp;
788   if(aNbComp == 1)
789     theScalarMode = 1;
790   else if(theScalarMode > aNbComp)
791     theScalarMode = 0;
792
793   VISU::TSetModified aModified(this);
794
795   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, int>
796                    (GetSpecificPL(), &VISU_ColoredPL::SetScalarMode, theScalarMode));
797 }
798
799 //----------------------------------------------------------------------------
800 CORBA::Double 
801 VISU::ColoredPrs3d_i
802 ::GetMin()
803 {
804   return myColoredPL->GetScalarRange()[0];
805 }
806
807 //----------------------------------------------------------------------------
808 CORBA::Double 
809 VISU::ColoredPrs3d_i
810 ::GetMax()
811 {
812   return myColoredPL->GetScalarRange()[1];
813 }
814
815
816 //----------------------------------------------------------------------------
817 void
818 VISU::ColoredPrs3d_i
819 ::SetRange( CORBA::Double theMin, CORBA::Double theMax )
820 {
821   VISU::TSetModified aModified(this);
822
823   double aScalarRange[2] = {theMin, theMax};
824   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, double*>
825                    (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
826   UseFixedRange(true);
827 }
828
829
830 //----------------------------------------------------------------------------
831 void
832 VISU::ColoredPrs3d_i
833 ::SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax )
834 {
835   VISU::TSetModified aModified(this);
836
837   double aScalarRange[ 2 ] = { theMin, theMax };
838   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, double*>
839                    (GetSpecificPL(), &VISU_ColoredPL::SetScalarFilterRange, aScalarRange) );
840 }
841
842
843 //----------------------------------------------------------------------------
844 CORBA::Double
845 VISU::ColoredPrs3d_i
846 ::GetScalarFilterMin()
847 {
848   double aScalarRange[ 2 ];
849   GetSpecificPL()->GetScalarFilterRange( aScalarRange );
850
851   return aScalarRange[ 0 ];
852 }
853
854
855 //----------------------------------------------------------------------------
856 CORBA::Double
857 VISU::ColoredPrs3d_i
858 ::GetScalarFilterMax()
859 {
860   double aScalarRange[ 2 ];
861   GetSpecificPL()->GetScalarFilterRange( aScalarRange );
862
863   return aScalarRange[ 1 ];
864 }
865
866
867 //----------------------------------------------------------------------------
868 CORBA::Boolean
869 VISU::ColoredPrs3d_i
870 ::IsScalarFilterUsed()
871 {
872   return myColoredPL->IsScalarFilterUsed();
873 }
874
875 //----------------------------------------------------------------------------
876 void
877 VISU::ColoredPrs3d_i
878 ::UseScalarFiltering( CORBA::Boolean theUseScalarFilter )
879 {
880   return myColoredPL->UseScalarFiltering( theUseScalarFilter );
881 }
882
883 //----------------------------------------------------------------------------
884 void
885 VISU::ColoredPrs3d_i
886 ::SetSourceRange()
887 {
888   VISU::TSetModified aModified(this);
889
890   if(IsTimeStampFixed()){
891     GetSpecificPL()->SetSourceRange();
892     ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
893                      (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
894   }else{
895     double aScalarRange[ 2 ] = {GetSourceMin(), GetSourceMax()};
896     ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, double*>
897                      (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
898   }
899   UseFixedRange(false);
900 }
901
902 //----------------------------------------------------------------------------
903 CORBA::Double 
904 VISU::ColoredPrs3d_i
905 ::GetSourceMin()
906 {
907   if(IsTimeStampFixed()){
908     double aRange[2];
909     GetSpecificPL()->GetSourceRange(aRange);
910     return aRange[0];
911   }
912   return GetComponentMin(GetScalarMode());
913 }
914
915 //----------------------------------------------------------------------------
916 CORBA::Double 
917 VISU::ColoredPrs3d_i
918 ::GetSourceMax()
919 {
920   if(IsTimeStampFixed()){
921     double aRange[2];
922     GetSpecificPL()->GetSourceRange(aRange);
923     return aRange[1];
924   }
925   return GetComponentMax(GetScalarMode());
926 }
927
928
929 //----------------------------------------------------------------------------
930 void
931 VISU::ColoredPrs3d_i
932 ::SetNbColors(CORBA::Long theNbColors)
933 {
934   VISU::TSetModified aModified(this);
935
936   ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, int>
937                    (GetSpecificPL(), &VISU_ColoredPL::SetNbColors, theNbColors));
938 }
939
940 //----------------------------------------------------------------------------
941 CORBA::Long 
942 VISU::ColoredPrs3d_i
943 ::GetNbColors()
944 {
945   return GetSpecificPL()->GetNbColors();
946 }
947
948 //----------------------------------------------------------------------------
949 void
950 VISU::ColoredPrs3d_i
951 ::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation)
952 {
953   if ( myOrientation == theOrientation )
954     return;
955
956   VISU::TSetModified aModified(this);
957   
958   myOrientation = theOrientation;
959   myParamsTime.Modified();
960 }
961
962 //----------------------------------------------------------------------------
963 VISU::ColoredPrs3dBase::Orientation 
964 VISU::ColoredPrs3d_i
965 ::GetBarOrientation() 
966 {
967   return myOrientation;
968 }
969
970 //----------------------------------------------------------------------------
971 void
972 VISU::ColoredPrs3d_i
973 ::SetPosition(CORBA::Double theX, CORBA::Double theY) 
974
975   bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX);
976   anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY);
977   if(anIsSameValue)
978     return;
979
980   VISU::TSetModified aModified(this);
981
982   myPosition[0] = theX; 
983   myPosition[1] = theY;
984   myParamsTime.Modified();
985 }
986
987 //----------------------------------------------------------------------------
988 CORBA::Double
989 VISU::ColoredPrs3d_i
990 ::GetPosX() 
991 {
992   return myPosition[0];
993 }
994
995 //----------------------------------------------------------------------------
996 CORBA::Double
997 VISU::ColoredPrs3d_i
998 ::GetPosY() 
999
1000   return myPosition[1];
1001 }
1002
1003 //----------------------------------------------------------------------------
1004 void
1005 VISU::ColoredPrs3d_i
1006 ::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) 
1007 {
1008   bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth);
1009   anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight);
1010   if(anIsSameValue)
1011     return;
1012
1013   VISU::TSetModified aModified(this);
1014
1015   myWidth = theWidth; 
1016   myHeight = theHeight;
1017   myParamsTime.Modified();
1018 }
1019
1020 //----------------------------------------------------------------------------
1021 CORBA::Double
1022 VISU::ColoredPrs3d_i
1023 ::GetWidth() 
1024 {
1025   return myWidth;
1026 }
1027
1028 //----------------------------------------------------------------------------
1029 CORBA::Double
1030 VISU::ColoredPrs3d_i
1031 ::GetHeight() 
1032
1033   return myHeight;
1034 }
1035
1036 //----------------------------------------------------------------------------
1037 void
1038 VISU::ColoredPrs3d_i
1039 ::SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize, 
1040             CORBA::Long theBarWidth, CORBA::Long theBarHeight) 
1041 {
1042   bool anIsSameValue = VISU::CheckIsSameValue(myTitleSize, theTitleSize);
1043   anIsSameValue &= VISU::CheckIsSameValue(myLabelSize, theLabelSize);
1044   anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
1045   anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
1046   if(anIsSameValue)
1047     return;
1048
1049   VISU::TSetModified aModified(this);
1050
1051   myTitleSize = theTitleSize; 
1052   myLabelSize = theLabelSize; 
1053   myBarWidth = theBarWidth; 
1054   myBarHeight = theBarHeight;
1055   myParamsTime.Modified();
1056 }
1057
1058 //----------------------------------------------------------------------------
1059 CORBA::Long
1060 VISU::ColoredPrs3d_i
1061 ::GetTitleSize() 
1062 {
1063   return myTitleSize;
1064 }
1065
1066 //----------------------------------------------------------------------------
1067 CORBA::Long
1068 VISU::ColoredPrs3d_i
1069 ::GetLabelSize() 
1070 {
1071   return myLabelSize;
1072 }
1073
1074 //----------------------------------------------------------------------------
1075 CORBA::Long
1076 VISU::ColoredPrs3d_i
1077 ::GetBarWidth() 
1078 {
1079   return myBarWidth;
1080 }
1081
1082 //----------------------------------------------------------------------------
1083 CORBA::Long
1084 VISU::ColoredPrs3d_i
1085 ::GetBarHeight() 
1086
1087   return myBarHeight;
1088 }
1089
1090 //----------------------------------------------------------------------------
1091 void
1092 VISU::ColoredPrs3d_i
1093 ::SetLabels(CORBA::Long theNbLabels)
1094 {
1095   if(myNumberOfLabels == theNbLabels)
1096     return;
1097
1098   VISU::TSetModified aModified(this);
1099
1100   myNumberOfLabels = theNbLabels;
1101   myParamsTime.Modified();
1102 }
1103
1104 //----------------------------------------------------------------------------
1105 CORBA::Long
1106 VISU::ColoredPrs3d_i
1107 ::GetLabels() 
1108
1109   return myNumberOfLabels;
1110 }
1111
1112 //----------------------------------------------------------------------------
1113
1114 //----------------------------------------------------------------------------
1115 void
1116 VISU::ColoredPrs3d_i
1117 ::SetLabelsFormat(const char* theFormat)
1118 {
1119   if( myLabelsFormat != theFormat ){
1120     VISU::TSetModified aModified(this);
1121     myLabelsFormat = theFormat;
1122     myParamsTime.Modified();
1123   }
1124 }
1125
1126
1127 //----------------------------------------------------------------------------
1128 char* 
1129 VISU::ColoredPrs3d_i
1130 ::GetLabelsFormat() 
1131
1132   return CORBA::string_dup(myLabelsFormat.c_str());
1133 }
1134
1135 //----------------------------------------------------------------------------
1136 void
1137 VISU::ColoredPrs3d_i
1138 ::SetTitle(const char* theTitle) 
1139 {
1140   VISU::PValForTime aValForTime;
1141   VISU::TValField& aValField = GetScalarField()->myValField;
1142   VISU::TValField::iterator anIter = aValField.find(GetScalarTimeStampNumber());
1143   if (anIter != aValField.end())
1144     aValForTime = anIter->second;
1145
1146   if (aValForTime) {
1147     std::stringstream aStream;
1148     const VISU::TTime& aTime = aValForTime->myTime;
1149     aStream<<theTitle<<" ";
1150     if(IsUnitsVisible()) {
1151       aStream << VISU_Convertor::GenerateName(aTime);
1152     } else {
1153       QString aName;
1154       aName.sprintf("%g", aTime.first);
1155       aStream << aName.toLatin1().data();
1156     }
1157     aStream <<std::ends;
1158     std::string aScalarBarTitle = aStream.str();
1159     if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
1160       VISU::TSetModified aModified(this);
1161
1162       myScalarBarTitle = aScalarBarTitle;
1163       myTitle = theTitle;
1164       myParamsTime.Modified();
1165     }
1166   }
1167 }
1168
1169 //----------------------------------------------------------------------------
1170 char* 
1171 VISU::ColoredPrs3d_i
1172 ::GetTitle() 
1173
1174   return CORBA::string_dup(myTitle.c_str());
1175 }
1176
1177 //----------------------------------------------------------------------------
1178 void
1179 VISU::ColoredPrs3d_i
1180 ::SetUnitsVisible(CORBA::Boolean theIsVisible)
1181 {
1182   if ( myIsUnits == theIsVisible ) 
1183     return;
1184
1185   VISU::TSetModified aModified( this );
1186
1187   myIsUnits = theIsVisible;
1188   myParamsTime.Modified();
1189 }
1190
1191 //----------------------------------------------------------------------------
1192 CORBA::Boolean
1193 VISU::ColoredPrs3d_i
1194 ::IsUnitsVisible()
1195 {
1196   return myIsUnits;
1197 }
1198
1199 //----------------------------------------------------------------------------
1200 std::string 
1201 VISU::ColoredPrs3d_i
1202 ::GetCTitle() 
1203
1204   return myTitle;
1205 }
1206
1207 //----------------------------------------------------------------------------
1208 bool
1209 VISU::ColoredPrs3d_i
1210 ::IsBoldTitle() 
1211
1212   return myIsBoldTitle;
1213 }
1214
1215 //----------------------------------------------------------------------------
1216 void
1217 VISU::ColoredPrs3d_i
1218 ::SetBoldTitle(bool theIsBoldTitle)
1219 {
1220   if(myIsBoldTitle == theIsBoldTitle)
1221     return;
1222
1223   VISU::TSetModified aModified(this);
1224
1225   myIsBoldTitle = theIsBoldTitle;
1226   myParamsTime.Modified();
1227 }
1228
1229 //----------------------------------------------------------------------------
1230 bool
1231 VISU::ColoredPrs3d_i
1232 ::IsItalicTitle() 
1233
1234   return myIsItalicTitle;
1235 }
1236
1237 //----------------------------------------------------------------------------
1238 void
1239 VISU::ColoredPrs3d_i
1240 ::SetItalicTitle(bool theIsItalicTitle)
1241
1242   if(myIsItalicTitle == theIsItalicTitle)
1243     return;
1244
1245   VISU::TSetModified aModified(this);
1246
1247   myIsItalicTitle = theIsItalicTitle;
1248   myParamsTime.Modified();
1249 }
1250
1251 //----------------------------------------------------------------------------
1252 bool
1253 VISU::ColoredPrs3d_i
1254 ::IsShadowTitle() 
1255
1256   return myIsShadowTitle;
1257 }
1258
1259 //----------------------------------------------------------------------------
1260 void
1261 VISU::ColoredPrs3d_i
1262 ::SetShadowTitle(bool theIsShadowTitle)
1263
1264   if(myIsShadowTitle == theIsShadowTitle)
1265     return;
1266
1267   VISU::TSetModified aModified(this);
1268
1269   myIsShadowTitle = theIsShadowTitle;
1270   myParamsTime.Modified();
1271 }
1272
1273 //----------------------------------------------------------------------------
1274 int
1275 VISU::ColoredPrs3d_i
1276 ::GetTitFontType()
1277 {
1278   return myTitFontType;
1279 }
1280
1281 //----------------------------------------------------------------------------
1282 void
1283 VISU::ColoredPrs3d_i
1284 ::SetTitFontType(int theTitFontType)
1285 {
1286   if(myTitFontType == theTitFontType)
1287     return;
1288
1289   VISU::TSetModified aModified(this);
1290
1291   myTitFontType = theTitFontType;
1292   myParamsTime.Modified();
1293 }
1294
1295 //----------------------------------------------------------------------------
1296 void
1297 VISU::ColoredPrs3d_i
1298 ::GetTitleColor(double& theR, 
1299                 double& theG, 
1300                 double& theB)
1301 {
1302   theR = myTitleColor[0]; 
1303   theG = myTitleColor[1]; 
1304   theB = myTitleColor[2];
1305 }
1306
1307 //----------------------------------------------------------------------------
1308 void
1309 VISU::ColoredPrs3d_i
1310 ::SetTitleColor(double theR, 
1311                 double theG, 
1312                 double theB)
1313 {
1314   bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR);
1315   anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG);
1316   anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB);
1317   if(anIsSameValue)
1318     return;
1319
1320   VISU::TSetModified aModified(this);
1321
1322   myTitleColor[0] = theR; 
1323   myTitleColor[1] = theG; 
1324   myTitleColor[2] = theB; 
1325   myParamsTime.Modified();
1326 }
1327
1328 //----------------------------------------------------------------------------
1329 bool
1330 VISU::ColoredPrs3d_i
1331 ::IsBoldLabel()
1332 {
1333   return myIsBoldLabel;
1334 }
1335
1336 //----------------------------------------------------------------------------
1337 void
1338 VISU::ColoredPrs3d_i
1339 ::SetBoldLabel(bool theIsBoldLabel) 
1340 {
1341   if(myIsBoldLabel == theIsBoldLabel)
1342     return;
1343
1344   VISU::TSetModified aModified(this);
1345
1346   myIsBoldLabel = theIsBoldLabel;
1347   myParamsTime.Modified();
1348 }
1349
1350 //----------------------------------------------------------------------------
1351 bool
1352 VISU::ColoredPrs3d_i
1353 ::IsItalicLabel() 
1354 {
1355   return myIsItalicLabel;
1356 }
1357
1358 //----------------------------------------------------------------------------
1359 void
1360 VISU::ColoredPrs3d_i
1361 ::SetItalicLabel(bool theIsItalicLabel)
1362 {
1363   if(myIsItalicLabel == theIsItalicLabel)
1364     return;
1365
1366   VISU::TSetModified aModified(this);
1367
1368   myIsItalicLabel = theIsItalicLabel;
1369   myParamsTime.Modified();
1370 }
1371
1372 //----------------------------------------------------------------------------
1373 bool
1374 VISU::ColoredPrs3d_i
1375 ::IsShadowLabel() 
1376 {
1377   return myIsShadowLabel;
1378 }
1379
1380 //----------------------------------------------------------------------------
1381 void
1382 VISU::ColoredPrs3d_i
1383 ::SetShadowLabel(bool theIsShadowLabel)
1384 {
1385   if(myIsShadowLabel == theIsShadowLabel)
1386     return;
1387
1388   VISU::TSetModified aModified(this);
1389
1390   myIsShadowLabel = theIsShadowLabel;
1391   myParamsTime.Modified();
1392 }
1393
1394 //----------------------------------------------------------------------------
1395 int
1396 VISU::ColoredPrs3d_i
1397 ::GetLblFontType()
1398 {
1399   return myLblFontType;
1400 }
1401
1402 //----------------------------------------------------------------------------
1403 void
1404 VISU::ColoredPrs3d_i
1405 ::SetLblFontType(int theLblFontType)
1406 {
1407   if(myLblFontType == theLblFontType)
1408     return;
1409
1410   VISU::TSetModified aModified(this);
1411
1412   myLblFontType = theLblFontType;
1413   myParamsTime.Modified();
1414 }
1415
1416 //----------------------------------------------------------------------------
1417 void
1418 VISU::ColoredPrs3d_i
1419 ::GetLabelColor(double& theR, 
1420                 double& theG, 
1421                 double& theB)
1422 {
1423   theR = myLabelColor[0]; 
1424   theG = myLabelColor[1]; 
1425   theB = myLabelColor[2];
1426 }
1427
1428 //----------------------------------------------------------------------------
1429 void
1430 VISU::ColoredPrs3d_i
1431 ::SetLabelColor(double theR, 
1432                 double theG, 
1433                 double theB)
1434 {
1435   bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR);
1436   anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG);
1437   anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB);
1438   if(anIsSameValue)
1439     return;
1440
1441   VISU::TSetModified aModified(this);
1442
1443   myLabelColor[0] = theR; 
1444   myLabelColor[1] = theG; 
1445   myLabelColor[2] = theB; 
1446   myParamsTime.Modified();
1447 }
1448
1449
1450 //----------------------------------------------------------------------------
1451 CORBA::Boolean
1452 VISU::ColoredPrs3d_i
1453 ::IsRangeFixed() 
1454
1455   return myIsFixedRange; 
1456 }
1457
1458 //----------------------------------------------------------------------------
1459 void
1460 VISU::ColoredPrs3d_i
1461 ::UseFixedRange(bool theUseFixedRange)
1462 {
1463   if(myIsFixedRange == theUseFixedRange)
1464     return;
1465
1466   myIsFixedRange = theUseFixedRange;
1467   myParamsTime.Modified();
1468 }
1469
1470 //----------------------------------------------------------------------------
1471 std::string
1472 VISU::ColoredPrs3d_i
1473 ::GetScalarBarTitle()
1474 {
1475   return myScalarBarTitle;
1476 }
1477
1478 //----------------------------------------------------------------------------
1479 /**
1480  * Creates ColoredPrs3d and initialises it from resources
1481  */
1482 VISU::Storable* 
1483 VISU::ColoredPrs3d_i
1484 ::Create(const std::string& theMeshName, 
1485          VISU::Entity theEntity,
1486          const std::string& theFieldName, 
1487          CORBA::Long theTimeStampNumber)
1488 {
1489   SetMeshName(theMeshName.c_str());
1490   SetEntity(theEntity);
1491   SetFieldName(theFieldName.c_str());
1492   SetTimeStampNumber(theTimeStampNumber);
1493   OnSetInput(false);
1494
1495   Build(ECreateNew); // to get corresponding input from result and initilize the pipeline
1496
1497   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1498
1499   int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
1500   SetScalarMode(aScalarMode);
1501
1502   // Scalar Range
1503   int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
1504   if ( aRangeType == 1 ) {
1505     float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
1506     float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
1507     SetRange( aMin, aMax );
1508   }
1509   UseFixedRange( aRangeType == 1 );
1510
1511   bool isFiltered = aResourceMgr->booleanValue("VISU", "scalar_bar_filter_by_scalars", false);
1512   UseScalarFiltering( isFiltered );
1513
1514   int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
1515   SetNbColors(aNumberOfColors);
1516
1517   bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
1518   SetUnitsVisible(isUnits);
1519
1520   SetIsDistributionVisible( aResourceMgr->booleanValue("VISU", "scalar_bar_show_distribution", false) ); // RKV
1521   
1522   int lp = aResourceMgr->integerValue( "VISU", "scalar_bar_label_precision", 3 );
1523   SetLabelsFormat( VISU::ToFormat( lp ).c_str() );
1524
1525   // Orientation
1526   int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
1527   if(anOrientation == 1)
1528     SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL);
1529   else
1530     SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL);
1531
1532   // Scalar Bar origin
1533   QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
1534
1535   double aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.1;
1536   aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
1537   myPosition[0] = aXorigin;
1538
1539   double aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.01;
1540   aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
1541   myPosition[1] = aYorigin;
1542
1543   // Scalar Bar size
1544   myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.08 : 0.8;
1545   myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
1546
1547   myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.08;
1548   myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
1549
1550   myTitleSize = 0;
1551   myTitleSize = aResourceMgr->integerValue("VISU", propertyName + "title_size", myTitleSize);
1552
1553   myLabelSize = 0;
1554   myLabelSize = aResourceMgr->integerValue("VISU", propertyName + "label_size", myLabelSize);
1555
1556   myBarWidth = 0;
1557   myBarWidth = aResourceMgr->integerValue("VISU", propertyName + "bar_width", myBarWidth);
1558
1559   myBarHeight = 0;
1560   myBarHeight = aResourceMgr->integerValue("VISU", propertyName + "bar_height", myBarHeight);
1561
1562   // scalar bar default position
1563   bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
1564   int aPlace = 1;
1565   if (anIsArrangeBar){
1566     aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
1567   }
1568   if(myOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){
1569     myPosition[1] += myHeight*(aPlace-1);
1570   } else {
1571     myPosition[0] += myWidth*(aPlace-1);
1572   }
1573
1574   // Nb of Labels
1575   myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
1576
1577   // Fonts properties definition
1578   myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
1579   myTitFontType = VTK_ARIAL;
1580
1581   if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
1582     QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
1583     if ( f.family() == "Arial" )
1584       myTitFontType = VTK_ARIAL;
1585     else if ( f.family() == "Courier" )
1586       myTitFontType = VTK_COURIER;
1587     else if ( f.family() == "Times" )
1588       myTitFontType = VTK_TIMES;
1589     
1590     myIsBoldTitle   = f.bold();
1591     myIsItalicTitle = f.italic();
1592     myIsShadowTitle =  f.overline();
1593   }
1594
1595   QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
1596
1597   SetTitleColor(aTextColor.red()/255., aTextColor.green()/255., aTextColor.blue()/255.);
1598                 
1599   myTitleColor[0] = aTextColor.red()   / 255.;
1600   myTitleColor[1] = aTextColor.green() / 255.;
1601   myTitleColor[2] = aTextColor.blue()  / 255.;
1602
1603   myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
1604   myLblFontType = VTK_ARIAL;
1605
1606   if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
1607     QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
1608     if ( f.family() == "Arial" )
1609       myLblFontType = VTK_ARIAL;
1610     else if ( f.family() == "Courier" )
1611       myLblFontType = VTK_COURIER;
1612     else if ( f.family() == "Times" )
1613       myLblFontType = VTK_TIMES;
1614     
1615     myIsBoldLabel   = f.bold();
1616     myIsItalicLabel = f.italic();
1617     myIsShadowLabel =  f.overline();
1618   }
1619
1620   QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
1621
1622   SetLabelColor(aLabelColor.red()/255., aLabelColor.green()/255., aLabelColor.blue()/255.);
1623
1624   myLabelColor[0] = aLabelColor.red()   / 255.;
1625   myLabelColor[1] = aLabelColor.green() / 255.;
1626   myLabelColor[2] = aLabelColor.blue()  / 255.;
1627   
1628   // Parameters of labels displaed field values
1629
1630   myValLblFontType = VTK_ARIAL;
1631   myIsBoldValLbl = true;
1632   myIsItalicValLbl = myIsShadowValLbl = false;
1633   myValLblFontSize = 12;
1634   if( aResourceMgr->hasValue( "VISU", "values_labeling_font" ) )
1635   {
1636     // family
1637     QFont f = aResourceMgr->fontValue( "VISU", "values_labeling_font" );
1638     if ( f.family() == "Arial" )
1639       myValLblFontType = VTK_ARIAL;
1640     else if ( f.family() == "Courier" )
1641       myValLblFontType = VTK_COURIER;
1642     else if ( f.family() == "Times" )
1643       myValLblFontType = VTK_TIMES;
1644
1645     // size
1646     if ( f.pointSize() > -1 )
1647       myValLblFontSize = f.pointSize();
1648
1649     // color
1650     QColor aColor = aResourceMgr->colorValue( 
1651       "VISU", "values_labeling_color", QColor( 255, 255, 255 ) );
1652     myValLblFontColor[ 0 ] = aColor.red() / 255.;
1653     myValLblFontColor[ 1 ] = aColor.green() / 255.;
1654     myValLblFontColor[ 2 ] = aColor.blue()/ 255.;
1655
1656     // bold, italic, shadow
1657     myIsBoldValLbl = f.bold();
1658     myIsItalicValLbl = f.italic();
1659     myIsShadowValLbl =  f.overline();
1660   }
1661   
1662   return this;
1663 }
1664
1665
1666 //----------------------------------------------------------------------------
1667 void
1668 VISU::ColoredPrs3d_i
1669 ::SaveRestoringState(SALOMEDS::SObject_ptr theSObject,
1670                      const Storable::TRestoringMap& theMap)
1671 {
1672   myRestoringSObject = SALOMEDS::SObject::_duplicate(theSObject);
1673   myRestoringMap = theMap;
1674   myIsRestored = false;
1675 }
1676
1677
1678 //----------------------------------------------------------------------------
1679 void
1680 VISU::ColoredPrs3d_i
1681 ::InitFromRestoringState()
1682 {
1683   if(!myIsRestored){
1684     Restore(myRestoringSObject, myRestoringMap);
1685     myIsRestored = true;
1686   }
1687 }
1688
1689
1690 //----------------------------------------------------------------------------
1691 VISU::Storable* 
1692 VISU::ColoredPrs3d_i
1693 ::Restore(SALOMEDS::SObject_ptr theSObject,
1694           const Storable::TRestoringMap& theMap)
1695 {
1696   if(!TSuperClass::Restore(theSObject, theMap))
1697     return NULL;
1698
1699   SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
1700   SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").toLatin1().data());
1701   SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
1702   myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed", "1").toInt();
1703   OnSetInput(false);
1704
1705   Build(ERestore);
1706
1707   SetScalarMode(VISU::Storable::FindValue( theMap,"myScalarMode" ).toInt() );
1708   {
1709     float aMin = VISU::Storable::FindValue( theMap, "myScalarRange[0]" ).toDouble();
1710     float aMax = VISU::Storable::FindValue( theMap, "myScalarRange[1]" ).toDouble();
1711     SetRange( aMin, aMax );
1712   }
1713   {
1714     bool isFiltered = VISU::Storable::FindValue( theMap, "myIsFilteredByScalars", "0" ).toInt();
1715     float aMin = VISU::Storable::FindValue( theMap, "myScalarFilterRange[0]" ).toDouble();
1716     float aMax = VISU::Storable::FindValue( theMap, "myScalarFilterRange[1]" ).toDouble();
1717     SetScalarFilterRange( aMin, aMax );
1718     UseScalarFiltering( isFiltered );
1719   }
1720   SetIsDistributionVisible(VISU::Storable::FindValue(theMap,"myIsDistributionVisible", "0").toInt());
1721
1722   UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
1723
1724   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
1725   SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
1726   SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g").toLatin1().data());
1727   SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
1728   
1729   SetTitle(VISU::Storable::FindValue(theMap,"myTitle").toLatin1().data());
1730   myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
1731   myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
1732   myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
1733   myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
1734   myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
1735   myTitleSize = VISU::Storable::FindValue(theMap,"myTitleSize").toInt();
1736   myLabelSize = VISU::Storable::FindValue(theMap,"myLabelSize").toInt();
1737   myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
1738   myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
1739
1740   myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
1741   myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
1742   myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
1743   myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
1744   myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
1745   myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
1746   myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
1747
1748   myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
1749   myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
1750   myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
1751   myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
1752   myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
1753   myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
1754   myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
1755
1756   bool anIsExists;
1757   QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList", &anIsExists);
1758   if(anIsExists){
1759     QStringList aGeomNameList = aGeomNames.split("|", QString::SkipEmptyParts);
1760     int aNbOfGroups = aGeomNameList.count();
1761     if(aNbOfGroups > 0){
1762       RemoveAllGeom();
1763       for(int aGroupNum = 0; aGroupNum < aNbOfGroups; aGroupNum++){
1764         QString aGroupName = aGeomNameList[aGroupNum];
1765         AddMeshOnGroup(aGroupName.toLatin1().data());
1766       }
1767     }
1768   }
1769   
1770   // Parameters of labels displayed field values
1771
1772   myValLblFontType = VISU::Storable::FindValue( theMap, "myValLblFontType", "0"  ).toInt();
1773   myIsBoldValLbl = VISU::Storable::FindValue( theMap, "myIsBoldValLbl", "1" ).toInt();
1774   myIsItalicValLbl = VISU::Storable::FindValue( theMap, "myIsItalicValLbl", "0" ).toInt();
1775   myIsShadowValLbl = VISU::Storable::FindValue( theMap, "myIsShadowValLbl", "0" ).toInt();
1776   myValLblFontSize = VISU::Storable::FindValue( theMap, "myValLblFontSize", "12" ).toDouble();
1777   myValLblFontColor[ 0 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[0]", "1" ).toFloat();
1778   myValLblFontColor[ 1 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[1]", "1" ).toFloat();
1779   myValLblFontColor[ 2 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[2]", "1" ).toFloat();
1780   
1781   return this;
1782 }
1783
1784 //----------------------------------------------------------------------------
1785 void 
1786 VISU::ColoredPrs3d_i
1787 ::ToStream(std::ostringstream& theStr)
1788 {
1789   TSuperClass::ToStream(theStr);
1790
1791   Storable::DataToStream( theStr, "myEntity",         GetEntity() );
1792   Storable::DataToStream( theStr, "myFieldName",      GetCFieldName().c_str() );
1793   Storable::DataToStream( theStr, "myIteration",      int(GetTimeStampNumber()) );
1794   Storable::DataToStream( theStr, "myIsTimeStampFixed", int(myIsTimeStampFixed) );
1795
1796   Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
1797   Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
1798   Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
1799   Storable::DataToStream( theStr, "myIsFixedRange",   IsRangeFixed() );
1800   
1801   Storable::DataToStream( theStr, "myIsFilteredByScalars",  IsScalarFilterUsed() );
1802   Storable::DataToStream( theStr, "myScalarFilterRange[0]", GetScalarFilterMin() );
1803   Storable::DataToStream( theStr, "myScalarFilterRange[1]", GetScalarFilterMax() );
1804
1805   Storable::DataToStream( theStr, "myIsDistributionVisible", GetIsDistributionVisible() ); // RKV
1806
1807   Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
1808   Storable::DataToStream( theStr, "myOrientation",    myOrientation );
1809
1810   Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
1811   Storable::DataToStream( theStr, "myUnitsVisible",   myIsUnits );
1812   Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
1813
1814   Storable::DataToStream( theStr, "myLabelsFormat",   myLabelsFormat.c_str() );
1815
1816   Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
1817   Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
1818   Storable::DataToStream( theStr, "myWidth",          myWidth );
1819   Storable::DataToStream( theStr, "myHeight",         myHeight );
1820   Storable::DataToStream( theStr, "myTitleSize",     myTitleSize );
1821   Storable::DataToStream( theStr, "myLabelSize",     myLabelSize );
1822   Storable::DataToStream( theStr, "myBarWidth",       myBarWidth );
1823   Storable::DataToStream( theStr, "myBarHeight",      myBarHeight );
1824
1825   Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
1826   Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
1827   Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
1828   Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
1829   Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
1830   Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
1831   Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
1832
1833   Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
1834   Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
1835   Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
1836   Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
1837   Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
1838   Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
1839   Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
1840   
1841   // Parameters of labels displayed field values
1842
1843   Storable::DataToStream( theStr, "myValLblFontType", myValLblFontType );
1844   Storable::DataToStream( theStr, "myIsBoldValLbl", myIsBoldValLbl );
1845   Storable::DataToStream( theStr, "myIsItalicValLbl", myIsItalicValLbl );
1846   Storable::DataToStream( theStr, "myIsShadowValLbl", myIsShadowValLbl );
1847   Storable::DataToStream( theStr, "myValLblFontSize", myValLblFontSize );
1848   Storable::DataToStream( theStr, "myValLblFontColor[0]", myValLblFontColor[ 0 ] );
1849   Storable::DataToStream( theStr, "myValLblFontColor[1]", myValLblFontColor[ 1 ] );
1850   Storable::DataToStream( theStr, "myValLblFontColor[2]", myValLblFontColor[ 2 ] );
1851
1852
1853   std::ostringstream aGeomNameList;
1854   std::string aMeshName = GetCMeshName();
1855   const TGroupNames& aGroupNames = GetGroupNames();
1856   TGroupNames::const_iterator anIter = aGroupNames.begin();
1857   for(; anIter != aGroupNames.end(); anIter++){
1858     const std::string& aGroupName = *anIter;
1859     aGeomNameList<<aGroupName<<"|";   
1860   }
1861   Storable::DataToStream(theStr, "myGeomNameList",  aGeomNameList.str().c_str());
1862 }
1863
1864 //----------------------------------------------------------------------------
1865 const VISU::ColoredPrs3d_i
1866 ::TGroupNames&
1867 VISU::ColoredPrs3d_i
1868 ::GetGroupNames()
1869 {
1870   return myGroupNames;
1871 }
1872
1873 //----------------------------------------------------------------------------
1874 bool
1875 VISU::ColoredPrs3d_i
1876 ::IsGroupsUsed()
1877 {
1878   return !myGroupNames.empty();
1879 }
1880
1881
1882 //----------------------------------------------------------------------------
1883 void
1884 VISU::ColoredPrs3d_i
1885 ::SetMapScale(double theMapScale)
1886 {
1887   GetSpecificPL()->SetMapScale(theMapScale);
1888 }
1889
1890
1891 //----------------------------------------------------------------------------
1892 void
1893 VISU::ColoredPrs3d_i
1894 ::CreatePipeLine(VISU_PipeLine* thePipeLine)
1895 {
1896   if(MYDEBUG) MESSAGE("ColoredPrs3d_i::CreatePipeLine() - "<<thePipeLine);
1897   myColoredPL = dynamic_cast<VISU_ColoredPL*>(thePipeLine);
1898
1899   SetPipeLine(myColoredPL);
1900 }
1901
1902 //----------------------------------------------------------------------------
1903
1904
1905 VISU::Storable* 
1906 VISU::ColoredPrs3d_i
1907 ::Build(EBuildMode theBuildMode)
1908 {
1909   if(MYDEBUG)
1910     MESSAGE("ColoredPrs3d_i::Build - "<<myFieldName<<"; theBuildMode = "<<theBuildMode);
1911   SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
1912   bool anIsPublishInStudy = (myPublishInStudyMode == EPublishUnderTimeStamp || myPublishInStudyMode == EPublishIndependently);
1913   if(anIsPublishInStudy) 
1914     aStudyBuilder->NewCommand();  // There is a transaction
1915 #ifndef _DEXCEPT_
1916   try{
1917 #endif
1918     QString aComment;
1919     SetName("NoName", false);
1920     if(theBuildMode == ECreateNew || theBuildMode == ESameAs){
1921       if(!IsRangeFixed()) 
1922         SetSourceRange();
1923       if(theBuildMode == ECreateNew) 
1924         SetTitle(GetCFieldName().c_str());
1925     }
1926     if(myPublishInStudyMode == EPublishUnderTimeStamp){
1927       SetName(GenerateName().toLatin1().data(), false);
1928       VISU::Storable::TRestoringMap aRestoringMap;
1929       aRestoringMap["myComment"] = "TIMESTAMP";
1930       aRestoringMap["myMeshName"] = GetCMeshName().c_str();
1931       aRestoringMap["myEntityId"] = QString::number(GetEntity());
1932       aRestoringMap["myFieldName"] = GetCFieldName().c_str();
1933       aRestoringMap["myTimeStampId"] = QString::number(GetTimeStampNumber());
1934       aRestoringMap["myNumComponent"] = QString::number(GetScalarField()->myNbComp);
1935       std::string anEntry = GetCResult()->GetEntry(aRestoringMap);
1936       if(anEntry == "") 
1937         throw std::runtime_error("There is no Entry for binding the presentation !!!");
1938       aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
1939                        GetComment(),
1940                        GetCMeshName().c_str(),
1941                        GetEntity(),
1942                        GetCFieldName().c_str(),
1943                        GetTimeStampNumber(),
1944                        GetScalarField()->myNbComp);
1945       CORBA::String_var anIOR = GetID();
1946       CreateAttributes(GetStudyDocument(),
1947                        anEntry,
1948                        GetIconName(),
1949                        anIOR.in(),
1950                        GetName(),
1951                        "",
1952                        aComment.toLatin1().data(),
1953                        true);
1954     }else if(myPublishInStudyMode == EPublishIndependently){
1955       SetName(GenerateName().toLatin1().data(), false);
1956       CORBA::String_var anIOR = GetID();
1957       std::string aFatherEntry = ::FindOrCreate3DPresentationsFolder(GetStudyDocument());
1958       aComment.sprintf("myComment=%s",
1959                        GetComment());
1960       CreateAttributes(GetStudyDocument(),
1961                        aFatherEntry,
1962                        GetIconName(),
1963                        anIOR.in(),
1964                        GetName(),
1965                        "",
1966                        aComment.toLatin1().data(),
1967                        true);
1968     }
1969 #ifndef _DEXCEPT_
1970   }catch(std::exception& exc){
1971     INFOS("Follow exception was occured :\n"<<exc.what());
1972     throw;
1973   }catch(...){
1974     INFOS("Unknown exception was occured!");
1975     throw;
1976   }
1977 #endif
1978
1979   if(anIsPublishInStudy) 
1980     aStudyBuilder->CommitCommand();
1981   return this;
1982 }
1983
1984 //----------------------------------------------------------------------------
1985 void
1986 VISU::ColoredPrs3d_i
1987 ::SetIsDistributionVisible(CORBA::Boolean isVisible)
1988 {
1989   if( myIsDistributionVisible != isVisible ){
1990     VISU::TSetModified aModified(this);
1991     myIsDistributionVisible = isVisible;
1992     myParamsTime.Modified();
1993   }
1994 }
1995
1996 //----------------------------------------------------------------------------
1997 CORBA::Boolean
1998 VISU::ColoredPrs3d_i
1999 ::GetIsDistributionVisible()
2000 {
2001   return myIsDistributionVisible;
2002 }
2003
2004 //----------------------------------------------------------------------------
2005
2006
2007 int
2008 VISU::ColoredPrs3d_i
2009 ::GetValLblFontType() const
2010 {
2011   return myValLblFontType;
2012 }
2013
2014 //----------------------------------------------------------------------------
2015
2016 void
2017 VISU::ColoredPrs3d_i
2018 ::SetValLblFontType( const int theType )
2019 {
2020   if ( myValLblFontType == theType )
2021     return;
2022
2023   VISU::TSetModified aModified( this );
2024
2025   myValLblFontType = theType;
2026   myParamsTime.Modified();
2027 }
2028
2029 //----------------------------------------------------------------------------
2030
2031 double
2032 VISU::ColoredPrs3d_i
2033 ::GetValLblFontSize() const
2034 {
2035   return myValLblFontSize;
2036 }
2037
2038 //----------------------------------------------------------------------------
2039
2040 void
2041 VISU::ColoredPrs3d_i
2042 ::SetValLblFontSize( const double theSize )
2043 {
2044   if ( VISU::CheckIsSameValue( myValLblFontSize, theSize ) )
2045     return;
2046
2047   VISU::TSetModified aModified( this );
2048
2049   myValLblFontSize = theSize;
2050   myParamsTime.Modified();
2051 }
2052
2053 //----------------------------------------------------------------------------
2054
2055 void
2056 VISU::ColoredPrs3d_i
2057 ::GetValLblFontColor( double& theR, 
2058                       double& theG, 
2059                       double& theB ) const
2060 {
2061   theR = myValLblFontColor[ 0 ];
2062   theG = myValLblFontColor[ 1 ];
2063   theB = myValLblFontColor[ 2 ];
2064 }
2065
2066 //----------------------------------------------------------------------------
2067
2068 void
2069 VISU::ColoredPrs3d_i
2070 ::SetValLblFontColor( const double theR, 
2071                       const double theG, 
2072                       const double theB )
2073 {
2074   if ( VISU::CheckIsSameValue( myValLblFontColor[ 0 ], theR ) &&
2075        VISU::CheckIsSameValue( myValLblFontColor[ 1 ], theG ) &&
2076        VISU::CheckIsSameValue (myValLblFontColor[ 2 ], theB ) )
2077     return;
2078
2079   VISU::TSetModified aModified(this);
2080
2081   myValLblFontColor[ 0 ] = theR; 
2082   myValLblFontColor[ 1 ] = theG; 
2083   myValLblFontColor[ 2 ] = theB; 
2084   myParamsTime.Modified();
2085 }
2086
2087 //----------------------------------------------------------------------------
2088
2089 bool
2090 VISU::ColoredPrs3d_i
2091 ::IsBoldValLbl() const
2092 {
2093   return myIsBoldValLbl;
2094 }
2095
2096 //----------------------------------------------------------------------------
2097
2098 void
2099 VISU::ColoredPrs3d_i
2100 ::SetBoldValLbl( const bool theVal )
2101 {
2102   if ( myIsBoldValLbl == theVal )
2103     return;
2104
2105   VISU::TSetModified aModified( this );
2106
2107   myIsBoldValLbl =  theVal;
2108   myParamsTime.Modified();
2109 }
2110
2111 //----------------------------------------------------------------------------
2112
2113 bool
2114 VISU::ColoredPrs3d_i
2115 ::IsItalicValLbl() const
2116 {
2117   return myIsItalicValLbl;
2118 }
2119
2120 //----------------------------------------------------------------------------
2121
2122 void
2123 VISU::ColoredPrs3d_i
2124 ::SetItalicValLbl( const bool theVal )
2125 {
2126   if ( myIsItalicValLbl == theVal )
2127     return;
2128
2129   VISU::TSetModified aModified( this );
2130
2131   myIsItalicValLbl =  theVal;
2132   myParamsTime.Modified();
2133 }
2134
2135 //----------------------------------------------------------------------------
2136
2137 bool
2138 VISU::ColoredPrs3d_i
2139 ::IsShadowValLbl() const
2140 {
2141   return myIsShadowValLbl;
2142 }
2143
2144 //----------------------------------------------------------------------------
2145
2146 void
2147 VISU::ColoredPrs3d_i
2148 ::SetShadowValLbl( const bool theVal )
2149 {
2150   if ( myIsShadowValLbl == theVal )
2151     return;
2152
2153   VISU::TSetModified aModified( this );
2154
2155   myIsShadowValLbl =  theVal;
2156   myParamsTime.Modified();
2157 }
2158
2159 //----------------------------------------------------------------------------
2160
2161 void
2162 VISU::ColoredPrs3d_i
2163 ::UpdateMapperLookupTable()
2164 {
2165   ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
2166     (GetSpecificPL(), &VISU_ColoredPL::UpdateMapperLookupTable));
2167 }
2168
2169 //----------------------------------------------------------------------------^