]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Improvement 0020020: SetShrink method
authorvsv <vsv@opencascade.com>
Wed, 12 Nov 2008 08:48:19 +0000 (08:48 +0000)
committervsv <vsv@opencascade.com>
Wed, 12 Nov 2008 08:48:19 +0000 (08:48 +0000)
idl/VISU_Gen.idl
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Mesh_i.hh
src/VISU_I/VISU_ScalarMap_i.cc

index b1faa0adb70799ffa9053cf8276d1294367a96ac..a6357f39f6a3511e8bb140789d4d460c18e25536 100644 (file)
@@ -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);
 
   };
index df9d6ebbd640859bb38e67b2791d7a8c0dbfae84..53922a9edbf78c507a5b07be6681aa556ea53171 100644 (file)
@@ -1257,6 +1257,7 @@ namespace VISU
              break;
            }
            theStr<<thePrefix<<aName<<".SetPresentationType("<<aParam<<")"<<endl;
+           theStr<<thePrefix<<aName<<".SetShrink("<<(aServant->IsShrank()? "True" : "False")<<")"<<endl;
            theStr<<thePrefix<<endl;
 
            DumpChildrenToPython(theStudy,
index aa4afe71c8f1fcc8b308bf522d65464d81009511..40676398367616e87fddee8e2d0dcd2369e90be6 100644 (file)
@@ -129,6 +129,8 @@ VISU::Mesh_i
   SetMeshName(theMeshName.c_str());
   myEntity = int(theEntity);//jfa IPAL9284
   mySubMeshName = theFamilyName;
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  myIsShrank = aResourceMgr->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;
+}
+
index b0395f1431523182351893ca9fd86feb40e16e6a..02d4efbca5d059f4519fe3ed5ebdc84e450bccad 100644 (file)
@@ -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 
index 98dcb95baaa8d064b13d06d3d96c715dafb020d3..db272f3dea334cd3d9c680da9aa8338996db0d3f 100644 (file)
@@ -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();