X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM%2FGEOM_PythonDump.cxx;h=6d697dd991895d231bebf09c3bfcb8a834e1df8d;hb=58803ba33ee53a5944d565373782e5f0868c5461;hp=732501961fab18e1c32ced372a226d5f8f6e2529;hpb=7d880c6a8262b6d670ed70ee2b9ec25c199a46d4;p=modules%2Fgeom.git diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx index 732501961..6d697dd99 100644 --- a/src/GEOM/GEOM_PythonDump.cxx +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -44,11 +44,11 @@ namespace GEOM { if (--myCounter == 0) { TCollection_AsciiString aDescr; - if ( myAppend ) { + if ( myAppend ) aDescr = myFunction->GetDescription(); - if ( !aDescr.IsEmpty() ) aDescr += "\n\t"; - } std::string aString = myStream.str(); + if ( !aDescr.IsEmpty() && !aString.empty()) + aDescr += "\n\t"; aDescr += (char *)aString.c_str(); myFunction->SetDescription( aDescr ); } @@ -125,6 +125,39 @@ namespace GEOM return *this; } + TPythonDump& TPythonDump::operator<< (const Handle(TColStd_HSequenceOfTransient)& theObjects) + { + Standard_Integer aLength = theObjects->Length(); + if ( aLength > 1 ) { + myStream << "["; + } + for ( Standard_Integer i = 1; i <= aLength; i++ ) { + *this << Handle(GEOM_Object)::DownCast(theObjects->Value(i)); + if ( i < aLength ) myStream << ", "; + } + if ( aLength > 1 ) { + myStream << "]"; + } + return *this; + } + Standard_EXPORT TPythonDump& + TPythonDump::operator<< (const std::list& theObjects) + { + Standard_Integer aLength = theObjects.size(); + if ( aLength > 1 ) { + myStream << "["; + } + std::list::const_iterator obj = theObjects.begin(); + for ( Standard_Integer i = 1; i <= aLength; i++, ++obj ) { + *this << *obj; + if ( i < aLength ) myStream << ", "; + } + if ( aLength > 1 ) { + myStream << "]"; + } + return *this; + } + TPythonDump& TPythonDump::operator<< (const GEOM_BaseObject* theObject) { if ( !theObject ) { @@ -168,6 +201,11 @@ namespace GEOM for (i = 1; i <= aLen; i++) { anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i)); + if ( anObject.IsNull() ) { + Handle(GEOM_Function) fun = Handle(GEOM_Function)::DownCast(theObjects->Value(i)); + if ( !fun.IsNull() ) + anObject = GEOM_Object::GetObject( fun->GetOwnerEntry() ); + } aLatest = GetCreatedLast(aLatest, anObject); } return aLatest;