X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Operation.cxx;h=173e1c8817fdcabd8c6ebf84940c751accafbd22;hb=09d10e66ba0fac5353c8d1f138055fc6fe86fb65;hp=0d2bb4846769b8010a9bdcdafc515aa75bb197ca;hpb=5ea16b2d660c191252474270455af7a3c5822eab;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Operation.cxx b/src/HYDROCurveCreator/CurveCreator_Operation.cxx index 0d2bb484..173e1c88 100644 --- a/src/HYDROCurveCreator/CurveCreator_Operation.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Operation.cxx @@ -60,8 +60,7 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType) { bool isOK = false; - if (theType == CurveCreator_Operation::Clear || - theType == CurveCreator_Operation::Join) { + if (theType == CurveCreator_Operation::Clear) { clear(); myType = theType; isOK = true; @@ -103,7 +102,6 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, if (theType == CurveCreator_Operation::SetType || theType == CurveCreator_Operation::SetClosed || theType == CurveCreator_Operation::MoveSection || - theType == CurveCreator_Operation::RemovePoints || theType == CurveCreator_Operation::Join) { int *pData = (int *)allocate(2*sizeof(int)); @@ -120,23 +118,28 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, // function: Constructor // purpose: //======================================================================= -bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, - const int theIntParam1, - const int theIntParam2, - const int theIntParam3) +bool CurveCreator_Operation::init(const Type theType, const std::list theParamList) { bool isOK = false; - if (theType == CurveCreator_Operation::RemovePoints) { - int *pData = (int *)allocate(3*sizeof(int)); + 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::const_iterator anIt = theParamList.begin(), aLast = theParamList.end(); + for ( ; anIt != aLast; anIt++ ) + *pIntData++ = *anIt; - pData[0] = theIntParam1; - pData[1] = theIntParam2; - pData[2] = theIntParam3; myType = theType; - isOK = true; + isOK = true; } - return isOK; } @@ -384,16 +387,20 @@ void CurveCreator_Operation::apply(CurveCreator_Curve *theCurve) theCurve->clearInternal(); break; case CurveCreator_Operation::SetClosed: - theCurve->setClosedInternal((pInt[0] != 0), pInt[1]); + theCurve->setClosedInternal(pInt[1], (pInt[0] != 0)); break; case CurveCreator_Operation::MoveSection: 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 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: