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.

110 lines
2.7 KiB
C++

#include "StdAfx.h"
#include "ObjArc.h"
#include "GlobalDrawMgr.h"
#include "DataPoint.h"
#include "GlobalFunction.h"
#include "Propertie.h"
#include "PropertieMgr.h"
#include "CommandModifiCircle.h"
#include "CommandMgr.h"
#include "WorkFileMgr.h"
#include "DrawSimpleShape.h"
CObjArc::CObjArc(void)
{
m_bDir = true;//圆弧的方向
}
CObjArc::~CObjArc(void)
{
}
CString CObjArc::GetStr()
{
CString str = "圆弧";
return str;
}
void CObjArc::Draw(CDC* pDC,CPen &Pen)
{
//圆心点
DrawSolidRect(pDC,gDraw->GetObjFirstNodeColor(),gDraw->GetCurPointRect(m_CenterPt.GetPt()));
CObjBase::Draw(pDC,Pen);
}
void CObjArc::WriteWorkFileExt(vector<CLab> &LabVec)
{
CObjBase::WriteWorkFileExt(LabVec);
Dbxy pt = m_CenterPt.GetPt();
LabVec.push_back(CLab(LAB_OBJ_ARC_CENTER_X,pt.x));
LabVec.push_back(CLab(LAB_OBJ_ARC_CENTER_Y,pt.y));
LabVec.push_back(CLab(LAB_OBJ_ARC_EDGE_CNT,m_EdgeCnt));
LabVec.push_back(CLab(LAB_OBJ_ARC_DIR,m_bDir));
}
void CObjArc::ReadWorkFileExt(CLabVecRang &LabVecRang)
{
CObjBase::ReadWorkFileExt(LabVecRang);
CWorkFileMgr WorkFileMgr;
Dbxy pt;
{
CLab Lab = WorkFileMgr.FindLab(LabVecRang,LAB_OBJ_ARC_CENTER_X);
if(Lab.m_ValType != _TYPE_NULL)
{
pt.x = Lab.m_Double;
}
}
{
CLab Lab = WorkFileMgr.FindLab(LabVecRang,LAB_OBJ_ARC_CENTER_Y);
if(Lab.m_ValType != _TYPE_NULL)
{
pt.y = Lab.m_Double;
}
}
m_CenterPt.SetPt(pt);
{
CLab Lab = WorkFileMgr.FindLab(LabVecRang,LAB_OBJ_ARC_EDGE_CNT);
if(Lab.m_ValType != _TYPE_NULL)
{
m_EdgeCnt = Lab.m_Int;
}
}
{
CLab Lab = WorkFileMgr.FindLab(LabVecRang,LAB_OBJ_ARC_DIR);
if(Lab.m_ValType != _TYPE_NULL)
{
m_bDir = Lab.m_Bool;
}
}
}
//设置圆心点
void CObjArc::SetCenterPt(Dbxy pt)
{
m_CenterPt.SetPt(pt);
}
void CObjArc::Operate(SObjOperatePar &par)
{
m_CenterPt.Operate(par);//圆心点也要操作
CObjBase::Operate(par);
}
//获取加工数据
void CObjArc::GetPtData(vector<vector<Dbxy>> &vec)
{
CObjBase::GetPtData(vec);
//设置圆弧信息
int size = vec.size();
if(size>0)
{
vector<Dbxy> &Vec1 = vec[size-1];
int size1 = Vec1.size();
if(size1>1)
{
for(int k=0;k<size1;k++)
{
Dbxy pt = m_CenterPt.GetPt();
Vec1[k].bArc = true;
Vec1[k].bDir = m_bDir;
Vec1[k].Cx = pt.x;
Vec1[k].Cy = pt.y;
}
}
}
}