Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISU_I / VISU_ColoredPrs3d_i.cc
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //  File   : VISU_PrsObject_i.cxx
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #include "VISU_ColoredPrs3d_i.hh"
28
29 #include "VISU_ScalarMapPL.hxx"
30 #include "VISU_Result_i.hh"
31 #include "VISU_Convertor.hxx"
32
33 #include "SUIT_ResourceMgr.h"
34 #include "SALOME_Event.hxx"
35
36 #include <vtkMapper.h>
37
38 using namespace VISU;
39 using namespace std;
40
41 #ifdef _DEBUG_
42 static int MYDEBUG = 0;
43 //#define _DEXCEPT_
44 #else
45 static int MYDEBUG = 0;
46 #endif
47
48
49 //============================================================================
50 VISU::ColoredPrs3d_i::
51 ColoredPrs3d_i(Result_i* theResult,
52                bool theAddToStudy) :
53   PrsObject_i(theResult->GetStudyDocument()),
54   Prs3d_i(theResult,theAddToStudy),
55   myScalarMapPL(NULL),
56   myIsFixedRange(false)
57 {}
58
59 VISU::ColoredPrs3d_i::
60 ColoredPrs3d_i(Result_i* theResult,
61                SALOMEDS::SObject_ptr theSObject) :
62   PrsObject_i(theResult->GetStudyDocument()),
63   Prs3d_i(theResult,theSObject),
64   myScalarMapPL(NULL),
65   myIsFixedRange(false)
66 {}
67
68 VISU::ColoredPrs3d_i
69 ::~ColoredPrs3d_i()
70 {}
71
72 //---------------------------------------------------------------
73 void 
74 VISU::ColoredPrs3d_i
75 ::RemoveFromStudy()
76 {
77   struct TRemoveFromStudy: public SALOME_Event
78   {
79     VISU::ColoredPrs3d_i* myRemovable;
80     TRemoveFromStudy(VISU::ColoredPrs3d_i* theRemovable):
81       myRemovable(theRemovable)
82     {}
83     
84     virtual
85     void
86     Execute()
87     {
88       SALOMEDS::SObject_var aSObject = myRemovable->GetSObject();
89       if(!CORBA::is_nil(aSObject.in()))
90         VISU::RemoveFromStudy(aSObject,false);
91       myRemovable->TSuperClass::RemoveFromStudy();
92     }
93   };
94
95   ProcessVoidEvent(new TRemoveFromStudy(this));
96 }
97
98 //---------------------------------------------------------------
99 void
100 VISU::ColoredPrs3d_i
101 ::SameAs(const Prs3d_i* theOrigin)
102 {
103   if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
104     DoHook();
105
106     ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
107  
108     myField = anOrigin->GetField();
109     myMeshName = myField->myMeshName;
110     myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity;
111     myIteration = anOrigin->GetIteration();
112     myFieldName = anOrigin->GetFieldName();
113     
114     Build(-1);
115     
116     TSuperClass::SameAs(theOrigin);
117     
118     SetScalarMode(anOrigin->GetScalarMode());
119     SetNbColors(anOrigin->GetNbColors());
120     SetBarOrientation(anOrigin->GetBarOrientation());
121     
122     SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
123     SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
124     SetLabels(anOrigin->GetLabels());
125     SetTitle(anOrigin->GetTitle());
126     
127     SetBoldTitle(anOrigin->IsBoldTitle());
128     SetItalicTitle(anOrigin->IsItalicTitle());
129     SetShadowTitle(anOrigin->IsShadowTitle());
130     SetTitFontType(anOrigin->GetTitFontType());
131     float r,g,b;
132     anOrigin->GetTitleColor(&r,&g,&b);
133     SetTitleColor(r,g,b);
134     
135     SetBoldLabel(anOrigin->IsBoldLabel());
136     SetItalicLabel(anOrigin->IsItalicLabel());
137     SetShadowLabel(anOrigin->IsShadowLabel());
138     SetLblFontType(anOrigin->GetLblFontType());
139     anOrigin->GetLabelColor(&r,&g,&b);
140     SetLabelColor(r,g,b);
141   }
142 }
143   
144 void
145 VISU::ColoredPrs3d_i
146 ::SameAsParams(const ColoredPrs3d_i* theOrigin)
147 {
148   int anIteration = GetIteration();
149   SameAs(theOrigin);
150   myIteration = anIteration;
151
152   Build(-1);
153   Update();
154 }
155
156
157 //----------------------------------------------------------------------------
158 CORBA::Long 
159 VISU::ColoredPrs3d_i
160 ::GetScalarMode()
161 {
162   return myScalarMapPL->GetScalarMode();
163 }
164
165 void
166 VISU::ColoredPrs3d_i
167 ::SetScalarMode(CORBA::Long theScalarMode) 
168 {
169   myScalarMapPL->SetScalarMode(theScalarMode);
170 }
171
172 CORBA::Double 
173 VISU::ColoredPrs3d_i
174 ::GetMin()
175 {
176   return myScalarMapPL->GetScalarRange()[0];
177 }
178
179 CORBA::Double 
180 VISU::ColoredPrs3d_i
181 ::GetMax()
182 {
183   return myScalarMapPL->GetScalarRange()[1];
184 }
185
186 void
187 VISU::ColoredPrs3d_i
188 ::SetNbColors(CORBA::Long theNbColors)
189 {
190   myScalarMapPL->SetNbColors(theNbColors);
191 }
192
193 CORBA::Long 
194 VISU::ColoredPrs3d_i
195 ::GetNbColors()
196 {
197   return myScalarMapPL->GetNbColors();
198 }
199
200 void
201 VISU::ColoredPrs3d_i
202 ::SetBarOrientation(VISU::ScalarMap::Orientation theOrientation)
203 {
204   myOrientation = theOrientation;
205 }
206
207 VISU::ScalarMap::Orientation 
208 VISU::ColoredPrs3d_i
209 ::GetBarOrientation() 
210 {
211   return myOrientation;
212 }
213
214 void
215 VISU::ColoredPrs3d_i
216 ::SetPosition(CORBA::Double X, CORBA::Double Y) 
217
218   myPosition[0] = X; 
219   myPosition[1] = Y;
220 }
221
222 CORBA::Double
223 VISU::ColoredPrs3d_i
224 ::GetPosX() 
225 {
226   return myPosition[0];
227 }
228
229 CORBA::Double
230 VISU::ColoredPrs3d_i
231 ::GetPosY() 
232
233   return myPosition[1];
234 }
235
236 void
237 VISU::ColoredPrs3d_i
238 ::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) 
239 {
240   myWidth = theWidth; 
241   myHeight = theHeight;
242 }
243
244 CORBA::Double
245 VISU::ColoredPrs3d_i
246 ::GetWidth() 
247 {
248   return myWidth;
249 }
250
251 CORBA::Double
252 VISU::ColoredPrs3d_i
253 ::GetHeight() 
254
255   return myHeight;
256 }
257
258 void
259 VISU::ColoredPrs3d_i
260 ::SetLabels(CORBA::Long theNbLabels)
261 {
262   myNumberOfLabels = theNbLabels;
263 }
264
265 CORBA::Long
266 VISU::ColoredPrs3d_i
267 ::GetLabels() 
268
269   return myNumberOfLabels;
270 }
271
272 void
273 VISU::ColoredPrs3d_i
274 ::SetTitle(const char* theName) 
275 {
276   myTitle = theName;
277 }
278
279 char* 
280 VISU::ColoredPrs3d_i
281 ::GetTitle() 
282
283   return CORBA::string_dup(myTitle.c_str());
284 }
285
286 bool
287 VISU::ColoredPrs3d_i
288 ::IsBoldTitle() 
289
290   return myIsBoldTitle;
291 }
292
293 void
294 VISU::ColoredPrs3d_i
295 ::SetBoldTitle(bool isBold)
296 {
297   myIsBoldTitle = isBold;
298 }
299
300 bool
301 VISU::ColoredPrs3d_i
302 ::IsItalicTitle() 
303
304   return myIsItalicTitle;
305 }
306
307 void
308 VISU::ColoredPrs3d_i
309 ::SetItalicTitle(bool isItalic)
310
311   myIsItalicTitle = isItalic;
312 }
313
314 bool
315 VISU::ColoredPrs3d_i
316 ::IsShadowTitle() 
317
318   return myIsShadowTitle;
319 }
320
321 void
322 VISU::ColoredPrs3d_i
323 ::SetShadowTitle(bool isShadow)
324
325   myIsShadowTitle = isShadow;
326 }
327
328 int
329 VISU::ColoredPrs3d_i
330 ::GetTitFontType()
331 {
332   return myTitFontType;
333 }
334
335 void
336 VISU::ColoredPrs3d_i
337 ::SetTitFontType(int theType)
338 {
339   myTitFontType = theType;
340 }
341
342 void
343 VISU::ColoredPrs3d_i
344 ::GetTitleColor(float* theR, float* theG, float* theB)
345 {
346   *theR = myTitleColor[0]; 
347   *theG = myTitleColor[1]; 
348   *theB = myTitleColor[2];
349 }
350
351 void
352 VISU::ColoredPrs3d_i
353 ::SetTitleColor(float theR, float theG, float theB)
354 {
355   myTitleColor[0] = theR; 
356   myTitleColor[1] = theG; 
357   myTitleColor[2] = theB; 
358 }
359
360 bool
361 VISU::ColoredPrs3d_i
362 ::IsBoldLabel()
363 {
364   return myIsBoldLabel;
365 }
366
367 void
368 VISU::ColoredPrs3d_i
369 ::SetBoldLabel(bool isBold) 
370 {
371   myIsBoldLabel = isBold;
372 }
373
374 bool
375 VISU::ColoredPrs3d_i
376 ::IsItalicLabel() 
377 {
378   return myIsItalicLabel;
379 }
380
381 void
382 VISU::ColoredPrs3d_i
383 ::SetItalicLabel(bool isItalic)
384 {
385   myIsItalicLabel = isItalic;
386 }
387
388 bool
389 VISU::ColoredPrs3d_i
390 ::IsShadowLabel() 
391 {
392   return myIsShadowLabel;
393 }
394
395 void
396 VISU::ColoredPrs3d_i
397 ::SetShadowLabel(bool isShadow)
398 {
399   myIsShadowLabel = isShadow;
400 }
401
402 int
403 VISU::ColoredPrs3d_i
404 ::GetLblFontType()
405 {
406   return myLblFontType;
407 }
408
409 void
410 VISU::ColoredPrs3d_i
411 ::SetLblFontType(int theType)
412 {
413   myLblFontType = theType;
414 }
415
416 void
417 VISU::ColoredPrs3d_i
418 ::GetLabelColor(float* theR, float* theG, float* theB)
419 {
420   *theR = myLabelColor[0]; 
421   *theG = myLabelColor[1]; 
422   *theB = myLabelColor[2];
423 }
424
425 void
426 VISU::ColoredPrs3d_i
427 ::SetLabelColor(float theR, float theG, float theB)
428 {
429   myLabelColor[0] = theR; 
430   myLabelColor[1] = theG; 
431   myLabelColor[2] = theB; 
432 }
433
434
435 //----------------------------------------------------------------------------
436 /**
437  * Creates ColoredPrs3d and initialises it from resources
438  */
439 VISU::Storable* 
440 VISU::ColoredPrs3d_i
441 ::Create(const char* theMeshName, 
442          VISU::Entity theEntity,
443          const char* theFieldName, 
444          int theIteration)
445 {
446   DoHook(); // to create proper pipeline
447
448   myMeshName = theMeshName;
449   myEntity = (VISU::TEntity)theEntity;
450   myFieldName =theFieldName;
451   myIteration = theIteration;
452
453   Build(false); // to get corresponding input from result and initilize the pipeline
454
455   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
456
457   int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
458   SetScalarMode(aScalarMode);
459
460   int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
461   SetNbColors(aNumberOfColors);
462
463   // Orientation
464   int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
465   if(anOrientation == 1)
466     myOrientation = VISU::ScalarMap::HORIZONTAL;
467   else
468     myOrientation = VISU::ScalarMap::VERTICAL;
469
470   // Scalar Bar origin
471   QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
472
473   float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2;
474   aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
475   myPosition[0] = aXorigin;
476
477   float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012;
478   aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
479   myPosition[1] = aYorigin;
480
481   // Scalar Bar size
482   myWidth = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.1 : 0.6;
483   myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
484
485   myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12;
486   myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
487
488   // scalar bar default position
489   bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
490   int aPlace = 1;
491   if (anIsArrangeBar){
492     aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
493   }
494   if(myOrientation == VISU::ScalarMap::HORIZONTAL){
495     myPosition[1] += myHeight*(aPlace-1);
496   } else {
497     myPosition[0] += myWidth*(aPlace-1);
498   }
499
500   // Nb of Labels
501   myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
502
503   // Fonts properties definition
504   myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
505   myTitFontType = VTK_ARIAL;
506
507   if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
508     QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
509     if ( f.family() == "Arial" )
510       myTitFontType = VTK_ARIAL;
511     else if ( f.family() == "Courier" )
512       myTitFontType = VTK_COURIER;
513     else if ( f.family() == "Times" )
514       myTitFontType = VTK_TIMES;
515     
516     myIsBoldTitle   = f.bold();
517     myIsItalicTitle = f.italic();
518     myIsShadowTitle =  f.underline();
519   }
520
521   QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
522
523   myTitleColor[0] = aTextColor.red()   / 255;
524   myTitleColor[1] = aTextColor.green() / 255;
525   myTitleColor[2] = aTextColor.blue()  / 255;
526
527   myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
528   myLblFontType = VTK_ARIAL;
529
530   if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
531     QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
532     if ( f.family() == "Arial" )
533       myLblFontType = VTK_ARIAL;
534     else if ( f.family() == "Courier" )
535       myLblFontType = VTK_COURIER;
536     else if ( f.family() == "Times" )
537       myLblFontType = VTK_TIMES;
538     
539     myIsBoldLabel   = f.bold();
540     myIsItalicLabel = f.italic();
541     myIsShadowLabel =  f.underline();
542   }
543
544   QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
545
546   myLabelColor[0] = aLabelColor.red()   / 255;
547   myLabelColor[1] = aLabelColor.green() / 255;
548   myLabelColor[2] = aLabelColor.blue()  / 255;
549
550   return this;
551 }
552
553 VISU::Storable* 
554 VISU::ColoredPrs3d_i
555 ::Restore(const Storable::TRestoringMap& theMap)
556 {
557   DoHook();
558
559   myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
560   myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
561   myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
562   myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
563
564   myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
565
566   Build(true);
567
568   TSuperClass::Restore(theMap);
569
570   SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
571   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
572   SetBarOrientation((VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
573   
574   myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
575   myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
576   myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
577   myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
578   myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
579   myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
580
581   myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
582   myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
583   myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
584   myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
585   myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
586   myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
587   myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
588
589   myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
590   myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
591   myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
592   myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
593   myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
594   myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
595   myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
596
597   return this;
598 }
599
600 void 
601 VISU::ColoredPrs3d_i
602 ::ToStream(std::ostringstream& theStr)
603 {
604   TSuperClass::ToStream(theStr);
605
606   Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
607   Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
608   Storable::DataToStream( theStr, "myOrientation",    myOrientation );
609
610   Storable::DataToStream( theStr, "myMeshName",       myMeshName.c_str() );
611   Storable::DataToStream( theStr, "myEntity",         myEntity );
612   Storable::DataToStream( theStr, "myFieldName",      myFieldName.c_str() );
613   Storable::DataToStream( theStr, "myIteration",      myIteration );
614
615   Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
616   Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
617   Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
618   Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
619   Storable::DataToStream( theStr, "myWidth",          myWidth );
620   Storable::DataToStream( theStr, "myHeight",         myHeight );
621
622   Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
623   Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
624   Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
625   Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
626   Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
627   Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
628   Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
629
630   Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
631   Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
632   Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
633   Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
634   Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
635   Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
636   Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
637 }
638
639
640 //----------------------------------------------------------------------------
641 void
642 VISU::ColoredPrs3d_i
643 ::DoHook()
644 {
645   if(MYDEBUG) MESSAGE("ColoredPrs3d_i::DoHook() - "<<myPipeLine);
646   if(!myPipeLine){
647     myPipeLine = VISU_ScalarMapPL::New();
648     myPipeLine->GetMapper()->SetScalarVisibility(1);
649   }
650   myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
651 }
652
653 //----------------------------------------------------------------------------
654 VISU::Storable* 
655 VISU::ColoredPrs3d_i
656 ::Build(int theRestoring)
657 {
658   if(MYDEBUG)
659     MESSAGE("ColoredPrs3d_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
660   SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
661   if(myAddToStudy) 
662     aStudyBuilder->NewCommand();  // There is a transaction
663 #ifndef _DEXCEPT_
664   try{
665 #endif
666     DoSetInput(myResult);
667     QString aComment;
668     myName = "NoName";
669     if(theRestoring <= 0){
670       if(theRestoring == 0) myScalarMapPL->Init();
671       if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
672       const VISU::TValField& aValField = myField->myValField;
673       const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
674       aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
675       if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
676     }
677     if(myAddToStudy){
678       myName = GenerateName().latin1();
679       aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
680                        VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
681       string aResultEntry = myResult->GetEntry();
682       string aRefFatherEntry = myResult->GetRefFatherEntry();
683       string anEntry = myResult->GetEntry(aComment.latin1());
684       if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
685       aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
686                        GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
687       CORBA::String_var anIOR = GetID();
688       CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
689       mySObject = myStudy->FindObjectIOR(anIOR);
690     }
691 #ifndef _DEXCEPT_
692   }catch(std::exception& exc){
693     INFOS("Follow exception was occured :\n"<<exc.what());
694     throw;
695   }catch(...){
696     INFOS("Unknown exception was occured!");
697     throw;
698   }
699 #endif
700   if(myAddToStudy) 
701     aStudyBuilder->CommitCommand();
702   return this;
703 }
704
705
706 //----------------------------------------------------------------------------
707 const VISU::PField&
708 VISU::ColoredPrs3d_i
709 ::GetField() const 
710
711   return myField;
712 }
713
714 const std::string&
715 VISU::ColoredPrs3d_i
716 ::GetMeshName() const 
717
718   return myMeshName;
719 }
720
721 VISU::Entity
722 VISU::ColoredPrs3d_i
723 ::GetEntity() const 
724
725   return VISU::Entity(myEntity);
726 }
727
728 const std::string&
729 VISU::ColoredPrs3d_i
730 ::GetFieldName() const 
731
732   return myFieldName;
733 }
734
735 int
736 VISU::ColoredPrs3d_i
737 ::GetIteration() const 
738
739   return myIteration;
740 }
741
742 VISU_ScalarMapPL*
743 VISU::ColoredPrs3d_i
744 ::GetScalarMapPL()
745
746   return myScalarMapPL;
747 }