]> 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 11:21:30 +0000 (14:21 +0300)
committereap <eap@opencascade.com>
Wed, 5 Sep 2018 11:21:30 +0000 (14:21 +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 dd4bc10126af391032cf63bed182c38951086002..e0fb46fe252f17477ec430358aea31b24022d885 100644 (file)
@@ -482,6 +482,10 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_BaseObject)& theObject)
   if(!_mapIDDocument.IsBound(aDocID))
     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)) {
@@ -510,7 +514,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
@@ -1432,7 +1435,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;
     }
 
@@ -1449,7 +1452,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)
@@ -1984,7 +1987,7 @@ ObjectStates::~ObjectStates()
 //================================================================================
 TState ObjectStates::GetCurrectState() const
 {
-  if(_states.size() > _dumpstate)
+  if((int)_states.size() > _dumpstate)
     return _states[_dumpstate];
   return TState();
 }
index fc6cee5c4398886e6ed1dd76b387a26ce36ca0ee..a5dac64eab0717b00c31b6a96596d6b8e96c1c89 100644 (file)
@@ -1103,7 +1103,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
 
     // Reconstruct arguments and tree of sub-shapes of the arguments
     CORBA::String_var anIOR;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var      aStudyBuilder = theStudy->NewBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
     for (Standard_Integer i = 0; i < aLength; i++)
     {
       GEOM::GEOM_Object_var anArgO = aList[i];
@@ -1123,7 +1124,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
         GEOM::GEOM_Object_var aSubO;
         switch (theFindMethod) {
         case GEOM::FSM_GetInPlace:
-          {
+        {
             // Use GetInPlace
             aSubO = aShapesOp->GetInPlace(theObject, anArgO);
           }
@@ -1270,7 +1271,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr     theStudy,
           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 =
@@ -1410,7 +1414,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr     th
       CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
     return aParts._retn();
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var      aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
 
   // Get interface, containing method, which we will use to reconstruct sub-shapes
   GEOM::GEOM_IShapesOperations_var  aShapesOp = GetIShapesOperations(theStudy->StudyId());
@@ -1529,6 +1534,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_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;
@@ -1545,8 +1554,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_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(theStudy, anOldSubSO, aNewSubSO,
@@ -1700,7 +1711,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
 
     // Reconstruct arguments and tree of sub-shapes of the arguments
     CORBA::String_var anIOR;
-    SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+    SALOMEDS::StudyBuilder_var      aStudyBuilder = theStudy->NewBuilder();
+    SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
     for (Standard_Integer i = 0; i < nbArgsActual; i++)
     {
       GEOM::GEOM_Object_var anArgO = aList[i];
@@ -1819,8 +1831,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr     theStu
           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(theStudy, anArgSO, aSubSO,
@@ -1954,7 +1968,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_ptr
       CORBA::is_nil(theNewO) /*|| CORBA::is_nil(theNewSO)*/)
     return aParts._retn();
 
-  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::StudyBuilder_var      aStudyBuilder = theStudy->NewBuilder();
+  SALOMEDS::UseCaseBuilder_wrap  useCaseBuilder = theStudy->GetUseCaseBuilder();
 
   // Get interface, containing method, which we will use to reconstruct sub-shapes
   GEOM::GEOM_IShapesOperations_var  aShapesOp = GetIShapesOperations(theStudy->StudyId());
@@ -2078,6 +2093,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_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;
@@ -2094,8 +2113,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::Study_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(theStudy, anOldSubSO, aNewSubSO,