Salome HOME
Stream object creation improved to do not use the transaction during it modification.
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Operation.cxx
index bd9cab5dcdea6a91a93e4b98ef6f8f760f525da2..173e1c8817fdcabd8c6ebf84940c751accafbd22 100644 (file)
@@ -114,6 +114,35 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
   return isOK;
 }
 
+//=======================================================================
+// function: Constructor
+// purpose:
+//=======================================================================
+bool CurveCreator_Operation::init(const Type theType, const std::list<int> theParamList)
+{
+  bool isOK = false;
+
+  if (theType == CurveCreator_Operation::Join)
+  {
+    const int aNbPoints = theParamList.size();
+
+    const size_t aSize =
+      sizeof(aNbPoints) +
+      aNbPoints * (sizeof(int));
+
+    int *pIntData = (int *)allocate(aSize);
+
+    *pIntData++ = aNbPoints;
+    std::list<int>::const_iterator anIt = theParamList.begin(), aLast = theParamList.end();
+    for ( ; anIt != aLast; anIt++ )
+      *pIntData++ = *anIt;
+
+    myType   = theType;
+    isOK   = true;
+  }
+  return isOK;
+}
+
 //=======================================================================
 // function: Constructor
 // purpose:
@@ -364,10 +393,14 @@ void CurveCreator_Operation::apply(CurveCreator_Curve *theCurve)
         theCurve->moveSectionInternal(pInt[0], pInt[1]);
         break;
       case CurveCreator_Operation::Join:
-        if (myPData == NULL) {
-          theCurve->joinInternal();
-        } else {
-          theCurve->joinInternal(pInt[0], pInt[1]);
+        if (myPData != NULL)
+        {
+          std::list<int> aListOfSections;
+          int nbSections = pInt[0];
+          for (int i = 1; i < nbSections+1; i++) {
+            aListOfSections.push_back(pInt[i]);
+          }
+          theCurve->joinInternal(aListOfSections);
         }
         break;
       case CurveCreator_Operation::AddSection: