Salome HOME
bug #63: join of sections
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Profile.cxx
index c857fd207a3e279a77f08de5fbea74f686c97c1e..69e60486ed65e3cc66c7913f42db6a1be7b12c3c 100644 (file)
@@ -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