X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Profile.cxx;h=bcfc8fb0f816e884bc5ab8e63daa6fd24a4b7228;hb=09d10e66ba0fac5353c8d1f138055fc6fe86fb65;hp=c857fd207a3e279a77f08de5fbea74f686c97c1e;hpb=5f5584107a486013bff5df971695bc8197716252;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Profile.cxx b/src/HYDROCurveCreator/CurveCreator_Profile.cxx index c857fd20..bcfc8fb0 100644 --- a/src/HYDROCurveCreator/CurveCreator_Profile.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Profile.cxx @@ -71,19 +71,19 @@ bool CurveCreator_Profile::clearInternal() myDisplayer->eraseAll( true ); // Delete all allocated data. - mySections[ 0 ]->myPoints.clear(); + CurveCreator_Section* aSection = getSection( 0 ); + if ( aSection ) + aSection->myPoints.clear(); return true; } -bool CurveCreator_Profile::joinInternal( const int theISectionTo, - const int theISectionFrom ) +bool CurveCreator_Profile::joinInternal( const std::list& theSections ) { return false; } -bool CurveCreator_Profile::join( const int theISectionTo, - const int theISectionFrom ) +bool CurveCreator_Profile::join( const std::list& theSections ) { return false; } @@ -137,7 +137,7 @@ bool CurveCreator_Profile::addPointsInternal( const CurveCreator::SectionsMap &t { bool res = false; - CurveCreator_Section* aSection = mySections.at( 0 ); + CurveCreator_Section* aSection = getSection( 0 ); if( !aSection ) return res; @@ -211,7 +211,7 @@ bool CurveCreator_Profile::setPointInternal( const CurveCreator::SectionsMap &th } int anISection = 0; - CurveCreator_Section* aSection = mySections.at( anISection ); + CurveCreator_Section* aSection = getSection( anISection ); if( !aSection ) return aRes; @@ -249,4 +249,32 @@ void CurveCreator_Profile::convert( const CurveCreator::PosPointsList& thePoints bool CurveCreator_Profile::canPointsBeSorted() { return true; +} + +/** + * Add one point to the specified section starting from the given theIPnt index + * (or at the end of points if \a theIPnt is -1). + */ +bool CurveCreator_Profile::addPoints( const CurveCreator::Coordinates& theCoords, + const int theISection, + const int theIPnt ) +{ + int anIPnt = theIPnt; + + if ( anIPnt == - 1 && theCoords.size() > 1 ) { + CurveCreator::Coordinates aCoords; + for ( int i = 0, aNb = getNbPoints( theISection ); i < aNb; i++ ) { + aCoords = getPoint( theISection, i ); + if ( aCoords.size() < 2 ) { + continue; + } + + if ( theCoords[0] < aCoords[0] ) { + anIPnt = i; + break; + } + } + } + + return CurveCreator_Curve::addPoints( theCoords, theISection, anIPnt ); } \ No newline at end of file