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