]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry
authoreap <eap@opencascade.com>
Wed, 5 Sep 2018 10:59:48 +0000 (13:59 +0300)
committereap <eap@opencascade.com>
Wed, 5 Sep 2018 10:59:48 +0000 (13:59 +0300)
--- GEOM_Gen_i.cc ---
In order to assure safe and fast search of initial groups by groups of
the new geometry, behavior of GEOM_Gen operations that implement searching
and publishing of new groups corresponding to initial groups, is
slightly modified. A reference to an initial sub-object is published
under a corresponding new sub-object. The modified functions are
RestoreSubShapesO(), RestoreGivenSubShapesO() and RestoreSubShapesSO().

--- GEOM_Engine.cxx ---
Avoid double removal of GEOM_BaseObject that leads to removal of all
attributes from the root TDF label. That caused some regression, don't
remember which.

src/GEOM/GEOM_Engine.cxx
src/GEOM_I/GEOM_Gen_i.cc

index 83406999cba50150ca28a65e60cab99c4646c125..b586ff24b5175ea2da622515ff95ebb432facdd5 100644 (file)
@@ -434,6 +434,10 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
   if(!_document)
     return false;  // document is closed...
 
+  TDF_Label aLabel = theObject->GetEntry();
+  if ( aLabel == aLabel.Root() )
+    return false; // already removed object
+
   //Remove an object from the map of available objects
   TCollection_AsciiString anID = BuildIDFromObject(theObject);
   if (_objects.IsBound(anID)) {
@@ -462,7 +466,6 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
       aNode->Remove();
   }
 
-  TDF_Label aLabel = theObject->GetEntry();
   aLabel.ForgetAllAttributes(Standard_True);
 
   // Remember the label to reuse it then
@@ -1360,7 +1363,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
 
     if(MYDEBUG) {
       cout<<"Variables from SObject:"<<endl;
-      for (int i = 0; i < aVariables.size();i++)
+      for (size_t i = 0; i < aVariables.size();i++)
         cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
     }
 
@@ -1377,7 +1380,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
     //Replace parameters by variables
     Standard_Integer aStartPos = 0;
     Standard_Integer aEndPos = 0;
-    int iVar = 0;
+    size_t iVar = 0;
     TCollection_AsciiString aVar, aReplacedVar;
     for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
       //Replace first parameter (bettwen '(' character and first ',' character)
@@ -1911,7 +1914,7 @@ ObjectStates::~ObjectStates()
 //================================================================================
 TState ObjectStates::GetCurrectState() const
 {
-  if(_states.size() > _dumpstate)
+  if((int)_states.size() > _dumpstate)
     return _states[_dumpstate];
   return TState();
 }
index b94e8619eac09ed5b19af20c1e51b9dc1cc132b4..f6a6ea35610b7b1f7a03b49a4f138afb821441d7 100644 (file)
@@ -1097,7 +1097,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr   theObject,
 
     // Reconstruct arguments and tree of sub-shapes of the arguments
     CORBA::String_var anIOR;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var      aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
     for (Standard_Integer i = 0; i < aLength; i++)
     {
       GEOM::GEOM_Object_var anArgO = aList[i];
@@ -1264,7 +1265,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr   theObject,
           if (!CORBA::is_nil(anArgSO)) {
             SALOMEDS::SObject_var aSubSO;
             if (!CORBA::is_nil(theSObject))
+            {
               aSubSO = aStudyBuilder->NewObject(theSObject);
+              useCaseBuilder->AppendTo( theSObject, aSubSO );
+            }
 
             // Restore published sub-shapes of the argument
             GEOM::ListOfGO_var aSubParts =
@@ -1405,7 +1409,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
       CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
     return aParts._retn();
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var     aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = aStudy->GetUseCaseBuilder();
 
   // Get interface, containing method, which we will use to reconstruct sub-shapes
   GEOM::GEOM_IShapesOperations_var  aShapesOp = GetIShapesOperations();
@@ -1524,6 +1529,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
               if (anOldSubO->GetMarkerType() == GEOM::MT_USER)
                 aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture());
             }
+            // reference to arg
+            SALOMEDS::SObject_wrap aReferenceSO = aStudyBuilder->NewObject( aNewSubSO );
+            aStudyBuilder->Addreference( aReferenceSO, anOldSubSO );
+            useCaseBuilder->AppendTo( theNewSO, aReferenceSO );
           }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts;
@@ -1540,8 +1549,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr   th
         else { // GetInPlace failed, try to build from published parts
           SALOMEDS::SObject_var aNewSubSO;
           if (!CORBA::is_nil(theNewSO))
+          {
             aNewSubSO = aStudyBuilder->NewObject(theNewSO);
-
+            useCaseBuilder->AppendTo( theNewSO, aNewSubSO );
+          }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts =
             RestoreSubShapesOneLevel(anOldSubSO, aNewSubSO,
@@ -1695,7 +1706,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
 
     // Reconstruct arguments and tree of sub-shapes of the arguments
     CORBA::String_var anIOR;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var      aStudyBuilder = aStudy->NewBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
     for (Standard_Integer i = 0; i < nbArgsActual; i++)
     {
       GEOM::GEOM_Object_var anArgO = aList[i];
@@ -1814,8 +1826,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr   theObj
           if (!CORBA::is_nil(anArgSO)) {
             SALOMEDS::SObject_var aSubSO;
             if (!CORBA::is_nil(theSObject))
+            {
               aSubSO = aStudyBuilder->NewObject(theSObject);
-
+              useCaseBuilder->AppendTo( theSObject, aSubSO );
+            }
             // Restore published sub-shapes of the argument
             GEOM::ListOfGO_var aSubParts =
               RestoreGivenSubShapesOneLevel(anArgSO, aSubSO,
@@ -1949,7 +1963,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
       CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
     return aParts._retn();
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var      aStudyBuilder = aStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = aStudy->GetUseCaseBuilder();
 
   // Get interface, containing method, which we will use to reconstruct sub-shapes
   GEOM::GEOM_IShapesOperations_var  aShapesOp = GetIShapesOperations();
@@ -2073,6 +2088,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
               if (anOldSubO->GetMarkerType() == GEOM::MT_USER)
                 aNewSubO->SetMarkerTexture(anOldSubO->GetMarkerTexture());
             }
+            // reference to arg
+            SALOMEDS::SObject_wrap aReferenceSO = aStudyBuilder->NewObject( aNewSubSO );
+            aStudyBuilder->Addreference( aReferenceSO, anOldSubSO );
+            useCaseBuilder->AppendTo( theNewSO, aReferenceSO );
           }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts;
@@ -2089,8 +2108,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
         else { // GetInPlace failed, try to build from published parts
           SALOMEDS::SObject_var aNewSubSO;
           if (!CORBA::is_nil(theNewSO))
+          {
             aNewSubSO = aStudyBuilder->NewObject(theNewSO);
-
+            useCaseBuilder->AppendTo( theNewSO, aNewSubSO );
+          }
           // Restore published sub-shapes of the argument
           GEOM::ListOfGO_var aSubParts =
             RestoreGivenSubShapesOneLevel(anOldSubSO, aNewSubSO,