|
|
|
|
#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 "Laser.h"
|
|
|
|
|
#include "ApplicationPriority.h"
|
|
|
|
|
#include "WorkAreaMgr.h"
|
|
|
|
|
#include "Ruler.h"
|
|
|
|
|
#include "WorkFileLable.h"
|
|
|
|
|
#include "CStringFuc.h"
|
|
|
|
|
#include "WorkFileMgr.h"
|
|
|
|
|
#include "FileMgr.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();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
if((*iter))
|
|
|
|
|
{
|
|
|
|
|
(*iter)->GetModuleType();
|
|
|
|
|
delete (*iter);
|
|
|
|
|
(*iter) = 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::AllModuleOnAppInitialize()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->OnAppInitialize();
|
|
|
|
|
}
|
|
|
|
|
//GetCurViewPtr()->RefreshView();
|
|
|
|
|
}
|
|
|
|
|
//<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::PropertiesOnAppInitialize()
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CModuleMgr::InsertPropertiesToGrid(set<MODULE> &Set,CMFCPropertyGridCtrl &PropertyGrid)
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
PropertyGrid.AddProperty(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)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
void CModuleMgr::SaveWorkFile(vector<CLab> &LabVec)
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->SaveWorkFile(LabVec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<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::InitPar()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CreatAllModule();
|
|
|
|
|
//<2F><><EFBFBD>鲢<EFBFBD><E9B2A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
CreatModuleDir();
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
PropertiesOnAppInitialize();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
AllModuleOnAppInitialize();
|
|
|
|
|
//Ĭ<><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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CModuleMgr::CreatModuleDir()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
CString DirName = (*iter)->GetParDirName();
|
|
|
|
|
if(DirName != "")
|
|
|
|
|
{
|
|
|
|
|
CString DirPath;
|
|
|
|
|
CString FileName = "\\Parameter\\"+DirName;
|
|
|
|
|
CFileMgr FileMgr;
|
|
|
|
|
FileMgr.GetFullFilePath(DirPath,FileName);
|
|
|
|
|
if(!FileMgr.IsDirectoryExists(DirPath))
|
|
|
|
|
FileMgr.CreatDir(DirPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>Ӧ<EFBFBD>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC>
|
|
|
|
|
void CModuleMgr::OnDeviceInit()
|
|
|
|
|
{
|
|
|
|
|
vector<CModule*>::iterator iter = m_ModuleVec.begin();
|
|
|
|
|
vector<CModule*>::iterator iter_end = m_ModuleVec.end();
|
|
|
|
|
for(;iter!=iter_end;iter++)
|
|
|
|
|
{
|
|
|
|
|
(*iter)->OnDeviceInit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|