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.
68 lines
2.1 KiB
C++
68 lines
2.1 KiB
C++
#include "StdAfx.h"
|
|
#include "SimulateTrace.h"
|
|
#include "Propertie.h"
|
|
#include "PropertieMgr.h"
|
|
#include "GlobalFunction.h"
|
|
#include "MsgBox.h"
|
|
#include "AuthorityMgr.h"
|
|
|
|
CSimulateTrace *gSimulateTrace = new CSimulateTrace;
|
|
CSimulateTrace::CSimulateTrace(void)
|
|
{
|
|
m_bSimulate = false;//是否模拟
|
|
m_Delay = 10;//模拟延时
|
|
}
|
|
CSimulateTrace::~CSimulateTrace(void)
|
|
{
|
|
}
|
|
CMFCPropertyGridProperty *CSimulateTrace::CreatGridProperty()
|
|
{
|
|
CString PropertyName;//属性名称
|
|
CString Description;//描述
|
|
CString Path = _T("Simulate");;//存储路径
|
|
CString Name;
|
|
//-------------------------------------------------------------------------------//
|
|
PropertyName = _T("轨迹模拟");
|
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
|
//-------------------------------------------------------------------------------//
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
|
{
|
|
//添加属性变量映射
|
|
Name = _T("m_Delay");//变量名字
|
|
CPropertie *pPropertie = new CPropertie;
|
|
pPropertie->SetpVal((void*)&m_Delay);
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
pPropertie->SetpModule(this);
|
|
pPropertie->SetPath(Path);
|
|
pPropertie->SetName(Name);
|
|
pPropertie->WriteRead(true);//读取保存的属性
|
|
|
|
//添加属性显示
|
|
PropertyName = _T("模拟延时");
|
|
Description = _T("延时越短,模拟速度越快(单位: 毫秒)");
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_Delay, Description);
|
|
pGroup->AddSubItem(p1);
|
|
|
|
gDrawPropertieMgr.Insert(p1, pPropertie);
|
|
}
|
|
//-------------------------------------------------------------------------------//
|
|
return pGroup;
|
|
}
|
|
|
|
void CSimulateTrace::Delay()
|
|
{
|
|
if(m_bSimulate)
|
|
{
|
|
if(IsShiftKeyDown())//通过shift 键来停止
|
|
{
|
|
CMsgBox MsgBox;
|
|
if(MsgBox.ConfirmOkCancel("结束?"))
|
|
{
|
|
Switch(false);
|
|
return;
|
|
}
|
|
}
|
|
int times = m_Delay*100000;
|
|
for(int i=0;i<times;i++);
|
|
}
|
|
} |