Issue 0020001: EDF 813 GEOM : PArtition , argument to get subshapes

Additional changes: fix bugs, update documentation
This commit is contained in:
vsr 2009-07-24 13:02:53 +00:00
parent 32f2ca4bb8
commit 20a9ed535c

View File

@ -809,12 +809,12 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy
// function : addToListOfGO // function : addToListOfGO
// purpose : static local function // purpose : static local function
//============================================================================ //============================================================================
static void addToListOfGO( const GEOM::GEOM_Object_ptr& theObject, static void addToListOfGO( GEOM::GEOM_Object_ptr theObject,
GEOM::ListOfGO& theList ) GEOM::ListOfGO& theList )
{ {
const int oldLen = theList.length(); const int oldLen = theList.length();
theList.length(oldLen + 1); theList.length(oldLen + 1);
theList[ oldLen ] = theObject; theList[ oldLen ] = GEOM::GEOM_Object::_duplicate( theObject );
} }
//============================================================================ //============================================================================
@ -828,7 +828,7 @@ static void addToListOfGO( const GEOM::ListOfGO& theSrcList,
const int srcLen = theSrcList.length(); const int srcLen = theSrcList.length();
theTrgList.length(oldLen + srcLen); theTrgList.length(oldLen + srcLen);
for( int i = 0; i < srcLen; i++ ) for( int i = 0; i < srcLen; i++ )
theTrgList[ oldLen + i ] = theSrcList[ i ]; theTrgList[ oldLen + i ] = GEOM::GEOM_Object::_duplicate( theSrcList[ i ] );
} }
//============================================================================ //============================================================================
@ -836,7 +836,7 @@ static void addToListOfGO( const GEOM::ListOfGO& theSrcList,
// purpose : Private method. Works only if both theObject and theSObject // purpose : Private method. Works only if both theObject and theSObject
// are defined, and does not check, if they correspond to each other. // are defined, and does not check, if they correspond to each other.
//============================================================================ //============================================================================
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy, GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr theObject,
SALOMEDS::SObject_ptr theSObject, SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs, const GEOM::ListOfGO& theArgs,
@ -860,7 +860,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
aList = new GEOM::ListOfGO; aList = new GEOM::ListOfGO;
aList->length(aLength); aList->length(aLength);
for (int i = 0; i < aLength; i++) { for (int i = 0; i < aLength; i++) {
aList[i] = theArgs[i]; aList[i] = GEOM::GEOM_Object::_duplicate( theArgs[i] );
} }
} }
else { else {
@ -877,8 +877,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
// Do not publish argument's reflection, // Do not publish argument's reflection,
// but only reconstruct its published sub-shapes // but only reconstruct its published sub-shapes
GEOM::GEOM_Object_var anArgO = aList[0]; CORBA::String_var anIOR = _orb->object_to_string(aList[0]);
CORBA::String_var anIOR = _orb->object_to_string(anArgO);
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in()); SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
aParts = RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod); aParts = RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod);
@ -928,7 +927,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
if (!CORBA::is_nil(aSubO)) if (!CORBA::is_nil(aSubO))
aGroupOp->UnionIDs(aSubO, anIDs); aGroupOp->UnionIDs(aSubO, anIDs);
} }
else { else if (anIDs->length() > 0) {
// single sub-shape // single sub-shape
aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]); aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]);
} }
@ -1040,7 +1039,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
int i = 0, j = 0; int i = 0, j = 0;
for ( ; i < nb; i++ ) for ( ; i < nb; i++ )
{ {
const GEOM::GEOM_Object_var& anObj = aParts[ i ]; GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aParts[ i ] );
if (CORBA::is_nil(anObj)) if (CORBA::is_nil(anObj))
continue; continue;
char* anEntry = anObj->GetEntry(); char* anEntry = anObj->GetEntry();