فهرست منبع

optimize the particle revision function

gsp 3 سال پیش
والد
کامیت
855b3eba13

+ 5 - 5
OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureDisplayResult.cs

@@ -347,8 +347,8 @@ namespace OTSMeasureApp
                     //已完成帧图的绘制 根据位置-判断相差范围  四舍五入返回的数值有偏差
                     int minTempRange = minRange;
                     int maxTempRange = maxRange;
-                    int XOffice = 0;
-                    int YOffice = 0;
+                    int XOffset = 0;
+                    int YOffset = 0;
                     //以放大倍数 获取当前倍数扫描尺寸 与100倍扫描尺寸的比例
                     int ScanFieldSize = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize();
                     int ScanFieldSize100 = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize100();
@@ -360,9 +360,9 @@ namespace OTSMeasureApp
                     }
                     for (int i = OTSSamplespaceWindow.m_SingleGDIObjects.Count - 1; i >= 0; i--)
                     {
-                        XOffice = OTSSamplespaceWindow.m_SingleGDIObjects[i].OTSX - CurrentFIELDOTSPoint.X;
-                        YOffice = OTSSamplespaceWindow.m_SingleGDIObjects[i].OTSY - CurrentFIELDOTSPoint.Y;
-                        if ((minTempRange < XOffice) && (XOffice < maxTempRange) && (minTempRange < YOffice) && (YOffice < maxTempRange))
+                        XOffset= OTSSamplespaceWindow.m_SingleGDIObjects[i].OTSX - CurrentFIELDOTSPoint.X;
+                        YOffset = OTSSamplespaceWindow.m_SingleGDIObjects[i].OTSY - CurrentFIELDOTSPoint.Y;
+                        if ((minTempRange < XOffset) && (XOffset < maxTempRange) && (minTempRange < YOffset) && (YOffset < maxTempRange))
                         {
                             //修改完成状态
                             OTSSamplespaceWindow.m_SingleGDIObjects[i].SelColor = changeColor;

+ 1 - 7
OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs

@@ -665,13 +665,7 @@ namespace OTSMeasureApp
             SMPara.sHoleName = WSample.GetSampleHoleName(); //获取样品孔名称
             SMPara.MeasureRect = (Rectangle)WSample.GetMsrArea().GetRectDomain();  //样品测量区域
 
-            //改变测量区域后重新设置样品修改状态
-            //m_ResultData.SetModify(true);
-            //string pathName = m_ProjDataMgr.GetPathName();
-            //if (pathName != "" && pathName != "Untitled")
-            //{
-            //    m_ProjDataMgr.Save();
-            //}
+     
             return SMPara;
 
         }

+ 34 - 34
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceGraphicsPanelFun.cs

@@ -625,7 +625,7 @@ namespace OTSMeasureApp
         /// <param name="m_MeasureAppForm"></param>
         /// <param name="sampleName"></param>
         /// <returns></returns>
-        public static SampleMeasurePara GetMeasureInfo(OTSIncAMeasureAppForm m_MeasureAppForm, string sampleName, ARectangleGDIObject item, ARectangleGDIObject m_RectangleGDIObjects, StageDrawingData oTSSampleStageData, int wDomain, int w)
+        public static SampleMeasurePara GetMeasureInfo( string sampleName, ARectangleGDIObject item,  int wDomain, int w)
         {
             SampleMeasurePara sampleMeasurePara = new SampleMeasurePara();
             foreach (ARectangleGDIObject measureItem in OTSSamplespaceWindow.m_MeasureGDIObjects)
@@ -679,7 +679,7 @@ namespace OTSMeasureApp
             return sampleMeasurePara;
         }
 
-        public static SampleHolePara GetSampleHoleInfo(OTSIncAMeasureAppForm m_MeasureAppForm, string sampleHoleName, ARectangleGDIObject item, ARectangleGDIObject m_RectangleGDIObjects, StageDrawingData oTSSampleStageData, int wDomain, int w)
+        public static SampleHolePara GetSampleHoleInfo(string sampleHoleName, ARectangleGDIObject item, int wDomain, int w)
         {
             SampleHolePara sampleHolePara = new SampleHolePara();
             foreach (ARectangleGDIObject sampleHoleItem in OTSSamplespaceWindow.m_SampleHoleGDIObjects)
@@ -717,20 +717,20 @@ namespace OTSMeasureApp
         /// 获取工作样品的测量区域信息
         /// </summary>
         /// <returns></returns>
-        public static Rectangle GetWorkMeasure(OTSIncAMeasureAppForm m_MeasureAppForm, ARectangleGDIObject m_RectangleGDIObjects, StageDrawingData oTSSampleStageData, int wDomain, int w)
-        {
-            foreach (ARectangleGDIObject itemMeasure in OTSSamplespaceWindow.m_MeasureGDIObjects)
-            {
-                if (itemMeasure.IsWorkSample)
-                {
-                    Point startPoint = new Point(itemMeasure.Region.Left, itemMeasure.Region.Top);
-                    Point endPoint = new Point(itemMeasure.Region.Right, itemMeasure.Region.Bottom);
-                    SampleMeasurePara rectMaesure = GetMeasureInfo(m_MeasureAppForm, itemMeasure.SampleName, itemMeasure, m_RectangleGDIObjects, oTSSampleStageData, wDomain, w);
-                    return rectMaesure.MeasureRect;
-                }
-            }
-            return new Rectangle();
-        }
+        //public static Rectangle GetWorkMeasure( int wDomain, int w)
+        //{
+        //    foreach (ARectangleGDIObject itemMeasure in OTSSamplespaceWindow.m_MeasureGDIObjects)
+        //    {
+        //        if (itemMeasure.IsWorkSample)
+        //        {
+        //            Point startPoint = new Point(itemMeasure.Region.Left, itemMeasure.Region.Top);
+        //            Point endPoint = new Point(itemMeasure.Region.Right, itemMeasure.Region.Bottom);
+        //            SampleMeasurePara rectMaesure = GetMeasureInfo(itemMeasure.SampleName, itemMeasure,  wDomain, w);
+        //            return rectMaesure.MeasureRect;
+        //        }
+        //    }
+        //    return new Rectangle();
+        //}
         #endregion
 
         #region 删除样品弹出提示
@@ -811,21 +811,21 @@ namespace OTSMeasureApp
         #endregion
 
         #region 计算两个点之间的距离 (图形中心与屏幕中心相差的距离)
-        public static Point RegionCenterToScreenCenterDist(ARectangleGDIObject regionCneter, Point screenCneter)
-        {
-            Point differentPoint = new Point();
-            //获取图形中心位置
-            Rectangle rectangle = new Rectangle();
-            rectangle.X = (int)regionCneter.RegionF.X;
-            rectangle.Y = (int)regionCneter.RegionF.Y;
-            rectangle.Width = (int)regionCneter.RegionF.Width;
-            rectangle.Height = (int)regionCneter.RegionF.Height;
-            Point m_RegionCenter = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(rectangle);
-            //获取图形中心与屏幕中心相差的距离
-            differentPoint.X = m_RegionCenter.X - screenCneter.X;
-            differentPoint.Y = m_RegionCenter.Y - screenCneter.Y;
-            return differentPoint;
-        }
+        //public static Point RegionCenterToScreenCenterDist(ARectangleGDIObject regionCneter, Point screenCneter)
+        //{
+        //    Point differentPoint = new Point();
+        //    //获取图形中心位置
+        //    Rectangle rectangle = new Rectangle();
+        //    rectangle.X = (int)regionCneter.RegionF.X;
+        //    rectangle.Y = (int)regionCneter.RegionF.Y;
+        //    rectangle.Width = (int)regionCneter.RegionF.Width;
+        //    rectangle.Height = (int)regionCneter.RegionF.Height;
+        //    Point m_RegionCenter = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(rectangle);
+        //    //获取图形中心与屏幕中心相差的距离
+        //    differentPoint.X = m_RegionCenter.X - screenCneter.X;
+        //    differentPoint.Y = m_RegionCenter.Y - screenCneter.Y;
+        //    return differentPoint;
+        //}
         #endregion
         
         #region 清除List中所有信息
@@ -880,7 +880,7 @@ namespace OTSMeasureApp
             if (returnResult)
             {
                 //获取测量区域的OTS位置与尺寸
-                sampleMeasureParas = OTSSamplespaceGraphicsPanelFun.GetMeasureInfo(m_MeasureAppForm, MeasureItem.SampleName, MeasureItem, m_RectangleGDIObjects, oTSSampleStageData, wDomain, w);
+                sampleMeasureParas = OTSSamplespaceGraphicsPanelFun.GetMeasureInfo( MeasureItem.SampleName, MeasureItem,   wDomain, w);
                 //获取工作区域位置与尺寸
                 Rectangle WorkAreaRect = new Rectangle(0, 0, Width, Height);
                 //获取工作区域 中心点
@@ -912,12 +912,12 @@ namespace OTSMeasureApp
             return sampleMeasureParas;
         }
 
-        public static SampleHolePara GetSampleHoleRect(ARectangleGDIObject sampleHoleItem, OTSIncAMeasureAppForm m_MeasureAppForm, StageDrawingData oTSSampleStageData, ARectangleGDIObject m_RectangleGDIObjects, int IsWidth, int Width, int Height, int wDomain)
+        public static SampleHolePara GetSampleHoleRect(ARectangleGDIObject sampleHoleItem, ARectangleGDIObject m_RectangleGDIObjects, int IsWidth, int Width, int Height, int wDomain)
         {
             int w = (IsWidth == 0 ? Width : Height);
             SampleHolePara sampleHoleParas = new SampleHolePara();
             //获取样品孔的OTS位置与尺寸
-            sampleHoleParas = OTSSamplespaceGraphicsPanelFun.GetSampleHoleInfo(m_MeasureAppForm, sampleHoleItem.Name, sampleHoleItem, m_RectangleGDIObjects, oTSSampleStageData, wDomain, w);
+            sampleHoleParas = OTSSamplespaceGraphicsPanelFun.GetSampleHoleInfo( sampleHoleItem.Name, sampleHoleItem, wDomain, w);
             //获取工作区域位置与尺寸
             Rectangle WorkAreaRect = new Rectangle(0, 0, Width, Height);
             //获取工作区域 中心点

+ 10 - 10
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -3871,12 +3871,12 @@ namespace OTSMeasureApp
     
                 #region 获取当前工作的测量区域信息
                 //是否获取过帧图标识
-                bool IsSingle = false;
+                bool IsPolygon = false;
                 if (m_MeasureAppForm.m_MessageStates == (int)MessageState.StartMeasure)
                 {
                     //设置测量区域形状与位置
-                    IsSingle = SetWorkSampleMeasureArea();
-                    if (!IsSingle)
+                    IsPolygon = SetWorkSampleMeasureArea();
+                    if (!IsPolygon)
                     {
                         return;
                     }
@@ -3889,7 +3889,7 @@ namespace OTSMeasureApp
                     m_MeasureAppForm.UpdatePropertyVal();
                 }
                 //如果当前工作样品是多边形则设置回原测量区域参数
-                if (IsSingle)
+                if (IsPolygon)
                 {
                     foreach (var MeasureItem in m_MeasureGDIObjects)
                     {
@@ -3921,6 +3921,7 @@ namespace OTSMeasureApp
                     Point pt = new Point(m_RectFieldRects[i].X, m_RectFieldRects[i].Y);
                     pt.X = m_RectFieldRects[i].X - m_RectFieldRects[i].Width / 2;
                     pt.Y = m_RectFieldRects[i].Y + m_RectFieldRects[i].Height / 2;
+
                     //获取Rectang 两点信息
                     Point XSTD = new Point(m_RectFieldRects[i].Left, m_RectFieldRects[i].Top);
                     Point YSTD = new Point(m_RectFieldRects[i].Right, m_RectFieldRects[i].Bottom);
@@ -4110,8 +4111,7 @@ namespace OTSMeasureApp
                 List<double> SemLocation = new List<double>();
                 if (GetSemLocation(ref SemLocation))
                 {
-                    //SemLocation[0] = 60000;
-                    //SemLocation[1] = 60000;
+                   
                     Point OTSLocation = m_MeasureAppForm.m_ProjParam.ConverSEMToOTSPoint(new Point((int)Math.Round(SemLocation[(int)XYIndex.X], 0), (int)Math.Round(SemLocation[(int)XYIndex.Y], 0)));
                     //转换为工作区域位置坐标
                     int w = (int)OTSSamplespaceGraphicsPanelFun.MillimetersToPixelsWidth(m_WDomain, Convert.ToDouble(OTSLocation.X), IsWidth, m_DefaultW, m_DefaultH);
@@ -4611,7 +4611,7 @@ namespace OTSMeasureApp
                         {
                             if (sampleHoleItem.Name == sampleHoleInfo.sSHoleName)
                             {
-                                SampleHolePara sampleHolePara = OTSSamplespaceGraphicsPanelFun.GetSampleHoleRect(sampleHoleItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain);
+                                SampleHolePara sampleHolePara = OTSSamplespaceGraphicsPanelFun.GetSampleHoleRect(sampleHoleItem, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain);
                                 iShape = (DOMAIN_SHAPE)sampleHolePara.iShape;
                                 Srect = sampleHolePara.SampleHoleRect;
                                 //设置测量区域形状
@@ -4771,7 +4771,7 @@ namespace OTSMeasureApp
         #region 设置工作样品测量区域
         public bool SetWorkSampleMeasureArea(int shape = 0)
         {
-            bool IsSingle = false;
+            bool isPolygon = false;
             //获取当前工作的测量区域信息
             CDomain cDomain = new CDomain();
             DOMAIN_SHAPE iShape = 0;
@@ -4785,7 +4785,7 @@ namespace OTSMeasureApp
                 {
                     if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                     {
-                        IsSingle = true;
+                        isPolygon = true;
                         SampleMeasurePara sampleMeasure = GetSampleMeasureRect(MeasureItem);
                         if (sampleMeasure.PolygonPointRegion == null)
                         {
@@ -4820,7 +4820,7 @@ namespace OTSMeasureApp
                     break;
                 }
             }
-            return IsSingle;
+            return isPolygon;
         }
         #endregion
 

+ 5 - 6
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -1650,23 +1650,22 @@ namespace OTSIncAReportGraph.Controls
 
                 Point sem_point = (Point)in_obj;
 
-                //第一步,连接电镜
-                ReportFun.ConnectToSEM();
+              
 
-                Thread.Sleep(500);
+                //Thread.Sleep(500);
 
                 //第二步,移动到指定位置,先读取再设置
-                if (ReportFun.m_SEMConnectionState == true)
+                if (ReportFun.ConnectToIpcSvr())
                 {
 
                     ReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
 
                 }
 
-                Thread.Sleep(1500);
+                //Thread.Sleep(1500);
 
                 //第三步,断开电镜连接
-                ReportFun.DisConnectSEM();
+                //ReportFun.DisConnectSEM();
 
                
 

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs

@@ -929,7 +929,7 @@ namespace OTSIncAReportGraph.Controls
                 Point sem_point = (Point)in_obj;
 
                 //第一步,连接电镜
-                m_ReportFun.ConnectToSEM();
+                m_ReportFun.ConnectToIpcSvr();
 
                 Thread.Sleep(500);
 

+ 8 - 25
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -75,7 +75,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         public  ServiceInterface.HardwareController m_cfun = null;
 
         //是否已经连接到了电镜
-        public bool m_SEMConnectionState = false;
+        //public bool m_SEMConnectionState = false;
 
         //连接到电镜的ID号
         public int m_SEM_ID = 0;
@@ -254,34 +254,17 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         /// <summary>
         /// 连接电镜,分布图使用
         /// </summary>
-        public void ConnectToSEM()
+        public bool ConnectToIpcSvr()
         {
            
          
-            log.Trace("(Connection_ForDrawDistrbutionImageAndBSE)" + "Connect to SEM");
-            if (!m_SEMConnectionState)
-            {
-
+         
 
                 //和电镜建立通讯连接
-                m_SEMConnectionState = m_cfun.Connect();
-             
-                log.Trace("(Connection_ForDrawDistrbutionImageAndBSE)" + "Connect to SEM" + ":--" + m_SEMConnectionState + "---");
-
-        
-            }
-            else
-            {
-             
-                log.Trace("(Connection_ForDrawDistrbutionImageAndBSE)" + ":allready connected, state:" + m_SEMConnectionState);
-                //断开电镜连接
-            }
-        }
-        public void DisConnectSEM()
-        {
-            m_SEMConnectionState = false;
-            m_cfun.DisConnect();
+            return  m_cfun.ConnectToIpcSvr();
+         
         }
+       
 
 
             /// <summary>
@@ -299,7 +282,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             double ls_PositionY = 0;
             double ls_PositionR = 0;
 
-            if (m_SEMConnectionState)
+            if (m_cfun.ConnectToIpcSvr())
             {
                 m_cfun.GetSemPositionXY(ref ls_PositionX, ref ls_PositionY, ref ls_PositionR);
             }
@@ -309,7 +292,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
                 return;
             }
 
-            if (m_SEMConnectionState)
+            if (m_cfun.ConnectToIpcSvr())
             {
                 m_cfun.MoveSEMToPoint(new Point((int)in_PositionX, (int)in_PositionY), ls_PositionR);
             }

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Grids/OTSIncAReportGridsFuncation/OTSReportGridsFun.cs

@@ -161,7 +161,7 @@ namespace OTSIncAReportGrids.OTSIncAReportGridsFuncation
             if (!m_SEMConnectionState)
             {
 
-                m_SEMConnectionState = m_cfun.Connect();
+                m_SEMConnectionState = m_cfun.ConnectToIpcSvr();
                 
             }
            

+ 7 - 7
OTSIncAReportApp/3-ServiceCenter/HardwareController.cs

@@ -36,7 +36,7 @@ namespace ServiceInterface
 
         }
 
-        public bool Connect()
+        public bool ConnectToIpcSvr()
         {
             if (!ifConnect)
             {
@@ -57,13 +57,13 @@ namespace ServiceInterface
             return true;
         }
 
-        public bool DisConnect()
-        {
-            //remoteObj = null;
-            ifConnect = false;
+        //public bool DisConnect()
+        //{
+        //    //remoteObj = null;
+        //    ifConnect = false;
 
-            return true;
-        }
+        //    return true;
+        //}
 
         public bool SetMagnification(double a_dMagnification)
         {