X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ProfileUZ.cxx;h=9e05e0a83fbe389129ecb72245064f9d6803a5f8;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=80fe9987309b306ecf9dc7ac997a2718e8577ec7;hpb=b0759ef35e28020af9766fc25ae9b8796f851b80;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ProfileUZ.cxx b/src/HYDROData/HYDROData_ProfileUZ.cxx index 80fe9987..9e05e0a8 100755 --- a/src/HYDROData/HYDROData_ProfileUZ.cxx +++ b/src/HYDROData/HYDROData_ProfileUZ.cxx @@ -8,6 +8,9 @@ #include +#include +#include +#include #include #include @@ -25,26 +28,25 @@ HYDROData_ProfileUZ::~HYDROData_ProfileUZ() { } -TopoDS_Shape HYDROData_ProfileUZ::GetShape() +TopoDS_Shape HYDROData_ProfileUZ::GetShape() const { - // TODO return TopoDS_Shape(); } -double HYDROData_ProfileUZ::GetDepthFromDistance( const double& theDistance ) const +double HYDROData_ProfileUZ::GetDepthFromDistance( const PointsList& thePoints, + const double& theDistance ) { double aResDepth = 0.0; - HYDROData_IPolyline::PointsList aPoints = GetPoints(); - int aNbPoints = aPoints.Size(); + int aNbPoints = thePoints.Size(); if ( aNbPoints < 2 ) return aResDepth; double aCompDist = 0.0; - HYDROData_IPolyline::Point aPrevPoint = aPoints.First(); + HYDROData_IPolyline::Point aPrevPoint = thePoints.First(); for ( int i = 2; i <= aNbPoints; ++i ) { - const Point& aCurPoint = aPoints.Value( i ); + const Point& aCurPoint = thePoints.Value( i ); double aPntDist = gp_Pnt2d( aPrevPoint.X(), 0 ).Distance( gp_Pnt2d( aCurPoint.X(), 0 ) ); @@ -52,7 +54,7 @@ double HYDROData_ProfileUZ::GetDepthFromDistance( const double& theDistance ) co if ( theDistance < aCompDist ) { - double aComPntDist = gp_Pnt2d( aPoints.First().X(), 0 ).Distance( gp_Pnt2d( aPrevPoint.X(), 0 ) ); + double aComPntDist = gp_Pnt2d( thePoints.First().X(), 0 ).Distance( gp_Pnt2d( aPrevPoint.X(), 0 ) ); double aFindDist = theDistance - aComPntDist; double aRatio = aFindDist / ( aPntDist - aFindDist ); @@ -90,12 +92,29 @@ void HYDROData_ProfileUZ::SetSectionName( const int /*theSe HYDROData_ProfileUZ::SectionType HYDROData_ProfileUZ::GetSectionType( const int /*theSectionIndex*/ ) const { - return SECTION_POLYLINE; + Handle(TDataStd_ExtStringList) aNamesList; + Handle(TDataStd_IntegerList) aTypesList; + Handle(TDataStd_BooleanList) aClosuresList; + getSectionsLists( aNamesList, aTypesList, aClosuresList, false ); + if ( aTypesList.IsNull() || aTypesList->IsEmpty() ) + return SECTION_POLYLINE; + + return (SectionType)aTypesList->First(); } void HYDROData_ProfileUZ::SetSectionType( const int /*theSectionIndex*/, - const SectionType /*theSectionType*/ ) + const SectionType theSectionType ) { + Handle(TDataStd_ExtStringList) aNamesList; + Handle(TDataStd_IntegerList) aTypesList; + Handle(TDataStd_BooleanList) aClosuresList; + getSectionsLists( aNamesList, aTypesList, aClosuresList ); + if ( aTypesList.IsNull() ) + return; + + // Refill the existing list + aTypesList->Clear(); + aTypesList->Append( theSectionType ); } bool HYDROData_ProfileUZ::IsClosedSection( const int /*theSectionIndex*/ ) const