00001
00002
00003
00004
00005
00006
00007 #include "CmdSelectCoordSystem.h"
00008 #include "DataKey.h"
00009 #include "Document.h"
00010 #include "DocumentSerialize.h"
00011 #include "EngaugeAssert.h"
00012 #include "Logger.h"
00013 #include "MainWindow.h"
00014 #include <QApplication>
00015 #include <QClipboard>
00016 #include <QTextStream>
00017 #include "QtToString.h"
00018 #include <QXmlStreamReader>
00019
00020 const QString CMD_DESCRIPTION ("Select Coordinate System");
00021
00022 CmdSelectCoordSystem::CmdSelectCoordSystem(MainWindow &mainWindow,
00023 Document &document,
00024 CoordSystemIndex coordSystemIndex) :
00025 CmdAbstract(mainWindow,
00026 document,
00027 CMD_DESCRIPTION),
00028 m_coordSystemIndexBefore (document.coordSystemIndex()),
00029 m_coordSystemIndexAfter (coordSystemIndex)
00030 {
00031 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
00032 }
00033
00034 CmdSelectCoordSystem::CmdSelectCoordSystem (MainWindow &mainWindow,
00035 Document &document,
00036 const QString &cmdDescription,
00037 QXmlStreamReader & ) :
00038 CmdAbstract (mainWindow,
00039 document,
00040 cmdDescription)
00041 {
00042 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::CmdSelectCoordSystem";
00043 }
00044
00045 CmdSelectCoordSystem::~CmdSelectCoordSystem ()
00046 {
00047 }
00048
00049 void CmdSelectCoordSystem::cmdRedo ()
00050 {
00051 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdRedo"
00052 << " index=" << m_coordSystemIndexBefore << "->" << m_coordSystemIndexAfter;
00053
00054 saveOrCheckPreCommandDocumentStateHash (document ());
00055 mainWindow().updateCoordSystem (m_coordSystemIndexAfter);
00056 saveOrCheckPostCommandDocumentStateHash (document ());
00057 }
00058
00059 void CmdSelectCoordSystem::cmdUndo ()
00060 {
00061 LOG4CPP_INFO_S ((*mainCat)) << "CmdSelectCoordSystem::cmdUndo"
00062 << " index=" << m_coordSystemIndexAfter << "->" << m_coordSystemIndexBefore;
00063
00064 saveOrCheckPostCommandDocumentStateHash (document ());
00065 mainWindow().updateCoordSystem (m_coordSystemIndexBefore);
00066 saveOrCheckPreCommandDocumentStateHash (document ());
00067 }
00068
00069 void CmdSelectCoordSystem::saveXml (QXmlStreamWriter &writer) const
00070 {
00071 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
00072 writer.writeEndElement();
00073 }