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