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.

48 lines
982 B
C++

#include "StdAfx.h"
#include "CommandModifiCircle.h"
#include "ObjCircle.h"
CCommandModifiCircle::CCommandModifiCircle(void)
{
}
CCommandModifiCircle::~CCommandModifiCircle(void)
{
}
//b 为true 时设置旧参数
void CCommandModifiCircle::SetPar(double Radius,int EdgeCnt,bool b)
{
if(b)
{
m_OldRadius = Radius;//半径
m_OldEdgeCnt = EdgeCnt;//边数
}
else
{
m_Radius = Radius;//半径
m_EdgeCnt = EdgeCnt;//边数
}
}
void CCommandModifiCircle::ExcuteExt()
{
ReCreatObj(true);
}
void CCommandModifiCircle::UndoExt()
{
ReCreatObj(false);
}
void CCommandModifiCircle::ReCreatObj(bool bExcute)
{
CObjBase *pBase = m_ObjContainer.GetCurOpObj();
if(pBase)
{
CObjCircle *p = dynamic_cast<CObjCircle*>(pBase);
if(bExcute)
{
p->ReCreat(m_Radius,m_EdgeCnt);
}
else
{
p->ReCreat(m_OldRadius,m_OldEdgeCnt);
}
}
}