#include "StdAfx.h" #include "WorkAreaMgr.h" #include "GlobalFunction.h" #include "Propertie.h" #include "PropertieMgr.h" #include "DrawSimpleShape.h" #include "AuthorityMgr.h" #include "MsgBox.h" #include "LogMgr.h" CWorkAreaMgr *gWorkAreaMgr = new CWorkAreaMgr; CWorkAreaMgr::CWorkAreaMgr(void) { m_bDrawWorkArea = true;//是否绘制工作区域 m_WorkRectColor = RGB_RED; //工作区域方框颜色 m_WorkRectSize.w = 100;//工作区域方框尺寸(mm) m_WorkRectSize.h = 100;//工作区域方框尺寸(mm) RefrashWorkArea(); } CWorkAreaMgr::~CWorkAreaMgr(void) { } #if 1 CMFCPropertyGridProperty *CWorkAreaMgr::CreatGridProperty() { CString PropertyName;//属性名称 CString Description;//描述 CString Path = _T("WorkArea");//存储路径 CString Name; //-------------------------------------------------------------------------------// PropertyName = _T("工作范围"); CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName); //-------------------------------------------------------------------------------// if(gAuthorityMgr->CheckAuthority(_FACTORY)) { { //添加属性变量映射 Name = _T("m_bDrawWorkArea");//变量名字 CPropertie *pPropertie = new CPropertie; pPropertie->SetpVal((void*)&m_bDrawWorkArea); pPropertie->SetType(_PROP_TYPE_BOOL); pPropertie->SetpModule(this); pPropertie->SetPath(Path); pPropertie->SetName(Name); pPropertie->WriteRead(true);//读取保存的属性 //添加属性显示 PropertyName = _T("显示工作范围"); Description = _T("是否显示工作范围,工作数据需要在工作范围之内"); CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bDrawWorkArea, Description); pGroup->AddSubItem(p1); gDevicePropertieMgr.Insert(p1, pPropertie); } //-------------------------------------------------------------------------------// { //添加属性变量映射 Name = _T("m_WorkRectColor");//变量名字 CPropertie *pPropertie = new CPropertie; pPropertie->SetpVal((void*)&m_WorkRectColor); pPropertie->SetType(_PROP_TYPE_COLOR); pPropertie->SetpModule(this); pPropertie->SetPath(Path); pPropertie->SetName(Name); pPropertie->WriteRead(true);//读取保存的属性 //添加属性显示 PropertyName = _T("范围边框颜色"); Description = _T("工作范围边框的颜色"); CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WorkRectColor, NULL, Description); p1->EnableOtherButton(_T("其他...")); p1->EnableAutomaticButton(_T("默认"),RGB_BLACK); pGroup->AddSubItem(p1); gDevicePropertieMgr.Insert(p1, pPropertie); } //-------------------------------------------------------------------------------// { //添加属性变量映射 Name = _T("m_WorkRectSize_w");//变量名字 CPropertie *pPropertie = new CPropertie; pPropertie->SetpVal((void*)&m_WorkRectSize.w); pPropertie->SetType(_PROP_TYPE_DOUBLE); pPropertie->SetpModule(this); pPropertie->SetPath(Path); pPropertie->SetName(Name); pPropertie->WriteRead(true);//读取保存的属性 //添加属性显示 PropertyName = _T("宽度"); Description = _T("工作范围的宽度(单位:mm)"); CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_WorkRectSize.w, Description); pGroup->AddSubItem(p1); gDevicePropertieMgr.Insert(p1, pPropertie); } //-------------------------------------------------------------------------------// { //添加属性变量映射 Name = _T("m_WorkRectSize_h");//变量名字 CPropertie *pPropertie = new CPropertie; pPropertie->SetpVal((void*)&m_WorkRectSize.h); pPropertie->SetType(_PROP_TYPE_DOUBLE); pPropertie->SetpModule(this); pPropertie->SetPath(Path); pPropertie->SetName(Name); pPropertie->WriteRead(true);//读取保存的属性 //添加属性显示 PropertyName = _T("高度"); Description = _T("工作范围的高度(单位:mm)"); CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_WorkRectSize.h, Description); pGroup->AddSubItem(p1); gDevicePropertieMgr.Insert(p1, pPropertie); } //-------------------------------------------------------------------------------// { //添加属性变量映射 Name = _T("m_CenterPt_x");//变量名字 CPropertie *pPropertie = new CPropertie; pPropertie->SetpVal((void*)&m_CenterPt.x); pPropertie->SetType(_PROP_TYPE_DOUBLE); pPropertie->SetpModule(this); pPropertie->SetPath(Path); pPropertie->SetName(Name); pPropertie->WriteRead(true);//读取保存的属性 //添加属性显示 PropertyName = _T("中心点坐标x"); Description = _T("工作范围的中心点坐标x(单位:mm)"); CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_CenterPt.x, Description); pGroup->AddSubItem(p1); gDevicePropertieMgr.Insert(p1, pPropertie); } //-------------------------------------------------------------------------------// { //添加属性变量映射 Name = _T("m_CenterPt_y");//变量名字 CPropertie *pPropertie = new CPropertie; pPropertie->SetpVal((void*)&m_CenterPt.y); pPropertie->SetType(_PROP_TYPE_DOUBLE); pPropertie->SetpModule(this); pPropertie->SetPath(Path); pPropertie->SetName(Name); pPropertie->WriteRead(true);//读取保存的属性 //添加属性显示 PropertyName = _T("中心点坐标y"); Description = _T("工作范围的中心点坐标x(单位:mm)"); CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_CenterPt.y, Description); pGroup->AddSubItem(p1); gDevicePropertieMgr.Insert(p1, pPropertie); } } //-------------------------------------------------------------------------------// return pGroup; } void CWorkAreaMgr::Ini() { RefrashWorkArea(); } void CWorkAreaMgr::ExportPar(ofstream *pFile) { (*pFile)<<"[模块] [CWorkAreaMgr]------------------------------------------------"<WriteDebugLog("数据检查OK"); return true; } #endif