Browse Source

add missing files

gsp 3 năm trước cách đây
mục cha
commit
3396f6ccd5

+ 145 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/GDIUIClass.cd

@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+  <Class Name="OTSMeasureApp.ARectangleGDIObject">
+    <Position X="2" Y="5" Width="2" />
+    <TypeIdentifier>
+      <HashCode>ASCFBAAAwIhI4YAAACAgA0cgAABAIBAAAAgAAgAAAAg=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.CreateRectangle">
+    <Position X="0.5" Y="13" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AaCFDAICwItZ4cAAAGAgA0cgMBBGJBAQAggAAgEJBgg=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.OTSSamplespaceWindow">
+    <Position X="7.5" Y="5" Width="2.5" />
+    <Compartments>
+      <Compartment Name="Properties" Collapsed="true" />
+      <Compartment Name="Methods" Collapsed="true" />
+    </Compartments>
+    <TypeIdentifier>
+      <HashCode>JbaN/HsRgr3TjwHlZbnEO7v7ZTjT0tjBv07OmLV6UGI=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\OTSSamplespaceWindow.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Field Name="selectSampleGDIObjects" />
+      <Field Name="m_OTSSampleStageData" />
+    </ShowAsAssociation>
+    <ShowAsCollectionAssociation>
+      <Field Name="m_MeasureGDIObjects" />
+      <Field Name="m_ContentGDIObjects" />
+      <Field Name="m_MeasurePathGDIObjects" />
+      <Field Name="m_ALLSingleGDIObjects" />
+      <Field Name="m_ImageGDIObjects" />
+      <Field Name="m_DrawPolygonFinishGDIObjects" />
+      <Field Name="m_DrawMeasureGDIObjects" />
+      <Field Name="m_ImageSingleGDIObjects" />
+      <Field Name="m_RectangleGDIObjects" />
+      <Field Name="m_SampleGDIObjects" />
+      <Field Name="m_SpecimenGDIObjects" />
+      <Field Name="m_SampleHoleGDIObjects" />
+      <Field Name="m_SingleGDIObjects" />
+      <Field Name="m_SEMCenterGDIObjects" />
+      <Field Name="m_WorkStageGDIObjects" />
+      <Field Name="m_SMeasrueAreaList" />
+    </ShowAsCollectionAssociation>
+  </Class>
+  <Class Name="OTSMeasureApp.CStageManage" Collapsed="true">
+    <Position X="10.75" Y="3.5" Width="2.25" />
+    <TypeIdentifier>
+      <HashCode>AAAABAAEAAAoEAAAAACAIAAAAEAAAAiQACAAAABAAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CStageManage.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.OTSSamplespaceGraphicsPanelFun">
+    <Position X="10.5" Y="7" Width="2.75" />
+    <Compartments>
+      <Compartment Name="Nested Types" Collapsed="false" />
+    </Compartments>
+    <NestedTypes>
+      <Enum Name="OTSMeasureApp.OTSSamplespaceGraphicsPanelFun.EnumMousePointPosition" Collapsed="true">
+        <TypeIdentifier>
+          <NewMemberFileName>4-OTSSamplespaceGraphicsPanel\OTSSamplespaceGraphicsPanelFun.cs</NewMemberFileName>
+        </TypeIdentifier>
+      </Enum>
+    </NestedTypes>
+    <TypeIdentifier>
+      <HashCode>AHrUUAhEBgAAIQEAAYYISaAIAYQAYBBEaEAEwAIB4iA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\OTSSamplespaceGraphicsPanelFun.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.StageDrawingData" Collapsed="true">
+    <Position X="12" Y="5.75" Width="2.25" />
+    <TypeIdentifier>
+      <HashCode>AAAAAYAAAAAQAAIAAAAEAAIAAoAAFAAAAAISAAAAAAA=</HashCode>
+      <FileName>8-OTSSampleMeasureInfo\OTSSampleData.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Struct Name="OTSMeasureApp.SampleMeasurePara" Collapsed="true">
+    <Position X="12" Y="5" Width="2.25" />
+    <TypeIdentifier>
+      <HashCode>ACAAAAAQAAgAAAAAAAAAAAAAAAAAICAAEAAQAAAAAAA=</HashCode>
+      <FileName>8-OTSSampleMeasureInfo\OTSSampleMeasureInfo.cs</FileName>
+    </TypeIdentifier>
+  </Struct>
+  <Enum Name="OTSMeasureApp.SEMControlIndex" Collapsed="true">
+    <Position X="1.5" Y="2" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAQAgAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.XYIndex" Collapsed="true">
+    <Position X="4.5" Y="2" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.CreateRectangleType" Collapsed="true">
+    <Position X="7.5" Y="0.5" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAIAAAAAAAEAAAAEAAEAAARAAAggBAAAAQEABBACAig=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.ContextMenuType" Collapsed="true">
+    <Position X="4.5" Y="0.5" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAEEAAgAAAAAAAACAAAQAAAAAAACAAAAAAAAEAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.MeasureStateMenuType" Collapsed="true">
+    <Position X="4.5" Y="1.25" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAEAACAAQAAAEAABAAAAAIAAAAEAAAAAAACABAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.MenuIndex" Collapsed="true">
+    <Position X="7.5" Y="1.25" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAAAABAAAgAACAMAABAAAAAJAQAEACAAAAAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.ColorType" Collapsed="true">
+    <Position X="1.5" Y="0.5" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAIAAIAAAAAAQAAAACAAAAQAAAAAAAAIAAAAAAAAAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Enum Name="OTSMeasureApp.GrayLevel" Collapsed="true">
+    <Position X="1.5" Y="1.25" Width="2.5" />
+    <TypeIdentifier>
+      <HashCode>AAAAAAAAABAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Enum>
+  <Font Name="Microsoft YaHei UI" Size="9" />
+</ClassDiagram>

+ 473 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSampleData.cs

@@ -0,0 +1,473 @@
+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;          //样品孔大小
+
+    }
+    //MeasureApp 给SampleWindow窗口发送添加样品的样品孔名信息
+    public struct SampleHolePara
+    {
+        public string sHoleName;
+        public ShapeType iShape;
+        //样品孔大小
+        public Rectangle SampleHoleRect;
+    };
+    // 用于绘制样品台的数据
+    public class StageDrawingData
+    {
+        public StageDrawingData()
+        {
+            sSHoleInfoList = new List<OTSSampleHoleInfo>();
+        }
+
+        //绘制样品台形状信息
+        //样品台名称
+        public String sStageName;                //样品台名称
+        public ShapeType bStageShape;                 // 样品台形状。  1: 矩形;  0: 圆形
+                                                //    public Point PSStageStartPos;           //样品台起点坐标
+                                                //    public Point PSStageEndPos;            //样品台终点坐标
+        public Rectangle StageDomain;           //样品台的大小
+        public ShapeType 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;
+
+        }
+    }
+}

+ 16 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/VisualSampleArea.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
+{
+    class VisualSampleArea
+    {
+          List<CRectangleGDIObject> m_SampleGDIObjects;//
+          List<CRectangleGDIObject> m_MeasureGDIObjects;//path
+          List<CRectangleGDIObject> m_MeasurePathGDIObjects;
+        string m_SampleSelectName;
+    }
+}

+ 1096 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/VisualStage.cs

@@ -0,0 +1,1096 @@
+using OTSDataType;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
+{
+    public class CVisualStage
+    {
+        //original data
+        CStage m_SStage;
+        CSEMStageData m_SEMStageData;
+        //interchange object
+        StageDrawingData m_OTSSampleStageData;
+
+
+        Point StageLTPointToSEMLocation = new Point(0, 0);
+        Point StageRBPointToSEMLocation = new Point(0, 0);
+      
+        int m_VisualStageEdgeLength;
+
+        int m_OTSCoordStageEdgeLength = 0;
+
+        int m_totalCtrlWidth;
+        int m_totalCtrlHeight;
+
+
+
+     
+
+        //public ShapeType m_Shape = 0;
+
+        //记录绘制样品台时的中心位置
+        Point m_RegionStartCenterPoint = new Point(0, 0);
+
+  
+
+        //样品台存在的List集合 the rectangle on the edge of  stage ,usually one.
+        private List<CRectangleGDIObject> m_StageEdgeGDIObjects;
+        //标样存在的List集合 usually it is a samll circle.
+        private List<CRectangleGDIObject> m_SpecimenGDIObjects;
+        private List<CRectangleGDIObject> m_SampleHoleGDIObjects;// the hole gdi of the stage 
+        //文字内容
+        private List<CRectangleGDIObject> m_ContentGDIObjects;//the text that will display in the hole.
+
+        public StageDrawingData GetOTSSampleStageData()
+        {
+            return m_OTSSampleStageData;
+        }
+
+        public void SetOTSSampleStageData(StageDrawingData value)
+        {
+            m_OTSSampleStageData = value;
+        }
+
+        public CVisualStage(StageDrawingData oTSSampleStageData)
+        {
+            //样品台
+            m_StageEdgeGDIObjects = new List<CRectangleGDIObject>();
+            //标样
+            m_SpecimenGDIObjects = new List<CRectangleGDIObject>();
+            //样品孔
+            m_SampleHoleGDIObjects = new List<CRectangleGDIObject>();
+            //样品孔文字内容
+            m_ContentGDIObjects = new List<CRectangleGDIObject>();
+
+            m_OTSSampleStageData = new StageDrawingData();
+
+            SetOTSSampleStageData(oTSSampleStageData ?? throw new ArgumentNullException(nameof(oTSSampleStageData)));
+        }
+
+        public CVisualStage()
+        {
+            //样品台
+            m_StageEdgeGDIObjects = new List<CRectangleGDIObject>();
+            //标样
+            m_SpecimenGDIObjects = new List<CRectangleGDIObject>();
+            //样品孔
+            m_SampleHoleGDIObjects = new List<CRectangleGDIObject>();
+            //样品孔文字内容
+            m_ContentGDIObjects = new List<CRectangleGDIObject>();
+
+            m_OTSSampleStageData = new StageDrawingData();
+        }
+        public CRectangleGDIObject GetEdgeGDIObj()
+        {
+            return m_StageEdgeGDIObjects[0];
+        }
+
+        public CRectangleGDIObject GetHoleGDIBySampleName(string name)
+        {
+            foreach (var g in m_SampleHoleGDIObjects)
+            {
+                if (g.SampleName == name)
+                {
+                    return g;
+                }
+            
+            }
+            return null;
+        
+        }
+        public CRectangleGDIObject GetHoleGDIByHoleName(string name)
+        {
+            foreach (var g in m_SampleHoleGDIObjects)
+            {
+                if (g.Name == name)
+                {
+                    return g;
+                }
+
+            }
+            return null;
+
+        }
+        public CRectangleGDIObject GetHoleGDIByMousePoint(Point  mousePoint)
+        {
+            foreach (var g in m_SampleHoleGDIObjects)
+            {
+                if (g.IfContains(mousePoint))
+                {
+                    return g;
+                }
+
+            }
+            return null;
+
+        }
+        public void cleargdiobj()
+        {
+            m_StageEdgeGDIObjects.Clear();
+            m_SpecimenGDIObjects.Clear();
+            m_SampleHoleGDIObjects.Clear();
+            m_ContentGDIObjects.Clear();
+        }
+        public void InitSampleStageData(CStage SStage, CSEMStageData SEMStageData, int ctrlWidth, int ctrlHeight)
+        {
+
+            //获取样品台信息
+
+            if (null == SStage)
+            {
+                return;
+            }
+            m_SStage = SStage;
+            m_SEMStageData = SEMStageData;
+
+
+
+
+            //获得样品台数据
+            GetOTSSampleStageData().sStageName = SStage.GetName();
+            GetOTSSampleStageData().bStageShape = (ShapeType)SStage.GetBoundary().GetShape();
+            GetOTSSampleStageData().StageDomain = SStage.GetBoundary().GetRectDomain();
+            GetOTSSampleStageData().bSampleShape = (ShapeType)SStage.GetSTD().GetShape();
+            GetOTSSampleStageData().SampleRect = (Rectangle)SStage.GetSTD().GetRectDomain();
+            int iSHoleCount = SStage.GetHoleList().Count;    //样品孔个数           
+            if (GetOTSSampleStageData().sSHoleInfoList.Count > 0)
+            {
+                GetOTSSampleStageData().sSHoleInfoList.Clear();
+            }
+            var holeLst = SStage.GetHoleList();
+            for (int i = 0; i < iSHoleCount; i++)
+            {
+                CHole d = holeLst[i];
+                OTSSampleHoleInfo SHoleInfo = new OTSSampleHoleInfo();
+                //获取样品口的名称,形状,坐标
+                SHoleInfo.sSHoleName = d.GetName();
+                SHoleInfo.iSHoleShape = (int)d.GetShape();
+
+                Rectangle r = (Rectangle)d.GetRectDomain();
+
+                SHoleInfo.HoleRect = r;
+                GetOTSSampleStageData().sSHoleInfoList.Add(SHoleInfo);
+            }
+
+            //获取SEMData 绘制样品
+            GetOTSSampleStageData().iScanFieldSize100 = SEMStageData.GetScanFieldSize100();  //放大倍数为100倍时的屏幕尺寸
+            GetOTSSampleStageData().iXAxisDir = (int)SEMStageData.GetXAxisDir();
+            GetOTSSampleStageData().iYAxisDir = (int)SEMStageData.GetYAxisDir();
+            GetOTSSampleStageData().iXAxisStartVal = SEMStageData.GetXAxis().GetStart();
+            GetOTSSampleStageData().iXAxisEndVal = SEMStageData.GetXAxis().GetEnd();
+            GetOTSSampleStageData().iYAxisStartVal = SEMStageData.GetYAxis().GetStart();
+            GetOTSSampleStageData().iYAxisEndVal = SEMStageData.GetYAxis().GetEnd();
+
+
+
+            string stageName = GetOTSSampleStageData().sStageName;
+        
+            //获取样品台
+            ShapeType StageShape = GetOTSSampleStageData().bStageShape;
+            Point xDomain = new Point(GetOTSSampleStageData().StageDomain.Left, GetOTSSampleStageData().StageDomain.Top);
+            Point yDomain = new Point(GetOTSSampleStageData().StageDomain.Right, GetOTSSampleStageData().StageDomain.Bottom);
+
+            //OTS宽度高度差值
+            int widthDomain = Math.Abs(yDomain.X - xDomain.X);
+            int heightDomain = Math.Abs(yDomain.Y - xDomain.Y);
+            //样品台转换在电镜位置的宽度与高度
+
+            //设置样品台宽度
+            m_OTSCoordStageEdgeLength = widthDomain;//the stage must be a square.So we can only memorize an edge length.this is millimeter usually.
+            m_VisualStageEdgeLength = ctrlHeight > ctrlWidth ? ctrlWidth : ctrlHeight;//the stage must be a square.So we can  memorize an edge length only.
+            //记录添加帧图的尺寸  鼠标滚动时使用的原值
+
+
+            m_totalCtrlWidth = ctrlWidth;
+            m_totalCtrlHeight = ctrlHeight;
+            //m_Shape = GetOTSSampleStageData().bStageShape;
+
+
+            return;
+        }
+        public PointF GetCenterPointF()
+        {
+            var item = m_StageEdgeGDIObjects[0].RegionF;
+            //声明中心点变量
+            PointF pCenterPoint = new Point();
+            //获取在工作窗口中X,Y位置
+            pCenterPoint.X = item.X + item.Width / 2;
+            pCenterPoint.Y = item.Y + item.Height / 2;
+            return pCenterPoint;
+        }
+        public Point GetCenterPoint()
+        {
+            return m_StageEdgeGDIObjects[0].GetCenterPoint();
+            //声明中心点变量
+           
+        }
+
+        public void DrawSampleStage()
+        {
+            StageDrawingData SData = GetOTSSampleStageData();
+
+            try
+            {
+                if (SData.StageDomain.X == 0 && SData.StageDomain.Y == 0)
+                {
+                    return;
+                }
+                string stageName = SData.sStageName;
+              
+                //获取样品台
+                ShapeType StageShape = SData.bStageShape;
+                Point stageLeftTop = new Point(SData.StageDomain.Left, SData.StageDomain.Top);
+                Point stageRightBottom = new Point(SData.StageDomain.Right, SData.StageDomain.Bottom);
+
+                
+
+                m_SEMStageData.ConvertSEMToOTSCoord(stageLeftTop, ref StageLTPointToSEMLocation);
+                m_SEMStageData.ConvertSEMToOTSCoord(stageRightBottom, ref StageRBPointToSEMLocation);
+
+                RectangleF Bourary;
+             
+                Bourary = GetCtrlCoordRectF(stageLeftTop, stageRightBottom);
+
+                CreateRectangle CreateBourary;
+                //0:圆角矩形 1:圆形 2:文字 3:矩形
+                if (SData.bStageShape == (ShapeType.RECTANGLE))
+                {
+                    CreateBourary = new CreateRectangle(Bourary, CreateRectangleType.SampleBackGround_Rectangle);
+                }
+                else
+                {
+                    CreateBourary = new CreateRectangle(Bourary, CreateRectangleType.Circle);
+                }
+      
+                //添加样品台 对象
+                //设置路径
+                GraphicsPath MeasurePath = new GraphicsPath();
+
+                if (StageShape == (int)CreateRectangleType.Circle)
+                {
+                    MeasurePath.AddEllipse(CreateBourary.Region);
+                }
+                else
+                {
+                    MeasurePath.AddRectangle(CreateBourary.Region);
+                }
+                CreateBourary.GPath = MeasurePath;
+                CreateBourary.Shape = StageShape;
+                m_StageEdgeGDIObjects.Add(CreateBourary);
+                //绘制后的样品台中心位置
+                Point m_Region = GetCenterPoint();
+                //获取绘制后的样品台中心位置
+                if (m_RegionStartCenterPoint.X != m_Region.X || m_RegionStartCenterPoint.Y != m_Region.Y)
+                {
+                    m_RegionStartCenterPoint = m_Region;
+                }
+        
+                //获取样品孔
+                System.Collections.Generic.List<OTSSampleHoleInfo> ChloeClrList = SData.sSHoleInfoList;
+                if (ChloeClrList.Count > 0)
+                {
+                    for (int i = 0; i < ChloeClrList.Count; i++)
+                    {
+                        //获取微米信息
+                        var xHole = new Point(ChloeClrList[i].HoleRect.Left, ChloeClrList[i].HoleRect.Top);
+                        var yHole = new Point(ChloeClrList[i].HoleRect.Right, ChloeClrList[i].HoleRect.Bottom);
+                        //将微米转换为像素
+
+                        int widthHole = Math.Abs(yHole.X - xHole.X);
+                        int heightHole = Math.Abs(yHole.Y - xHole.Y);
+                        var RecF = GetCtrlCoordRectF(xHole, yHole);
+                        //获取矩形
+                        CreateRectangle CreateHole = null;
+                        //0:圆角矩形 1:圆形 2:文字 3:矩形
+                        if (ChloeClrList[i].iSHoleShape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+                        {
+                            CreateHole = new CreateRectangle(RecF, CreateRectangleType.Rectangle);
+
+                        }
+                        else
+                        {
+                            CreateHole = new CreateRectangle(RecF, CreateRectangleType.Circle);
+                        }
+                        //获取样品孔默认尺寸
+                        //m_DefaultStageHoleWidth = CreateHole.Region.Width;
+                        //m_DefaultStageHoleHeight = CreateHole.Region.Height;
+                        //绘制样品孔路径
+                        GraphicsPath HolePath = new GraphicsPath();
+                        if (ChloeClrList[i].iSHoleShape == (int)CreateRectangleType.Circle)
+                        {
+                            HolePath.AddEllipse(CreateHole.Region);
+                        }
+                        else
+                        {
+                            HolePath.AddRectangle(CreateHole.Region);
+                        }
+                        CreateHole.GPath = HolePath;
+                        CreateHole.Name= ChloeClrList[i].sSHoleName;
+                        m_SampleHoleGDIObjects.Add(CreateHole);
+
+                        //添加文字
+
+
+                        CreateRectangle CreateContent = GetCtrlCoordRect(xHole, yHole, CreateRectangleType.Rectangle, "", "");
+                        //类型 文字:2
+                        CreateContent.CreateType = CreateRectangleType.Text;
+                        CreateContent.Region = CreateContent.Region;
+                        CreateContent.strContent = ChloeClrList[i].sSHoleName;
+                        CreateContent.Name = ChloeClrList[i].sSHoleName;
+                        m_ContentGDIObjects.Add(CreateContent);
+                    }
+                }
+                //获取标样
+                ShapeType StageShapes = SData.bStageShape;
+                stageLeftTop = new Point(SData.SampleRect.Left, SData.SampleRect.Top);
+                stageRightBottom = new Point(SData.SampleRect.Right, SData.SampleRect.Bottom);
+
+                //获取矩形
+                CreateRectangle CreateSTD;
+                if (StageShapes == (int)CreateRectangleType.Circle)
+                {
+                    CreateSTD = GetCtrlCoordRect(stageLeftTop, stageRightBottom, CreateRectangleType.SpecimenCircle, "", "");
+                }
+                else
+                {
+                    CreateSTD = GetCtrlCoordRect(stageLeftTop, stageRightBottom, CreateRectangleType.SpecimenRectangle, "", "");
+                }
+        
+                //绘制标样路径
+                GraphicsPath STDPath = new GraphicsPath();
+                if (StageShapes == (int)CreateRectangleType.Circle)
+                {
+                    STDPath.AddEllipse(CreateSTD.Region);
+                }
+                else
+                {
+                    STDPath.AddRectangle(CreateSTD.Region);
+                }
+                CreateSTD.GPath = STDPath;
+                m_SpecimenGDIObjects.Add(CreateSTD);
+                return;
+            }
+            catch (Exception ex)
+            {
+
+                NLog.LogManager.GetCurrentClassLogger().Error("OTSSamplespaceWindow_DrawSampleInfo():--" + ex.ToString() + "");
+            }
+        }
+        public CreateRectangle GetCtrlCoordRect(Point OTSLeftTop, Point OTSRightBottom, CreateRectangleType type, string content, string name)
+        {
+            try
+            {
+                //将微米信息 转换为 像素
+                PointF xPoints = new Point();
+                PointF yPoints = new Point();
+                xPoints.X = (int)MillimetersToPixelsWidth(OTSLeftTop.X );
+                xPoints.Y = (int)MillimetersToPixelsWidth( OTSLeftTop.Y );
+                yPoints.X = (int)MillimetersToPixelsWidth( OTSRightBottom.X );
+                yPoints.Y = (int)MillimetersToPixelsWidth(OTSRightBottom.Y);
+                //计算位置
+                xPoints = (PointF)CalculateLocationF(xPoints);
+                yPoints = CalculateLocationF(yPoints);
+
+                //获取图形四个点
+                float realStartX = Math.Min(xPoints.X, yPoints.X);
+                float realStartY = Math.Min(xPoints.Y, yPoints.Y);
+                float realEndX = Math.Max(xPoints.X, yPoints.X);
+                float realEndY = Math.Max(xPoints.Y, yPoints.Y);
+
+                //创建矩形 并返回类型对象
+                return new CreateRectangle(realStartX, realStartY, realEndX - Math.Abs(realStartX), realEndY - Math.Abs(realStartY), type, content, name);
+            }
+            catch (Exception)
+            {
+                return new CreateRectangle(new Rectangle(), 0, "");
+            }
+        }
+        public RectangleF GetCtrlCoordRectF(Point OTSLeftTop, Point OTSRightBottom)
+        {
+            try
+            {
+
+               
+                //将微米信息 转换为 像素
+                PointF leftTop = new PointF();
+                PointF rightBottom = new PointF();
+                leftTop.X = (float)MillimetersToPixelsWidth( OTSLeftTop.X);
+                leftTop.Y = (float)MillimetersToPixelsWidth( OTSLeftTop.Y);
+                rightBottom.X = (float)MillimetersToPixelsWidth( OTSRightBottom.X);
+                rightBottom.Y = (float)MillimetersToPixelsWidth(OTSRightBottom.Y);
+                //计算位置
+                leftTop = CalculateLocationF(leftTop );
+                rightBottom = CalculateLocationF(rightBottom);
+
+                //获取图形四个点
+                float realStartX = Math.Min(leftTop.X, rightBottom.X);
+                float realStartY = Math.Min(leftTop.Y, rightBottom.Y);
+                float realEndX = Math.Max(leftTop.X, rightBottom.X);
+                float realEndY = Math.Max(leftTop.Y, rightBottom.Y);
+
+                //创建矩形 并返回类型对象
+                return new RectangleF(realStartX, realStartY, realEndX - Math.Abs(realStartX), realEndY - Math.Abs(realStartY));
+
+           
+
+            }
+            catch (Exception)
+            {
+                return new RectangleF();
+            }
+        }
+        public PointF CalculateLocationF(PointF point)
+        {
+            //获取窗体的高度与宽度
+            int screenWidth = m_totalCtrlWidth;
+            int screenHeight = m_totalCtrlHeight;
+            //获取屏幕中心点
+            PointF pointXY = new PointF();
+            PointF screenPoint = new PointF(screenWidth / 2, screenHeight / 2);
+            pointXY.X = screenPoint.X + point.X; //(IsWidth == 0 ? screenPoint.X : screenPoint.Y) + point.X;
+            pointXY.Y = screenPoint.Y - point.Y;
+            return pointXY;
+        }
+    
+
+        public double MillimetersToPixelsWidth( double PointVal)
+        {
+          
+            var v = m_VisualStageEdgeLength;
+            return PointVal / ((double)m_OTSCoordStageEdgeLength / v);
+        }
+        internal void DecreaseSampleCount(string holeName)
+        {
+            foreach (var hole in m_SampleHoleGDIObjects)
+            {
+                if (hole.Name == holeName)
+                {
+
+                    hole.SampleCount -= 1;
+                }
+            }
+        }
+        public bool AddSample(SampleMeasurePara SMeasurePara, float globalZoomNum, out CRectangleGDIObject SampleGDIObject,out CRectangleGDIObject MeasureGDIObject)
+        {
+            Point xHole = new Point(SMeasurePara.MeasureRect.Left, SMeasurePara.MeasureRect.Top);
+            Point yHole = new Point(SMeasurePara.MeasureRect.Right, SMeasurePara.MeasureRect.Bottom);
+   
+
+
+            RectangleF SampleRectangleF =GetCtrlCoordRectF(xHole, yHole);
+
+
+
+            CRectangleGDIObject m_SampleGDIObject = GetCtrlCoordRect(xHole, yHole, (CreateRectangleType)SMeasurePara.iShape, "", "");
+            m_SampleGDIObject.Region = new Rectangle((int)SampleRectangleF.X, (int)SampleRectangleF.Y, (int)SampleRectangleF.Width, (int)SampleRectangleF.Height);
+            m_SampleGDIObject.RegionF = SampleRectangleF;
+            m_SampleGDIObject.DrawRegionF = SampleRectangleF;
+            //测量区域名称 样品名称
+            m_SampleGDIObject.SampleName = SMeasurePara.sSampleName;
+            //测量区域类型 
+            m_SampleGDIObject.CreateType = (CreateRectangleType)SMeasurePara.iShape;
+            string SampleHoleName = SMeasurePara.sampleHoleName; 
+            string SampleName = SMeasurePara.sSampleName;
+
+                CRectangleGDIObject m_MeasureGDIObject;
+              
+
+               
+                  
+                    //设置样品选择状态为非工作样品
+              
+                    foreach (CRectangleGDIObject item in m_SampleHoleGDIObjects)
+                    {
+                       
+                        if (item.Name == SampleHoleName)
+                        {
+                           
+                   
+
+                            //设置颜色
+                            string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
+                            Color selColor = ColorTranslator.FromHtml(ColorStr);
+                            CreateRectangle NewSample = new CreateRectangle(item.Region, CreateRectangleType.SelectSample, item.Shape, item.Name, selColor);
+                            //累加样品数量
+                            item.SampleCount += 1;
+                            item.IsWorkSample = true;
+                            NewSample.SampleName = SampleName;
+                            NewSample.Name = item.Name;
+                            //设置当前添加的样品为工作样品
+                            NewSample.IsWorkSample = true;
+                            // 获取样品孔的大小与初始大小
+                            NewSample.Region = item.Region;
+                            NewSample.RegionF = item.RegionF;
+                            NewSample.DrawRegionF = item.DrawRegionF;
+                            //绘制样品路径
+                            GraphicsPath NewSamplePath = new GraphicsPath();
+                            if (NewSample.Shape == (int)CreateRectangleType.Circle)
+                            {
+                                NewSamplePath.AddEllipse(NewSample.Region);
+                            }
+                            else
+                            {
+                                NewSamplePath.AddRectangle(NewSample.Region);
+                            }
+                            NewSample.GPath = NewSamplePath;
+
+
+                            SampleGDIObject = NewSample;
+
+                           
+                            //获取测量区域尺寸与位置
+                            m_MeasureGDIObject = GetSampleMeasureInfo(NewSample, m_SampleGDIObject, globalZoomNum);
+                            //设置样品孔名称
+                            m_MeasureGDIObject.Name = item.Name;
+                            //根据节点设置样品台窗口中所选择的样品名称
+                            
+                            //添加测量区域
+
+
+                            bool ret= AddMeasure(m_MeasureGDIObject,out MeasureGDIObject);
+                           return ret;
+                        }
+                    }
+
+                    SampleGDIObject = null;
+                    MeasureGDIObject = null;
+                    return false;
+                
+
+
+
+
+           
+        }
+        #region 根据样品位置 获取测量区域位置
+        public CRectangleGDIObject GetSampleMeasureInfo(CRectangleGDIObject NewSample, CRectangleGDIObject 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;
+        }
+        public SampleMeasurePara GetSampleMeasurePara(CRectangleGDIObject MeasureItem)
+        {
+       
+           
+
+            //获取测量区域的OTS位置与尺寸
+            SampleMeasurePara sampleMeasurePara = GetMeasureInfo(MeasureItem);
+
+            //获取样品台 中心点
+            PointF RectanglePointCenter = GetCenterPointF();
+
+            //获取样品台中心点
+            float CenterX = PixelConvertToMicron((int)RectanglePointCenter.X );
+            float CenterY = PixelConvertToMicron((int)RectanglePointCenter.Y);
+            Rectangle sampleMeasureRect = new Rectangle();
+
+            //根据样品台中心点获取开始点位置
+            sampleMeasureRect.X = -((int)CenterX - sampleMeasurePara.MeasureRect.X);
+            sampleMeasureRect.Y = (int)CenterY - sampleMeasurePara.MeasureRect.Bottom;
+            sampleMeasurePara.MeasureRect.X = sampleMeasureRect.X;
+            sampleMeasurePara.MeasureRect.Y = sampleMeasureRect.Y;
+
+            for (int i = 0; i < sampleMeasurePara.DrawPolygonPointRegionF.Count; i++)
+            {
+                int X = -((int)CenterX - (int)sampleMeasurePara.DrawPolygonPointRegionF[i].X);
+                int Y = (int)CenterY - (int)sampleMeasurePara.DrawPolygonPointRegionF[i].Y;
+
+                sampleMeasurePara.DrawPolygonPointRegionF[i] = new Point(X, Y);
+            }
+
+            sampleMeasurePara.sSampleName = MeasureItem.SampleName ;
+            sampleMeasurePara.sampleHoleName =MeasureItem.Name;
+            return sampleMeasurePara;
+        }
+        public SampleMeasurePara GetMeasureInfo(CRectangleGDIObject item)
+        {
+            SampleMeasurePara sampleMeasurePara = new SampleMeasurePara();
+       
+                    //设置测量区域位置与尺寸
+                    float left = 0;
+                    float Top = 0;
+                    float Right = 0;
+                    float Bottom = 0;
+                    float Widths = 0;
+                    float Height = 0;
+                    //设置测量区域位置与尺寸
+                    left = PixelConvertToMicron((int)item.RegionF.X);
+                    Top = PixelConvertToMicron((int)item.RegionF.Y);
+                    Right = PixelConvertToMicron((int)item.RegionF.Right);
+                    Bottom = PixelConvertToMicron((int)item.RegionF.Bottom);
+                    Widths = PixelConvertToMicron((int)item.RegionF.Width);
+                    Height = PixelConvertToMicron((int)item.RegionF.Height);
+                    //保存原位置
+                    RectangleF polygonRectPara = item.DrawRegionF;
+                    if (item.CreateType == CreateRectangleType.Polygon)
+                    {
+                        polygonRectPara = OTSSamplespaceGraphicsPanelFun.GetPolygonToMinRectangle(item.DrawPolygonPointRegionF);
+                        //设置测量区域位置与尺寸
+                        left = PixelConvertToMicron((int)polygonRectPara.X);
+                        Top = PixelConvertToMicron((int)polygonRectPara.Y);
+                        Right = PixelConvertToMicron((int)polygonRectPara.Right);
+                        Bottom = PixelConvertToMicron((int)polygonRectPara.Bottom);
+                        Widths = PixelConvertToMicron((int)polygonRectPara.Width);
+                        Height = PixelConvertToMicron((int)polygonRectPara.Height);
+                    }
+                    //设置测量区域
+                    PointF startPoint = new PointF(left, Top);
+                    SizeF MeasureSize = new SizeF(Widths, Height);
+                    sampleMeasurePara.MeasureRect = new Rectangle(new Point((int)startPoint.X, (int)startPoint.Y), new Size((int)MeasureSize.Width, (int)MeasureSize.Height));
+                    //设置样品孔名称
+                    sampleMeasurePara.sampleHoleName = item.Name;
+                    //设置样品名称
+                    sampleMeasurePara.sSampleName = item.SampleName;
+                    //设置测量区域形状
+                    sampleMeasurePara.iShape = item.Shape;
+                    //设置多边形点集合
+                    sampleMeasurePara.PolygonPointRegion = PointFConvertPoint(ConvertPolygonPointToOTSPoint(item.PolygonPointRegionF));
+                    sampleMeasurePara.PolygonPointRegionF = ConvertPolygonPointToOTSPoint(item.PolygonPointRegionF);
+                    sampleMeasurePara.DrawPolygonPointRegionF = ConvertPolygonPointToOTSPoint(item.DrawPolygonPointRegionF);
+           
+            return sampleMeasurePara;
+        }
+        public  List<PointF> ConvertPolygonPointToOTSPoint(List<PointF> polygonPointList)
+        {
+            List<PointF> OTSPoint = new List<PointF>();
+            float X = 0;
+            float Y = 0;
+            if (polygonPointList != null)
+            {
+                foreach (var item in polygonPointList)
+                {
+                    X = (float)(item.X * ((double)m_OTSCoordStageEdgeLength / m_VisualStageEdgeLength));
+                    Y = (float)(item.Y * ((double)m_OTSCoordStageEdgeLength / m_VisualStageEdgeLength));
+                    OTSPoint.Add(new PointF(X, Y));
+                }
+            }
+            return OTSPoint;
+        }
+        public float PixelConvertToMicron(int Pixel)
+        {
+            return (float)(Pixel * ((double)m_OTSCoordStageEdgeLength / m_VisualStageEdgeLength));
+        }
+        public  List<Point> PointFConvertPoint(List<PointF> Points)
+        {
+            List<Point> PointFs = new List<Point>();
+            if (Points != null)
+            {
+                foreach (var itemPoint in Points)
+                {
+                    PointFs.Add(new Point((int)itemPoint.X, (int)itemPoint.Y));
+                }
+            }
+            return PointFs;
+        }
+        public  PointF[] PointConvertPointF(Point[] Points)
+        {
+            PointF[] PointFs = new PointF[Points.Length];
+            if (Points != null)
+            {
+                for (int i = 0; i < Points.Length; i++)
+                {
+                    PointFs[i] = Points[i];
+                }
+            }
+            return PointFs;
+        }
+        public  List<PointF> PointConvertPointF(List<Point> Points)
+        {
+            List<PointF> PointFs = new List<PointF>();
+            if (Points != null)
+            {
+                foreach (var itemPoint in Points)
+                {
+                    PointFs.Add(itemPoint);
+                }
+            }
+            return PointFs;
+        }
+        #endregion
+        #region 添加测量
+        /// <summary>
+        /// 添加测量
+        /// </summary>
+        /// <param name="IsIsDragging">是否选择样品 0:未选择 1:选择</param>
+        /// <param name="sampleName">样品名称</param>
+        /// <returns>是否成功</returns>
+        public bool AddMeasure( CRectangleGDIObject MeasureGDIObject,out CRectangleGDIObject outMeasureRect)
+        {
+            
+                //添加测量区域
+                CreateRectangleType shape = MeasureGDIObject.CreateType;// == 1 ? 1 : 0;
+                GraphicsPath MeasurePath = new GraphicsPath();
+                if (shape == CreateRectangleType.Rectangle)
+                {
+                    MeasurePath.AddRectangle(MeasureGDIObject.Region);
+                }
+                else
+                {
+                    MeasurePath.AddEllipse(MeasureGDIObject.Region);
+                }
+                //缩小与样品的尺寸
+                Rectangle rectMeasure = MeasureGDIObject.Region;
+                Color MeasureColor = Color.Red;
+                CreateRectangle MeasureRect = new CreateRectangle(rectMeasure, CreateRectangleType.MeasureArea, MeasureGDIObject.Shape, MeasureGDIObject.Name, MeasureGDIObject.SampleName, MeasureColor);
+                MeasureRect.GPath = MeasurePath;
+                MeasureRect.sampleName = MeasureGDIObject.SampleName;
+                MeasureRect.Name = MeasureGDIObject.Name;
+                //获取缩放前尺寸与位置
+                MeasureRect.RegionF = MeasureGDIObject.RegionF;
+                MeasureRect.DrawRegionF = MeasureGDIObject.DrawRegionF;
+              
+                outMeasureRect = MeasureRect;
+                return true;
+            
+        }
+        #endregion
+        public bool CheckMeasureAreaIsBeyondStageArea(RectangleF RMeasureArea)
+        {
+            otsdataconst.DOMAIN_SHAPE iShape = (otsdataconst.DOMAIN_SHAPE)m_StageEdgeGDIObjects[0].CreateType;
+            Rectangle pStageArea = m_StageEdgeGDIObjects[0].Region;
+            Rectangle pMeasureArea = new Rectangle((int)RMeasureArea.Left, (int)RMeasureArea.Top, (int)RMeasureArea.Width, (int)RMeasureArea.Height);
+        
+
+
+            CDomain a_DomainMeasureArea = new CDomain((otsdataconst.DOMAIN_SHAPE)iShape, pMeasureArea);
+            CDomain a_DomainStageArea = new CDomain((otsdataconst.DOMAIN_SHAPE)iShape, pStageArea);
+            return a_DomainStageArea.DomainInDomain(a_DomainMeasureArea);
+        }
+      
+
+        public void ShowSemCoordvAL(Point mPoint, OTSIncAMeasureAppForm m_MeasureAppForm)
+        {
+
+            //鼠标在样品台中移动获取坐标
+            Point mousePoint = GetMouseSEMLocation(mPoint);
+
+            Point SEMPoint = new Point();
+            m_SEMStageData.ConvertOTSToSEMCoord(mousePoint, ref SEMPoint);
+            //将微米转换为毫米
+            float mousePointX = Convert.ToSingle((SEMPoint.X / 1000).ToString("F2"));
+            float mousePointY = Convert.ToSingle((SEMPoint.Y / 1000).ToString("F2"));
+            //将样品台坐标转换为Sem 坐标
+            //编辑显示内容
+            string STSemCoordinate = "X:" + mousePointX + "|Y:" + mousePointY + "";
+            //显示XY轴
+            m_MeasureAppForm.ShowSemCoordvAL(STSemCoordinate);
+
+        }
+        public Point GetMouseSEMLocation(Point mousePoint)
+        {
+
+            var domain = GetOTSSampleStageData().StageDomain;
+            Point rectLocation = m_StageEdgeGDIObjects[0].Region.Location;
+            //样品台尺寸
+            Size rectSize = m_StageEdgeGDIObjects[0].Region.Size;
+            //鼠标在工作区域中的位置
+
+            //OTS坐标中鼠标的位置
+            int OTSX = -((rectLocation.X + rectSize.Width / 2) - mousePoint.X);
+            int OTSY = -(mousePoint.Y - (rectLocation.Y + rectSize.Height / 2));
+            //OTS坐标中鼠标的尺寸位置
+            double OTSWidth = 0;
+            double OTSHeight = 0;
+
+            int width = m_VisualStageEdgeLength;
+            int height = m_VisualStageEdgeLength;
+
+
+            //获取样品台两个坐标点
+            var XDomain = new Point(domain.Left, domain.Top);
+            var YDomain = new Point(domain.Right, domain.Bottom);
+            //转换类型
+            Point xDomain = ((System.Drawing.Point)XDomain);
+            Point yDomain = ((System.Drawing.Point)YDomain);
+            //宽度
+            int widthDomain = Math.Abs(((Point)yDomain).X - ((Point)xDomain).X);
+            int heightDomain = Math.Abs(((Point)yDomain).Y - ((Point)xDomain).Y);
+
+            //换算鼠标在OTS坐标中的位置
+            OTSWidth = (OTSX * ((double)widthDomain / width));
+            OTSHeight = (OTSY * ((double)widthDomain / height));
+
+
+            Point OTSMousePosition = new Point(Convert.ToInt32(Math.Round(OTSWidth, 0)), Convert.ToInt32(Math.Round(OTSHeight, 0)));
+
+            return OTSMousePosition;
+
+        }
+
+        public bool IfMouseInSampleHole(Point mousePoint,out CRectangleGDIObject gdiItem)
+        {
+            foreach (CRectangleGDIObject item in m_SampleHoleGDIObjects)
+            {
+                if (item.IfContains(mousePoint))
+                {
+                    gdiItem = item;
+                    return true; ;
+                }
+            }
+            gdiItem = null;
+            return false;
+
+        }
+        public bool IfMouseInStage(Point mousePoint,out CRectangleGDIObject gdiobj)
+        {
+            foreach (CRectangleGDIObject item in m_StageEdgeGDIObjects)
+            {
+                if (item.IfContains(mousePoint))
+                {
+                    gdiobj = item;
+                    return true;
+                }
+            }
+            gdiobj = null;
+            return false;
+
+        }
+        public bool IfMouseInStage(Point mousePoint )
+        {
+            foreach (CRectangleGDIObject item in m_StageEdgeGDIObjects)
+            {
+                if (item.IfContains(mousePoint))
+                {
+                  
+                    return true;
+                }
+            }
+           
+            return false;
+
+        }
+
+        public void OnMouseMove(CRectangleGDIObject item,MouseEventArgs e)
+        {
+            foreach (CRectangleGDIObject sampleHoleItem in m_SampleHoleGDIObjects)
+            {
+                //获取样品孔中心点 
+                Point sampleHoleCenterPoint = sampleHoleItem.GetCenterPoint();
+                if (item.IfContains(sampleHoleCenterPoint))
+                {
+                    if (item.Name != sampleHoleItem.Name)
+                    {
+                        //获取颜色
+                        string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleColor);
+                        item.SelColor = ColorTranslator.FromHtml(ColorStr);
+                        break;
+                    }
+                }
+                else
+                {
+                    //获取颜色
+                    string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
+                    item.SelColor = ColorTranslator.FromHtml(ColorStr);
+                }
+            }
+
+
+        }
+        public void OnMouseMove( MouseEventArgs e)
+        {
+            foreach (CRectangleGDIObject item in m_ContentGDIObjects)
+            {
+                item.IsDragging = true;
+                item.DraggingPoint = e.Location;
+            }
+            foreach (CRectangleGDIObject item in m_SampleHoleGDIObjects)
+            {
+                item.IsDragging = true;
+                item.DraggingPoint = e.Location;
+            }
+            foreach (CRectangleGDIObject item in m_SpecimenGDIObjects)
+            {
+                item.IsDragging = true;
+                item.DraggingPoint = e.Location;
+            }
+
+
+        }
+        public List<CRectangleGDIObject> GetAllGDIObject()
+        {
+            var allobj = new List<CRectangleGDIObject>();
+            foreach (CRectangleGDIObject item in m_StageEdgeGDIObjects)
+            {
+                allobj.Add(item);
+            }
+
+            foreach (CRectangleGDIObject item in m_SampleHoleGDIObjects)
+            {
+                allobj.Add(item);
+            }
+            foreach (CRectangleGDIObject item in m_SpecimenGDIObjects)
+            {
+                allobj.Add(item);
+            }
+            foreach (CRectangleGDIObject item in m_ContentGDIObjects)
+            {
+                allobj.Add(item);
+            }
+
+
+            return allobj;
+        }
+        public  bool NewLocationDrawSingleInfo(  Point moveToSEMLocation, List<CRectangleGDIObject> UpdateLocationGDIObject, CRectangleGDIObject WorkMeasure, float m_GlobalZoomNum)
+        {
+            //样品台中心点位置
+            Point m_StageCenterPoint = GetCenterPoint();
+            //当前与中心点相差距离
+            int m_StageCenterDiffX = 0;
+            int m_StageCenterDiffY = 0;
+            Point m_WorkMeasureCenterPoint = new Point();
+            if (UpdateLocationGDIObject == null)
+            {
+                return false;
+            }
+
+            int diffNewX = 0;
+            int diffNewY = 0;
+            bool IsOK = true;
+            diffNewX = moveToSEMLocation.X;
+            diffNewY = moveToSEMLocation.Y;
+
+            if (IsOK)
+            {
+                foreach (var item in UpdateLocationGDIObject)
+                {
+                    m_WorkMeasureCenterPoint = WorkMeasure.GetCenterPoint();
+                    m_StageCenterDiffX = m_StageCenterPoint.X - m_WorkMeasureCenterPoint.X;//(int)((m_StageCenterPoint.X - m_WorkMeasureCenterPoint.X) * m_GlobalZoomNum);
+                    m_StageCenterDiffY = m_StageCenterPoint.Y - m_WorkMeasureCenterPoint.Y;// (int)((m_StageCenterPoint.Y - m_WorkMeasureCenterPoint.Y) * m_GlobalZoomNum);
+                    diffNewX = (int)(moveToSEMLocation.X * m_GlobalZoomNum);
+                    diffNewY = (int)(moveToSEMLocation.Y * m_GlobalZoomNum);
+                    //根据鼠标_更改测量区域的位置
+                    item.Region = new Rectangle(new Point(item.Region.X + m_StageCenterDiffX + diffNewX, item.Region.Y + m_StageCenterDiffY - diffNewY), new Size(item.Region.Width, item.Region.Height));
+                    item.RegionF = new RectangleF(new PointF(item.RegionF.X + (m_StageCenterDiffX + diffNewX), item.RegionF.Y + (m_StageCenterDiffY - diffNewY)), new SizeF(item.RegionF.Width, item.RegionF.Height));
+                    item.DrawRegionF = new RectangleF(new PointF(item.DrawRegionF.X + (m_StageCenterDiffX + diffNewX) / m_GlobalZoomNum, item.DrawRegionF.Y + (m_StageCenterDiffY - diffNewY) / m_GlobalZoomNum), new SizeF(item.DrawRegionF.Width, item.DrawRegionF.Height));
+                }
+            }
+            return IsOK;
+        }
+        public  void NewLocationDrawMeasureInfo( Point moveToSEMLocation, List<CRectangleGDIObject> UpdateLocationGDIObject, float m_GlobalZoomNum)
+        {
+            //样品台中心点位置
+            Point m_StageCenterPoint = GetCenterPoint();
+            //当前与中心点相差距离
+            int m_StageCenterDiffX = 0;
+            int m_StageCenterDiffY = 0;
+            int diffNewX = 0;
+            int diffNewY = 0;
+            Point m_UpdateCenterPoint = new Point();
+
+            foreach (var item in UpdateLocationGDIObject)
+            {
+                if (item.IsWorkSample)
+                {
+                    m_UpdateCenterPoint = item.GetCenterPoint();
+                    m_StageCenterDiffX = (int)((m_StageCenterPoint.X - m_UpdateCenterPoint.X) * 1);
+                    m_StageCenterDiffY = (int)((m_StageCenterPoint.Y - m_UpdateCenterPoint.Y) * 1);
+
+                    diffNewX = (int)(moveToSEMLocation.X * m_GlobalZoomNum);
+                    diffNewY = (int)(moveToSEMLocation.Y * m_GlobalZoomNum);
+                    //根据鼠标_更改测量区域的位置
+                    item.Region = new Rectangle(new Point(item.Region.X + m_StageCenterDiffX + diffNewX, item.Region.Y + m_StageCenterDiffY - diffNewY), new Size(item.Region.Width, item.Region.Height));
+                    item.RegionF = new RectangleF(new PointF(item.RegionF.X + (m_StageCenterDiffX + diffNewX) / m_GlobalZoomNum, item.RegionF.Y + (m_StageCenterDiffY - diffNewY) / m_GlobalZoomNum), new SizeF(item.RegionF.Width, item.RegionF.Height));
+                    item.DrawRegionF = item.RegionF;
+                    //修改多边形的绘制点集合
+                    if (item.CreateType == CreateRectangleType.Polygon)
+                    {
+                        for (int i = 0; i < item.PolygonPointRegion.Count; i++)
+                        {
+                            item.PolygonPointRegion[i] = new Point(item.PolygonPointRegion[i].X + m_StageCenterDiffX + diffNewX, item.PolygonPointRegion[i].Y + m_StageCenterDiffY - diffNewY);
+                            item.PolygonPointRegionF[i] = new PointF(item.PolygonPointRegionF[i].X + (m_StageCenterDiffX + diffNewX), item.PolygonPointRegionF[i].Y + (m_StageCenterDiffY - diffNewY));
+                            item.DrawPolygonPointRegionF[i] = new PointF(item.DrawPolygonPointRegionF[i].X + (m_StageCenterDiffX + diffNewX) / m_GlobalZoomNum, item.DrawPolygonPointRegionF[i].Y + (m_StageCenterDiffY - diffNewY) / m_GlobalZoomNum);
+                        }
+                    }
+                }
+            }
+        }
+        public  SampleHolePara GetSampleHolePara(CRectangleGDIObject sampleHoleItem)
+        {
+            //int w = (IsWidth == 0 ? Width : Height);
+            SampleHolePara sampleHoleParas = new SampleHolePara();
+            //获取样品孔的OTS位置与尺寸
+            sampleHoleParas = GetSampleHoleInfo(sampleHoleItem);
+            //获取工作区域位置与尺寸
+            Rectangle WorkAreaRect = new Rectangle(0, 0, m_totalCtrlWidth, m_totalCtrlHeight);
+            //获取工作区域 中心点
+            Point ScreenPointCenter = GetCenterPoint(WorkAreaRect);
+            //获取样品台 中心点
+            PointF RectanglePointCenter =GetCenterPoint();
+            //获取屏幕中心点
+            float WorkAreaCenterPointX = PixelConvertToMicron(ScreenPointCenter.X);
+            float WorkAreaCenterPointY = PixelConvertToMicron(ScreenPointCenter.Y);
+            //获取样品台中心点
+            float CenterX = PixelConvertToMicron((int)RectanglePointCenter.X);
+            float CenterY = PixelConvertToMicron((int)RectanglePointCenter.Y);
+            Rectangle sampleHoleRect = new Rectangle();
+            //根据样品台中心点获取开始点位置
+            sampleHoleRect.X = -((int)CenterX - sampleHoleParas.SampleHoleRect.X);
+            sampleHoleRect.Y = (int)CenterY - sampleHoleParas.SampleHoleRect.Bottom;
+            sampleHoleParas.SampleHoleRect.X = sampleHoleRect.X;
+            sampleHoleParas.SampleHoleRect.Y = sampleHoleRect.Y;
+            return sampleHoleParas;
+        }
+        public  Point GetCenterPoint(Rectangle rect)
+        {
+            //声明
+            Point centerPoint = new Point();
+            //设置X,Y坐标
+            centerPoint.X = rect.X + rect.Width / 2;
+            centerPoint.Y = rect.Y + rect.Height / 2;
+            return centerPoint;
+        }
+        public  SampleHolePara GetSampleHoleInfo(CRectangleGDIObject item)
+        {
+            SampleHolePara sampleHolePara = new SampleHolePara();
+         
+            //保存原位置
+            Rectangle rectPara = item.Region;
+            //设置测量区域
+            sampleHolePara.SampleHoleRect = item.Region;
+            //设置测量区域位置与尺寸
+            float left = PixelConvertToMicron((int)item.RegionF.X);
+            float Top = PixelConvertToMicron((int)item.RegionF.Y);
+            float Right = PixelConvertToMicron((int)item.RegionF.Right);
+            float Bottom = PixelConvertToMicron((int)item.RegionF.Bottom);
+            float Widths = PixelConvertToMicron((int)item.RegionF.Width);
+            float Height = PixelConvertToMicron((int)item.RegionF.Height);
+
+            PointF startPoint = new PointF(left, Top);
+            SizeF sampleHoleSize = new SizeF(Widths, Height);
+            sampleHolePara.SampleHoleRect = new Rectangle(new Point((int)startPoint.X, (int)startPoint.Y), new Size((int)sampleHoleSize.Width, (int)sampleHoleSize.Height));
+            //设置样品孔名称
+            sampleHolePara.sHoleName = item.Name;
+            //设置测量区域形状
+            sampleHolePara.iShape = item.Shape;
+           
+            return sampleHolePara;
+        }
+
+
+    }
+}

+ 68 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/sampleSpaceObject.cd

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+  <Class Name="OTSMeasureApp.CRectangleGDIObject">
+    <Position X="1.25" Y="0.5" Width="2.75" />
+    <TypeIdentifier>
+      <HashCode>AWCFBAAAwIho4YAAACAgA0cgAABAIBAAAAgAAgAAAAg=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.CreateRectangle">
+    <Position X="1" Y="10" Width="2.75" />
+    <TypeIdentifier>
+      <HashCode>AeCFDAICwIt54cAAAGAgA0cgMBBGJBAQAggAAgEJBgg=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\CreateRectangle.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.OTSSamplespaceWindow">
+    <Position X="8.75" Y="0.5" Width="2.75" />
+    <TypeIdentifier>
+      <HashCode>Jb6d/TvUAqHzzwHlJTniOrr7ZH7TkJnR/26MGCR6UCA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\OTSSamplespaceWindow.cs</FileName>
+    </TypeIdentifier>
+    <ShowAsAssociation>
+      <Field Name="selectSampleGDIObjects" />
+      <Field Name="m_visualStage" />
+    </ShowAsAssociation>
+    <ShowAsCollectionAssociation>
+      <Field Name="m_SampleGDIObjects" />
+      <Field Name="m_MeasureGDIObjects" />
+      <Field Name="m_MeasurePathGDIObjects" />
+      <Field Name="m_MeasureFieldGDIObjects" />
+      <Field Name="m_AllFieldGDIObjects" />
+      <Field Name="m_ImageGDIObjects" />
+      <Field Name="m_ImageOfFieldGDIObjects" />
+      <Field Name="m_DrawMeasureGDIObjects" />
+      <Field Name="m_DrawPolygonFinishGDIObjects" />
+    </ShowAsCollectionAssociation>
+  </Class>
+  <Class Name="OTSMeasureApp.OTSSamplespaceGraphicsPanelFun">
+    <Position X="17.25" Y="0.75" Width="2.75" />
+    <NestedTypes>
+      <Enum Name="OTSMeasureApp.OTSSamplespaceGraphicsPanelFun.EnumMousePointPosition" Collapsed="true">
+        <TypeIdentifier>
+          <NewMemberFileName>4-OTSSamplespaceGraphicsPanel\OTSSamplespaceGraphicsPanelFun.cs</NewMemberFileName>
+        </TypeIdentifier>
+      </Enum>
+    </NestedTypes>
+    <TypeIdentifier>
+      <HashCode>ABhEQABEAAAAIQAAAAAAQQAIAIAAAABEIEAEwAIBwCA=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\OTSSamplespaceGraphicsPanelFun.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp.SEMDATAFieldManage">
+    <Position X="19" Y="8.25" Width="2" />
+    <TypeIdentifier>
+      <HashCode>QIAAAAgAJAAAACAggAAIKgGAACAAAAABQAAAAEAAAAM=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\SEMDATAFieldManage.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Class Name="OTSMeasureApp._4_OTSSamplespaceGraphicsPanel.CVisualStage">
+    <Position X="13.5" Y="0.5" Width="3" />
+    <TypeIdentifier>
+      <HashCode>kWIacgCACJgKEAESAAYEKSgAABMwMpIAhAAIUAQAAAg=</HashCode>
+      <FileName>4-OTSSamplespaceGraphicsPanel\VisualStage.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Font Name="Microsoft YaHei UI" Size="9" />
+</ClassDiagram>