X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Operation.cxx;h=173e1c8817fdcabd8c6ebf84940c751accafbd22;hb=09d10e66ba0fac5353c8d1f138055fc6fe86fb65;hp=bd9cab5dcdea6a91a93e4b98ef6f8f760f525da2;hpb=def20bd12acaadb7d345ef3635a23eb8e4e4d086;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Operation.cxx b/src/HYDROCurveCreator/CurveCreator_Operation.cxx index bd9cab5d..173e1c88 100644 --- a/src/HYDROCurveCreator/CurveCreator_Operation.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Operation.cxx @@ -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 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::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 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: