Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CmdAddPointGraph Class Reference

Command for adding one graph point. More...

#include <CmdAddPointGraph.h>

Inheritance diagram for CmdAddPointGraph:
Inheritance graph
Collaboration diagram for CmdAddPointGraph:
Collaboration graph

Public Member Functions

 CmdAddPointGraph (MainWindow &mainWindow, Document &document, const QString &curveName, const QPointF &posScreen, double ordinal)
 Constructor for normal creation.
 
 CmdAddPointGraph (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
 
virtual ~CmdAddPointGraph ()
 
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 CmdPointChangeBase
 CmdPointChangeBase (MainWindow &mainWindow, Document &document, const QString &cmdDescription)
 Single constructor.
 
virtual ~CmdPointChangeBase ()
 
- 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 CmdPointChangeBase
void restoreDocumentState (Document &document) const
 Restore the document previously saved by saveDocumentState.
 
void saveDocumentState (const Document &document)
 Save the document state for restoration by restoreDocumentState.
 
- 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 graph point.

Definition at line 17 of file CmdAddPointGraph.h.

Constructor & Destructor Documentation

◆ CmdAddPointGraph() [1/2]

CmdAddPointGraph::CmdAddPointGraph ( MainWindow & mainWindow,
Document & document,
const QString & curveName,
const QPointF & posScreen,
double ordinal )

Constructor for normal creation.

Definition at line 19 of file CmdAddPointGraph.cpp.

23 :
27 m_curveName (curveName),
28 m_posScreen (posScreen),
29 m_ordinal (ordinal)
30{
31 LOG4CPP_INFO_S ((*mainCat)) << "CmdAddPointGraph::CmdAddPointGraph"
32 << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
33 << " ordinal=" << m_ordinal;
34}
const QString CMD_DESCRIPTION("Add axis point")
log4cpp::Category * mainCat
Definition Logger.cpp:14
QString QPointFToString(const QPointF &pos)
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.
Base class for CmdBase leaf subclasses that involve point additions, deletions and/or modifications.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ CmdAddPointGraph() [2/2]

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

Constructor for parsing error report file xml.

Definition at line 36 of file CmdAddPointGraph.cpp.

39 :
42 cmdDescription)
43{
44 LOG4CPP_INFO_S ((*mainCat)) << "CmdAddPointGraph::CmdAddPointGraph";
45
47
48 if (!attributes.hasAttribute(DOCUMENT_SERIALIZE_SCREEN_X) ||
54 QString ("Missing attribute(s) %1, %2, %3, %4 and/or %5")
60 }
61
62 m_posScreen.setX(attributes.value(DOCUMENT_SERIALIZE_SCREEN_X).toDouble());
63 m_posScreen.setY(attributes.value(DOCUMENT_SERIALIZE_SCREEN_Y).toDouble());
64 m_curveName = attributes.value(DOCUMENT_SERIALIZE_CURVE_NAME).toString();
65 m_identifierAdded = attributes.value(DOCUMENT_SERIALIZE_IDENTIFIER).toString();
66 m_ordinal = attributes.value(DOCUMENT_SERIALIZE_ORDINAL).toDouble();
67}
const int INNER_RADIUS_MIN
const QString DOCUMENT_SERIALIZE_IDENTIFIER
const QString DOCUMENT_SERIALIZE_CURVE_NAME
const QString DOCUMENT_SERIALIZE_SCREEN_Y
const QString DOCUMENT_SERIALIZE_ORDINAL
const QString DOCUMENT_SERIALIZE_SCREEN_X
void xmlExitWithError(QXmlStreamReader &reader, const QString &message)
Show specified message for an error while reading xml, then quit.
Definition Xml.cpp:25

◆ ~CmdAddPointGraph()

CmdAddPointGraph::~CmdAddPointGraph ( )
virtual

Definition at line 69 of file CmdAddPointGraph.cpp.

70{
71}

Member Function Documentation

◆ cmdRedo()

void CmdAddPointGraph::cmdRedo ( )
virtual

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

Implements CmdAbstract.

Definition at line 73 of file CmdAddPointGraph.cpp.

74{
75 LOG4CPP_INFO_S ((*mainCat)) << "CmdAddPointGraph::cmdRedo";
76
80 m_posScreen,
81 m_identifierAdded,
82 m_ordinal);
83 document().updatePointOrdinals (mainWindow().transformation());
86}
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 saveDocumentState(const Document &document)
Save the document state for restoration by restoreDocumentState.
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
Definition Document.cpp:195
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.

◆ cmdUndo()

void CmdAddPointGraph::cmdUndo ( )
virtual

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

Implements CmdAbstract.

Definition at line 88 of file CmdAddPointGraph.cpp.

89{
90 LOG4CPP_INFO_S ((*mainCat)) << "CmdAddPointGraph::cmdUndo";
91
96}
void restoreDocumentState(Document &document) const
Restore the document previously saved by saveDocumentState.

◆ saveXml()

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

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 98 of file CmdAddPointGraph.cpp.

99{
100 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
102 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
103 writer.writeAttribute(DOCUMENT_SERIALIZE_CURVE_NAME, m_curveName);
104 writer.writeAttribute(DOCUMENT_SERIALIZE_SCREEN_X, QString::number (m_posScreen.x()));
105 writer.writeAttribute(DOCUMENT_SERIALIZE_SCREEN_Y, QString::number (m_posScreen.y()));
106 writer.writeAttribute(DOCUMENT_SERIALIZE_IDENTIFIER, m_identifierAdded);
107 writer.writeAttribute(DOCUMENT_SERIALIZE_ORDINAL, QString::number (m_ordinal));
108 writer.writeEndElement();
109}
const QString DOCUMENT_SERIALIZE_CMD_ADD_POINT_GRAPH
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION

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