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++
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;//笔的颜色
|
|
m_bSelected = false;//是否被选中
|
|
CreatParVec();
|
|
}
|
|
CPenPar::~CPenPar(void)
|
|
{
|
|
}
|
|
CPenPar CPenPar::operator =(CPenPar rls)
|
|
{
|
|
//不要设置选择颜色
|
|
m_ParVec = rls.m_ParVec;
|
|
m_bSelected = rls.m_bSelected;//是否被选中
|
|
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]));
|
|
}
|
|
//选择状态
|
|
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;
|
|
//选择状态
|
|
{
|
|
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;
|
|
} |