{
bool isOK = false;
- if (theType == CurveCreator_Operation::Clear ||
- theType == CurveCreator_Operation::Join) {
+ if (theType == CurveCreator_Operation::Clear) {
clear();
myType = theType;
isOK = true;
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));
// 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<int> theParamList)
{
bool isOK = false;
- if (theType == CurveCreator_Operation::RemovePoints) {
- int *pData = (int *)allocate(3*sizeof(int));
-
- pData[0] = theIntParam1;
- pData[1] = theIntParam2;
- pData[2] = theIntParam3;
- myType = theType;
- isOK = true;
- }
-
- return isOK;
-}
-
-//=======================================================================
-// function: Constructor
-// purpose:
-//=======================================================================
-bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
- const CurveCreator::Coordinates &theCoords,
- const int theIntParam)
-{
- bool isOK = false;
+ if (theType == CurveCreator_Operation::Join)
+ {
+ const int aNbPoints = theParamList.size();
- if (theType == CurveCreator_Operation::AddPoints) {
- const int aNbCoords = theCoords.size();
const size_t aSize =
- 2*sizeof(theIntParam) + aNbCoords*sizeof(CurveCreator::TypeCoord);
- int *pIntData = (int *)allocate(aSize);
-
- *pIntData++ = theIntParam;
- *pIntData++ = aNbCoords;
+ sizeof(aNbPoints) +
+ aNbPoints * (sizeof(int));
- CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData;
- int i = 0;
+ int *pIntData = (int *)allocate(aSize);
- for (; i < aNbCoords; i++) {
- *pRealData++ = theCoords[i];
- }
+ *pIntData++ = aNbPoints;
+ std::list<int>::const_iterator anIt = theParamList.begin(), aLast = theParamList.end();
+ for ( ; anIt != aLast; anIt++ )
+ *pIntData++ = *anIt;
- myType = theType;
+ myType = theType;
isOK = true;
}
-
return isOK;
}
//=======================================================================
bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
const CurveCreator::Coordinates &theCoords,
- const int theIntParam1,
- const int theIntParam2)
+ const int theIntParam)
{
bool isOK = false;
- if (theType == CurveCreator_Operation::AddSection) {
+ if (theType == CurveCreator_Operation::AddPoints) {
const int aNbCoords = theCoords.size();
const size_t aSize =
- 3*sizeof(theIntParam1) + aNbCoords*sizeof(CurveCreator::TypeCoord);
+ 2*sizeof(theIntParam) + aNbCoords*sizeof(CurveCreator::TypeCoord);
int *pIntData = (int *)allocate(aSize);
- *pIntData++ = theIntParam1;
- *pIntData++ = theIntParam2;
+ *pIntData++ = theIntParam;
*pIntData++ = aNbCoords;
CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData;
pIntData = (int*)aStrPtr;
*pIntData++ = aNbCoords;
- CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)aStrPtr;
+ CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData;
int i = 0;
for (; i < aNbCoords; i++) {
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<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: