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.
TwoLaserHead-PushJig/LaiPuLaser/GlobalDrawMgr.h

148 lines
7.6 KiB
C++

#pragma once
#include "Module.h"
#include "DataPoint.h"
#include "EnumPropertieType.h"
#define SCROLL_SIZE_CX (15000000) //滚动区域x 的范围--(单位:像素)
#define SCROLL_SIZE_CY (8000000) //滚动区域y 的范围--(单位:像素)
#define LOGIC_CENTER_X (SCROLL_SIZE_CX/2) //逻辑坐标中心点X --(单位:像素)
#define LOGIC_CENTER_Y (SCROLL_SIZE_CY/2) //逻辑坐标中心点Y --(单位:像素)
class CGlobalDrawMgr:public CModule
{
public:
CGlobalDrawMgr(void);
~CGlobalDrawMgr(void);
virtual void Ini();
virtual CMFCPropertyGridProperty *CreatGridProperty();
//响应属性的改变
virtual void OnPropertyChanged();
virtual MODULE GetModuleType(){return _DRAW_PROP;};
virtual void Draw(CDC* pDC);
public:
void XorDrawLine(CDC* pDC,CPen&pen,Dbxy pt1,Dbxy pt2);
COLORREF GetBkgndColor(){return m_BkgndColor;};
CSize GetScrollViewSize(){return m_ScrollViewSize;};
Dbxy CPoint2Dbxy(CPoint point);
CPoint Dbxy2CPoint(Dbxy point);
CRect DbRect2CRect(DbRect dbRect);
double Int2Double(int size);
int Double2Int(double d);
CPen& GetObjectPen(){return m_ObjectPen;};
CPen& GetSelObjectPen(){return m_SelObjectPen;};
CPen& GetMouseRectPen(){return m_MouseRectPen;};
CPen& GetSelObjRectPen(){return m_SelObjRectPen;};
CPen& GetSelObjSmallRectPen(){return m_SelObjSmallRectPen;};
CPen& GetCatchNodePen(){return m_CatchNodePen;};
CPen& GetMeasurePen(){return m_MeasurePen;};
CPen& GetObjComponentAreaPen(){return m_ObjComponentAreaPen;};
CPen& GetMarkPointPen(){return m_MarkPointPen;};
CPen& GetTempRectPen(){return m_TempRectPen;};
double GetCatchNodeSize();
COLORREF GetObjNodeColor(){return m_ObjNodeColor;};
COLORREF GetObjFirstNodeColor(){return m_ObjFirstNodeColor;};
COLORREF GetEasyOperationColor(){return m_EasyOperationColor;};
COLORREF GetButtomDefaultColor(){return m_ButtomDefaultColor;};
double GetSelObjRectGap();
double GetRotatoPtDis();
DbRect GetCurPointRect(Dbxy pt,double Scale = 1);
DbRect GetCurCatchRect(Dbxy pt);
bool IsCatchObjNode(){return m_bCatchObjNode;};
bool IsCatchObjLine(){return m_bCatchObjLine;};
bool IsCatchCrossPoint(){return m_bCatchCrossPoint;};
bool IsCatchOrthoPoint(){return m_bCatchOrthoPoint;};
bool IsCatchCutTrack(){return m_bCatchCutTrack;};
void SetCurZoomPoint(CPoint point){m_CurZoomPoint = point;};
CPoint GetCurZoomPoint(){return m_CurZoomPoint;};
void DrawMouseCross(CDC* pDC,Dbxy pt);
void DrawMouseRect(CDC* pDC,Dbxy pt);
void DrawDbxyVec(CDC* pDC,vector<vector<Dbxy>> &vec,Dbxy Offset);
double GetKeyboardMoveDis(){return m_KeyboardMoveDis;};
bool IsShowPlatformPos(){return m_bShowPlatformPos;};
void SetViewToDlg();
void ResetView();
double GetWorkAreaViewScale();
double GetMouseWheelScale(){return m_MouseWheelScale;};
bool IsbRectSel(){return m_bRectSel;};
bool IsbPointSel(){return m_bPointSel;};
bool IsEditLayerObj(){return m_bEditLayerObj;};
bool IsbMultipleSel(){return m_bMultipleSel;};
bool IsbMouseWheel(){return m_bMouseWheel;};
void SetTempViewScale(double val){m_TempViewScale = val;};
int GetCirclePtCnt(double R);
CPoint GetProgressDlgPos(){return m_ProgressDlgPos;};
void DrawTxt(CDC *pDC,CString txt,Dbxy pt);
bool IsbDelOldObj(){return m_bDelOldObj;};
void SetbDelOldObj(bool b){m_bDelOldObj = b;};
private:
DbRect GetCurRect(Dbxy pt,double size);
void DrawAxis(CDC* pDC);
int Logic2Divce(double LogicCoord,X_OR_Y xy);
double Divce2Logic(int DivceCoord,X_OR_Y xy);
private:
CPoint m_LogicCenter;//逻辑中心点
CPoint m_DlgLogicCenter;//对话框逻辑中心点
double m_ViewScale;//视图设备坐标对应逻辑坐标的比例
double m_DlgViewScale;//对话框视图设备坐标对应逻辑坐标的比例
double m_SelObjRectGap;//选择obj 外围框的间隔
double m_RotatoPtDis;//旋转点的距离
double m_MousePointRectSize;//鼠标点选的矩形的尺寸
double m_MouseCatchRectSize;//鼠标捕获的矩形范围
double m_CatchNodeSize;//绘制捕获node 点方框的尺寸
double m_MouseCursorSize;//鼠标光标的尺寸
double m_MouseCursorRectSize;//光标中间方框的尺寸
CSize m_ScrollViewSize;//滚动视图的范围
CPoint m_ProgressDlgPos;//进度条对话框的位置
CPoint m_ScrollViewCenterPt;//滚动视图的中心点
COLORREF m_BkgndColor; //view背景色
bool m_bDrawAxis;//是否绘制坐标轴
COLORREF m_AxisColor; //坐标轴颜色
int m_PenWidth;//笔的宽度
CPen m_ObjectPen;//Object 绘制笔
CPen m_SelObjectPen;//选择的Object 绘制笔
CPen m_MouseRectPen;//鼠标选择框的笔
CPen m_SelObjRectPen;//选择obj 的外框笔
CPen m_SelObjSmallRectPen;//选择obj 的小外框笔
CPen m_CatchNodePen;//捕获node 点的笔
CPen m_MeasurePen;//测量笔
CPen m_ObjComponentAreaPen;//元件范围框
CPen m_MarkPointPen;//理论定位点
CPen m_TempRectPen;//模板边框
COLORREF m_ObjNodeColor;//obj 节点的颜色
COLORREF m_ObjFirstNodeColor;//obj 节点的颜色
COLORREF m_EasyOperationColor;//便捷操作点的颜色
bool m_bCatchObjNode;//是否抓取obj 的节点
bool m_bCatchObjLine;//是否抓取obj 的线段上的点
bool m_bCatchCrossPoint;//是否抓取obj 的交叉
bool m_bCatchOrthoPoint;//是否抓取正交点
bool m_bCatchCutTrack;//是否抓取元件切割道的交点
CPoint m_CurZoomPoint;//当前的缩放点
double m_KeyboardMoveDis;//键盘移动选择的对象一次移动的距离(单位:mm)
double m_WorkAreaViewScale;//工作区域观察缩放比例
double m_TempViewScale;//临时的缩放比例
double m_MouseWheelScale;//鼠标滚动的比例
bool m_bShowPlatformPos;//显示平台和其他硬件的相对位置
bool m_bRectSel;//允许框选
bool m_bPointSel;//允许点选
bool m_bMultipleSel;//是否允许多选(false 的时候会取消之前的选择)
bool m_bMouseWheel;//是否允许鼠标滚动
bool m_bEditLayerObj;//是否可以编辑layer 的obj
COLORREF m_ButtomDefaultColor;//按钮的默认颜色
int m_CircleOneMMptCnt;//生成圆时1mm 的周长上包含多少个点
int m_MinCircleOneMMptCnt;//点数的最小值(自动的点数不能小于这个值)
bool m_bDelOldObj;//是否删除之前的obj
};
extern CGlobalDrawMgr *gDraw;