Engauge Digitizer
2
Loading...
Searching...
No Matches
Cmd
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
7
#include "
CmdSelectCoordSystem.h
"
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
20
const
QString
CMD_DESCRIPTION
(
"Select Coordinate System"
);
21
22
CmdSelectCoordSystem::CmdSelectCoordSystem
(
MainWindow
&mainWindow,
23
Document
&document,
24
CoordSystemIndex
coordSystemIndex) :
25
CmdAbstract
(mainWindow,
26
document,
27
CMD_DESCRIPTION
),
28
m_coordSystemIndexBefore (document.coordSystemIndex()),
29
m_coordSystemIndexAfter (coordSystemIndex)
30
{
31
LOG4CPP_INFO_S
((*
mainCat
)) <<
"CmdSelectCoordSystem::CmdSelectCoordSystem"
;
32
}
33
34
CmdSelectCoordSystem::CmdSelectCoordSystem
(
MainWindow
&mainWindow,
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
45
CmdSelectCoordSystem::~CmdSelectCoordSystem
()
46
{
47
}
48
49
void
CmdSelectCoordSystem::cmdRedo
()
50
{
51
LOG4CPP_INFO_S
((*
mainCat
)) <<
"CmdSelectCoordSystem::cmdRedo"
52
<<
" index="
<< m_coordSystemIndexBefore <<
"->"
<< m_coordSystemIndexAfter;
53
54
saveOrCheckPreCommandDocumentStateHash
(
document
());
55
mainWindow
().
updateCoordSystem
(m_coordSystemIndexAfter);
56
saveOrCheckPostCommandDocumentStateHash
(
document
());
57
}
58
59
void
CmdSelectCoordSystem::cmdUndo
()
60
{
61
LOG4CPP_INFO_S
((*
mainCat
)) <<
"CmdSelectCoordSystem::cmdUndo"
62
<<
" index="
<< m_coordSystemIndexAfter <<
"->"
<< m_coordSystemIndexBefore;
63
64
saveOrCheckPostCommandDocumentStateHash
(
document
());
65
mainWindow
().
updateCoordSystem
(m_coordSystemIndexBefore);
66
saveOrCheckPreCommandDocumentStateHash
(
document
());
67
}
68
69
void
CmdSelectCoordSystem::saveXml
(QXmlStreamWriter &writer)
const
70
{
71
writer.writeStartElement(
DOCUMENT_SERIALIZE_CMD
);
72
writer.writeEndElement();
73
}
CMD_DESCRIPTION
const QString CMD_DESCRIPTION("Select Coordinate System")
CmdSelectCoordSystem.h
CoordSystemIndex
unsigned int CoordSystemIndex
Zero-based index for identifying CoordSystem instantiations.
Definition
CoordSystemIndex.h:11
DataKey.h
DocumentSerialize.h
DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD
Document.h
EngaugeAssert.h
mainCat
log4cpp::Category * mainCat
Definition
Logger.cpp:14
Logger.h
MainWindow.h
QtToString.h
CmdAbstract
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition
CmdAbstract.h:20
CmdAbstract::document
Document & document()
Return the Document that this command will modify during redo and undo.
Definition
CmdAbstract.cpp:35
CmdAbstract::mainWindow
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
Definition
CmdAbstract.cpp:45
CmdAbstract::saveOrCheckPostCommandDocumentStateHash
void saveOrCheckPostCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
Definition
CmdAbstract.cpp:102
CmdAbstract::saveOrCheckPreCommandDocumentStateHash
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
Definition
CmdAbstract.cpp:125
CmdSelectCoordSystem::CmdSelectCoordSystem
CmdSelectCoordSystem(MainWindow &mainWindow, Document &document, CoordSystemIndex coordSystem)
Constructor for normal creation.
Definition
CmdSelectCoordSystem.cpp:22
CmdSelectCoordSystem::cmdUndo
virtual void cmdUndo()
Undo method that is called when QUndoStack is moved one command backward.
Definition
CmdSelectCoordSystem.cpp:59
CmdSelectCoordSystem::~CmdSelectCoordSystem
virtual ~CmdSelectCoordSystem()
Definition
CmdSelectCoordSystem.cpp:45
CmdSelectCoordSystem::cmdRedo
virtual void cmdRedo()
Redo method that is called when QUndoStack is moved one command forward.
Definition
CmdSelectCoordSystem.cpp:49
CmdSelectCoordSystem::saveXml
virtual void saveXml(QXmlStreamWriter &writer) const
Save commands as xml for later uploading.
Definition
CmdSelectCoordSystem.cpp:69
Document
Storage of one imported image and the data attached to that image.
Definition
Document.h:42
MainWindow
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition
MainWindow.h:92
MainWindow::updateCoordSystem
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Definition
MainWindow.cpp:3417
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition
convenience.h:18
Generated on Wed Aug 3 2022 00:00:00 for Engauge Digitizer by
1.10.0