Browse Source

refactor the stage and measure area animation display part in the measure system.

gsp 3 years ago
parent
commit
331ebbb887
26 changed files with 905 additions and 3164 deletions
  1. 1 2
      OTSCPP/OTSRptCalculate/Model/PropItem.cpp
  2. 10 10
      OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs
  3. 21 34
      OTSIncAMeasureApp/0-OTSModel/Measure/ParamData/COTSMsrPrjResultData.cs
  4. 15 1
      OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSImageProcParam.cs
  5. 1 2
      OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSSample.cs
  6. 2 2
      OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleParam.cs
  7. 8 8
      OTSIncAMeasureApp/0-OTSModel/OTSDataType/SEMStageData.cs
  8. 4 4
      OTSIncAMeasureApp/1-OTSMeasure/CMeasureThreadWrapper.cs
  9. 34 176
      OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureDisplayResult.cs
  10. 2 12
      OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureResultWindow.cs
  11. 16 16
      OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs
  12. 12 10
      OTSIncAMeasureApp/2-OTSMeasureParamManage/MeasureParam.cd
  13. 3 10
      OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.cs
  14. 0 791
      OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CStageManage.cs
  15. 88 63
      OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CreateRectangle.cs
  16. 52 779
      OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceGraphicsPanelFun.cs
  17. 407 472
      OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs
  18. 67 115
      OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SEMDATAFieldManage.cs
  19. 66 51
      OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs
  20. 18 32
      OTSIncAMeasureApp/6-OTSDisplayTreeViewData/OTSSolutionWindow.cs
  21. 0 466
      OTSIncAMeasureApp/8-OTSSampleMeasureInfo/OTSSampleData.cs
  22. 3 18
      OTSIncAMeasureApp/8-OTSSampleMeasureInfo/OTSSampleMeasureInfo.cs
  23. 4 2
      OTSIncAMeasureApp/OTSIncAMeasureApp.csproj
  24. 66 83
      OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs
  25. 2 2
      OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs
  26. 3 3
      OTSIncAMeasureApp/ServiceCenter/DTLBase/SQliteHelper.cs

+ 1 - 2
OTSCPP/OTSRptCalculate/Model/PropItem.cpp

@@ -1,7 +1,6 @@
 #include "stdafx.h"
 #include "PropItem.h"
-//#include "MultiLang.h"
-//#include "OTSDATAresource.h"		
+	
 
 namespace OTSMODEL {
 	

+ 10 - 10
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -34,13 +34,13 @@ namespace OTSModelSharp
 
        protected CSmplMsrResult m_pSampleRstFile;
         CHoleBSEImgsList m_listHoleBSEImg;
-        //CFunExportClass loger;
+        
         protected SemController m_SemHardwareMgr;
         protected ScanController m_ScanHardwareMgr;
         protected EDSController m_EDSHardwareMgr;
       
         protected Queue<COTSFieldData> fieldQueue=new Queue<COTSFieldData>();
-        //protected COTSFieldData curFldData;
+      
         protected IClassifyEngine m_classifyEngine;
         public CSmplMeasure()
         {
@@ -63,7 +63,7 @@ namespace OTSModelSharp
 
           
             m_strWorkingFolder = a_strWorkingFolder;
-            m_pSampleRstFile = new CSmplMsrResult( a_strWorkingFolder,  a_pSample);// new CSmplMsrResultFile(m_strWorkingFolder,a_pSample);
+            m_pSampleRstFile = new CSmplMsrResult( a_strWorkingFolder,  a_pSample);
             m_SemHardwareMgr = SemController.GetSEMController();
             m_ScanHardwareMgr = ScanController.GetScanController();
             m_EDSHardwareMgr = EDSController.GetEDSController();
@@ -91,13 +91,13 @@ namespace OTSModelSharp
         bool SetSEMDataMrs()
         {
             var pSEMDataMsr = m_Sample.GetSEMDataMsr();
-            //ASSERT(pSEMDataMsr);
+          
             double dMag = pSEMDataMsr.GetMagnification();
             double dWorkDis = pSEMDataMsr.GetWorkingDistance();
 
            
             var pSEMCtrl = m_pMsrThread.GetSEMController();
-            // get SEM controller
+         
             if (!pSEMCtrl.IsConnected())
             {
                 if (!pSEMCtrl.Connect())
@@ -465,7 +465,7 @@ namespace OTSModelSharp
             int hardWareDelay = a_pCSEMStageData.GetHardWareDelay();
 
 
-            if (!a_pCSEMStageData.ConverOTSToSEMPoint(a_poi, ref a_SEMpt))
+            if (!a_pCSEMStageData.ConvertOTSToSEMCoord(a_poi, ref a_SEMpt))
             {
                 return false;
             }
@@ -835,8 +835,8 @@ namespace OTSModelSharp
                     MsgFieldEnd.STMSampleRetData.SFieldData.FieldPos.Y = Convert.ToInt32(poiFieldCentre.Y);
 
                     m_pMsrThread.SendMessageToMeasureApp(MsgFieldEnd);
-           
 
+                    COTSSample theSample = m_Sample;
                 }
                 while (bSaveThreadWorking)//wait untill all the field data has been saved.
                 {
@@ -903,7 +903,7 @@ namespace OTSModelSharp
             curFldData.SetBSEImage(a_pBSEImg);
             CSEMStageData a_pCSEMStageData = m_pMsrThread.GetProjResultData().GetSEMStageData();
             Point semPos = new Point();
-            a_pCSEMStageData.ConverOTSToSEMPoint(fldCenter, ref semPos);
+            a_pCSEMStageData.ConvertOTSToSEMCoord(fldCenter, ref semPos);
 
             curFldData.SetSemPos(semPos);
 
@@ -1144,7 +1144,7 @@ namespace OTSModelSharp
                 Point pos = new Point((int)posX, (int)posY);
                 Point otsPos = new Point(0, 0);
 
-                if (!a_pCSEMStageData.ConverSEMToOTSPoint(pos, ref otsPos)) 
+                if (!a_pCSEMStageData.ConvertSEMToOTSCoord(pos, ref otsPos)) 
                 {
                     return;
                 }
@@ -1556,7 +1556,7 @@ namespace OTSModelSharp
 
                 Point fldOtsPos = new Point(curFldData.OTSPos.X, curFldData.OTSPos.Y);
                 Point semPos = new Point();
-                pCSEMStageData.ConverOTSToSEMPoint(fldOtsPos, ref semPos);
+                pCSEMStageData.ConvertOTSToSEMCoord(fldOtsPos, ref semPos);
                 p.SetAbsolutPos(semPos);
             }
 

+ 21 - 34
OTSIncAMeasureApp/0-OTSModel/Measure/ParamData/COTSMsrPrjResultData.cs

@@ -15,6 +15,7 @@ using static OTSDataType.otsdataconst;
 using System.Xml;
 using OTSCLRINTERFACE;
 using OTSModelSharp.ServiceCenter;
+using System.Data;
 
 namespace OTSModelSharp
 {
@@ -110,27 +111,10 @@ namespace OTSModelSharp
 
         public void SetPathName(String a_strPathName) { m_strPathName = a_strPathName; }
 
-        public bool Load()
+        public bool Load(string strPathName)
         {
 
-            String strPathName = "";
-
-            strPathName.Trim();
-            if (strPathName == "")
-            {
-                // file open dialog
-                OpenFileDialog openFileDialog = new OpenFileDialog();
-                if (openFileDialog.ShowDialog() != DialogResult.OK)
-                {
-                    return false;
-
-                }
-
-
-                strPathName = openFileDialog.FileName;
-            }
-
-            //Init data
+           
             Cleanup();
 
             // check if the file exist 
@@ -175,11 +159,11 @@ namespace OTSModelSharp
                 CIncAFileMgr pIncAFileMgr = new CIncAFileMgr(strIncAFilename);
                 List<COTSFieldData> allFlds = new List<COTSFieldData>();
                 CMsrSampleStatus poMsrStatus = new CMsrSampleStatus();
-                poMsrStatus.GetStatus();
+                //poMsrStatus.GetStatus();
                 CMsrDisplayResults poMsrResults = smpl.GetMsrResults();
                 double aFldArea = smpl.CalculateAFieldArea();
                 SetPathName(strIncAFilename);
-                if (GetAllFieldsFromDB(ref allFlds, poMsrStatus, poMsrResults, aFldArea))
+                if (GetAllFieldsFromDB(ref allFlds,ref poMsrStatus, poMsrResults, aFldArea))
                 {
                     smpl.SetFieldsData(allFlds);
                     // file validation
@@ -258,7 +242,7 @@ namespace OTSModelSharp
         // file pathname
         public String GetPathName() { return m_strPathName; }
 
-        public bool GetAllFieldsFromDB(ref List<COTSFieldData> allFlds, CMsrSampleStatus status, CMsrDisplayResults rst, double aFieldArea)
+        public bool GetAllFieldsFromDB(ref List<COTSFieldData> allFlds, ref CMsrSampleStatus status, CMsrDisplayResults rst, double aFieldArea)
         {
             String sDatabaseName = m_strPathName;
 
@@ -287,7 +271,7 @@ namespace OTSModelSharp
                     fldvec+=curFldId.ToString();
                     fldvec+="_";
                     fldvec += xrayId.ToString();
-                    //auto cXray = mapXrayInfo.find(fldvec);
+                    
                     if (mapXrayInfo.ContainsKey(fldvec))
                     {
                         var xray = mapXrayInfo[fldvec];
@@ -311,7 +295,7 @@ namespace OTSModelSharp
                     fldvec+=curFldId.ToString();
                     fldvec += "_";
                     fldvec += xrayId.ToString();
-                    //auto cXray = mapXrayData.find(fldvec);
+                  
                     if (mapXrayData.ContainsKey(fldvec))
                     {
                         var xray = mapXrayData[fldvec];
@@ -371,7 +355,7 @@ namespace OTSModelSharp
                        
                         msrFldsArea += aFieldArea;
                     }
-                    completedflds.Add(fld.GetOTSPosition());
+                
 
 
                 }
@@ -384,9 +368,17 @@ namespace OTSModelSharp
                 m_GenInfoDB.GetStringValue(m_GenInfoDB.GetTableItemNameTimeStart(), ref strTimeStart);
                 m_GenInfoDB.GetStringValue(m_GenInfoDB.GetTableItemNameTimeEnd(), ref strTimeEnd);
                 m_GenInfoDB.GetStringValue(m_GenInfoDB.GetTableItemNameResultStatus(), ref strRstStatus);
+                var fielddb = incAFileMgr.GetFieldDB();
+                var fielddata = fielddb.GetTableQueryForDataTable();
+
+                foreach (DataRow r in fielddata.Rows)
+                {
+                    var p = new Point(Convert.ToInt32( r[(int)CFieldTable.ColumnID.N_FIELDPOS_X]),Convert.ToInt32( r[(int)CFieldTable.ColumnID.N_FIELDPOS_Y]));
+                    completedflds.Add(p);
+                }
 
                 status.SetCompletedFieldsCenter(completedflds);
-                //status.SetCompletedFields(completedflds.Count);
+              
 
                 DateTime timeStart, timeEnd;
                 try
@@ -421,6 +413,7 @@ namespace OTSModelSharp
                     rstItm.SetTypeId(typeParticles.Key);
                     rstItm.SetNumber((uint)typeNum);
                     rstItm.SetArea((uint)typeArea);
+                    rstItm.SetName(typeParticles.Value[0].GetTypeName());
                     rstItms.Add(rstItm);
                     allPartArea += typeArea;
                 }
@@ -1571,10 +1564,7 @@ namespace OTSModelSharp
                 xSystype.AssignValue(m_nPackId.ToString());
                 xstrPathName.AssignValue(m_strPathName);
                 xholeBSEImgs.Clear();
-                //foreach (var hole in m_listHoleBSEImg)
-                //{
-                //    xholeBSEImgs.addItem(hole);
-                //}
+             
                 xsamples.Clear();
                 foreach (var sample in m_listSamples)
                 {
@@ -1588,10 +1578,7 @@ namespace OTSModelSharp
                 slo.Serialize(false, classDoc, rootNode);
                 m_strPathName = xstrPathName.value();
                 m_listHoleBSEImg.Clear();
-                //for (int i = 0; i < xholeBSEImgs.size(); i++)
-                //{
-                //    m_listHoleBSEImg.Add(xholeBSEImgs.getItem(i));
-                //}
+              
                 m_listSamples.Clear();
                 for (int i = 0; i < (int)xsamples.size(); i++)
                 {

+ 15 - 1
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSImageProcParam.cs

@@ -26,7 +26,20 @@ namespace OTSDataType
 
         private CSpecialGrayRangeParam m_specialGreyRangeParam;
 
-        public CSpecialGrayRangeParam SpecialGreyRangeParam { get => m_specialGreyRangeParam; set => m_specialGreyRangeParam = value; }
+        public CSpecialGrayRangeParam GetSpecialGreyRangeParam()
+        {
+            if (m_specialGreyRangeParam == null)
+            {
+                m_specialGreyRangeParam = new CSpecialGrayRangeParam();
+            }
+
+            return m_specialGreyRangeParam;
+        }
+
+        public void SetSpecialGreyRangeParam(CSpecialGrayRangeParam value)
+        {
+            m_specialGreyRangeParam = value;
+        }
 
         public COTSImageProcParam()
         {
@@ -34,6 +47,7 @@ namespace OTSDataType
         }
         public COTSImageProcParam(COTSImageProcParam a_oSource)
         {
+            Init();
             // copy data over
             Duplicate(a_oSource);
         }

+ 1 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSSample.cs

@@ -2748,8 +2748,7 @@ namespace OTSDataType
                 case OTS_ITEM_TYPES.FILE_LIST:
                     {
                         //CMsrParams object represent a project param file. It includes PartSTD file ImgProcessParam ImgScanParam XrayParam four parts content.
-                        int iPos = -1;
-                        List<string> sFileNameList;
+                      
                         if (OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_PARAM_FILE_NAME == (OTS_SAMPLE_PROP_GRID_ITEMS)ItemID)
                         {
                             valStr = m_poMsrParams.GetName();

+ 2 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleParam.cs

@@ -40,7 +40,7 @@ namespace OTSDataType
         public void SetSpecialGrayRangeParam(CSpecialGrayRangeParam value)
         {
             m_specialGrayRangeParam = value;
-            m_poImageProcessParam.SpecialGreyRangeParam = value;
+            m_poImageProcessParam.SetSpecialGreyRangeParam(value);
         }
 
         public CSampleParam()
@@ -156,7 +156,7 @@ namespace OTSDataType
 
         }
         public COTSImgScanPrm GetImageScanParam() { return m_poImageScanParam; }
-        public COTSImageProcParam GetImageProcessParam() { m_poImageProcessParam.SpecialGreyRangeParam = m_specialGrayRangeParam; return m_poImageProcessParam; }
+        public COTSImageProcParam GetImageProcessParam() { m_poImageProcessParam.SetSpecialGreyRangeParam(m_specialGrayRangeParam); return m_poImageProcessParam; }
         public COTSXRayParam GetXRayParam() { return m_poXRayParam; }
         // STDSwitch
         public bool GetSysSTDSwitch() { return m_bSysSTDSwitch; }

+ 8 - 8
OTSIncAMeasureApp/0-OTSModel/OTSDataType/SEMStageData.cs

@@ -56,8 +56,8 @@ namespace OTSDataType
             System.Drawing.Point ptBRBSEM = rectBoundarySEM.Location;
             System.Drawing.Point ptTLBOTS = new System.Drawing.Point();
             System.Drawing.Point ptBRBOTS = new System.Drawing.Point();
-            ConverSEMToOTSPoint(ptTLBSEM, ref ptTLBOTS);
-            ConverSEMToOTSPoint(ptBRBSEM, ref ptBRBOTS);
+            ConvertSEMToOTSCoord(ptTLBSEM, ref ptTLBOTS);
+            ConvertSEMToOTSCoord(ptBRBSEM, ref ptBRBOTS);
             System.Drawing.Rectangle rectBoundaryOTS = new System.Drawing.Rectangle();//(ptTLBOTS, ptBRBOTS);
             a_pBoundary.SetDomainRect(rectBoundaryOTS);
 
@@ -67,8 +67,8 @@ namespace OTSDataType
             System.Drawing.Point ptBRSSEM = rectSTDSEM.Location;
             System.Drawing.Point ptTLSOTS = new System.Drawing.Point();
             System.Drawing.Point ptBRSOTS = new System.Drawing.Point();
-            ConverSEMToOTSPoint(ptTLSSEM, ref ptTLSOTS);
-            ConverSEMToOTSPoint(ptBRSSEM, ref ptBRSOTS);
+            ConvertSEMToOTSCoord(ptTLSSEM, ref ptTLSOTS);
+            ConvertSEMToOTSCoord(ptBRSSEM, ref ptBRSOTS);
             System.Drawing.Rectangle rectSTDOTS = new System.Drawing.Rectangle();// (ptTLSOTS, ptBRSOTS)
             a_pSTD.SetDomainRect(rectSTDOTS);
 
@@ -81,15 +81,15 @@ namespace OTSDataType
                 System.Drawing.Point ptBRHSEM = rectHoleSEM.Location;
                 System.Drawing.Point ptBRHOTS = new System.Drawing.Point();
                 System.Drawing.Point ptTLHOTS = new System.Drawing.Point();
-                ConverSEMToOTSPoint(ptTLHSEM, ref ptTLHOTS);
-                ConverSEMToOTSPoint(ptBRHSEM, ref ptBRHOTS);
+                ConvertSEMToOTSCoord(ptTLHSEM, ref ptTLHOTS);
+                ConvertSEMToOTSCoord(ptBRHSEM, ref ptBRHOTS);
                 System.Drawing.Rectangle rectHoleOTS = new Rectangle();// (ptTLHOTS, ptBRHOTS);
                 pHole.SetDomainRect(rectHoleOTS);
             }
 
             return true;
         }
-        public bool ConverSEMToOTSPoint(System.Drawing.Point a_SEMpt, ref System.Drawing.Point a_OTSpt)
+        public bool ConvertSEMToOTSCoord(System.Drawing.Point a_SEMpt, ref System.Drawing.Point a_OTSpt)
         {
 
 
@@ -138,7 +138,7 @@ namespace OTSDataType
 
             return true;
         }
-        public bool ConverOTSToSEMPoint(System.Drawing.Point a_OTSpt, ref System.Drawing.Point a_SEMpt)
+        public bool ConvertOTSToSEMCoord(System.Drawing.Point a_OTSpt, ref System.Drawing.Point a_SEMpt)
         {
         
 

+ 4 - 4
OTSIncAMeasureApp/1-OTSMeasure/CMeasureThreadWrapper.cs

@@ -20,7 +20,7 @@ namespace OTSMeasureApp
         public CMeasure m_MsrThread = null;
 
         //线程执行类型 1:测量 2:获取样品孔图片
-        public static int DoRunType = 1;
+        public static MSR_THREAD_RunSTATUS DoRunType = (MSR_THREAD_RunSTATUS)1;
         public static int m_HoleID;
         public static CDomain c_DomainMessure;
         NLog.Logger log ;
@@ -67,7 +67,7 @@ namespace OTSMeasureApp
         /// 设置线程类型
         /// </summary>
         /// <param name="doRunType">线程执行类型 1:测量类型 2:获取样品孔图片类型</param>
-        public void SetDoRunType(int doRunType)
+        public void SetDoRunType(MSR_THREAD_RunSTATUS doRunType)
         {
             DoRunType = doRunType;
         }
@@ -151,7 +151,7 @@ namespace OTSMeasureApp
         /// <param name="e"></param>
         private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
         {
-            if (DoRunType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+            if (DoRunType == MSR_THREAD_RunSTATUS.RUNMEASURE)
             {
                 InitMeasureThread(m_MeasureApp.m_ProjData);
 
@@ -159,7 +159,7 @@ namespace OTSMeasureApp
                 m_MsrThread.DoMeasure();
               
             }
-            else if (DoRunType == (int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
+            else if (DoRunType == MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
             {
                 InitMeasureThread(m_MeasureApp.m_ProjData);
 

+ 34 - 176
OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureDisplayResult.cs

@@ -29,8 +29,6 @@ namespace OTSMeasureApp
         OTSIncAMeasureAppForm m_MeasureApp = null;
       
        
-      
-       
         
         //样品台窗口对象
         public OTSSamplespaceWindow m_OTSSamplespaceWindow = null;
@@ -43,14 +41,10 @@ namespace OTSMeasureApp
         public OTSMeasureStatusWindow m_OTSMeasureStatusWindow = null;
         public System.ComponentModel.BackgroundWorker m_bgWorker;
       
-        //开始时间
-        static string m_StartTimePara = "";
-        //当前测试样品名称
-        static string m_CurrentSampleName = "";
+   
         ST_MSTMsg MeasureResultMsrData;
         //已完成帧图的绘制 根据位置-判断相差范围  四舍五入返回的数值有偏差
-        static int minRange = -100;
-        static int maxRange = 100;
+       
         #endregion
 
         #region 构造方法
@@ -104,7 +98,7 @@ namespace OTSMeasureApp
                             m_OTSMeasureResultWindow = m_MeasureApp.m_MeasureRetWindow;
                         }
                         //设置工作样品
-                        m_MeasureApp.m_ProjParam.SetWorkSample(OTSSamplespaceWindow.m_SampleSelectName);
+                        m_MeasureApp.m_ProjParam.SetWorkSample(m_OTSSamplespaceWindow.m_SampleSelectName);
                         //获取工作样品信息
                         COTSSample WSample = m_MeasureApp.m_ProjParam.GetWorkSample();
                         CMsrDisplayResults cMsrResultsClr = WSample.GetMsrResults();
@@ -120,7 +114,7 @@ namespace OTSMeasureApp
             }
             catch (Exception ex)
             {
-                log.Error("OTSIncAMeasureApp_backgroundWorker_ProgressChanged:--Open the measurement results list window - error log:" + ex.ToString());
+                log.Error( ex.ToString());
             }
         }
         #endregion
@@ -137,22 +131,7 @@ namespace OTSMeasureApp
 
 
 
-        #region 判断窗口是否已经打开
-        //判断窗口是否已经打开
-        private bool CheckFormIsOpen(string Forms)
-        {
-            bool bResult = false;
-            foreach (Form frm in Application.OpenForms)
-            {
-                if (frm.Name == Forms)
-                {
-                    bResult = true;
-                    break;
-                }
-            }
-            return bResult;
-        }
-        #endregion
+   
 
         #region 打开测量结果窗口
         /// <summary>
@@ -244,24 +223,6 @@ namespace OTSMeasureApp
         }
         #endregion
 
-        #region 设置结束时间
-        /// <summary>
-        /// 设置结束时间
-        /// </summary>
-        /// <param name="SetEndTime"></param>
-        public void SetEndTime(string endTime)
-        {
-            //设置开始时间
-            if (endTime != null)
-            {
-                if (endTime != "")
-                {
-                    //设置结束时间
-                    m_MeasureCheckReportInfoWindow.SetEndTime(endTime);
-                }
-            }
-        }
-        #endregion
 
         #region 设置测量结束窗体中信息内容
         public void SetMeasureResultInfo(ST_MSTMsg SMsrData)
@@ -283,7 +244,7 @@ namespace OTSMeasureApp
             Hashtable table= lan.GetNameTable("OTSMeasureResultWindow");
 
             //状态
-            //switch (SMsrData.STMThreadStu.SMsrCompleteData.MsrStatus)
+        
             switch (SMsrData.STMThreadStu.iMsrStatu)
             {
                 case OTS_MSR_THREAD_STATUS.COMPLETED:
@@ -321,98 +282,22 @@ namespace OTSMeasureApp
             {
                 if (sampleName != "")
                 {
-                    CStageManage.SetWorkSampleAndWorkMeasure(sampleName);
+                    m_MeasureApp.m_SamplepaceWindow.SetWorkSampleAndWorkMeasure(sampleName);
                     double iWDistance = 0;
                     double dMagni = 0;
                     m_MeasureApp.m_ProjParam.GetWorkingSampleSEMData(ref iWDistance, ref dMagni);
                     
-                    if (CMeasureThreadWrapper.DoRunType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                    if (CMeasureThreadWrapper.DoRunType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                     {
                         m_OTSMeasureResultWindow.SetSampleName(sampleName);
                     }
-                    m_OTSSamplespaceWindow.Invalidate();
+                    m_MeasureApp.m_SamplepaceWindow.Invalidate();
                 }
             }
         }
         #endregion
 
-        #region 更改已完成测量的帧图状态
-        public void ChangeDoneMeasureState(Point CurrentFIELDOTSPoint, Color changeColor)
-        {
-            //根据完成的测量帧图 更改帧图的完成状态
-            if (OTSSamplespaceWindow.m_SingleGDIObjects != null)
-            {
-                if (OTSSamplespaceWindow.m_SingleGDIObjects.Count > 0)
-                {
-                    //已完成帧图的绘制 根据位置-判断相差范围  四舍五入返回的数值有偏差
-                    int minTempRange = minRange;
-                    int maxTempRange = maxRange;
-                    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();
-                    float Scale = Convert.ToSingle(ScanFieldSize100) / Convert.ToSingle(ScanFieldSize);
-                    if (Scale > 0)
-                    {
-                        minTempRange = Convert.ToInt32(minTempRange / Scale);
-                        maxTempRange = Convert.ToInt32(maxTempRange / Scale);
-                    }
-                    for (int i = OTSSamplespaceWindow.m_SingleGDIObjects.Count - 1; i >= 0; i--)
-                    {
-                        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;
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-        public static int ChangeCompleteFieldMeasureState(List<Point> CompleteFieldList, Color changeColor, OTSIncAMeasureAppForm m_MeasureApp)
-        {
-
-
-            int CompleteCount = 0;
-            //根据完成的测量帧图 更改帧图的完成状态
-            if (OTSSamplespaceWindow.m_SingleGDIObjects != null)
-            {
-                if (OTSSamplespaceWindow.m_SingleGDIObjects.Count > 0)
-                {
-                    //已完成帧图的绘制 根据位置-判断相差范围  四舍五入返回的数值有偏差
-                    int minTempRange = minRange;
-                    int maxTempRange = maxRange;
-                    int XOffice = 0;
-                    int YOffice = 0;
-                    //以放大倍数 获取当前倍数扫描尺寸 与100倍扫描尺寸的比例
-                    int ScanFieldSize = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize();
-                    int ScanFieldSize100 = m_MeasureApp.m_ProjParam.GetResultData().GetWorkingSample().GetSEMDataMsr().GetScanFieldSize100();
-                    float Scale = ScanFieldSize100 / ScanFieldSize;
-                    minTempRange = Convert.ToInt32(minTempRange / Scale);
-                    maxTempRange = Convert.ToInt32(maxTempRange / Scale);
-                    for (int y = 0; y < CompleteFieldList.Count; y++)
-                    {
-                        for (int x = OTSSamplespaceWindow.m_SingleGDIObjects.Count - 1; x >= 0; x--)
-                        {
-                            XOffice = Convert.ToInt32((OTSSamplespaceWindow.m_SingleGDIObjects[x].OTSX - CompleteFieldList[y].X)/Scale);
-                            YOffice = Convert.ToInt32((OTSSamplespaceWindow.m_SingleGDIObjects[x].OTSY - CompleteFieldList[y].Y)/ Scale);
-                            if ((minTempRange < XOffice) && (XOffice < maxTempRange) && (minTempRange < YOffice) && (YOffice < maxTempRange))
-                            {
-                                //修改完成状态
-                                OTSSamplespaceWindow.m_SingleGDIObjects[x].SelColor = changeColor;
-                                CompleteCount++;
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-            return CompleteCount;
-        }
-        #endregion
+       
 
         #region 测量状态进度窗口
         public void MeasureStateProgressInfo(SAMPLEFIELDDATA FieldData)
@@ -461,7 +346,7 @@ namespace OTSMeasureApp
                 //测量状态:开始状态、完成状态(测量停止、测量失败、测量完成)
                 OTS_MSR_THREAD_STATUS msrStatus = SMsrData.STMThreadStu.iMsrStatu;
                 //获取当前线程执行类型 1:测量 2:获取样品孔图片
-                int runThreadType = CMeasureThreadWrapper.DoRunType;
+                var runThreadType = CMeasureThreadWrapper.DoRunType;
 
                 //获取需显示的grid信息
                 OTSSamplePropertyInfo MeasureInfo = new OTSSamplePropertyInfo();
@@ -476,25 +361,24 @@ namespace OTSMeasureApp
                             //测量状态在进行中-测量开始
                             case OTS_MSR_THREAD_STATUS.INPROCESS:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
 
                                     string startTime = SMsrData.STMThreadStu.csMsrStartTime;
-                                    //设置开始时间
-                                    m_StartTimePara = startTime;
+                             
                                      
                                 }
                                 //判断信息来源  拍摄样品孔图片 或是 测量开始 
                                 if (m_MeasureApp.m_MessageStates == MessageState.ShotBSEPicture)
                                 {
                                     //根据放大倍数、重新绘制帧图信息
-                                    m_MeasureApp.m_SamplepaceWindow.showSingleInfo();
+                                    m_MeasureApp.m_SamplepaceWindow.DrawMeasureField();
                                 }
                                 break;
                             //测量状态已完成
                             case OTS_MSR_THREAD_STATUS.COMPLETED:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
                                     string inprocessEndTime = SMsrData.STMThreadStu.csMsrEndTime;
                                     SetMeasureResultInfo(SMsrData);
@@ -505,10 +389,7 @@ namespace OTSMeasureApp
                                     m_MeasureApp.rbPReport.Enabled = true;
                                     m_MeasureApp.rbReport.Enabled = true;
                                 }
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
-                                {
-                                    SetRestoreWorkingDistanceAndMagnification();
-                                }
+                          
 
                                 //测量完成,更新Grid显示的测量信息
                                 m_MeasureApp.m_SPropertyWindows.DisplaySampleMeasureInfo(MeasureInfo);
@@ -516,17 +397,14 @@ namespace OTSMeasureApp
                             //测量状态已失败
                             case OTS_MSR_THREAD_STATUS.FAILED:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
                                     string failedEndTime = SMsrData.STMThreadStu.csMsrEndTime;
                                     SetMeasureResultInfo(SMsrData);
                                     MeasureResultMsrData = SMsrData;
                                     m_bgWorker.ReportProgress((int)ProgressState.MeasureCheckReport, SMsrData);
                                 }
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
-                                {
-                                    SetRestoreWorkingDistanceAndMagnification();
-                                }
+                          
 
                                 //测量失败,更新Grid显示的测量信息
                                 m_MeasureApp.m_SPropertyWindows.DisplaySampleMeasureInfo(MeasureInfo);
@@ -534,7 +412,7 @@ namespace OTSMeasureApp
                             //测量状态已停止
                             case OTS_MSR_THREAD_STATUS.STOPPED:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
                                     string stopEndTime = SMsrData.STMThreadStu.csMsrEndTime;
                                     //打开测量结果窗口
@@ -545,10 +423,7 @@ namespace OTSMeasureApp
                                     m_MeasureApp.rbPReport.Enabled = true;
                                     m_MeasureApp.rbReport.Enabled = true;
                                 }
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
-                                {
-                                    SetRestoreWorkingDistanceAndMagnification();
-                                }
+                          
 
                                 //测量停止,更新Grid显示的测量信息
                                 m_MeasureApp.m_SPropertyWindows.DisplaySampleMeasureInfo(MeasureInfo);
@@ -563,7 +438,7 @@ namespace OTSMeasureApp
                         {
                             case OTS_MSR_SAMPLE_STATUS.INPROCESS:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
                                     //获取样品名称
                                     string sampleName = SMsrData.STMSampleStu.cSampleName;
@@ -577,7 +452,7 @@ namespace OTSMeasureApp
                                             SetSampleName(sampleName);
                                             //设置开始时间
                                             SetStartTime(csSampleMsrStartTime);
-                                            m_CurrentSampleName = sampleName;
+                                          
                                         }
                                     }
                                     //切换样品
@@ -586,10 +461,9 @@ namespace OTSMeasureApp
                                     m_OTSMeasureResultWindow.SetSampleName(sampleName);
 
                                     
-                                    //填充帧图信息
-                                    OTSSamplespaceWindow.ChangeSampleFillSingleInfo(sampleName);
+                                    
                                 }
-                                else if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
+                                else if (runThreadType == MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
                                 {
                                     //获取样品名称
                                     string sampleName = SMsrData.STMSampleStu.cSampleName;
@@ -618,7 +492,7 @@ namespace OTSMeasureApp
                         {
                             case MSAMPLE_RET.BSE_DATA:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
                                     //获取显示BSE的图片数据
                                     byte[] ImageData = SMsrData.STMSampleRetData.BSEData.lpBSEData;
@@ -637,7 +511,7 @@ namespace OTSMeasureApp
                                   
 
                                 }
-                                else if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
+                                else if (runThreadType == MSR_THREAD_RunSTATUS.RUNSampleHoleImage)
                                 {
                                     //获取显示BSE的图片数据
                                     byte[] ImageData = SMsrData.STMSampleRetData.BSEData.lpBSEData;
@@ -653,7 +527,7 @@ namespace OTSMeasureApp
                                 break;
                             case MSAMPLE_RET.FIELD_DATA:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
                                     //设置测量当前用时
                                     if (SMsrData.STMSampleRetData.SFieldData.TUsedTime != null)
@@ -662,18 +536,18 @@ namespace OTSMeasureApp
                                     }
 
                                     MeasureStateProgressInfo(SMsrData.STMSampleRetData.SFieldData);
-                                    ChangeDoneMeasureState(SMsrData.STMSampleRetData.SFieldData.FieldPos, Color.Green);
-                                    m_OTSSamplespaceWindow.Invalidate();
+                                    m_MeasureApp.m_SamplepaceWindow. ChangeDoneMeasureState(SMsrData.STMSampleRetData.SFieldData.FieldPos, Color.Green);
+                                    m_MeasureApp.m_SamplepaceWindow.Invalidate();
 
                                 }
                                 break;
                             case MSAMPLE_RET.START_MSR_FIELD:
                                 //当前线程执行类型 1:测量
-                                if (runThreadType == (int)MSR_THREAD_RunSTATUS.RUNMEASURE)
+                                if (runThreadType == MSR_THREAD_RunSTATUS.RUNMEASURE)
                                 {
-                                    ChangeDoneMeasureState(SMsrData.STMSampleRetData.SMsrField.FieldPos, Color.Yellow);
-                                    //log.Warn("turn yellow!");
-                                    m_OTSSamplespaceWindow.Invalidate();
+                                    m_MeasureApp.m_SamplepaceWindow.ChangeDoneMeasureState(SMsrData.STMSampleRetData.SMsrField.FieldPos, Color.Yellow);
+                                   
+                                    m_MeasureApp.m_SamplepaceWindow.Invalidate();
                                 }
                                 break;
                         }
@@ -688,23 +562,7 @@ namespace OTSMeasureApp
 
 
         #endregion
-        #region 设置原放大倍数与工作距离
-        protected void SetRestoreWorkingDistanceAndMagnification()
-        {
-            //设置原放大倍数
-            double m_SEMIWDistance = OTSSamplespaceWindow.m_SEMIWDistance;
-            double m_SEMDMagni = OTSSamplespaceWindow.m_SEMDMagni;
-            double m_PropIWDistance = OTSSamplespaceWindow.m_PropIWDistance;
-            double m_PropDMagni = OTSSamplespaceWindow.m_PropDMagni;
-            //m_MeasureApp.m_ProjParam.
-            if (m_PropIWDistance != 0 && m_PropDMagni != 0)
-            {
-                m_MeasureApp.m_ProjParam.SetWorkingSampleSEMData(m_PropIWDistance, m_PropDMagni);
-            }
-            m_MeasureApp.m_SamplepaceWindow.SetSEMDATAMParameter(m_SEMDMagni,m_SEMIWDistance);
-            m_MeasureApp.m_ProjParam.SetFliedsCount(OTSSamplespaceWindow.m_TotalFieldsCount);
-        }
-        #endregion
+
 
     }
 }

+ 2 - 12
OTSIncAMeasureApp/1-OTSMeasure/OTSMeasureResultWindow.cs

@@ -136,17 +136,7 @@ namespace OTSMeasureApp
             dg_Info.DataSource = null;
             return true;
         }
-        ///// <summary>
-        ///// 设置当前帧图数
-        ///// </summary>
-        ///// <param name="fieldIndex"></param>
-        ///// <returns></returns>
-        //public bool SetCurrentData(string fieldIndex)
-        //{
-        //    //获取当前数据
-        //    lblSingleCount.Text = fieldIndex.ToString();
-        //    return false;
-        //}
+
         #region 显示操作
         /// <summary>
         /// 测量进度
@@ -187,7 +177,7 @@ namespace OTSMeasureApp
             }
             catch (Exception ex)
             {
-                log.Trace("OTSMeasureResultWindow_SetProgressInfo():" + ex.ToString());
+                log.Trace( ex.ToString());
             }
         }
         /// <summary>

+ 16 - 16
OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs

@@ -265,18 +265,18 @@ namespace OTSMeasureApp
  
 
         //将样品台坐标转换为Sem 坐标
-        public Point ChangeOTSToSemCoord(Point POTSCoord)
+        public Point ConvertOTSToSemCoord(Point POTSCoord)
         {
             System.Drawing.Point VSemCoord = new System.Drawing.Point();
-            GetDefaultParam().GetStageDataParam().ConverOTSToSEMPoint(POTSCoord, ref VSemCoord);
+            GetDefaultParam().GetStageDataParam().ConvertOTSToSEMCoord(POTSCoord, ref VSemCoord);
             return (Point)VSemCoord;
         }
 
         //将Sem 坐标转换为样品台坐标
-        public Point ConverSEMToOTSPoint(Point PSEMCoord)
+        public Point ConverSEMToOTSCoord(Point PSEMCoord)
         {
             System.Drawing.Point VOTSCoord = new System.Drawing.Point();
-            GetDefaultParam().GetStageDataParam().ConverSEMToOTSPoint(PSEMCoord, ref VOTSCoord);
+            GetDefaultParam().GetStageDataParam().ConvertSEMToOTSCoord(PSEMCoord, ref VOTSCoord);
             return (Point)VOTSCoord;
         }
 
@@ -635,13 +635,13 @@ namespace OTSMeasureApp
 
         //移动工作样品到其他样品孔,样品孔名称和测量区域都要改变,重新设置工作样品参数
         //SampleMeasurePara SMeasurePara:
-        public SampleMeasurePara SetWorkSampleHoleNameAndMeasureArea(SampleMeasurePara SMeasurePara)
+        public void SetWorkSampleHoleAndMeasureArea(SampleMeasurePara SMeasurePara)
         {
-            SampleMeasurePara SMPara = new SampleMeasurePara();
+            //SampleMeasurePara SMPara = new SampleMeasurePara();
             COTSSample WSample = GetResultData().GetWorkingSample();
             if (null == WSample)
             {
-                return SMPara;
+                return ;
             }
 
             CDomain Domain = new CDomain();
@@ -656,17 +656,17 @@ namespace OTSMeasureApp
                 }
                 Domain.SetPolygonPoint(PolygonPoint);
             }
-            WSample.SetSampleHoleName(SMeasurePara.sHoleName);
+            WSample.SetSampleHoleName(SMeasurePara.sampleHoleName);
             WSample.SetMsrArea(Domain);
 
             //获取样品的测量区域信息 
-            SMPara.sSampleName = WSample.GetName();    //获取样品名称
-            SMPara.iShape = (int)WSample.GetMsrArea().GetShape();  // 获取测量区域形状
-            SMPara.sHoleName = WSample.GetSampleHoleName(); //获取样品孔名称
-            SMPara.MeasureRect = (Rectangle)WSample.GetMsrArea().GetRectDomain();  //样品测量区域
+            //SMPara.sSampleName = WSample.GetName();    //获取样品名称
+            //SMPara.iShape = (ShapeType)WSample.GetMsrArea().GetShape();  // 获取测量区域形状
+            //SMPara.sHoleName = WSample.GetSampleHoleName(); //获取样品孔名称
+            //SMPara.MeasureRect = (Rectangle)WSample.GetMsrArea().GetRectDomain();  //样品测量区域
 
      
-            return SMPara;
+            return ;
 
         }
 
@@ -675,7 +675,7 @@ namespace OTSMeasureApp
 
         //设置测量区域的形状 (通过RIBBON 上的画圆,画矩形 设置)
         //int iShape:  测量区域形状 0: 圆形; 1 :矩形
-        public void SetMeasureAreaShape(int iShape)
+        public void SetMeasureAreaShape(ShapeType iShape)
         {
             //  SampleMeasurePara SMPara = new SampleMeasurePara();
             COTSSample WSample = GetResultData().GetWorkingSample();
@@ -1413,9 +1413,9 @@ namespace OTSMeasureApp
           
             SMeasureInfo.SMeasurePara.sSampleName = Sample.GetName();// (String)SMeasurePara.GetValue("sNewSampleName");
             // 获取测量区域形状
-            SMeasureInfo.SMeasurePara.iShape = (int)Sample.GetMsrArea().GetShape();// (int)SMeasurePara.GetValue("iShape");
+            SMeasureInfo.SMeasurePara.iShape = (ShapeType)Sample.GetMsrArea().GetShape();// (int)SMeasurePara.GetValue("iShape");
             //获取样品孔名称
-            SMeasureInfo.SMeasurePara.sHoleName = Sample.GetSampleHoleName();// (String)SMeasurePara.GetValue("sHoleName");
+            SMeasureInfo.SMeasurePara.sampleHoleName = Sample.GetSampleHoleName();// (String)SMeasurePara.GetValue("sHoleName");
                                                                              //样品测量区域
                                                                              // JObject rec = (JObject)SMeasurePara.GetValue("MeasureRect");
             Rectangle rec = Sample.GetMsrArea().GetDomainRect();

+ 12 - 10
OTSIncAMeasureApp/2-OTSMeasureParamManage/MeasureParam.cd

@@ -58,7 +58,7 @@
   <Class Name="OTSDataType.COTSSample" Collapsed="true">
     <Position X="8.75" Y="6.5" Width="2.5" />
     <TypeIdentifier>
-      <HashCode>UCEIgsIiY0kCoAAQiUmCAikAECCEYxABiIAPYEIgXJk=</HashCode>
+      <HashCode>UCEIgsIiY0kCoCAQiUmCAikAECCEZxABiIAPYEIgXJk=</HashCode>
       <FileName>0-OTSModel\OTSDataType\COTSSample.cs</FileName>
     </TypeIdentifier>
     <ShowAsAssociation>
@@ -77,7 +77,7 @@
       </Path>
     </AssociationLine>
     <TypeIdentifier>
-      <HashCode>IIQggICCQZAEZADnBDIAKkZAyCSAqCAEIjAqT0IQAIg=</HashCode>
+      <HashCode>IIQggICCQZAEZADnBDIAKkZAyCSAqCAEIDAqT0IQAIg=</HashCode>
       <FileName>0-OTSModel\Measure\ParamData\COTSMsrPrjResultData.cs</FileName>
     </TypeIdentifier>
     <ShowAsAssociation>
@@ -87,19 +87,21 @@
       <Field Name="m_listSamples" />
     </ShowAsCollectionAssociation>
   </Class>
-  <Class Name="OTSMeasureApp.OTSIncAMeasureAppForm">
+  <Class Name="OTSMeasureApp.OTSIncAMeasureAppForm" Collapsed="true">
     <Position X="2.5" Y="7.5" Width="2.75" />
     <AssociationLine Name="m_ProjData" Type="OTSModelSharp.COTSMsrPrjResultData" FixedFromPoint="true" FixedToPoint="true">
       <Path>
-        <Point X="5.25" Y="21.766" />
-        <Point X="6.94" Y="21.766" Type="JumpStart" />
-        <Point X="7.107" Y="21.766" Type="JumpEnd" />
-        <Point X="15.5" Y="21.766" />
+        <Point X="5.25" Y="7.833" />
+        <Point X="6.76" Y="7.833" Type="JumpStart" />
+        <Point X="6.927" Y="7.833" Type="JumpEnd" />
+        <Point X="10.042" Y="7.833" Type="JumpStart" />
+        <Point X="10.208" Y="7.833" Type="JumpEnd" />
+        <Point X="15.5" Y="7.833" />
         <Point X="15.5" Y="3.798" />
       </Path>
     </AssociationLine>
     <TypeIdentifier>
-      <HashCode>cIGadXIZ6PENrQ5bYEOxLjq7DEARCnwbVGsEIl+D4rk=</HashCode>
+      <HashCode>cIGadXIZ6PENrQ5bYEOxLzq7DEARCnwbVGsEIl+D4vk=</HashCode>
       <FileName>OTSIncAMeasureAppForm.cs</FileName>
     </TypeIdentifier>
     <ShowAsAssociation>
@@ -111,7 +113,7 @@
   <Class Name="OTSMeasureApp.CMeasureThreadWrapper" Collapsed="true">
     <Position X="0.5" Y="6" Width="3.25" />
     <TypeIdentifier>
-      <HashCode>FAgIAwAhIQIAAACQBAAEKI0hQBAAAAAACQBgYAQACgA=</HashCode>
+      <HashCode>FAgIAwAhIYIAAACQBAAEKI0hQBAAAAEACQBgYAQACgA=</HashCode>
       <FileName>1-OTSMeasure\CMeasureThreadWrapper.cs</FileName>
     </TypeIdentifier>
   </Class>
@@ -132,7 +134,7 @@
   <Class Name="OTSDataType.CSEMDataMsr" Collapsed="true">
     <Position X="9" Y="8.5" Width="2.75" />
     <TypeIdentifier>
-      <HashCode>gCAACIAAggAIACAAgBAAAAAQACAAMAgQAAgLAAgEIAA=</HashCode>
+      <HashCode>gCAACIAAggAIICAAgBAAAAAQACAAMAgQAAgLAAgEIAA=</HashCode>
       <FileName>0-OTSModel\OTSDataType\CSEMDataMsr.cs</FileName>
     </TypeIdentifier>
   </Class>

+ 3 - 10
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.cs

@@ -86,8 +86,8 @@ namespace OTSMeasureApp
             }
             
         }
+  
 
-   
         public void SampleGridInfoChange(OTS_SAMPLE_PROP_GRID_ITEMS SampleId, OTS_ITEM_TYPES ValType, object ObjVal)
         {
             var PropertyMeasureThreadRunFlag = m_MeasureAppForm.m_MsrThreadWrapper.BGWorkThreadIsRunning();
@@ -238,14 +238,7 @@ namespace OTSMeasureApp
             {
                 m_SolutionWindows.m_TreeViewBase.EditTreeWorkSampleName(sWSampleName, (string)ObjVal);
 
-                //将已存在的帧图修改为重命名
-                if (OTSSamplespaceWindow.m_ALLSingleGDIObjects != null)
-                {
-                    if (OTSSamplespaceWindow.m_ALLSingleGDIObjects.Count > 0)
-                    {
-                        OTSSamplespaceGraphicsPanelFun.EditWorkSampleName(OTSSamplespaceWindow.m_ALLSingleGDIObjects, sWSampleName, (string)ObjVal);
-                    }
-                }
+             
             }
 
         HERE:
@@ -276,7 +269,7 @@ namespace OTSMeasureApp
                 if (OTS_SAMPLE_PROP_GRID_ITEMS.IMAGE_GRP_MAX == SampleId || OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION == SampleId
                     || OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE == SampleId)
                 {
-                   m_MeasureAppForm. m_SamplepaceWindow.Rev_DDDrawSampleStage_EventHandler_Event();
+                   m_MeasureAppForm. m_SamplepaceWindow.DrawSampleField();
                 }
           
         }

+ 0 - 791
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CStageManage.cs

@@ -1,791 +0,0 @@
-using System;
-using System.Collections;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace OTSMeasureApp
-{
-    public class CStageManage
-    {
-        #region 添加样品
-        /// <summary>
-        /// 添加样品
-        /// </summary>
-        /// <param name="IsSelect"></param>
-        /// <param name="SampleHoleName"></param>
-        /// <param name="SampleName"></param>
-        /// <param name="oTSSamplespaceWindow"></param>
-        /// <returns></returns>
-        public static bool AddSample(string SampleHoleName, string SampleName, ARectangleGDIObject m_MeasureGDIObjects, OTSSamplespaceWindow oTSSamplespaceWindow,float globalZoomNum)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_SampleHoleGDIObjects != null)
-                {
-                    if (OTSSamplespaceWindow.m_SampleHoleGDIObjects.Count > 0)
-                    {
-                        ARectangleGDIObject itemAdd = null;
-                        //设置样品选择状态为非工作样品
-                        foreach (ARectangleGDIObject itemSample in OTSSamplespaceWindow.m_SampleGDIObjects)
-                        {
-                            //设置颜色
-                            string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
-                            itemSample.SelColor = ColorTranslator.FromHtml(ColorStr);
-                            itemSample.IsWorkSample = false;
-                        }
-                        foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_SampleHoleGDIObjects)
-                        {
-                            itemAdd = items;
-                            if (items.Name == SampleHoleName)
-                            {
-                                //获取样品台类型
-                                int shape = itemAdd.CreateType;// == (int)CreateRectangleType.Rectangle ? (int)CreateRectangleType.Rectangle: (int)CreateRectangleType.Ellipse;
-                                //设置颜色
-                                string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
-                                Color selColor = ColorTranslator.FromHtml(ColorStr);
-                                CreateRectangle NewSample = new CreateRectangle(items.Region, (int)CreateRectangleType.SelectSample, shape, items.Name, selColor);
-                                //累加样品数量
-                                items.SampleCount += 1;
-                                items.IsWorkSample = true;
-                                NewSample.SampleName = SampleName;
-                                NewSample.Name = itemAdd.Name;
-                                //设置当前添加的样品为工作样品
-                                NewSample.IsWorkSample = true;
-                                // 获取样品孔的大小与初始大小
-                                NewSample.Region = items.Region;
-                                NewSample.RegionF = items.RegionF;
-                                NewSample.DrawRegionF = items.DrawRegionF;
-                                //绘制样品路径
-                                GraphicsPath NewSamplePath = new GraphicsPath();
-                                if (NewSample.Shape == (int)CreateRectangleType.Circle)
-                                {
-                                    NewSamplePath.AddEllipse(NewSample.Region);
-                                }
-                                else
-                                {
-                                    NewSamplePath.AddRectangle(NewSample.Region);
-                                }
-                                NewSample.GPath = NewSamplePath;
-                                OTSSamplespaceWindow.m_SampleGDIObjects.Add(NewSample);
-                                //获取测量区域尺寸与位置
-                                m_MeasureGDIObjects = GetSampleMeasureInfo(NewSample, m_MeasureGDIObjects, globalZoomNum);
-                                //设置样品孔名称
-                                m_MeasureGDIObjects.Name = items.Name;
-                                //根据节点设置样品台窗口中所选择的样品名称
-                                OTSSamplespaceWindow.m_SampleSelectName = SampleName;
-                                //添加测量区域
-                                return AddMeasure(m_MeasureGDIObjects.CreateType, m_MeasureGDIObjects);
-                            }
-                        }
-                    }
-                }
-
-
-            }
-            catch (Exception)
-            {
-
-            }
-            return false;
-        }
-
-        #region 根据样品位置 获取测量区域位置
-        public static ARectangleGDIObject GetSampleMeasureInfo(ARectangleGDIObject NewSample, ARectangleGDIObject m_MeasureGDIObjects, float globalZoomNum)
-        {
-            //根据样品位置 获取测量区域位置
-            int MeasurePointX = (int)(NewSample.Region.Location.X + ((NewSample.Region.Size.Width - (m_MeasureGDIObjects.Region.Width * globalZoomNum)) / 2));
-            int MeasurePointY = (int)(NewSample.Region.Location.Y + ((NewSample.Region.Size.Height - (m_MeasureGDIObjects.Region.Height * globalZoomNum)) / 2));
-            int MeasureWidth = Convert.ToInt32(m_MeasureGDIObjects.Region.Width * globalZoomNum);
-            int MeasureHeight = Convert.ToInt32(m_MeasureGDIObjects.Region.Height * globalZoomNum);
-            
-            float MeasureFPointX = (float)(NewSample.RegionF.Location.X + (NewSample.RegionF.Size.Width - m_MeasureGDIObjects.Region.Width )  / 2);
-            float MeasureFPointY = (float)(NewSample.RegionF.Location.Y + (NewSample.RegionF.Size.Height - m_MeasureGDIObjects.Region.Height)  / 2);
-            float MeasureFWidth = Convert.ToSingle(m_MeasureGDIObjects.RegionF.Width);
-            float MeasureFHeight = Convert.ToSingle(m_MeasureGDIObjects.RegionF.Height);
-
-            float MeasureDrawPointX = (float)(NewSample.DrawRegionF.Location.X + (NewSample.DrawRegionF.Size.Width - m_MeasureGDIObjects.Region.Width)  / 2);
-            float MeasureDrawPointY = (float)(NewSample.DrawRegionF.Location.Y + (NewSample.DrawRegionF.Size.Height - m_MeasureGDIObjects.Region.Height)  / 2);
-            float MeasureDrawWidth = Convert.ToSingle(m_MeasureGDIObjects.DrawRegionF.Width);
-            float MeasureDrawHeight = Convert.ToSingle(m_MeasureGDIObjects.DrawRegionF.Height);
-
-            m_MeasureGDIObjects.Region = new Rectangle(new Point(MeasurePointX, MeasurePointY), new Size(MeasureWidth, MeasureHeight));
-            m_MeasureGDIObjects.RegionF = new RectangleF(new PointF(MeasureFPointX, MeasureFPointY), new SizeF(MeasureFWidth, MeasureFHeight));
-            m_MeasureGDIObjects.DrawRegionF = new RectangleF(new PointF(MeasureDrawPointX, MeasureDrawPointY), new SizeF(MeasureDrawWidth, MeasureDrawHeight));
-            return m_MeasureGDIObjects;
-        }
-        #endregion
-
-        /// <summary>
-        /// 添加样品
-        /// </summary>
-        /// <param name="IsSelect"></param>
-        /// <param name="SampleHoleName"></param>
-        /// <param name="SampleName"></param>
-        /// <param name="oTSSamplespaceWindow"></param>
-        /// <returns></returns>
-        public static bool AddOnlySample(string SampleHoleName, string SampleName, OTSSamplespaceWindow oTSSamplespaceWindow)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_SampleHoleGDIObjects != null)
-                {
-                    if (OTSSamplespaceWindow.m_SampleHoleGDIObjects.Count > 0)
-                    {
-                        ARectangleGDIObject itemAdd = null;
-                        //设置样品选择状态为非工作样品
-                        foreach (ARectangleGDIObject itemSample in OTSSamplespaceWindow.m_SampleGDIObjects)
-                        {
-                            //设置颜色
-                            string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
-                            itemSample.SelColor = ColorTranslator.FromHtml(ColorStr);
-                            itemSample.IsWorkSample = false;
-                        }
-                        foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_SampleHoleGDIObjects)
-                        {
-                            itemAdd = items;
-                            if (items.Name == SampleHoleName)
-                            {
-                                //获取样品台类型
-                                int shape = itemAdd.CreateType;// == (int)CreateRectangleType.Rectangle ? (int)CreateRectangleType.Rectangle: (int)CreateRectangleType.Ellipse;
-                                //设置颜色
-                                string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
-                                Color selColor = ColorTranslator.FromHtml(ColorStr);
-                                CreateRectangle AddSample = new CreateRectangle(items.Region, (int)CreateRectangleType.SelectSample, shape, items.Name, selColor);
-                                //累加样品数量
-                                items.SampleCount += 1;
-                                items.IsWorkSample = true;
-                                AddSample.SampleName = SampleName;
-                                AddSample.Name = itemAdd.Name;
-                                //绘制测量区域路径
-                                GraphicsPath AddSamplePath = new GraphicsPath();
-                                AddSamplePath.AddRectangle(AddSample.Region);
-                                AddSample.GPath = AddSamplePath;
-                                OTSSamplespaceWindow.m_SampleGDIObjects.Add(AddSample);
-                                return true;
-                            }
-                        }
-                    }
-                }
-                return false;
-            }
-            catch (Exception)
-            {
-
-            }
-            return false;
-        }
-        #endregion
-
-        #region 删除样品
-        /// <summary>
-        /// 删除样品
-        /// </summary>
-        /// <param name="IsIsDragging">是否选择样品孔 0:未选择 1:选择</param>
-        /// <param name="stageName">样品孔名称</param>
-        /// <returns>是否成功</returns>
-        public static bool DeleteStage(int IsSelect, string SampleName)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_SampleHoleGDIObjects != null)
-                {
-                    if (OTSSamplespaceWindow.m_SampleHoleGDIObjects.Count > 0)
-                    {
-                        ARectangleGDIObject itemAdd = null;
-                        if (OTSSamplespaceWindow.m_SampleGDIObjects.Count > 0)
-                        {
-                            foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_SampleGDIObjects)
-                            {
-                                itemAdd = items;
-                                if (IsSelect > 0)
-                                {
-                                    if (items.SampleName == SampleName)
-                                    {
-                                        foreach (ARectangleGDIObject itemSampleHole in OTSSamplespaceWindow.m_SampleHoleGDIObjects)
-                                        {
-                                            if (itemSampleHole.Name == itemAdd.Name)
-                                            {
-                                                itemSampleHole.SampleCount -= 1;
-                                                break;
-                                            }
-                                        }
-                                        //将样品孔恢复未拖动状态
-                                        items.IsSelect = false;
-                                        OTSSamplespaceWindow.m_SampleGDIObjects.Remove(items);
-                                        return true;
-                                    }
-                                }
-                                else
-                                {
-                                    //删除样品测量
-                                    if (items.SampleName == SampleName)
-                                    {
-                                        //将样品孔恢复未拖动状态
-                                        items.IsSelect = false;
-                                        OTSSamplespaceWindow.m_SampleGDIObjects.Remove(items);
-                                        return true;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            catch (Exception)
-            {
-
-            }
-            return false;
-        }
-        #endregion
-
-        #region 通过样品名称 删除样品
-        /// <summary>
-        /// 删除样品
-        /// </summary>
-        /// <param name="stageName">样品孔名称</param>
-        /// <returns>是否成功</returns>
-        public static bool DeleteSample(string SampleName)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_SampleHoleGDIObjects != null)
-                {
-                    if (OTSSamplespaceWindow.m_SampleHoleGDIObjects.Count > 0)
-                    {
-                        ARectangleGDIObject itemAdd = null;
-                        if (OTSSamplespaceWindow.m_SampleGDIObjects.Count > 0)
-                        {
-                            foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_SampleGDIObjects)
-                            {
-                                itemAdd = items;
-                                if (items.SampleName == SampleName)
-                                {
-                                    foreach (ARectangleGDIObject itemSampleHole in OTSSamplespaceWindow.m_SampleHoleGDIObjects)
-                                    {
-                                        if (itemSampleHole.Name == itemAdd.Name)
-                                        {
-                                            itemSampleHole.SampleCount -= 1;
-                                            break;
-                                        }
-                                    }
-                                    //将样品孔恢复未拖动状态
-                                    items.IsSelect = false;
-                                    OTSSamplespaceWindow.m_SampleGDIObjects.Remove(items);
-                                    if (DeleteMeasure(SampleName))
-                                    {
-                                        return true;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            catch (Exception)
-            {
-
-            }
-            return false;
-        }
-        #endregion
-
-        #region 修改测量区域选择状态
-        public static void SetMeasureState(Color setColor)
-        {
-            foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_MeasureGDIObjects)
-            {
-                items.SelColor = setColor;
-            }
-        }
-        #endregion
-
-        #region 修改样品选择状态
-        public static void SetSampleState(Color setColor)
-        {
-            foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_SampleGDIObjects)
-            {
-                if (items.IsDragging)
-                {
-                    //设置颜色
-                    string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
-                    items.SelColor = ColorTranslator.FromHtml(ColorStr);
-                }
-                else
-                {
-                    items.SelColor = setColor;
-                }
-            }
-        }
-        #endregion
-
-        #region 添加测量
-        /// <summary>
-        /// 添加测量
-        /// </summary>
-        /// <param name="IsIsDragging">是否选择样品 0:未选择 1:选择</param>
-        /// <param name="sampleName">样品名称</param>
-        /// <returns>是否成功</returns>
-        public static bool AddMeasure(int IsSelect, string sampleName)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_SampleGDIObjects != null)
-                {
-                    if (OTSSamplespaceWindow.m_SampleGDIObjects.Count > 0)
-                    {
-                        ARectangleGDIObject itemAdd = null;
-                        if (IsSelect > 0)
-                        {
-                            foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_SampleGDIObjects)
-                            {
-                                //判断是否与传递的样品名称相同
-                                itemAdd = items;
-                                if (items.Name == sampleName)
-                                {
-                                    //添加测量区域
-                                    //获取样品台类型
-                                    int shape = itemAdd.CreateType;// == (int)CreateRectangleType.Rectangle ? (int)CreateRectangleType.Rectangle: (int)CreateRectangleType.Ellipse;
-                                    GraphicsPath MeasurePath = new GraphicsPath();
-                                    if (shape == (int)CreateRectangleType.Rectangle)
-                                    {
-                                        MeasurePath.AddRectangle(itemAdd.Region);
-                                    }
-                                    else
-                                    {
-                                        MeasurePath.AddEllipse(itemAdd.Region);
-                                    }
-                                    //缩小与样品的尺寸
-                                    Rectangle rectMeasure = items.Region;
-                                    rectMeasure.X = rectMeasure.X + 5;
-                                    rectMeasure.Y = rectMeasure.Y + 5;
-                                    rectMeasure.Width = rectMeasure.Width - 10;
-                                    rectMeasure.Height = rectMeasure.Height - 10;
-                                    //与样品中心相差的距离
-                                    Point sampleCenterDifferPoint = new Point();
-                                    //获取测量区域中心与样品中心相差的距离
-                                    sampleCenterDifferPoint = OTSSamplespaceGraphicsPanelFun.GetSampleCenterDifferCenterPoint(rectMeasure, items.Region);
-                                    //创建测量区域
-                                    //设置颜色
-                                    string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
-                                    CreateRectangle selectState = new CreateRectangle(rectMeasure, sampleCenterDifferPoint, (int)CreateRectangleType.MeasureArea, shape, items.Name, items.Name, ColorTranslator.FromHtml(ColorStr));
-                                    selectState.GPath = MeasurePath;
-                                    OTSSamplespaceWindow.m_MeasureGDIObjects.Add(selectState);
-                                    return true;
-                                }
-                            }
-                        }
-                        else
-                        {
-                            //默认添加测量
-                            itemAdd = OTSSamplespaceWindow.m_SampleGDIObjects[0];
-                            CreateRectangle selectState = new CreateRectangle(itemAdd.Region, (int)CreateRectangleType.MeasureArea, sampleName);
-                            GraphicsPath MeasurePath = new GraphicsPath();
-                            if (selectState.Shape == (int)CreateRectangleType.Rectangle)
-                            {
-                                MeasurePath.AddRectangle(itemAdd.Region);
-                            }
-                            else
-                            {
-                                MeasurePath.AddEllipse(itemAdd.Region);
-                            }
-                            selectState.GPath = MeasurePath;
-                            OTSSamplespaceWindow.m_MeasurePathGDIObjects.Add(selectState);
-                            return true;
-                        }
-                    }
-                }
-            }
-            catch (Exception)
-            {
-
-                throw;
-            }
-            return false;
-        }
-        #endregion
-
-        #region 添加测量
-        /// <summary>
-        /// 添加测量
-        /// </summary>
-        /// <param name="IsIsDragging">是否选择样品 0:未选择 1:选择</param>
-        /// <param name="sampleName">样品名称</param>
-        /// <returns>是否成功</returns>
-        public static bool AddMeasure(int CreateType, ARectangleGDIObject m_MeasureGDIObjects)
-        {
-            try
-            {
-                //添加测量区域
-                int shape = CreateType;// == 1 ? 1 : 0;
-                GraphicsPath MeasurePath = new GraphicsPath();
-                if (shape == (int)CreateRectangleType.Rectangle)
-                {
-                    MeasurePath.AddRectangle(m_MeasureGDIObjects.Region);
-                }
-                else
-                {
-                    MeasurePath.AddEllipse(m_MeasureGDIObjects.Region);
-                }
-                //缩小与样品的尺寸
-                Rectangle rectMeasure = m_MeasureGDIObjects.Region;
-                Color MeasureColor = Color.Red;
-                CreateRectangle MeasureRect = new CreateRectangle(rectMeasure, m_MeasureGDIObjects.SampleCenterDifferCenterPoint, (int)CreateRectangleType.MeasureArea, shape, m_MeasureGDIObjects.Name, m_MeasureGDIObjects.SampleName, MeasureColor);
-                MeasureRect.GPath = MeasurePath;
-                MeasureRect.sampleName = m_MeasureGDIObjects.SampleName;
-                MeasureRect.Name = m_MeasureGDIObjects.Name;
-                //获取缩放前尺寸与位置
-                MeasureRect.RegionF = m_MeasureGDIObjects.RegionF;
-                MeasureRect.DrawRegionF = m_MeasureGDIObjects.DrawRegionF;
-                OTSSamplespaceWindow.m_MeasureGDIObjects.Add(MeasureRect);
-                return true;
-            }
-            catch (Exception)
-            {
-                return false;
-            }
-        }
-        #endregion
-
-        #region 复位测量
-        /// <summary>
-        /// 复位测量
-        /// </summary>
-        /// <param name="CreateType">是否选择样品 0:圆形 3:矩形</param>
-        /// <param name="m_MeasureGDIObjects">测量区域</param>
-        /// <returns>是否成功</returns>
-        public static ARectangleGDIObject ResetMeasure(int CreateType, ARectangleGDIObject m_SampleGDIObjects, ARectangleGDIObject m_MeasureGDIObjects, float globalZoomNum)
-        {
-            try
-            {
-                //复位测量
-                int shape = CreateType;
-                GraphicsPath MeasurePath = new GraphicsPath();
-                if (shape == (int)CreateRectangleType.Rectangle)
-                {
-                    MeasurePath.AddRectangle(m_SampleGDIObjects.Region);
-                }
-                else
-                {
-                    MeasurePath.AddEllipse(m_SampleGDIObjects.Region);
-                }
-                //缩小与样品的尺寸
-                Rectangle rectMeasure = m_SampleGDIObjects.Region;
-                Color MeasureColor = Color.Red;
-                return GetSampleMeasureInfo(m_SampleGDIObjects, m_MeasureGDIObjects,  globalZoomNum);
-            }
-            catch (Exception)
-            {
-                return null;
-            }
-        }
-        #endregion
-
-        #region 通过样品名称 删除测量
-        /// <summary>
-        /// 通过样品名称 删除测量
-        /// </summary>
-        /// <param name="measureName">测量名称</param>
-        /// <returns>是否成功</returns>
-        public static bool DeleteMeasure(string sampleName)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_MeasureGDIObjects.Count > 0)
-                {
-                    foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_MeasureGDIObjects)
-                    {
-                        //删除样品测量
-                        if (items.SampleName == sampleName)
-                        {
-                            //将样品孔恢复未拖动状态
-                            items.IsSelect = false;
-                            OTSSamplespaceWindow.m_MeasureGDIObjects.Remove(items);
-                            //设置样品与测量区域
-                            //设置颜色
-                            string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
-                            SetSampleState(ColorTranslator.FromHtml(ColorStr));
-                            SetMeasureState(ColorTranslator.FromHtml(ColorStr));
-                            OTSSamplespaceWindow.m_IsMeasure = false;
-                            foreach (ARectangleGDIObject sampleItem in OTSSamplespaceWindow.m_SampleGDIObjects)
-                            {
-                                if (sampleItem.SampleName == items.SampleName)
-                                {
-                                    sampleItem.IsWorkSample = true;
-                                    //设置颜色
-                                    string SampleSelColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
-                                    sampleItem.SelColor = ColorTranslator.FromHtml(SampleSelColor);
-
-                                }
-                            }
-                            return true;
-                        }
-                    }
-                }
-            }
-            catch (Exception)
-            {
-
-            }
-            return false;
-        }
-        #endregion
-
-        #region 删除测量
-        /// <summary>
-        /// 删除测量
-        /// </summary>
-        /// <param name="IsIsDragging">是否选择测量 0:未选择 1:选择</param>
-        /// <param name="measureName">测量名称</param>
-        /// <returns>是否成功</returns>
-        public static bool DeleteMeasure(int IsSelect, string sampleName)
-        {
-            try
-            {
-                if (OTSSamplespaceWindow.m_MeasureGDIObjects.Count > 0)
-                {
-                    foreach (ARectangleGDIObject items in OTSSamplespaceWindow.m_MeasureGDIObjects)
-                    {
-                        //删除样品测量
-                        if (items.SampleName == sampleName)
-                        {
-                            //将样品孔恢复未拖动状态
-                            items.IsSelect = false;
-                            OTSSamplespaceWindow.m_MeasureGDIObjects.Remove(items);
-                            //设置样品与测量区域
-                            //设置颜色
-                            string SampleColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
-                            SetSampleState(ColorTranslator.FromHtml(SampleColor));
-                            SetMeasureState(ColorTranslator.FromHtml(SampleColor));
-                            OTSSamplespaceWindow.m_IsMeasure = false;
-                            foreach (ARectangleGDIObject sampleItem in OTSSamplespaceWindow.m_SampleGDIObjects)
-                            {
-                                if (sampleItem.Name == items.SampleName)
-                                {
-                                    //设置颜色
-                                    string SampleSelColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
-                                    sampleItem.IsWorkSample = true;
-                                    sampleItem.SelColor = ColorTranslator.FromHtml(SampleSelColor);
-                                }
-                            }
-                            return true;
-                        }
-                    }
-                }
-            }
-            catch (Exception)
-            {
-
-            }
-            return false;
-        }
-        #endregion
-
-        #region 更换样品名称
-        /// <summary>
-        /// 更换样品名称
-        /// </summary>
-        /// <param name="sampleName">新样品名称</param>
-        public static void ChangeSampleName(string sampleName)
-        {
-            //循环 样品与测量区域的名称修改为新名称
-            foreach (ARectangleGDIObject itemSample in OTSSamplespaceWindow.m_SampleGDIObjects)
-            {
-                if (itemSample.IsWorkSample)
-                {
-                    foreach (ARectangleGDIObject measureItemSample in OTSSamplespaceWindow.m_MeasureGDIObjects)
-                    {
-                        if (measureItemSample.SampleName == itemSample.SampleName)
-                        {
-                            measureItemSample.SampleName = sampleName;
-                            itemSample.SampleName = sampleName;
-                            return;
-                        }
-                    }
-                }
-            }
-        }
-        #endregion
-
-        #region 更换样品形状
-        /// <summary>
-        /// 更换样品形状
-        /// </summary>
-        /// <param name="iShape">形状</param>
-        public static bool ChangeSampleShape(int iShape)
-        {
-            foreach (ARectangleGDIObject itemSample in OTSSamplespaceWindow.m_SampleGDIObjects)
-            {
-                if (itemSample.IsWorkSample)
-                {
-                    foreach (ARectangleGDIObject itemMeasure in OTSSamplespaceWindow.m_MeasureGDIObjects)
-                    {
-                        if (itemSample.SampleName == itemMeasure.SampleName)
-                        {
-                            if (itemMeasure.Shape != iShape)
-                            {
-                                //改变大小
-                                itemMeasure.Region = new Rectangle(itemMeasure.Region.X, itemMeasure.Region.Y, itemMeasure.Region.Height, itemMeasure.Region.Height);
-                                itemMeasure.RegionF = new RectangleF(itemMeasure.RegionF.X, itemMeasure.RegionF.Y, itemMeasure.RegionF.Height, itemMeasure.RegionF.Height);
-                                itemMeasure.DrawRegionF = new RectangleF(itemMeasure.DrawRegionF.X, itemMeasure.DrawRegionF.Y, itemMeasure.DrawRegionF.Height, itemMeasure.DrawRegionF.Height);
-                                itemMeasure.Shape = iShape;
-                                GraphicsPath NewMeasurePath = new GraphicsPath();
-                                if (itemMeasure.Shape == (int)CreateRectangleType.Circle)
-                                {
-                                    NewMeasurePath.AddEllipse(itemMeasure.Region);
-                                }
-                                else
-                                {
-                                    NewMeasurePath.AddRectangle(itemMeasure.Region);
-                                }
-                                itemMeasure.GPath = NewMeasurePath;
-                                return true;
-                            }
-                            return false;
-                        }
-                    }
-                }
-            }
-            return false;
-        }
-        #endregion
-
-        #region 设置工作样品
-        /// <summary>
-        /// 设置工作样品与测量区域
-        /// </summary>
-        /// <param name="sampleName">样品名称</param>
-        public static void SetWorkSampleAndWorkMeasure(string sampleName)
-        {
-            foreach (ARectangleGDIObject itemSample in OTSSamplespaceWindow.m_SampleGDIObjects)
-            {
-                if (itemSample.SampleName == sampleName)
-                {
-                    itemSample.IsWorkSample = true;
-                    string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
-                    itemSample.SelColor = ColorTranslator.FromHtml(ColorStr);
-                }
-                else
-                {
-                    itemSample.IsWorkSample = false;
-                    string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
-                    itemSample.SelColor = ColorTranslator.FromHtml(ColorStr);
-                }
-            }
-            foreach (ARectangleGDIObject itemMeasure in OTSSamplespaceWindow.m_MeasureGDIObjects)
-            {
-                if (itemMeasure.SampleName == sampleName)
-                {
-                    itemMeasure.IsWorkSample = true;
-                    itemMeasure.SelColor = Color.Red;
-                }
-                else
-                {
-                    itemMeasure.IsWorkSample = false;
-                    itemMeasure.SelColor = Color.Transparent;
-                }
-            }
-            //修改测量区域集合 索引     (添加样品或者切换样品时,将当前工作样品显示在样品孔的最上)
-            OTSSamplespaceWindow.m_MeasureGDIObjects = OTSSamplespaceGraphicsPanelFun.SelectMeasureIndexIsTop(OTSSamplespaceWindow.m_MeasureGDIObjects, sampleName);
-            //修改样品集合 索引
-            OTSSamplespaceWindow.m_SampleGDIObjects = OTSSamplespaceGraphicsPanelFun.SelectSampleIndexIsTop(OTSSamplespaceWindow.m_SampleGDIObjects, sampleName);
-
-        }
-        #endregion
-
-        public static void SetShowCMStrip(int IsSelectType, ContextMenuStrip cmStrip, bool IsTrue)
-        {
-
-            //鼠标右键选择的类型 0:样品台 1:样品 2:测量区域
-            cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Tag = (int)MessageState.ShotBSEPicture;
-            switch (IsSelectType)
-            {
-                case (int)ContextMenuType.SampleHoleMenu:
-                    cmStrip.Items[(int)MenuIndex.AddSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteSample].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.ReadSEMData].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SetSemData].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SetSEMCenterLocation].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCenterLocation].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCurrentLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SEMStripSeparator].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DeleteBSEPicture].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SlopFocus].Enabled = false;
-                    break;
-                case (int)ContextMenuType.SampleMenu:
-                    cmStrip.Items[(int)MenuIndex.AddSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ReadSEMData].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SetSemData].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SetSEMCenterLocation].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCenterLocation].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCurrentLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SEMStripSeparator].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteBSEPicture].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SlopFocus].Enabled = true;
-                    break;
-                case (int)ContextMenuType.MeasureMenu:
-                    cmStrip.Items[(int)MenuIndex.AddSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ReadSEMData].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SetSemData].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SetSEMCenterLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCenterLocation].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCurrentLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteBSEPicture].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.SlopFocus].Enabled = true;
-                    //cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Text = str2;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Tag = MessageState.MeasureBSEPicture;
-                    break;
-                case (int)ContextMenuType.SingleMenu:
-                    cmStrip.Items[(int)MenuIndex.AddSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ReadSEMData].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SetSemData].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SetSEMCenterLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCenterLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCurrentLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteBSEPicture].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SlopFocus].Enabled = true;
-                    //cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Text = str2;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Tag = MessageState.MeasureBSEPicture;
-                    break;
-                case (int)ContextMenuType.ThreadRunMenu:
-                    for (int i = 0; i < cmStrip.Items.Count; i++)
-                    {
-                        cmStrip.Items[i].Enabled = false;
-                    }
-                    break;
-                case (int)ContextMenuType.SampleStateMenu:
-                    cmStrip.Items[(int)MenuIndex.AddSample].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DeleteSample].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.ReadSEMData].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SetSemData].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SetSEMCenterLocation].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCenterLocation].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCurrentLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.DeleteBSEPicture].Enabled = false;
-                    cmStrip.Items[(int)MenuIndex.SlopFocus].Enabled = false;
-                    break;
-                case (int)ContextMenuType.SampleHoleBSEImage:
-                    cmStrip.Items[(int)MenuIndex.AddSample].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.DeleteSample].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.ReadSEMData].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.SetSemData].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.SetSEMCenterLocation].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCenterLocation].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.DriveSEMToCurrentLocation].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.ShootBSEPicture].Enabled = IsTrue;
-                    cmStrip.Items[(int)MenuIndex.DeleteBSEPicture].Enabled = true;
-                    cmStrip.Items[(int)MenuIndex.SlopFocus].Enabled = IsTrue;
-                    break;
-            }
-        }
-    }
-}

+ 88 - 63
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CreateRectangle.cs

@@ -6,7 +6,7 @@ using System.Windows.Forms;
 
 namespace OTSMeasureApp
 {
-    public abstract class ARectangleGDIObject
+    public abstract class CRectangleGDIObject
     {
         #region 共同属性
         /// <summary>
@@ -49,9 +49,9 @@ namespace OTSMeasureApp
         /// <summary>
         /// 创建类型 记录生成的图形类型
         /// </summary>
-        public abstract int CreateType { get; set; }
+        public abstract CreateRectangleType CreateType { get; set; }
         //0:圆形 1:矩形
-        public abstract int Shape { get; set; }
+        public abstract ShapeType Shape { get; set; }
         /// <summary>
         /// 拖动到的位置 
         /// </summary>
@@ -70,7 +70,7 @@ namespace OTSMeasureApp
         /// <summary>
         /// 样品台中心与工作区域中心相差的位置
         /// </summary>
-        public abstract PointF SampleCenterDifferCenterPoint { get; set; }
+        //public abstract PointF SampleCenterDifferCenterPoint { get; set; }
         #endregion
         #region 样品属性
         /// <summary>
@@ -90,7 +90,7 @@ namespace OTSMeasureApp
         /// <summary>
         /// 是否存在帧图  (测量区域属性)
         /// </summary>
-        public abstract bool IsSingle { get; set; }
+        //public abstract bool IsSingle { get; set; }
         /// <summary>
         /// 图形的路径 (圆角矩形、测量区域)
         /// </summary>
@@ -137,6 +137,8 @@ namespace OTSMeasureApp
         /// OTS帧图Y位置
         /// </summary>
         public abstract int OTSY { get; set; }
+
+        //public abstract bool OTSContains(Point OTSPoint);
         #endregion
         #region 绘制样品孔BSE图像
         public abstract Image BSEImage { get; set; }
@@ -146,10 +148,15 @@ namespace OTSMeasureApp
         public abstract float BSEImageHeight { get; set; }
         //绘制样品孔BSE图像位置
         public abstract PointF BSEImageLocation { get; set; }
+
+        public abstract Point GetCenterPoint();
+
+        public abstract bool IfContains(Point mousePoint);
+
         #endregion
     }
 
-    public class CreateRectangle : ARectangleGDIObject // 同样的方式可以从ADraggableGDIObject生成其它图形的继承角类,比如矩形,三形等等。。
+    public class CreateRectangle : CRectangleGDIObject // 同样的方式可以从ADraggableGDIObject生成其它图形的继承角类,比如矩形,三形等等。。
     {
         /// <summary>
         /// 创建图形
@@ -159,21 +166,21 @@ namespace OTSMeasureApp
         /// <param name="width">宽度</param>
         /// <param name="height">高度</param>
         /// <param name="cType">图形类型:createType=0 圆角矩形 createType=1 圆形 createType=2 文字</param>
-        /// <param name="str">文字内容</param>
-        public CreateRectangle(float startx, float starty, float width, float height, int cType, string str, string name)
+        /// <param name="content">文字内容</param>
+        public CreateRectangle(float startx, float starty, float width, float height, CreateRectangleType cType, string content, string name)
         {
             m_Region = new Rectangle((int)startx, (int)starty, (int)width, (int)height);
             m_RegionF = new RectangleF(startx, starty, width, height);
             m_DrawRegionF = new RectangleF(startx, starty, width, height);
             CreateType = cType;
-            strContent = str;
+            strContent = content;
             Name = name;
             ID = System.Guid.NewGuid().ToString();
             OTSX = -1;
             OTSY = -1;
         }
 
-        public CreateRectangle(RectangleF rect, int cType)
+        public CreateRectangle(RectangleF rect, CreateRectangleType cType)
         {
             m_Region = new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
             m_RegionF = rect;
@@ -185,7 +192,7 @@ namespace OTSMeasureApp
             OTSX = -1;
             OTSY = -1;
         }
-        public CreateRectangle(RectangleF rect, int cType, string name)
+        public CreateRectangle(RectangleF rect, CreateRectangleType cType, string name)
         {
             m_Region = new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
             m_RegionF = rect;
@@ -196,7 +203,7 @@ namespace OTSMeasureApp
             OTSX = -1;
             OTSY = -1;
         }
-        public CreateRectangle(RectangleF rect, int cType, int shape, string name)
+        public CreateRectangle(RectangleF rect, CreateRectangleType cType, ShapeType shape, string name)
         {
             m_Region = new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
             m_RegionF = rect;
@@ -208,7 +215,7 @@ namespace OTSMeasureApp
             OTSX = -1;
             OTSY = -1;
         }
-        public CreateRectangle(RectangleF rect, int cType, int shape, string name, Color selColor)
+        public CreateRectangle(RectangleF rect, CreateRectangleType cType, ShapeType shape, string name, Color selColor)
         {
             m_Region = new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
             m_RegionF = rect;
@@ -221,12 +228,12 @@ namespace OTSMeasureApp
             OTSX = -1;
             OTSY = -1;
         }
-        public CreateRectangle(RectangleF rectMeasure, PointF sampleCenterDifferPoint, int cType, int shape, string name, string sampleName, Color selColor)
+        public CreateRectangle(RectangleF rectMeasure,  CreateRectangleType cType, ShapeType shape, string name, string sampleName, Color selColor)
         {
             m_Region = new Rectangle((int)rectMeasure.X, (int)rectMeasure.Y, (int)rectMeasure.Width, (int)rectMeasure.Height);
             m_RegionF = rectMeasure;
             m_DrawRegionF = rectMeasure;
-            SampleCenterDifferCenterPoint = sampleCenterDifferPoint;
+            //SampleCenterDifferCenterPoint = sampleCenterDifferPoint;
             CreateType = cType;
             Name = name;
             Shape = shape;
@@ -237,7 +244,7 @@ namespace OTSMeasureApp
             OTSY = -1;
         }
         //绘制帧图
-        public CreateRectangle(RectangleF rectSingle, int cType, string name, string sampleName, Color selColor)
+        public CreateRectangle(RectangleF rectSingle, CreateRectangleType cType, string name, string sampleName, Color selColor)
         {
             m_Region = new Rectangle((int)rectSingle.X, (int)rectSingle.Y, (int)rectSingle.Width, (int)rectSingle.Height);
             m_RegionF = rectSingle;
@@ -252,7 +259,7 @@ namespace OTSMeasureApp
             OTSY = -1;
         }
         //绘制帧图
-        public CreateRectangle(RectangleF rectSingle, int OTSx, int OTSy, int cType, string name, string sampleName, Color selColor)
+        public CreateRectangle(RectangleF rectSingle, int OTSx, int OTSy, CreateRectangleType cType, string name, string sampleName, Color selColor)
         {
             m_Region = new Rectangle((int)rectSingle.X, (int)rectSingle.Y, (int)rectSingle.Width, (int)rectSingle.Height);
             m_RegionF = rectSingle;
@@ -273,7 +280,7 @@ namespace OTSMeasureApp
         /// <param name="lineLength">直线的长度</param>
         /// <param name="cType">类型</param>
         /// <param name="lineColor">颜色</param>
-        public CreateRectangle(PointF lineStartPoint, float lineLength, int cType, Color lineColor)
+        public CreateRectangle(PointF lineStartPoint, float lineLength, CreateRectangleType cType, Color lineColor)
         {
             m_Region = new Rectangle((int)lineStartPoint.X, (int)lineStartPoint.Y, (int)lineLength, 1);
             m_RegionF = new RectangleF(lineStartPoint.X, lineStartPoint.Y, lineLength, 1);
@@ -294,7 +301,7 @@ namespace OTSMeasureApp
         /// <param name="bseImageHeight">图像高度</param>
         /// <param name="drawImageLocation">图像开始位置</param>
         /// <param name="cType">绘制类型</param>
-        public CreateRectangle(RectangleF rect, int OTSx, int OTSy, string sampleName, string sampleHoleName, Image bseImage, float bseImageWitdh, float bseImageHeight, Point drawImageLocation, int cType)
+        public CreateRectangle(RectangleF rect, int OTSx, int OTSy, string sampleName, string sampleHoleName, Image bseImage, float bseImageWitdh, float bseImageHeight, Point drawImageLocation, CreateRectangleType cType)
         {
             m_Region = new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
             m_RegionF = rect;
@@ -321,14 +328,14 @@ namespace OTSMeasureApp
         /// </summary>
         /// <param name="semCPoint"></param>
         /// <param name="cType"></param>
-        public CreateRectangle(PointF semCPoint, int cType)
+        public CreateRectangle(PointF semCPoint, CreateRectangleType cType)
         {
             CreateType = cType;
             ID = System.Guid.NewGuid().ToString();
             semCenterPoint = semCPoint;
         }
 
-        public CreateRectangle(RectangleF rect, Point ImgPoint, float m_Multiple, int cType)
+        public CreateRectangle(RectangleF rect, Point ImgPoint, float m_Multiple, CreateRectangleType cType)
         {
             m_Region = new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
             m_RegionF.X = m_Region.X - ImgPoint.X * m_Multiple;
@@ -346,7 +353,7 @@ namespace OTSMeasureApp
         /// </summary>
         /// <param name="mPoint"></param>
         /// <param name="cType"></param>
-        public CreateRectangle(List<PointF> mPoint, int cType, int shape, string name, string sampleName, Color selColor)
+        public CreateRectangle(List<PointF> mPoint, CreateRectangleType cType, ShapeType shape, string name, string sampleName, Color selColor)
         {
             ID = System.Guid.NewGuid().ToString();
             List<Point> PointRegion = new List<Point>();
@@ -365,7 +372,7 @@ namespace OTSMeasureApp
             Name = name;
             SampleName = sampleName;
             CreateType = cType;
-            Shape = cType;
+            Shape = shape;
             SelColor = selColor;
         }
         #region 变量重写
@@ -419,12 +426,12 @@ namespace OTSMeasureApp
             get { return otsY; }
             set { otsY = value; }
         }
-        public override int CreateType
+        public override CreateRectangleType CreateType
         {
             get { return createType; }
             set { createType = value; }
         }
-        public override int Shape
+        public override ShapeType Shape
         {
             get { return shape; }
             set { shape = value; }
@@ -508,17 +515,22 @@ namespace OTSMeasureApp
             get { return endPoint; }
             set { endPoint = value; }
         }
-        public override PointF SampleCenterDifferCenterPoint
+  
+
+        public override Point GetCenterPoint()
         {
-            get { return sampleCenterDifferCenterPoint; }
-            set { sampleCenterDifferCenterPoint = value; }
+            Point pCenterPoint = new Point();
+            //获取在工作窗口中X,Y位置
+            pCenterPoint.X = (int)(this.Region.X + this.Region.Width / 2);
+            pCenterPoint.Y = (int)(this.Region.Y + this.Region.Height / 2);
+            return pCenterPoint;
         }
         #endregion
 
         public override void OnPaint(PaintEventArgs e)
         {
             //createType=0 圆角矩形 createType=1 圆形 createType=2 文字
-            if (createType == (int)CreateRectangleType.SampleBackGround_Rectangle)
+            if (createType == CreateRectangleType.SampleBackGround_Rectangle)
             {
                 //获取颜色
                 string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.RoundRectangleColor);
@@ -530,7 +542,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawPath(Pens.Black, grPath);
             }
             //样品台-圆形
-            else if (createType == (int)CreateRectangleType.SampleBackGround_Circle)
+            else if (createType == CreateRectangleType.SampleBackGround_Circle)
             {
                 //获取颜色
                 string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleBackGroundColor);
@@ -543,9 +555,9 @@ namespace OTSMeasureApp
                 e.Graphics.DrawEllipse(Pens.Black, m_Region);
             }
             //圆形
-            else if (createType == (int)CreateRectangleType.Circle)
+            else if (createType == CreateRectangleType.Circle)
             {
-                System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White);
+                System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.FloralWhite);
                 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;  //图片柔顺模式选择
                 e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
                 e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
@@ -553,7 +565,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawEllipse(Pens.Black, m_Region);
             }
             //文字
-            else if (createType == (int)CreateRectangleType.Font)
+            else if (createType == CreateRectangleType.Text)
             {
                 //设置文字对齐方式
                 StringFormat sf = new StringFormat();
@@ -583,7 +595,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawString(strContent, font, sampleBrush, m_Region, sf);
             }
             //矩形
-            else if (createType == (int)CreateRectangleType.Rectangle)
+            else if (createType == CreateRectangleType.Rectangle)
             {
                 Color myColor = System.Drawing.Color.White;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -594,7 +606,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawRectangle(Pens.Black, m_Region);
             }
             //选择样品台
-            else if (createType == (int)CreateRectangleType.SelectSample)
+            else if (createType == CreateRectangleType.SelectSample)
             {
                 Color myColor = selColor;
 
@@ -615,7 +627,7 @@ namespace OTSMeasureApp
                 }
             }
             //测试区域
-            else if (createType == (int)CreateRectangleType.MeasureArea)
+            else if (createType == CreateRectangleType.MeasureArea)
             {
                 Color myColor = selColor;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -638,7 +650,7 @@ namespace OTSMeasureApp
                 }
             }
             //绘制帧图 直线
-            else if (createType == (int)CreateRectangleType.SingleLine)
+            else if (createType == CreateRectangleType.SingleLine)
             {
                 //设置颜色
                 string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SingleColor);
@@ -659,7 +671,7 @@ namespace OTSMeasureApp
 
             }
             //绘制标样
-            else if (createType == (int)CreateRectangleType.SpecimenRectangle)
+            else if (createType == CreateRectangleType.SpecimenRectangle)
             {
                 Color myColor = System.Drawing.Color.Black;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -669,7 +681,7 @@ namespace OTSMeasureApp
                 e.Graphics.FillRectangle(sampleBrush, m_Region);
             }
             //绘制标样
-            else if (createType == (int)CreateRectangleType.SpecimenCircle)
+            else if (createType == CreateRectangleType.SpecimenCircle)
             {
                 Color myColor = System.Drawing.Color.Black;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -679,7 +691,7 @@ namespace OTSMeasureApp
                 e.Graphics.FillEllipse(sampleBrush, m_Region);
             }
             //绘制帧图
-            else if (createType == (int)CreateRectangleType.SingleRectangle)
+            else if (createType == CreateRectangleType.SingleRectangle)
             {
                 Color myColor = SelColor;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -692,7 +704,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawRectangle(pen, startPointF.X, startPointF.Y, endPointF.X - startPointF.X, endPointF.Y - startPointF.Y);
             }
             //绘制颗粒
-            else if (createType == (int)CreateRectangleType.ParticleLine)
+            else if (createType == CreateRectangleType.ParticleLine)
             {
                 Color myColor = LineColor;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -705,7 +717,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawLine(pen, startPointF, endPointF);
             }
             //矩形
-            else if (createType == (int)CreateRectangleType.ParticleAreaRectangle)
+            else if (createType == CreateRectangleType.ParticleAreaRectangle)
             {
                 Color myColor = System.Drawing.Color.White;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -715,7 +727,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawRectangle(Pens.Black, m_Region);
             }
             //绘制样品孔BSE图像
-            else if (createType == (int)CreateRectangleType.DrawSampleHoleBSEImage)
+            else if (createType == CreateRectangleType.DrawSampleHoleBSEImage)
             {
                 Color myColor = System.Drawing.Color.White;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -733,7 +745,7 @@ namespace OTSMeasureApp
 
                 }
             }
-            else if (createType == (int)CreateRectangleType.DrawSEMCenterPoint)
+            else if (createType == CreateRectangleType.DrawSEMCenterPoint)
             {
                 Color myColor = System.Drawing.Color.Red;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -756,7 +768,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawLine(pen, startPointY, endPointY);
             }
             //绘制BSE标记
-            else if (createType == (int)CreateRectangleType.DrawBSEElementSignPoint)
+            else if (createType == CreateRectangleType.DrawBSEElementSignPoint)
             {
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Green);
                 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;  //图片柔顺模式选择
@@ -769,7 +781,7 @@ namespace OTSMeasureApp
                 e.Graphics.DrawLine(pen, new Point(X, Y-8), new Point(X, Y+8));
             }
             //绘制多边形测量区域
-            else if (createType == (int)CreateRectangleType.Polygon)
+            else if (createType == CreateRectangleType.Polygon)
             {
                 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;  //图片柔顺模式选择
                 e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
@@ -802,7 +814,7 @@ namespace OTSMeasureApp
                     }
                 }
             }//多边形测量区域完成标识
-            else if (createType == (int)CreateRectangleType.DrawPolygonFinish)
+            else if (createType == CreateRectangleType.DrawPolygonFinish)
             {
                 Color myColor = selColor;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -818,7 +830,7 @@ namespace OTSMeasureApp
 
 
             //绘制多边形测量区域
-            else if (createType == (int)CreateRectangleType.CircleByThreePoints)
+            else if (createType == CreateRectangleType.CircleByThreePoints)
             {
                 Color myColor = selColor;
                 System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
@@ -844,11 +856,11 @@ namespace OTSMeasureApp
             get { return m_IsSelect; }
             set { m_IsSelect = value; }
         }
-        public override bool IsSingle
-        {
-            get { return m_IsSingle; }
-            set { m_IsSingle = value; }
-        }
+        //public override bool IsSingle
+        //{
+        //    get { return m_IsSingle; }
+        //    set { m_IsSingle = value; }
+        //}
         public override bool IsWorkSample
         {
             get { return m_IsWorkSample; }
@@ -875,6 +887,23 @@ namespace OTSMeasureApp
             roundedRect.CloseFigure();
             return roundedRect;
         }
+
+        public override bool IfContains(Point mousePoint)
+        {
+            if (mousePoint.X > Region.Left && mousePoint.X < Region.Left + Region.Width)
+            {
+                if (mousePoint.Y >Region.Top && mousePoint.Y <Region.Top + Region.Height)
+                {
+                    return true;
+                
+                }
+            
+            
+            }
+            return false;
+        }
+
+    
         #endregion
         //是否设置为选择样品
         private bool m_IsSelect;
@@ -884,8 +913,8 @@ namespace OTSMeasureApp
         private bool m_IsDragging;
         //是否为工作样品
         private bool m_IsWorkSample;
-        private int createType;
-        private int shape;
+        private CreateRectangleType createType;
+        private ShapeType shape;
         private string id;
         private string name;
         public string sampleName;
@@ -949,7 +978,7 @@ namespace OTSMeasureApp
         //圆角矩形
         SampleBackGround_Rectangle = 1,
         //样品孔中的文字
-        Font = 2,
+        Text = 2,
         //矩形
         Rectangle = 3,
         //选择的样品
@@ -996,13 +1025,13 @@ namespace OTSMeasureApp
         //样品孔BSE图像
         SampleHoleBSEImage = 5,
         //帧图菜单
-        SingleMenu = 6
+        FieldMenu = 6
     }
 
     public enum MeasureStateMenuType
     {
         //获取BSE图
-        SampleParaLock = 0,
+        ReadBSEPic = 0,
         //设置可视化灰度
         SetVisualGray = 1,
         //显示BSE灰度曲线图
@@ -1022,11 +1051,7 @@ namespace OTSMeasureApp
         ExportReport =11
     }
 
-    //public enum photoMode
-    //{
-    //    measureMode=0,
-    //    sampleHoleMode=1
-    //}
+
     public enum MenuIndex
     {
         AddSample = 0,

File diff suppressed because it is too large
+ 52 - 779
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceGraphicsPanelFun.cs


File diff suppressed because it is too large
+ 407 - 472
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs


+ 67 - 115
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SEMDATAFieldManage.cs

@@ -6,29 +6,24 @@ using OTSDataType;
 using OTSModelSharp;
 
 using OTSModelSharp.ServiceInterface;
+using OTSMeasureApp._4_OTSSamplespaceGraphicsPanel;
 
 namespace OTSMeasureApp
 {
     public class SEMDATAFieldManage 
     {
         #region 全部变量声明
-        //连接状态
-        public bool ConnectionState = false;
-        // 判断是否是模拟状态 FASE:    不是在模拟环境下  True:    在模拟环境下
-        public bool IsSimulationStatus = false;
-        //获取当前电镜的ID号
-        //int SemType = 0;
-        //获取XML 路径
-        static string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
-        //日志路径
-        static string LogPath = System.Configuration.ConfigurationManager.ConnectionStrings["LogPath"].ConnectionString;
+    
+    
+       
+
         //电镜设置对象
         SemController cSemfun = null;
         ScanController cScanfun = null;
         EDSController cEDSfun = null;
         //主窗体对象
         COTSMeasureParam m_ProjData;
-        //CFieldPositionMgr cFieldMgrClr;
+ 
 
         NLog.Logger log ;
         #endregion
@@ -70,7 +65,7 @@ namespace OTSMeasureApp
             }
             catch (Exception ex)
             {
-                log.Error("SEMDATAFieldManage_InitAndConntion:--Error:" + ex.ToString() + "");
+                log.Error(ex.ToString() );
                 return false;
             }
         }
@@ -135,14 +130,14 @@ namespace OTSMeasureApp
             }
             catch (Exception ex)
             {
-                log.Error("SEMDATAFieldManage_GetSemWorkingDistance--错误日志:" + ex.ToString() + "");
+                log.Error(ex.ToString() );
                 return 0;
             }
         }
         #endregion
 
         #region 设置放大倍数
-        private bool SetGMagnification(double a_dMagnification)
+        public bool SetGMagnification(double a_dMagnification)
         {
             try
             {
@@ -154,14 +149,14 @@ namespace OTSMeasureApp
             }
             catch (Exception ex)
             {
-                log.Error("SEMDATAFieldManage_SetSemWorkingDistance--错误日志:" + ex.ToString() + "");
+                log.Error( ex.ToString() );
                 return false;
             }
         }
         #endregion
 
         #region 设置工作距离
-        private bool SetSemWorkingDistance(double a_WorkingDistance)
+        public bool SetSemWorkingDistance(double a_WorkingDistance)
         {
             try
             {
@@ -172,29 +167,13 @@ namespace OTSMeasureApp
             }
             catch (Exception ex)
             {
-                log.Error("SEMDATAFieldManage_SetSemWorkingDistance--错误日志:" + ex.ToString() + "");
+                log.Error(ex.ToString() );
                 return false;
             }
         }
         #endregion
 
-        #region 获取单点Xray与元素信息
-        /// <summary>
-        /// 获取单点Xray与元素信息
-        /// </summary>
-        /// <param name="a_Milliseconds">采集时间</param>
-        /// <param name="a_BSEX">鼠标在BSE图中X轴</param>
-        /// <param name="a_BSEY">鼠标在BSE图中Y轴</param>
-        /// <param name="a_ElementXrayData">Xray数组</param>
-        /// <param name="a_nElementNum">元素数量</param>
-        /// <param name="a_strElementName">元素名称</param>
-        /// <returns></returns>
-        public bool GetXRayAndElementInfo(uint a_Milliseconds, int a_BSEX, int a_BSEY, ref int[] a_ElementXrayData, ref ValueType a_nElementNum, ref string a_strElementName)
-        {
-            //获取Xray与元素信息
-            return false;// cfun.GetEDSControl().GetXRayByPoints(a_Milliseconds,  a_BSEX,  a_BSEY, ref a_ElementXrayData, ref a_nElementNum, ref a_strElementName);
-        }
-        #endregion
+     
 
         #region 获取电镜参数 放大倍数与工作距离
         public List<double> GetSEMMagAndWDParameter()
@@ -211,124 +190,97 @@ namespace OTSMeasureApp
         }
         #endregion
 
-        #region 设置电镜 放大倍数与工作距离
-        /// <summary>
-        /// 设置电镜 放大倍数
-        /// </summary>
-        /// <param name="a_dMagnification"></param>
-        /// <param name="a_WorkingDistance"></param>
-        /// <returns></returns>
-        public bool SetSEMMagnificationParameter(double a_dMagnification)
-        {
-            return SetGMagnification(a_dMagnification);
-        }
-        /// <summary>
-        /// 设置电镜 工作距离
-        /// </summary>
-        /// <param name="a_WorkingDistance"></param>
-        /// <returns></returns>
-        public bool SetSEMWorkingDistanceParameter(double a_WorkingDistance)
-        {
-            return SetSemWorkingDistance(a_WorkingDistance);
-        }
-        #endregion
+  
 
 
 
         #region 驱动SEM到当前位置
-        public bool SetSEMCurrentLocation( Point mousePoint, List<ARectangleGDIObject> m_RectangleGDIObjects, StageDrawingData oTSSampleStageData, int IsWidth, int Width, int Height)
+        public bool SetSEMCurrentLocation( Point mousePoint, CVisualStage stage)
         {
             try
             {
-                ARectangleGDIObject RectangleGDIObject = null;
-                //循环判断是否鼠标在样品范围中
-                foreach (ARectangleGDIObject item in m_RectangleGDIObjects)
+             
+                if (!stage.IfMouseInStage(mousePoint))
                 {
-                    if (item.Region.Contains(mousePoint))
-                    {
-                        //获取在范围中的样品
-                        RectangleGDIObject = item;
-                        break;
-                    }
+                    //获取在范围中的样品
+                    return false;
+                   
                 }
+              
                 //判断是否鼠标在样品台范围中
                 Point OTSLocation = new Point();
-                if (RectangleGDIObject != null)
-                {
-                    //鼠标在样品台中移动获取坐标
-                    OTSLocation = OTSSamplespaceGraphicsPanelFun.GetMouseLocationInRectangleGDIObject(mousePoint, m_RectangleGDIObjects[0], oTSSampleStageData, IsWidth, m_RectangleGDIObjects[0].Region.Width, m_RectangleGDIObjects[0].Region.Height);
+              
+                //鼠标在样品台中移动获取坐标
+                OTSLocation = stage.GetMouseSEMLocation(mousePoint);
 
-                    Point SEMPoint =m_ProjData.ChangeOTSToSemCoord(OTSLocation);
+                Point SEMPoint =m_ProjData.ConvertOTSToSemCoord(OTSLocation);
 
-                    //调用C++ controller中的方法
-                    //移动至当前位置
-                    bool result = cSemfun.MoveSEMToPoint(SEMPoint.X, SEMPoint.Y);
-                    if (result)
-                    {
-                        return result;
-                    }
+               
+                bool result = cSemfun.MoveSEMToPoint(SEMPoint.X, SEMPoint.Y);
+                if (result)
+                {
+                    return result;
                 }
+                
                 return false;
             }
-            catch (Exception)
+            catch (Exception ex)
             {
+                log.Error(ex.ToString());
                 return false;
             }
         }
         #endregion
 
         #region 驱动SEM到中心位置
-        public bool DriveSEMToLocation(Point mousePoint, List<ARectangleGDIObject> m_RectangleGDIObjects, List<ARectangleGDIObject> m_SingleGDIObjects, StageDrawingData oTSSampleStageData, int IsWidth, int Width, int Height)
+        public bool DriveSEMToLocation(Point mousePoint,CVisualStage stage, List<CRectangleGDIObject> m_MeasureFieldGDIObjects)
         {
             try
             {
-                ARectangleGDIObject RectangleGDIObject = null;
-                //循环判断是否鼠标在样品范围中
-                foreach (ARectangleGDIObject item in m_RectangleGDIObjects)
+               
+               
+                if (!stage.IfMouseInStage(mousePoint))
                 {
-                    if (item.Region.Contains(mousePoint))
-                    {
-                        //获取在范围中的样品台对象
-                        RectangleGDIObject = item;
-                        break;
-                    }
+                  
+                  
+                    return false;
                 }
+              
                 //判断是否鼠标在样品台范围中
                 Point OTSLocation = new Point();
-                if (RectangleGDIObject != null)
+             
+                //鼠标在样品台中移动获取坐标
+                OTSLocation = stage.GetMouseSEMLocation(mousePoint);
+                Point SEMPoint = m_ProjData.ConvertOTSToSemCoord(OTSLocation);
+                //循环single中所有对象 进行位置匹配
+                for (int i = 0; i < m_MeasureFieldGDIObjects.Count; i++)
                 {
-                    //鼠标在样品台中移动获取坐标
-                    OTSLocation = OTSSamplespaceGraphicsPanelFun.GetMouseLocationInRectangleGDIObject(mousePoint, RectangleGDIObject, oTSSampleStageData, IsWidth, RectangleGDIObject.Region.Width, RectangleGDIObject.Region.Height);
-                    Point SEMPoint = m_ProjData.ChangeOTSToSemCoord(OTSLocation);
-                    //循环single中所有对象 进行位置匹配
-                    for (int i = 0; i < m_SingleGDIObjects.Count; i++)
+                    if (m_MeasureFieldGDIObjects[i].Region.Contains(mousePoint))
                     {
-                        if (m_SingleGDIObjects[i].Region.Contains(mousePoint))
+                        //获取帧图左上坐标
+                        Point LT = new Point((int)m_MeasureFieldGDIObjects[i].RegionF.Left, (int)m_MeasureFieldGDIObjects[i].RegionF.Top);
+                        Point lTLocation = stage.GetMouseSEMLocation(LT);
+                        lTLocation = m_ProjData.ConvertOTSToSemCoord(lTLocation);
+                        //获取帧图右下坐标
+                        Point RB = new Point((int)m_MeasureFieldGDIObjects[i].RegionF.Right, (int)m_MeasureFieldGDIObjects[i].RegionF.Bottom);
+                        Point rbLocation = stage.GetMouseSEMLocation(RB);
+                        rbLocation = m_ProjData.ConvertOTSToSemCoord(rbLocation);
+
+                        int diffX = Math.Abs(rbLocation.X - lTLocation.X) / 2;
+                        int diffY = Math.Abs(rbLocation.Y - lTLocation.Y) / 2;
+                        //移动至帧图中心位置 
+                        int moveCenterX = lTLocation.X - diffX;
+                        int moveCenterY = lTLocation.Y + diffY;
+                        bool result = cSemfun.MoveSEMToPoint(moveCenterX, moveCenterY);
+                        if (result)
                         {
-                            //获取帧图左上坐标
-                            Point LT = new Point((int)m_SingleGDIObjects[i].RegionF.Left, (int)m_SingleGDIObjects[i].RegionF.Top);
-                            Point lTLocation = OTSSamplespaceGraphicsPanelFun.GetMouseLocationInRectangleGDIObject(LT, RectangleGDIObject, oTSSampleStageData, IsWidth, RectangleGDIObject.Region.Width, RectangleGDIObject.Region.Height);
-                            lTLocation = m_ProjData.ChangeOTSToSemCoord(lTLocation);
-                            //获取帧图右下坐标
-                            Point RB = new Point((int)m_SingleGDIObjects[i].RegionF.Right, (int)m_SingleGDIObjects[i].RegionF.Bottom);
-                            Point rbLocation = OTSSamplespaceGraphicsPanelFun.GetMouseLocationInRectangleGDIObject(RB, RectangleGDIObject, oTSSampleStageData, IsWidth, RectangleGDIObject.Region.Width, RectangleGDIObject.Region.Height);
-                            rbLocation = m_ProjData.ChangeOTSToSemCoord(rbLocation);
-
-                            int diffX = Math.Abs(rbLocation.X - lTLocation.X) / 2;
-                            int diffY = Math.Abs(rbLocation.Y - lTLocation.Y) / 2;
-                            //移动至帧图中心位置 
-                            int moveCenterX = lTLocation.X - diffX;
-                            int moveCenterY = lTLocation.Y + diffY;
-                            bool result = cSemfun.MoveSEMToPoint(moveCenterX, moveCenterY);
-                            if (result)
-                            {
-                                return result;
-                            }
+                            return result;
                         }
                     }
                 }
+               
                 return false;
-            }
+        }
             catch (Exception)
             {
                 return false;

+ 66 - 51
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -74,7 +74,7 @@ namespace OTSMeasureApp
         //记录采集点
         List<Point> m_ElementSignPoint = new List<Point>();
         //绘制采集点对象
-        public static List<ARectangleGDIObject> m_ElementPointGDIObjects;
+        public static List<CRectangleGDIObject> m_ElementPointGDIObjects;
         Point m_mouseCurrentPoint = new Point();
         //鼠标缩放倍数
         float m_CurrentMultiple = 0;
@@ -128,7 +128,7 @@ namespace OTSMeasureApp
             {
                 m_ImageData = new OTSImageData(this, m_MeasureAppForm);
             }
-            m_ElementPointGDIObjects = new List<ARectangleGDIObject>();
+            m_ElementPointGDIObjects = new List<CRectangleGDIObject>();
         
             //进入时首先对XRayTable进行隐藏
             panelXray.Visible = false;
@@ -893,7 +893,7 @@ namespace OTSMeasureApp
                         if (m_ElementPointGDIObjects.Count > 0)
                         {
                             //绘制采集点标记
-                            foreach (ARectangleGDIObject item in m_ElementPointGDIObjects)
+                            foreach (CRectangleGDIObject item in m_ElementPointGDIObjects)
                             {
                                 if (item != null)
                                 {
@@ -1164,18 +1164,12 @@ namespace OTSMeasureApp
                     contextMenuStrip1.Show(PointToScreen(mousePoint));
                     //电镜位置信息
                     Point semLocatin = new Point((int)dPositionX, (int)dPositionY);
-                    Rectangle semRect = new Rectangle();
-                    if (IsSEMLocationOnTheSampleStage(semLocatin, ref semRect))
+                    //Rectangle semRect = new Rectangle();
+                    if (IsSEMLocationOnTheSampleStage(semLocatin))
                     {
                         SetContentMenu();
                     }
-                    if (m_MeasureAppForm.MeasureThreadRunFlag)
-                    {
-                        foreach (ToolStripItem item in contextMenuStrip1.Items)
-                        {
-                            item.Enabled = false;
-                        }
-                    }
+                    
                 }
             }
             catch (Exception ex)
@@ -1312,7 +1306,7 @@ namespace OTSMeasureApp
             pbBSEImage.Hide();
             foreach (ToolStripItem item in contextMenuStrip1.Items)
             {
-                if (item != contextMenuStrip1.Items[(int)MeasureStateMenuType.SampleParaLock])
+                if (item != contextMenuStrip1.Items[(int)MeasureStateMenuType.ReadBSEPic])
                 {
                     item.Enabled = false;
                 }
@@ -1372,43 +1366,43 @@ namespace OTSMeasureApp
         /// <param name="semLocation">电镜当前位置</param>
         /// <param name="SampleStage">样品台尺寸与位置</param>
         /// <returns></returns>
-        public bool IsSEMLocationOnTheSampleStage(Point semLocation, ref Rectangle semRect)
+        public bool IsSEMLocationOnTheSampleStage(Point semLocation)
         {
             //获取样品台信息
-            StageDrawingData SData = m_MeasureAppForm.m_SamplepaceWindow.m_OTSSampleStageData;
-            string stageName = SData.sStageName;
-            int widthDomain = 0;
-            int heightDomain = 0;
-            //获取样品台
-            int StageShape = SData.bStageShape;
-
-            ValueType XDomain = new Point(SData.StageDomain.Left, SData.StageDomain.Top);
-            ValueType YDomain = new Point(SData.StageDomain.Right, SData.StageDomain.Bottom);
-            //转换类型
-            Point xDomain = ((System.Drawing.Point)XDomain);
-            Point yDomain = ((System.Drawing.Point)YDomain);
-            //宽度
-            widthDomain = Math.Abs(((Point)yDomain).X - ((Point)xDomain).X);
-            heightDomain = Math.Abs(((Point)yDomain).Y - ((Point)xDomain).Y);
-            //设置样品台宽度
-            int wDomain = widthDomain;
-            int IsWidth = this.Height > this.Width ? 0 : 1;
-            int Shape = SData.bStageShape;
-            CreateRectangle CreateBourary = null;
-            //0:区域圆形 1:区域矩形 2:文字 
-            if (SData.bStageShape == (int)CreateRectangleType.Rectangle)
-            {
-                CreateBourary = OTSSamplespaceGraphicsPanelFun.GetPixRect(widthDomain, xDomain, yDomain, (int)CreateRectangleType.Rectangle, "", "", IsWidth, this.Width, this.Height);
-            }
-            else
-            {
-                CreateBourary = OTSSamplespaceGraphicsPanelFun.GetPixRect(widthDomain, xDomain, yDomain, (int)CreateRectangleType.SampleBackGround_Circle, "", "", IsWidth, this.Width, this.Height);
-
-            }
-            //获取SEM位置
-            CreateRectangle semRectangle = OTSSamplespaceGraphicsPanelFun.GetPixRect(widthDomain, semLocation, semLocation, (int)CreateRectangleType.Rectangle, "", "", IsWidth, this.Width, this.Height);
-            semRect = semRectangle.Region;
-            return CreateBourary.Region.Contains(semRectangle.Region.Location);
+            //StageDrawingData SData = m_MeasureAppForm.m_SamplepaceWindow.m_visualStage.GetOTSSampleStageData();
+            //string stageName = SData.sStageName;
+            //int widthDomain = 0;
+            //int heightDomain = 0;
+            ////获取样品台
+            //ShapeType StageShape = SData.bStageShape;
+
+            //ValueType XDomain = new Point(SData.StageDomain.Left, SData.StageDomain.Top);
+            //ValueType YDomain = new Point(SData.StageDomain.Right, SData.StageDomain.Bottom);
+            ////转换类型
+            //Point xDomain = ((System.Drawing.Point)XDomain);
+            //Point yDomain = ((System.Drawing.Point)YDomain);
+            ////宽度
+            //widthDomain = Math.Abs(((Point)yDomain).X - ((Point)xDomain).X);
+            //heightDomain = Math.Abs(((Point)yDomain).Y - ((Point)xDomain).Y);
+            ////设置样品台宽度
+            //int wDomain = widthDomain;
+            //int IsWidth = this.Height > this.Width ? 0 : 1;
+            //ShapeType Shape = SData.bStageShape;
+            //CreateRectangle CreateBourary = null;
+            ////0:区域圆形 1:区域矩形 2:文字 
+            //if (SData.bStageShape == (ShapeType)CreateRectangleType.Rectangle)
+            //{
+            //    CreateBourary = m_MeasureAppForm.m_SamplepaceWindow.m_visualStage.GetCtrlCoordRect ( xDomain,yDomain,CreateRectangleType.Rectangle, "", "");
+            //}
+            //else
+            //{
+            //    CreateBourary = OTSSamplespaceGraphicsPanelFun.GetPixRect(CreateRectangleType.SampleBackGround_Circle, "", "",  this.Width, this.Height);
+
+            //}
+            ////获取SEM位置
+            //CreateRectangle semRectangle = OTSSamplespaceGraphicsPanelFun.GetPixRect( CreateRectangleType.Rectangle, "", "",  this.Width, this.Height);
+            //semRect = semRectangle.Region;
+            return m_MeasureAppForm.m_SamplepaceWindow.m_visualStage.IfMouseInStage(semLocation);
         }
         #endregion
 
@@ -1428,14 +1422,35 @@ namespace OTSMeasureApp
             }
             else
             {
+                if (m_MeasureAppForm.MeasureThreadRunFlag)
+                {
+                    if (m_MeasureAppForm.m_MsrThreadWrapper.BgWorkIsPaused())
+                    {
+                        foreach (ToolStripItem item in contextMenuStrip1.Items)
+                        {
+                            item.Enabled = true;
+                        }
+
+                    }
+                    else
+                    {
+                        foreach (ToolStripItem item in contextMenuStrip1.Items)
+                        {
+                            item.Enabled = false;
+                        }
+                    }
+
+                }
                 double iWDistance = 0;
                 double dMagni = 0;
                 m_MeasureAppForm.m_ProjParam.GetWorkingSampleSEMData(ref iWDistance, ref dMagni);
                 if (iWDistance != 0 && dMagni != 0)
                 {
-                    contextMenuStrip1.Items[(int)MeasureStateMenuType.SampleParaLock].Enabled = true;
+                    contextMenuStrip1.Items[(int)MeasureStateMenuType.ReadBSEPic].Enabled = true;
                 }
+
             }
+           
         }
         #endregion
         #region 获取线扫描初始位置
@@ -1550,7 +1565,7 @@ namespace OTSMeasureApp
                         //4-2 根据位置绘制标记
                         Point ImgPoint = new Point((int)dMouseImgX, (int)dMouseImgY);
                         Rectangle rect = new Rectangle(p_mouseCurrentTempPoint, new Size(1, 1));
-                        CreateRectangle createRect = new CreateRectangle(rect, ImgPoint, m_CurrentMultiple, (int)CreateRectangleType.DrawBSEElementSignPoint);
+                        CreateRectangle createRect = new CreateRectangle(rect, ImgPoint, m_CurrentMultiple, CreateRectangleType.DrawBSEElementSignPoint);
                         m_ElementPointGDIObjects.Add(createRect);
                         //5.获取成功后弹出对话框
                         //计数率
@@ -1843,7 +1858,7 @@ namespace OTSMeasureApp
         {
             if (m_ElementPointGDIObjects.Count > 0)
             {
-                foreach (ARectangleGDIObject item in m_ElementPointGDIObjects)
+                foreach (CRectangleGDIObject item in m_ElementPointGDIObjects)
                 {
                     RectangleF rectF = new RectangleF();
                     rectF.X = item.RegionF.X + Convert.ToSingle(dMouseImgX) * m_CurrentMultiple;

+ 18 - 32
OTSIncAMeasureApp/6-OTSDisplayTreeViewData/OTSSolutionWindow.cs

@@ -44,8 +44,7 @@ namespace OTSMeasureApp
             table = lan.GetNameTable(this.Name);
             m_DefaultSolutionName = table["m_defaultsolutionname"].ToString();
             m_DefaultSampleName = table["m_defaultsamplename"].ToString();
-            // 初始化事件对象
-            //this.InitSoluDelegateEvent();
+        
         }
 
         private void OTSSolutionWindow_Load(object sender, EventArgs e)
@@ -56,29 +55,24 @@ namespace OTSMeasureApp
            log = NLog.LogManager.GetCurrentClassLogger();
         }
         
-        // 当TREEVIEW 样品数的样品顺序发生变化后,执行TREEVIEW树上的样品排序
+  
         public void Rev_SoluWindow_SampleSortOrder_Event()
         {
             m_TreeViewBase.SortTreeNodeList();
         }
 
-        // MeasureApp 和 OTSSolutionWindow 交互样品信息
-        //List<CTreeSampleParam> TSampleParamList : //MeasureApp 给 SoluWindow 发送打开已存在的样品LIST (之前可能保存了多个样品)
-        //CTreeSampleParam WorkSampleParam :    工作样品参数  (保存了多个样品,其中的一个是工作样品)
-        public void Rev_MeasureApp_OpenExistSampleFile_Event(List<CTreeSampleParam> TSampleParamList, CTreeSampleParam WorkSampleParam)
+  
+        public void OpenExistSampleFile(List<CTreeSampleParam> TSampleParamList, CTreeSampleParam WorkSampleParam)
         {
             this.m_TreeViewBase.DisplayTreeViewData(TSampleParamList, WorkSampleParam);
         }
 
-        //切换当前工作样品
-        //string sNewWorkSample : 新的工作样品名
-        public void Rev_MeasureApp_SwitchSample_Event(string sNewWorkSample)
+        public void SwitchSample(string sNewWorkSample)
         {
             m_TreeViewBase.SwitchWorkSample(sNewWorkSample);
         }
 
-        // MeasureApp 和 OTSSolutionWindow 交互样品信息
-        //CWorkSampleParam WSampleParam : //MeasureApp 给 SoluWindow 发送添加样品的样品信息
+
         public void AddSampleMeasure(CTreeSampleParam TSampleParam)
         {
             m_WorkSampleParam = TSampleParam;
@@ -100,8 +94,7 @@ namespace OTSMeasureApp
             this.m_TreeViewBase.ReSetWorkSampleFoucs();
         }
 
-        // 新
-        //MeasureApp 给 OTSSolutionWindow 发送样品checkbox发生变化事件
+
         public void Rev_MeasureApp_CheckboxStatuChange_Event(string sSampleName, bool bCheckBoxStatu)
         {
             m_TreeViewBase.SetSampleCheckboxStatu(sSampleName, bCheckBoxStatu);
@@ -115,14 +108,10 @@ namespace OTSMeasureApp
                 return;
             }
 
-            // 将Treeview里的修改的样品名修改为新样品名
-
-            //      this.EditTreeSampleName(sSampleOldName, sSampleNewName);
             m_TreeViewBase.EditTreeNodeSampleName(sSampleOldName, sSampleNewName);
         }
        
-        //修改样品名请求返回后,将样品名设置为新样品名
-        // 返回 True: 说明修改成功
+
         bool bChangeNodeTextFlag = false;
        
         private void ChangeNodeText(TreeNode node, string sOldSName, string sNewSName)
@@ -181,7 +170,7 @@ namespace OTSMeasureApp
         //sNewSName: 修改样品的新名称
         private void GetNodeText(TreeNode node)
         {
-            //     result.Add(node.Text);
+           
             if (node.Checked)
             {
                 csCheckNodeName = node.Text;
@@ -209,18 +198,17 @@ namespace OTSMeasureApp
                 if (e.Node.IsSelected)
                 {
                     //判断的选中的CHECKBOX和焦点都在当前被选择的节点上,切换当前工作样品
-                    //       m_DeleteOrLockTreeNode = e.Node;
+                
                     m_WorkSampleNode = e.Node;
                     treeView1.SelectedNode = e.Node;    //当前被选中
                                                         // OTSSolutionWindow窗口给MeasureApp窗口发送改变工作样品请求
                     treeView1.Refresh();
-                    // OTSSolutionWindow窗口给MeasureApp窗口发送改变工作样品请求
-                    //当选择的样品节点不是工作样品再切换
+                   
                     string sWorkName = m_MeasureAppForm.m_ProjParam.GetWorkSampleName();
                     if ("" != sWorkName && (sWorkName != e.Node.Text))
                     {
-                        //m_MeasureAppForm.m_EventFun.Send_SwithcWSample_SoluWindowReqMeasureApp_Event_Fun(e.Node.Text);
-                        Rev_MeasureApp_SwitchSample_Event(e.Node.Text);
+                    
+                        SwitchSample(e.Node.Text);
                     }
                 }
             }  
@@ -230,19 +218,17 @@ namespace OTSMeasureApp
         private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
         {
 
-            //OTSSolutionWindow 给 MeasureApp 发送样品checkbox状态由鼠标/键盘 触发状态变化事件
             if (e.Action == TreeViewAction.ByMouse || e.Action == TreeViewAction.ByKeyboard)
             {
                 // 切换工作样品
                 string sWorkName = m_MeasureAppForm.m_ProjParam.GetWorkSampleName();
                 if ("" != sWorkName && (sWorkName != e.Node.Text))
                 {
-                    //m_MeasureAppForm.m_EventFun.Send_SwithcWSample_SoluWindowReqMeasureApp_Event_Fun(e.Node.Text);
+              
                     m_MeasureAppForm.SwitchWSample(e.Node.Text);
                 }
 
-                //OTSSolutionWindow 给 MeasureApp 发送样品checkbox发生变化事件
-                //m_MeasureAppForm.m_EventFun.Send_CheckBoxStatu_SoluWindowToMeasureAPP_Event_Fun(e.Node.Text, e.Node.Checked);
+       
                 m_MeasureAppForm.Rev_SoluWindowReqCheckBosStatuChange_Event(e.Node.Text, e.Node.Checked);
             }
         }
@@ -302,7 +288,7 @@ namespace OTSMeasureApp
             TreeNode tn = (TreeNode)e.Node;
             string sWorkName = m_MeasureAppForm.m_ProjParam.GetWorkSampleName();
 
-            //m_MeasureAppForm.m_EventFun.Send_SwithcWSample_SoluWindowReqMeasureApp_Event_Fun(tn.Text);
+           
             m_MeasureAppForm.SwitchWSample(tn.Text);
                 //切换工作样品,通知Grid更新工作样品属性值
                 m_bSetWorkSampleFlag = true;
@@ -584,7 +570,7 @@ namespace OTSMeasureApp
             }
 
             //m_MeasureAppForm.m_EventFun.Send_SwithcWSample_SoluWindowReqMeasureApp_Event_Fun(moveNode.Text);
-            Rev_MeasureApp_SwitchSample_Event(moveNode.Text);
+            SwitchSample(moveNode.Text);
 
 
 
@@ -598,7 +584,7 @@ namespace OTSMeasureApp
             {
                 treeView1.SelectedNode = moveNode;
                 //m_MeasureAppForm.m_EventFun.Send_SwithcWSample_SoluWindowReqMeasureApp_Event_Fun(moveNode.Text);
-                Rev_MeasureApp_SwitchSample_Event(moveNode.Text);
+                SwitchSample(moveNode.Text);
                 return;
             }
             //如果目标节点无子节点则添加为同级节点,反之添加到下级节点的未端

+ 0 - 466
OTSIncAMeasureApp/8-OTSSampleMeasureInfo/OTSSampleData.cs

@@ -1,466 +0,0 @@
-using OTSDataType;
-using OTSModelSharp.ResourceManage;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace OTSMeasureApp
-{
-
-    enum OTS_X_AXIS_DIRECTION
-    {
-        LEFT_TOWARD = 0,
-        RIGHT_TOWARD = 1
-    };
-
-    enum OTS_Y_AXIS_DIRECTION
-    {
-        UP_TOWARD = 0,
-        DOWN_TOWARD = 1
-    };
-
-
-
-    //样品孔信息,包括样品孔名称,样品孔形状,样品口坐标
-    public class OTSSampleHoleInfo
-    {
-      public  String sSHoleName;            //样品孔名称
-      public int iSHoleShape;              // 样品口形状      1: 矩形;  0: 圆形
-                                           //    public  Point sSHoleStartPoint;     // 样品孔起点坐标
-                                           //    public  Point sSHoleEndPoint;      //样品孔终点坐标
-      public Rectangle HoleRect;          //样品孔大小
-
-    }
-
-    // 用于绘制样品台的数据
-   public class StageDrawingData
-    {
-        public StageDrawingData()
-        {
-            sSHoleInfoList = new List<OTSSampleHoleInfo>();
-        }
-
-        //绘制样品台形状信息
-        //样品台名称
-        public String sStageName;                //样品台名称
-        public int bStageShape;                 // 样品台形状。  1: 矩形;  0: 圆形
-                                                //    public Point PSStageStartPos;           //样品台起点坐标
-                                                //    public Point PSStageEndPos;            //样品台终点坐标
-        public Rectangle StageDomain;           //样品台的大小
-        public int bSampleShape;               //标样形状     1: 矩形;  0: 圆形
-                                               //    public Point PSSampleStartPos;          // 标样起点坐标
-                                               //    public Point PSSampleEndPos;            // 
-        public Rectangle SampleRect;           //标样大小
-        public List<OTSSampleHoleInfo> sSHoleInfoList;          //样品孔信息List
-
-
-        //绘制样品台坐标信息
-        public int iScanFieldSize100;            //放大倍数为100倍时的屏幕尺寸
-        public int iXAxisDir;                    // X轴方向 ,参看 enum  OTS_X_AXIS_DIRECTION
-        public int iXAxisStartVal;               //X轴起点值
-        public int iXAxisEndVal;                 //X轴终点值
-        public int iYAxisDir;                    //Y轴方向,,参看enum  OTS_Y_AXIS_DIRECTION
-        public int iYAxisStartVal;               //Y轴起点值
-        public int iYAxisEndVal;                 //Y轴终点值.
-
-    }
-    
-    public class TestSampleInfo
-    {
-        OTSIncAMeasureAppForm m_MeasureApp = null;
-        public TestSampleInfo(OTSIncAMeasureAppForm Mapp)
-        {
-            m_MeasureApp = Mapp;
-        }
-        // 测试标题栏的显示
-        public OTSSamplePropertyInfo TestShowGrid(String sSampleName,bool bFlag=false)
-        {
-            OTSSamplePropertyInfo m_SMInfo = new OTSSamplePropertyInfo();
-           
-            m_SMInfo.sSampleSoluName = "Project";
-            //样品名
-            SamplePropertyData sData = new SamplePropertyData();
-            sData.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_NAME;
-            sData.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData.sSCaptionName = "样品名";
-            sData.SampleVal = sSampleName;
-            sData.bReadOnly = true;
-            m_SMInfo.SampleDataList.Add(sData);
-            //样品孔名称
-            SamplePropertyData sData1 = new SamplePropertyData();
-            sData1.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.SAMPLE_HOLE_NAME;
-            sData1.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData1.sSCaptionName = "样品孔名称";
-            sData1.SampleVal = "样品孔1";
-            sData1.bReadOnly = true;
-            m_SMInfo.SampleDataList.Add(sData1);
-
-            //Switch
-            SamplePropertyData sData2 = new SamplePropertyData();
-            sData2.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.SWITCH;
-            sData2.iSampleValType = OTS_ITEM_TYPES.BOOL;
-            sData2.sSCaptionName = "开关";
-            if((string)sData.SampleVal == "Sample3" || (string)sData.SampleVal == "Sample4" || (string)sData.SampleVal == "Sample2")
-            {
-                sData2.SampleVal = true;
-                m_SMInfo.bSwitch = true;
-            }
-            else
-            {
-                sData2.SampleVal = bFlag;
-                m_SMInfo.bSwitch = false;
-            }
-            
-            m_SMInfo.SampleDataList.Add(sData2);
-
-            //样品测量参数文件名
-            SamplePropertyData sData3 = new SamplePropertyData();
-            sData3.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_PARAM_FILE_NAME;
-            sData3.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData3.sSCaptionName = "样品测量参数文件名";
-            List<string> m_FileList = new List<string>();
-            m_FileList.Add("文件1");
-            m_FileList.Add("文件2");
-            m_FileList.Add("文件3");
-            m_FileList.Add("文件4");
-            sData3.SampleVal = m_FileList;
-            m_SMInfo.SampleDataList.Add(sData3);
-
-            //颗粒分析标准库名
-            SamplePropertyData sData4 = new SamplePropertyData();
-            sData4.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.STD_FILE_NAME;
-            sData4.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData4.sSCaptionName = "颗粒分析标准库名";
-            //  sData4.SampleVal = "\\Config\\SysData\\OTSStage.stg";
-            List<string> m_LibList = new List<string>();
-            m_LibList.Add("标准库1");
-            m_LibList.Add("标准库2");
-            m_LibList.Add("标准库3");
-            m_LibList.Add("标准库4");
-            sData4.SampleVal = m_LibList;
-            m_SMInfo.SampleDataList.Add(sData4);
-
-
-            //图像扫描参数组(Image)
-
-
-
-            //开始模式
-            SamplePropertyData sData5 = new SamplePropertyData();
-            sData5.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.START_MODE;
-            sData5.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData5.sSCaptionName = "开始模式";
-            List<string> m_ValList = new List<string>();
-            m_ValList.Add("中心");
-            m_ValList.Add("自上而下");
-            m_ValList.Add("自下而上");
-            m_ValList.Add("随机");
-            sData5.SampleVal = m_ValList;
-            m_SMInfo.SampleDataList.Add(sData5);
-
-            //停止模式
-            SamplePropertyData sData6 = new SamplePropertyData();
-            sData6.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.STOP_MODE;
-            sData6.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData6.sSCaptionName = "停止模式";
-            List<string> m_ValList1 = new List<string>();
-            m_ValList1.Add("覆盖测量区域");
-            m_ValList1.Add("幁图数");
-            m_ValList1.Add("颗粒数");
-            m_ValList1.Add("时间");
-            sData6.SampleVal = m_ValList1;
-            m_SMInfo.SampleDataList.Add(sData6);
-
-            //扫描速度
-            SamplePropertyData sData7 = new SamplePropertyData();
-            sData7.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.SCAN_SPEED;
-            sData7.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData7.sSCaptionName = "停止模式";
-            List<string> m_ValList2 = new List<string>();
-            m_ValList2.Add("高");
-            m_ValList2.Add("中");
-            m_ValList2.Add("低");
-            sData7.SampleVal = m_ValList2;
-            m_SMInfo.SampleDataList.Add(sData7);
-
-            //扫描图尺寸
-            SamplePropertyData sData8 = new SamplePropertyData();
-            sData8.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGE_RESOLUTION;
-            sData8.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData8.sSCaptionName = "扫描图尺寸";
-            List<string> m_ValList3 = new List<string>();
-            m_ValList3.Add("点扫描");
-            m_ValList3.Add("面扫描");
-            sData8.SampleVal = m_ValList3;
-            m_SMInfo.SampleDataList.Add(sData8);
-
-
-
-            // 图像处理参数(Image Process)
-            //颗粒面积最小范围
-            SamplePropertyData sData9 = new SamplePropertyData();
-            sData9.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MIN;
-            sData9.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData9.sSCaptionName = "颗粒面积最小范围";
-            sData9.SampleVal = 10;
-            m_SMInfo.SampleDataList.Add(sData9);
-
-            //颗粒面积最大范围
-            SamplePropertyData sData10 = new SamplePropertyData();
-            sData10.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.PARTICLE_AREA_MAX;
-            sData10.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData10.sSCaptionName = "颗粒面积最大范围";
-            sData10.SampleVal = 50;
-            m_SMInfo.SampleDataList.Add(sData10);
-
-            //背景灰度最小范围
-            SamplePropertyData sData11 = new SamplePropertyData();
-            sData11.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MIN;
-            sData11.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData11.sSCaptionName = "背景灰度最小范围";
-            sData11.SampleVal = 20;
-            m_SMInfo.SampleDataList.Add(sData11);
-
-            //背景灰度最大范围
-            SamplePropertyData sData12 = new SamplePropertyData();
-            sData12.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX;
-            sData12.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData12.sSCaptionName = "背景灰度最大范围";
-            sData12.SampleVal = 60;
-            m_SMInfo.SampleDataList.Add(sData12);
-
-            //颗粒灰度最小范围
-            SamplePropertyData sData13 = new SamplePropertyData();
-            sData13.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX;
-            sData13.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData13.sSCaptionName = "颗粒灰度最小范围";
-            sData13.SampleVal = 30;
-            m_SMInfo.SampleDataList.Add(sData13);
-
-            //颗粒灰度最大范围
-            SamplePropertyData sData14 = new SamplePropertyData();
-            sData14.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.BG_GRAY_MAX;
-            sData14.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData14.sSCaptionName = "颗粒灰度最大范围";
-            sData14.SampleVal = 70;
-            m_SMInfo.SampleDataList.Add(sData14);
-
-
-            //x-ray参数组(x-ray)
-            //搜索x-ray精度 
-            SamplePropertyData sData15 = new SamplePropertyData();
-            sData15.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.SEARCH_RESOLUTION;
-            sData15.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData15.sSCaptionName = "搜索x-ray精度";
-            List<string> m_ValList4 = new List<string>();
-            m_ValList4.Add("低");
-            m_ValList4.Add("中");
-            m_ValList4.Add("高");
-            //   m_ValList3.Add("时间");
-            sData15.SampleVal = m_ValList4;
-            m_SMInfo.SampleDataList.Add(sData15);
-
-            //x - ray最低计数
-            SamplePropertyData sData16 = new SamplePropertyData();
-            sData16.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.LOW_COUNTS;
-            sData16.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData16.sSCaptionName = "XRay最低计数";
-            sData16.SampleVal = 100;
-            m_SMInfo.SampleDataList.Add(sData16);
-
-            //分析x-ray精度 
-            SamplePropertyData sData17 = new SamplePropertyData();
-            sData17.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_RESOLUTION;
-            sData17.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData17.sSCaptionName = "分析XRay精度";
-            List<string> m_ValList5 = new List<string>();
-            m_ValList5.Add("低");
-            m_ValList5.Add("中");
-            m_ValList5.Add("高");
-            //   m_ValList3.Add("时间");
-            sData17.SampleVal = m_ValList5;
-            m_SMInfo.SampleDataList.Add(sData17);
-
-            // x-ray扫描方式 
-            SamplePropertyData sData18 = new SamplePropertyData();
-            sData18.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.SCAN_MODE;
-            sData18.iSampleValType = OTS_ITEM_TYPES.COMBO;
-            sData18.sSCaptionName = "XRay扫描方式";
-            List<string> m_ValList6 = new List<string>();
-            m_ValList6.Add("点扫描");
-            m_ValList6.Add("面扫描");
-            //m_ValList6.Add("高");
-            //   m_ValList3.Add("时间");
-            sData18.SampleVal = m_ValList6;
-            m_SMInfo.SampleDataList.Add(sData18);
-
-            //分析x-ray计数期望值
-            SamplePropertyData sData19 = new SamplePropertyData();
-            sData19.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.ANALYSIS_COUNTS;
-            sData19.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData19.sSCaptionName = "分析XRay计数期望值";
-            sData19.SampleVal = 800;
-            m_SMInfo.SampleDataList.Add(sData19);
-
-            //SEM工作参数组(SEM Data)
-            //放大倍数
-            SamplePropertyData sData20 = new SamplePropertyData();
-            sData20.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.MAGNIFICATION;
-            sData20.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData20.sSCaptionName = "放大倍数";
-            sData20.SampleVal = "100";
-            m_SMInfo.SampleDataList.Add(sData20);
-
-            //测量精度
-            SamplePropertyData sData21 = new SamplePropertyData();
-            sData21.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.IMAGERESOLUTION_SIZE;
-            sData21.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData21.sSCaptionName = "测量精度";
-            sData21.SampleVal = "高精度";
-            m_SMInfo.SampleDataList.Add(sData21);
-
-            //工作距离  
-            SamplePropertyData sData22 = new SamplePropertyData();
-            sData22.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.WORKING_DISTANCE;
-            sData22.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData22.sSCaptionName = "工作距离";
-            sData22.SampleVal = "200";
-            m_SMInfo.SampleDataList.Add(sData22);
-
-            //覆盖测量区域帧图数  
-            SamplePropertyData sData23 = new SamplePropertyData();
-            sData23.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_FIELDS;
-            sData23.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData23.sSCaptionName = "覆盖测量区域帧图数";
-            sData23.SampleVal = "4000";
-            m_SMInfo.SampleDataList.Add(sData23);
-
-            //样品测量状态(Measure status) 
-            //测量状态  
-            SamplePropertyData sData24 = new SamplePropertyData();
-            sData24.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.MEASURE_STATAU;
-            sData24.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData24.sSCaptionName = "测量状态";
-            sData24.SampleVal = "未测量";
-            m_SMInfo.SampleDataList.Add(sData24);
-
-
-            //测量开始时间
-            DateTime dt = DateTime.Now;
-            String sDate = dt.ToString();
-            //    MessageBox.Show(sDate);
-            SamplePropertyData sData25 = new SamplePropertyData();
-            sData25.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.START_TIME;
-            sData25.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData25.sSCaptionName = "测量开始事件";
-            sData25.SampleVal = sDate;
-            m_SMInfo.SampleDataList.Add(sData25);
-
-            //Thread.Sleep(1000);
-
-            //已经测量时间
-            DateTime dt1 = DateTime.Now;
-            String sDate1 = this.DateDiff(dt1, dt);
-            //    MessageBox.Show(sDate);
-            SamplePropertyData sData26 = new SamplePropertyData();
-            sData26.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.USED_TIME;
-            sData26.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData26.sSCaptionName = "已经测量时间";
-            sData26.SampleVal = sDate1;
-            m_SMInfo.SampleDataList.Add(sData26);
-
-            //完成时间
-            SamplePropertyData sData27 = new SamplePropertyData();
-            sData27.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.FINISH_TIME;
-            sData27.iSampleValType = OTS_ITEM_TYPES.STRING;
-            sData27.sSCaptionName = "完成时间";
-            sData27.SampleVal = dt1.ToString();
-            m_SMInfo.SampleDataList.Add(sData27);
-
-            //完成幁图数
-            SamplePropertyData sData28 = new SamplePropertyData();
-            sData28.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.COMPLETED_FIELDS;
-            sData28.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData28.sSCaptionName = "完成幁图数";
-            sData28.SampleVal = 1800;
-            m_SMInfo.SampleDataList.Add(sData28);
-
-            //样品测量结果(Measure Result) 
-            //比率 
-            SamplePropertyData sData29 = new SamplePropertyData();
-            sData29.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.RATIO;
-            sData29.iSampleValType = OTS_ITEM_TYPES.DOUBLE;
-            sData29.sSCaptionName = "比率";
-            sData29.SampleVal = 3.14;
-            m_SMInfo.SampleDataList.Add(sData29);
-
-            //测量面积
-            SamplePropertyData sData30 = new SamplePropertyData();
-            sData30.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_AREA;
-            sData30.iSampleValType = OTS_ITEM_TYPES.DOUBLE;
-            sData30.sSCaptionName = "测量面积";
-            sData30.SampleVal = 120;
-            m_SMInfo.SampleDataList.Add(sData30);
-
-            //颗粒数
-            SamplePropertyData sData31 = new SamplePropertyData();
-            sData31.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE;
-            sData31.iSampleValType = OTS_ITEM_TYPES.INT;
-            sData31.sSCaptionName = "颗粒数";
-            sData31.SampleVal = 8000;
-            m_SMInfo.SampleDataList.Add(sData31);
-
-            //颗粒面积
-            SamplePropertyData sData32 = new SamplePropertyData();
-            sData32.iSampleId = OTS_SAMPLE_PROP_GRID_ITEMS.TOTAL_PARTICLE_AREA;
-            sData32.iSampleValType = OTS_ITEM_TYPES.DOUBLE;
-            sData32.sSCaptionName = "颗粒面积";
-            sData32.SampleVal = 8000;
-            m_SMInfo.SampleDataList.Add(sData32);
-
-            return m_SMInfo;
-
-        }
-
-        //获取两个时间差
-        private string DateDiff(DateTime DateTime1, DateTime DateTime2)
-
-        {
-
-            string dateDiff = null;
-
-            try
-
-            {
-
-                TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
-
-                TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
-
-                TimeSpan ts = ts1.Subtract(ts2).Duration();
-
-                dateDiff = ts.Days.ToString() + "天"
-
-                        + ts.Hours.ToString() + "小时"
-
-                        + ts.Minutes.ToString() + "分钟"
-
-                        + ts.Seconds.ToString() + "秒";
-
-            }
-
-            catch
-
-            {
-
-            }
-
-            return dateDiff;
-
-        }
-    }
-}

+ 3 - 18
OTSIncAMeasureApp/8-OTSSampleMeasureInfo/OTSSampleMeasureInfo.cs

@@ -30,8 +30,8 @@ namespace OTSMeasureApp
     {
 
         public string sSampleName;
-        public string sHoleName;
-        public int iShape;   //测量区域形状                                
+        public string sampleHoleName;
+        public ShapeType iShape;   //测量区域形状                                
         public List<Point> PolygonPointRegion;//多边形点集合                                
         public List<PointF> PolygonPointRegionF;//多边形点集合                                
         public List<PointF> DrawPolygonPointRegionF;//多边形点集合
@@ -39,14 +39,7 @@ namespace OTSMeasureApp
     };
 
 
-    //MeasureApp 给SampleWindow窗口发送添加样品的样品孔名信息
-    public struct SampleHolePara
-    {
-        public string sHoleName;
-        public int iShape;
-        //样品孔大小
-        public Rectangle SampleHoleRect;
-    };
+
 
     //样品属性数据
     public class SamplePropertyData
@@ -61,14 +54,6 @@ namespace OTSMeasureApp
         public string sDescriptionInfo;   //描述信息
 
     }
-    //public class SampleNodeMeaInfo              //样品信息
-    //{
-
-    //    public String sSampleName;              //样品名称
-    //    public bool bSwitch;                    //样品执行开关
-
-    //    public List<SampleData> SampleDataList;   //样品属性数据
-
 
 
 

+ 4 - 2
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -293,6 +293,8 @@
     <Compile Include="3-OTSDisplaySourceGridData\MeasureStopMode.Designer.cs">
       <DependentUpon>MeasureStopMode.cs</DependentUpon>
     </Compile>
+    <Compile Include="4-OTSSamplespaceGraphicsPanel\VisualSampleArea.cs" />
+    <Compile Include="4-OTSSamplespaceGraphicsPanel\VisualStage.cs" />
     <Compile Include="5-OTSMeasureStatuImageFun\frmSpecialGrayParticle.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -425,7 +427,7 @@
     <Compile Include="OTSPeriodicTable\User_Element_Small.designer.cs">
       <DependentUpon>User_Element_Small.cs</DependentUpon>
     </Compile>
-    <Compile Include="8-OTSSampleMeasureInfo\OTSSampleData.cs" />
+    <Compile Include="4-OTSSamplespaceGraphicsPanel\OTSSampleData.cs" />
     <Compile Include="3-OTSDisplaySourceGridData\OTSDisplaySampleGrid.cs" />
     <Compile Include="OTSMeasureOutputNlog.cs">
       <SubType>Form</SubType>
@@ -471,7 +473,6 @@
     <Compile Include="3-OTSDisplaySourceGridData\OTSPropertyWindow.Designer.cs">
       <DependentUpon>OTSPropertyWindow.cs</DependentUpon>
     </Compile>
-    <Compile Include="4-OTSSamplespaceGraphicsPanel\CStageManage.cs" />
     <Compile Include="5-OTSMeasureStatuImageFun\OTSBSEImageFun.cs" />
     <Compile Include="4-OTSSamplespaceGraphicsPanel\OTSSamplespaceGraphicsPanelFun.cs" />
     <Compile Include="4-OTSSamplespaceGraphicsPanel\SEMDATAFieldManage.cs" />
@@ -605,6 +606,7 @@
     <None Include="0-OTSModel\OTSDataType\COTSSample.cd" />
     <None Include="1-OTSMeasure\MeasureRetThread.cd" />
     <None Include="2-OTSMeasureParamManage\MeasureParam.cd" />
+    <None Include="4-OTSSamplespaceGraphicsPanel\sampleSpaceObject.cd" />
     <None Include="app.manifest" />
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">

+ 66 - 83
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -33,7 +33,7 @@ namespace OTSMeasureApp
         ShotBSEPicture = 1,      //拍摄样品孔图片
         MeasureBSEPicture = 2     //拍摄测量区域图片
     };
-    enum ShapeType
+   public enum ShapeType
     {
         CIRCUL = 0,       //圆形
         RECTANGLE = 1      //矩形
@@ -61,7 +61,7 @@ namespace OTSMeasureApp
         public  OTSRibbonFun m_RibbonFun = null;
 
         //判断信息来源  拍摄样品孔图片 或是 测量开始
-        public MessageState m_MessageStates = (int)MessageState.StartMeasure;
+        public MessageState m_MessageStates = MessageState.StartMeasure;
 
 
 
@@ -203,13 +203,12 @@ namespace OTSMeasureApp
                     MessageBox.Show("Connect SEM failed!Please goto the SysMgrApp.exe to setup the proper parameter or check other parameter of the EDS software");
                     System.Diagnostics.ProcessStartInfo process = new System.Diagnostics.ProcessStartInfo();
                     process.FileName = "OTSSysMgrApp.exe";//打开app的路径
-                    //string FilePath = string.Join(" ",m_ProjData.GetPathName());
-                    //process.Arguments = FilePath;//多个参数用空格隔开
+               
                     process.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
                     System.Diagnostics.Process.Start(process);
                     this.rbConnectHardware.Enabled = true;
                     this.rbDisconnectHardware.Enabled = false;
-                    //this.StatusConnection.Text = "Connect Failed!";
+                 
                 }
                 this.rbConnectHardware.Enabled = false;
                 
@@ -245,7 +244,7 @@ namespace OTSMeasureApp
            m_SPropertyWindows.Show(dockPanel);
 
             m_SamplepaceWindow.Activate();
-           
+
 
         }
 
@@ -283,7 +282,7 @@ namespace OTSMeasureApp
         {
             if (!m_ProjParam.SetWorkSample(sNewWorkSampleName))
             {
-                m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(m_ProjParam.GetWorkSampleName());
+                m_SolutionWindows.SwitchSample(m_ProjParam.GetWorkSampleName());
                 return;
             }
 
@@ -291,7 +290,7 @@ namespace OTSMeasureApp
             string sNewName = m_ProjParam.GetWorkSampleName();
             if ("" == sNewName)
             {
-                m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sNewWorkSampleName);
+                m_SolutionWindows.SwitchSample(sNewWorkSampleName);
                 return;
             }
 
@@ -299,20 +298,20 @@ namespace OTSMeasureApp
             OTSSamplePropertyInfo SMInfo = new OTSSamplePropertyInfo();
             if (!m_ProjParam.GetWorkSamplePerameter(m_ProjParam.GetWorkSample(), ref SMInfo))
             {
-                m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sNewWorkSampleName);
+                m_SolutionWindows.SwitchSample(sNewWorkSampleName);
                 return;
             }
 
 
             //设置获取帧图状态
-            m_MessageStates = (int)MessageState.StartMeasure;
+            m_MessageStates = MessageState.StartMeasure;
             m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
             //发送新的样品名给Treeview
-            m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sNewName);
+            m_SolutionWindows.SwitchSample(sNewName);
             //发送想你的样品名给Sample
             m_SamplepaceWindow.SwitchWorkSample(sNewName);
             //根据节点设置样品台窗口中所选择的样品名称
-            OTSSamplespaceWindow.m_SampleSelectName = sNewName;
+            m_SamplepaceWindow.m_SampleSelectName = sNewName;
 
 
         }
@@ -382,10 +381,10 @@ namespace OTSMeasureApp
 
         //移动工作样品到其他样品孔,样品孔名称和测量区域都要改变,重新设置工作样品参数
         //SampleMeasurePara SMeasurePara:
-        public SampleMeasurePara SetWorkSamplHoleAndMeasureArea(SampleMeasurePara SMeasurePara)
+        public void SetWorkSamplHoleAndMeasureArea(SampleMeasurePara SMeasurePara)
         {
 
-            return m_ProjParam.SetWorkSampleHoleNameAndMeasureArea(SMeasurePara);
+             m_ProjParam.SetWorkSampleHoleAndMeasureArea(SMeasurePara);
 
         }
 
@@ -469,14 +468,10 @@ namespace OTSMeasureApp
                 string message = table["message3"].ToString();
                 log.Error("OTSIncAMeasureAppForm_FormClosing-"+ message + ":" + ex.ToString());
             }
-            //CloseAllContents();
-           
-            //m_MsrThreadWrapper.freeHw();
+         
             Process.GetCurrentProcess().Kill();
           
          
-            //Application.ExitThread();
-            //Application.Exit();
         }
 
 
@@ -524,7 +519,7 @@ namespace OTSMeasureApp
         public int ShowSaveInfoMsgBox()
         {
             string message = table["message4"].ToString();
-            //    DialogResult.OK
+        
             DialogResult dResult = MessageBox.Show(message, "Tip", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
             if (dResult == DialogResult.Yes)
             {
@@ -581,13 +576,13 @@ namespace OTSMeasureApp
             m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
 
             // MeasureApp 给 OTSSolutionWindow 发送打开已保存的工作样品文件
-            m_SolutionWindows.Rev_MeasureApp_OpenExistSampleFile_Event(TSampleParamList, SMInfo.TSampleParam);
+            m_SolutionWindows.OpenExistSampleFile(TSampleParamList, SMInfo.TSampleParam);
 
-            //MeasureApp 给 OTSSamplespaceWindow 发送已保存的工作样品文件
+         
 
             if (!OpenExistSampleMeasureArea(ref SampleMeasureAreaList))
             {
-                log.Error("(OTSIncAMeasureAppForm.OpenExistSampleFile)  m_DataMgrFun.OpenExistSampleMeasureArea(ref SampleMeasureAreaList) = false Failed !");
+                log.Error(" OpenExistSampleMeasureArea(ref SampleMeasureAreaList)  Failed !");
                 return false;
             }
 
@@ -600,7 +595,7 @@ namespace OTSMeasureApp
                 return false;
             }
          
-            m_SamplepaceWindow.OpenExistSampleFile_Event(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
+            m_SamplepaceWindow.OpenExistSampleFile(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
             return true;
         }
         public bool OpenExistSampleMeasureArea(ref List<SampleMeasurePara> SampleMeasureAreaList)
@@ -617,9 +612,9 @@ namespace OTSMeasureApp
                 //获取样品名称
                 SampleMeasureArea.sSampleName = (m_ProjData.GetSampleList())[i].GetName();
                 // 获取测量区域形状
-                SampleMeasureArea.iShape = (int)(m_ProjData.GetSampleList())[i].GetMsrArea().GetShape();
+                SampleMeasureArea.iShape = (ShapeType)m_ProjData.GetSampleList()[i].GetMsrArea().GetShape();
                 //获取样品孔名称
-                SampleMeasureArea.sHoleName = (m_ProjData.GetSampleList())[i].GetSampleHoleName();
+                SampleMeasureArea.sampleHoleName = (m_ProjData.GetSampleList())[i].GetSampleHoleName();
                 //样品测量区域
                 SampleMeasureArea.MeasureRect = (Rectangle)(m_ProjData.GetSampleList())[i].GetMsrArea().GetRectDomain();
                 //多边形点集合
@@ -673,7 +668,7 @@ namespace OTSMeasureApp
                     log.Error("(OTSIncAMeasureAppForm.rbDeleteSample_Click)  DeleteSample(sWSampleName) = false Failed, sWSampleName = " + sWSampleName);
                     return;
                 }
-                //m_MeasureRetWindow.SetInit();
+              
                 sWSampleName = m_ProjParam.GetWorkSampleName();
                 if ("" != sWSampleName)
                 {
@@ -706,12 +701,12 @@ namespace OTSMeasureApp
                 //给工作样品台发送删除样品和新的工作样品名称
                 m_SamplepaceWindow.DeleteWorkSample(sDeleteWSampleName, "");
                 //清空样品对象列表
-                if (OTSSamplespaceWindow.m_SampleGDIObjects != null)
+                if (m_SamplepaceWindow.m_SampleGDIObjects != null)
                 {
                     //清空样品台窗口中样品、测量区域、帧图、照片位置对象列表
-                    OTSSamplespaceWindow.m_SampleGDIObjects.Clear();
-                    OTSSamplespaceWindow.m_MeasureGDIObjects.Clear();
-                    OTSSamplespaceWindow.m_MeasurePathGDIObjects.Clear();
+                    m_SamplepaceWindow.m_SampleGDIObjects.Clear();
+                    m_SamplepaceWindow.m_MeasureGDIObjects.Clear();
+                  
                     m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
                 }
                 //样品全部删除完,将Treeview 和Grid 显示内容清空
@@ -761,10 +756,10 @@ namespace OTSMeasureApp
         {
 
             //样品的属性值
-            OTSSamplePropertyInfo SamplePropParam ;
+           
 
-            SamplePropParam = m_ProjParam.AddNewSampleMeasure(sSampleHoleName);
-            if (null == SamplePropParam)
+            OTSSamplePropertyInfo SMInfo = m_ProjParam.AddNewSampleMeasure(sSampleHoleName);
+            if (null == SMInfo)
             {
                 // 设置 开始 ,停止 和检查参数 按钮状态
                 m_RibbonFun.SetMeasureRibbonButnStatu();
@@ -774,7 +769,7 @@ namespace OTSMeasureApp
             m_SPropertyWindows.TSSaveAs.Enabled = true;
             m_SPropertyWindows.TSLoad.Enabled = true;
             //给SampleWindow 发送样品信息
-            OTSSamplePropertyInfo SMInfo = SamplePropParam;
+           
             m_SamplepaceWindow.AddOneSampleArea(SMInfo.SMeasurePara);
             //给PropWindow 发送工作样品属性信息
             m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
@@ -785,7 +780,7 @@ namespace OTSMeasureApp
             //设置 删除,复位,圆形,矩形 按钮状态
             m_RibbonFun.SetSampleRibbonButnStatus();
             //清空帧图信息
-            m_MessageStates = (int)MessageState.StartMeasure;
+            m_MessageStates = MessageState.StartMeasure;
             m_SamplepaceWindow.ClearImageAndSingleGDIObjects();
             m_SamplepaceWindow.Invalidate();
         }
@@ -840,7 +835,7 @@ namespace OTSMeasureApp
         public void ShowSemCoordvAL(string sSemCoord)
         {
             STSemCoordinate.Text = sSemCoord;
-            //    TSGrayVal.Text = sGrayVal;
+           
             statusStrip1.Refresh();
         }
 
@@ -902,7 +897,7 @@ namespace OTSMeasureApp
             bool iRev = m_ProjData.Save();
             if (!iRev)
             {
-                //log.Trace("(OTSIncAMeasureAppForm.rbSaveFile_Click)  m_DataMgrFun.SaveFile()  Failed !");
+               
                 return;
             }
         }
@@ -927,18 +922,18 @@ namespace OTSMeasureApp
         private void ribCircle_Click(object sender, EventArgs e)
         {
             //修改工作样品的测量区域为圆形
-            m_SamplepaceWindow.Rev_DDrawCircleMeasure_MeasureAppToSampleWindow_Event();
+            m_SamplepaceWindow.DrawCircleMeasure();
         }
         private void rbThreePoints_Click(object sender, EventArgs e)
         {
             //修改工作样品的测量区域为圆形
-            m_SamplepaceWindow.Rev_DDrawCircleMeasureByThreePoints_MeasureAppToSampleWindow_Event();
+            m_SamplepaceWindow.DrawCircleMeasureByThreePoints();
         }
         //绘制矩形测量区域
         private void ribRectangle_Click(object sender, EventArgs e)
         {
             //修改工作样品的测量区域为矩形
-            m_SamplepaceWindow.Rev_DDrawRectangleMeasure_MeasureAppToSampleWindow_Event();
+            m_SamplepaceWindow.DrawRectangleMeasure();
         }
 
         private void rbExitApp_Click(object sender, EventArgs e)
@@ -956,7 +951,7 @@ namespace OTSMeasureApp
             if (!m_MsrThreadWrapper.BGWorkThreadIsRunning())
             {
                 m_MessageStates = MessageState.ShotBSEPicture;
-                m_MsrThreadWrapper.SetDoRunType((int)MSR_THREAD_RunSTATUS.RUNSampleHoleImage);
+                m_MsrThreadWrapper.SetDoRunType(MSR_THREAD_RunSTATUS.RUNSampleHoleImage);
                 m_MsrThreadWrapper.StartBGWorkThread();
                 m_RibbonFun.SetMeasureRibbonButnStatu();
             }
@@ -972,7 +967,7 @@ namespace OTSMeasureApp
             {
                 //设置消息类型 拍摄样品孔
                 m_MessageStates = (int)MessageState.StartMeasure;
-                m_MsrThreadWrapper.SetDoRunType((int)MSR_THREAD_RunSTATUS.RUNMEASURE);
+                m_MsrThreadWrapper.SetDoRunType(MSR_THREAD_RunSTATUS.RUNMEASURE);
                 m_MsrThreadWrapper.StartBGWorkThread();
                 m_RibbonFun.SetMeasureRibbonButnStatu();
             }
@@ -985,7 +980,7 @@ namespace OTSMeasureApp
 
         public void SetStartMeasureRibbonStatus()
         {
-            //this.PropertyMeasureThreadRunFlag = true;
+           
             ribView.Enabled = false;
             m_RibbonFun.SetToolButnStatu(false);          
             //false:  将其他ribbon按钮设置为灰色
@@ -1041,7 +1036,7 @@ namespace OTSMeasureApp
         }
         private void rbSmapleName_Click(object sender, EventArgs e)
         {
-            m_SamplepaceWindow.ChangeSampleHoleFont();
+            //m_SamplepaceWindow.ChangeSampleHoleFont();
         }
         private void rbSmaplePhoto_Click(object sender, EventArgs e)
         {
@@ -1050,7 +1045,7 @@ namespace OTSMeasureApp
         //当点击Ribbon停止按钮时,设置Ribbon状态
         public void SetStopMeasureRibbonStatus()
         {
-            //this.PropertyMeasureThreadRunFlag = false;
+           
             ribView.Enabled = true;
             m_RibbonFun.SetToolButnStatu(true);
             rbPanelFile.Enabled = true;
@@ -1066,7 +1061,7 @@ namespace OTSMeasureApp
 
         public void SetPauseMeasureRibbonStatus()
         {
-            //this.PropertyMeasureThreadRunFlag = false;
+           
             ribView.Enabled = true;
             m_RibbonFun.SetToolButnStatu(true);
             rbPanelFile.Enabled = true;
@@ -1101,7 +1096,7 @@ namespace OTSMeasureApp
 
             // MeasureApp 窗口给 OTSPropertyWindow窗口 Grid显示的样品属性信息
 
-            m_SolutionWindows.Rev_MeasureApp_SwitchSample_Event(sMsrSampleName);
+            m_SolutionWindows.SwitchSample(sMsrSampleName);
             m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
 
             return true;
@@ -1115,7 +1110,7 @@ namespace OTSMeasureApp
         /// <param name="doRunType"></param>
         /// <param name="HoleID"></param>
         /// <param name="c_DomainMessure"></param>
-        public void StartSampleHoleBSEImage(int doRunType, int HoleID, CDomain c_DomainMessure)
+        public void StartSampleHoleBSEImage(MSR_THREAD_RunSTATUS doRunType, int HoleID, CDomain c_DomainMessure)
         {
             //线程执行类型 1:测量类型 2:获取样品孔图片类型
             m_MsrThreadWrapper.SetDoRunType(doRunType);
@@ -1175,16 +1170,16 @@ namespace OTSMeasureApp
 
         private void rbMeasureCircle_Click(object sender, EventArgs e)
         {
-            m_ProjParam.SetMeasureAreaShape((int)ShapeType.CIRCUL);
+            m_ProjParam.SetMeasureAreaShape(ShapeType.CIRCUL);
             //修改工作样品的测量区域为圆形
-            m_SamplepaceWindow.changeShape((int)ShapeType.CIRCUL);
+            m_SamplepaceWindow.changeShape(ShapeType.CIRCUL);
         }
 
         private void rbMeasureRectangle_Click(object sender, EventArgs e)
         {
-            m_ProjParam.SetMeasureAreaShape((int)ShapeType.RECTANGLE);
+            m_ProjParam.SetMeasureAreaShape(ShapeType.RECTANGLE);
             //修改工作样品的测量区域为矩形
-            m_SamplepaceWindow.changeShape((int)ShapeType.RECTANGLE);
+            m_SamplepaceWindow.changeShape(ShapeType.RECTANGLE);
         }
 
         //ctrl+s组合键进行保存
@@ -1253,7 +1248,7 @@ namespace OTSMeasureApp
         private void ribPolygon_Click(object sender, EventArgs e)
         {
             //修改工作样品的测量区域为矩形
-            m_SamplepaceWindow.Rev_DDrawPolygonMeasure_MeasureAppToSampleWindow_Event();
+            m_SamplepaceWindow.DrawPolygonMeasure();
         }
 
         private void rbReClassify_Click(object sender, EventArgs e)
@@ -1280,8 +1275,22 @@ namespace OTSMeasureApp
 
             bool bOpenFlag=false;
             COTSMsrPrjResultData ProjDataMgr = new COTSMsrPrjResultData();
-            
-            if (ProjDataMgr.Load())
+            string strPathName;
+            //strPathName.Trim();
+          
+                // file open dialog
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                if (openFileDialog.ShowDialog() != DialogResult.OK)
+                {
+                    return ;
+
+                }
+
+
+                strPathName = openFileDialog.FileName;
+           
+
+            if (ProjDataMgr.Load(strPathName))
             {
                 m_ProjData = ProjDataMgr;
                 m_ProjParam.SetResultData(m_ProjData);
@@ -1324,33 +1333,7 @@ namespace OTSMeasureApp
             {
                 case MsgID:
 
-                    //MSTMsg = new STMrsSampleRetThreadMsg();
-                    //MSTMsg.STMThreadStu.cMsrStartTime = new char[(int)MEMORY_SIZE.TIME_SIZE];
-                    //MSTMsg.STMThreadStu.cMsrEndTime = new char[(int)MEMORY_SIZE.TIME_SIZE];
-                    //MSTMsg.STMSampleRetData.BSEData.FieldPos = new Point();
-                    //MSTMsg.STMSampleRetData.SFieldata.FieldPos = new Point();
-                    //MSTMsg.STMSampleRetData.StartMsrField.FieldPos = new Point();
-                    //MSTMsg.STMSampleStu.cMsrSName = new char[(int)MEMORY_SIZE.SAMPLE_NAME_SIZE];
-                    //MSTMsg = (STMrsSampleRetThreadMsg)Marshal.PtrToStructure(m.LParam, typeof(STMrsSampleRetThreadMsg));
-                    ////以下为实时接收图片数据,因为图片传出来的只是指针,所以必须立即接收,否则指针指向的数据就会被析构。
-                    //Byte[] bBSEData;
-                    //int iHeight, iWidth;
-                    //iHeight = MSTMsg.STMSampleRetData.BSEData.iBSEDataHeight;
-                    //iWidth = MSTMsg.STMSampleRetData.BSEData.iBSEDataWidth;
-                    //if (iHeight > 0 && iWidth > 0)
-                    //{
-                    //    bBSEData = new Byte[iHeight * iWidth];
-                    //    Marshal.Copy(MSTMsg.STMSampleRetData.BSEData.pData, bBSEData, 0, iHeight * iWidth);
-                    //    MSTMsg.gbseData = bBSEData;
-
-                    //}
-
-                    ////申请
-                    //shareRes.mutex.WaitOne();
-                    //m_MSTMsg.Add(MSTMsg);
-
-                    //  释放
-                    //shareRes.mutex.ReleaseMutex();
+                    
                     break;
                 case LogMsgID:
                     m_LogMsg = new PostLogMsg();

+ 2 - 2
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -184,9 +184,9 @@ namespace OTSModelSharp.ServiceInterface
                 return;
             }
 
-            if (a_pImgProcessParam.SpecialGreyRangeParam.GetIsToRun())
+            if (a_pImgProcessParam.GetSpecialGreyRangeParam().GetIsToRun())
             {
-                var param = a_pImgProcessParam.SpecialGreyRangeParam;
+                var param = a_pImgProcessParam.GetSpecialGreyRangeParam();
                 var ranges = param.GetSpecialGreyRanges();
               
                 

+ 3 - 3
OTSIncAMeasureApp/ServiceCenter/DTLBase/SQliteHelper.cs

@@ -330,10 +330,10 @@ namespace OTSModelSharp.DTLBase
                             tran.Commit();
                            
                         }
-                        catch (Exception) 
+                        catch (Exception ex) 
                         { 
-                            tran.Rollback(); 
-                            throw;
+                            tran.Rollback();
+                            log.Error(ex.ToString());
                         }
                     }
                 }

Some files were not shown because too many files changed in this diff