|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "TemplateMgr.h"
|
|
|
|
|
#include "Layer.h"
|
|
|
|
|
#include "Propertie.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "AuthorityMgr.h"
|
|
|
|
|
#include "WorkFileLable.h"
|
|
|
|
|
#include "WorkFileMgr.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "GlobalDrawMgr.h"
|
|
|
|
|
|
|
|
|
|
#define MaxTempCnt 200 //<2F>ɱ༭ģ<E0BCAD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
#define NULL_IDX -1//<2F>ж<EFBFBD><D0B6>ް<EFBFBD><DEB0><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
CTemplateMgr *gTemplateMgr = new CTemplateMgr;
|
|
|
|
|
CTemplateMgr::CTemplateMgr(void)
|
|
|
|
|
{
|
|
|
|
|
m_bUseObjList = false;//<2F>Ƿ<EFBFBD>ʹ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>б<EFBFBD>
|
|
|
|
|
m_bClearOldObj = true;//<2F><>ȡ<EFBFBD>ļ<EFBFBD>ʱ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>obj <20><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
CTemplateMgr::~CTemplateMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#if 1//<2F><>дmodule <20>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
CMFCPropertyGridProperty *CTemplateMgr::CreatGridProperty()
|
|
|
|
|
{
|
|
|
|
|
CPropertieMgr &PropertieMgr = gDevicePropertieMgr;
|
|
|
|
|
|
|
|
|
|
CString PropertyName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CString Description;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
CString Path = _T("Template");//<2F>洢·<E6B4A2><C2B7>
|
|
|
|
|
CString Name;
|
|
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
|
|
PropertyName = _T("ģ<EFBFBD><EFBFBD><EFBFBD>趨");
|
|
|
|
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
|
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
|
|
{
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>");
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_Authority_Operator))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_bUseObjList");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_bUseObjList);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bUseObjList, Description);
|
|
|
|
|
pGroup->AddSubItem(p);
|
|
|
|
|
|
|
|
|
|
PropertieMgr.Insert(p, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return pGroup;
|
|
|
|
|
}
|
|
|
|
|
void CTemplateMgr::OnAppInitialize()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_TempVec.clear();
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(int i=0;i<MaxTempCnt;i++)
|
|
|
|
|
{
|
|
|
|
|
CTemplate Temp;
|
|
|
|
|
m_TempVec.push_back(Temp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>ģ<EFBFBD>嵽layer
|
|
|
|
|
ClearTempNull();
|
|
|
|
|
BindNullTemp();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
void CTemplateMgr::WriteWorkFileExt(vector<CLab> &LabVec)
|
|
|
|
|
{
|
|
|
|
|
for(int i=0;i<MaxTempCnt;i++)
|
|
|
|
|
{
|
|
|
|
|
LabVec.push_back(CLab(LAB_TEMPLATE_START));
|
|
|
|
|
m_TempVec[i].WriteWorkFile(LabVec);
|
|
|
|
|
LabVec.push_back(CLab(LAB_TEMPLATE_END));
|
|
|
|
|
}
|
|
|
|
|
//д<><D0B4><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
LabVec.push_back(CLab(LAB_TEMPLATE_START));
|
|
|
|
|
m_TempNull.WriteWorkFile(LabVec);
|
|
|
|
|
LabVec.push_back(CLab(LAB_TEMPLATE_END));
|
|
|
|
|
}
|
|
|
|
|
void CTemplateMgr::ReadWorkFile(CLabVecRang &LabVecRang)
|
|
|
|
|
{
|
|
|
|
|
if(IsbClearOldObj())
|
|
|
|
|
{
|
|
|
|
|
ClearTempNull();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>---------------------------------------------------
|
|
|
|
|
vector<CLabVecRang> LabVecRangVec;
|
|
|
|
|
CWorkFileMgr WorkFileMgr;
|
|
|
|
|
WorkFileMgr.SeparateStrVec(LabVecRang,LabVecRangVec,LAB_TEMPLATE_START,LAB_TEMPLATE_END);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ģ<EFBFBD><C4A3>
|
|
|
|
|
if(!LabVecRangVec.empty())
|
|
|
|
|
{
|
|
|
|
|
size_t size = LabVecRangVec.size();
|
|
|
|
|
for(size_t i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
if(i==size-1)
|
|
|
|
|
{
|
|
|
|
|
m_TempNull.ReadWorkFile(LabVecRangVec[i]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_TempVec[i].ReadWorkFile(LabVecRangVec[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
BindNullTemp();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void CTemplateMgr::ClearTempNull()
|
|
|
|
|
{
|
|
|
|
|
m_TempNull.ClearObj();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>ģ<EFBFBD>嵽layer
|
|
|
|
|
void CTemplateMgr::BindNullTemp()
|
|
|
|
|
{
|
|
|
|
|
m_CurTempIdx = NULL_IDX;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
BindCurTemp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><EFBFBD>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
void CTemplateMgr::BindCurTemp()
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ǰģ<C7B0><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊlayer <20>༭ģ<E0BCAD><C4A3>
|
|
|
|
|
CLayer &Layer = gLayer;
|
|
|
|
|
|
|
|
|
|
//û<><C3BB>Ҫ<EFBFBD>༭<EFBFBD><E0BCAD>ģ<EFBFBD><C4A3>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ģ<EFBFBD>嵽layer
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>
|
|
|
|
|
if(m_CurTempIdx==NULL_IDX)
|
|
|
|
|
{
|
|
|
|
|
Layer.BindObjContainer(m_TempNull.GetObjContainer());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Layer.BindObjContainer(m_TempVec[m_CurTempIdx].GetObjContainer());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ָ<><D6B8>Ҫ<EFBFBD>༭<EFBFBD><E0BCAD>ģ<EFBFBD><C4A3>
|
|
|
|
|
void CTemplateMgr::EditTemp(int idx)
|
|
|
|
|
{
|
|
|
|
|
if(idx>=0&&idx<MaxTempCnt)
|
|
|
|
|
{
|
|
|
|
|
m_CurTempIdx = idx;
|
|
|
|
|
ClearTempNull();
|
|
|
|
|
BindCurTemp();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CTemplateMgr::Draw(CDC* pDC)
|
|
|
|
|
{
|
|
|
|
|
if(m_CurTempIdx != NULL_IDX)
|
|
|
|
|
m_TempVec[m_CurTempIdx].Draw(pDC,gDraw->GetTempRectPen());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>ģ<EFBFBD><C4A3><EFBFBD>ķ<EFBFBD>Χ(bCircle <20><>ʾ<EFBFBD>Ƿ<EFBFBD>ΪԲ<CEAA><D4B2>)
|
|
|
|
|
void CTemplateMgr::SetTempRect(int idx,DbRect &rect,bool bCircle)
|
|
|
|
|
{
|
|
|
|
|
if(idx>=0&&idx<MaxTempCnt)
|
|
|
|
|
{
|
|
|
|
|
m_TempVec[idx].SetRect(rect,bCircle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ռ<EFBFBD>ָ<EFBFBD><D6B8>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BasePt <20><>ת<EFBFBD><D7AA><EFBFBD>Ļ<EFBFBD><EFBFBD><D7BC>
|
|
|
|
|
void CTemplateMgr::CollectWorkData(int idx,vector<vector<Dbxy>> &vec)
|
|
|
|
|
{
|
|
|
|
|
if(idx>=0&&idx<MaxTempCnt)
|
|
|
|
|
{
|
|
|
|
|
m_TempVec[idx].CollectWorkData(vec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡ0 <20><>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ObjContainer
|
|
|
|
|
CObjContainer &CTemplateMgr::GetTemplateZeroObjContainer()
|
|
|
|
|
{
|
|
|
|
|
return m_TempVec[0].GetObjContainer();
|
|
|
|
|
}
|