]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_ScalarMap_i.cc
Salome HOME
Preferences for VISU module.
[modules/visu.git] / src / VISU_I / VISU_ScalarMap_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_ScalarMap_i.hh"
28
29 #include "VISU_Result_i.hh"
30 #include "VISU_ViewManager_i.hh"
31
32 #include "VISU_ScalarMapPL.hxx"
33 #include "VISU_ScalarMapAct.h"
34
35 #include "SUIT_ResourceMgr.h"
36
37 #include <vtkDataSetMapper.h>
38 #include <vtkTextProperty.h>
39
40 using namespace VISU;
41 using namespace std;
42
43 #ifdef _DEBUG_
44 static int MYDEBUG = 0;
45 #else
46 static int MYDEBUG = 0;
47 #endif
48
49 static int INCMEMORY = 4;
50
51 int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
52                                   const char* theFieldName, int theIteration, int isMemoryCheck)
53 {
54   try{
55     float aSize = INCMEMORY*
56       theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
57     bool aResult = true;
58     if(isMemoryCheck){
59       aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
60       MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
61     }
62     return aResult;
63   }catch(std::exception& exc){
64     INFOS("Follow exception was occured :\n"<<exc.what());
65   }catch(...){
66     INFOS("Unknown exception was occured!");
67   }
68   return 0;
69 }
70
71 int VISU::ScalarMap_i::myNbPresent = 0;
72 QString VISU::ScalarMap_i::GenerateName() { return VISU::GenerateName("ScalarMap",myNbPresent++);}
73
74 const string VISU::ScalarMap_i::myComment = "SCALARMAP";
75 const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
76 VISU::ScalarMap_i::
77 ScalarMap_i(Result_i* theResult,
78             bool theAddToStudy) :
79   PrsObject_i(theResult->GetStudyDocument()),
80   Prs3d_i(theResult,theAddToStudy),
81   myScalarMapPL(NULL)
82 {
83 }
84
85
86 VISU::ScalarMap_i::
87 ScalarMap_i(Result_i* theResult,
88             SALOMEDS::SObject_ptr theSObject) :
89   PrsObject_i(theResult->GetStudyDocument()),
90   Prs3d_i(theResult,theSObject),
91   myScalarMapPL(NULL)
92 {
93 }
94
95
96 void VISU::ScalarMap_i::RemoveFromStudy()
97 {
98   VISU::DeleteActors(this);
99   VISU::RemoveFromStudy(mySObject,false);
100 }
101
102
103 void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin)
104 {
105   ScalarMap_i* aScalarMap = const_cast<ScalarMap_i*>(theOrigin);
106   DoHook();
107   VISU::Prs3d_i::SameAs(aScalarMap);
108   myField = aScalarMap->GetField();
109   myMeshName = myField->myMeshName;
110   myEntity = myField->myEntity;
111   myIteration = aScalarMap->GetIteration();
112   myFieldName = aScalarMap->GetFieldName();
113
114   SetScalarMode(aScalarMap->GetScalarMode());
115
116   SetRange(aScalarMap->GetMin(), aScalarMap->GetMax());
117   myIsFixedRange = aScalarMap->IsRangeFixed();
118
119   SetScaling(aScalarMap->GetScaling());
120
121   SetBarOrientation(aScalarMap->GetBarOrientation());
122   SetPosition(aScalarMap->GetPosX(), aScalarMap->GetPosY());
123   SetSize(aScalarMap->GetWidth(), aScalarMap->GetHeight());
124   SetNbColors(aScalarMap->GetNbColors());
125   SetLabels(aScalarMap->GetLabels());
126   SetTitle(aScalarMap->GetTitle());
127
128   SetBoldTitle(aScalarMap->IsBoldTitle());
129   SetItalicTitle(aScalarMap->IsItalicTitle());
130   SetShadowTitle(aScalarMap->IsShadowTitle());
131   SetTitFontType(aScalarMap->GetTitFontType());
132   float r,g,b;
133   aScalarMap->GetTitleColor(&r,&g,&b);
134   SetTitleColor(r,g,b);
135
136   SetBoldLabel(aScalarMap->IsBoldLabel());
137   SetItalicLabel(aScalarMap->IsItalicLabel());
138   SetShadowLabel(aScalarMap->IsShadowLabel());
139   SetLblFontType(aScalarMap->GetLblFontType());
140   aScalarMap->GetLabelColor(&r,&g,&b);
141   SetLabelColor(r,g,b);
142
143   Build(-1);
144   Update();
145 }
146
147
148 /**
149  * Creates Scalar Map and initialises it from resources
150  */
151 VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity,
152                                           const char* theFieldName, int theIteration)
153 {
154   DoHook();
155
156   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
157
158   int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
159   SetScalarMode(aScalarMode);
160   
161   // Orientation
162   int orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
163   if (orient == 1)
164     myOrientation = VISU::ScalarMap::HORIZONTAL;
165   else
166     myOrientation = VISU::ScalarMap::VERTICAL;
167
168   // Scalar Bar origin
169   QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
170
171   float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2;
172   aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
173   myPosition[0] = aXorigin;
174   
175   float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012;
176   aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
177   myPosition[1] = aYorigin;
178   
179   // Scalar Bar size
180   myWidth = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.1 : 0.6;
181   myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
182   
183   myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12;
184   myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
185
186   // Nb of Colors
187   int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
188   SetNbColors(aNumberOfColors);
189
190   // Nb of Labels
191   myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
192   
193   // Scalar Range
194   int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
195   myIsFixedRange = (rangeType == 1) ? true : false;
196
197   if (myIsFixedRange)
198     {
199       float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
200       float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
201       SetRange(aMin,aMax);
202     }
203   
204   bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
205     
206   if( isLog )
207     SetScaling(VISU::LOGARITHMIC);
208   else
209     SetScaling(VISU::LINEAR);
210
211   // Fonts properties definition
212   myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
213   myTitFontType = VTK_ARIAL;
214  
215   if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
216     {
217       QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
218       
219       if ( f.family() == "Arial" )
220         myTitFontType = VTK_ARIAL;
221       else if ( f.family() == "Courier" )
222         myTitFontType = VTK_COURIER;
223       else if ( f.family() == "Times" )
224         myTitFontType = VTK_TIMES;
225       
226       myIsBoldTitle   = f.bold();
227       myIsItalicTitle = f.italic();
228       myIsShadowTitle =  f.underline();
229     }
230   
231   QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
232   
233   myTitleColor[0] = aTextColor.red()   / 255; 
234   myTitleColor[1] = aTextColor.green() / 255;
235   myTitleColor[2] = aTextColor.blue()  / 255;
236   
237   ///
238
239   myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
240   myLblFontType = VTK_ARIAL;
241   
242   if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
243     {
244       QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
245       
246       if ( f.family() == "Arial" )
247         myLblFontType = VTK_ARIAL;
248       else if ( f.family() == "Courier" )
249         myLblFontType = VTK_COURIER;
250       else if ( f.family() == "Times" )
251         myLblFontType = VTK_TIMES;
252       
253       myIsBoldLabel   = f.bold();
254       myIsItalicLabel = f.italic();
255       myIsShadowLabel =  f.underline();
256     }
257
258   QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
259   
260   myLabelColor[0] = aLabelColor.red()   / 255; 
261   myLabelColor[1] = aLabelColor.green() / 255;
262   myLabelColor[2] = aLabelColor.blue()  / 255;
263
264
265   myMeshName = theMeshName;
266   myEntity = (VISU::TEntity)theEntity;
267   myFieldName =theFieldName;
268   myIteration = theIteration;
269
270   return Build(false);
271 }
272
273
274 VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap)
275 {
276   DoHook();
277   myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
278   myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
279   myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
280   myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
281
282   SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
283   SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
284   float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
285   float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
286   SetRange(aMin,aMax);
287   myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt();
288
289   myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
290   myOrientation = (VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt();
291   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
292   myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
293   myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
294   myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
295   myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
296   myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
297
298   myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
299   myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
300   myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
301   myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
302   myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
303   myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
304   myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
305
306   myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
307   myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
308   myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
309   myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
310   myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
311   myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
312   myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
313
314   Prs3d_i::Restore(theMap);
315   myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
316   return Build(true);
317 }
318
319
320 void VISU::ScalarMap_i::ToStream(std::ostringstream& theStr){
321   Prs3d_i::ToStream(theStr);
322
323   Storable::DataToStream( theStr, "myMeshName",       myMeshName.c_str() );
324   Storable::DataToStream( theStr, "myEntity",         myEntity );
325   Storable::DataToStream( theStr, "myFieldName",      myFieldName.c_str() );
326   Storable::DataToStream( theStr, "myIteration",      myIteration );
327
328   Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
329   Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
330   Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
331   Storable::DataToStream( theStr, "myIsFixedRange",   myIsFixedRange );
332   Storable::DataToStream( theStr, "myScaling",        GetScaling() );
333
334   Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
335   Storable::DataToStream( theStr, "myOrientation",    myOrientation );
336   Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
337   Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
338   Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
339   Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
340   Storable::DataToStream( theStr, "myWidth",          myWidth );
341   Storable::DataToStream( theStr, "myHeight",         myHeight );
342
343   Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
344   Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
345   Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
346   Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
347   Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
348   Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
349   Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
350
351   Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
352   Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
353   Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
354   Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
355   Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
356   Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
357   Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
358 }
359
360
361 CORBA::Long VISU::ScalarMap_i::GetScalarMode(){
362   return myScalarMapPL->GetScalarMode();
363 }
364 void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode) {
365   myScalarMapPL->SetScalarMode(theScalarMode);
366 }
367
368
369 VISU::Scaling VISU::ScalarMap_i::GetScaling(){
370   return VISU::Scaling(myScalarMapPL->GetScaling());
371 }
372 void VISU::ScalarMap_i::SetScaling(VISU::Scaling theScaling){
373   myScalarMapPL->SetScaling(theScaling);
374 }
375
376
377 void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax){
378   if(theMin > theMax) return;
379   float aScalarRange[2] = {theMin, theMax};
380   myScalarMapPL->SetScalarRange(aScalarRange);
381   myIsFixedRange = true;
382 }
383
384 CORBA::Double VISU::ScalarMap_i::GetMin(){
385   return myScalarMapPL->GetScalarRange()[0];
386 }
387
388 CORBA::Double VISU::ScalarMap_i::GetMax(){
389   return myScalarMapPL->GetScalarRange()[1];
390 }
391
392
393 void VISU::ScalarMap_i::SetNbColors(CORBA::Long theNbColors){
394   myScalarMapPL->SetNbColors(theNbColors);
395 }
396
397 CORBA::Long VISU::ScalarMap_i::GetNbColors(){
398   return myScalarMapPL->GetNbColors();
399 }
400
401
402 VISU::ScalarMap_i::~ScalarMap_i(){}
403
404
405 VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
406   if(MYDEBUG)
407     MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
408   SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
409   if(myAddToStudy) aStudyBuilder->NewCommand();  // There is a transaction
410   try{
411     if(myResult->GetInput() == NULL)
412       throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
413     myField = myResult->GetInput()->GetField(myMeshName,myEntity,myFieldName);
414     if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!");
415     VISU_Convertor::TOutput *anOutput =
416       myResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
417     if(anOutput == NULL) throw std::runtime_error("There is no TimeStamp with the parameters !!!");
418     myScalarMapPL->SetInput(anOutput);
419     myScalarMapPL->Build();
420     QString aComment;
421     myName = "NoName";
422     if(theRestoring <= 0){
423       if(theRestoring == 0) myScalarMapPL->Init();
424       if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
425       const VISU::TValField& aValField = myField->myValField;
426       const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
427       aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
428       if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
429     }
430     if(myAddToStudy){
431       myName = GenerateName().latin1();
432       aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
433                        VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
434       string aResultEntry = myResult->GetEntry();
435       string aRefFatherEntry = myResult->GetRefFatherEntry();
436       string anEntry = myResult->GetEntry(aComment.latin1());
437       if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
438       aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
439                        GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
440       CORBA::String_var anIOR = GetID();
441       CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
442       mySObject = myStudy->FindObjectIOR(anIOR);
443     }
444   }catch(std::exception& exc){
445     INFOS("Follow exception was occured :\n"<<exc.what());
446     return NULL;
447   }catch(...){
448     INFOS("Unknown exception was occured!");
449     return NULL;
450   }
451   if(myAddToStudy) aStudyBuilder->CommitCommand();
452   return this;
453 }
454
455
456 void VISU::ScalarMap_i::DoHook(){
457   if(MYDEBUG)  MESSAGE("ScalarMap_i::DoHook() - "<<myPipeLine);
458   if(!myPipeLine) {
459     myPipeLine = VISU_ScalarMapPL::New();
460     myPipeLine->GetMapper()->SetScalarVisibility(1);
461   }
462   myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
463 }
464
465 void VISU::ScalarMap_i::Update() {
466   VISU::Prs3d_i::Update();
467 }
468
469 void VISU::ScalarMap_i::SetMapScale(double theMapScale){
470   myScalarMapPL->SetMapScale(theMapScale);
471 }
472
473 VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
474 {
475   VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New();
476   try{
477     VISU::Prs3d_i::CreateActor(anActor,theIO);
478     anActor->SetBarVisibility(true);
479     anActor->SetRepresentation(2);
480     UpdateActor(anActor);
481   }catch(...) {
482     anActor->Delete();
483     throw std::runtime_error("CreateActor error");
484   }
485   return anActor;
486 }
487
488 void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) {
489   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
490     VISU::Prs3d_i::UpdateActor(theActor);
491     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
492     aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable());
493     aScalarBar->SetTitle(myTitle.c_str());
494     aScalarBar->SetOrientation(myOrientation);
495     aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
496     aScalarBar->GetPositionCoordinate()->SetValue(myPosition[0],myPosition[1]);
497     aScalarBar->SetWidth(myWidth);
498     aScalarBar->SetHeight(myHeight);
499     aScalarBar->SetNumberOfLabels(myNumberOfLabels);
500
501     vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
502     aTitleProp->SetFontFamily(myTitFontType);
503     aTitleProp->SetColor(myTitleColor);
504     (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
505     (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
506     (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
507
508     vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
509     aLabelProp->SetFontFamily(myLblFontType);
510     aLabelProp->SetColor(myLabelColor);
511     (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
512     (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
513     (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
514
515     aScalarBar->Modified();
516   }
517 }
518
519
520 void VISU::ScalarMap_i::SetSourceRange(){
521   myScalarMapPL->SetSourceRange();
522   myIsFixedRange = false;
523 }