23586: [EDF] HYDRO: Copy mesh to new geometry

--- 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.
This commit is contained in:
eap 2018-09-05 14:21:30 +03:00
parent 1be0dcd9a7
commit 5d59645403
2 changed files with 36 additions and 12 deletions

View 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();
}

View 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,