Version: 9.12.0
CurveCreator_Diff Class Reference

This is the support class for store/retrieve differences of undo/redo operations. More...

#include <CurveCreator_Diff.hxx>

Public Member Functions

 CurveCreator_Diff ()
 Constructor. More...
 
 ~CurveCreator_Diff ()
 Destructor. More...
 
bool init (const CurveCreator_Curve *theCurve)
 This method initializes the difference with an operation without parameters. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const int theIntParam)
 This method initializes the difference with an operation with one integer parameter. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const int theIntParam1, const int theIntParam2)
 This method initializes the difference with an operation with two integer parameters. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const std::list< int > &theParams)
 This method initializes the difference with an operation with two integer parameters. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const std::string &theName, const CurveCreator::Coordinates &theCoords, const int theIntParam1, const int theIntParam2)
 This method initializes the difference with an operation with one Name, one CurveCreator::Coordinates parameter and two integer parameters. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const std::string &theName, const int theIntParam1)
 This method initializes the difference with an operation with one string and one integer parameters. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const CurveCreator_ICurve::SectionToPointList &theParamList)
 This method initializes the difference with an operation with list of pairs of integer parameters. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const CurveCreator_ICurve::SectionToPointCoordsList &theParamList)
 This method initializes the difference with an operation with list of pairs of integer parameters with point coordinates. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_ICurve::SectionToPointCoordsList &theOldParamList)
 This method initializes the difference with an operation with list of pairs of integer parameters with point coordinates. More...
 
bool init (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const int theIntParam1, const int theIntParam2[3])
 This method initializes the difference with an operation with one integer and one array of integer[3] parameters. More...
 
void applyUndo (CurveCreator_Curve *theCurve)
 This method applies undo operation to theCurve. More...
 
void applyRedo (CurveCreator_Curve *theCurve)
 This method applies redo operation to theCurve. More...
 

Private Member Functions

void clear ()
 This method clears initialized data pointers. More...
 
void setNbUndos (const int theNbUndos)
 This method sets the number of undos and allocates the required space for myPUndo. More...
 
int getSectionIndex (const CurveCreator_Curve *theCurve, const int theIndex) const
 This method returns the section index. More...
 
bool addSectionToUndo (const CurveCreator_Curve *theCurve, const int theIndex, CurveCreator_Operation &theOperation) const
 Convert theIndex'th section of theCurve into AddSection command and store it in theOperation. More...
 
bool setTypeOrClosedToUndo (const CurveCreator_Curve *theCurve, const CurveCreator_Operation::Type theType, const int theIntParam1, const int theIntParam2)
 Construct undos for SetType and SetClosed operations. More...
 

Private Attributes

int myNbUndos
 
CurveCreator_OperationmyPUndo
 
CurveCreator_OperationmyPRedo
 

Detailed Description

To fill the difference it is necessary to create it with an appropriate type and to call the method initialize with required parameters.

Constructor & Destructor Documentation

◆ CurveCreator_Diff()

CurveCreator_Diff::CurveCreator_Diff ( )

◆ ~CurveCreator_Diff()

CurveCreator_Diff::~CurveCreator_Diff ( )

References clear().

Member Function Documentation

◆ addSectionToUndo()

bool CurveCreator_Diff::addSectionToUndo ( const CurveCreator_Curve theCurve,
const int  theIndex,
CurveCreator_Operation theOperation 
) const
private

◆ applyRedo()

void CurveCreator_Diff::applyRedo ( CurveCreator_Curve theCurve)

◆ applyUndo()

void CurveCreator_Diff::applyUndo ( CurveCreator_Curve theCurve)

◆ clear()

void CurveCreator_Diff::clear ( )
private

References myNbUndos, myPRedo, and myPUndo.

◆ getSectionIndex()

int CurveCreator_Diff::getSectionIndex ( const CurveCreator_Curve theCurve,
const int  theIndex 
) const
private

It returns theIndex if it is a real index and the last section's index if theIndex is equal to -1.

References CurveCreator_Curve::getNbSections().

◆ init() [1/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve)

◆ init() [2/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_ICurve::SectionToPointCoordsList theOldParamList 
)
Parameters
theCurvethe modified curve
theOldParamListthe old parameters (to be saved for undo)

References clear(), CurveCreator_Curve::getPoint(), CurveCreator_Operation::init(), myPRedo, myPUndo, CurveCreator_Operation::SetCoordinates, and setNbUndos().

◆ init() [3/10]

◆ init() [4/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const CurveCreator_ICurve::SectionToPointList theParamList 
)

◆ init() [5/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const int  theIntParam 
)

◆ init() [6/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const int  theIntParam1,
const int  theIntParam2 
)

◆ init() [7/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const int  theIntParam1,
const int  theIntParam2[3] 
)

It is applicable to the following operations:

  • ColorSection

References clear(), CurveCreator_Utils::colorConv(), CurveCreator_Curve::getColorSection(), CurveCreator_Operation::init(), myPRedo, myPUndo, and setNbUndos().

◆ init() [8/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const std::list< int > &  theParams 
)

◆ init() [9/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const std::string &  theName,
const CurveCreator::Coordinates theCoords,
const int  theIntParam1,
const int  theIntParam2 
)

◆ init() [10/10]

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const std::string &  theName,
const int  theIntParam1 
)

◆ setNbUndos()

void CurveCreator_Diff::setNbUndos ( const int  theNbUndos)
private

References myNbUndos, and myPUndo.

◆ setTypeOrClosedToUndo()

bool CurveCreator_Diff::setTypeOrClosedToUndo ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const int  theIntParam1,
const int  theIntParam2 
)
private

Note: the algorithm is optimized taking into account that there are only 2 types and 2 values of isClosed flag. If the number of types is increased, this algorithm should be re-implemented.

References CurveCreator_Curve::getNbSections(), CurveCreator_Curve::getSectionType(), CurveCreator_Operation::init(), CurveCreator_Curve::isClosed(), myPUndo, setNbUndos(), and CurveCreator_Operation::SetType.

Member Data Documentation

◆ myNbUndos

int CurveCreator_Diff::myNbUndos
private

◆ myPRedo

CurveCreator_Operation* CurveCreator_Diff::myPRedo
private

◆ myPUndo

CurveCreator_Operation* CurveCreator_Diff::myPUndo
private

The documentation for this class was generated from the following files: