فهرست منبع

fix the magnification display problem.Originally it will change for the float datatype.

gsp 3 سال پیش
والد
کامیت
8a5cd41f1b
1فایلهای تغییر یافته به همراه20 افزوده شده و 7 حذف شده
  1. 20 7
      OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSEMDataMsr.cs

+ 20 - 7
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSEMDataMsr.cs

@@ -16,6 +16,7 @@ namespace OTSDataType
         private double m_dWorkingDistance;
         private int m_nTotalFields;
         private int m_nScanFieldHeight100;
+        private double m_magnification;
 
         public CSEMDataMsr()
 	{
@@ -28,6 +29,7 @@ namespace OTSDataType
             m_nScanFieldSize100 = 1142;
             m_dWorkingDistance = 0;
             m_nTotalFields = 0;
+            m_magnification = 0;
         }
 
      public    CSEMDataMsr ( CSEMDataMsr a_oSource)
@@ -45,6 +47,7 @@ namespace OTSDataType
         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;
 	}
 
@@ -76,17 +79,22 @@ namespace OTSDataType
 
         public double GetMagnification()
         {
-            // magnification
-            double dMag = 0.0;
-
-            // convert scan field size to magnification
-            if (m_nScanFieldWidth > 0)
+            if (m_magnification == 0)
             {
-                dMag = (double)m_nScanFieldSize100 * 100.0 / (double)m_nScanFieldWidth;
+                // magnification
+                double dMag = 0.0;
+
+                // convert scan field size to magnification
+                if (m_nScanFieldWidth > 0)
+                {
+                    dMag = (double)m_nScanFieldSize100 * 100.0 / (double)m_nScanFieldWidth;
+                }
+                m_magnification = dMag;
             }
+           
 
             // return magnification
-            return dMag;
+            return m_magnification;
         }
        public void SetMagnification(double a_dMag)
         {
@@ -94,6 +102,7 @@ namespace OTSDataType
             {
                 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);
         }
@@ -104,12 +113,14 @@ namespace OTSDataType
            xInt xnScanFieldHeight = new xInt();
            xInt xnScanFieldSize100=new xInt();
            xDouble xdWorkingDistance=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("Magnification", xMag);
             slo.Register("TotalFields", xnTotalFields);
 
             if (isStoring)
@@ -118,6 +129,7 @@ namespace OTSDataType
                 xnScanFieldHeight.AssignValue(m_nScanFieldHeight);
                 xnScanFieldSize100.AssignValue(m_nScanFieldSize100);
                 xdWorkingDistance.AssignValue(m_dWorkingDistance);
+                xMag.AssignValue(m_magnification);
                 xnTotalFields.AssignValue(m_nTotalFields);
 
                 slo.Serialize(true, classDoc, rootNode);
@@ -130,6 +142,7 @@ namespace OTSDataType
                 m_nScanFieldWidth = xnScanFieldSize.value();
                 m_nScanFieldSize100 = xnScanFieldSize100.value();
                 m_dWorkingDistance = xdWorkingDistance.value();
+                m_magnification = xMag.value();
                 m_nTotalFields = xnTotalFields.value();
             }
         }