Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VISU_I / VISU_Mesh_i.cc
index 6d8851026cffc5f8d9b7b9b16bb237ee8807cdaf..6b9f866078d5d5492b0345dbd6013c52f94ce601 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  File   : VISU_PrsObject_i.cxx
 //  Module : VISU
 
 #include "VISU_Mesh_i.hh"
+#include "VISU_Prs3dUtils.hh"
 
 #include "VISU_Result_i.hh"
-#include "VISU_ViewManager_i.hh"
 
-#include "VISU_MeshPL.hxx"
 #include "VISU_MeshAct.h"
+#include "VISU_MeshPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+#include "VISU_Convertor.hxx"
+
+#include "SALOME_Event.hxx"
 
-using namespace VISU;
-using namespace std;
+#include "SUIT_ResourceMgr.h"
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -43,57 +46,64 @@ static int MYDEBUG = 0;
 
 static int INCMEMORY = 4;
 
-int VISU::Mesh_i::myNbPresent = 0;
-
-QString VISU::Mesh_i::GenerateName() { return VISU::GenerateName("Mesh",myNbPresent++);}
-
-const string VISU::Mesh_i::myComment = "MESH";
-
-const char* VISU::Mesh_i::GetComment() const { return myComment.c_str();}
-
-VISU::Mesh_i::
-Mesh_i(Result_i* theResult) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,false),
-  myMeshPL(VISU_MeshPL::New())
+//----------------------------------------------------------------------------
+namespace
 {
-  myPipeLine = myMeshPL;
+  bool
+  IsSameColor(const SALOMEDS::Color& theLeft,
+             const SALOMEDS::Color& theRight)
+  {
+    return 
+      VISU::CheckIsSameValue(theLeft.R, theRight.R) &&
+      VISU::CheckIsSameValue(theLeft.G, theRight.G) &&
+      VISU::CheckIsSameValue(theLeft.B, theRight.B);
+  }
 }
 
+//----------------------------------------------------------------------------
+int VISU::Mesh_i::myNbPresent = 0;
 
-VISU::Mesh_i::
-Mesh_i(Result_i* theResult,
-       SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theSObject),
-  myMeshPL(VISU_MeshPL::New())
-{
-  myPipeLine = myMeshPL;
+//----------------------------------------------------------------------------
+QString
+VISU::Mesh_i
+::GenerateName() 
+{ 
+  return VISU::GenerateName("Mesh", myNbPresent++);
 }
 
+//----------------------------------------------------------------------------
+const string VISU::Mesh_i::myComment = "MESH";
 
-void VISU::Mesh_i::RemoveFromStudy()
-{
-  VISU::DeleteActors(this);
-  VISU::RemoveFromStudy(mySObject);
+//----------------------------------------------------------------------------
+const char* 
+VISU::Mesh_i
+::GetComment() const
+{ 
+  return myComment.c_str();
 }
 
-
-void VISU::Mesh_i::SameAs (const Mesh_i* theOrigin)
+//----------------------------------------------------------------------------
+VISU::Mesh_i
+::Mesh_i():
+  myMeshPL(VISU_MeshPL::New())
 {
-  return; // "SameAs" command for mesh is not valid in current architecture
+  SetPipeLine(myMeshPL);
 }
 
 
-
-int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName,
-                             Entity theEntity, const char* theFamilyName)
+//----------------------------------------------------------------------------
+size_t
+VISU::Mesh_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName,
+            Entity theEntity, 
+            const std::string& theFamilyName)
 {
   try{
     MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
-    float aSize = INCMEMORY*
-      theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity,theFamilyName);
-    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    size_t aSize = INCMEMORY*
+      theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity);
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     return aResult;
   }catch(std::exception& exc){
@@ -104,25 +114,35 @@ int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName,
   return 0;
 }
 
-VISU::Storable* VISU::Mesh_i::Create (const char* theMeshName,
-                                     Entity theEntity,
-                                     const char* theFamilyName)
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Create(VISU::Result_i* theResult, 
+        const std::string& theMeshName, 
+        VISU::Entity theEntity, 
+        const std::string& theFamilyName)
 {
-  myMeshName = theMeshName;
-  //jfa IPAL9284:myEntity = VISU::TEntity(theEntity);
+  SetCResult(theResult);
+  SetMeshName(theMeshName.c_str());
   myEntity = int(theEntity);//jfa IPAL9284
   mySubMeshName = theFamilyName;
   return Build(false);
 }
 
 
-int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName, const char* theGroupName)
+//----------------------------------------------------------------------------
+size_t 
+VISU::Mesh_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            const std::string& theGroupName)
 {
   try{
     MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
-    float aSize = INCMEMORY*
+    size_t aSize = INCMEMORY*
       theResult->GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName);
-    bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     return aResult;
   }catch(std::exception& exc){
@@ -134,133 +154,118 @@ int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName, cons
 }
 
 
-VISU::Storable* VISU::Mesh_i::Create (const char* theMeshName,
-                                     const char* theGroupName)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Create(VISU::Result_i* theResult, 
+        const std::string& theMeshName, 
+        const std::string& theGroupName)
 {
-  myMeshName = theMeshName;
-  //jfa IPAL9284:myEntity = VISU::TEntity(-1);
+  SetCResult(theResult);
+  SetMeshName(theMeshName.c_str());
   myEntity = -1;//jfa IPAL9284
   mySubMeshName = theGroupName;
   return Build(false);
 }
 
 
-VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap)
+//----------------------------------------------------------------------------
+VISU::Mesh_i
+::~Mesh_i()
 {
-  Prs3d_i::Restore(theMap);
-
-  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
-  //jfa IPAL9284:myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
-  myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284
-  mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1();
-
-  myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt());
-
-  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();
-
-  myNodeColor.R = VISU::Storable::FindValue(theMap,"myNodeColor.R").toDouble();
-  myNodeColor.G = VISU::Storable::FindValue(theMap,"myNodeColor.G").toDouble();
-  myNodeColor.B = VISU::Storable::FindValue(theMap,"myNodeColor.B").toDouble();
-
-  myLinkColor.R = VISU::Storable::FindValue(theMap,"myLinkColor.R").toDouble();
-  myLinkColor.G = VISU::Storable::FindValue(theMap,"myLinkColor.G").toDouble();
-  myLinkColor.B = VISU::Storable::FindValue(theMap,"myLinkColor.B").toDouble();
-
-  return Build(true);
-}
-
-
-void VISU::Mesh_i::ToStream(std::ostringstream& theStr){
-  Prs3d_i::ToStream(theStr);
-
-  Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() );
-  Storable::DataToStream( theStr, "myEntity", myEntity );
-  Storable::DataToStream( theStr, "mySubMeshName", mySubMeshName.c_str() );
-
-  Storable::DataToStream( theStr, "myPresentType", int(myPresentType) );
-
-  Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R );
-  Storable::DataToStream( theStr, "myCellColor.G", myCellColor.G );
-  Storable::DataToStream( theStr, "myCellColor.B", myCellColor.B );
-
-  Storable::DataToStream( theStr, "myNodeColor.R", myNodeColor.R );
-  Storable::DataToStream( theStr, "myNodeColor.G", myNodeColor.G );
-  Storable::DataToStream( theStr, "myNodeColor.B", myNodeColor.B );
-
-  Storable::DataToStream( theStr, "myLinkColor.R", myLinkColor.R );
-  Storable::DataToStream( theStr, "myLinkColor.G", myLinkColor.G );
-  Storable::DataToStream( theStr, "myLinkColor.B", myLinkColor.B );
-}
-
-
-VISU::Mesh_i::~Mesh_i(){
   if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
 }
 
 
-VISU::Storable* VISU::Mesh_i::Build (int theRestoring)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Build(int theRestoring)
 {
-  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
   aStudyBuilder->NewCommand();  // There is a transaction
   try {
-    if (myResult->GetInput() == NULL)
-      throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
+    if (GetCResult()->GetInput() == NULL)
+      throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
     if (!theRestoring) {
-      myPresentType = VISU::SHADED;
-      myName = GenerateName().latin1();
+      myPresentType =  VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2));
+      if(myEntity == VISU::NODE_ENTITY)
+       myPresentType = VISU::POINT;
+      SetName(GenerateName().latin1(), false);
       myCellColor.R = 0.0;  myCellColor.G = myCellColor.B = 1.0;
       myNodeColor.R = myNodeColor.G = 1.0;  myNodeColor.B = 1.0;
       myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.;
     }
-    //jfa IPAL9284:if (int(myEntity) >= 0)
-    if (myEntity >= 0) //jfa IPAL9284
-      if (mySubMeshName == "")
+
+    if(myEntity >= 0)
+      if(mySubMeshName == "")
        myType = VISU::TENTITY;
       else
        myType = VISU::TFAMILY;
     else
       myType = VISU::TGROUP;
+
     if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
-    QString aComment;
+    QString aComment,aTmp;
+
+    std::string aMeshName = GetCMeshName();
+    VISU::TEntity anEntity = VISU::TEntity(myEntity);
+
+    VISU::Storable::TRestoringMap aRestoringMap;
+    aRestoringMap["myMeshName"] = GetCMeshName();
 
-    VISU_Convertor::TOutput *anOutput;
+    VISU::PUnstructuredGridIDMapper anIDMapper;
+    VISU::Result_i::PInput anInput = GetCResult()->GetInput();
     switch(myType){
     case VISU::TENTITY :
-      //jfa IPAL9284:anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity);
-      anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284
-      aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
-                      VISU::TENTITY,myMeshName.c_str(),myEntity);
+      anIDMapper = anInput->GetMeshOnEntity(aMeshName,
+                                           anEntity);//jfa IPAL9284
+      aRestoringMap["myComment"] = "ENTITY";
+      aRestoringMap["myId"] = QString::number(anEntity);
       break;
     case VISU::TFAMILY :
-      //jfa IPAL9284:anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity,mySubMeshName);
-      anOutput = myResult->GetInput()->GetMeshOnEntity
-        (myMeshName,(VISU::TEntity)myEntity,mySubMeshName);//jfa IPAL9284
-      aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                      VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str());
+      anIDMapper = anInput->GetFamilyOnEntity(aMeshName,
+                                             anEntity,
+                                             mySubMeshName);
+      aRestoringMap["myComment"] = "FAMILY";
+      aRestoringMap["myEntityId"] = QString::number(anEntity);
+      aRestoringMap["myName"] = mySubMeshName;
       break;
     case VISU::TGROUP :
-      anOutput = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
-      aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
-                      VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str());
+      anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(),
+                                          mySubMeshName);
+      aRestoringMap["myComment"] = "GROUP";
+      aRestoringMap["myName"] = mySubMeshName;
       break;
     }
-    if(anOutput == NULL) throw std::runtime_error("Mesh_i::Build - anOutput == NULL !!!");
-    myMeshPL->SetInput(anOutput);
-    myMeshPL->Build();
+    if(!anIDMapper) 
+      throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
+
+    myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
+
+    string anEntry = GetCResult()->GetEntry(aRestoringMap);
+    if(anEntry == "") 
+      throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
+    SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
+
     if(!theRestoring) { //Setting IOR on the label
       myMeshPL->Init();
-      string aResultEntry = myResult->GetEntry();
-      string anEntry = myResult->GetEntry(aComment.latin1());
-      if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
-      mySObject = myStudy->FindObjectID(anEntry.c_str());
-      SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR");
+      string aResultEntry = GetCResult()->GetEntry();
+      SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+      SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
       CORBA::String_var aString = GetID();
       anIOR->SetValue(aString);
     }
+
+    // Set icon
+    SALOMEDS::GenericAttribute_var anAttr;
+    SALOMEDS::AttributePixMap_var  aPixmap;
+    
+    anAttr  = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributePixMap");
+    aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
+    aPixmap->SetPixMap("ICON_TREE_MESH");
+
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
     return NULL;
@@ -273,11 +278,238 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring)
 }
 
 
-VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+//---------------------------------------------------------------
+void
+VISU::Mesh_i
+::SameAs(const VISU::Prs3d_i* theOrigin)
+{
+  return; // "SameAs" command for mesh is not valid in current architecture
+}
+
+
+//---------------------------------------------------------------
+void
+VISU::Mesh_i
+::RemoveFromStudy()
+{
+  struct TRemoveFromStudy: public SALOME_Event
+  {
+    VISU::Mesh_i* myRemovable;
+    TRemoveFromStudy(VISU::Mesh_i* theRemovable):
+      myRemovable(theRemovable)
+    {}
+    
+    virtual
+    void
+    Execute()
+    {
+      VISU::RemoveFromStudy(myRemovable->GetSObject());
+      myRemovable->TSuperClass::RemoveFromStudy();
+    }
+  };
+
+  // Unset icon
+  SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+  aStudyBuilder->RemoveAttribute(GetSObject(), "AttributePixMap");
+
+  ProcessVoidEvent(new TRemoveFromStudy(this));
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetCellColor(const SALOMEDS::Color& theColor) 
+{ 
+  if(IsSameColor(myCellColor, theColor))
+    return;
+
+  VISU::TSetModified aModified(this);
+  
+  myCellColor = theColor;
+  myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color 
+VISU::Mesh_i
+::GetCellColor() 
+{ 
+  return myCellColor;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetNodeColor(const SALOMEDS::Color& theColor) 
+{ 
+  if(IsSameColor(myNodeColor, theColor))
+    return;
+
+  VISU::TSetModified aModified(this);
+  
+  myNodeColor = theColor;
+  myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color 
+VISU::Mesh_i
+::GetNodeColor() 
+{ 
+  return myNodeColor;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetLinkColor(const SALOMEDS::Color& theColor) 
+{ 
+  if(IsSameColor(myLinkColor, theColor))
+    return;
+
+  VISU::TSetModified aModified(this);
+  
+  myLinkColor = theColor;
+  myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+SALOMEDS::Color 
+VISU::Mesh_i
+::GetLinkColor() 
+{ 
+  return myLinkColor;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::SetPresentationType(VISU::PresentationType theType) 
+{ 
+  if(myPresentType == theType)
+    return;
+
+  VISU::TSetModified aModified(this);
+  
+  myPresentType = theType;
+  myParamsTime.Modified();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::PresentationType 
+VISU::Mesh_i
+::GetPresentationType() 
+{ 
+  return myPresentType;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Entity 
+VISU::Mesh_i
+::GetEntity() const
+{ 
+  return VISU::Entity(myEntity);
+}
+
+
+//----------------------------------------------------------------------------
+const std::string&
+VISU::Mesh_i
+::GetSubMeshName() const
+{ 
+  return mySubMeshName;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const Storable::TRestoringMap& theMap)
+{
+  if(!TSuperClass::Restore(theSObject, theMap))
+    return NULL;
+
+  myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284
+  mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1();
+
+  myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt());
+
+  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();
+
+  myNodeColor.R = VISU::Storable::FindValue(theMap,"myNodeColor.R").toDouble();
+  myNodeColor.G = VISU::Storable::FindValue(theMap,"myNodeColor.G").toDouble();
+  myNodeColor.B = VISU::Storable::FindValue(theMap,"myNodeColor.B").toDouble();
+
+  myLinkColor.R = VISU::Storable::FindValue(theMap,"myLinkColor.R").toDouble();
+  myLinkColor.G = VISU::Storable::FindValue(theMap,"myLinkColor.G").toDouble();
+  myLinkColor.B = VISU::Storable::FindValue(theMap,"myLinkColor.B").toDouble();
+
+  return Build(true);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable*
+VISU::Mesh_i
+::StorableEngine(SALOMEDS::SObject_ptr theSObject,
+                const Storable::TRestoringMap& theMap,
+                const std::string& thePrefix,
+                CORBA::Boolean theIsMultiFile)
+{
+  Mesh_i* aMesh = new Mesh_i();
+  return aMesh->Restore(theSObject, theMap);
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU::Mesh_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myEntity", myEntity );
+  Storable::DataToStream( theStr, "mySubMeshName", mySubMeshName.c_str() );
+
+  Storable::DataToStream( theStr, "myPresentType", int(myPresentType) );
+
+  Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R );
+  Storable::DataToStream( theStr, "myCellColor.G", myCellColor.G );
+  Storable::DataToStream( theStr, "myCellColor.B", myCellColor.B );
+
+  Storable::DataToStream( theStr, "myNodeColor.R", myNodeColor.R );
+  Storable::DataToStream( theStr, "myNodeColor.G", myNodeColor.G );
+  Storable::DataToStream( theStr, "myNodeColor.B", myNodeColor.B );
+
+  Storable::DataToStream( theStr, "myLinkColor.R", myLinkColor.R );
+  Storable::DataToStream( theStr, "myLinkColor.G", myLinkColor.G );
+  Storable::DataToStream( theStr, "myLinkColor.B", myLinkColor.B );
+}
+
+
+//----------------------------------------------------------------------------
+VISU_Actor* 
+VISU::Mesh_i
+::CreateActor()
 {
   VISU_MeshAct* anActor = VISU_MeshAct::New();
   try{
-    VISU::Prs3d_i::CreateActor(anActor,theIO);
+    VISU::Prs3d_i::CreateActor(anActor);
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    bool toShrink  = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
+    if (toShrink) anActor->SetShrink();
     UpdateActor(anActor);
   }catch (...) {
     anActor->Delete();
@@ -287,7 +519,11 @@ VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& th
 }
 
 
-void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor) {
+//----------------------------------------------------------------------------
+void
+VISU::Mesh_i
+::UpdateActor(VISU_Actor* theActor) 
+{
   if(VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(theActor)){
     if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor");
     VISU::Prs3d_i::UpdateActor(anActor);
@@ -297,3 +533,5 @@ void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor) {
     anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B);
   }
 }
+
+//----------------------------------------------------------------------------