You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.8 KiB
C++

#include "StdAfx.h"
#include "PenPar.h"
#include "GlobalDefine.h"
#include "WorkFileMgr.h"
CPenPar::CPenPar(void)
{
m_color = RGB_GRAY;//<2F>ʵ<EFBFBD><CAB5><EFBFBD>ɫ
m_bSelected = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ѡ<EFBFBD><D1A1>
CreatParVec();
}
CPenPar::~CPenPar(void)
{
}
CPenPar CPenPar::operator =(CPenPar rls)
{
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ɫ
m_ParVec = rls.m_ParVec;
m_bSelected = rls.m_bSelected;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ѡ<EFBFBD><D1A1>
return *this;
}
void CPenPar::Serialize(CArchive &ar)
{
if(ar.IsStoring())
{
for(int i=0;i<VAR_PAR_CNT;i++)
{
ar<<m_ParVec[i];
}
}
else
{
for(int i=0;i<VAR_PAR_CNT;i++)
{
ar>>m_ParVec[i];
}
}
}
void CPenPar::WriteWorkFile(vector<CLab> &LabVec)
{
for(int i=0;i<VAR_PAR_CNT;i++)
{
LabVec.push_back(CLab(LAB_NULL,m_ParVec[i]));
}
//ѡ<><D1A1>״̬
LabVec.push_back(CLab(LAB_RCD_PEN_SEL_STATE,m_bSelected));
}
void CPenPar::ReadWorkFile(CLabVecRang &LabVecRang)
{
int idx = LabVecRang.GetStart();
for(int i=0;i<VAR_PAR_CNT;i++)
{
m_ParVec[i] = LabVecRang.GetDouble(idx++);
}
CWorkFileMgr WorkFileMgr;
//ѡ<><D1A1>״̬
{
CLab Lab = WorkFileMgr.FindLab(LabVecRang,LAB_RCD_PEN_SEL_STATE);
if(Lab.m_ValType != _TYPE_NULL)
{
m_bSelected = Lab.m_Bool;
}
}
}
void CPenPar::CreatParVec()
{
m_ParVec.clear();
for(int i=0;i<VAR_PAR_CNT;i++)
{
m_ParVec.push_back(0);
}
}
double CPenPar::GetParByIdx(int idx)
{
int size = m_ParVec.size();
if(idx>=0 && idx<size)
return m_ParVec[idx];
return 0;
}
void CPenPar::SetParByIdx(int idx,double val)
{
int size = m_ParVec.size();
if(idx>=0 && idx<size)
m_ParVec[idx] = val;
}