1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File : VISU_PrsObject_i.cxx
24 // Author : Alexey PETROV
27 #include "VISU_ScalarMap_i.hh"
29 #include "VISU_Result_i.hh"
30 #include "VISU_ViewManager_i.hh"
32 #include "VISU_ScalarMapPL.hxx"
33 #include "VISU_ScalarMapAct.h"
35 #include "SUIT_ResourceMgr.h"
37 #include <vtkDataSetMapper.h>
38 #include <vtkTextProperty.h>
44 static int MYDEBUG = 0;
46 static int MYDEBUG = 0;
49 static int INCMEMORY = 4;
51 int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
52 const char* theFieldName, int theIteration, int isMemoryCheck)
55 float aSize = INCMEMORY*
56 theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
59 aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
60 MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
63 }catch(std::exception& exc){
64 INFOS("Follow exception was occured :\n"<<exc.what());
66 INFOS("Unknown exception was occured!");
71 int VISU::ScalarMap_i::myNbPresent = 0;
72 QString VISU::ScalarMap_i::GenerateName() { return VISU::GenerateName("ScalarMap",myNbPresent++);}
74 const string VISU::ScalarMap_i::myComment = "SCALARMAP";
75 const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
77 ScalarMap_i(Result_i* theResult,
79 PrsObject_i(theResult->GetStudyDocument()),
80 Prs3d_i(theResult,theAddToStudy),
87 ScalarMap_i(Result_i* theResult,
88 SALOMEDS::SObject_ptr theSObject) :
89 PrsObject_i(theResult->GetStudyDocument()),
90 Prs3d_i(theResult,theSObject),
96 void VISU::ScalarMap_i::RemoveFromStudy()
98 VISU::DeleteActors(this);
99 VISU::RemoveFromStudy(mySObject,false);
103 void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin)
105 ScalarMap_i* aScalarMap = const_cast<ScalarMap_i*>(theOrigin);
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();
114 SetScalarMode(aScalarMap->GetScalarMode());
116 SetRange(aScalarMap->GetMin(), aScalarMap->GetMax());
117 myIsFixedRange = aScalarMap->IsRangeFixed();
119 SetScaling(aScalarMap->GetScaling());
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());
128 SetBoldTitle(aScalarMap->IsBoldTitle());
129 SetItalicTitle(aScalarMap->IsItalicTitle());
130 SetShadowTitle(aScalarMap->IsShadowTitle());
131 SetTitFontType(aScalarMap->GetTitFontType());
133 aScalarMap->GetTitleColor(&r,&g,&b);
134 SetTitleColor(r,g,b);
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);
149 * Creates Scalar Map and initialises it from resources
151 VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity,
152 const char* theFieldName, int theIteration)
157 QString aOrient = VISU::GetResourceMgr()->stringValue("Visu:SBOrientation");
158 if ( !aOrient.isEmpty() )
159 myOrientation = (VISU::ScalarMap::Orientation) aOrient.toInt();
161 myOrientation = VISU::ScalarMap::VERTICAL;
164 QString aXorigin = VISU::GetResourceMgr()->stringValue("Visu:SBXorigin");
165 if ( !aXorigin.isEmpty() )
166 myPosition[0] = aXorigin.toFloat();
168 if(myOrientation == VISU::ScalarMap::VERTICAL) {
169 myPosition[0] = 0.03;
175 QString aYorigin = VISU::GetResourceMgr()->stringValue("Visu:SBYorigin");
176 if ( !aYorigin.isEmpty() )
177 myPosition[1] = aYorigin.toFloat();
179 if(myOrientation == VISU::ScalarMap::VERTICAL) {
182 myPosition[1] = 0.012;
187 QString aWidth = VISU::GetResourceMgr()->stringValue("Visu:SBWidth");
188 if ( !aWidth.isEmpty() )
189 myWidth = aWidth.toFloat();
191 myWidth =(myOrientation == VISU::ScalarMap::VERTICAL)? 0.17:0.6;
193 QString aHeight = VISU::GetResourceMgr()->stringValue("Visu:SBHeight");
194 if ( !aHeight.isEmpty() )
195 myHeight = aHeight.toFloat();
197 myHeight =(myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12;
201 QString aColors = VISU::GetResourceMgr()->stringValue("Visu:SBNumberOfColors");
202 int aNumberOfColors = (aColors.isEmpty())? 64 : aColors.toInt();
203 if (aNumberOfColors > 64)
204 aNumberOfColors = 64;
205 SetNbColors(aNumberOfColors);
208 QString aLabels = VISU::GetResourceMgr()->stringValue("Visu:SBNumberOfLabels");
209 myNumberOfLabels = (aLabels.isEmpty())? 5 : aLabels.toInt();
210 if (myNumberOfLabels > 65)
211 myNumberOfLabels = 65;
214 QString aFixRange = VISU::GetResourceMgr()->stringValue("Visu:SBImposeRange");
215 myIsFixedRange = (aFixRange.compare("true") == 0);
218 QString aRangeMin = VISU::GetResourceMgr()->stringValue("Visu:SBMinimumValue");
219 float aMin = (aRangeMin.isEmpty())? 0 : aRangeMin.toFloat();
220 QString aRangeMax = VISU::GetResourceMgr()->stringValue("Visu:SBMaximumValue");
221 float aMax = (aRangeMax.isEmpty())? 0 : aRangeMax.toFloat();
225 QString aScaling = VISU::GetResourceMgr()->stringValue("Visu:SBScaling");
226 if(aScaling.compare("LOGARITHMIC") == 0)
227 SetScaling(VISU::LOGARITHMIC);
229 SetScaling(VISU::LINEAR);
231 // Fonts properties definition
232 QString aIsBoldTitle = VISU::GetResourceMgr()->stringValue("Visu:IsBoldTitle");
233 myIsBoldTitle = (aIsBoldTitle.isEmpty())? true : (aIsBoldTitle.compare("true") == 0);
235 QString aIsItalicTitle = VISU::GetResourceMgr()->stringValue("Visu:IsItalicTitle");
236 myIsItalicTitle = (aIsItalicTitle.isEmpty())? true : (aIsItalicTitle.compare("true") == 0);
238 QString aIsShadowTitle = VISU::GetResourceMgr()->stringValue("Visu:IsShadowTitle");
239 myIsShadowTitle = (aIsShadowTitle.isEmpty())? true : (aIsShadowTitle.compare("true") == 0);
241 QString aTitFontType = VISU::GetResourceMgr()->stringValue("Visu:TitFontType");
242 if (!aTitFontType.isEmpty()) {
243 switch (aTitFontType.toInt()) {
244 case 0: myTitFontType = VTK_ARIAL; break;
245 case 1: myTitFontType = VTK_COURIER; break;
246 case 2: myTitFontType = VTK_TIMES; break;
249 myTitFontType = VTK_ARIAL;
251 QString aRTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorR");
252 myTitleColor[0] = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
253 if (myTitleColor[0] > 1) myTitleColor[0] = 1;
254 if (myTitleColor[0] < 0) myTitleColor[0] = 0;
256 QString aGTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorG");
257 myTitleColor[1] = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
258 if (myTitleColor[1] > 1) myTitleColor[1] = 1;
259 if (myTitleColor[1] < 0) myTitleColor[1] = 0;
261 QString aBTitColor = VISU::GetResourceMgr()->stringValue("Visu:TitleColorB");
262 myTitleColor[2] = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
263 if (myTitleColor[2] > 1) myTitleColor[2] = 1;
264 if (myTitleColor[2] < 0) myTitleColor[2] = 0;
268 QString aIsBoldLabel = VISU::GetResourceMgr()->stringValue("Visu:IsBoldLabel");
269 myIsBoldLabel = (aIsBoldLabel.isEmpty())? true : (aIsBoldLabel.compare("true") == 0);
271 QString aIsItalicLabel = VISU::GetResourceMgr()->stringValue("Visu:IsItalicLabel");
272 myIsItalicLabel = (aIsItalicLabel.isEmpty())? true : (aIsItalicLabel.compare("true") == 0);
274 QString aIsShadowLabel = VISU::GetResourceMgr()->stringValue("Visu:IsShadowLabel");
275 myIsShadowLabel = (aIsShadowLabel.isEmpty())? true : (aIsShadowLabel.compare("true") == 0);
277 QString aLblFontType = VISU::GetResourceMgr()->stringValue("Visu:LblFontType");
278 if (!aLblFontType.isEmpty()) {
279 switch (aLblFontType.toInt()) {
280 case 0: myLblFontType = VTK_ARIAL; break;
281 case 1: myLblFontType = VTK_COURIER; break;
282 case 2: myLblFontType = VTK_TIMES; break;
285 myLblFontType = VTK_ARIAL;
287 QString aRLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorR");
288 myLabelColor[0] = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
289 if (myLabelColor[0] > 1) myLabelColor[0] = 1;
290 if (myLabelColor[0] < 0) myLabelColor[0] = 0;
292 QString aGLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorG");
293 myLabelColor[1] = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
294 if (myLabelColor[1] > 1) myLabelColor[1] = 1;
295 if (myLabelColor[1] < 0) myLabelColor[1] = 0;
297 QString aBLblColor = VISU::GetResourceMgr()->stringValue("Visu:LabelColorB");
298 myLabelColor[2] = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
299 if (myLabelColor[2] > 1) myLabelColor[2] = 1;
300 if (myLabelColor[2] < 0) myLabelColor[2] = 0;
303 myMeshName = theMeshName;
304 myEntity = (VISU::TEntity)theEntity;
305 myFieldName =theFieldName;
306 myIteration = theIteration;
312 VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap)
315 myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
316 myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
317 myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
318 myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
320 SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
321 SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
322 float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
323 float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
325 myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt();
327 myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
328 myOrientation = (VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt();
329 SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
330 myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
331 myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
332 myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
333 myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
334 myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
336 myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
337 myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
338 myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
339 myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
340 myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
341 myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
342 myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
344 myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
345 myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
346 myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
347 myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
348 myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
349 myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
350 myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
352 Prs3d_i::Restore(theMap);
353 myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
358 void VISU::ScalarMap_i::ToStream(std::ostringstream& theStr){
359 Prs3d_i::ToStream(theStr);
361 Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() );
362 Storable::DataToStream( theStr, "myEntity", myEntity );
363 Storable::DataToStream( theStr, "myFieldName", myFieldName.c_str() );
364 Storable::DataToStream( theStr, "myIteration", myIteration );
366 Storable::DataToStream( theStr, "myScalarMode", int(GetScalarMode()) );
367 Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
368 Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
369 Storable::DataToStream( theStr, "myIsFixedRange", myIsFixedRange );
370 Storable::DataToStream( theStr, "myScaling", GetScaling() );
372 Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
373 Storable::DataToStream( theStr, "myOrientation", myOrientation );
374 Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
375 Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
376 Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] );
377 Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
378 Storable::DataToStream( theStr, "myWidth", myWidth );
379 Storable::DataToStream( theStr, "myHeight", myHeight );
381 Storable::DataToStream( theStr, "myTitFontType", myTitFontType );
382 Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle );
383 Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle );
384 Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle );
385 Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] );
386 Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] );
387 Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] );
389 Storable::DataToStream( theStr, "myLblFontType", myLblFontType );
390 Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel );
391 Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel );
392 Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel );
393 Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
394 Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
395 Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
399 CORBA::Long VISU::ScalarMap_i::GetScalarMode(){
400 return myScalarMapPL->GetScalarMode();
402 void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode) {
403 myScalarMapPL->SetScalarMode(theScalarMode);
407 VISU::Scaling VISU::ScalarMap_i::GetScaling(){
408 return VISU::Scaling(myScalarMapPL->GetScaling());
410 void VISU::ScalarMap_i::SetScaling(VISU::Scaling theScaling){
411 myScalarMapPL->SetScaling(theScaling);
415 void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax){
416 if(theMin > theMax) return;
417 float aScalarRange[2] = {theMin, theMax};
418 myScalarMapPL->SetScalarRange(aScalarRange);
419 myIsFixedRange = true;
422 CORBA::Double VISU::ScalarMap_i::GetMin(){
423 return myScalarMapPL->GetScalarRange()[0];
426 CORBA::Double VISU::ScalarMap_i::GetMax(){
427 return myScalarMapPL->GetScalarRange()[1];
431 void VISU::ScalarMap_i::SetNbColors(CORBA::Long theNbColors){
432 myScalarMapPL->SetNbColors(theNbColors);
435 CORBA::Long VISU::ScalarMap_i::GetNbColors(){
436 return myScalarMapPL->GetNbColors();
440 VISU::ScalarMap_i::~ScalarMap_i(){}
443 VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
445 MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
446 SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
447 if(myAddToStudy) aStudyBuilder->NewCommand(); // There is a transaction
449 if(myResult->GetInput() == NULL)
450 throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
451 myField = myResult->GetInput()->GetField(myMeshName,myEntity,myFieldName);
452 if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!");
453 VISU_Convertor::TOutput *anOutput =
454 myResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
455 if(anOutput == NULL) throw std::runtime_error("There is no TimeStamp with the parameters !!!");
456 myScalarMapPL->SetInput(anOutput);
457 myScalarMapPL->Build();
460 if(theRestoring <= 0){
461 if(theRestoring == 0) myScalarMapPL->Init();
462 if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
463 const VISU::TValField& aValField = myField->myValField;
464 const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
465 aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
466 if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
469 myName = GenerateName().latin1();
470 aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
471 VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
472 string aResultEntry = myResult->GetEntry();
473 string aRefFatherEntry = myResult->GetRefFatherEntry();
474 string anEntry = myResult->GetEntry(aComment.latin1());
475 if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
476 aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
477 GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
478 CORBA::String_var anIOR = GetID();
479 CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
480 mySObject = myStudy->FindObjectIOR(anIOR);
482 }catch(std::exception& exc){
483 INFOS("Follow exception was occured :\n"<<exc.what());
486 INFOS("Unknown exception was occured!");
489 if(myAddToStudy) aStudyBuilder->CommitCommand();
494 void VISU::ScalarMap_i::DoHook(){
495 if(MYDEBUG) MESSAGE("ScalarMap_i::DoHook() - "<<myPipeLine);
497 myPipeLine = VISU_ScalarMapPL::New();
498 myPipeLine->GetMapper()->SetScalarVisibility(1);
500 myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
503 void VISU::ScalarMap_i::Update() {
504 VISU::Prs3d_i::Update();
507 void VISU::ScalarMap_i::SetMapScale(double theMapScale){
508 myScalarMapPL->SetMapScale(theMapScale);
511 VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
513 VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New();
515 VISU::Prs3d_i::CreateActor(anActor,theIO);
516 anActor->SetBarVisibility(true);
517 anActor->SetRepresentation(2);
518 UpdateActor(anActor);
521 throw std::runtime_error("CreateActor error");
526 void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) {
527 if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
528 VISU::Prs3d_i::UpdateActor(theActor);
529 VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
530 aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable());
531 aScalarBar->SetTitle(myTitle.c_str());
532 aScalarBar->SetOrientation(myOrientation);
533 aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
534 aScalarBar->GetPositionCoordinate()->SetValue(myPosition[0],myPosition[1]);
535 aScalarBar->SetWidth(myWidth);
536 aScalarBar->SetHeight(myHeight);
537 aScalarBar->SetNumberOfLabels(myNumberOfLabels);
539 vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
540 aTitleProp->SetFontFamily(myTitFontType);
541 aTitleProp->SetColor(myTitleColor);
542 (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
543 (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
544 (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
546 vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
547 aLabelProp->SetFontFamily(myLblFontType);
548 aLabelProp->SetColor(myLabelColor);
549 (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
550 (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
551 (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
553 aScalarBar->Modified();
558 void VISU::ScalarMap_i::SetSourceRange(){
559 myScalarMapPL->SetSourceRange();
560 myIsFixedRange = false;