16#include <QXmlStreamReader>
17#include <QXmlStreamWriter>
24 const QString &curveName,
25 const QList<QPoint> &points,
26 const QList<double> &ordinals) :
30 m_curveName (curveName),
39 const QString &cmdDescription,
40 QXmlStreamReader &reader) :
47 QXmlStreamAttributes attributes = reader.attributes();
52 .arg (QObject::tr (
"Missing attribute"))
61 if (reader.atEnd() || reader.hasError ()) {
66 if ((reader.tokenType() == QXmlStreamReader::EndElement) &
72 if ((reader.tokenType() == QXmlStreamReader::StartElement) &&
76 QXmlStreamAttributes attributes = reader.attributes ();
78 QStringList requiredAttributesLeaf;
84 requiredAttributesLeaf,
97 reader.raiseError (QObject::tr (
"Cannot read graph points"));
114 for (index = 0; index < m_points.count(); index++) {
116 QString identifierAdded;
120 m_ordinals.at (index));
121 m_identifiersAdded.push_back (identifierAdded);
148 for (
int index = 0; index < m_points.count(); index++) {
155 if (index < m_identifiersAdded.count()) {
156 identifier = m_identifiersAdded.at (index);
161 writer.writeEndElement();
164 writer.writeEndElement();
const QString CMD_DESCRIPTION("Add axis point")
const QString CMD_DESCRIPTION("Add graph points")
const QString DOCUMENT_SERIALIZE_IDENTIFIER
const QString DOCUMENT_SERIALIZE_CURVE_NAME
const QString DOCUMENT_SERIALIZE_CMD_ADD_POINTS_GRAPH
const QString DOCUMENT_SERIALIZE_SCREEN_Y
const QString DOCUMENT_SERIALIZE_POINT
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_ORDINAL
const QString DOCUMENT_SERIALIZE_SCREEN_X
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
log4cpp::Category * mainCat
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
void xmlExitWithError(QXmlStreamReader &reader, const QString &message)
Show specified message for an error while reading xml, then quit.
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.
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 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 inher...
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void baseAttributes(QXmlStreamWriter &writer) const
After writing leaf class attributes, this writes the base class atributes.
void selectAddedPointsForMoving(const QStringList &pointsAdded)
Select points that were just added so they can be moved by the user next for convenience.
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.
CmdAddPointsGraph(MainWindow &mainWindow, Document &document, const QString &curveName, const QList< QPoint > &points, const QList< double > &ordinals)
Constructor for normal creation.
virtual void saveXml(QXmlStreamWriter &writer) const
Save commands as xml for later uploading.
virtual ~CmdAddPointsGraph()
void saveDocumentState(const Document &document)
Save the document state for restoration by restoreDocumentState.
void restoreDocumentState(Document &document) const
Restore the document previously saved by saveDocumentState.
CmdPointChangeBase(MainWindow &mainWindow, Document &document, const QString &cmdDescription)
Single constructor.
Storage of one imported image and the data attached to that image.
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.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
#define LOG4CPP_INFO_S(logger)