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

Command for adding one Y/R Guideline value. More...

#include <CmdGuidelineAddYR.h>

Inheritance diagram for CmdGuidelineAddYR:
Inheritance graph
Collaboration diagram for CmdGuidelineAddYR:
Collaboration graph

Public Member Functions

 CmdGuidelineAddYR (MainWindow &mainWindow, Document &document, double value)
 Constructor for normal creation.
 CmdGuidelineAddYR (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
virtual ~CmdGuidelineAddYR ()
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
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.
MainWindowmainWindow ()
 Return the MainWindow so it can be updated by this command as a last step.
void resetSelection (const PointIdentifiers &pointIdentifiersToSelect)
 Since the set of selected points has probably changed, changed that set back to the specified set.
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.

Detailed Description

Command for adding one Y/R Guideline value.

Definition at line 16 of file CmdGuidelineAddYR.h.

Constructor & Destructor Documentation

◆ CmdGuidelineAddYR() [1/2]

CmdGuidelineAddYR::CmdGuidelineAddYR ( MainWindow & mainWindow,
Document & document,
double value )

Constructor for normal creation.

Definition at line 17 of file CmdGuidelineAddYR.cpp.

19 :
23 m_identifier (GuidelineIdentifierGenerator::next ()),
24 m_value (value)
25{
26 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineAddYR::CmdGuidelineAddYR";
27}
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.
static QString next()
Create next identifier.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ CmdGuidelineAddYR() [2/2]

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

Constructor for parsing error report file xml.

Definition at line 29 of file CmdGuidelineAddYR.cpp.

32 :
35 cmdDescription)
36{
37 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineAddYR::CmdGuidelineAddYR";
38
39 QXmlStreamAttributes attributes = reader.attributes();
40
41 if (!attributes.hasAttribute(DOCUMENT_SERIALIZE_IDENTIFIER) ||
42 !attributes.hasAttribute(DOCUMENT_SERIALIZE_GRAPH_AFTER)) {
43 xmlExitWithError (reader,
44 QString ("%1 %2 %3 %4")
45 .arg (QObject::tr ("Missing attribute(s)"))
47 .arg (QObject::tr ("and/or"))
49 }
50
51 m_identifier = attributes.value(DOCUMENT_SERIALIZE_IDENTIFIER).toString();
52 m_value = attributes.value(DOCUMENT_SERIALIZE_GRAPH_AFTER).toDouble();
53}
const QString DOCUMENT_SERIALIZE_IDENTIFIER
const QString DOCUMENT_SERIALIZE_GRAPH_AFTER
void xmlExitWithError(QXmlStreamReader &reader, const QString &message)
Show specified message for an error while reading xml, then quit.
Definition Xml.cpp:25

◆ ~CmdGuidelineAddYR()

CmdGuidelineAddYR::~CmdGuidelineAddYR ( )
virtual

Definition at line 55 of file CmdGuidelineAddYR.cpp.

56{
57}

Member Function Documentation

◆ cmdRedo()

void CmdGuidelineAddYR::cmdRedo ( )
virtual

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

Implements CmdAbstract.

Definition at line 59 of file CmdGuidelineAddYR.cpp.

60{
61 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineAddYR::cmdRedo"
62 << " identifier=" << m_identifier.toLatin1().data()
63 << " value=" << m_value;
64
65 mainWindow().guidelineAddYR (m_identifier,
66 m_value);
67}
void guidelineAddYR(const QString &identifier, double yR)
Add a Y/R Guideline.

◆ cmdUndo()

void CmdGuidelineAddYR::cmdUndo ( )
virtual

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

Implements CmdAbstract.

Definition at line 69 of file CmdGuidelineAddYR.cpp.

70{
71 LOG4CPP_INFO_S ((*mainCat)) << "CmdGuidelineAddYR::cmdUndo"
72 << " identifier=" << m_identifier.toLatin1().data();
73
74 mainWindow().guidelineRemove (m_identifier);
75}
void guidelineRemove(const QString &identifier)
Remove a X/T or Y/R Guideline.

◆ saveXml()

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

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 77 of file CmdGuidelineAddYR.cpp.

78{
79 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
81 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
82 writer.writeAttribute(DOCUMENT_SERIALIZE_IDENTIFIER, m_identifier);
83 writer.writeAttribute(DOCUMENT_SERIALIZE_GRAPH_AFTER, QString::number (m_value));
84 writer.writeEndElement();
85}
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_ADD_Y_R
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION

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