|
@@ -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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|