Quellcode durchsuchen

add missing files

gsp vor 1 Monat
Ursprung
Commit
33a85753ab

+ 100 - 0
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CBrightnessContrastRegulateParam.cs

@@ -0,0 +1,100 @@
+using OTSDataType;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace OTSMeasureApp._0_OTSModel.OTSDataType
+{
+    public enum AutoRegulateType
+    {
+        EveryPeriod = 0,
+        EverySample = 1
+    }
+
+    internal class CBrightnessContrastRegulateParam:ISlo
+    {
+        public CBrightnessContrastRegulateParam()
+        {
+            brightphaseGrayvalue = 0;
+            darkphaseGrayvalue = 0;
+        }
+
+       
+        public Point stdMaterialOTSPos = new Point();
+       public int brightphaseGrayvalue;
+        public string brightphaseelement = "";  
+
+        public int darkphaseGrayvalue;
+        public string darkphaseelement = "";
+        public int mag = 100; //放大倍数
+        public double initialBrightness;
+        public double initialContrast;
+        public int period = 60;//minutes to run the regulation
+        public AutoRegulateType autoRegulateType = AutoRegulateType.EveryPeriod; //自动调节类型
+        public bool toRun = false;
+        public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+            xInt xbrphasevalue  = new xInt();
+            xInt xdarkphasevalue = new xInt();
+            xInt xmag= new xInt();
+            xString xbrphaseelement = new xString();
+            xString xdarkphaseelement = new xString();
+            xPoint xStart = new xPoint();
+            xBool xtorun = new xBool();
+            xDouble xinitialBrightness = new xDouble(this.initialBrightness);
+            xDouble xinitialContrast = new xDouble(this.initialContrast);
+            xInt xPeriod = new xInt(this.period);
+            xString xAutoRegulateType = new xString(this.autoRegulateType.ToString());
+            Slo slo = new Slo();
+            slo.Register("ToRun", xtorun);
+            slo.Register("BrightPhaseElement", xbrphaseelement);
+            slo.Register("BrightPhaseValue", xbrphasevalue);
+            slo.Register("DarkPhaseElement", xdarkphaseelement);
+            slo.Register("DarkPhaseValue", xdarkphasevalue);
+            slo.Register("mag", xmag);
+            slo.Register("InitialBrightness", xinitialBrightness);
+            slo.Register("InitialContrast", xinitialContrast); 
+            slo.Register("StdMaterialOTSPos", xStart);
+            slo.Register("Period", xPeriod);
+            slo.Register("AutoRegulateType", xAutoRegulateType);    
+
+            if (isStoring)
+            {
+                xStart.AssignValue(stdMaterialOTSPos);
+                xbrphaseelement.AssignValue(brightphaseelement);
+                xbrphasevalue.AssignValue(brightphaseGrayvalue);
+                xdarkphaseelement.AssignValue(darkphaseelement);
+                xdarkphasevalue.AssignValue(darkphaseGrayvalue);
+                xmag.AssignValue(mag);
+                xtorun.AssignValue(toRun);
+                xinitialBrightness.AssignValue(initialBrightness);
+                xinitialContrast.AssignValue(initialContrast);
+                xPeriod.AssignValue(period);
+                xAutoRegulateType.AssignValue(autoRegulateType.ToString());
+
+
+                slo.Serialize(true, classDoc, rootNode);
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+                stdMaterialOTSPos = xStart.value();
+                brightphaseelement = xbrphaseelement.value();
+                brightphaseGrayvalue = xbrphasevalue.value();
+                darkphaseelement = xdarkphaseelement.value();
+                darkphaseGrayvalue = xdarkphasevalue.value();
+                mag = xmag.value();
+                toRun = xtorun.value();
+                initialBrightness = xinitialBrightness.value();
+                initialContrast = xinitialContrast.value();
+                period = xPeriod.value();
+                autoRegulateType = (AutoRegulateType)Enum.Parse(typeof(AutoRegulateType), xAutoRegulateType.value(), true); 
+
+            }
+        }
+    }
+}

+ 145 - 0
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSEMFieldData.cs

@@ -0,0 +1,145 @@
+
+using System.Xml;
+
+namespace OTSDataType
+{
+   public class CSEMFieldData:ISlo
+    {
+        const double MAGNIFICATION_MIN = 20.0;
+        private int m_nScanFieldWidth;
+        private int m_nScanFieldHeight;
+        private int m_nScanFieldSize100;
+        private double m_dWorkingDistance;
+        private int m_nTotalFields;
+        private int m_nScanFieldHeight100;
+        private double m_magnification;
+
+        private double m_KV=0;
+        private double m_Brightness=0;
+        private double m_Contrast = 0;
+
+        public double KV { get => m_KV; set => m_KV = value; }
+        public double Brightness { get => m_Brightness; set => m_Brightness = value; }
+        public double Contrast { get => m_Contrast; set => m_Contrast = value; }
+
+        public CSEMFieldData()
+	{
+		// initialization
+		Init();
+    }
+        void Init()
+        {
+            m_nScanFieldWidth = 0;
+            m_nScanFieldSize100 = 1142;
+            m_dWorkingDistance = 0;
+            m_nTotalFields = 0;
+            m_magnification = 0;
+        }
+
+     public    CSEMFieldData ( CSEMFieldData a_oSource)
+	{
+
+	
+		// copy data over
+		Duplicate(a_oSource);
+    }
+        void Duplicate( CSEMFieldData a_oSource)
+	{
+		
+
+        // copy data over
+        m_nScanFieldWidth = a_oSource.m_nScanFieldWidth;
+		m_nScanFieldSize100 = a_oSource.m_nScanFieldSize100;
+		m_dWorkingDistance = a_oSource.m_dWorkingDistance;
+        m_magnification = a_oSource.m_magnification;
+		m_nTotalFields = a_oSource.m_nTotalFields;
+	}
+
+       public int GetScanFieldSize() { return m_nScanFieldWidth; }
+        public void SetScanFieldWidth(int a_nScanFieldWidth) { m_nScanFieldWidth = a_nScanFieldWidth; }
+        public void SetScanFieldHeight(int a_nScanFieldHeight) { m_nScanFieldHeight = a_nScanFieldHeight; }
+
+
+        // scan field size 100 (micros)
+        public int GetScanFieldSize100() { return m_nScanFieldSize100; }
+        public void SetScanFieldSize100(int a_nScanFieldSize100) { m_nScanFieldSize100 = a_nScanFieldSize100; }
+
+        public void SetScanFieldHeight100(int a_nScanFieldHeight100) { m_nScanFieldHeight100 = a_nScanFieldHeight100; }
+
+        // working distance
+        public double GetWorkingDistance() { return m_dWorkingDistance; }
+        public void SetWorkingDistance(double a_dWorkingDistance) { m_dWorkingDistance = a_dWorkingDistance; }
+
+        // total fields
+        public int GetTotalFields() { return m_nTotalFields; }
+        public void SetTotalFields(int a_nTotalFields) { m_nTotalFields = a_nTotalFields; }
+
+        public double GetMagnification()
+        {
+ 
+            return m_magnification;
+        }
+       public void SetMagnification(double a_dMag)
+        {
+            if (a_dMag < MAGNIFICATION_MIN)
+            {
+                return;
+            }
+            m_magnification = a_dMag;
+            m_nScanFieldWidth = (int)(100.0 * (double)m_nScanFieldSize100 / a_dMag + 0.5);
+            m_nScanFieldHeight= (int)(100.0 * (double)m_nScanFieldHeight100 / a_dMag + 0.5);
+        }
+
+        public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+           xInt xnScanFieldSize=new xInt();
+           xInt xnScanFieldHeight = new xInt();
+           xInt xnScanFieldSize100=new xInt();
+           xDouble xdWorkingDistance=new xDouble();
+            xDouble xdKV = new xDouble();
+            xDouble xdBrightness = new xDouble();
+            xDouble xdConstrast = new xDouble();
+            xDouble xMag = new xDouble();
+           xInt xnTotalFields=new xInt();
+           Slo slo=new Slo();
+            slo.Register("ScanFieldSize", xnScanFieldSize);
+            slo.Register("ScanFieldHeight", xnScanFieldHeight);
+            slo.Register("ScanFieldSize100", xnScanFieldSize100);
+            slo.Register("WorkingDistance", xdWorkingDistance);           
+            slo.Register("Brightness", xdBrightness);
+            slo.Register("Constrast", xdConstrast);
+            slo.Register("KV", xdKV);
+            slo.Register("Magnification", xMag);
+            slo.Register("TotalFields", xnTotalFields);
+
+            if (isStoring)
+            {
+                xnScanFieldSize.AssignValue(m_nScanFieldWidth);
+                xnScanFieldHeight.AssignValue(m_nScanFieldHeight);
+                xnScanFieldSize100.AssignValue(m_nScanFieldSize100);
+                xdWorkingDistance.AssignValue(m_dWorkingDistance);
+                xdKV.AssignValue(m_KV);
+                xdBrightness.AssignValue(m_Brightness);
+                xdConstrast.AssignValue(m_Contrast);
+                xMag.AssignValue(m_magnification);
+                xnTotalFields.AssignValue(m_nTotalFields);
+
+                slo.Serialize(true, classDoc, rootNode);
+            }
+
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+
+                m_nScanFieldWidth = xnScanFieldSize.value();
+                m_nScanFieldSize100 = xnScanFieldSize100.value();
+                m_dWorkingDistance = xdWorkingDistance.value();
+                m_KV = xdKV.value();
+                m_Brightness = xdBrightness.value();
+                m_Contrast = xdConstrast.value();
+                m_magnification = xMag.value();
+                m_nTotalFields = xnTotalFields.value();
+            }
+        }
+    }
+}

+ 237 - 0
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleHolder.cs

@@ -0,0 +1,237 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace OTSDataType
+{
+    public class CSampleHolder : ISlo
+    {
+        // stage name
+        String m_strName;
+
+        // boundary
+        CDomain m_poBourary;
+
+        // std
+        CDomain m_poSTD;
+
+        // sample holes list
+        List<CHole> m_listHoles;
+        // constructor
+        public CSampleHolder()
+        {
+            // initialization
+            Init();
+        }
+
+        // initialization
+        public void Init()
+        {
+            // initialization
+            m_strName = "";
+            m_poBourary = new CDomain();
+            m_poSTD = new CDomain();
+            m_listHoles = new List<CHole>();
+        }
+
+
+
+        public CSampleHolder(CSampleHolder a_poSource)
+        {
+
+            // can't copy itself
+            if (a_poSource == this)
+            {
+                return;
+            }
+
+            Duplicate(a_poSource);
+
+        }
+
+        public bool Equals(CSampleHolder a_oSource)          // CBSEImg& operator=(const CBSEImg&);        // =operator
+        {
+            // return FASLE, if the two holes list are in different size
+            int nSize = m_listHoles.Count;
+            if (nSize != a_oSource.m_listHoles.Count)
+            {
+                return false;
+            }
+
+            // return FALSE if any of the pare holes are different
+            for (int i = 0; i < nSize; ++i)
+            {
+                if (m_listHoles[i] != a_oSource.m_listHoles[i])
+                {
+                    return false;
+                }
+            }
+
+            // members check
+            return m_strName == a_oSource.m_strName &&
+                   m_poBourary == a_oSource.m_poBourary &&
+                   m_poSTD == a_oSource.m_poSTD;
+
+        }
+
+        // stage name
+        public String GetName()
+        {
+            return m_strName;
+
+        }
+
+        //public int GetBourary() { return 0; }
+
+        public void SetName(String a_strName)
+        {
+            m_strName = a_strName;
+        }
+
+        // boundary
+        public CDomain GetBoundary()
+        {
+            return m_poBourary;
+        }
+
+        // boundary
+        public void SetBoundary(CDomain a_poBourary)
+        {
+
+            m_poBourary = a_poBourary;
+
+        }
+
+        // std
+        public CDomain GetSTD()
+        {
+            return m_poSTD;
+        }
+
+        // std
+        public void SetSTD(CDomain a_poSTD)
+        {
+            m_poSTD = new CDomain(a_poSTD);
+        }
+
+        // sample holes list
+        public List<CHole> GetHoleList()
+        {
+            return m_listHoles;
+        }
+
+        // holes list
+        public void SetHoleList(List<CHole> a_listHoles, bool a_bClear /* = TRUE*/)
+        {
+            // clear holes list if necessary
+            if (a_bClear)
+            {
+                m_listHoles.Clear();
+            }
+
+            // copy the list
+            foreach (var pHole in a_listHoles)
+            {
+                CHole pHoleNew = new CHole(pHole);
+                m_listHoles.Add(pHoleNew);
+            }
+        }
+
+        // sample holes list
+        public CHole GetHoleByIndex(int a_nIndex)
+        {
+            if (a_nIndex < 0 || a_nIndex >= (int)m_listHoles.Count)
+            {
+                // invalid index
+                return null;
+            }
+            return m_listHoles[a_nIndex];
+        }
+        public CHole GetHoleByName(String a_strHoleName)
+        {
+            a_strHoleName.Trim();
+
+            if (a_strHoleName == "")
+            {
+                // invalid hole name
+                return null;
+            }
+
+            CHole p = new CHole();
+
+            for (int i = 0; i < m_listHoles.Count; i++)
+            {
+                if (m_listHoles[i].GetName() == a_strHoleName)
+                {
+                    p = m_listHoles[i];
+                    break;
+                }
+            }
+
+            return p;
+        }
+        // duplication 
+        void Duplicate(CSampleHolder a_oSource)
+        {
+
+            Init();
+
+            // copy data over
+            m_strName = a_oSource.m_strName;
+            m_poBourary = new CDomain(a_oSource.m_poBourary);
+            m_poSTD = new CDomain(a_oSource.m_poSTD);
+            foreach (var pHole in a_oSource.m_listHoles)
+            {
+                CHole pHoleNew = new CHole(pHole);
+                m_listHoles.Add(pHoleNew);
+
+            }
+
+        }
+
+        public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+            xString xnstrName = new xString();
+            Collection<CHole> xHolelist = new Collection<CHole>();
+            CDomain x_poBourary = new CDomain();
+            CDomain x_poSTD = new CDomain();
+            Slo slo = new Slo();
+            slo.Register("strName", xnstrName);
+            slo.Register("boundary", x_poBourary);
+            slo.Register("std", x_poSTD);
+            slo.Register("Holes", xHolelist);
+            if (isStoring)
+            {
+                xnstrName.AssignValue(m_strName);
+                x_poBourary.SetPolygonPoint(m_poBourary.GetPolygonPoint());
+                x_poBourary.SetRectDomain(m_poBourary.GetDomainRect());
+                x_poBourary.SetShape(m_poBourary.GetShape());
+                x_poSTD.SetPolygonPoint(m_poSTD.GetPolygonPoint());
+                x_poSTD.SetRectDomain(m_poSTD.GetDomainRect());
+                x_poSTD.SetShape(m_poSTD.GetShape());
+                xHolelist.Clear();
+                for (int i = 0; i < m_listHoles.Count; i++)
+                {
+                    xHolelist.addItem(m_listHoles[i]);
+                }
+
+                slo.Serialize(true, classDoc, rootNode);
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+                m_strName = xnstrName.value();
+                m_poBourary = x_poBourary;
+                m_poSTD = x_poSTD;
+                m_listHoles.Clear();
+                for (int i = 0; i < xHolelist.size(); i++)
+                {
+                    m_listHoles.Add(xHolelist.getItem(i));
+                }
+            }
+        }
+    }
+}