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.

149 lines
7.7 KiB
C

#pragma once
#include "ObjComponent.h"
#include "Module.h"
#include "LabVecRang.h"
#include "MarkAreaMgr.h"
//Ԫ<><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class CObjComponentMgr :public CModule
{
friend class CDlgObjComponent;
friend class CDlgObjComponentArr;
public:
CObjComponentMgr(void);
~CObjComponentMgr(void);
virtual void Draw(CDC* pDC);//<2F><>pDC <20><><EFBFBD><EFBFBD>һЩ<D2BB><D0A9><EFBFBD><EFBFBD>
virtual MODULE GetModuleType(){return _OBJ_COMPONENT_PROP;};
virtual void WriteWorkFileExt(vector<CLab> &LabVec);
virtual void ReadWorkFile(CLabVecRang &LabVecRang);
bool IsInArea(Dbxy pt,DbSize Size);
void SetDrawBase(bool b){m_bDrawBase = b;};
void AddBaseComponent();
void AddBaseComponent(Dbxy pt,DbSize size);
void AddComponent(CObjComponent Component);
void InsertList(CListCtrl &List);
void DelSel(int &idx);
void DelAll();
void OpArea(int idx,CObjComponent &Area,bool bRead);
void SetCurSelIdx(int idx){m_CurSelIdx = idx;};
void Array();
bool SelObjectInRect(DbRect rect);
void SelAllObj();
void NotSelAllObj();
void RevSelAllObj();
vector<Dbxy> &GetCatchPtVec(){return m_CatchPtVec;};
void SetDrawAllObj(bool b){m_bDrawAllObj = b;};//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void DelAllBaseObj(){m_BaseComponentVec.clear();};
bool HasBase(){return !m_BaseComponentVec.empty();};//<2F>Ƿ<EFBFBD><C7B7>л<EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>
DbSize GetBaseSize(int idx);
bool IsBaseCircle(int idx);
void CollectWorkData(DbRect &rect,vector<vector<Dbxy>> &vec,bool bNeedSel);
void ResetObjCollectState(bool NeedSel);
void DrawArea(CDC* pDC,Dbxy Offset);
void SetAreaRadius(double r){m_AreaRadius = r;};
double GetAreaRadius(){return m_AreaRadius;};
COLORREF GetNoSelColor(){return m_NoSelColor;};
COLORREF GetSelColor(){return m_SelColor;};
COLORREF GetViewColor(){return m_ViewObjColor;};
COLORREF GetViewedObjColor(){return m_ViewedObjColor;};
bool IsDrawFillColor(){return m_bDrawFillColor;};
void SetDefaultAng(double ang){m_DefaultAng = ang;};
double GetDefaultAng(){return m_DefaultAng;};
Dbxy FindNearestPt(Dbxy pt);
bool IsAutoArray(){return m_bAutoArray;};
bool HasObj(){return !m_ComponentVec.empty();};
void CreatAreaByObj(CMarkAreaMgr &AreaMgr);
int GetObjCnt(){return m_ComponentVec.size();}
void GetSelObjIdx(vector<bool> &SelObjIdxVec);
void SetSelectedByIdx(int idx,bool b);
vector<CObjComponent>&GetComponentVec(){return m_ComponentVec;};
void CreatObjByLayerObj();
void AnalyseMarkPt(double R);
void SetAreaBasePt(Dbxy pt){m_AreaBasePt = pt;};
IntXY GetFristSelectedObjIdx();
void MoveFristSelObjToPt(Dbxy TargetPt);
void MoveObjToCameraByDir(DIRECTION dir,Dbxy TargetPt);
IntXY GetCurViewObjIdx(){return m_CurSelObjIdx;};
void MoveTrackS(Dbxy TargetPt,IntXY Gap,bool bDir);
void ResetMoveTrackSDir(){m_bMoveTrackSDir = true;};//<2F><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>
bool IsbShowRealObj(){return m_bShowRealObj;};
void SetCurSelObjIdx(IntXY Idx);
bool MoveObjToPtByIdx(IntXY IdxXY,Dbxy TargetPt);
int GetCurViewedObj();
bool SetMarkObj();
bool SwithObjToCcdMode();
DbRect SetMarkedStateRect(DbRect rect,bool bSel);
void ResetAllMarkedState();
void SetShapeLockState(bool b);
Dbxy GetAllObjCenterPt(){return m_AllObjCenterPt;};
void CalAllObjCenterPt();
void ResetAllMarkObj();
private:
bool IdxValid(int idx);
void ArrayExt();
void Arrayij(int i,int j,IntXY idx,Dbxy Offset,Dbxy RealOffset);
void AutoArray();
void SetBaseObjOffset(Dbxy Offset);
bool AutoArrayExt(Dbxy BasePt,DbSize Size,double OffsetX,double OffsetY,bool bIsCircle);
void SaveBaseObj(vector<CLab> &LabVec);
void ReadBaseObj(CLabVecRang &LabVecRang);
bool IsCircle();
void SetIsCircle(bool b);
void OnObjSelStateChange();
int ConvertIdx(IntXY Idx);
void SetCurViewObjIdx(IntXY Idx);
void DivideBySpacingDis(double dis,bool bDivideX);
CObjComponent CopyObj(CObjComponent &Obj,int sign,double dis,bool bDivideX);
int GetMarkObjCnt();
void SetSelObjMark(int CurMarkCnt);
int GetSelObjCnt();
Dbxy GetFristSelObjCenter();
private:
vector<CObjComponent> m_BaseComponentVec;//<2F><>׼Ԫ<D7BC><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
vector<CObjComponent> m_ComponentVec;//Ԫ<><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool m_bDrawAllObj;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool m_bDrawBase;//<2F>Ƿ<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>ƻ<EFBFBD>׼Ԫ<D7BC><D4AA>
int m_CurSelIdx;//<2F><>ǰѡ<C7B0><D1A1><EFBFBD>Ļ<EFBFBD>׼Ԫ<D7BC><D4AA> <20><><EFBFBD><EFBFBD>ֵ
vector<Dbxy> m_CatchPtVec;//<2F><><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><E3A3AC><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>ץȡ
bool m_bObjToCcdMode;//true <20><>ʱ<EFBFBD><CAB1>ѡ<EFBFBD><D1A1>obj <20><><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>CCD <20>۲<EFBFBD>
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>-----------------------------------------------
COLORREF m_NoSelColor;//û<><C3BB>ѡ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>ɫ
COLORREF m_SelColor;//ѡ<>е<EFBFBD><D0B5><EFBFBD>ɫ
COLORREF m_ViewObjColor;//<2F><><EFBFBD>ڹ۲<DAB9><DBB2><EFBFBD>obj <20><>ɫ
COLORREF m_ViewedObjColor;//<2F>۲<EFBFBD><DBB2><EFBFBD><EFBFBD><EFBFBD>obj <20><>ɫ
bool m_bDrawBindingObj;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ư󶨵<C6B0>layer obj
bool m_bDrawFillColor;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool m_bAutoArray;//<2F>Ƿ<EFBFBD><C7B7>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
double m_AutoArrayGap;//<2F>Զ<EFBFBD><D4B6>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>(mm)
double m_DefaultAng;//Ĭ<>ϽǶ<CFBD>
//Ԫ<><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ---------------------------------------------------------------
int m_ArrayXcntZ;//X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int m_ArrayXcntF;//X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int m_ArrayYcntZ;//Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int m_ArrayYcntF;//Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double m_OffsetX;//X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double m_OffsetY;//Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F>޶<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD>ķ<EFBFBD>Χ-------------------------------------------------------------
bool m_bUseArea;//<2F>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>޶<EFBFBD><DEB6><EFBFBD>Χ
bool m_bRectArea;//true Ϊ<><CEAA><EFBFBD>η<EFBFBD>Χ,false ΪԲ<CEAA>η<EFBFBD>Χ
Dbxy m_AreaBasePt;//<2F><>Χ<EFBFBD>Ļ<EFBFBD>׼<EFBFBD><D7BC>
DbSize m_AreaSize;//<2F><><EFBFBD>η<EFBFBD>Χ<EFBFBD>ijߴ<C4B3>
double m_AreaRadius;//Բ<>η<EFBFBD>Χ<EFBFBD><CEA7>ֱ<EFBFBD><D6B1>
bool m_bNeedAllIn;//Ԫ<><D4AA><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫȫ<D2AA><C8AB><EFBFBD>ڷ<EFBFBD>Χ<EFBFBD><CEA7>
Dbxy m_AllObjCenterPt;//<2F><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>obj
//LPS - ISP3000------------------------------------------------------------------
IntXY m_CurSelObjIdx;//<2F><>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD>obj <20><><EFBFBD><EFBFBD>ֵ
double m_RealOffsetX;//ʵ<>ʵ<EFBFBD>X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mm
double m_RealOffsetY;//ʵ<>ʵ<EFBFBD>Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mm
bool m_bMoveTrackSDir;//S<>ι<CEB9>ƶ<EFBFBD><C6B6>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>־
bool m_bShowRealObj;//<2F><>ʾobj <20><>ʵ<EFBFBD><CAB5>λ<EFBFBD><CEBB>
};
extern CObjComponentMgr *gObjComponentMgr;