X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM%2FGEOM_PythonDump.cxx;h=bcee3dc0451d34d56c8d965f6f372df7482226b8;hb=1db636b7ff138bd7b3ac84f1c77a42299b259983;hp=395a3ab72458fcdea316a3336269a0dd843d2dff;hpb=2df46277e97c9573598470185c938e0c4ae419d6;p=modules%2Fgeom.git diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx index 395a3ab72..bcee3dc04 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 ); } @@ -140,6 +140,23 @@ namespace GEOM } 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) { @@ -184,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;