00001
00002
00003
00004
00005
00006
00007 #include "CmdPointChangeBase.h"
00008 #include "Curve.h"
00009 #include "CurvesGraphs.h"
00010 #include "Document.h"
00011 #include "EngaugeAssert.h"
00012 #include "Logger.h"
00013
00014 CmdPointChangeBase::CmdPointChangeBase(MainWindow &mainWindow,
00015 Document &document,
00016 const QString &cmdDescription) :
00017 CmdAbstract (mainWindow,
00018 document,
00019 cmdDescription),
00020 m_curveAxes (0),
00021 m_curvesGraphs (0)
00022 {
00023 LOG4CPP_INFO_S ((*mainCat)) << "CmdPointChangeBase::CmdPointChangeBase";
00024 }
00025
00026 CmdPointChangeBase::~CmdPointChangeBase()
00027 {
00028 }
00029
00030 void CmdPointChangeBase::restoreDocumentState (Document &document) const
00031 {
00032 LOG4CPP_INFO_S ((*mainCat)) << "CmdPointChangeBase::restoreDocumentState";
00033
00034 ENGAUGE_ASSERT (m_curveAxes != 0);
00035 ENGAUGE_ASSERT (m_curvesGraphs != 0);
00036
00037 document.setCurveAxes (*m_curveAxes);
00038 document.setCurvesGraphs (*m_curvesGraphs);
00039 }
00040
00041 void CmdPointChangeBase::saveDocumentState (const Document &document)
00042 {
00043 LOG4CPP_INFO_S ((*mainCat)) << "CmdPointChangeBase::saveDocumentState";
00044
00045 if (m_curveAxes != 0) {
00046 delete m_curveAxes;
00047 m_curveAxes = 0;
00048 }
00049
00050 if (m_curvesGraphs != 0) {
00051 delete m_curvesGraphs;
00052 m_curvesGraphs = 0;
00053 }
00054
00055 m_curveAxes = new Curve (document.curveAxes());
00056 m_curvesGraphs = new CurvesGraphs (document.curvesGraphs());
00057 }