|
|
@@ -95,8 +95,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//拖动前的坐标记录
|
|
|
private PointF m_beforedrag_pointf = new PointF();
|
|
|
|
|
|
- //记录鼠标拖选完成后形成的路径
|
|
|
- private GraphicsPath m_selectmulti_gpath = new GraphicsPath();
|
|
|
+
|
|
|
|
|
|
//缩放的增大缩小的增量
|
|
|
private float m_f_zoom_increment = 0.05f;
|
|
|
@@ -131,8 +130,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//整个背景矩形的背景色
|
|
|
private Color m_backrangecolor = Color.White;
|
|
|
|
|
|
- //日志文件名
|
|
|
- const String m_csFileName = "OTSReportAppLog";
|
|
|
+
|
|
|
|
|
|
//底层封装类
|
|
|
OTSIncAReportFun m_OTSIncAReportFun = null;
|
|
|
@@ -166,7 +164,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//背景使用原图
|
|
|
private bool OriginalBackground = false;
|
|
|
|
|
|
-
|
|
|
+ static System.Windows.Forms.Timer delaytimer = new System.Windows.Forms.Timer();
|
|
|
|
|
|
/// <summary>
|
|
|
/// 当前正在显示的数据源名称,用来与框架调用条件判断使用
|
|
|
@@ -205,10 +203,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
/// </summary>
|
|
|
public bool bShowSmallParticle = false;
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 接收外部传进来的查询条件
|
|
|
- /// </summary>
|
|
|
- //List<CGridDataClr> m_list_cgriddataclr = null;
|
|
|
+
|
|
|
|
|
|
public List<Particle> SelectedParticles { set; get; }
|
|
|
OTSIncAReportApp.frmReportApp m_ReportApp;
|
|
|
@@ -329,11 +324,6 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//上面是必须有的
|
|
|
SetStyle(ControlStyles.UserMouse, true); //执行自己的鼠标行为,这个打开后,在win7下鼠标操作明显改善
|
|
|
|
|
|
- //双缓冲其它选项说明
|
|
|
- //SetStyle(ControlStyles.Selectable, true); //可以接收焦点,未知效果
|
|
|
- //SetStyle(ControlStyles.StandardClick,true); //控件标准行为,未知效果
|
|
|
- //SetStyle(ControlStyles.EnableNotifyMessage, true);//派发所有的消息,未知效果
|
|
|
- //SetStyle(ControlStyles.ContainerControl, true); //设置自身为容器,未知效果
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
@@ -745,7 +735,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
{
|
|
|
DParticle dp = (DParticle)item;
|
|
|
//明白了,选择第一个时,被第二个刷掉了
|
|
|
- if (true == WhetherInRange(item.GPath.PathPoints, e.Location))
|
|
|
+ if (true == WhetherInRange(dp, e.Location))
|
|
|
{
|
|
|
dp.IsMouseMove = true;
|
|
|
//获取颗粒ID
|
|
|
@@ -821,13 +811,10 @@ namespace OTSIncAReportGraph.Controls
|
|
|
DParticle dp = (DParticle)item;
|
|
|
if (dp.Operator != ParticleOperator.NODISPLAY)
|
|
|
{
|
|
|
- if (true == WhetherInRange(dp.GPath.PathPoints, e.Location))
|
|
|
+ if (true == WhetherInRange(dp, e.Location))
|
|
|
{
|
|
|
////并保存到变量中,供移动电镜使用
|
|
|
- //Point ls_fieldotspoint =m_OTSIncAReportFun.GetOTSPointByFieldID(m_list_dfield,dp.CLRFieldID);
|
|
|
- ////从OTS坐标系转成SEM坐标系
|
|
|
- //m_sem_mouse_now_point = m_OTSIncAReportFun.ChangeOTSToSemCoord(new Point(ls_fieldotspoint.X, ls_fieldotspoint.Y));
|
|
|
- //m_str_mouseshow_left = "视域位置:" + m_sem_mouse_now_point.X.ToString() + ":" + m_sem_mouse_now_point.Y.ToString();
|
|
|
+
|
|
|
|
|
|
m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
|
|
|
m_str_mouseshow_left = "颗粒SEM位置:" + dp.SEMPosX.ToString() + ":" + dp.SEMPosY.ToString();
|
|
|
@@ -839,43 +826,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
Color ls_c = GetColorByMousePoint(e.X, e.Y);
|
|
|
m_str_mouseshow_right = "灰度#" + ls_c.R.ToString();
|
|
|
|
|
|
- #region ////获取颜色方法2,获取的速度很快,但是却影响程序的运行速度----------------------------------------------------
|
|
|
- //Bitmap ls_bp = new Bitmap(this.Width, this.Height);
|
|
|
- //this.DrawToBitmap(ls_bp, new Rectangle(0, 0, this.Width, this.Height));
|
|
|
- //Color ls_c = ls_bp.GetPixel(e.X, e.Y);
|
|
|
- //str_mouseshow_right = "颜色值#" + ls_c.R.ToString() + "," + ls_c.G.ToString() + "," + ls_c.B.ToString();
|
|
|
-
|
|
|
- //str_mouseshow_right = "未指向颗粒";
|
|
|
- //foreach (BaseObject item in list_baseobject)
|
|
|
- //{
|
|
|
- // if (((DParticle)item).Operator != "不显示")
|
|
|
- // {
|
|
|
- // //明白了,选择第一个时,被第二个刷掉了
|
|
|
- // if (true == WhetherInRange(item.GPath.PathPoints, e.Location))
|
|
|
- // {
|
|
|
- // DParticle ap = (DParticle)item;
|
|
|
- // str_mouseshow_right = "颗粒:" + item.ID.ToString();
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //int hWnd = FindWindow(null, @"报告程序");
|
|
|
- //if (hWnd == 0)
|
|
|
- //{
|
|
|
- // MessageBox.Show("未找到消息接受者!");
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // string sendString = str_mouseshow_left + "|"+ str_mouseshow_right ;
|
|
|
- // byte[] sarr = System.Text.Encoding.Default.GetBytes(sendString);
|
|
|
- // int len = sarr.Length;
|
|
|
- // COPYDATASTRUCT cds;
|
|
|
- // cds.dwData = (IntPtr)0;
|
|
|
- // cds.cbData = len + 1;
|
|
|
- // cds.lpData = sendString;
|
|
|
- // SendMessage(hWnd, WM_COPYDATA, ref cds, ref cds);
|
|
|
- //}
|
|
|
- #endregion
|
|
|
+
|
|
|
|
|
|
m_ReportApp.mouseMatter.Text = m_str_mouseshow_right ;
|
|
|
m_ReportApp.RSGrayVal.Text = m_str_mouseshow_left;
|
|
|
@@ -931,7 +882,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
PointF[] lspointf = dp.GPath.PathPoints;
|
|
|
for (int i = 0; i < lspointf.Count(); i++)
|
|
|
{
|
|
|
- if (true == WhetherInRange(ls_gpath.PathPoints, lspointf[i]))
|
|
|
+ if (true == WhetherInRange(dp, lspointf[i]))
|
|
|
{
|
|
|
//选择到了该路径,那么就选取该图像
|
|
|
dp.Operator = ParticleOperator.SELECTED;
|
|
|
@@ -999,7 +950,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
foreach (DParticle dp in m_list_baseobject)
|
|
|
{
|
|
|
PointF[] lspointf = dp.GPath.PathPoints;
|
|
|
- if (true == WhetherInRange(lspointf, new Point(e.X, e.Y)))
|
|
|
+ if (true == WhetherInRange(dp, new Point(e.X, e.Y)))
|
|
|
{
|
|
|
//选择到了该路径,那么就选取该图像b
|
|
|
dp.Operator_ShowXRay = ParticleOperatorShowXray.SELECTANDDISPLAYXRAY;
|
|
|
@@ -1036,7 +987,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//这个判断右键菜单加在这里,也不知道对不对
|
|
|
foreach (BaseObject item in m_list_baseobject)
|
|
|
{
|
|
|
- if (true == WhetherInRange(item.GPath.PathPoints, e.Location))
|
|
|
+ if (true == WhetherInRange((DParticle)item, e.Location))
|
|
|
{
|
|
|
DParticle dp = (DParticle)item;
|
|
|
CMenuStrip.Items[0].Enabled = true;
|
|
|
@@ -1055,10 +1006,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
CMenuStrip.Items[2].Enabled = true;
|
|
|
CMenuStrip.Items[3].Enabled = true;
|
|
|
|
|
|
- ////并保存到变量中,供移动电镜使用
|
|
|
- //Point ls_fieldotspoint = m_OTSIncAReportFun.GetOTSPointByFieldID(m_list_dfield, dp.CLRFieldID);
|
|
|
- ////从OTS坐标系转成SEM坐标系
|
|
|
- //m_sem_mouse_now_point = m_OTSIncAReportFun.ChangeOTSToSemCoord(new Point(ls_fieldotspoint.X, ls_fieldotspoint.Y));
|
|
|
+
|
|
|
|
|
|
m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
|
|
|
//获取颜色方法1,使用API来获取当前鼠标指向位置的颜色值-----------------------------------------------------
|
|
|
@@ -1178,6 +1126,28 @@ namespace OTSIncAReportGraph.Controls
|
|
|
/// <param name="in_dparticle"></param>
|
|
|
private void ShowXRay(DParticle in_dparticle)
|
|
|
{
|
|
|
+
|
|
|
+ if (delaytimer.Enabled == false)
|
|
|
+ {
|
|
|
+ m_move_dparticle = in_dparticle;//将显示xray的dparticle记录给全局变量
|
|
|
+
|
|
|
+ delaytimer.Tick += Delaytimer_Tick;
|
|
|
+ delaytimer.Interval = 500;
|
|
|
+ delaytimer.Start();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Delaytimer_Tick(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (m_move_dparticle.IsMouseMove == false)
|
|
|
+ {
|
|
|
+ delaytimer.Enabled = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ delaytimer.Enabled = false;
|
|
|
//显示xray相关信息
|
|
|
uint[] Search_xray = new uint[2000];
|
|
|
uint[] Analysis_xray = new uint[2000];
|
|
|
@@ -1188,7 +1158,7 @@ namespace OTSIncAReportGraph.Controls
|
|
|
List<Element> list_celementchemistryclr = new List<Element>();
|
|
|
|
|
|
//获取Xray数据
|
|
|
- m_OTSIncAReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(in_dparticle.CLRTagID, in_dparticle.CLRFieldID, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
|
|
|
+ m_OTSIncAReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_move_dparticle.CLRTagID, m_move_dparticle.CLRFieldID, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
|
|
|
|
|
|
//get CElementChemistryClr list
|
|
|
List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
|
|
|
@@ -1202,36 +1172,10 @@ namespace OTSIncAReportGraph.Controls
|
|
|
}
|
|
|
|
|
|
//获取使用标准库的名称
|
|
|
- string str_stdname = "";
|
|
|
+ //string str_stdname = "";
|
|
|
string str_IncALibName = "";
|
|
|
- List<int> FLID = new List<int>() { 0, 1, 2, 4, 6, 9 };
|
|
|
- //List<string> NameList = new List<string>() { "过小颗粒", "过大颗粒", "亮度不在分析范围内的颗粒", "低计数率颗粒", "不含分析元素的颗粒", "非夹杂物颗粒SiC", "非夹杂物颗粒FeO", "未识别颗粒" };
|
|
|
- List<string> NameList = new List<string>() { "过小颗粒", "过大颗粒", "亮度不在分析范围内的颗粒", "低计数率颗粒", "不含分析元素的颗粒", "未识别颗粒" };
|
|
|
+ str_IncALibName = m_move_dparticle.TypeName;
|
|
|
|
|
|
- if (in_dparticle.TypeId < 1000)
|
|
|
- {
|
|
|
- int index = FLID.IndexOf(in_dparticle.TypeId);
|
|
|
- if (index == -1)
|
|
|
- {
|
|
|
- index = 5;
|
|
|
- }
|
|
|
- //小于1000,使用系统默认分类
|
|
|
- str_IncALibName = NameList[index];
|
|
|
- str_stdname = "默认标准库";
|
|
|
- }
|
|
|
- else if (in_dparticle.TypeId >= 1000 && in_dparticle.TypeId < 10000)
|
|
|
- {
|
|
|
- //大于等于1000,并且小于10000时,使用系统数据库中夹杂物来分析
|
|
|
- str_IncALibName = in_dparticle.TypeName;
|
|
|
- str_stdname = "用户定义标准库";
|
|
|
- }
|
|
|
- else if (in_dparticle.TypeId > 10000)
|
|
|
- {
|
|
|
- //大于10000时,使用用户标准库来分析夹杂物名称
|
|
|
- str_IncALibName = in_dparticle.TypeName;
|
|
|
- if (str_stdname == "")
|
|
|
- str_stdname = "系统标准库";
|
|
|
- }
|
|
|
|
|
|
//获取数据后,需要对xraytable设置
|
|
|
control_XRayTable1.Visible = false;
|
|
|
@@ -1239,16 +1183,15 @@ namespace OTSIncAReportGraph.Controls
|
|
|
//颗粒国标信息
|
|
|
control_XRayTable1.GBInfoStr = "";
|
|
|
control_XRayTable1.GoodName = str_IncALibName;//杂夹物
|
|
|
- control_XRayTable1.STDName = str_stdname;//标准库
|
|
|
+ //control_XRayTable1.STDName = str_stdname;//标准库
|
|
|
control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
|
|
|
control_XRayTable1.Visible = true;
|
|
|
|
|
|
- //将显示xray的dparticle记录给全局变量
|
|
|
- m_move_dparticle = in_dparticle;
|
|
|
+
|
|
|
|
|
|
this.Refresh();
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 隐藏x-ray能谱图
|
|
|
/// </summary>
|
|
|
@@ -1588,19 +1531,31 @@ namespace OTSIncAReportGraph.Controls
|
|
|
/// <param name="inPoints"></param>
|
|
|
/// <param name="WhetherPoint"></param>
|
|
|
/// <returns></returns>
|
|
|
- private bool WhetherInRange(PointF[] inPoints, Point WhetherPoint)
|
|
|
+ private bool WhetherInRange(DParticle Part,/*PointF[] inPoints,*/ Point WhetherPoint)
|
|
|
{
|
|
|
- bool b_inrange = false;
|
|
|
- GraphicsPath myGraphicsPath = new GraphicsPath();
|
|
|
- Region myRegion = new Region();
|
|
|
- myGraphicsPath.Reset();
|
|
|
-
|
|
|
- myGraphicsPath.AddPolygon(inPoints);
|
|
|
- myRegion.MakeEmpty();
|
|
|
- myRegion.Union(myGraphicsPath);
|
|
|
- //返回判断点是否在多边形里
|
|
|
- b_inrange = myRegion.IsVisible(WhetherPoint);
|
|
|
- return b_inrange;
|
|
|
+ var rect = Part.Rect;
|
|
|
+ if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
|
|
|
+ {
|
|
|
+ var itm = (BaseObject)Part;
|
|
|
+ PointF[] inPoints = itm.GPath.PathPoints;
|
|
|
+ bool b_inrange = false;
|
|
|
+ GraphicsPath myGraphicsPath = new GraphicsPath();
|
|
|
+ Region myRegion = new Region();
|
|
|
+ myGraphicsPath.Reset();
|
|
|
+
|
|
|
+ myGraphicsPath.AddPolygon(inPoints);
|
|
|
+ myRegion.MakeEmpty();
|
|
|
+ myRegion.Union(myGraphicsPath);
|
|
|
+ //返回判断点是否在多边形里
|
|
|
+ b_inrange = myRegion.IsVisible(WhetherPoint);
|
|
|
+ return b_inrange;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1609,19 +1564,29 @@ namespace OTSIncAReportGraph.Controls
|
|
|
/// <param name="inPoints"></param>
|
|
|
/// <param name="WhetherPoint"></param>
|
|
|
/// <returns></returns>
|
|
|
- private bool WhetherInRange(PointF[] inPoints, PointF WhetherPoint)
|
|
|
+ private bool WhetherInRange(DParticle Part,/* PointF[] inPoints, */PointF WhetherPoint)
|
|
|
{
|
|
|
- bool b_inrange = false;
|
|
|
- GraphicsPath myGraphicsPath = new GraphicsPath();
|
|
|
- Region myRegion = new Region();
|
|
|
- myGraphicsPath.Reset();
|
|
|
-
|
|
|
- myGraphicsPath.AddPolygon(inPoints);
|
|
|
- myRegion.MakeEmpty();
|
|
|
- myRegion.Union(myGraphicsPath);
|
|
|
- //返回判断点是否在多边形里
|
|
|
- b_inrange = myRegion.IsVisible(WhetherPoint);
|
|
|
- return b_inrange;
|
|
|
+ var rect = Part.Rect;
|
|
|
+ if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
|
|
|
+ {
|
|
|
+ var itm = (BaseObject)Part;
|
|
|
+ PointF[] inPoints = itm.GPath.PathPoints;
|
|
|
+ bool b_inrange = false;
|
|
|
+ GraphicsPath myGraphicsPath = new GraphicsPath();
|
|
|
+ Region myRegion = new Region();
|
|
|
+ myGraphicsPath.Reset();
|
|
|
+
|
|
|
+ myGraphicsPath.AddPolygon(inPoints);
|
|
|
+ myRegion.MakeEmpty();
|
|
|
+ myRegion.Union(myGraphicsPath);
|
|
|
+ //返回判断点是否在多边形里
|
|
|
+ b_inrange = myRegion.IsVisible(WhetherPoint);
|
|
|
+ return b_inrange;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|