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

Command for deleting all selected Points. More...

#include <CmdDelete.h>

Inheritance diagram for CmdDelete:
Inheritance graph
Collaboration diagram for CmdDelete:
Collaboration graph

Public Member Functions

 CmdDelete (MainWindow &mainWindow, Document &document, const QStringList &selectedPointIdentifiers)
 Constructor for normal creation.
 
 CmdDelete (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
 
virtual ~CmdDelete ()
 
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 deleting all selected Points.

Definition at line 18 of file CmdDelete.h.

Constructor & Destructor Documentation

◆ CmdDelete() [1/2]

CmdDelete::CmdDelete ( MainWindow & mainWindow,
Document & document,
const QStringList & selectedPointIdentifiers )

Constructor for normal creation.

Definition at line 24 of file CmdDelete.cpp.

26 :
30{
31 LOG4CPP_INFO_S ((*mainCat)) << "CmdDelete::CmdDelete"
32 << " selected=" << selectedPointIdentifiers.count ();
33
34 // Export to clipboard
36 QTextStream strCsv (&m_csv), strHtml (&m_html);
37 exportStrategy.exportToClipboard (selectedPointIdentifiers,
39 strCsv,
40 strHtml,
43 m_curvesGraphsRemoved);
44}
const QString CMD_DESCRIPTION("Add axis point")
const int INNER_RADIUS_MIN
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.
Base class for CmdBase leaf subclasses that involve point additions, deletions and/or modifications.
const Curve & curveAxes() const
Get method for axis curve.
Definition Document.cpp:321
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
Definition Document.cpp:342
Strategy class for exporting to the clipboard. This strategy is external to the Document class so tha...
Transformation transformation() const
Return read-only copy of transformation.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ CmdDelete() [2/2]

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

Constructor for parsing error report file xml.

Definition at line 46 of file CmdDelete.cpp.

49 :
52 cmdDescription)
53{
54 LOG4CPP_INFO_S ((*mainCat)) << "CmdDelete::CmdDelete";
55
57
59 !attributes.hasAttribute(DOCUMENT_SERIALIZE_CSV) ||
60 !attributes.hasAttribute(DOCUMENT_SERIALIZE_HTML)) {
62 QString ("%1 %2, %3 %4 %5")
63 .arg (QObject::tr ("Missing attribute(s)"))
66 .arg (QObject::tr ("and/or"))
68 }
69
71
72 m_transformIsDefined = (defined == DOCUMENT_SERIALIZE_BOOL_TRUE);
73 m_csv = attributes.value(DOCUMENT_SERIALIZE_CSV).toString();
74 m_html = attributes.value(DOCUMENT_SERIALIZE_HTML).toString();
75 m_curvesGraphsRemoved.loadXml(reader);
76}
const QString DOCUMENT_SERIALIZE_TRANSFORM_DEFINED
const QString DOCUMENT_SERIALIZE_HTML
const QString DOCUMENT_SERIALIZE_CSV
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
void xmlExitWithError(QXmlStreamReader &reader, const QString &message)
Show specified message for an error while reading xml, then quit.
Definition Xml.cpp:25
void loadXml(QXmlStreamReader &reader)
Load from serialized xml post-version 5 file.

◆ ~CmdDelete()

CmdDelete::~CmdDelete ( )
virtual

Definition at line 78 of file CmdDelete.cpp.

79{
80}

Member Function Documentation

◆ cmdRedo()

void CmdDelete::cmdRedo ( )
virtual

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

Implements CmdAbstract.

Definition at line 82 of file CmdDelete.cpp.

83{
84 LOG4CPP_INFO_S ((*mainCat)) << "CmdDelete::cmdRedo";
85
88 document().removePointsInCurvesGraphs (m_curvesGraphsRemoved);
89
90 document().updatePointOrdinals (mainWindow().transformation());
93}
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 removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
Definition Document.cpp:877
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.

◆ cmdUndo()

void CmdDelete::cmdUndo ( )
virtual

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

Implements CmdAbstract.

Definition at line 95 of file CmdDelete.cpp.

96{
97 LOG4CPP_INFO_S ((*mainCat)) << "CmdDelete::cmdUndo";
98
103}
void restoreDocumentState(Document &document) const
Restore the document previously saved by saveDocumentState.

◆ saveXml()

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

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 105 of file CmdDelete.cpp.

106{
107 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
109 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
112 writer.writeAttribute(DOCUMENT_SERIALIZE_CSV, m_csv);
113 writer.writeAttribute(DOCUMENT_SERIALIZE_HTML, m_html);
114 m_curvesGraphsRemoved.saveXml(writer);
115 writer.writeEndElement();
116}
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DELETE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
const QString DOCUMENT_SERIALIZE_BOOL_FALSE
void saveXml(QXmlStreamWriter &writer) const
Serialize curves.

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