+bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
+ const CurveCreator_ICurve::SectionToPointCoordsList &theParamList1)
+{
+ bool isOK = false;
+
+ if (theType == CurveCreator_Operation::InsertPoints ||
+ theType == CurveCreator_Operation::SetCoordinates ) {
+
+ const int aNbPoints = theParamList1.size();
+
+ CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt =
+ theParamList1.begin();
+ const int aNbCoords = anIt->second.size();
+
+ const size_t aSize =
+ sizeof(aNbPoints) + sizeof(aNbCoords) +
+ aNbPoints * (3*sizeof(int) + aNbCoords*sizeof(CurveCreator::TypeCoord));
+ int *pIntData = (int *)allocate(aSize);
+
+ *pIntData++ = aNbPoints;
+ *pIntData++ = aNbCoords;
+ int aSectionId, aPointId;
+ for ( ; anIt != theParamList1.end(); anIt++ ) {
+ aSectionId = anIt->first.first;
+ aPointId = anIt->first.second;
+
+ *pIntData++ = aSectionId;
+ *pIntData++ = aPointId;
+ *pIntData++ = aNbCoords;
+
+ const CurveCreator::Coordinates &aCoords = anIt->second;
+ CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData;
+ for (int i = 0; i < aNbCoords; i++) {
+ *pRealData++ = aCoords[i];
+ }
+ pIntData = (int *)pRealData;
+ }
+
+ myType = theType;
+ isOK = true;
+ }
+
+ return isOK;
+}
+
+bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType,
+ const CurveCreator_ICurve::SectionToPointList &theParamList1)
+{
+ bool isOK = false;
+
+ if (theType == CurveCreator_Operation::RemovePoints) {
+ const int aNbPoints = theParamList1.size();
+
+ CurveCreator_ICurve::SectionToPointList::const_iterator anIt =
+ theParamList1.begin();
+
+ const size_t aSize =
+ sizeof(aNbPoints) +
+ aNbPoints * (2*sizeof(int));
+ int *pIntData = (int *)allocate(aSize);
+
+ *pIntData++ = aNbPoints;
+ int aSectionId, aPointId;
+ for ( ; anIt != theParamList1.end(); anIt++ ) {
+ aSectionId = anIt->first;
+ aPointId = anIt->second;
+
+ *pIntData++ = aSectionId;
+ *pIntData++ = aPointId;
+ }
+
+ myType = theType;
+ isOK = true;
+ }
+
+ return isOK;
+}
+