Seamly2D
Code documentation
MovePiece Class Reference

#include <movepiece.h>

Inheritance diagram for MovePiece:
Collaboration diagram for MovePiece:

Public Member Functions

 MovePiece (VAbstractPattern *doc, const double &x, const double &y, const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent=nullptr)
 
virtual ~MovePiece ()
 
virtual void undo () Q_DECL_OVERRIDE
 
virtual void redo () Q_DECL_OVERRIDE
 
virtual bool mergeWith (const QUndoCommand *command) Q_DECL_OVERRIDE
 
virtual int id () const Q_DECL_OVERRIDE
 
quint32 getPieceId () const
 
double getNewX () const
 
double getNewY () const
 
- Public Member Functions inherited from VUndoCommand
 VUndoCommand (const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent=nullptr)
 
virtual ~VUndoCommand ()=default
 

Private Member Functions

void SaveCoordinates (QDomElement &domElement, double x, double y)
 

Private Attributes

double m_oldX
 
double m_oldY
 
double m_newX
 
double m_newY
 
QGraphicsScene * m_scene
 

Additional Inherited Members

- Signals inherited from VUndoCommand
void ClearScene ()
 
void NeedFullParsing ()
 
void NeedLiteParsing (const Document &parse)
 
- Protected Member Functions inherited from VUndoCommand
virtual void RedoFullParsing ()
 
void UndoDeleteAfterSibling (QDomNode &parentNode, const quint32 &siblingId) const
 
void IncrementReferences (const QVector< quint32 > &nodes) const
 
void DecrementReferences (const QVector< quint32 > &nodes) const
 
void IncrementReferences (const QVector< CustomSARecord > &nodes) const
 
void DecrementReferences (const QVector< CustomSARecord > &nodes) const
 
void IncrementReferences (const QVector< VPieceNode > &nodes) const
 
void DecrementReferences (const QVector< VPieceNode > &nodes) const
 
QDomElement getDestinationObject (quint32 idTool, quint32 idPoint) const
 
- Protected Attributes inherited from VUndoCommand
QDomElement xml
 
VAbstractPatterndoc
 
quint32 nodeId
 
bool redoFlag
 

Detailed Description

Definition at line 65 of file movepiece.h.

Constructor & Destructor Documentation

◆ MovePiece()

MovePiece::MovePiece ( VAbstractPattern doc,
const double &  x,
const double &  y,
const quint32 &  id,
QGraphicsScene *  scene,
QUndoCommand *  parent = nullptr 
)

◆ ~MovePiece()

MovePiece::~MovePiece ( )
virtual

Definition at line 94 of file movepiece.cpp.

Member Function Documentation

◆ getNewX()

double MovePiece::getNewX ( ) const
inline

Definition at line 100 of file movepiece.h.

References m_newX.

Referenced by mergeWith().

◆ getNewY()

double MovePiece::getNewY ( ) const
inline

Definition at line 106 of file movepiece.h.

References m_newY.

Referenced by mergeWith().

◆ getPieceId()

quint32 MovePiece::getPieceId ( ) const
inline

Definition at line 94 of file movepiece.h.

References VUndoCommand::nodeId.

Referenced by mergeWith().

◆ id()

int MovePiece::id ( ) const
virtual

Definition at line 160 of file movepiece.cpp.

References MovePiece.

Referenced by MovePiece().

◆ mergeWith()

bool MovePiece::mergeWith ( const QUndoCommand *  command)
virtual

Definition at line 143 of file movepiece.cpp.

References getNewX(), getNewY(), getPieceId(), m_newX, m_newY, VUndoCommand::nodeId, and SCASSERT.

◆ redo()

◆ SaveCoordinates()

void MovePiece::SaveCoordinates ( QDomElement &  domElement,
double  x,
double  y 
)
private

Definition at line 166 of file movepiece.cpp.

References AttrMx, AttrMy, VUndoCommand::doc, qApp, and VDomDocument::SetAttribute().

Referenced by redo(), and undo().

◆ undo()

Member Data Documentation

◆ m_newX

double MovePiece::m_newX
private

Definition at line 86 of file movepiece.h.

Referenced by getNewX(), mergeWith(), and redo().

◆ m_newY

double MovePiece::m_newY
private

Definition at line 87 of file movepiece.h.

Referenced by getNewY(), mergeWith(), and redo().

◆ m_oldX

double MovePiece::m_oldX
private

Definition at line 84 of file movepiece.h.

Referenced by MovePiece(), and undo().

◆ m_oldY

double MovePiece::m_oldY
private

Definition at line 85 of file movepiece.h.

Referenced by MovePiece(), and undo().

◆ m_scene

QGraphicsScene* MovePiece::m_scene
private

Definition at line 88 of file movepiece.h.

Referenced by redo().


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