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.

65 lines
2.2 KiB
C++

#pragma once
#include "GlobalDefine.h"
#include "ObjContainer.h"
#include "WorkData.h"
#include "SmartPtr.h"
#include "ObjComponent.h"
class CProduct;
//标刻区域
class CMarkArea
{
public:
CMarkArea();
CMarkArea(Dbxy pt,DbSize size);
~CMarkArea(void);
void Serialize(CArchive& ar);
void WriteWorkFile(vector<CLab> &LabVec);
void ReadWorkFile(CLabVecRang &LabVecRang);
void Draw(CDC* pDC,bool bSel);
DbRect GetRect();
Dbxy GetBasePt(){return m_BasePt;};
void SetBasePt(Dbxy pt);
DbSize GetSize(){return m_Size;};
void CollectWorkData(bool bNeedSel);
bool HasWorkData();
vector<vector<Dbxy>> &GetDataVec(){return m_WorkData.GetDataVec();};
CWorkData &GetWorkData(){return m_WorkData;};
void SetSelState(bool b){m_bSel = b;};
bool IsSelected(){return m_bSel;};
bool IsPtInArea(Dbxy pt);
void UpdateSize();
void AdjustByObj();
Dbxy GetRealBasePt();//获取实际中心位置
void SetRealBasePt(Dbxy pt){m_RealBasePt = pt;};
int GetAreaIdx(){return m_AreaIdx;};
void SetAreaIdx(int n){m_AreaIdx = n;};
int GetAreaPenNum(){return m_AreaPenNum;};
private:
void CollectLayerObjExt(CObjContainer &ObjContainer,bool bNeedSel);
void CollectComponentObj(vector<vector<Dbxy>> &vec,bool bNeedSel);
bool DrawObjComponentVec(vector<Sptr<CObjComponent>> &vec,CDC* pDC,bool bSel);
void CollectObjExt(Sptr<CObjComponent> &pObj,DbRect &rect);
void ResetObjCollectState();
void Init();
private:
Dbxy m_BasePt;//区域的基准点(理论中心点)
Dbxy m_RealBasePt;//根据area 内的数据中心调整的基准点,用于保证尽量使用振镜的中心区域加工
DbSize m_Size;//区域的尺寸
Dbxy m_Offset;//区域强制偏移,用来针对区域进行调整
bool m_bSel;//选择状态
CWorkData m_WorkData;//工作数据(收集来的点数据)
CObjContainer m_ObjContainer;//也可以加入图形obj 对象
int m_AreaIdx;//区域的编号
int m_AreaPenNum;//第一个区域内obj 的笔号
};