Browse Source

add missing files

gsp 1 year ago
parent
commit
14a68c7e96

+ 282 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/MeasureCheckResultInfoWindow.Designer.cs

@@ -0,0 +1,282 @@
+namespace OTSMeasureApp
+{
+    partial class MeasureCheckResultInfoWindow
+    {
+        /// <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.components = new System.ComponentModel.Container();
+            this.lblBeginTime = new System.Windows.Forms.Label();
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.lblMeasureTime = new System.Windows.Forms.Label();
+            this.lblParticleCount = new System.Windows.Forms.Label();
+            this.lblSingleCount = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.lblMeasureCount = new System.Windows.Forms.Label();
+            this.lblMeasureState = new System.Windows.Forms.Label();
+            this.label7 = new System.Windows.Forms.Label();
+            this.lblEndTime = new System.Windows.Forms.Label();
+            this.SuspendLayout();
+            // 
+            // lblBeginTime
+            // 
+            this.lblBeginTime.AutoSize = true;
+            this.lblBeginTime.BackColor = System.Drawing.Color.Transparent;
+            this.lblBeginTime.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblBeginTime.ForeColor = System.Drawing.Color.Black;
+            this.lblBeginTime.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblBeginTime.Location = new System.Drawing.Point(140, 64);
+            this.lblBeginTime.Name = "lblBeginTime";
+            this.lblBeginTime.Size = new System.Drawing.Size(0, 18);
+            this.lblBeginTime.TabIndex = 25;
+            // 
+            // timer1
+            // 
+            this.timer1.Interval = 1000;
+            // 
+            // lblMeasureTime
+            // 
+            this.lblMeasureTime.AutoSize = true;
+            this.lblMeasureTime.BackColor = System.Drawing.Color.Transparent;
+            this.lblMeasureTime.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblMeasureTime.ForeColor = System.Drawing.Color.Black;
+            this.lblMeasureTime.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblMeasureTime.Location = new System.Drawing.Point(140, 184);
+            this.lblMeasureTime.Name = "lblMeasureTime";
+            this.lblMeasureTime.Size = new System.Drawing.Size(0, 18);
+            this.lblMeasureTime.TabIndex = 24;
+            // 
+            // lblParticleCount
+            // 
+            this.lblParticleCount.AutoSize = true;
+            this.lblParticleCount.BackColor = System.Drawing.Color.Transparent;
+            this.lblParticleCount.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblParticleCount.ForeColor = System.Drawing.Color.Black;
+            this.lblParticleCount.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblParticleCount.Location = new System.Drawing.Point(140, 153);
+            this.lblParticleCount.Name = "lblParticleCount";
+            this.lblParticleCount.Size = new System.Drawing.Size(0, 18);
+            this.lblParticleCount.TabIndex = 23;
+            // 
+            // lblSingleCount
+            // 
+            this.lblSingleCount.AutoSize = true;
+            this.lblSingleCount.BackColor = System.Drawing.Color.Transparent;
+            this.lblSingleCount.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblSingleCount.ForeColor = System.Drawing.Color.Black;
+            this.lblSingleCount.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblSingleCount.Location = new System.Drawing.Point(140, 121);
+            this.lblSingleCount.Name = "lblSingleCount";
+            this.lblSingleCount.Size = new System.Drawing.Size(0, 18);
+            this.lblSingleCount.TabIndex = 22;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.BackColor = System.Drawing.Color.Transparent;
+            this.label6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label6.ForeColor = System.Drawing.Color.Black;
+            this.label6.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label6.Location = new System.Drawing.Point(12, 121);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(98, 18);
+            this.label6.TabIndex = 21;
+            this.label6.Text = "帧    数:";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.BackColor = System.Drawing.Color.Transparent;
+            this.label5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.ForeColor = System.Drawing.Color.Black;
+            this.label5.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label5.Location = new System.Drawing.Point(12, 151);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(98, 18);
+            this.label5.TabIndex = 20;
+            this.label5.Text = "颗 粒 数:";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.BackColor = System.Drawing.Color.Transparent;
+            this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label4.ForeColor = System.Drawing.Color.Black;
+            this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label4.Location = new System.Drawing.Point(12, 61);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(98, 18);
+            this.label4.TabIndex = 19;
+            this.label4.Text = "开始时间:";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.BackColor = System.Drawing.Color.Transparent;
+            this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.ForeColor = System.Drawing.Color.Black;
+            this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label3.Location = new System.Drawing.Point(12, 181);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(98, 18);
+            this.label3.TabIndex = 18;
+            this.label3.Text = "测量时间:";
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.BackColor = System.Drawing.Color.Transparent;
+            this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.ForeColor = System.Drawing.Color.Black;
+            this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label1.Location = new System.Drawing.Point(12, 91);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(98, 18);
+            this.label1.TabIndex = 18;
+            this.label1.Text = "测 量 数:";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.BackColor = System.Drawing.Color.Transparent;
+            this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.ForeColor = System.Drawing.Color.Black;
+            this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label2.Location = new System.Drawing.Point(12, 31);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(98, 18);
+            this.label2.TabIndex = 18;
+            this.label2.Text = "测量状态:";
+            // 
+            // lblMeasureCount
+            // 
+            this.lblMeasureCount.AutoSize = true;
+            this.lblMeasureCount.BackColor = System.Drawing.Color.Transparent;
+            this.lblMeasureCount.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblMeasureCount.ForeColor = System.Drawing.Color.Black;
+            this.lblMeasureCount.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblMeasureCount.Location = new System.Drawing.Point(140, 93);
+            this.lblMeasureCount.Name = "lblMeasureCount";
+            this.lblMeasureCount.Size = new System.Drawing.Size(0, 18);
+            this.lblMeasureCount.TabIndex = 22;
+            // 
+            // lblMeasureState
+            // 
+            this.lblMeasureState.AutoSize = true;
+            this.lblMeasureState.BackColor = System.Drawing.Color.Transparent;
+            this.lblMeasureState.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblMeasureState.ForeColor = System.Drawing.Color.Black;
+            this.lblMeasureState.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblMeasureState.Location = new System.Drawing.Point(140, 31);
+            this.lblMeasureState.Name = "lblMeasureState";
+            this.lblMeasureState.Size = new System.Drawing.Size(0, 18);
+            this.lblMeasureState.TabIndex = 22;
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.BackColor = System.Drawing.Color.Transparent;
+            this.label7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label7.ForeColor = System.Drawing.Color.Black;
+            this.label7.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.label7.Location = new System.Drawing.Point(12, 211);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(98, 18);
+            this.label7.TabIndex = 18;
+            this.label7.Text = "结束时间:";
+            // 
+            // lblEndTime
+            // 
+            this.lblEndTime.AutoSize = true;
+            this.lblEndTime.BackColor = System.Drawing.Color.Transparent;
+            this.lblEndTime.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblEndTime.ForeColor = System.Drawing.Color.Black;
+            this.lblEndTime.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.lblEndTime.Location = new System.Drawing.Point(140, 213);
+            this.lblEndTime.Name = "lblEndTime";
+            this.lblEndTime.Size = new System.Drawing.Size(0, 18);
+            this.lblEndTime.TabIndex = 24;
+            // 
+            // MeasureCheckReportInfoWindow
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+            this.ClientSize = new System.Drawing.Size(384, 271);
+            this.Controls.Add(this.lblBeginTime);
+            this.Controls.Add(this.lblEndTime);
+            this.Controls.Add(this.lblMeasureTime);
+            this.Controls.Add(this.lblParticleCount);
+            this.Controls.Add(this.lblMeasureState);
+            this.Controls.Add(this.lblMeasureCount);
+            this.Controls.Add(this.lblSingleCount);
+            this.Controls.Add(this.label6);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.label7);
+            this.Controls.Add(this.label3);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+            this.MaximizeBox = false;
+            this.MinimizeBox = false;
+            this.Name = "MeasureCheckReportInfoWindow";
+            this.ShowIcon = false;
+            this.ShowInTaskbar = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "测量结果";
+            this.TopMost = true;
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MeasureCheckReportInfoWindow_FormClosing);
+            this.Load += new System.EventHandler(this.MeasureCheckReportInfoWindow_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label lblBeginTime;
+        private System.Windows.Forms.Timer timer1;
+        private System.Windows.Forms.Label lblMeasureTime;
+        private System.Windows.Forms.Label lblParticleCount;
+        private System.Windows.Forms.Label lblSingleCount;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label lblMeasureCount;
+        private System.Windows.Forms.Label lblMeasureState;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.Label lblEndTime;
+    }
+}

+ 105 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/MeasureCheckResultInfoWindow.cs

@@ -0,0 +1,105 @@
+using System;
+using System.Collections;
+using System.Windows.Forms;
+
+namespace OTSMeasureApp
+{
+    public partial class MeasureCheckResultInfoWindow : Form
+    {
+        public string endTime = "";
+        //国际化
+        OTSCommon.Language lan;
+        Hashtable table;
+        public MeasureCheckResultInfoWindow()
+        {
+            InitializeComponent();
+            CheckForIllegalCrossThreadCalls = false;
+            //国际化
+            lan = new OTSCommon.Language(this);
+            table = lan.GetNameTable(this.Name);
+        }
+        /// <summary>
+        /// 测量状态
+        /// </summary>
+        /// <param name="currentMeasureCount"></param>
+        /// <param name="beginTime"></param>
+        /// <param name="MeasureTime"></param>
+        public void SetMeasureStateInfo(string MeasureState,int completeSampleCount, int completeFieldCount, int particleCount, string beginTime, TimeSpan MsrUsedTime, string endTime,ref string measureTimes)
+        {
+            //设置测量状态
+            lblMeasureState.Text = MeasureState;
+            //设置开始时间
+            lblBeginTime.Text = beginTime.ToString();
+            //设置结束时间
+            lblEndTime.Text = endTime.ToString();
+            //测量数
+            lblMeasureCount.Text = completeSampleCount.ToString();
+            //设置当前帧图数
+            lblSingleCount.Text = completeFieldCount.ToString();
+            //设置颗粒数量
+            lblParticleCount.Text = particleCount.ToString();
+            //开始与截至时间 相差时间
+            //TimeSpan tsSub = MsrUsedTime;   
+            TimeSpan tsSub = TimeSpans(Convert.ToDateTime(beginTime), Convert.ToDateTime(endTime)); //为差值显示例准确,于此计算但数值不一定为真实值并且与domeasure中差值会出现不一致
+            //设置测量时间
+            string measureTime = string.Empty;
+            if (tsSub.Days > 0)
+            {
+                string str= table["str1"].ToString();
+                measureTime += tsSub.Days + str;
+            }
+            if (tsSub.Hours > 0)
+            {
+                string str = table["str2"].ToString();
+                measureTime += tsSub.Hours + str;
+            }
+            if (tsSub.Minutes > 0)
+            {
+                string str = table["str3"].ToString();
+                measureTime += tsSub.Minutes + str;
+            }
+            if (tsSub.Seconds > 0)
+            {
+                string str = table["str4"].ToString();
+                measureTime += tsSub.Seconds + str;
+            }
+            measureTimes = measureTime;
+            //默认值
+            if (measureTime.Equals(""))
+            {
+                string str = table["str5"].ToString();
+                lblMeasureTime.Text = str;
+            }
+            else
+            { 
+                lblMeasureTime.Text = measureTime;
+            }
+        }
+
+        public TimeSpan TimeSpans(DateTime beginTime ,DateTime endTime)
+        {
+            //c#对时间差,有一个专门的类进行封装,TimeSpan.cs;
+            System.DateTime pauseT = beginTime;
+            System.DateTime resumeT = endTime;
+            System.TimeSpan ts1 = new System.TimeSpan(pauseT.Ticks);
+            System.TimeSpan ts2 = new System.TimeSpan(resumeT.Ticks);
+            System.TimeSpan tsSub = ts1.Subtract(ts2).Duration();
+            return tsSub;
+        }
+
+        private void MeasureCheckReportInfoWindow_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            this.Close();
+        }
+        
+        public void SetEndTime(string endTime)
+        {
+            lblEndTime.Text = endTime;
+        }
+
+        private void MeasureCheckReportInfoWindow_Load(object sender, EventArgs e)
+        {
+
+        }
+    }
+}

+ 123 - 0
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/MeasureCheckResultInfoWindow.resx

@@ -0,0 +1,123 @@
+<?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>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>

+ 217 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CFieldPositionHelper.cs

@@ -0,0 +1,217 @@
+using OTSCLRINTERFACE;
+using OTSDataType;
+using OTSMeasureApp._0_OTSModel.OTSDataType;
+using System.Collections.Generic;
+using System.Drawing;
+using static OTSDataType.otsdataconst;
+
+
+namespace OTSModelSharp
+{//provide fieldpos calculate service
+    public enum SORTING_DIRECTION
+    {
+        LEFT = 1,
+        DOWN = 2,
+        RIGHT = 3,
+        UP = 4,
+        CENTER=5
+    }
+    public class CFieldPositionHelper
+    {
+       
+
+
+        // measure area
+        CDomain m_pMeasureArea;
+        // image scan parameter
+        COTSImgScanPrm m_poImageScanParam;
+
+        const int RESOLUTION_ID_FIRST_TIE = 0;
+
+        // field centre points list
+        List<System.Drawing.Point> m_listFieldCentrePoints;
+
+        // SEM data (measurement)
+        CSEMDataMsr m_poSEMDataMsr;
+
+        int overLap;
+
+        // unmeasured field centre points list
+        List<System.Drawing.Point> m_listUnmeasuredFieldCentrePoints;
+        CFieldMgrClr fieldmgrclr;
+        public bool Init(CDomain a_pMeasureArea, COTSImgScanPrm a_poImageScanParam, int overlap, CSEMDataMsr a_poSEMDataMsr, List<System.Drawing.PointF> a_listMeasuredFieldCentrePoints)
+        {
+            // assign class member
+            m_pMeasureArea = a_pMeasureArea;
+            m_poImageScanParam = a_poImageScanParam;
+            m_poSEMDataMsr = a_poSEMDataMsr;
+            overLap = overlap;
+
+            if (m_listFieldCentrePoints == null)
+            {
+                m_listFieldCentrePoints = new List<System.Drawing.Point>();
+            }
+            if (m_listUnmeasuredFieldCentrePoints == null)
+            {
+                m_listUnmeasuredFieldCentrePoints = new List<System.Drawing.Point>();
+            }
+
+            var scanfieldsize = m_poSEMDataMsr.GetScanFieldSize();
+
+            OTS_IMAGE_RESULOTION_OPTIONS nImageSizeId = m_poImageScanParam.GetImageResulotion();
+            long nResulotionId = RESOLUTION_ID_FIRST_TIE + (long)nImageSizeId;
+
+            fieldmgrclr = new CFieldMgrClr(scanfieldsize, RESOLUTION_VALUE[nResulotionId]);
+            CDomain domainclr = new CDomain(a_pMeasureArea.GetShape(), a_pMeasureArea.GetRectDomain());
+            domainclr.SetPolygonPoint(a_pMeasureArea.GetPolygonPoint());
+
+
+
+            fieldmgrclr.Init(domainclr.GetClrDomainObj(), (int)m_poImageScanParam.GetFieldStartMode());
+            fieldmgrclr.SetOverlap(overlap);
+
+            List<System.Drawing.Point> fieldpoints = new List<System.Drawing.Point>();
+            for (int i = 0; i < a_listMeasuredFieldCentrePoints.Count; i++)
+            {
+                var p = a_listMeasuredFieldCentrePoints[i];
+                fieldpoints.Add(new System.Drawing.Point((int)p.X, (int)p.Y));
+            }
+            var sortedlistUnmeasuredFieldCentrePoints = fieldmgrclr.GetUnmeasuredFieldCentrePoints(fieldpoints);
+            for (int i = 0; i < sortedlistUnmeasuredFieldCentrePoints.Count; i++)
+            {
+                var p = sortedlistUnmeasuredFieldCentrePoints[i];
+                m_listUnmeasuredFieldCentrePoints.Add(p);
+            }
+
+            m_listFieldCentrePoints = fieldmgrclr.GetFieldCentrePoints();
+
+            return true;
+        }
+
+
+
+
+
+
+
+        // field centre points list
+        public List<System.Drawing.Point> GetFieldCentrePoints()
+        {
+            return m_listFieldCentrePoints;
+        }
+
+        // field centre points list
+        public bool GetOTSRectByIndex(int a_nIndex, ref COTSRect a_rectField)
+        {
+            // check input
+            if (a_nIndex < 0 || a_nIndex > (int)m_listFieldCentrePoints.Count)
+            {
+
+                return false;
+            }
+
+            // get image size
+            OTS_IMAGE_RESULOTION_OPTIONS nImageSizeId = m_poImageScanParam.GetImageResulotion();
+            int nResulotionId = RESOLUTION_ID_FIRST_TIE + (int)nImageSizeId;
+            System.Drawing.Size sizePixelImage = RESOLUTION_VALUE[nResulotionId];
+            // scan field size (x, y)
+            System.Drawing.Size sizeImage = new System.Drawing.Size();
+
+            sizeImage.Width = fieldmgrclr.GetEffectiveFieldWidth();
+
+            sizeImage.Height = fieldmgrclr.GetEffectiveFieldHeight();
+            // get left top
+            System.Drawing.Point ptcenter = m_listFieldCentrePoints[a_nIndex];
+            Point ptLt = new Point(ptcenter.X - sizeImage.Width / 2, ptcenter.Y + sizeImage.Height / 2);
+            Point ptRb=new Point(ptcenter.X + sizeImage.Width / 2, ptcenter.Y - sizeImage.Height / 2);
+            // get field rectangle
+            a_rectField = new COTSRect(ptLt, ptRb);
+
+            return true;
+        }
+
+
+
+        // unmeasured field centre points list
+        public List<System.Drawing.Point> GetUnmeasuredFieldCentrePoints()
+        {
+            return m_listUnmeasuredFieldCentrePoints;
+        }
+
+        public void CalculateBorderParticleBias(List<COTSField> previousFields, COTSField currentfld)
+        {
+            List<Point> allFldPoints = new List<Point>();
+            Dictionary<Point, COTSField> allflds = new Dictionary<Point, COTSField>();
+            foreach (var f in previousFields)
+            {
+                PointF p = f.GetOTSPosition();
+                Point p1 = new Point((int)p.X, (int)p.Y);
+                allFldPoints.Add(p1);
+                allflds.Add(p1, f);
+            }
+            PointF curPos = currentfld.GetOTSPosition();
+            Point curFld = new Point((int)curPos.X, (int)curPos.Y);
+            Point neighbor = new Point();
+            if (fieldmgrclr.FindNeighborField(allFldPoints, curFld, ref neighbor, (int)SORTING_DIRECTION.LEFT))
+            {
+                //if (allflds[neighbor].GetMeasureSequence() < currentfld.GetMeasureSequence())
+                //{
+                //    currentfld.SetLeftBorderParticlesBiasDefine(false);
+                    currentfld.leftField = allflds[neighbor];
+                //}
+
+            }
+            if (fieldmgrclr.FindNeighborField(allFldPoints, curFld, ref neighbor, (int)SORTING_DIRECTION.RIGHT))
+            {
+                //if (allflds[neighbor].GetMeasureSequence() < currentfld.GetMeasureSequence())
+                //{
+                    //currentfld.SetRightBorderParticlesBiasDefine(false);
+                    currentfld.rightField = allflds[neighbor];
+                //}
+            }
+            if (fieldmgrclr.FindNeighborField(allFldPoints, curFld, ref neighbor, (int)SORTING_DIRECTION.UP))
+            {
+                //if (allflds[neighbor].GetMeasureSequence() < currentfld.GetMeasureSequence())
+                //{
+                //    currentfld.SetUpBorderParticlesBiasDefine(false);
+                    currentfld.upField = allflds[neighbor];
+                //}
+            }
+            if (fieldmgrclr.FindNeighborField(allFldPoints, curFld, ref neighbor, (int)SORTING_DIRECTION.DOWN))
+            {
+                //if (allflds[neighbor].GetMeasureSequence() < currentfld.GetMeasureSequence())
+                //{
+                //    currentfld.SetDownBorderParticlesBiasDefine(false);
+                    currentfld.downField = allflds[neighbor];
+                //}
+            }
+
+        }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    }
+}