]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Fix Undo/Redo of section removing.
authorakl <akl@opencascade.com>
Thu, 21 Nov 2013 18:37:39 +0000 (18:37 +0000)
committerakl <akl@opencascade.com>
Thu, 21 Nov 2013 18:37:39 +0000 (18:37 +0000)
src/HYDROCurveCreator/CurveCreator_Diff.cxx
src/HYDROCurveCreator/CurveCreator_Operation.cxx
src/HYDROCurveCreator/CurveCreator_Operation.hxx

index fba15d131dc6ca6ff3fb7f299fca872873ddcf94..128deb7c10727e90b85192a5af5a90df032d2232 100644 (file)
@@ -525,12 +525,13 @@ bool CurveCreator_Diff::addSectionToUndo
                        const int theIndex,
                        CurveCreator_Operation &theOperation) const
 {
+  const std::string aName = theCurve->getSectionName(theIndex);
   const CurveCreator::Coordinates &aPnts = theCurve->getPoints(theIndex);
   const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex);
   const bool isClosed = theCurve->isClosed(theIndex);
 
   bool isOK = theOperation.init(CurveCreator_Operation::AddSection,
-                                aPnts, aType, isClosed);
+                                aName, aPnts, aType, isClosed);
 
   return isOK;
 }
index fa9cdb071f753de652069a14ed1307fd8bb4c980..0d2bb4846769b8010a9bdcdafc515aa75bb197ca 100644 (file)
@@ -173,41 +173,6 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
   return isOK;
 }
 
-//=======================================================================
-// function: Constructor
-// purpose:
-//=======================================================================
-bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
-                                  const CurveCreator::Coordinates &theCoords,
-                                  const int theIntParam1,
-                                  const int theIntParam2)
-{
-  bool isOK = false;
-
-  if (theType == CurveCreator_Operation::AddSection) {
-    const int aNbCoords = theCoords.size();
-    const size_t aSize =
-      3*sizeof(theIntParam1) + aNbCoords*sizeof(CurveCreator::TypeCoord);
-    int *pIntData = (int *)allocate(aSize);
-
-    *pIntData++ = theIntParam1;
-    *pIntData++ = theIntParam2;
-    *pIntData++ = aNbCoords;
-
-    CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData;
-    int i = 0;
-
-    for (; i < aNbCoords; i++) {
-      *pRealData++ = theCoords[i];
-    }
-
-    myType = theType;
-    isOK   = true;
-  }
-
-  return isOK;
-}
-
 //=======================================================================
 // function: Constructor
 // purpose:
@@ -239,7 +204,7 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
     pIntData = (int*)aStrPtr;
     *pIntData++ = aNbCoords;
 
-    CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)aStrPtr;
+    CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData;
     int i = 0;
 
     for (; i < aNbCoords; i++) {
index be8ceef616e7c445f3e22a7f6da1d8d1b24a3402..1b83cd51771d36cd35434ebd440f4805196eebdb 100644 (file)
@@ -142,19 +142,6 @@ public:
   bool init(const Type theType, const CurveCreator::Coordinates &theCoords,
             const int theIntParam);
 
-  /**
-   * This method initializes the object with an operation with one
-   * CurveCreator::Coordinates parameter and two integer parameters.
-   * It is applicable to the following operations:
-   * <UL>
-   *   <LI>AddSection</LI>
-   *   <LI>InsertPoints</LI>
-   *   <LI>SetCoordinates</LI>
-   * </UL>
-   * @return true in case of success; false otherwise.
-   */
-  bool init(const Type theType, const CurveCreator::Coordinates &theCoords,
-            const int theIntParam1, const int theIntParam2);
   /**
    * This method initializes the object with an operation with
    * list of pairs of integer parameters and CurveCreator::Coordinates parameters.