From 3505356b8543a203cf1756ee7863e3bfbbcf3fc0 Mon Sep 17 00:00:00 2001 From: sln Date: Tue, 19 Jun 2007 08:45:25 +0000 Subject: [PATCH] NPAL 16185. Initialization of myIsColored and myColor fields fixed on the level of bas class of all presentations VISU::PrsMerger_i. These fields are private now. Duplicated fields were removed from deformed shape presentation --- src/VISU_I/VISU_DeformedShape_i.cc | 18 +++++------------- src/VISU_I/VISU_DeformedShape_i.hh | 10 ++++------ src/VISU_I/VISU_PrsMerger_i.cc | 12 ++++++++++++ src/VISU_I/VISU_PrsMerger_i.hh | 9 ++++++--- src/VISU_I/VISU_Vectors_i.cc | 3 ++- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index dacdb69d..41657e8c 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -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); } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 93874fbb..f7a07222 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -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, diff --git a/src/VISU_I/VISU_PrsMerger_i.cc b/src/VISU_I/VISU_PrsMerger_i.cc index 74a41aef..f7eb19c6 100644 --- a/src/VISU_I/VISU_PrsMerger_i.cc +++ b/src/VISU_I/VISU_PrsMerger_i.cc @@ -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 ); + } diff --git a/src/VISU_I/VISU_PrsMerger_i.hh b/src/VISU_I/VISU_PrsMerger_i.hh index 59cf5cf6..5c3b6980 100644 --- a/src/VISU_I/VISU_PrsMerger_i.hh +++ b/src/VISU_I/VISU_PrsMerger_i.hh @@ -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, diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index e4408f5e..a4410266 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -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); -- 2.39.2