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.
204 lines
8.3 KiB
C++
204 lines
8.3 KiB
C++
#include "StdAfx.h"
|
|
#include "Mirror.h"
|
|
#include "Propertie.h"
|
|
#include "PropertieMgr.h"
|
|
#include "AuthorityMgr.h"
|
|
#include "GlobalFunction.h"
|
|
#include "LogMgr.h"
|
|
|
|
|
|
|
|
CMirror *gMirror = new CMirror;
|
|
CMirror::CMirror(void)
|
|
{
|
|
m_MirrorStep = 1;
|
|
m_bUsePciCard = true;//使用pci 卡还是拖机卡true 为pci 卡
|
|
m_LaserSwitch = false;//激光是否反向
|
|
m_LaserType = 3;//激光器类型
|
|
m_CheckDataArea = false;//是否检查数据范围
|
|
}
|
|
CMirror::~CMirror(void)
|
|
{
|
|
}
|
|
#if 1//复写module 的函数
|
|
CMFCPropertyGridProperty *CMirror::CreatGridProperty()
|
|
{
|
|
CString PropertyName;//属性名称
|
|
CString Description;//描述
|
|
CString Path = _T("Mirror");//存储路径
|
|
CString Name;
|
|
//-------------------------------------------------------------------------------//
|
|
PropertyName = _T("振镜");
|
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
|
//-------------------------------------------------------------------------------//
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
|
{
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_MirrorRange_w");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_MirrorRange.w);
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("振镜范围宽");
|
|
Description = _T("振镜的工作范围(单位:mm)");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MirrorRange.w, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_MirrorRange_h");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_MirrorRange.h);
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("振镜范围高");
|
|
Description = _T("振镜的工作范围(单位:mm)");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MirrorRange.h, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_MirrorStep");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_MirrorStep);
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("振镜步长");
|
|
Description = _T("用于控制振镜数据尺寸的比例值");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MirrorStep, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_bUsePciCard");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_bUsePciCard);
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("pci 卡控制");
|
|
Description = _T("true 表示pci卡控制,false 表示脱机卡控制");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bUsePciCard, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_CheckDataArea");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_CheckDataArea);
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("检查范围");
|
|
Description = _T("是否检查数据范围在设置的尺寸内");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_CheckDataArea, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_LaserSwitch");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_LaserSwitch);
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("激光反向");
|
|
Description = _T("激光控制端口是否反向");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_LaserSwitch, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_LaserType");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_LaserType);
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("激光器类型");
|
|
Description = _T("激光器的类型");
|
|
CMFCPropertyGridProperty* p = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_LaserType, Description);
|
|
pGroup->AddSubItem(p);
|
|
|
|
gDevicePropertieMgr.Insert(p, pPropertie);
|
|
}
|
|
}
|
|
return pGroup;
|
|
}
|
|
void CMirror::ExportPar(ofstream *pFile)
|
|
{
|
|
(*pFile)<<"[模块] [CMirror]------------------------------------------------"<<endl;
|
|
(*pFile)<<"[振镜步长][m_MirrorStep] = "<<m_MirrorStep<<endl;
|
|
}
|
|
//检查数据是否在振镜范围内
|
|
bool CMirror::CheckDataInMirrorArea( vector<vector<Dbxy>>& m_DataVec)
|
|
{
|
|
if(!m_CheckDataArea)
|
|
return true;
|
|
DbRect rect(Dbxy(0,0),m_MirrorRange);
|
|
vector<vector<Dbxy>>::iterator iter = m_DataVec.begin();
|
|
vector<vector<Dbxy>>::iterator iter_end = m_DataVec.end();
|
|
for(;iter!=iter_end;iter++)
|
|
{
|
|
vector<Dbxy>::iterator iter1 = (*iter).begin();
|
|
vector<Dbxy>::iterator iter1_end = (*iter).end();
|
|
for(;iter1!=iter1_end;iter1++)
|
|
{
|
|
if(!IsPointInRect((*iter1),rect))
|
|
{
|
|
CString LogStr;
|
|
LogStr.Format(_T("[ptX] = [%f] ,[ptY] = [%f]"),(*iter1).x,(*iter1).y);
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
#endif
|
|
|