X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Object.cxx;h=2ee9bd7ec4788fab611f7367eaebf3bf9173df72;hb=f108c7fd8c3b2dbb8c263b14456a31f8dd1d0921;hp=9a971a75a61172f187e110cf429866fbcc6a8e1c;hpb=bd1a4992da8d54929ec556df6db4e7e0ebbfbbd7;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Object.cxx b/src/HYDROData/HYDROData_Object.cxx index 9a971a75..2ee9bd7e 100644 --- a/src/HYDROData/HYDROData_Object.cxx +++ b/src/HYDROData/HYDROData_Object.cxx @@ -303,4 +303,44 @@ QColor HYDROData_Object::GetColor( const QColor& theDefColor, } return aResColor; -} \ No newline at end of file +} + +void HYDROData_Object::setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects, + QStringList& theScript, + const Handle(HYDROData_Object)& theRefObject, + const QString& theMethod ) const +{ + if ( theRefObject.IsNull() ) + return; + + QString aRefObjName = theRefObject->GetName(); + if ( aRefObjName.isEmpty() ) + return; + + bool anIsToSetObject = true; + + // The definition of reference polyline must be dumped before this + if ( !theTreatedObjects.contains( aRefObjName ) ) + { + // Write definition of reference polyline + QStringList aRefObjDump = theRefObject->DumpToPython( theTreatedObjects ); + if ( ( anIsToSetObject = !aRefObjDump.isEmpty() ) ) + { + QStringList aTmpList = theScript; + theScript = aRefObjDump; + + theScript << QString( "" ); + theScript << aTmpList; + + theTreatedObjects.insert( aRefObjName, theRefObject ); + } + } + + if ( anIsToSetObject ) + { + theScript << QString( "%1.%2( %3 );" ) + .arg( GetName() ).arg( theMethod ).arg( aRefObjName ); + } +} + +