From 29738849977d8c2e03ad727b401392908071ec6e Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 12 Nov 2008 08:48:19 +0000 Subject: [PATCH] Improvement 0020020: SetShrink method --- idl/VISU_Gen.idl | 18 +++++++++++++++ src/VISU_I/VISU_DumpPython.cc | 1 + src/VISU_I/VISU_Mesh_i.cc | 42 +++++++++++++++++++++++++++++++--- src/VISU_I/VISU_Mesh_i.hh | 6 +++++ src/VISU_I/VISU_ScalarMap_i.cc | 2 ++ 5 files changed, 66 insertions(+), 3 deletions(-) diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index b1faa0ad..a6357f39 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -362,6 +362,17 @@ module VISU { * \return The type of representation of the mesh. */ PresentationType GetPresentationType(); + + /*! + * Switches shrink mode of presentation + * Note: SetPresentationType(SHRINK) is same as SetShrink(True) + */ + void SetShrink(in boolean toShrink); + + /*! + * Returns current state of shrink mode + */ + boolean IsShrank(); }; @@ -711,7 +722,14 @@ module VISU { interface ScalarMap : ColoredPrs3d, ScaledPrs3d { + /*! + * Returns visibility state of scalar bar + */ boolean IsBarVisible(); + + /*! + * Sets visibility state of scalar bar + */ void SetBarVisible(in boolean theVisible); }; diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index df9d6ebb..53922a9e 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -1257,6 +1257,7 @@ namespace VISU break; } theStr<IsShrank()? "True" : "False")<<")"<booleanValue("VISU", "mesh_shrink", false); return Build(false); } @@ -191,6 +193,8 @@ VISU::Mesh_i throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!"); if (!theRestoring) { myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2)); + myIsShrank = (myPresentType == VISU::SHRINK); + if(myEntity == VISU::NODE_ENTITY) myPresentType = VISU::POINT; SetName((const char*)GenerateName().toLatin1(), false); @@ -446,6 +450,8 @@ VISU::Mesh_i myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt()); + myIsShrank = (VISU::Storable::FindValue(theMap,"myIsShrank", "0").toInt() == 1)? true: false; + myCellColor.R = VISU::Storable::FindValue(theMap,"myCellColor.R").toDouble(); myCellColor.G = VISU::Storable::FindValue(theMap,"myCellColor.G").toDouble(); myCellColor.B = VISU::Storable::FindValue(theMap,"myCellColor.B").toDouble(); @@ -487,6 +493,8 @@ VISU::Mesh_i Storable::DataToStream( theStr, "myPresentType", int(myPresentType) ); + Storable::DataToStream( theStr, "myIsShrank", (myIsShrank? "1":"0")); + Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R ); Storable::DataToStream( theStr, "myCellColor.G", myCellColor.G ); Storable::DataToStream( theStr, "myCellColor.B", myCellColor.B ); @@ -510,9 +518,14 @@ VISU::Mesh_i try{ VISU::Prs3d_i::CreateActor(anActor); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); - if (toShrink) anActor->SetShrink(); - + //bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); + //if (toShrink) anActor->SetShrink(); + if (anActor->IsShrunkable()) { + if (myIsShrank) + anActor->SetShrink(); + else + anActor->UnShrink(); + } anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) ); anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false), aResourceMgr->booleanValue("VISU", "show_boundary_edges", false), @@ -538,6 +551,12 @@ VISU::Mesh_i if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor"); VISU::Prs3d_i::UpdateActor(anActor); anActor->SetRepresentation(myPresentType); + if (anActor->IsShrunkable()) { + if (myIsShrank) + anActor->SetShrink(); + else + anActor->UnShrink(); + } anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B); anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B); anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B); @@ -545,3 +564,20 @@ VISU::Mesh_i } //---------------------------------------------------------------------------- + + +void VISU::Mesh_i::SetShrink(CORBA::Boolean toShrink) +{ + if(toShrink == myIsShrank) + return; + VISU::TSetModified aModified(this); + myIsShrank = toShrink; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- +CORBA::Boolean VISU::Mesh_i::IsShrank() +{ + return myIsShrank; +} + diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index b0395f14..02d4efbc 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -95,6 +95,11 @@ namespace VISU VISU::PresentationType GetPresentationType(); + + virtual void SetShrink(CORBA::Boolean toShrink); + + virtual CORBA::Boolean IsShrank(); + VISU_MeshPL* GetSpecificPL() const { return myMeshPL; @@ -114,6 +119,7 @@ namespace VISU SALOMEDS::Color myCellColor; SALOMEDS::Color myNodeColor; SALOMEDS::Color myLinkColor; + bool myIsShrank; public: static diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 98dcb95b..db272f3d 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -371,6 +371,8 @@ VISU::ScalarMap_i void VISU::ScalarMap_i::SetBarVisible(CORBA::Boolean theVisible) { + if (myShowBar == theVisible) + return; VISU::TSetModified aModified(this); myShowBar = theVisible; myParamsTime.Modified(); -- 2.39.2