Sfoglia il codice sorgente

The logical synchronization checked before the measurement begins is replaced with the new version of the detection

cxs 1 mese fa
parent
commit
993272bd1d

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

@@ -1,5 +1,4 @@
 using OTSCLRINTERFACE;
-using OTSCommon.DBOperate.Model;
 using OTSMeasureApp._0_OTSModel.OTSDataType;
 using OTSModelSharp;
 using OTSModelSharp.ServiceCenter;
@@ -7,7 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.Drawing;
 using System.Drawing.Imaging;
-using System.Linq;
 using System.Xml;
 
 namespace OTSDataType

+ 78 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/ParamData/frmPre_measurementDetection.Designer.cs

@@ -0,0 +1,78 @@
+namespace OTSMeasureApp._1_OTSMeasure.Measure.ParamData
+{
+    partial class frmPre_measurementDetection
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.dGV_check = new System.Windows.Forms.DataGridView();
+            this.btn = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.dGV_check)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // dGV_check
+            // 
+            this.dGV_check.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.dGV_check.Location = new System.Drawing.Point(12, 38);
+            this.dGV_check.Name = "dGV_check";
+            this.dGV_check.RowTemplate.Height = 23;
+            this.dGV_check.Size = new System.Drawing.Size(516, 316);
+            this.dGV_check.TabIndex = 0;
+            // 
+            // btn
+            // 
+            this.btn.Location = new System.Drawing.Point(453, 360);
+            this.btn.Name = "btn";
+            this.btn.Size = new System.Drawing.Size(75, 23);
+            this.btn.TabIndex = 1;
+            this.btn.Text = "关闭";
+            this.btn.UseVisualStyleBackColor = true;
+            this.btn.Click += new System.EventHandler(this.btn_Click);
+            // 
+            // frmPre_measurementDetection
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(540, 389);
+            this.Controls.Add(this.btn);
+            this.Controls.Add(this.dGV_check);
+            this.MaximizeBox = false;
+            this.Name = "frmPre_measurementDetection";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "测量前参数检测";
+            this.Load += new System.EventHandler(this.frmPre_measurementDetection_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.dGV_check)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.DataGridView dGV_check;
+        private System.Windows.Forms.Button btn;
+    }
+}

+ 462 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/ParamData/frmPre_measurementDetection.cs

@@ -0,0 +1,462 @@
+using OTSDataType;
+using OTSModelSharp;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using static OTSDataType.otsdataconst;
+
+namespace OTSMeasureApp._1_OTSMeasure.Measure.ParamData
+{
+    public partial class frmPre_measurementDetection : Form
+    {
+        public class InspectionItem
+        {
+            public string Name { get; set; }
+            public string Suggestion { get; set; }
+
+            public InspectionType Inspectiontype { get; set; }
+            public InspectionStatus Status { get; set; }
+            public bool IsChecked { get; set; }
+        }
+        public enum InspectionType
+        {
+            MeasureState,
+            Saved,
+            Minsize,
+            SEMState,
+            Stddb,
+            AutoFocus,
+            AutoContrastAndBrightness
+        }
+        public enum InspectionStatus
+        {
+            NotStarted,
+            InProgress,
+            Passed,
+            Failed,
+            Warning
+        }
+        private List<InspectionItem> inspectionItems;
+        COTSMsrPrjResultData _pPrjResultData;
+        public List<COTSSample> listMeasuableSamples { get; set; }
+        public bool checkResult { get; set; } = true;
+        COTSMeasureParam _cOTSMeasure;
+        public List<COTSSample> SampleList { get; set; } = new List<COTSSample>();
+        public frmPre_measurementDetection(COTSMeasureParam a_cOTSMeasure)
+        {
+            InitializeComponent();
+            _cOTSMeasure= a_cOTSMeasure;
+            _pPrjResultData = a_cOTSMeasure.GetResultData();
+
+            SetupDataGridView();
+            InitializeInspectionData();
+        }
+
+
+        private void SetupDataGridView()
+        {
+            dGV_check.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+            dGV_check.AllowUserToAddRows = false;
+            dGV_check.ReadOnly = true;
+            dGV_check.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+            // 隐藏表格线
+            dGV_check.CellBorderStyle = DataGridViewCellBorderStyle.None;
+            dGV_check.GridColor = Color.White; // 与背景色相同,视觉上隐藏网格线
+            dGV_check.RowHeadersVisible = false;
+            //dGV_check.ColumnHeadersVisible = false;
+
+            dGV_check.BorderStyle = BorderStyle.None;
+            dGV_check.Columns.Add("ItemName", "检查项");
+            dGV_check.Columns.Add("Status", "状态");
+            dGV_check.Columns.Add("Suggestion", "建议");
+            dGV_check.Columns["Status"].ValueType = typeof(Image);
+            foreach (DataGridViewColumn column in dGV_check.Columns)
+            {
+                column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+                column.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
+            }
+            dGV_check.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
+            dGV_check.Columns["ItemName"].FillWeight = 20;
+            dGV_check.Columns["Status"].FillWeight = 10;
+            dGV_check.Columns["Suggestion"].FillWeight = 30;
+            dGV_check.DefaultCellStyle.ForeColor = Color.Black;
+            dGV_check.DefaultCellStyle.Font = new Font("Microsoft Sans Serif", 9F);
+            dGV_check.BackgroundColor = Color.White;
+            dGV_check.CellFormatting += DataGridView_CellFormatting;
+            dGV_check.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+        }
+
+
+
+        
+        
+        
+        private void InitializeInspectionData()
+        {
+            inspectionItems = new List<InspectionItem>
+            {
+                 new InspectionItem { Name = "测量状态", Suggestion = "测量已结束",Inspectiontype=InspectionType.MeasureState },
+                 new InspectionItem { Name = "是否保存", Suggestion = "设定错误,工作文件未保存",Inspectiontype=InspectionType.Saved },
+                 new InspectionItem { Name = "最小尺寸是否合适", Suggestion = "设定的分辨率太低,请修改像素尺寸为颗粒直径最小值的一半以下,或修改颗粒最小尺寸为像素尺寸的2倍以上" ,Inspectiontype=InspectionType.Minsize},
+                 new InspectionItem { Name = "SEM状态", Suggestion = "没有获取到SEM数据",Inspectiontype=InspectionType.SEMState },
+                 new InspectionItem { Name = "标准库检测", Suggestion = "标准库不能使用nostddb",Inspectiontype=InspectionType.Stddb },
+                 new InspectionItem { Name = "斜面聚焦", Suggestion = "建议启用斜面聚焦",Inspectiontype=InspectionType.AutoFocus },
+                 new InspectionItem { Name = "自动亮度及对比度", Suggestion = "建议启用自动亮度及对比度",Inspectiontype=InspectionType.AutoContrastAndBrightness }
+            };
+            RefreshDataGridView();
+        }
+        private void DataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
+        {
+            if (e.ColumnIndex == dGV_check.Columns["Status"].Index && e.RowIndex >= 0)
+            {
+                var item = inspectionItems[e.RowIndex];
+
+                switch (item.Status)
+                {
+                    case InspectionStatus.NotStarted:
+                        e.Value = "";
+                        // 重置字体颜色为黑色
+                        dGV_check.Rows[e.RowIndex].Cells["ItemName"].Style.ForeColor = Color.Black;
+                        dGV_check.Rows[e.RowIndex].Cells["Status"].Style.ForeColor = Color.Black;
+                        dGV_check.Rows[e.RowIndex].Cells["Suggestion"].Value = "";
+                        break;
+                    case InspectionStatus.InProgress:
+                        e.Value = "↻"; // 转圈动画
+                        dGV_check.Rows[e.RowIndex].Cells["ItemName"].Style.ForeColor = Color.Black;
+                        dGV_check.Rows[e.RowIndex].Cells["Status"].Style.ForeColor = Color.Black;
+                        dGV_check.Rows[e.RowIndex].Cells["Suggestion"].Value = "";
+                        break;
+                    case InspectionStatus.Passed:
+                        e.Value = "✓";
+                        dGV_check.Rows[e.RowIndex].Cells["ItemName"].Style.ForeColor = Color.Green;
+                        dGV_check.Rows[e.RowIndex].Cells["Status"].Style.ForeColor = Color.Green;
+                        dGV_check.Rows[e.RowIndex].Cells["Suggestion"].Value = "";
+                        break;
+                    case InspectionStatus.Failed:
+                        e.Value = "✗";
+                        dGV_check.Rows[e.RowIndex].Cells["ItemName"].Style.ForeColor = Color.Red;
+                        dGV_check.Rows[e.RowIndex].Cells["Status"].Style.ForeColor = Color.Red;
+                        dGV_check.Rows[e.RowIndex].Cells["Suggestion"].Value = item.Suggestion;
+                        break;
+                    case InspectionStatus.Warning:
+                        e.Value = "⚠";
+                        dGV_check.Rows[e.RowIndex].Cells["ItemName"].Style.ForeColor = Color.Orange;
+                        dGV_check.Rows[e.RowIndex].Cells["Status"].Style.ForeColor = Color.Orange;
+                        dGV_check.Rows[e.RowIndex].Cells["Suggestion"].Value = item.Suggestion;
+                        break;
+                }
+            }
+        }
+        public void StartInspection()
+        {
+            List<COTSSample> listSamples = _pPrjResultData.GetSampleList();
+            foreach (var pSample in listSamples)
+            {
+                if (pSample.GetSwitch())
+                {
+                    for (int i = 0; i < inspectionItems.Count; i++)
+                    {
+                        var item = inspectionItems[i];
+                        // 设置为检查中状态
+                        item.Status = InspectionStatus.InProgress;
+                        dGV_check.InvalidateRow(i);
+                        // 模拟检查过程
+                        Task.Delay(500); // 实际检查逻辑替换此处
+                        // 执行实际检查
+                        var cResult = PerformCheck(item, pSample);
+                        // 更新状态
+                        item.Status = cResult.Status;
+                        item.Suggestion = cResult.Suggestion;
+                        item.IsChecked = true;
+                        dGV_check.InvalidateRow(i);
+                    }
+                    if(checkResult) SampleList.Add(pSample);
+                }
+            }
+        }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+        private (InspectionStatus Status, string Suggestion) PerformCheck(InspectionItem inspection, COTSSample pSample)
+        {
+            // 这里实现具体的检查逻辑
+            // 返回状态和建议
+            switch (inspection.Inspectiontype)
+            {
+                case InspectionType.MeasureState:
+                    bool val= checkMeasureState(pSample);
+                    if (!val)
+                        return (InspectionStatus.Passed, "");
+                    else
+                    {
+                        checkResult = false;
+                        return (InspectionStatus.Failed, inspection.Suggestion);
+                    }
+                case InspectionType.Saved:
+                    bool isSaved= IsSaved(_pPrjResultData, pSample);
+                    if (isSaved)
+                        return (InspectionStatus.Passed, "");
+                    else
+                        {
+                        checkResult = false;
+                         return (InspectionStatus.Failed, inspection.Suggestion);} 
+                case InspectionType.SEMState:
+                    bool semState= GetSEMState(pSample);
+                if (semState)
+                    return (InspectionStatus.Passed, "");
+                else
+                {
+                    checkResult = false;
+                    return (InspectionStatus.Failed, inspection.Suggestion);
+                }
+                case InspectionType.Minsize:
+                    bool minSize= GetMinSizeAppropriate(_pPrjResultData, pSample);
+                if (minSize)
+                    return (InspectionStatus.Passed, "");
+                else
+                {
+                    checkResult = false;
+                    return (InspectionStatus.Failed, inspection.Suggestion);
+                }
+                case InspectionType.Stddb:
+                    bool stdDb= GetStddbState(pSample);
+                if (stdDb)
+                    return (InspectionStatus.Passed, "");
+                else
+                {
+                    checkResult = false;
+                    return (InspectionStatus.Failed, inspection.Suggestion);
+                }
+                case InspectionType.AutoFocus:
+                    bool aufocus = GetFocusState(pSample);
+                    if (aufocus)
+                        return (InspectionStatus.Passed, "");
+                    else
+                    {
+                        return (InspectionStatus.Warning, inspection.Suggestion);
+                    }
+                case InspectionType.AutoContrastAndBrightness:
+                    bool autoContrastAndBrightnessState = GetAutoContrastAndBrightnessState(pSample);
+                    if (autoContrastAndBrightnessState)
+                        return (InspectionStatus.Passed, "");
+                    else
+                    {
+                        return (InspectionStatus.Warning, inspection.Suggestion);
+                    }
+                default:
+                    return (InspectionStatus.Passed, "");
+            }
+        }
+        private void RefreshDataGridView()
+        {
+            // 清空现有数据
+            dGV_check.Rows.Clear();
+
+            // 添加检查项
+            foreach (var item in inspectionItems)
+            {
+                int rowIndex = dGV_check.Rows.Add(item.Name, "", "");
+                dGV_check.Rows[rowIndex].Tag = item;
+            }
+
+            // 设置初始字体颜色为黑色
+            foreach (DataGridViewRow row in dGV_check.Rows)
+            {
+                row.Cells["ItemName"].Style.ForeColor = Color.Black;
+            }
+            Refresh();
+            Invalidate();
+        }
+
+
+
+
+
+        bool IsMeasureCompletedSmpl(COTSSample a_pSample)
+        {
+            if (a_pSample.GetMsrStatus().GetStatus() != OTSDataType.OTS_MSR_SAMPLE_STATUS.COMPLETED)
+            {
+
+                return false;
+            }
+            return true;
+        }
+
+        bool checkMeasureState(COTSSample pSample)
+        {
+
+            if (IsMeasureCompletedSmpl(pSample))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        bool IsSaved(COTSMsrPrjResultData a_pProjMgrFile, COTSSample a_pSample)
+        {
+            const string UNTITLED_FILE_NAME = "Untitled";
+            String strPathName = a_pProjMgrFile.GetPathName();
+            strPathName.Trim();
+            if (strPathName == UNTITLED_FILE_NAME || strPathName == "")
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        
+        
+        bool GetMinSizeAppropriate(COTSMsrPrjResultData a_pProjMgrFile, COTSSample a_pSample)
+        {
+            CSampleHolder pStage = a_pProjMgrFile.GetStageHolder();
+            String sHoleName = a_pSample.GetSampleHoleName();
+            CHole pSampleHole = pStage.GetHoleByName(sHoleName);
+            if (a_pSample.GetSEMDataMsr() != null)
+            {
+                double dPixleSize = a_pSample.CalculatePixelSize();
+                // get min size
+                COTSImageProcParam pImageProcParam = a_pSample.GetMsrParams().GetImageProcessParam();
+                double dMinSize = pImageProcParam.GetIncAreaRange().GetStart();
+                // if pixel size is bigger than 1/2 of the min size,than  can't see  the object clearly on current magnification
+                if (dPixleSize >= dMinSize * 0.5)
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        bool GetSEMState(COTSSample a_pSample)
+        {
+            if (a_pSample.GetSEMDataMsr().GetTotalFields() == 0|| a_pSample.GetSEMDataMsr().GetScanFieldSize() == 0|| a_pSample.GetSEMDataMsr().GetWorkingDistance() == 0)
+            {
+                return false;
+            }
+            return true;
+        }
+        bool GetStddbState(COTSSample a_pSample)
+        {
+            CSampleParam pa = a_pSample.GetMsrParams();
+            if (pa.GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.ExpressionParse|| pa.GetEngineType() == OTS_CLASSIFY_ENGINE_TYPE.SpectrumMatch)
+            {
+                if (pa.GetSTDName() == "NoSTDDB")
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        private void btn_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+        bool GetFocusState(COTSSample a_pSample)
+        {
+            CSampleParam pa = a_pSample.GetMsrParams();
+            if (pa.SlopParam!=null&&pa.SlopParam.IsUsingSlopParam)
+            {
+               return true;
+            }
+            return false;
+        }
+
+        bool GetAutoContrastAndBrightnessState(COTSSample a_pSample)
+        {
+            COTSDefaultParam pa = _cOTSMeasure.GetDefaultParam();
+            if (pa.BrightnessContrastRegulationParam.toRun)
+            {
+                return true;
+            }
+            return false;
+        }
+    
+        public async Task StartInspectionAsync()
+{
+    List<COTSSample> listSamples = _pPrjResultData.GetSampleList();
+    foreach (var pSample in listSamples)
+    {
+        if (pSample.GetSwitch())
+        {
+            for (int i = 0; i < inspectionItems.Count; i++)
+            {
+                var item = inspectionItems[i];
+                
+                // 设置为检查中状态
+                item.Status = InspectionStatus.InProgress;
+                // 强制刷新UI
+                dGV_check.InvalidateRow(i);
+                dGV_check.Update(); // 立即更新UI
+                
+                // 真正的延迟等待
+                await Task.Delay(500);
+                
+                // 执行实际检查
+                var cResult = PerformCheck(item, pSample);
+                
+                // 更新状态
+                item.Status = cResult.Status;
+                item.Suggestion = cResult.Suggestion;
+                item.IsChecked = true;
+                
+                // 再次刷新UI
+                dGV_check.InvalidateRow(i);
+                dGV_check.Update(); // 立即更新UI
+            }
+            
+            if (checkResult) 
+                SampleList.Add(pSample);
+        }
+    }
+}
+        private void frmPre_measurementDetection_Load(object sender, EventArgs e)
+        {
+            if (checkResult)
+            {
+                StartInspectionAsync();
+            }
+        }
+    }
+}

+ 120 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/ParamData/frmPre_measurementDetection.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 23 - 404
OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs

@@ -1,26 +1,16 @@
-using OTSModelSharp;
-using OTSDataType;
+using OTSDataType;
+using OTSMeasureApp._1_OTSMeasure.Measure.ParamData;
+using OTSModelSharp;
+using OTSModelSharp.ResourceManage;
 using System;
 using System.Collections.Generic;
 using System.Drawing;
-using System.Linq;
 using System.IO;
-
-using OTSModelSharp.ResourceManage;
-using static OTSModelSharp.ResourceManage.ResourceID;
-using static OTSModelSharp.ResourceManage.ResourceData;
-using static OTSDataType.otsdataconst;
+using System.Linq;
 using System.Windows.Forms;
-using OTSMeasureApp._0_OTSModel.OTSDataType;
-
-
+using static OTSDataType.otsdataconst;
 namespace OTSMeasureApp
 {
-
-
-
- 
-
     //设置线程状态
     public enum MSR_RUN_TYPE
     {
@@ -93,19 +83,19 @@ namespace OTSMeasureApp
             resultData = value;
         }
 
+
+
+
+
+
         public COTSMeasureParam(OTSIncAMeasureAppForm MeasureApp)
         {
             log = NLog.LogManager.GetCurrentClassLogger();
             m_MeasureAppFrom = MeasureApp;
 
             SetResultData(new COTSMsrPrjResultData());
-
-
         }
 
-      
-
-
 
         //检查参数文件是否存在
         public bool LoadParamFile()
@@ -113,16 +103,9 @@ namespace OTSMeasureApp
             //加载样品参数文件:   \Config\SysData\OTSProgMgrParam.pmf
             SetDefaultParam(new COTSDefaultParam());
           return  GetDefaultParam().LoadInfoFromProgMgrFile();
-           
-          
         }
 
-       
-
- 
-
         //获取系统文件是否存在和有效
-
         public bool InitResultData(bool bNewFileFlag = true)
         {
             //打开文件,则文件中保存有样品台信息,不需要使用系统样品名信息
@@ -168,8 +151,6 @@ namespace OTSMeasureApp
             return true;
         }
 
-       
-
         //新建样品工作文件 0:报错 1:正常 2:取消
         public int CreateNewFile()
         {
@@ -189,13 +170,8 @@ namespace OTSMeasureApp
                     return 2;
                 }
             }
-
-            //新建新的工作文件
-            //重新生成一个工作文件对象
             COTSMsrPrjResultData ProjDataMgr = new COTSMsrPrjResultData();
             GetResultData().SetPathName("Untitled");
-
-
             SetResultData(ProjDataMgr);
             //this.LoadStageParamFile();
            
@@ -203,7 +179,6 @@ namespace OTSMeasureApp
             {
                 return 0;
             }
-
             return 1;
         }
 
@@ -620,343 +595,25 @@ namespace OTSMeasureApp
         public bool CheckSampleParam(bool bCheckFlag)
         {
             m_MeasureSampleList.Clear();
-            List<COTSSample> MSampleList = new List<COTSSample>();
-
-            if (!CheckMeasureParam(GetResultData(), ref MSampleList, bCheckFlag))
-            {
-                return false;
-            }
-            if (MSampleList.Count > 0)
-            {
-                m_MeasureSampleList = MSampleList;
-                return true;
-            }
-            return false;
-        }
-        public bool CheckMeasureParam(COTSMsrPrjResultData a_pProjMgrFile, ref List<COTSSample> a_listMeasuableSamples, bool a_bCheckSetting)
-        {
 
+            frmPre_measurementDetection frmPre_MeasurementDetection = new frmPre_measurementDetection(this);
 
-            // go through the sample list to check setting parameters 
-            int nSwitchSmplNo = 0;
-            int nCompletedSmplNo = 0;
-            int nErrorSmplNo = 0;
-            int nWarningSmplNo = 0;
-            List<String> listSamplMessages = new List<string>();
-            List<COTSSample> listSamples = a_pProjMgrFile.GetSampleList();
-            List<COTSSample> listMeasurableSamples = new List<COTSSample>();
-            List<COTSSample> listWithWarningMeasurableSamples = new List<COTSSample>();
-            foreach (var pSample in listSamples)
+            frmPre_MeasurementDetection.StartInspection();
+            if (!frmPre_MeasurementDetection.checkResult)
             {
-                // is the sample switch on
-                if (pSample.GetSwitch())
-                {
-                    ++nSwitchSmplNo;
-                    String strSmplMessage;
-                    strSmplMessage = pSample.GetName() + ":" + "\r\n";
-
-                    // is this a measurement completed sample
-                    if (IsMeasureCompletedSmpl(pSample))
-                    {   // measurement completed sample
-                        ++nCompletedSmplNo;
-                        string str2 = GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE.FINISHED);
-                        strSmplMessage += str2;
-                        strSmplMessage += "\r\n";
-                    }
-                    else
-                    {
-                        // errors
-                        List<SAMPLE_FAULT_WARN_CODE> a_listErrorCodes = new List<SAMPLE_FAULT_WARN_CODE>();
-                        GetSampleErrorCodes(a_pProjMgrFile, pSample, ref a_listErrorCodes);
-                        if (a_listErrorCodes.Count != 0)
-                        {
-                            // has error, this is not a measurable sample
-                            ++nErrorSmplNo;
-                            foreach (var nErrorCode in a_listErrorCodes)
-                            {
-                                String str3 = GetSampleErrorWarnString(nErrorCode);
-                                strSmplMessage += str3;
-                                strSmplMessage += "\r\n";
-                            }
-                        }
-                        else
-                        {
-                            // no error, this is a measurable sample
-                            listMeasurableSamples.Add(pSample);
-                        }
-
-                        // warnings
-                        List<SAMPLE_FAULT_WARN_CODE> a_listWarningCodes = new List<SAMPLE_FAULT_WARN_CODE>();
-                        GetSampleWarningCodes(a_pProjMgrFile, pSample, ref a_listWarningCodes);
-                        if (a_listWarningCodes.Count != 0)
-                        {
-                            ++nWarningSmplNo;
-                            foreach (var nWarningCode in a_listWarningCodes)
-                            {
-                                String str3 = GetSampleErrorWarnString(nWarningCode);
-                                strSmplMessage += str3;
-                                strSmplMessage += "\r\n";
-                            }
-
-                            // has no error?
-                            if (a_listErrorCodes.Count == 0)
-                            {
-                                // this is a measurable sample but with setting warnings
-                                listWithWarningMeasurableSamples.Add(pSample);
-                            }
-                        }
-
-                        // no error and warning
-                        if (a_listErrorCodes.Count == 0 && a_listWarningCodes.Count == 0)
-                        {
-                            String str3 = GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE.NO_ERROR_WARNING);
-                            strSmplMessage += str3;
-                            strSmplMessage += "\r\n";
-                        }
-                    }
-
-                    // add 
-                    listSamplMessages.Add(strSmplMessage);
-                }
-            }
-
-            // dlg message string
-            String strDlgMessage = "";
-            String str;
-            String str1;
-            str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SWITCH_ON);
-            str1 = str1.Replace("%d", "{0}");
-            str = string.Format(str1, nSwitchSmplNo);
-            strDlgMessage += str;
-            strDlgMessage += "\r\n";
-
-            // add more string if there switch on sample
-            if (nSwitchSmplNo > 0)
-            {
-                // completed sample number (optional)
-                if (nCompletedSmplNo > 0)
-                {
-                    str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.FINISHED);
-                    str1 = str1.Replace("%d", "{0}");
-                    str = string.Format(str1, nCompletedSmplNo);
-                    strDlgMessage += str;
-                    strDlgMessage += "\r\n";
-                }
-
-                // any unmeasured switch on samples?
-                if (nSwitchSmplNo > nCompletedSmplNo)
-                {
-                    // with setting error sample number
-                    str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SETTING_ERROR);
-                    str1 = str1.Replace("%d", "{0}");
-                    str = string.Format(str1, nErrorSmplNo);
-                    strDlgMessage += str;
-                    strDlgMessage += "\r\n";
-
-                    // with setting warning sample number
-                    str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SETTING_WARNING);
-                    str1 = str1.Replace("%d", "{0}");
-                    str = string.Format(str1, nWarningSmplNo);
-                    strDlgMessage += str;
-                    strDlgMessage += "\r\n";
-
-                }
-            }
-
-            // add an empty line strDlgMessage
-            strDlgMessage += "\r\n";
-
-            // add sample messages
-            foreach (var strSmplMessage in listSamplMessages)
-            {
-                strDlgMessage += strSmplMessage;
-                strDlgMessage += "\r\n";
-            }
-
-            // do we need to show dialog box?
-            if (nSwitchSmplNo == 0)
-            {
-                return false;
-            }
-
-            // measure button clicked?
-            if (a_bCheckSetting)
-            {
-                // there are measurable samples but no setting warnings samples
-                if (listMeasurableSamples.Count > 0 && listWithWarningMeasurableSamples.Count == 0)
-                {
-                    // set output measurable samples list
-                    foreach (var pSample in listMeasurableSamples)
-                    {
-                        a_listMeasuableSamples.Add(pSample);
-                    }
-                    return true;
-                }
-
-            }
-            //when there is sample setting error, and setting with no error and no warning samples, the dlg will not be show.??
-
-            //show the result dlg
-            DIALOG_CHECK_PARAM_RESULT dlg = new DIALOG_CHECK_PARAM_RESULT();
-            int nTatolMeasuableSmplNo = listMeasurableSamples.Count;
-            int nWithWarningMeasuableSmplNo = listWithWarningMeasurableSamples.Count;
-
-            // set the dlg parameters
-            dlg.SetCheckOnlyFlag(a_bCheckSetting);
-            dlg.SetMessageBase(strDlgMessage);
-            dlg.SetTatolMeasuableSmplNo(nTatolMeasuableSmplNo);
-            dlg.SetWithWarningMeasuableSmplNo(nWithWarningMeasuableSmplNo);
-
-            //no error not show dlg
-            if (nTatolMeasuableSmplNo == nSwitchSmplNo - nCompletedSmplNo && listMeasurableSamples.Count != 0)
-            {
-                foreach (var pSample in listMeasurableSamples)
-                {
-                    var itr = listWithWarningMeasurableSamples.Find(s => { return s.GetName() == pSample.GetName(); });
-
-
-                    if (itr == null)
-                    {
-                        a_listMeasuableSamples.Add(pSample);
-                    }
-                }
-
-                if (a_listMeasuableSamples.Count == listMeasurableSamples.Count)
-                {
-                    return true;
-                }
-
-            }
-
-
-            //show dlg
-            DialogResult dResult = dlg.ShowDialog();
-            if (!(dResult == System.Windows.Forms.DialogResult.OK))
-            {
-                // do something here
-                return false;
+                DialogResult dialog= frmPre_MeasurementDetection.ShowDialog(); return false;
             }
             else
             {
-                //if warnDo, back the listMeasuableSample
-                if (dlg.GetWarnDo())
-                {
-                    foreach (var pSample in listMeasurableSamples)
-                    {
-                        a_listMeasuableSamples.Add(pSample);
-                    }
-                }
-                else // back with no warn sample
-                {
-                    foreach (var pSample in listMeasurableSamples)
-                    {
-                        var itr = listWithWarningMeasurableSamples.Find(e => { return e.GetName() == pSample.GetName(); });
-                        if (itr == null)
-                        {
-                            a_listMeasuableSamples.Add(pSample);
-                        }
-                    }
-                }
-            }
-            return true;
-        }
-        bool IsMeasureCompletedSmpl(COTSSample a_pSample)
-        {
-            if (a_pSample.GetMsrStatus().GetStatus() != OTSDataType.OTS_MSR_SAMPLE_STATUS.COMPLETED)
-            {
-
-                return false;
-            }
-            return true;
-        }
-
-
-
-
-
-
-
-
-
-
-        string GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE a_nSampleFaultWarn)
-        {
-
-            // check input
-            if (a_nSampleFaultWarn < SAMPLE_FAULT_WARN_CODE.MIN && a_nSampleFaultWarn > SAMPLE_FAULT_WARN_CODE.MAX)
-            {
-                return "";
-            }
-            // error/waring string
-            string strErrorWarn;
-            strErrorWarn = GetResourceByKey(GrpOtherParam, IDS_ERROR_WARNING + (int)a_nSampleFaultWarn);
-            return strErrorWarn;
-        }
-        // get error codes list of a sample
-        void GetSampleErrorCodes(COTSMsrPrjResultData a_pProjMgrFile, COTSSample a_pSample, ref List<SAMPLE_FAULT_WARN_CODE> a_listErrorCodes)
-        {
-
-            const string UNTITLED_FILE_NAME = "Untitled";
-
-            // file has not been saved
-            String strPathName = a_pProjMgrFile.GetPathName();
-
-            // is this a file no saved?
-            strPathName.Trim();
-            if (strPathName == UNTITLED_FILE_NAME || strPathName == "")
-            {
-           
-                a_listErrorCodes.Add(SAMPLE_FAULT_WARN_CODE.FILE_NOT_SAVED);
-            }
-
-
-        }
-
-        // get warning codes list of a sample
-        void GetSampleWarningCodes(COTSMsrPrjResultData a_pProjMgrFile, COTSSample a_pSample, ref List<SAMPLE_FAULT_WARN_CODE> a_listWarningCodes)
-        {
-
-            // get the work stage
-            CSampleHolder pStage = a_pProjMgrFile.GetStageHolder();
-
-            //get hole
-            String sHoleName = a_pSample.GetSampleHoleName();
-
-            //look for the hole Domain
-            CHole pSampleHole = pStage.GetHoleByName(sHoleName);
-            if (pSampleHole == null)
-            {
-
-                return;
-            }
-            if (a_pSample.GetSEMDataMsr() != null)
-            {
-                // compute pixel size
-                double dPixleSize = a_pSample.CalculatePixelSize();
-
-                // get min size
-                COTSImageProcParam pImageProcParam = a_pSample.GetMsrParams().GetImageProcessParam();
-                double dMinSize = pImageProcParam.GetIncAreaRange().GetStart();
-
-                // if pixel size is bigger than 1/2 of the min size,than  can't see  the object clearly on current magnification
-                if (dPixleSize >= dMinSize * 0.5)
+                if (frmPre_MeasurementDetection.SampleList.Count > 0)
                 {
-                    // resolution low
-                    a_listWarningCodes.Add(SAMPLE_FAULT_WARN_CODE.RESOLUTION_LOW);
+                    m_MeasureSampleList = frmPre_MeasurementDetection.SampleList;
+                    frmPre_MeasurementDetection.Dispose();
+                    return true;
                 }
             }
-            if(a_pSample.GetSEMDataMsr().GetTotalFields()==0
-               && a_pSample.GetSEMDataMsr().GetScanFieldSize() == 0
-               && a_pSample.GetSEMDataMsr().GetWorkingDistance() == 0)
-            {
-                // SEM_DATA_ERROR 
-                a_listWarningCodes.Add(SAMPLE_FAULT_WARN_CODE.SEM_DATA_ERROR);
-            }
+            return false;
         }
- 
-
-
-
         //打开工作样品的测量参数文件     
         public bool LoadWorkMeasureFile()
         {
@@ -989,9 +646,6 @@ namespace OTSMeasureApp
             m_MeasureAppFrom.m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
             return true;
         }
-
-
-
         //判断是否允许修改样品名
         public bool CheckSampleNameIsValid(string sNewName)
         {
@@ -1010,10 +664,7 @@ namespace OTSMeasureApp
             semdata.Brightness = bri;
             semdata.Contrast = contra;
             semdata.KV = kv;
-           
         }
-       
-
       public  bool   GetWorkingSampleSEMData(ref double iWDistance, ref double dMagni, ref double bri, ref double contra, ref double kv)
         {
             COTSSample WSample = GetResultData().GetWorkingSample();
@@ -1029,12 +680,6 @@ namespace OTSMeasureApp
             kv = semdata.KV;
             return true;
         }
-
-       
-        
-
-
-
         //检查Samplelist中的sample的checkbox状态
         //当Samplelist中的链表有sample 的checkbox状态是选中状态,则返回TRUE. 说明可以测量
         public bool GetSampleCheckBoxStatus()
@@ -1078,11 +723,6 @@ namespace OTSMeasureApp
             }
             return true;
         }
-
-
-
-       
-
         //获取图像尺寸
         public string GetBSEImageResolutionStr()
         {
@@ -1140,11 +780,6 @@ namespace OTSMeasureApp
             FieldList = WSample.GetMsrStatus().GetCompletedFieldsCenter();
             return true;
         }
-
-
- 
-
-
         /// <summary>
         /// 获取已完成测量的结果文件路径
         /// </summary>
@@ -1154,13 +789,10 @@ namespace OTSMeasureApp
         {
             //测量文件路径
             string proFilePath = GetResultData().GetPathName();
-            //样品列表
             List<COTSSample> sampleList = GetResultData().GetSampleList();
             //获取样品数量
             int sampleCount = sampleList.Count;
-            string mrSuffix = ".rst";
-            int existsCount = 0;
-            //获取测量文件路径
+            string mrSuffix = ".rst";int existsCount = 0;
             if (proFilePath.Equals("Untitled"))
             {
                 return false;
@@ -1177,12 +809,11 @@ namespace OTSMeasureApp
             for (int sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++)
             {
                 int CompleteFieldsCount = sampleList[sampleIndex].GetMsrStatus().GetCompletedFields();
-                //如果样品已测量成功后再加载至报告程序中
+
                 if (CompleteFieldsCount > 0)
                 {
                     string sampleName = sampleList[sampleIndex].GetName();
                     string mrFilePath = mrFolderPath + "\\" + sampleName + "\\" + sampleName + mrSuffix;
-                    //判断文件是否存在
                     if (File.Exists(mrFilePath))
                     {
                         if (mrFilePathList != null)
@@ -1193,20 +824,8 @@ namespace OTSMeasureApp
                     }
                 }
             }
-            if (existsCount > 0)
-            {
-                return true;
-            }
+            if (existsCount > 0){return true;}
             return false;
         }
-
-
-        
-      
     }
-
-   
-
-
-
 }

+ 1 - 0
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSDisplaySampleGrid.cs

@@ -684,6 +684,7 @@ namespace OTSMeasureApp
     class ChangeGridCellValEvent : SourceGrid.Cells.Controllers.ControllerBase
     {
         OTSDisplaySampleGrid m_SampleGrid = null;
+        
         public ChangeGridCellValEvent(OTSDisplaySampleGrid SGrid)
         {
             m_SampleGrid = SGrid;

+ 18 - 0
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -297,6 +297,12 @@
     <Compile Include="1-OTSMeasure\Measure\5-OTSSteelMineral\CSmplMeasureInclutionForSteelMineral.cs" />
     <Compile Include="1-OTSMeasure\Measure\3-MeasureFlow\CBrightnessContrastAdjust.cs" />
     <Compile Include="1-OTSMeasure\Measure\3-MeasureFlow\CSmplPreviewMeasure.cs" />
+    <Compile Include="1-OTSMeasure\Measure\ParamData\frmPre_measurementDetection.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="1-OTSMeasure\Measure\ParamData\frmPre_measurementDetection.Designer.cs">
+      <DependentUpon>frmPre_measurementDetection.cs</DependentUpon>
+    </Compile>
     <Compile Include="1-OTSMeasure\Measure\ParamData\frmReclassifyCondition.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -402,6 +408,12 @@
     <Compile Include="4-OTSSamplespaceGraphicsPanel\frmInitializeImageboundary.Designer.cs">
       <DependentUpon>frmInitializeImageboundary.cs</DependentUpon>
     </Compile>
+    <Compile Include="4-OTSSamplespaceGraphicsPanel\frmInitializeLengthAndWidthRectangle.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="4-OTSSamplespaceGraphicsPanel\frmInitializeLengthAndWidthRectangle.Designer.cs">
+      <DependentUpon>frmInitializeLengthAndWidthRectangle.cs</DependentUpon>
+    </Compile>
     <Compile Include="4-OTSSamplespaceGraphicsPanel\frmInitializeTwoPointRectangle.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -668,6 +680,9 @@
     <EmbeddedResource Include="1-OTSMeasure\Measure\ParamData\DIALOG_CHECK_PARAM_RESULT.resx">
       <DependentUpon>DIALOG_CHECK_PARAM_RESULT.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="1-OTSMeasure\Measure\ParamData\frmPre_measurementDetection.resx">
+      <DependentUpon>frmPre_measurementDetection.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="1-OTSMeasure\Measure\ParamData\frmReclassifyCondition.resx">
       <DependentUpon>frmReclassifyCondition.cs</DependentUpon>
     </EmbeddedResource>
@@ -686,6 +701,9 @@
     <EmbeddedResource Include="4-OTSSamplespaceGraphicsPanel\frmInitializeImageboundary.resx">
       <DependentUpon>frmInitializeImageboundary.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="4-OTSSamplespaceGraphicsPanel\frmInitializeLengthAndWidthRectangle.resx">
+      <DependentUpon>frmInitializeLengthAndWidthRectangle.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="4-OTSSamplespaceGraphicsPanel\frmInitializeStartInput.resx">
       <DependentUpon>frmInitializeStartInput.cs</DependentUpon>
     </EmbeddedResource>

+ 20 - 1
OTSIncAMeasureApp/OTSIncAMeasureAppForm.Designer.cs

@@ -74,6 +74,7 @@
             this.rbRingShape = new System.Windows.Forms.RibbonButton();
             this.ribRectangle = new System.Windows.Forms.RibbonButton();
             this.ribbonButtonTwoPoint = new System.Windows.Forms.RibbonButton();
+            this.ribbonButtonLengthAndWidth = new System.Windows.Forms.RibbonButton();
             this.ribPolygon = new System.Windows.Forms.RibbonButton();
             this.ribbonSeparator4 = new System.Windows.Forms.RibbonSeparator();
             this.ribonBtnShot = new System.Windows.Forms.RibbonButton();
@@ -508,6 +509,7 @@
             this.ribRectangle.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Down;
             this.ribRectangle.DropDownArrowSize = new System.Drawing.Size(5, 3);
             this.ribRectangle.DropDownItems.Add(this.ribbonButtonTwoPoint);
+            this.ribRectangle.DropDownItems.Add(this.ribbonButtonLengthAndWidth);
             this.ribRectangle.Image = global::OTSMeasureApp.Properties.Resources.矩形32;
             this.ribRectangle.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribRectangle.SmallImage")));
             this.ribRectangle.Style = System.Windows.Forms.RibbonButtonStyle.SplitDropDown;
@@ -527,12 +529,28 @@
             this.ribbonButtonTwoPoint.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonButtonTwoPoint.SmallImage")));
             this.ribbonButtonTwoPoint.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
             this.ribbonButtonTwoPoint.Tag = null;
-            this.ribbonButtonTwoPoint.Text = "两点法";
+            this.ribbonButtonTwoPoint.Text = "取点定界法";
             this.ribbonButtonTwoPoint.ToolTip = null;
             this.ribbonButtonTwoPoint.ToolTipImage = null;
             this.ribbonButtonTwoPoint.ToolTipTitle = null;
             this.ribbonButtonTwoPoint.Click += new System.EventHandler(this.ribbonButton4_Click);
             // 
+            // ribbonButtonLengthAndWidth
+            // 
+            this.ribbonButtonLengthAndWidth.AltKey = null;
+            this.ribbonButtonLengthAndWidth.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbonButtonLengthAndWidth.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonButtonLengthAndWidth.Enabled = false;
+            this.ribbonButtonLengthAndWidth.Image = ((System.Drawing.Image)(resources.GetObject("ribbonButtonLengthAndWidth.Image")));
+            this.ribbonButtonLengthAndWidth.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonButtonLengthAndWidth.SmallImage")));
+            this.ribbonButtonLengthAndWidth.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonButtonLengthAndWidth.Tag = null;
+            this.ribbonButtonLengthAndWidth.Text = "长宽法";
+            this.ribbonButtonLengthAndWidth.ToolTip = null;
+            this.ribbonButtonLengthAndWidth.ToolTipImage = null;
+            this.ribbonButtonLengthAndWidth.ToolTipTitle = null;
+            this.ribbonButtonLengthAndWidth.Click += new System.EventHandler(this.ribbonButtonLengthAndWidth_Click);
+            // 
             // ribPolygon
             // 
             this.ribPolygon.AltKey = null;
@@ -1090,6 +1108,7 @@
         public System.Windows.Forms.RibbonButton menuSysMgrApp;
         private System.Windows.Forms.RibbonButton rb_Reclassify;
         private System.Windows.Forms.RibbonButton ribbonButtonTwoPoint;
+        private System.Windows.Forms.RibbonButton ribbonButtonLengthAndWidth;
         private System.Windows.Forms.RibbonSeparator ribbonSeparator4;
         public System.Windows.Forms.RibbonButton ribonBtnShot;
     }

+ 8 - 6
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -1122,12 +1122,8 @@ namespace OTSMeasureApp
 
         private void rbCheckParam_Click(object sender, EventArgs e)
         {
-            //检查样品测量参数
-            if (m_ProjParam.CheckSampleParam(true))
-            {
-                string message = table["message7"].ToString();
-                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-            }
+            frmPre_measurementDetection frmPre_MeasurementDetection = new frmPre_measurementDetection(m_ProjParam);
+            frmPre_MeasurementDetection.ShowDialog();
         }
 
         private void ribReset_Click(object sender, EventArgs e)
@@ -1839,5 +1835,11 @@ namespace OTSMeasureApp
         {
             m_SamplepaceWindow.DrawCircleByFixedpoint();
         }
+
+        private void ribbonButtonLengthAndWidth_Click(object sender, EventArgs e)
+        {
+            
+            //m_SamplepaceWindow.DrawRectangleByLengthAndWidth();
+        }
     }
 }

+ 14 - 2
OTSIncAMeasureApp/OTSIncAMeasureAppForm.resx

@@ -211,13 +211,25 @@
   <data name="ribbonButtonTwoPoint.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        vAAADrwBlbxySQAAABpJREFUWEftwQEBAAAAgiD/r25IQAEAAADvBhAgAAHBYCyfAAAAAElFTkSuQmCC
+        wQAADsEBuJFr7QAAABpJREFUWEftwQEBAAAAgiD/r25IQAEAAADvBhAgAAHBYCyfAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonButtonTwoPoint.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        vAAADrwBlbxySQAAABJJREFUOE9jYBgFo2AUjAIIAAAEEAABTLtGVQAAAABJRU5ErkJggg==
+        wQAADsEBuJFr7QAAABJJREFUOE9jYBgFo2AUjAIIAAAEEAABTLtGVQAAAABJRU5ErkJggg==
+</value>
+  </data>
+  <data name="ribbonButtonLengthAndWidth.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAEAAADvBhAgAAHBYCyfAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonButtonLengthAndWidth.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wAAADsABataJCQAAABJJREFUOE9jYBgFo2AUjAIIAAAEEAABTLtGVQAAAABJRU5ErkJggg==
 </value>
   </data>
   <data name="ribRectangle.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

+ 11 - 2
OTSPartA_STDEditor/UI/STDRuleslist.cs

@@ -70,11 +70,13 @@ namespace OTSPartA_STDEditor
                 base.OnValueChanged(sender, e);
             }
         }
+        private TreeNode editingNode = null;
         private void Grid_Minerals_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
         {
             if (e.KeyCode == Keys.Delete)
             {
-                ToolStripMenuItem_Del_Click(null, null);
+                if (editingNode != null) return;
+                else ToolStripMenuItem_Del_Click(null, null);
             }
         }
 
@@ -591,11 +593,13 @@ namespace OTSPartA_STDEditor
                 if(e.Label == "")
                 {
                     e.CancelEdit=true;
+                    editingNode = null;
                     return;
                 }
                 if (e.Label == "Default")
                 {
                     e.CancelEdit = true;
+                    editingNode = null;
                     return;
                 }
                 if (e.Label != null && e.Label != "")
@@ -604,6 +608,7 @@ namespace OTSPartA_STDEditor
                     {
                         MessageBox.Show("Group names cannot be duplicated!", "Tip");
                         e.CancelEdit = true;
+                        editingNode = null;
                         return;
                     }
                     else
@@ -615,6 +620,7 @@ namespace OTSPartA_STDEditor
                         m_MainForm._sTDEditor.GroupIdDictionaryFromId.Add(Group.id, Group.name);
                         m_MainForm._sTDEditor.GroupIdDictionaryFromName.Add(GroupViewDic[Group.id].name, Group.id);
                         m_MainForm.m_Attributes.AddSTDGroupsToAttribute();
+                        editingNode = null;
                     }
                 }
             }
@@ -623,6 +629,7 @@ namespace OTSPartA_STDEditor
                 if (e.Label == "") 
                 {
                     e.CancelEdit = true;
+                    editingNode = null;
                     return;
                 }
                 if (e.Label != null && e.Label != "")
@@ -640,6 +647,7 @@ namespace OTSPartA_STDEditor
                             }
                         }
                     }
+                    editingNode = null;
                 }
             }
         }
@@ -773,8 +781,9 @@ namespace OTSPartA_STDEditor
         }
         private void treeView_G_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e)
         {
-            if (!RenFlag) e.CancelEdit = true;
+            if (!RenFlag) { e.CancelEdit = true; editingNode = null; }
             RenFlag = false;
+            editingNode = e.Node;
         }
     }
 }

+ 7 - 2
OTSSysMgrApp/OTSSystemManagerForms.cs

@@ -15,10 +15,9 @@ namespace OTSSysMgrApp
         [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)2000)]
         public char[] logMessage;
     };
+
     public partial class OTSSystemManagerForms : Form
     {
-    
-
         private PostLogMsg m_LogMsg;
         public const int MsgID = 0x0464;
         public const int LogMsgID = 0x0465;
@@ -376,6 +375,9 @@ namespace OTSSysMgrApp
 
 
 
+
+
+
         private bool ChangeSysType()
         {
             SwitchSystemValidation switchSystemValidation = new SwitchSystemValidation();
@@ -665,6 +667,7 @@ namespace OTSSysMgrApp
             if (radioButton_IncA.Checked)
             {
                 Type = "IncA";
+                bool result2 = XMLOperationClass.WriteDoc(path, "GenParam", "EngineType", "0:InclustionEngine");
             }
             else if (radioButton_CleannessA.Checked)
             {
@@ -676,11 +679,13 @@ namespace OTSSysMgrApp
                 {
                     Type = "BatteryCleannessA";
                 }
+                bool result2 = XMLOperationClass.WriteDoc(path, "GenParam", "EngineType", "1:ExpressionParse");
             }
 
             else if (radioButton_SteelMineral.Checked)
             {
                 Type = "SteelMineral";
+                bool result2 = XMLOperationClass.WriteDoc(path, "GenParam", "EngineType", "3:SpectrumMatch");
             }
 
             bool result = XMLOperationClass.WriteSysType(path, "SysType", Type);

+ 29 - 0
OTSSysMgrApp/XMLOperationClass.cs

@@ -355,5 +355,34 @@ namespace OTSSysMgrApp
             }
             return true;
         }
+
+        public static bool WriteDoc(string filePath, string regName, string attributeName, string newValue)
+        {
+            try
+            {
+                XmlDocument xmlDoc = new XmlDocument();
+                xmlDoc.Load(filePath);
+                XmlNodeList nodeList = xmlDoc.GetElementsByTagName("Member");
+
+                foreach (XmlNode node in nodeList)
+                {
+                    XmlElement element = (XmlElement)node;
+                    if (element.GetAttribute("RegName") == regName)
+                    {
+                        if (element.HasAttribute(attributeName))
+                        {
+                            element.SetAttribute(attributeName, newValue);
+                            xmlDoc.Save(filePath);
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+            catch /*(Exception ex)*/
+            {
+                return false;
+            }
+        }
     }
 }