From: isn Date: Tue, 9 Apr 2019 14:50:06 +0000 (+0300) Subject: dumping-to-py of stream X-Git-Tag: SH_V2_2_0~99^2~24^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=484d0f0451d20e6a75c0bf331527d165a7e3982a;p=modules%2Fhydro.git dumping-to-py of stream --- diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 8b458e2a..e75dc368 100644 --- a/src/HYDROData/HYDROData_Stream.cxx +++ b/src/HYDROData/HYDROData_Stream.cxx @@ -119,6 +119,10 @@ QStringList HYDROData_Stream::DumpToPython( const QString& thePyScriptPath QStringList aResList = dumpObjectCreation( theTreatedObjects ); QString aName = GetObjPyName(); + int interpMethod = GetInterpolationMethod(); + QString anInterpMethod = QString::number( interpMethod ); + aResList << QString( "%1.SetInterpolationMethod( %2 )" ).arg( aName ).arg( anInterpMethod ); + Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis(); setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aHydAxis, "SetHydraulicAxis" ); @@ -135,10 +139,25 @@ QStringList HYDROData_Stream::DumpToPython( const QString& thePyScriptPath setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBottomPolyline, "SetBottomPolyline" ); } - QString aDDZs = QString::number( GetDDZ(), 'f', 3 ); - QString aSSteps = QString::number( GetSpatialStep(), 'f', 3 ); - aResList << QString( "%1.SetDDZ( %2 )" ).arg( aName ).arg( aDDZs ); - aResList << QString( "%1.SetSpatialStep( %2 )" ).arg( aName ).arg( aSSteps ); + if (interpMethod==0) + { + QString aDDZs = QString::number( GetDDZ(), 'f', 3 ); + QString aSSteps = QString::number( GetSpatialStep(), 'f', 3 ); + aResList << QString( "%1.SetDDZ( %2 )" ).arg( aName ).arg( aDDZs ); + aResList << QString( "%1.SetSpatialStep( %2 )" ).arg( aName ).arg( aSSteps ); + } + else if (interpMethod==1) + { + Handle(HYDROData_PolylineXY) aLeftBank = GetLeftBank(); + setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aLeftBank, "SetLeftBank" ); + Handle(HYDROData_PolylineXY) aRightBank = GetRightBank(); + setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRightBank, "SetRightBank" ); + + QString aHaxStep = QString::number( GetHaxStep(), 'f', 3 ); + QString aNbProfilePoints = QString::number( GetNbProfilePoints() ); + aResList << QString( "%1.SetHaxStep( %2 )" ).arg( aName ).arg( aHaxStep ); + aResList << QString( "%1.SetNbProfilePoints( %2 )" ).arg( aName ).arg( aNbProfilePoints ); + } aResList << QString( "" ); aResList << QString( "%1.Update()" ).arg( aName ); diff --git a/src/HYDROData/HYDROData_Stream.h b/src/HYDROData/HYDROData_Stream.h index 4d57079a..fb65c983 100644 --- a/src/HYDROData/HYDROData_Stream.h +++ b/src/HYDROData/HYDROData_Stream.h @@ -187,13 +187,13 @@ public: */ HYDRODATA_EXPORT virtual void RemoveHydraulicAxis(); - HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetLeftBank() const; + HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetLeftBank() const; - HYDRODATA_EXPORT void SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank ); + HYDRODATA_EXPORT virtual void SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank ); - HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetRightBank() const; + HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetRightBank() const; - HYDRODATA_EXPORT void SetRightBank( const Handle(HYDROData_PolylineXY)& theBank ); + HYDRODATA_EXPORT virtual void SetRightBank( const Handle(HYDROData_PolylineXY)& theBank ); /** * Returns true if profile has the intersection with the given hydraulic axis. * Returns the parameter of inresection point on axis if axis is presented by one curve, @@ -274,7 +274,7 @@ public: HYDRODATA_EXPORT void SetDDZ( double theDDZ ); HYDRODATA_EXPORT int GetInterpolationMethod() const; - HYDRODATA_EXPORT void SetInterpolationMethod( int theDDZ ); + HYDRODATA_EXPORT void SetInterpolationMethod( int theMode ); HYDRODATA_EXPORT double GetSpatialStep() const; HYDRODATA_EXPORT void SetSpatialStep( double theSpatialStep ); diff --git a/src/HYDROPy/HYDROData_Stream.sip b/src/HYDROPy/HYDROData_Stream.sip index cb233c5c..b4b78c40 100644 --- a/src/HYDROPy/HYDROData_Stream.sip +++ b/src/HYDROPy/HYDROData_Stream.sip @@ -176,6 +176,72 @@ public: } %End + /** + * Sets the left bank object for stream. (LISM method only) + */ + void SetLeftBank( HYDROData_PolylineXY theBank ) + [void ( const opencascade::handle& )]; + %MethodCode + Handle(HYDROData_PolylineXY) aRef = + Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) ); + if ( !aRef.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Stream::SetLeftBank( aRef ): + sipCpp->SetLeftBank( aRef ); + Py_END_ALLOW_THREADS + } + %End + + /** + * Returns the left bank object of stream. (LISM method only) + */ + HYDROData_PolylineXY GetLeftBank() const + [opencascade::handle ()]; + %MethodCode + Handle(HYDROData_PolylineXY) aRef; + + Py_BEGIN_ALLOW_THREADS + aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetLeftBank() : + sipCpp->GetLeftBank(); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_PolylineXY*)createPointer( aRef ); + %End + + /** + * Sets the right bank object for stream. (LISM method only) + */ + void SetRightBank( HYDROData_PolylineXY theBank ) + [void ( const opencascade::handle& )]; + %MethodCode + Handle(HYDROData_PolylineXY) aRef = + Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) ); + if ( !aRef.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Stream::SetRightBank( aRef ): + sipCpp->SetRightBank( aRef ); + Py_END_ALLOW_THREADS + } + %End + + /** + * Returns the right bank object of stream. (LISM method only) + */ + HYDROData_PolylineXY GetRightBank() const + [opencascade::handle ()]; + %MethodCode + Handle(HYDROData_PolylineXY) aRef; + + Py_BEGIN_ALLOW_THREADS + aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetRightBank() : + sipCpp->GetRightBank(); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_PolylineXY*)createPointer( aRef ); + %End + /** * Add interpolated profiles into the stream. * \param theInterpolator the interpolator @@ -184,15 +250,30 @@ public: virtual bool Interpolate( HYDROData_IProfilesInterpolator* theInterpolator ); /** - * Set vertical slicing step for profiles interpolation. + * Set vertical slicing step for profiles interpolation. (DTM method only) */ void SetDDZ( double theDDZ ); /** - * Set horizontal step for profiles interpolation. + * Set horizontal step for profiles interpolation. (DTM method only) */ void SetSpatialStep( double theSpatialStep ); + /** + * Set interpolation method (DTM or LISM). + */ + void SetInterpolationMethod( int theMode ); + + /** + * Set horizontal step on hydr. axis for profiles interpolation. (LISM method) + */ + void SetHaxStep( double theHaxStep ); + + /** + * Set number of points on profiles to insert (LISM method) + */ + void SetNbProfilePoints( int theNbPoints ); + protected: /** * Creates new object in the internal data structure. Use higher level objects