X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Polyline3D.cxx;h=66cec7be744e31c58dbcdd6c26efba08a800c8e8;hb=d398a8be8e0b0259b476b358d53d234ce4c82379;hp=564f4f2cd4f2f18f1a878bc15d279fb7d43e2451;hpb=51f1f5efbfb19a6e9b39baccdb76a89b04663fbb;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Polyline3D.cxx b/src/HYDROData/HYDROData_Polyline3D.cxx index 564f4f2c..66cec7be 100644 --- a/src/HYDROData/HYDROData_Polyline3D.cxx +++ b/src/HYDROData/HYDROData_Polyline3D.cxx @@ -29,6 +29,9 @@ #include #include +#include +#include +#include #include #include @@ -47,6 +50,9 @@ #include +#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + #include #include @@ -82,7 +88,7 @@ QStringList HYDROData_Polyline3D::DumpToPython( const QString& thePyScriptPath, QString aProfileName = aProfile->GetObjPyName(); if ( !aProfileName.isEmpty() ) { - aResList << QString( "%1.SetProfileUZ( %2.GetProfileUZ() );" ) + aResList << QString( "%1.SetProfileUZ( %2.GetProfileUZ() )" ) .arg( aPolylineName ).arg( aProfileName ); } } @@ -102,7 +108,7 @@ QStringList HYDROData_Polyline3D::DumpToPython( const QString& thePyScriptPath, QString aProfileName = aProfile->GetObjPyName(); if ( !aProfileName.isEmpty() ) { - aResList << QString( "%1.SetChildProfileUZ( %2.GetProfileUZ() );" ) + aResList << QString( "%1.SetChildProfileUZ( %2.GetProfileUZ() )" ) .arg( aPolylineName ).arg( aProfileName ); } } @@ -113,7 +119,7 @@ QStringList HYDROData_Polyline3D::DumpToPython( const QString& thePyScriptPath, } aResList << QString( "" ); - aResList << QString( "%1.Update();" ).arg( aPolylineName ); + aResList << QString( "%1.Update()" ).arg( aPolylineName ); aResList << QString( "" ); return aResList; @@ -417,7 +423,7 @@ void HYDROData_Polyline3D::removeChildProfileUZ() */ } -HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints() const +HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints( double theEqDistance ) const { Polyline3DPoints aPoints; @@ -468,7 +474,29 @@ HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints() const } else { // Get points from spline curve Standard_Real aStart, anEnd; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve( TopoDS::Edge( anEdges.First() ), aStart, anEnd ); + TopoDS_Edge anEdge = TopoDS::Edge( anEdges.First() ); + Handle(Geom_Curve) aCurve = BRep_Tool::Curve( anEdge, aStart, anEnd ); + + if( theEqDistance > 0 ) + { + GeomAdaptor_Curve anAdaptorCurve( aCurve ); + double aLength = GCPnts_AbscissaPoint::Length( anAdaptorCurve ); + int aNbPoints = ceil( aLength / theEqDistance ); + GCPnts_QuasiUniformAbscissa aDist( anAdaptorCurve, aNbPoints ); + if( aDist.IsDone() ) + { + aNbPoints = aDist.NbPoints(); + for( int i=1; i<=aNbPoints; i++ ) + { + double p = aDist.Parameter( i ); + gp_Pnt aPnt; + aCurve->D0( p, aPnt ); + aPoints.Append( aPnt.XYZ() ); + } + return aPoints; + } + } + Handle(Geom_BSplineCurve) aGeomSpline = Handle(Geom_BSplineCurve)::DownCast( aCurve ); if ( !aGeomSpline.IsNull() ) {