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.

90 lines
2.7 KiB
C++

#pragma once
#include "GlobalDefine.h"
#include "ObjContainer.h"
#include "GlobalFunction.h"
enum SCAN_TRACK_E
{
_SCAN_TRACK_S_L_R=0,//S 形扫描-竖向-从左到右
_SCAN_TRACK_S_R_L,//S 形扫描-竖向-从右到左
_SCAN_TRACK_U_D,//单向扫描-上到下
_SCAN_TRACK_D_U,//单向扫描-下到上
_SCAN_TRACK_S_U_D,//S 形扫描-横向-上到下
_SCAN_TRACK_S_D_U,//S 形扫描-横向-下到上
_SCAN_TRACK_L_R,//单向扫描-左到右
_SCAN_TRACK_R_L,//单向扫描-右到左
};
//扫描线
class CScanLine
{
public:
CScanLine(Dbxy StartPt,Dbxy EndPt)
{
m_StartPt = StartPt;
m_EndPt = EndPt;
m_bFirstLine = false;//第一条线
};
CScanLine(void)
{
};
~CScanLine(void){};
Dbxy GetStartPt(){return m_StartPt;};
Dbxy GetEndPt(){return m_EndPt;};
void SetStartPt(Dbxy pt){m_StartPt = pt;};
void SetEndPt(Dbxy pt){m_EndPt = pt;};
double GetLength(){return CalDistance(m_StartPt,m_EndPt);};
void SetbFirstLine(){m_bFirstLine = true;};
bool IsbFirstLine(){return m_bFirstLine;};
void SetPenNum(int n){m_PenNum = n;};
int GetPenNum(){return m_PenNum;};
private:
Dbxy m_StartPt;//起点
Dbxy m_EndPt;//终点
bool m_bFirstLine;//第一条线
int m_PenNum;//笔号
};
//图形填充参数
class CObjFillMgr
{
public:
CObjFillMgr(void);
~CObjFillMgr(void);
void FillAllSelObj();
void FillAllSelObjByIdx(int idx);
void SetFillOffset(double val){m_FillOffset = val;};
void SetFillAngle(double val){m_FillAngle = val;};
void SetbDelEdgeObj(bool b){m_bDelEdgeObj = b;};
bool GetAngle(double &Angle,int PenNum);
SCAN_TRACK_E GetCurScanType(){return m_CurScanType;};
void SetStartFillIdx(int idx){m_StartFillIdx = idx;};
private:
void CreatCmd();
void FillObjAddToLayer();
void CreatFillLineByObj();
void CreatObjFillData(CObjContainer &ObjContainer);
void AdjustScanLine1();
void AdjustScanLine2();
bool CreatScanLineByObjFill();
void CreatObjByScanLine();
void ScanLineCoverWafer(Dbxy &pt1,Dbxy &pt2,bool bDir,int PenNum);
void UpdateCurScanType();
public:
double m_FillOffset;//填充间隔mm
double m_FillAngle;//填充角度(360 角)
bool m_bDelEdgeObj;//是否删除轮廓obj
bool m_bCreatConnectLine;//是否创建连接线
int m_StartFillIdx;//从第几根填充线开始
SCAN_TRACK_E m_CurScanType;//当前的扫描方式
vector<CScanLine> m_ScanLineVec;//扫描线容器
CObjContainer m_ObjContainer;
};
extern CObjFillMgr gObjFillMgr;