-// Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "CurveCreator_Diff.hxx"
#include "CurveCreator_Curve.hxx"
+#include "CurveCreator_Section.hxx"
+#include "CurveCreator_Utils.hxx"
#include <list>
if (myPRedo->init(theType, theIntParam)) {
// Construct undo for RemoveSection command.
// If the last section is removed, one AddSection command is enough.
- // If not last section is removed, two commands are requred: AddSection
+ // If not last section is removed, two commands are required: AddSection
// and MoveSection.
const int aLastIndex = theCurve->getNbSections() - 1;
return isOK;
}
+bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve,
+ const CurveCreator_Operation::Type theType,
+ const int theIntParam1,
+ const int theIntParam2[3])
+{
+ bool isOK = false;
+
+ if (theCurve != NULL)
+ {
+ clear();
+ myPRedo = new CurveCreator_Operation;
+
+ if (myPRedo->init(theType, theIntParam1, theIntParam2))
+ {
+ Quantity_Color aColor = theCurve->getColorSection(theIntParam1);
+
+ setNbUndos(1);
+ QColor aQColor = CurveCreator_Utils::colorConv(aColor);
+ int colorArr[3] = {aQColor.red(),aQColor.green(), aQColor.blue()};
+
+ isOK = myPUndo[0].init(theType, theIntParam1, colorArr);
+ }
+
+ if (!isOK)
+ clear();
+ }
+
+ return isOK;
+}
+
//=======================================================================
// function: init
// purpose:
setNbUndos(1);
isOK = myPUndo[0].init(CurveCreator_Operation::RemoveSection, -1);
break;
+ default:
+ break;
}
}
}
isOK = myPUndo[0].init(CurveCreator_Operation::RenameSection,
theCurve->getSectionName(theIntParam1), theIntParam1);
break;
+ default:
+ break;
}
}
if( !isOK ){
theCurve->getCoords(aSectionId);
CurveCreator::Coordinates::const_iterator anIterBegin =
aPoints.begin() + (aDim*aPointId);
- CurveCreator::Coordinates::const_iterator anIterEnd =
+ CurveCreator::Coordinates::const_iterator anIterEnd =
anIterBegin + aDim;
aPointsToAdd.insert(aPointsToAdd.end(), anIterBegin, anIterEnd);
aSectionToPointCoords.push_back(std::make_pair(*anIt, aPointsToAdd));
// Construct redo for SetCoordinates command.
CurveCreator_ICurve::SectionToPointCoordsList aSectionToPointActualCoords;
- CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt =
+ CurveCreator_ICurve::SectionToPointCoordsList::const_iterator anIt =
theOldParamList.begin(), aLast = theOldParamList.end();
for ( ; anIt != aLast; anIt++ ) {
CurveCreator::Coordinates anActualCoords = theCurve->getPoint(anIt->first.first, anIt->first.second);