mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 09:20:35 +05:00
0023493: EDF 15626 - Problem with Dump Study
- Fixed problem with GetExistingSubObjects() function dumping
This commit is contained in:
parent
b02853cb86
commit
1137dd744f
@ -170,41 +170,43 @@ namespace GEOM
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(GEOM_Object) GetCreatedLast(const Handle(GEOM_Object)& theObj1,
|
Handle(GEOM_BaseObject) GetCreatedLast(const Handle(Standard_Transient)& theObj1,
|
||||||
const Handle(GEOM_Object)& theObj2)
|
const Handle(Standard_Transient)& theObj2)
|
||||||
{
|
{
|
||||||
if (theObj1.IsNull()) return theObj2;
|
Handle(GEOM_BaseObject) bo1 = Handle(GEOM_Object)::DownCast(theObj1);
|
||||||
if (theObj2.IsNull()) return theObj1;
|
Handle(GEOM_BaseObject) bo2 = Handle(GEOM_Object)::DownCast(theObj2);
|
||||||
|
if (bo1.IsNull()) return bo2;
|
||||||
|
if (bo2.IsNull()) return bo1;
|
||||||
|
|
||||||
TColStd_ListOfInteger aTags1, aTags2;
|
TColStd_ListOfInteger aTags1, aTags2;
|
||||||
TDF_Tool::TagList(theObj1->GetEntry(), aTags1);
|
TDF_Tool::TagList(bo1->GetEntry(), aTags1);
|
||||||
TDF_Tool::TagList(theObj2->GetEntry(), aTags2);
|
TDF_Tool::TagList(bo2->GetEntry(), aTags2);
|
||||||
TColStd_ListIteratorOfListOfInteger aListIter1(aTags1), aListIter2(aTags2);
|
TColStd_ListIteratorOfListOfInteger aListIter1(aTags1), aListIter2(aTags2);
|
||||||
for (; aListIter1.More(); aListIter1.Next(), aListIter2.Next()) {
|
for (; aListIter1.More(); aListIter1.Next(), aListIter2.Next()) {
|
||||||
if (!aListIter2.More())
|
if (!aListIter2.More())
|
||||||
return theObj1; // anObj1 is stored under anObj2
|
return bo1; // anObj1 is stored under anObj2
|
||||||
|
|
||||||
if (aListIter1.Value() > aListIter2.Value())
|
if (aListIter1.Value() > aListIter2.Value())
|
||||||
return theObj1;
|
return bo1;
|
||||||
else if (aListIter1.Value() < aListIter2.Value())
|
else if (aListIter1.Value() < aListIter2.Value())
|
||||||
return theObj2;
|
return bo2;
|
||||||
}
|
}
|
||||||
return theObj1;
|
return bo1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(GEOM_Object) GetCreatedLast(const Handle(TColStd_HSequenceOfTransient)& theObjects)
|
Handle(GEOM_BaseObject) GetCreatedLast(const Handle(TColStd_HSequenceOfTransient)& theObjects)
|
||||||
{
|
{
|
||||||
Handle(GEOM_Object) anObject, aLatest;
|
Handle(GEOM_BaseObject) anObject, aLatest;
|
||||||
int i, aLen = theObjects->Length();
|
int i, aLen = theObjects->Length();
|
||||||
if (aLen < 1)
|
if (aLen < 1)
|
||||||
return aLatest;
|
return aLatest;
|
||||||
|
|
||||||
for (i = 1; i <= aLen; i++) {
|
for (i = 1; i <= aLen; i++) {
|
||||||
anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
|
anObject = Handle(GEOM_BaseObject)::DownCast(theObjects->Value(i));
|
||||||
if ( anObject.IsNull() ) {
|
if ( anObject.IsNull() ) {
|
||||||
Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast(theObjects->Value(i));
|
Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast(theObjects->Value(i));
|
||||||
if ( !fun.IsNull() )
|
if ( !fun.IsNull() )
|
||||||
anObject = GEOM_Object::GetObject( fun->GetOwnerEntry() );
|
anObject = GEOM_BaseObject::GetObject( fun->GetOwnerEntry() );
|
||||||
}
|
}
|
||||||
aLatest = GetCreatedLast(aLatest, anObject);
|
aLatest = GetCreatedLast(aLatest, anObject);
|
||||||
}
|
}
|
||||||
|
@ -67,12 +67,12 @@ namespace GEOM
|
|||||||
|
|
||||||
/*! Returns an object from two given, which has the latest entry
|
/*! Returns an object from two given, which has the latest entry
|
||||||
*/
|
*/
|
||||||
Standard_EXPORT Handle(::GEOM_Object) GetCreatedLast (const Handle(::GEOM_Object)& theObj1,
|
Standard_EXPORT Handle(::GEOM_BaseObject) GetCreatedLast (const Handle(Standard_Transient)& theObj1,
|
||||||
const Handle(::GEOM_Object)& theObj2);
|
const Handle(Standard_Transient)& theObj2);
|
||||||
|
|
||||||
/*! Returns an object from \a theObjects, which has the latest entry
|
/*! Returns an object from \a theObjects, which has the latest entry
|
||||||
*/
|
*/
|
||||||
Standard_EXPORT Handle(::GEOM_Object) GetCreatedLast (const Handle(TColStd_HSequenceOfTransient)& theObjects);
|
Standard_EXPORT Handle(::GEOM_BaseObject) GetCreatedLast (const Handle(TColStd_HSequenceOfTransient)& theObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1231,7 +1231,7 @@ GEOMImpl_IShapesOperations::GetGlueShapes (std::list< Handle(GEOM_Object) >& the
|
|||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
TopTools_SequenceOfShape shapes;
|
TopTools_SequenceOfShape shapes;
|
||||||
std::list< Handle(GEOM_Object) >::iterator s = theShapes.begin();
|
std::list< Handle(GEOM_Object) >::iterator s = theShapes.begin();
|
||||||
Handle(GEOM_Object) lastCreatedGO;
|
Handle(GEOM_BaseObject) lastCreatedGO;
|
||||||
for ( ; s != theShapes.end(); ++s )
|
for ( ; s != theShapes.end(); ++s )
|
||||||
{
|
{
|
||||||
Handle(GEOM_Object) go = *s;
|
Handle(GEOM_Object) go = *s;
|
||||||
@ -1414,23 +1414,23 @@ GEOMImpl_IShapesOperations::GetExistingSubObjects(Handle(GEOM_Object) theShap
|
|||||||
Standard_Integer types = theGroupsOnly ? Groups : Groups|SubShapes;
|
Standard_Integer types = theGroupsOnly ? Groups : Groups|SubShapes;
|
||||||
Handle(TColStd_HSequenceOfTransient) results = GetExistingSubObjects(theShape, types);
|
Handle(TColStd_HSequenceOfTransient) results = GetExistingSubObjects(theShape, types);
|
||||||
|
|
||||||
|
Handle(GEOM_BaseObject) lastCreatedGO = GEOM::GetCreatedLast(results);
|
||||||
|
lastCreatedGO = GEOM::GetCreatedLast(lastCreatedGO, theShape);
|
||||||
|
|
||||||
if (results->Length() > 0) {
|
if (results->Length() > 0) {
|
||||||
//Make a Python command
|
// Make a Python command
|
||||||
TCollection_AsciiString anAsciiList;
|
GEOM::TPythonDump pd (lastCreatedGO->GetLastFunction(), /*append=*/true);
|
||||||
for (int i = 1; i <= results->Length(); i++)
|
pd << "[";
|
||||||
|
Standard_Integer i, aLen = results->Length();
|
||||||
|
for (i = 1; i <= aLen; i++)
|
||||||
{
|
{
|
||||||
Handle(GEOM_BaseObject) obj = Handle(GEOM_BaseObject)::DownCast( results->Value(i));
|
Handle(GEOM_BaseObject) obj = Handle(GEOM_BaseObject)::DownCast(results->Value(i));
|
||||||
obj->GetEntryString();
|
pd << obj << ((i < aLen) ? ", " : "");
|
||||||
if ( i < results->Length() )
|
|
||||||
anAsciiList += ",";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM::TPythonDump pd (theShape->GetLastFunction(), /*append=*/true);
|
|
||||||
pd << "[" << anAsciiList.ToCString();
|
|
||||||
pd << "] = geompy.GetExistingSubObjects(";
|
pd << "] = geompy.GetExistingSubObjects(";
|
||||||
pd << theShape << ", " << (bool)theGroupsOnly << ")";
|
pd << theShape << ", " << (bool)theGroupsOnly << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4419,7 +4419,7 @@ Handle(TColStd_HSequenceOfInteger)
|
|||||||
// Make a Python command
|
// Make a Python command
|
||||||
|
|
||||||
// The GetShapesOnCylinder() doesn't change object so no new function is required.
|
// The GetShapesOnCylinder() doesn't change object so no new function is required.
|
||||||
Handle(GEOM_Object) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
|
Handle(GEOM_BaseObject) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
|
||||||
lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
|
lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
|
||||||
lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
|
lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
|
||||||
lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
|
lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
|
||||||
|
Loading…
Reference in New Issue
Block a user