]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
NPAL 16185. Initialization of myIsColored and myColor fields fixed on the level of...
authorsln <sln@opencascade.com>
Tue, 19 Jun 2007 08:45:25 +0000 (08:45 +0000)
committersln <sln@opencascade.com>
Tue, 19 Jun 2007 08:45:25 +0000 (08:45 +0000)
src/VISU_I/VISU_DeformedShape_i.cc
src/VISU_I/VISU_DeformedShape_i.hh
src/VISU_I/VISU_PrsMerger_i.cc
src/VISU_I/VISU_PrsMerger_i.hh
src/VISU_I/VISU_Vectors_i.cc

index dacdb69dfb1e2907de1c2283d4cf31ebc749e2be..41657e8c495839520841a79dd7f3b1870dd02c4b 100644 (file)
@@ -114,8 +114,7 @@ void VISU::DeformedShape_i::Update()
 VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, 
                                              const char* theFieldName, int theIteration)
 {
-  myIsColored = false;
-  myColor.R = myColor.G = myColor.B = 0.5;
+  ShowColored( false );
   return TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
 }
 
@@ -125,10 +124,6 @@ VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& th
   TSuperClass::Restore(theMap);
 
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
-  myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
-  myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
-  myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
-  myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
 
   return this;
 }
@@ -138,11 +133,6 @@ void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
   TSuperClass::ToStream(theStr);
 
   Storable::DataToStream( theStr, "myFactor", GetScale() );
-
-  Storable::DataToStream( theStr, "myIsColored", myIsColored );
-  Storable::DataToStream( theStr, "myColor.R", myColor.R );
-  Storable::DataToStream( theStr, "myColor.G", myColor.G );
-  Storable::DataToStream( theStr, "myColor.B", myColor.B );
 }
 
 
@@ -195,7 +185,8 @@ VISU::DeformedShape_i
   bool toShrink  = aResourceMgr->booleanValue("VISU", "deformed_shape_shrink", false);
   anActor->SetRepresentation(aDispMode);
   if (toShrink && !toSupressShrinking) anActor->SetShrink();
-  anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+  SALOMEDS::Color aColor = GetColor();
+  anActor->GetProperty()->SetColor(aColor.R,aColor.G,aColor.B);
   return anActor;
 }
 
@@ -214,7 +205,8 @@ void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) {
     }else{
       anActor->SetBarVisibility(false);
       myPipeLine->GetMapper()->SetScalarVisibility(0);
-      anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+      SALOMEDS::Color aColor = GetColor();
+      anActor->GetProperty()->SetColor(aColor.R,aColor.G,aColor.B);
     }
     TSuperClass::UpdateActor(theActor);
   }
index 93874fbb09763dd1080984ccebd56bc71a371cb0..f7a072224dd8127470223aca6ba226f6135c1c7c 100644 (file)
@@ -56,11 +56,11 @@ namespace VISU{
     virtual void SetScale(CORBA::Double theScale);
     virtual CORBA::Double GetScale();
 
-    virtual CORBA::Boolean IsColored() { return myIsColored; }
-    virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; }
+    virtual CORBA::Boolean IsColored() { return PrsMerger_i::IsColored(); }
+    virtual void ShowColored(CORBA::Boolean theColored) { PrsMerger_i::ShowColored( theColored ); }
 
-    virtual SALOMEDS::Color GetColor() { return myColor;}
-    virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;}
+    virtual SALOMEDS::Color GetColor() { return PrsMerger_i::GetColor();}
+    virtual void SetColor(const SALOMEDS::Color& theColor) { PrsMerger_i::SetColor( theColor ); }
 
     typedef VISU::DeformedShape TInterface;
     VISU_DeformedShapePL* GetDeformedShapePL(){ return myDeformedShapePL;}
@@ -73,8 +73,6 @@ namespace VISU{
     virtual const char* GetIconName();
 
     VISU_DeformedShapePL *myDeformedShapePL;
-    SALOMEDS::Color myColor;
-    bool myIsColored;
 
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
index 74a41aef4a8572308f09ebca2fca010a16265e83..f7eb19c6bba8417c385e68bcf4cbd9bd766f058f 100644 (file)
@@ -108,6 +108,7 @@ VISU::Storable* VISU::PrsMerger_i::Create(const char* theMeshName, VISU::Entity
                                          const char* theFieldName, int theIteration)
 {
   if (MYDEBUG) MESSAGE("PrsMerger_i::Create");
+
   myIsColored = true;
   myColor.R = myColor.G = myColor.B = 0.5;
   VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
@@ -120,6 +121,11 @@ VISU::Storable* VISU::PrsMerger_i::Restore(const Storable::TRestoringMap& theMap
 {
   if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::Restore");
   
+  myIsColored = VISU::Storable::FindValue(theMap,"myIsColored",QString( "1" )).toInt();
+  myColor.R = VISU::Storable::FindValue(theMap,"myColor.R",QString( "0.5" )).toDouble();
+  myColor.G = VISU::Storable::FindValue(theMap,"myColor.G",QString( "0.5" )).toDouble();
+  myColor.B = VISU::Storable::FindValue(theMap,"myColor.B",QString( "0.5" )).toDouble();
+
   TSuperClass::Restore(theMap);
   
   SetScalarMap(myMeshName.c_str(),
@@ -188,6 +194,12 @@ void VISU::PrsMerger_i::ToStream(std::ostringstream& theStr)
   Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() );
   Storable::DataToStream( theStr, "myGeomNameList",  aStrSubMeshName.latin1());
   Storable::DataToStream( theStr, "myGeomEntityList",  aStrEntity.latin1());
+
+  Storable::DataToStream( theStr, "myIsColored", myIsColored );
+  Storable::DataToStream( theStr, "myColor.R", myColor.R );
+  Storable::DataToStream( theStr, "myColor.G", myColor.G );
+  Storable::DataToStream( theStr, "myColor.B", myColor.B );
+
   
 }
 
index 59cf5cf6c14e09cba887c92bb813bbb53749278c..5c3b6980653ef723a9107bdbad38a5f9f056725a 100644 (file)
@@ -86,13 +86,16 @@ namespace VISU{
     VISU_PrsMergerPL* myPrsMergerPL;
     VISU_PrsMergerPL::TPipeLines  myMeshPLList;
     
-    SALOMEDS::Color myColor;
-    bool myIsColored;
-
     /*! Warning! This variable must be maked as list, if
      * you we will need in different mesh entities (ENTITY,FAMILY,GROUP) as geometries.
      */
     TNameAndEntityList myGeomNameEntityList;
+
+  private:
+
+    SALOMEDS::Color myColor;
+    bool myIsColored;
+
     
   public:
     static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
index e4408f5e4d1b4b78f986fb84fcd90376af578e1b..a44102669977ed01f2fcf1b9b31bb99ed485279a 100644 (file)
@@ -207,7 +207,8 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)&
     VISU::Prs3d_i::CreateActor(anActor,theIO);
     anActor->SetVTKMapping(true);
     anActor->SetBarVisibility(true);
-    anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+    SALOMEDS::Color aColor = GetColor();
+    anActor->GetProperty()->SetColor(aColor.R,aColor.G,aColor.B);
     anActor->GetProperty()->SetLineWidth(GetLineWidth());
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     int  aDispMode = aResourceMgr->integerValue("VISU", "vectors_represent", 1);