13 #include <QTextStream> 15 #include <QXmlStreamReader> 22 const QStringList &pointIdentifiers,
30 m_pointIdentifiers (pointIdentifiers),
37 << pointIdentifiers.join(
" ").toLatin1 ().data ()
38 <<
" x=" << (m_isX ? QString::number (x).toLatin1().data() :
"")
39 <<
" y=" << (m_isY ? QString::number (y).toLatin1().data() :
"");
44 const QString &cmdDescription,
45 QXmlStreamReader &reader) :
52 QXmlStreamAttributes attributes = reader.attributes();
59 QString (
"%1 %2, %3, %4 %5 %6")
60 .arg (QObject::tr (
"Missing attribute(s)"))
64 .arg (QObject::tr (
"and/or"))
80 if (reader.atEnd() || reader.hasError ()) {
85 if ((reader.tokenType() == QXmlStreamReader::EndElement) &
91 if ((reader.tokenType() == QXmlStreamReader::StartElement) &&
95 QXmlStreamAttributes attributes = reader.attributes ();
105 reader.raiseError (QObject::tr (
"Cannot read graph points"));
155 for (
int index = 0; index < m_pointIdentifiers.count(); index++) {
159 writer.writeEndElement();
161 writer.writeEndElement();
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
virtual ~CmdEditPointGraph()
const QString DOCUMENT_SERIALIZE_POINT
virtual void cmdUndo()
Undo method that is called when QUndoStack is moved one command backward.
const QString DOCUMENT_SERIALIZE_EDIT_GRAPH_IS_Y
#define LOG4CPP_INFO_S(logger)
void restoreDocumentState(Document &document) const
Restore the document previously saved by saveDocumentState.
virtual void cmdRedo()
Redo method that is called when QUndoStack is moved one command forward.
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
const QString DOCUMENT_SERIALIZE_CMD_EDIT_POINT_GRAPH
void saveOrCheckPostCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
virtual void saveXml(QXmlStreamWriter &writer) const
Save commands as xml for later uploading.
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_BOOL_FALSE
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
Base class for CmdBase leaf subclasses that involve point additions, deletions and/or modifications.
const QString DOCUMENT_SERIALIZE_EDIT_GRAPH_Y
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
const QString CMD_DESCRIPTION("Edit curve points")
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
Storage of one imported image and the data attached to that image.
const QString DOCUMENT_SERIALIZE_IDENTIFIER
log4cpp::Category * mainCat
const QString DOCUMENT_SERIALIZE_EDIT_GRAPH_IS_X
const QString DOCUMENT_SERIALIZE_EDIT_GRAPH_X
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.
void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Edit the graph coordinates of one or more graph points.
const QString DOCUMENT_SERIALIZE_CMD
CmdEditPointGraph(MainWindow &mainWindow, Document &document, const QStringList &pointIdentifiers, bool isX, bool isY, double x, double y)
Constructor for normal creation.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
void saveDocumentState(const Document &document)
Save the document state for restoration by restoreDocumentState.