123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- // SEMStageData.cpp : implementation file
- //
- #include "stdafx.h"
- #include "SEMStageData.h"
- // CSEMStageData
- namespace OTSDATA
- {
-
- CSEMStageData::CSEMStageData()
- {
- Init();
- }
- // copy constructor
- CSEMStageData::CSEMStageData(const CSEMStageData& a_oSource)
- {
- // can't copy itself
- if (&a_oSource == this)
- {
- return;
- }
- // copy data over
- Duplicate(a_oSource);
- }
- // copy constructor
- CSEMStageData::CSEMStageData(CSEMStageData* a_poSource)
- {
- // input check
- ASSERT(a_poSource);
- if (!a_poSource)
- {
- return;
- }
- // can't copy itself
- if (a_poSource == this)
- {
- return;
- }
- // copy data over
- Duplicate(*a_poSource);
- }
- // =operator
- CSEMStageData& CSEMStageData::operator=(const CSEMStageData& a_oSource)
- {
- // cleanup
- Cleanup();
- // copy the class data over
- Duplicate(a_oSource);
- // return class
- return *this;
- }
- // ==operator
- BOOL CSEMStageData::operator==(const CSEMStageData& a_oSource)
- {
- // return test result
- return m_nScanFieldSize100 == a_oSource.m_nScanFieldSize100 &&
- *(m_oXAxis.get()) == *(a_oSource.m_oXAxis.get()) &&
- *(m_oYAxis.get()) == *(a_oSource.m_oYAxis.get()) &&
- m_bXAxisDir == a_oSource.m_bXAxisDir &&
- m_bYAxisDir == a_oSource.m_bYAxisDir &&
- m_dMinMag == a_oSource.m_dMinMag;
- }
- // detractor
- CSEMStageData::~CSEMStageData()
- {
- Cleanup();
- }
- // CSEMStageData member functions
- // serialization
-
- void CSEMStageData::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
- {
- xmls::xInt xscanFieldSize100;
- xmls::xInt xbXAxisDir;
- xmls::xInt xbYAxisDir;
- xmls::xDouble xMinMag;
- xmls::Slo slo;
- //Slo::Clear();
- slo.Register("scanFieldSize", &xscanFieldSize100);
- slo.Register("xAxisDir", &xbXAxisDir);
- slo.Register("yAxisDir", &xbYAxisDir);
- slo.Register("MinMag", &xMinMag);
- slo.Register("XAxis", m_oXAxis.get());
- slo.Register("YAxis", m_oYAxis.get());
- if (isStoring)
- {
- xscanFieldSize100 = m_nScanFieldSize100;
- xbXAxisDir = (int)m_bXAxisDir;
- xbYAxisDir = (int)m_bYAxisDir;
- xMinMag = m_dMinMag;
- slo.Serialize(true, classDoc, rootNode);
- }
- else
- {
- slo.Serialize(false, classDoc, rootNode);
- m_nScanFieldSize100 = xscanFieldSize100.value();
- m_bXAxisDir = (OTS_X_AXIS_DIRECTION)xbXAxisDir.value();
- m_bYAxisDir = (OTS_Y_AXIS_DIRECTION)xbYAxisDir.value();
- m_dMinMag = xMinMag.value();
- }
- }
- // cleanup
- void CSEMStageData::Cleanup()
- {
- // nothing needs to be done at the moment
- }
- // initialization
- void CSEMStageData::Init()
- {
- m_nScanFieldSize100 = 0;
- m_bXAxisDir = OTS_X_AXIS_DIRECTION::LEFT_TOWARD;
- m_bYAxisDir = OTS_Y_AXIS_DIRECTION::UP_TOWARD;
- m_oXAxis = CIntRangePtr(new CIntRange(0, 0));
- m_oYAxis = CIntRangePtr(new CIntRange(0, 0));
- m_dMinMag = MAGNIFICATION_MIN;
- }
- // duplication
- void CSEMStageData::Duplicate(const CSEMStageData& a_oSource)
- {
- // initialization
- Init();
- // copy data over
- m_nScanFieldSize100 = a_oSource.m_nScanFieldSize100;
- m_bXAxisDir = a_oSource.m_bXAxisDir;
- m_bYAxisDir = a_oSource.m_bYAxisDir;
- m_oXAxis = a_oSource.m_oXAxis;
- m_oYAxis = a_oSource.m_oYAxis;
- m_dMinMag = a_oSource.m_dMinMag;
- }
- }
|