Salome HOME
Create goups for stream.
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Diff.cxx
index 797cc68b18d7fdc797bb1f9f74ca6b4b268151ff..dbc633428bdce57e697d56cfb63975ce0435cb14 100644 (file)
@@ -49,9 +49,9 @@ CurveCreator_Diff::~CurveCreator_Diff()
 // function: init
 // purpose:
 //=======================================================================
-bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
-                             const CurveCreator_Operation::Type theType)
+bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve)
 {
+  CurveCreator_Operation::Type aType = CurveCreator_Operation::Clear;
   bool isOK = false;
 
   if (theCurve != NULL) {
@@ -60,36 +60,18 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
     // Set redo.
     myPRedo = new CurveCreator_Operation;
 
-    if (myPRedo->init(theType)) {
+    if (myPRedo->init(aType)) {
       isOK = true;
 
       const int aNbSections = theCurve->getNbSections();
 
-      if (theType == CurveCreator_Operation::Clear) {
-        // Construct undo for Clear command.
-        if (aNbSections > 0) {
-          setNbUndos(aNbSections);
+      // Construct undo for Clear command.
+      if (aNbSections > 0) {
+        setNbUndos(aNbSections);
 
-          for (int i = 0; i < aNbSections && isOK; i++) {
-            // Add AddSection command.
-            isOK = addSectionToUndo(theCurve, i, myPUndo[i]);
-          }
-        }
-      } else { // theType == CurveCreator_Operation::Join
-        // Construct undo for Join command.
-        if (aNbSections > 1) {
-          // Add the RemovePoints command to remove points of
-          // the second section fron the first one.
-          const int aNbPoints = theCurve->getNbPoints(0);
-
-          setNbUndos(aNbSections);
-          isOK = myPUndo[0].init(CurveCreator_Operation::RemovePoints,
-                                 0, aNbPoints, -1);
-
-          for (int i = 1; i < aNbSections && isOK; i++) {
-            // Add AddSection command.
-            isOK = addSectionToUndo(theCurve, i, myPUndo[i]);
-          }
+        for (int i = 0; i < aNbSections && isOK; i++) {
+          // Add AddSection command.
+          isOK = addSectionToUndo(theCurve, i, myPUndo[i]);
         }
       }
     }
@@ -226,73 +208,6 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
   return isOK;
 }
 
-//=======================================================================
-// function: init
-// purpose:
-//=======================================================================
-bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
-                             const CurveCreator_Operation::Type theType,
-                             const int theIntParam1,
-                             const int theIntParam2,
-                             const int theIntParam3)
-{
-  bool isOK = false;
-
-  if (theCurve != NULL) {
-    clear();
-
-    // Set redo.
-    myPRedo = new CurveCreator_Operation;
-
-    if (myPRedo->init(theType, theIntParam1, theIntParam2, theIntParam3)) {
-    }
-
-    if (!isOK) {
-      clear();
-    }
-  }
-
-  return isOK;
-}
-
-//=======================================================================
-// function: init
-// purpose:
-//=======================================================================
-bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
-                             const CurveCreator_Operation::Type theType,
-                             const CurveCreator::Coordinates &theCoords,
-                             const int theIntParam)
-{
-  bool isOK = false;
-
-  if (theCurve != NULL) {
-    clear();
-
-    // Set redo.
-    myPRedo = new CurveCreator_Operation;
-
-    if (myPRedo->init(theType, theCoords, theIntParam)) {
-      // Construct undo for AddPoints command.
-      const int aSectionInd = getSectionIndex(theCurve, theIntParam);
-      const CurveCreator::Dimension aDim = theCurve->getDimension();
-      const CurveCreator::Coordinates &aPoints =
-              theCurve->getPoints(aSectionInd);
-      const int aNbPoints = (aPoints.size()/aDim);
-
-      setNbUndos(1);
-      isOK = myPUndo[0].init(CurveCreator_Operation::RemovePoints,
-                             aSectionInd, aNbPoints, -1);
-    }
-
-    if (!isOK) {
-      clear();
-    }
-  }
-
-  return isOK;
-}
-
 //=======================================================================
 // function: init
 // purpose: