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.

1195 lines
49 KiB
C++

#include "StdAfx.h"
#include "GlobalDrawMgr.h"
#include "Propertie.h"
#include "PropertieMgr.h"
#include "LaiPuLaserView.h"
#include "GlobalFunction.h"
#include "SequentialPoint.h"
#include "DrawSimpleShape.h"
#include "MouseToolmgr.h"
#include "AuthorityMgr.h"
#include "ObjComponentMgr.h"
#include "WorkAreaMgr.h"
#include "EncryptionMgr.h"
CGlobalDrawMgr *gDraw = new CGlobalDrawMgr;
CGlobalDrawMgr::CGlobalDrawMgr(void)
{
ResetView();
m_SelObjRectGap = 20/m_ViewScale;//选择obj 外围框的间隔
m_RotatoPtDis = 30/m_ViewScale;//旋转点的距离
m_MousePointRectSize = 5/m_ViewScale;//鼠标点选的是否矩形的尺寸
m_MouseCatchRectSize = 10/m_ViewScale;//鼠标捕获的矩形范围
m_CatchNodeSize = 6/m_ViewScale;//绘制捕获node 点方框的尺寸
m_MouseCursorSize = 32/m_ViewScale;//鼠标光标的尺寸
m_MouseCursorRectSize = 4/m_ViewScale;//光标中间方框的尺寸
m_PenWidth = 0.5;//笔的宽度
m_BkgndColor = RGB_WHITE;
m_AxisColor = RGB_GREEN;
m_ObjectPen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_WHITE);
m_SelObjectPen.CreatePen(PS_DOT,m_PenWidth,RGB_RED);//选择的Object 绘制笔
LOGBRUSH LogBrush;
LogBrush.lbColor = RGB_YELLOW;
LogBrush.lbStyle = PS_SOLID;
m_MouseRectPen.CreatePen( PS_COSMETIC | PS_ALTERNATE , 1, &LogBrush, 0, NULL );
m_SelObjRectPen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_RED);//选择obj 的外框笔
m_SelObjSmallRectPen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_YELLOW);//选择obj 的小外框笔
m_CatchNodePen.CreatePen(PS_SOLID,3,RGB_YELLOW);//捕获node 点的笔
m_ObjFirstNodeColor = RGB_RED;//obj 首节点的颜色
m_EasyOperationColor = RGB_YELLOW;//便捷操作点的颜色
m_ObjNodeColor = RGB_NODE_BLUE;//obj 节点的颜色
m_MeasurePen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_RED);//测量笔
m_ObjComponentAreaPen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_BLUE);////元件范围框
m_MarkPointPen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_RED);;//理论定位点
m_TempRectPen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_RED);//模板边框
//m_ScanLinePen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_GRAY2);//扫描过的线
m_ScanLinePen.CreatePen(PS_INSIDEFRAME,m_PenWidth,RGB_RED);//扫描过的线
m_ScrollViewSize.cx = SCROLL_SIZE_CX;
m_ScrollViewSize.cy = SCROLL_SIZE_CY;
m_ScrollViewCenterPt.x = SCROLL_SIZE_CX/2;
m_ScrollViewCenterPt.y = SCROLL_SIZE_CY/2;
m_bDrawAxis = true;//是否绘制坐标轴
m_bCatchObjNode = true;//是否抓取obj 的节点
m_bCatchOrthoPoint = true;//是否抓取正交点
m_bCatchCutTrack = false;//是否抓取元件切割道的交点
m_KeyboardMoveDis = 1;//键盘移动选择的对象一次移动的距离(单位:mm)
m_DlgViewScale = 5;//对话框视图设备坐标对应逻辑坐标的比例
m_WorkAreaViewScale = (0.000461);//工作区域观察缩放比例
m_TempViewScale = -1;//临时的缩放比例
m_MouseWheelScale = 1.25;
m_bRectSel = true;//允许框选
m_bPointSel = true;//允许点选
m_bMultipleSel = true;//是否允许多选(false 的时候会取消之前的选择)
m_bMouseWheel = true;//是否允许鼠标滚动
m_bEditLayerObj = true;//是否可以编辑layer 的obj
m_bUseEasyOperation = true;//是否使用缩放快捷操作
m_CircleOneMMptCnt = 30;//生成圆时1mm 的周长上包含多少个点
m_MinCircleOneMMptCnt = 100;//点数的最小值(自动的点数不能小于这个值)
m_AreaGridGap = 10;//area 区域显示网格的间隔mm
m_bShowObjNode = true;//是否绘制obj 的节点
m_bDrawObjIdxCenter = true;//obj 的索引值在中心显示(false 在第一个点显示)
m_bNeedRedraw = false;//是否需要重绘
m_bObjEditMode = false;//图形编辑模式
m_DlgMainWidth = 1600;//操作面板的宽度
m_DlgMainWidthNoteBook = 1200;//操作面板的宽度(笔记本)
m_EditTextColor = RGB_GREEN;//编辑框字体颜色
m_EditBkColor = RGB_BLACK;//编辑框背景色
m_EditFontSize = 120;//编辑框字体的大小
m_WaferSateColor1 = RGB_WHITE;//wafer 状态的颜色_WaferState_NoWafer
m_WaferSateColor2 = RGB_GRAY2;//wafer 状态的颜色_WaferState_NoSel
m_WaferSateColor3 = RGB_BLUE1;//wafer 状态的颜色_WaferState_Untreated
m_WaferSateColor4 = RGB_PURPLE;//wafer 状态的颜色_WaferState_Waiting
m_WaferSateColor5 = RGB_YELLOW;//wafer 状态的颜色_WaferState_Processing
m_WaferSateColor6 = RGB_GREEN1;//wafer 状态的颜色_WaferState_Finished
m_WaferSateColor7 = RGB_RED;//wafer 状态的颜色_WaferState_NoFinished
m_LCD_Txt_LineW = 2;//LCD 显示框字体的线宽
m_bDlgLayerViewShow = false;//是否在对话框显示view 的内容
}
CGlobalDrawMgr::~CGlobalDrawMgr(void)
{
m_ObjectPen.DeleteObject();
m_SelObjectPen.DeleteObject();
m_MouseRectPen.DeleteObject();
m_SelObjRectPen.DeleteObject();
m_SelObjSmallRectPen.DeleteObject();
m_CatchNodePen.DeleteObject();
m_MarkPointPen.DeleteObject();
m_TempRectPen.DeleteObject();
}
#if 1//模块属性管理
void CGlobalDrawMgr::OnAppInitialize()
{
gMouseToolMgr.SetMouseTool(_TOOL_POINT);
OnPropertyChanged();
m_pView = GetCurViewPtr();
m_pView->DoZoomFull();
}
CMFCPropertyGridProperty * CGlobalDrawMgr::CreatGridProperty()
{
CString PropertyName;//属性名称
CString Description;//描述
CString Path = _T("ViewDraw");//存储路径
CString Name;
//-------------------------------------------------------------------------------//
PropertyName = _T("显示");
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
//-------------------------------------------------------------------------------//
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_EditTextColor");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_EditTextColor);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Text 字体颜色");
Description = _T("Text 字体颜色");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_EditTextColor, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
p1->EnableAutomaticButton(_T("默认"),RGB_GREEN);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_EditBkColor");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_EditBkColor);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Text 背景颜色");
Description = _T("Text 背景颜色");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_EditBkColor, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
p1->EnableAutomaticButton(_T("默认"),RGB_BLACK);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_EditFontSize");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_EditFontSize);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Text 字体大小");
Description = _T("Text 字体大小");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_EditFontSize, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_BkgndColor");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_BkgndColor);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("背景颜色");
Description = _T("视图背景颜色");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_BkgndColor, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
p1->EnableAutomaticButton(_T("默认"),RGB_BLACK);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_ButtomDefaultColor");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_ButtomDefaultColor);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("按钮颜色");
Description = _T("按钮的默认颜色");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_ButtomDefaultColor, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
p1->EnableAutomaticButton(_T("默认"),RGB_BLUE);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_ScanLineColor");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_ScanLineColor);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("扫描线颜色");
Description = _T("退火扫描线的颜色");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_ScanLineColor, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
p1->EnableAutomaticButton(_T("默认"),RGB_YELLOW);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_WorkAreaViewScale");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WorkAreaViewScale);
pPropertie->SetType(_PROP_TYPE_DOUBLE);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("默认观察比例");
Description = _T("工作区域观察的默认比例");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_WorkAreaViewScale, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_MouseWheelScale");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_MouseWheelScale);
pPropertie->SetType(_PROP_TYPE_DOUBLE);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("鼠标滚动比例");
Description = _T("鼠标滚动一次变化的比例");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MouseWheelScale, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_AreaGridGap");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_AreaGridGap);
pPropertie->SetType(_PROP_TYPE_DOUBLE);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("区域网格间隔");
Description = _T("加工区域网格的间隔mm");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_AreaGridGap, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_DlgMainWidth");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_DlgMainWidth);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("面板宽度1");
Description = _T("操作面板宽度");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DlgMainWidth, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_DlgMainWidthNoteBook");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_DlgMainWidthNoteBook);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("面板宽度2");
Description = _T("操作面板宽度(Note book)");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DlgMainWidthNoteBook, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_KeyboardMoveDis");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_KeyboardMoveDis);
pPropertie->SetType(_PROP_TYPE_DOUBLE);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("手动移动距离");
Description = _T("键盘移动选择图形对象一次的距离(单位:mm)");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_KeyboardMoveDis, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_LCD_Txt_LineW");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_LCD_Txt_LineW);
pPropertie->SetType(_PROP_TYPE_DOUBLE);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("LCD线宽");
Description = _T("LCD 显示框字体的线宽");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_LCD_Txt_LineW, Description);
pGroup->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("圆弧属性"));
{
//添加属性变量映射
Name = _T("m_CircleOneMMptCnt");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_CircleOneMMptCnt);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("圆弧点数");
Description = _T("1 mm 直径的圆弧上点的个数");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_CircleOneMMptCnt, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_MinCircleOneMMptCnt");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_MinCircleOneMMptCnt);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("圆弧点数最小值");
Description = _T("点数的最小值(自动的点数不能小于这个值,用来控制很小的弧线点数)");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MinCircleOneMMptCnt, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Wafer 状态颜色"));
{
//添加属性变量映射
Name = _T("m_WaferSateColor1");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor1);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("NoSelect");
Description = _T("有wafer ,但是没有选择");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor1, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_WaferSateColor2");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor2);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Waiting");
Description = _T("等待加工状态");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor2, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_WaferSateColor3");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor3);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Loading");
Description = _T("上料状态");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor3, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_WaferSateColor4");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor4);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Proccess");
Description = _T("加工状态");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor4, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_WaferSateColor5");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor5);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Unloading");
Description = _T("退料状态");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor5, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_WaferSateColor6");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor6);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Finished");
Description = _T("加工完成");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor6, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_WaferSateColor7");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_WaferSateColor7);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("Unfinished");
Description = _T("wafer 退回料盒,但是未完成加工");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_WaferSateColor7, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("进度条"));
{
//添加属性变量映射
Name = _T("m_ProgressDlgPos_x");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_ProgressDlgPos.x);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("进度位置X");
Description = _T("进度条对话框弹出的位置X (像素)");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_ProgressDlgPos.x, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_ProgressDlgPos_y");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_ProgressDlgPos.y);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("进度位置Y");
Description = _T("进度条对话框弹出的位置Y (像素)");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_ProgressDlgPos.y, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
//-------------------------------------------------------------------------------//
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("坐标轴"));
{
//添加属性变量映射
Name = _T("m_bDrawAxis");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bDrawAxis);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("显示坐标轴");
Description = _T("是否显示坐标轴");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bDrawAxis, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
//-------------------------------------------------------------------------------//
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
//添加属性变量映射
Name = _T("m_AxisColor");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_AxisColor);
pPropertie->SetType(_PROP_TYPE_COLOR);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("坐标轴颜色");
Description = _T("视图坐标轴的颜色");
CMFCPropertyGridColorProperty* p1 = new CMFCPropertyGridColorProperty(PropertyName,m_AxisColor, NULL, Description);
p1->EnableOtherButton(_T("其他..."));
p1->EnableAutomaticButton(_T("默认"),RGB_BLACK);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Factory))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("对话框view"));
{
//添加属性变量映射
Name = _T("m_DlgLogicCenter_x");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_DlgLogicCenter.x);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("逻辑中心X");
Description = _T("view 映射到对话框的逻辑中心X");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DlgLogicCenter.x, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_DlgLogicCenter_y");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_DlgLogicCenter.y);
pPropertie->SetType(_PROP_TYPE_INT);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("逻辑中心Y");
Description = _T("view 映射到对话框的逻辑中心Y");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DlgLogicCenter.y, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_DlgViewScale");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_DlgViewScale);
pPropertie->SetType(_PROP_TYPE_DOUBLE);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("对话框视图比例");
Description = _T("view 映射到对话框的视图比例");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_DlgViewScale, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
//-------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------//
if(gAuthorityMgr->CheckAuthority(_Authority_Engineer))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("捕捉"));
{
//添加属性变量映射
Name = _T("m_bCatchObjNode");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bCatchObjNode);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("节点捕捉");
Description = _T("是否捕捉对象的节点");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCatchObjNode, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bCatchObjLine");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bCatchObjLine);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("线段捕捉");
Description = _T("是否捕捉对象线段上的点");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCatchObjLine, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bCatchCrossPoint");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bCatchCrossPoint);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("交叉点捕捉");
Description = _T("是否捕捉对象的交叉点");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCatchCrossPoint, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bCatchOrthoPoint");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bCatchOrthoPoint);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("正交捕捉");
Description = _T("是否捕捉正交点");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCatchOrthoPoint, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bCatchCutTrack");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bCatchCutTrack);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("原件捕捉");
Description = _T("是否捕捉阵列元件中心点");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCatchCutTrack, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
if(gAuthorityMgr->CheckAuthority(_Authority_Engineer))
{
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("操作"));
{
//添加属性变量映射
Name = _T("m_bUseEasyOperation");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bUseEasyOperation);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("显示缩放点");
Description = _T("是否显示快捷的obj 缩放点功能");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bUseEasyOperation, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bEditLayerObj");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bEditLayerObj);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("允许编辑");
Description = _T("是否允许手动编辑图形");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bEditLayerObj, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bRectSel");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bRectSel);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("允许框选");
Description = _T("是否使用鼠标框选对象");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bRectSel, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bPointSel");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bPointSel);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("允许点选");
Description = _T("是否使用鼠标点选对象");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bPointSel, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bMultipleSel");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bMultipleSel);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("连续选择");
Description = _T("false 的时候会取消之前的选择项");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bMultipleSel, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bMouseWheel");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bMouseWheel);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("鼠标滚动");
Description = _T("是否允许鼠标滚动");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bMouseWheel, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bShowObjNode");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bShowObjNode);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("对象节点");
Description = _T("是否显示选择对象的节点");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bShowObjNode, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
{
//添加属性变量映射
Name = _T("m_bDrawObjIdxCenter");//变量名字
CPropertie *pPropertie = new CPropertie;
pPropertie->SetpVal((void*)&m_bDrawObjIdxCenter);
pPropertie->SetType(_PROP_TYPE_BOOL);
pPropertie->SetpModule(this);
pPropertie->SetPath(Path);
pPropertie->SetName(Name);
pPropertie->WriteRead(true);//读取保存的属性
//添加属性显示
PropertyName = _T("对象索引位置");
Description = _T("TRUE : 在中心显示,FALSE : 在第一个点显示");
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bDrawObjIdxCenter, Description);
pGroup1->AddSubItem(p1);
gDevicePropertieMgr.Insert(p1, pPropertie);
}
pGroup->AddSubItem(pGroup1);
}
return pGroup;
}
//响应属性的改变
void CGlobalDrawMgr::OnPropertyChanged()
{
//刷新界面显示
CLaiPuLaserView *pView = GetCurViewPtr();
if(pView)
{
pView->RefreshView();
}
}
#endif
#if 1
//设置view 为对话框显示
void CGlobalDrawMgr::SetViewToDlg()
{
m_LogicCenter = m_DlgLogicCenter;
m_ViewScale = m_DlgViewScale;
m_bDlgLayerViewShow = true;//是否在对话框显示view 的内容
}
//恢复view 的显示
void CGlobalDrawMgr::ResetView()
{
m_bDlgLayerViewShow = false;//是否在对话框显示view 的内容
CPoint pt(LOGIC_CENTER_X,LOGIC_CENTER_Y);
m_LogicCenter = pt;
m_ViewScale = 10000;//视图设备坐标对应逻辑坐标的比例(1毫米对应10000)
}
double CGlobalDrawMgr::GetWorkAreaViewScale()
{
if(m_TempViewScale>0)//设置了临时的缩放比例
{
return m_TempViewScale;
}
return m_WorkAreaViewScale;
}
//获取固定面板的宽度
int CGlobalDrawMgr::GetDlgMainWidth()
{
if(gEncryptionMgr->IsbRunAtNoteBook())
return m_DlgMainWidthNoteBook;
return m_DlgMainWidth;
}
#endif
#if 1//坐标转换
//逻辑坐标转换为设备坐标
int CGlobalDrawMgr::Logic2Divce(double LogicCoord,X_OR_Y xy)
{
int rtn;
if(xy == _X)
{
rtn = LogicCoord*m_ViewScale + m_LogicCenter.x;
}
else
{
rtn = m_LogicCenter.y -LogicCoord*m_ViewScale;
}
return rtn;
}
double CGlobalDrawMgr::Divce2Logic(int DivceCoord,X_OR_Y xy)
{
double rtn;
if(xy == _X)
{
rtn = (DivceCoord- m_LogicCenter.x)/m_ViewScale;
}
else
{
rtn = (m_LogicCenter.y - DivceCoord)/m_ViewScale;
}
return rtn;
}
CRect CGlobalDrawMgr::DbRect2CRect(DbRect dbRect)
{
CRect rect;
rect.left = Logic2Divce(dbRect.L,_X);
rect.right = Logic2Divce(dbRect.R,_X);
rect.top = Logic2Divce(dbRect.T,_Y);
rect.bottom = Logic2Divce(dbRect.B,_Y);
return rect;
}
Dbxy CGlobalDrawMgr::CPoint2Dbxy(CPoint point)
{
Dbxy pt;
pt.x = Divce2Logic(point.x,_X);
pt.y = Divce2Logic(point.y,_Y);
return pt;
}
CPoint CGlobalDrawMgr::Dbxy2CPoint(Dbxy point)
{
CPoint pt;
pt.x = Logic2Divce(point.x,_X);
pt.y = Logic2Divce(point.y,_Y);
return pt;
}
//设备尺寸转换为逻辑尺寸
double CGlobalDrawMgr::Int2Double(int size)
{
return (double)size/m_ViewScale;
}
//逻辑尺寸转换为设备尺寸
int CGlobalDrawMgr::Double2Int(double d)
{
return (int)(d*m_ViewScale);
}
#endif
#if 1//绘制共通部分
void CGlobalDrawMgr::Draw(CDC* pDC)
{
DrawAxis(pDC);
}
//绘制坐标轴
void CGlobalDrawMgr::DrawAxis(CDC* pDC)
{
if(!m_bDrawAxis)
return;
CPen Pen,*pOldPen;
Pen.CreatePen(PS_INSIDEFRAME,1,m_AxisColor);
pOldPen = pDC->SelectObject(&Pen);
int CenterX = m_ScrollViewCenterPt.x;
int CenterY = m_ScrollViewCenterPt.y;
pDC->MoveTo(0, CenterY);
pDC->LineTo(m_ScrollViewSize.cx+2000, CenterY);
pDC->MoveTo(CenterX,0);
pDC->LineTo(CenterX, m_ScrollViewSize.cy*2);
Pen.DeleteObject();
pDC->SelectObject(pOldPen);
}
//绘制鼠标的光标
void CGlobalDrawMgr::DrawMouseCross(CDC* pDC,Dbxy pt)
{
double CorssSize = GetCurViewPtr()->GetCurrScaleVal(m_MouseCursorSize);
XorDrawCross(pDC,true,m_ObjectPen,pt,CorssSize);
}
//绘制鼠标的光标
void CGlobalDrawMgr::DrawMouseRect(CDC* pDC,Dbxy pt)
{
double rectSize = GetCurViewPtr()->GetCurrScaleVal(m_MouseCursorRectSize);
DrawRect(pDC,m_ObjectPen,pt,rectSize);
}
//绘制连续的数据点
void CGlobalDrawMgr::DrawDbxyVec(CDC* pDC,vector<vector<Dbxy>> &vec)
{
vector<vector<Dbxy>>::iterator iter = vec.begin();
vector<vector<Dbxy>>::iterator iter_end = vec.end();
int size = vec.size();
for(int i=0;iter!=iter_end;i++,iter++)
{
vector<Dbxy>::iterator iter1 = (*iter).begin();
vector<Dbxy>::iterator iter1_end = (*iter).end();
for(;iter1!=iter1_end;iter1++)
{
CPoint pt = Dbxy2CPoint(*iter1);
if(iter1 == (*iter).begin())
{
pDC->MoveTo(pt.x,pt.y);
}
else
{
pDC->LineTo(pt.x,pt.y);
}
}
}
}
//绘制文字
void CGlobalDrawMgr::DrawTxt(CDC *pDC,CString txt,Dbxy pt)
{
CPoint Point = Dbxy2CPoint(pt);
//设置字体------------------------------------------------------
pDC->TextOut(Point.x,Point.y,txt);
}
#endif
#if 1//获取一些值
double CGlobalDrawMgr::GetSelObjRectGap()
{
return GetCurViewPtr()->GetCurrScaleVal(m_SelObjRectGap);
}
double CGlobalDrawMgr::GetRotatoPtDis()
{
return GetCurViewPtr()->GetCurrScaleVal(m_RotatoPtDis);
}
double CGlobalDrawMgr::GetCatchNodeSize()
{
return GetCurViewPtr()->GetCurrScaleVal(m_CatchNodeSize);;
}
#endif
#if 1//鼠标相关
//获取当前比例的鼠标点范围
DbRect CGlobalDrawMgr::GetCurPointRect(Dbxy pt,double Scale)
{
return GetCurRect(pt,m_MousePointRectSize*Scale);
}
//获取当前鼠标捕获的rect 范围
DbRect CGlobalDrawMgr::GetCurCatchRect(Dbxy pt)
{
return GetCurRect(pt,m_MouseCatchRectSize);
}
DbRect CGlobalDrawMgr::GetCurRect(Dbxy pt,double size)
{
double DSize = GetCurViewPtr()->GetCurrScaleVal(size);
DbRect rect(Dbxy(pt.x-DSize,pt.y+DSize),Dbxy(pt.x+DSize,pt.y-DSize));
return rect;
}
#endif
//获取半径R 的圆的点数
int CGlobalDrawMgr::GetCirclePtCnt(double R)
{
double Perimeter = 2*PI*R;
int cnt = Perimeter*m_CircleOneMMptCnt;
return (cnt > m_MinCircleOneMMptCnt)?cnt:m_MinCircleOneMMptCnt;
}
//获取wafer 状态的颜色
COLORREF CGlobalDrawMgr::GetWaferSateColor(int Idx)
{
COLORREF c;
switch(Idx)
{
case 0://NoSelect
c = m_WaferSateColor1;
break;
case 1://Waiting
c = m_WaferSateColor2;
break;
case 2://Loading
c = m_WaferSateColor3;
break;
case 3://Proccess
c = m_WaferSateColor4;
break;
case 4://Unloading
c = m_WaferSateColor5;
break;
case 5://Finished
c = m_WaferSateColor6;
break;
case 6://Unfinished
c = m_WaferSateColor7;
break;
default:
break;
}
return c;
}