|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "ObjComposite.h"
|
|
|
|
|
#include "ObjPline.h"
|
|
|
|
|
#include "GlobalFunction.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CObjComposite::CObjComposite(void)
|
|
|
|
|
{
|
|
|
|
|
m_Distance = 10;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
CObjComposite::~CObjComposite(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
CObjComposite::CObjComposite(CObjComposite &rhs)
|
|
|
|
|
:CObjBase(rhs)
|
|
|
|
|
{
|
|
|
|
|
m_BasePt1 = rhs.m_BasePt1;//<2F><><EFBFBD><EFBFBD>object <20><>ǰ<EFBFBD><C7B0>λ<EFBFBD><CEBB>
|
|
|
|
|
m_BasePt2 = rhs.m_BasePt2;//<2F><><EFBFBD><EFBFBD>object <20><>ǰ<EFBFBD><C7B0>λ<EFBFBD><CEBB>(<28><><EFBFBD>ڼ<EFBFBD>¼<EFBFBD><C2BC>ת)
|
|
|
|
|
m_Distance = rhs.m_Distance;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
|
|
|
|
|
|
|
|
|
|
rhs.m_ObjContainer.CloneObj(m_ObjContainer,false);
|
|
|
|
|
}
|
|
|
|
|
#if 1
|
|
|
|
|
void CObjComposite::WriteWorkFileExt(vector<CLab> &LabVec)
|
|
|
|
|
{
|
|
|
|
|
//д<><D0B4>obj <20><>Ϣ
|
|
|
|
|
m_ObjContainer.WriteWorkFile(LabVec);
|
|
|
|
|
}
|
|
|
|
|
void CObjComposite::ReadWorkFileExt(CLabVecRang &LabVecRang)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ȡobj <20><>Ϣ
|
|
|
|
|
m_ObjContainer.ReadWorkFile(LabVecRang);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
//bNewLine <20><>ʾ<EFBFBD>Ƿ<EFBFBD>Ҫ<EFBFBD>½<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>߶<EFBFBD>
|
|
|
|
|
void CObjComposite::AddPt(CDataPoint pt,bool bNewLine)
|
|
|
|
|
{
|
|
|
|
|
if(bNewLine)
|
|
|
|
|
{
|
|
|
|
|
CObjPline *p = new CObjPline;
|
|
|
|
|
p->AddDataPoint(pt);
|
|
|
|
|
m_ObjContainer.AddObject(p);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.AddPtToLastObj(pt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CObjComposite::Creat()
|
|
|
|
|
{
|
|
|
|
|
CreatExt();
|
|
|
|
|
UpdateSelState();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>obj <20><>ѡ<EFBFBD><D1A1>״̬
|
|
|
|
|
void CObjComposite::UpdateSelState()
|
|
|
|
|
{
|
|
|
|
|
if(m_bSelected)
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.SelAllObj();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.NotSelAllObj();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void CObjComposite::Draw(CDC* pDC,CPen &Pen)
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.DrawAllObj(pDC);
|
|
|
|
|
}
|
|
|
|
|
bool CObjComposite::IsInRect(DbRect rect,bool bNeedAllIn)
|
|
|
|
|
{
|
|
|
|
|
return m_ObjContainer.IsInRect(rect,bNeedAllIn);
|
|
|
|
|
}
|
|
|
|
|
void CObjComposite::SetSelected(bool bSelected)
|
|
|
|
|
{
|
|
|
|
|
CObjBase::SetSelected(bSelected);//ȫ<><C8AB><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>״̬
|
|
|
|
|
|
|
|
|
|
m_ObjContainer.SetSelected(bSelected);//ÿ<><C3BF><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ѡ<EFBFBD><D1A1>״̬
|
|
|
|
|
}
|
|
|
|
|
void CObjComposite::Operate(SObjOperatePar &par)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
SavePar(par);
|
|
|
|
|
m_ObjContainer.Operate(par);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5>Ƿ<EFBFBD><C7B7><EFBFBD>λ
|
|
|
|
|
void CObjComposite::SavePar(SObjOperatePar &par)
|
|
|
|
|
{
|
|
|
|
|
if(par.OpType == _OP_MOVE)
|
|
|
|
|
{
|
|
|
|
|
m_BasePt1.x += par.MoveX;
|
|
|
|
|
m_BasePt1.y += par.MoveY;
|
|
|
|
|
m_BasePt2.x += par.MoveX;
|
|
|
|
|
m_BasePt2.y += par.MoveY;
|
|
|
|
|
}
|
|
|
|
|
if(par.OpType == _OP_ROTATO)
|
|
|
|
|
{
|
|
|
|
|
m_BasePt1 = RotatoPt(m_BasePt1,_360ToAngle(par.Angle),par.BasePt);
|
|
|
|
|
m_BasePt2 = RotatoPt(m_BasePt2,_360ToAngle(par.Angle),par.BasePt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DbRect CObjComposite::GetRect()
|
|
|
|
|
{
|
|
|
|
|
return m_ObjContainer.GetObjRect(false);
|
|
|
|
|
}
|
|
|
|
|
void CObjComposite::SetPosition(Dbxy pt)
|
|
|
|
|
{
|
|
|
|
|
m_BasePt1 = m_BasePt2= pt;
|
|
|
|
|
m_BasePt2.x += m_Distance;
|
|
|
|
|
};
|
|
|
|
|
//ί<>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD>Աȥ<D4B1>Ѽ<EFBFBD>
|
|
|
|
|
void CObjComposite::GetPtData(vector<vector<Dbxy>> &vec)
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.GetObjPtData(vec,false);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡrect <20><>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5>߶<EFBFBD>
|
|
|
|
|
void CObjComposite::GetLineInRect(DbRect &rect,vector<DbLine> &DataPtLineVec,bool bGetCatchNode)
|
|
|
|
|
{
|
|
|
|
|
m_ObjContainer.GetLineInRect(rect,DataPtLineVec,true);
|
|
|
|
|
}
|