Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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...
 
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 ( )

References clear().

Member Function Documentation

bool CurveCreator_Diff::addSectionToUndo ( const CurveCreator_Curve theCurve,
const int  theIndex,
CurveCreator_Operation theOperation 
) const
private
void CurveCreator_Diff::applyRedo ( CurveCreator_Curve theCurve)
void CurveCreator_Diff::applyUndo ( CurveCreator_Curve theCurve)
void CurveCreator_Diff::clear ( )
private

References myNbUndos, myPRedo, myPUndo, and NULL.

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().

bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve)
bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const int  theIntParam 
)
bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const int  theIntParam1,
const int  theIntParam2 
)
bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const std::list< int > &  theParams 
)
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 
)
bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const std::string &  theName,
const int  theIntParam1 
)
bool CurveCreator_Diff::init ( const CurveCreator_Curve theCurve,
const CurveCreator_Operation::Type  theType,
const CurveCreator_ICurve::SectionToPointList theParamList 
)
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, NULL, CurveCreator_Operation::SetCoordinates, and setNbUndos().

void CurveCreator_Diff::setNbUndos ( const int  theNbUndos)
private

References myNbUndos, and myPUndo.

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 anIter(), CurveCreator_Curve::getNbSections(), CurveCreator_Curve::getSectionType(), CurveCreator_Curve::isClosed(), and CurveCreator_Operation::SetType.

Member Data Documentation

int CurveCreator_Diff::myNbUndos
private
CurveCreator_Operation* CurveCreator_Diff::myPRedo
private
CurveCreator_Operation* CurveCreator_Diff::myPUndo
private

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