X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_UtilsICurve.cxx;h=d11598e257661b781a0191e3ec7694c1a4a22faa;hb=65c66988575cb4fc8de7d838cde08b4731a6e54b;hp=29aa672cbedbe19459a64679c10d81e6abee5710;hpb=ab0fa2ad7637d748339ba77b7ba151ef4f51fe9e;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_UtilsICurve.cxx b/src/HYDROCurveCreator/CurveCreator_UtilsICurve.cxx index 29aa672c..d11598e2 100644 --- a/src/HYDROCurveCreator/CurveCreator_UtilsICurve.cxx +++ b/src/HYDROCurveCreator/CurveCreator_UtilsICurve.cxx @@ -20,10 +20,11 @@ #include "CurveCreator_UtilsICurve.hxx" #include "CurveCreator.hxx" +#include const double LOCAL_SELECTION_TOLERANCE = 0.0001; -int CurveCreator_UtilsICurve::findLocalPointIndex( CurveCreator_ICurve* theCurve, +int CurveCreator_UtilsICurve::findLocalPointIndex( const CurveCreator_ICurve* theCurve, int theSectionId, float theX, float theY ) { int aPntIndex = -1; @@ -43,7 +44,7 @@ int CurveCreator_UtilsICurve::findLocalPointIndex( CurveCreator_ICurve* theCurve return aPntIndex; } -void CurveCreator_UtilsICurve::findSectionsToPoints( CurveCreator_ICurve* theCurve, +void CurveCreator_UtilsICurve::findSectionsToPoints( const CurveCreator_ICurve* theCurve, const double theX, const double theY, CurveCreator_ICurve::SectionToPointList& thePoints ) { @@ -82,11 +83,35 @@ void CurveCreator_UtilsICurve::convert( const CurveCreator_ICurve::SectionToPoin } } -/** - * Returns whethe the container has the value - * \param theList a container of values - * \param theValue a value - */ +#include "CurveCreator_Curve.hxx" // TODO +void CurveCreator_UtilsICurve::getPoint( const CurveCreator_ICurve* theCurve, const int theISection, + const int theIPoint, gp_Pnt& thePoint ) +{ + double anX, anY, aZ; + // TODO + const CurveCreator_Curve* aCurve = dynamic_cast( theCurve ); + if ( aCurve ) + aCurve->getCoordinates( theISection, theIPoint, anX, anY, aZ ); + thePoint = gp_Pnt( anX, anY, aZ); +} + +std::string CurveCreator_UtilsICurve::getUniqSectionName( CurveCreator_ICurve* theCurve ) +{ + for( int i = 0 ; i < 1000000 ; i++ ){ + char aBuffer[255]; + sprintf( aBuffer, "Section_%d", i+1 ); + std::string aName(aBuffer); + int j; + for( j = 0 ; j < theCurve->getNbSections() ; j++ ){ + if( theCurve->getSectionName(j) == aName ) + break; + } + if( j == theCurve->getNbSections() ) + return aName; + } + return ""; +} + bool CurveCreator_UtilsICurve::contains( const CurveCreator_ICurve::SectionToPointList& theList, const CurveCreator_ICurve::SectionToPoint& theValue ) {