Salome HOME
Fix on Bug PAL7927
[modules/visu.git] / src / VISU_I / VISU_Table_i.cc
index 1607524ce31c374d90be9189c629b34f436e4fc8..d588e45c279085e0ab0ec3e629e6c18b58fc14f9 100644 (file)
@@ -31,6 +31,7 @@
 #include "QAD_Study.h"
 
 #include "VISU_CutLines_i.hh"
+#include "VISU_Result_i.hh"
 
 #include <memory>      
 #include <fstream>     
@@ -249,6 +250,10 @@ const char* VISU::Table_i::GetTableTitle()
   return ""; 
 }
 
+void VISU::Table_i::RemoveFromStudy(){
+  VISU::RemoveFromStudy(mySObj,false);
+}
+
 //----------------------------------------------------------------
 //                      Curve Object
 //----------------------------------------------------------------
@@ -641,6 +646,10 @@ VISU::Storable* VISU::Curve_i::Restore(SALOMEDS::SObject_ptr theSObject,
   return NULL;
 }
 
+void VISU::Curve_i::RemoveFromStudy(){
+  VISU::RemoveFromStudy(mySObj,false);
+}
+
 //----------------------------------------------------------------
 //                      Container Object
 //----------------------------------------------------------------
@@ -786,6 +795,7 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring )
                                       "",
                                       aComment.latin1(),
                                       true );
+    mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str()));
   }
   return this;
 }
@@ -873,9 +883,10 @@ VISU::Curve_i* VISU::Container_i::GetCurve( CORBA::Long theIndex )
 /*!
   Restores container data from the stream
 */
-VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMap )
+VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO )
 {
   if(MYDEBUG) MESSAGE(GetComment());
+  mySObj = SALOMEDS::SObject::_duplicate(SO);
   myName = VISU::Storable::FindValue( theMap, "myName" ).latin1(); 
   QString val = VISU::Storable::FindValue( theMap, "myCurves" );
   myCurves = QStringList::split( QString( "*" ), val, false );
@@ -899,7 +910,11 @@ VISU::Storable* VISU::Container_i::Restore(SALOMEDS::SObject_ptr theSObject,
 {
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
   VISU::Container_i* pResent = new VISU::Container_i( aStudy );
-  return pResent->Restore( theMap );
+  return pResent->Restore( theMap, theSObject );
+}
+
+void VISU::Container_i::RemoveFromStudy(){
+  VISU::RemoveFromStudy(mySObj,false);
 }
 
 //-------------------------------------------------------------
@@ -975,7 +990,6 @@ int getLine(ifstream& theStmIn, QString& theString){
 }
 
 void ImportTables(const char* theFileName, TTableCont& theTableCont){
-  static int STRPRECISION = 12;
   ifstream aStmIn;
   QFileInfo aFileInfo( theFileName );
   if( !aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size() )
@@ -1111,7 +1125,6 @@ SALOMEDS::SObject_var VISU::ImportTables(const char* theFileName, SALOMEDS::Stud
   SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
   QFileInfo aFileInfo(theFileName);
   aName->SetValue(aFileInfo.fileName().latin1());
-  int iEnd = aTableCont.size();
   for(int i = 0, iEnd = aTableCont.size(); i < iEnd; i++){
     const TTable2D& aTable2D = aTableCont[i];
     SALOMEDS::SObject_var aRealObject = aStudyBuilder->NewObject(aFileObject);