Engauge Digitizer 2
Loading...
Searching...
No Matches
CmdSelectCoordSystem.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
8#include "DataKey.h"
9#include "Document.h"
10#include "DocumentSerialize.h"
11#include "EngaugeAssert.h"
12#include "Logger.h"
13#include "MainWindow.h"
14#include <QApplication>
15#include <QClipboard>
16#include <QTextStream>
17#include "QtToString.h"
18#include <QXmlStreamReader>
19
20const QString CMD_DESCRIPTION ("Select Coordinate System");
21
23 Document &document,
24 CoordSystemIndex coordSystemIndex) :
25 CmdAbstract(mainWindow,
26 document,
28 m_coordSystemIndexBefore (document.coordSystemIndex()),
29 m_coordSystemIndexAfter (coordSystemIndex)
30{
31 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
32}
33
35 Document &document,
36 const QString &cmdDescription,
37 QXmlStreamReader & /* reader */) :
38 CmdAbstract (mainWindow,
39 document,
40 cmdDescription)
41{
42 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
43}
44
48
50{
51 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdRedo"
52 << " index=" << m_coordSystemIndexBefore << "->" << m_coordSystemIndexAfter;
53
55 mainWindow().updateCoordSystem (m_coordSystemIndexAfter);
57}
58
60{
61 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdUndo"
62 << " index=" << m_coordSystemIndexAfter << "->" << m_coordSystemIndexBefore;
63
65 mainWindow().updateCoordSystem (m_coordSystemIndexBefore);
67}
68
69void CmdSelectCoordSystem::saveXml (QXmlStreamWriter &writer) const
70{
71 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
72 writer.writeEndElement();
73}
const QString CMD_DESCRIPTION("Select Coordinate System")
unsigned int CoordSystemIndex
Zero-based index for identifying CoordSystem instantiations.
const QString DOCUMENT_SERIALIZE_CMD
log4cpp::Category * mainCat
Definition Logger.cpp:14
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition CmdAbstract.h:20
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 saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
CmdSelectCoordSystem(MainWindow &mainWindow, Document &document, CoordSystemIndex coordSystem)
Constructor for normal creation.
virtual void cmdUndo()
Undo method that is called when QUndoStack is moved one command backward.
virtual void cmdRedo()
Redo method that is called when QUndoStack is moved one command forward.
virtual void saveXml(QXmlStreamWriter &writer) const
Save commands as xml for later uploading.
Storage of one imported image and the data attached to that image.
Definition Document.h:42
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:92
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18