Salome HOME
Bug #183: regression: polyline - unnecessary table in Additition mode.
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_UtilsICurve.cxx
index 979a246d9aa1a6d91a75a0bf301c5532a362ad7d..d11598e257661b781a0191e3ec7694c1a4a22faa 100644 (file)
 #include "CurveCreator_UtilsICurve.hxx"
 
 #include "CurveCreator.hxx"
+#include <gp_Pnt.hxx>
 
 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,7 +83,7 @@ void CurveCreator_UtilsICurve::convert( const CurveCreator_ICurve::SectionToPoin
   }
 }
 
-#include "CurveCreator_Curve.hxx"
+#include "CurveCreator_Curve.hxx" // TODO
 void CurveCreator_UtilsICurve::getPoint( const CurveCreator_ICurve* theCurve, const int theISection,
                                          const int theIPoint, gp_Pnt& thePoint )
 {
@@ -94,11 +95,23 @@ void CurveCreator_UtilsICurve::getPoint( const CurveCreator_ICurve* theCurve, co
   thePoint = gp_Pnt( anX, anY, aZ);
 }
 
-/**
- * Returns whethe the container has the value
- * \param theList a container of values
- * \param theValue a value
- */
+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 )
 {