From: mzn Date: Wed, 1 Apr 2015 08:41:51 +0000 (+0300) Subject: refs #492: implement dump to Python X-Git-Tag: BR_hydro_v_1_0_5~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=03f324d2f8bd78aa701c417c016a79017102a015;p=modules%2Fhydro.git refs #492: implement dump to Python --- diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 33de721c..bf9480c9 100644 --- a/src/HYDROData/HYDROData_Stream.cxx +++ b/src/HYDROData/HYDROData_Stream.cxx @@ -122,10 +122,10 @@ QStringList HYDROData_Stream::DumpToPython( MapOfTreatedObjects& theTreatedObjec setPythonReferenceObject( theTreatedObjects, aResList, aProfile, "AddProfile" ); } - // Create bottom polyline if exists + // Set bottom polyline if exists const Handle(HYDROData_Polyline3D) aBottomPolyline = GetBottomPolyline(); if ( !aBottomPolyline.IsNull() ) { - aResList << QString( "%1.GenerateBottomPolyline();" ).arg( aName ); + setPythonReferenceObject( theTreatedObjects, aResList, aBottomPolyline, "SetBottomPolyline" ); } aResList << QString( "" ); @@ -1123,6 +1123,17 @@ Handle(HYDROData_Polyline3D) HYDROData_Stream::GetBottomPolyline() const GetReferenceObject( DataTag_BottomPolyline ) ); } +bool HYDROData_Stream::SetBottomPolyline( const Handle(HYDROData_Polyline3D)& theBottom ) +{ + if ( theBottom.IsNull() ) { + return false; + } + + SetReferenceObject( theBottom, DataTag_BottomPolyline ); + + return true; +} + bool HYDROData_Stream::Interpolate( HYDROData_IProfilesInterpolator* theInterpolator ) { // Get the document diff --git a/src/HYDROData/HYDROData_Stream.h b/src/HYDROData/HYDROData_Stream.h index b80d588a..2af9abae 100644 --- a/src/HYDROData/HYDROData_Stream.h +++ b/src/HYDROData/HYDROData_Stream.h @@ -244,6 +244,13 @@ public: * Returns reference bottom polyline object of stream. */ HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline3D) GetBottomPolyline() const; + + /** + * Sets reference bottom polyline object for stream. + * \param theBottom the polyline 3D + * \return true in case of success + */ + HYDRODATA_EXPORT virtual bool SetBottomPolyline( const Handle(HYDROData_Polyline3D)& theBottom ); /** * Add interpolated profiles into the stream. diff --git a/src/HYDROPy/HYDROData_Stream.sip b/src/HYDROPy/HYDROData_Stream.sip index 1b64e7c8..8b17eff4 100644 --- a/src/HYDROPy/HYDROData_Stream.sip +++ b/src/HYDROPy/HYDROData_Stream.sip @@ -168,6 +168,23 @@ public: sipRes = (HYDROData_Polyline3D*)createPointer( aRef ); %End + /** + * Sets reference bottom polyline object for stream. + */ + bool SetBottomPolyline( HYDROData_Polyline3D theBottom ) + [bool ( const Handle_HYDROData_Polyline3D& )]; + %MethodCode + Handle(HYDROData_Polyline3D) aRef = + Handle(HYDROData_Polyline3D)::DownCast( createHandle( a0 ) ); + if ( !aRef.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipSelfWasArg ? sipCpp->HYDROData_Stream::SetBottomPolyline( aRef ): + sipCpp->SetBottomPolyline( aRef ); + Py_END_ALLOW_THREADS + } + %End + protected: /** * Creates new object in the internal data structure. Use higher level objects