Engauge Digitizer 2
Loading...
Searching...
No Matches
CmdSelectCoordSystem Class Reference

Command for changing the currently selected CoordSystem. More...

#include <CmdSelectCoordSystem.h>

Inheritance diagram for CmdSelectCoordSystem:
Inheritance graph
Collaboration diagram for CmdSelectCoordSystem:
Collaboration graph

Public Member Functions

 CmdSelectCoordSystem (MainWindow &mainWindow, Document &document, CoordSystemIndex coordSystem)
 Constructor for normal creation.
 CmdSelectCoordSystem (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
virtual ~CmdSelectCoordSystem ()
virtual void cmdRedo ()
 Redo method that is called when QUndoStack is moved one command forward.
virtual void cmdUndo ()
 Undo method that is called when QUndoStack is moved one command backward.
virtual void saveXml (QXmlStreamWriter &writer) const
 Save commands as xml for later uploading.
Public Member Functions inherited from CmdAbstract
 CmdAbstract (MainWindow &mainWindow, Document &document, const QString &cmdDescription)
 Single constructor.
virtual ~CmdAbstract ()

Additional Inherited Members

Protected Member Functions inherited from CmdAbstract
void baseAttributes (QXmlStreamWriter &writer) const
 After writing leaf class attributes, this writes the base class atributes.
Documentdocument ()
 Return the Document that this command will modify during redo and undo.
const Documentdocument () const
 Return a const copy of the Document for non redo/undo interaction.
void leafAttributes (const QXmlStreamAttributes &attributes, const QStringList &requiredAttributesLeaf, QXmlStreamReader &reader)
 Same as often-used leafAndBaseAttributes, except this is used in the special case where a class inherits from another class (e.g.
void leafAndBaseAttributes (const QXmlStreamAttributes &attributes, const QStringList &requiredAttributesLeaf, QXmlStreamReader &reader)
 Before reading leaf class attributes, check all required attributes from leaf and this base class are included, then extract the parent class attributes.
MainWindowmainWindow ()
 Return the MainWindow so it can be updated by this command as a last step.
void resetSelection (const PointIdentifiers &pointIdentifiersToSelect)
 Call this (for consistency) after writing leaf class attributes, to write the base class attributes.
void restoreState ()
 Before any other operations associated with a Cmd class are performed, this method is called to restore original states to all relevant state machines.
void saveOrCheckPostCommandDocumentStateHash (const Document &document)
 Save, when called the first time, a hash value representing the state of the Document.
void saveOrCheckPreCommandDocumentStateHash (const Document &document)
 Save, when called the first time, a hash value representing the state of the Document.
void selectAddedPointForMoving (const QString &pointAdded)
 Select point that was just added so it can be moved by the user next for convenience.
void selectAddedPointsForMoving (const QStringList &pointsAdded)
 Select points that were just added so they can be moved by the user next for convenience.

Detailed Description

Command for changing the currently selected CoordSystem.

Definition at line 16 of file CmdSelectCoordSystem.h.

Constructor & Destructor Documentation

◆ CmdSelectCoordSystem() [1/2]

CmdSelectCoordSystem::CmdSelectCoordSystem ( MainWindow & mainWindow,
Document & document,
CoordSystemIndex coordSystem )

Constructor for normal creation.

Definition at line 23 of file CmdSelectCoordSystem.cpp.

25 :
29 m_coordSystemIndexBefore (document.coordSystemIndex()),
30 m_coordSystemIndexAfter (coordSystemIndex)
31{
32 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
33}
const QString CMD_DESCRIPTION("Add axis point")
log4cpp::Category * mainCat
Definition Logger.cpp:14
Document & document()
Return the Document that this command will modify during redo and undo.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
CmdAbstract(MainWindow &mainWindow, Document &document, const QString &cmdDescription)
Single constructor.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ CmdSelectCoordSystem() [2/2]

CmdSelectCoordSystem::CmdSelectCoordSystem ( MainWindow & mainWindow,
Document & document,
const QString & cmdDescription,
QXmlStreamReader & reader )

Constructor for parsing error report file xml.

Definition at line 35 of file CmdSelectCoordSystem.cpp.

38 :
41 cmdDescription)
42{
43 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
44
45 QXmlStreamAttributes attributes = reader.attributes();
46
47 QStringList requiredAttributesLeaf;
48 requiredAttributesLeaf << DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_AFTER
50 leafAndBaseAttributes (attributes,
51 requiredAttributesLeaf,
52 reader);
53
54 m_coordSystemIndexAfter = attributes.value(DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_AFTER).toInt ();
55 m_coordSystemIndexBefore = attributes.value(DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_BEFORE).toInt ();
56}
const QString DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_BEFORE
const QString DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_AFTER
void leafAndBaseAttributes(const QXmlStreamAttributes &attributes, const QStringList &requiredAttributesLeaf, QXmlStreamReader &reader)
Before reading leaf class attributes, check all required attributes from leaf and this base class are...

◆ ~CmdSelectCoordSystem()

CmdSelectCoordSystem::~CmdSelectCoordSystem ( )
virtual

Definition at line 58 of file CmdSelectCoordSystem.cpp.

59{
60}

Member Function Documentation

◆ cmdRedo()

void CmdSelectCoordSystem::cmdRedo ( )
virtual

Redo method that is called when QUndoStack is moved one command forward.

Implements CmdAbstract.

Definition at line 62 of file CmdSelectCoordSystem.cpp.

63{
64 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdRedo"
65 << " index=" << m_coordSystemIndexBefore << "->" << m_coordSystemIndexAfter;
66
67 restoreState ();
69 mainWindow().updateCoordSystem (m_coordSystemIndexAfter);
71}
void saveOrCheckPostCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void restoreState()
Before any other operations associated with a Cmd class are performed, this method is called to resto...
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.

◆ cmdUndo()

void CmdSelectCoordSystem::cmdUndo ( )
virtual

Undo method that is called when QUndoStack is moved one command backward.

Implements CmdAbstract.

Definition at line 73 of file CmdSelectCoordSystem.cpp.

74{
75 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdUndo"
76 << " index=" << m_coordSystemIndexAfter << "->" << m_coordSystemIndexBefore;
77
78 restoreState ();
80 mainWindow().updateCoordSystem (m_coordSystemIndexBefore);
82}

◆ saveXml()

void CmdSelectCoordSystem::saveXml ( QXmlStreamWriter & writer) const
virtual

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 84 of file CmdSelectCoordSystem.cpp.

85{
86 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
88 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
89 writer.writeAttribute(DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_BEFORE, QString::number (m_coordSystemIndexBefore));
90 writer.writeAttribute(DOCUMENT_SERIALIZE_COORD_SYSTEM_INDEX_AFTER, QString::number (m_coordSystemIndexAfter));
91 baseAttributes (writer);
92 writer.writeEndElement();
93}
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
const QString DOCUMENT_SERIALIZE_CMD_SELECT_COORD_SYSTEM
void baseAttributes(QXmlStreamWriter &writer) const
After writing leaf class attributes, this writes the base class atributes.

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