|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "MainFrm.h"
|
|
|
|
|
#include "ModuleMgr.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "GlobalDrawMgr.h"
|
|
|
|
|
#include "MarkObjPropertieMgr.h"
|
|
|
|
|
#include "GlobalFunction.h"
|
|
|
|
|
#include "PltReader.h"
|
|
|
|
|
#include "PciPortMgr.h"
|
|
|
|
|
#include "PciCh365Mgr.h"
|
|
|
|
|
#include "PlatformXY.h"
|
|
|
|
|
#include "Laser.h"
|
|
|
|
|
#include "Motor.h"
|
|
|
|
|
#include "ApplicationPriority.h"
|
|
|
|
|
#include "WorkAreaMgr.h"
|
|
|
|
|
#include "CameraHawkvis.h"
|
|
|
|
|
#include "GratingRuler.h"
|
|
|
|
|
#include "Ruler.h"
|
|
|
|
|
#include "WorkFileLable.h"
|
|
|
|
|
#include "CStringFuc.h"
|
|
|
|
|
#include "WorkFileMgr.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CModuleMgr::CModuleMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
CModuleMgr::~CModuleMgr(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void CModuleMgr::DeleteAllModule()
|
|
|
|
|
{
|
|
|
|
|
//<2F>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>Դ
|
|
|
|
|
/* vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();*/
|
|
|
|
|
|
|
|
|
|
int cnt = m_ModuleVec.size();
|
|
|
|
|
for (int i=0;i!=cnt;i++)
|
|
|
|
|
{
|
|
|
|
|
if (m_ModuleVec[i]!=nullptr)
|
|
|
|
|
{
|
|
|
|
|
auto & pModuleVec = m_ModuleVec[i];
|
|
|
|
|
m_ModuleVec[i]->GetModuleType();
|
|
|
|
|
delete m_ModuleVec[i];
|
|
|
|
|
m_ModuleVec[i] = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><>¼<EFBFBD><C2BC><EFBFBD>е<EFBFBD>module <20><><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CModuleMgr::SaveAllModuleProperty()
|
|
|
|
|
{
|
|
|
|
|
gDevicePropertieMgr.SetSaveAllPropertie(true);
|
|
|
|
|
gDrawPropertieMgr.SetSaveAllPropertie(true);
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CMFCPropertyGridProperty* pProp = (*iter)->CreatGridProperty();
|
|
|
|
|
if(pProp)
|
|
|
|
|
{
|
|
|
|
|
delete pProp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gDevicePropertieMgr.SetSaveAllPropertie(false);
|
|
|
|
|
gDrawPropertieMgr.SetSaveAllPropertie(false);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
void CModuleMgr::AllModuleIni()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->Ini();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ
|
|
|
|
|
void CModuleMgr::PropertiesIni()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CMFCPropertyGridProperty* pProp = (*iter)->CreatGridProperty();//ģ<><C4A3><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><F0B4B4BD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(pProp)
|
|
|
|
|
{
|
|
|
|
|
delete pProp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>wnd
|
|
|
|
|
void CModuleMgr::InsertPropertiesToWnd(set<MODULE> &Set,CPanePropertiesWnd &Wnd)
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if(Set.count((*iter)->GetModuleType()))
|
|
|
|
|
{
|
|
|
|
|
CMFCPropertyGridProperty* pProp = (*iter)->CreatGridProperty();//ģ<><C4A3><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><F0B4B4BD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(pProp)
|
|
|
|
|
{
|
|
|
|
|
Wnd.InsertGridProperty(pProp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
void CModuleMgr::ExportDevicePar(ofstream *pFile)
|
|
|
|
|
{
|
|
|
|
|
if(pFile)
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->ExportPar(pFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ҵ<EFBFBD><D2B5><EFBFBD>Ӧ<EFBFBD>Ķ<EFBFBD>ȡģ<C8A1><C4A3>
|
|
|
|
|
bool CModuleMgr::ReadWorkFile(CLabVecRang &LabVecRang)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ȡģ<C8A1><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CWorkFileMgr WorkFileMgr;
|
|
|
|
|
CLab StartLab = WorkFileMgr.FindLab(LabVecRang,LAB_MODULE_TYPE);
|
|
|
|
|
if(StartLab.m_ValType == _TYPE_NULL)
|
|
|
|
|
return false;
|
|
|
|
|
MODULE ModuleType = (MODULE)(StartLab.m_Int);
|
|
|
|
|
//<2F>ָ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ģ<EFBFBD>鴦<EFBFBD><E9B4A6>
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if((*iter)->GetModuleType()==ModuleType)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->ReadWorkFile(LabVecRang);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>
|
|
|
|
|
void CModuleMgr::Ini()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CreatAllModule();
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PropertiesIni();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
AllModuleIni();
|
|
|
|
|
//Ĭ<><C4AC>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
InsertModuleGridProperty(_COMB_OBJ_PROP);
|
|
|
|
|
}
|
|
|
|
|
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>һЩ<D2BB>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CModuleMgr::Draw(CDC* pDC)
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->Draw(pDC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
void CModuleMgr::OnWorkStart()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->OnWorkStart();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CModuleMgr::OnWorkEnd()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->OnWorkEnd();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CModuleMgr::OnExitApp()
|
|
|
|
|
{
|
|
|
|
|
gExitApp = true;
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->OnExitApp();
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ʱ<EFBFBD>ȴ<EFBFBD><C8B4>߳̽<DFB3><CCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⱨ<EFBFBD><E2B1A8>
|
|
|
|
|
Sleep(2000);
|
|
|
|
|
}
|
|
|
|
|
#endif
|