Procházet zdrojové kódy

Merge branch 'Release2.5' of http://36.129.163.148:10080/gaoshipeng/OTS2_0 into Release2.5

zhangjiaxin před 2 roky
rodič
revize
8c2e0e2952

+ 2 - 6
OTSCPP/OTSImagePro/FieldMgr.cpp

@@ -129,9 +129,6 @@ namespace OTSIMGPROC {
 	{
 	}
 
-	// CFieldMgr member functions
-
-	// public
 
 	// initialization
 	BOOL CFieldMgr::Init(CDomainPtr a_pMeasureArea, CSize a_ResolutionSize,int a_scanfieldsize,int a_FieldStartMode)
@@ -373,12 +370,11 @@ namespace OTSIMGPROC {
 		double pixely = ImageSizeByPixel.cy;
 		
 		double dScanFiledSizeX = m_ScanFieldSize ;
-		double dScanFiledSizeY = m_ScanFieldSize * pixely / pixelx;
+		double dScanFiledSizeY = dScanFiledSizeX * pixely / pixelx;
 		CSize sizeImage;
 		sizeImage.cx = dScanFiledSizeX;
 		sizeImage.cy = dScanFiledSizeY;
-		// pixel size (micros)
-		//double dPixelSize = (double)dScanFiledSizeX / (double)ImageSizeByPixel.cx;
+	
 
 		// the measure domain rectangle 
 		CRect rectMeasureDomain = m_pMeasureArea->GetDomainRect();

+ 2 - 15
OTSCPP/OTSRptCalculate/GBCal/CGBCalculate.cpp

@@ -103,9 +103,7 @@ namespace OTSGBCalculate
 		int nDLevel[LEVEL_LENGTH];// nDLevelZero, nDLevel_0_5, nDLevel_1_0, nDLevel_1_5, nDLevel_2_0, nDLevel_2_5, nDLevel_3_0, nDLevel_3_5, nDLevel_4_0, nDLevel_4_5, nDLevel_5_0;
 		int nDLevel_w[LEVEL_LENGTH]; //nDLevelZero_f, nDLevel_0_5_f, nDLevel_1_0_f, nDLevel_1_5_f, nDLevel_2_0_f, nDLevel_2_5_f, nDLevel_3_0_f, nDLevel_3_5_f, nDLevel_4_0_f, nDLevel_4_5_f, nDLevel_5_0_f;
 		int nDLevel_s[LEVEL_LENGTH];
-		//int nDSLevel[LEVEL_LENGTH];// nDLevelZero, nDLevel_0_5, nDLevel_1_0, nDLevel_1_5, nDLevel_2_0, nDLevel_2_5, nDLevel_3_0, nDLevel_3_5, nDLevel_4_0, nDLevel_4_5, nDLevel_5_0;
-		//int nDSLevel_w[LEVEL_LENGTH]; //nDLevelZero_f, nDLevel_0_5_f, nDLevel_1_0_f, nDLevel_1_5_f, nDLevel_2_0_f, nDLevel_2_5_f, nDLevel_3_0_f, nDLevel_3_5_f, nDLevel_4_0_f, nDLevel_4_5_f, nDLevel_5_0_f;
-		//int nDSLevel_s[LEVEL_LENGTH];
+
         int nDSulfideLevel[LEVEL_LENGTH];// nDLevelZero, nDLevel_0_5, nDLevel_1_0, nDLevel_1_5, nDLevel_2_0, nDLevel_2_5, nDLevel_3_0, nDLevel_3_5, nDLevel_4_0, nDLevel_4_5, nDLevel_5_0;
         int nDSulfideLevel_w[LEVEL_LENGTH]; //nDLevelZero_f, nDLevel_0_5_f, nDLevel_1_0_f, nDLevel_1_5_f, nDLevel_2_0_f, nDLevel_2_5_f, nDLevel_3_0_f, nDLevel_3_5_f, nDLevel_4_0_f, nDLevel_4_5_f, nDLevel_5_0_f;
         int nDSulfideLevel_s[LEVEL_LENGTH];
@@ -125,9 +123,7 @@ namespace OTSGBCalculate
 			nDLevel[i]=0;
 			nDLevel_w[i]=0;
 			nDLevel_s[i] = 0;
-			/*nDSLevel[i] = 0;
-			nDSLevel_w[i] = 0;
-			nDSLevel_s[i] = 0;*/
+	
             nDSulfideLevel[i] = 0;
             nDSulfideLevel_w[i] = 0;
             nDSulfideLevel_s[i] = 0;
@@ -198,16 +194,7 @@ namespace OTSGBCalculate
 			
 				SetFrameLevelNo(levels, nDLevel_s);
 
-			//update the Ds class grid data
-				/*levelt = GBFld->GetDSLevel()->GetThinGrade();
-				levelw = GBFld->GetDSLevel()->GetWideGrade();
-				levels = GBFld->GetDSLevel()->GetSuperGrade();
-
-				SetFrameLevelNo(levelt, nDSLevel);
-
-				SetFrameLevelNo(levelw, nDSLevel_w);
 
-				SetFrameLevelNo(levels, nDSLevel_s);*/
 
 			//update the Ds class grid data
 				levelt = GBFld->GetDSulfideLevel()->GetThinGrade();

+ 21 - 18
OTSCPP/OTSRptCalculate/GBCal/GBFieldData.cpp

@@ -248,15 +248,15 @@ namespace OTSGBCalculate
 		for (auto pParticle : m_listParticles)
 		{	// compute length width ratio
 
-			CRect rectParticle = pParticle->GetParticleRect();
-			//check the denominator is zero or not
-			if (rectParticle.Width() == 0)
+			auto w = pParticle->GetDMin();
+		
+			if (w == 0)
 			{
 				continue;
 			}
 			//获取最大长度和最小宽度
 			double h = pParticle->GetDMax();
-			double w = pParticle->GetDMin();
+		
 			double dLengthWidthRatio = h / w;
 			if (dLengthWidthRatio < 1)
 			{
@@ -495,16 +495,16 @@ namespace OTSGBCalculate
 		for (auto pParticle : m_listParticles)
 		{
 			
-			//IdentifyPartChemicalType(pParticle);
 			//check the denominator is zero or not
-			CRect rectParticle = pParticle->GetParticleRect();
-			if (rectParticle.Width() == 0)
+			auto w = pParticle->GetDMin();
+
+			if (w == 0)
 			{
 				continue;
 			}
 			//获取最小外接矩形的宽和高
 			double h = pParticle->GetDMax();
-			double w = pParticle->GetDMin();
+		
 			double dLengthWidthRatio = h / w;
 			if (dLengthWidthRatio < 1)
 			{
@@ -664,15 +664,15 @@ namespace OTSGBCalculate
 		for (auto pParticle : m_listParticles)
 		{	// compute length width ratio
 
-			CRect rectParticle = pParticle->GetParticleRect();
-			//check the denominator is zero or not
-			if (rectParticle.Width() == 0)
+			auto w = pParticle->GetDMin();
+
+			if (w == 0)
 			{
 				continue;
 			}
 			//获取最大长度和最小宽度
 			double h = pParticle->GetDMax();
-			double w = pParticle->GetDMin();
+		
 			double dLengthWidthRatio = h / w;
 			if (dLengthWidthRatio < 1)
 			{
@@ -702,7 +702,7 @@ namespace OTSGBCalculate
 					}
 					mapAllParticles[pParticle] = GBParticle(pParticle, GB_LEVEL_TYPE::A_TYPE, wt);
 				}
-				else if (nChemicalType == GB_CHEMICAL_TYPE::CHE_O)
+				else if (nChemicalType == GB_CHEMICAL_TYPE::CHE_O || nChemicalType == GB_CHEMICAL_TYPE::CHE_Si || nChemicalType == GB_CHEMICAL_TYPE::CHE_Al)
 				{
 					// C				
 					//计算颗粒宽度是属于细系粗系还是超尺寸
@@ -743,14 +743,17 @@ namespace OTSGBCalculate
 				else
 				{
 					// B or D
-					GBParticle gbP = GBParticle(pParticle, GB_LEVEL_TYPE::INVALID, GB_WIDTH_TYPE::INVALID);
-					//不能确定是B或D,先设为INVALID
-					listBAndDParticles.push_back(gbP);
+					if (pParticle->GetChemicalType() != GB_CHEMICAL_TYPE::INVALID)//here we take all the particles 
+					{
+						GBParticle gbP = GBParticle(pParticle, GB_LEVEL_TYPE::INVALID, GB_WIDTH_TYPE::INVALID);
+						//不能确定是B或D,先设为INVALID
+						listBAndDParticles.push_back(gbP);
+					}
 
 				}
 			}
 		}
-		{
+		
 			for (auto pGBParticle : listBAndDParticles)
 			{
 				// check if the particle is alone			
@@ -849,7 +852,7 @@ namespace OTSGBCalculate
 
 			}
 
-		}
+		
 	}
 	// caculate Level by DIN
 	void CGBFieldData::CaculateLevelDIN(COTSParticleList listParticle)

+ 2 - 2
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CMeasure.cs

@@ -486,7 +486,7 @@ namespace OTSModelSharp
             }
 
 
-            var a_pMeasureArea = m_pProjData.GetWorkingSample().GetMsrArea();
+            var a_pMeasureArea = m_pProjData.GetWorkingSample().GetMsrDomain();
 
 
             COTSSample pSampleHole = CreateHoleSample(a_pMeasureArea);
@@ -572,7 +572,7 @@ namespace OTSModelSharp
 
             COTSSample pHoleSample = new COTSSample();
 
-            pHoleSample.SetMsrArea(a_pMsrArea);
+            pHoleSample.SetMsrDomain(a_pMsrArea);
 
            
 

+ 3 - 27
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -107,15 +107,7 @@ namespace OTSModelSharp
 
            
             var pSEMCtrl = m_pMsrThread.GetSEMController();
-         
-            //if (!pSEMCtrl.IsConnected())
-            //{
-            //    if (!pSEMCtrl.Connect())
-            //    {
-            //        log.Error("SetSEMDataMrs: can't connect SEM.");
-            //        return false;
-            //    }
-            //}
+   
           
             pSEMCtrl.SetMagnification(dMag);
             pSEMCtrl.SetWorkingDistance(dWorkDis);
@@ -170,15 +162,6 @@ namespace OTSModelSharp
             Size sizePixelImage = RESOLUTION_VALUE[nResulotionId];
 
 
-            // get SEM controller
-            //if (!pSEMController.IsConnected())
-            //{
-            //    if (!pSEMController.Connect())
-            //    {
-            //        log.Error("SetBSEParam: can't connect SEM.");
-            //        return false;
-            //    }
-            //}
 
             // get dwell time 
             OTS_IMAGE_SCANSPEED_OPTIONS nDwellTime = pImgScanParam.GetScanImageSpeed();
@@ -319,7 +302,7 @@ namespace OTSModelSharp
             CFieldPositionMgr pFieldMgr = new CFieldPositionMgr();
 
             // init field centers list manager
-            if (!pFieldMgr.Init(sample.GetMsrArea(), poImageScanParam, poSEMDataMsr, listCompletedCenter))
+            if (!pFieldMgr.Init(sample.GetMsrDomain(), poImageScanParam, poSEMDataMsr, listCompletedCenter))
             {
                 log.Error("CalculateFieldsCenters: failed to init field centres list manager.");
                 a_listUnMsrFieldCenter = new List<System.Drawing.Point>();
@@ -463,15 +446,8 @@ namespace OTSModelSharp
                 return false;
             }
 
+            log.Info("Begin to move SEM stage to OTScoord:" + a_poi.X + "," + a_poi.Y);
 
-            //if (!pSEMController.IsConnected())
-            //{
-            //    if (!pSEMController.Connect())
-            //    {
-            //        log.Error("MoveSEMToPoint: can't connect SEM.");
-            //        return false;
-            //    }
-            //}
             log.Info("Begin to move SEM stage to " + a_SEMpt.X + "," + a_SEMpt.Y);
            
             // move SEM to the position (rotation 0)

+ 3 - 3
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSSample.cs

@@ -238,7 +238,7 @@ namespace OTSDataType
             return true;
         }
 
-        public CDomain GetMsrArea() { return m_poMsrArea; }
+        public CDomain GetMsrDomain() { return m_poMsrArea; }
         public bool SetPropdoubleData(OTS_SAMPLE_PROP_GRID_ITEMS a_nId, double a_dValue)
         {
             switch (a_nId)
@@ -404,7 +404,7 @@ namespace OTSDataType
 
         // measurement area
 
-        public void SetMsrArea(CDomain a_poMsrArea)
+        public void SetMsrDomain(CDomain a_poMsrArea)
         {
             m_poMsrArea = a_poMsrArea;
         }
@@ -2805,7 +2805,7 @@ namespace OTSDataType
             pFields = new List<Point>();
             iSzie = new Size();
 
-            CDomain pMsrArea = GetMsrArea();
+            CDomain pMsrArea = GetMsrDomain();
 
 
             COTSImgScanPrm pImgScanParam =GetMsrParams().GetImageScanParam();

+ 5 - 5
OTSIncAMeasureApp/2-OTSMeasureParamManage/COTSMeasureParam.cs

@@ -341,7 +341,7 @@ namespace OTSMeasureApp
             pSample.SetSampleHoleName(pHole.GetName());
             pSample.SetSwitch(m_pParam.GetMeasurementSwitch());
             pSample.GetMsrParams().SetSysSTDSwitch(m_pParam.GetSysSTD());
-            pSample.SetMsrArea(pMsrArea);
+            pSample.SetMsrDomain(pMsrArea);
             pSample.SetMembraneType(a_nVal);
             pSample.SetMsrParams(poMsrParams);
             CSEMDataMsr semData = new CSEMDataMsr();
@@ -654,7 +654,7 @@ namespace OTSMeasureApp
                 Domain.SetPolygonPoint(PolygonPoint);
             }
             WSample.SetSampleHoleName(SMeasurePara.sampleHoleName);
-            WSample.SetMsrArea(Domain);
+            WSample.SetMsrDomain(Domain);
 
          
 
@@ -1251,7 +1251,7 @@ namespace OTSMeasureApp
             }
 
             CDomain pMsrArea = new CDomain();
-            pMsrArea = WSample.GetMsrArea();
+            pMsrArea = WSample.GetMsrDomain();
             if (null == pMsrArea)
             {
                 return false;
@@ -1399,12 +1399,12 @@ namespace OTSMeasureApp
           
             SMeasureInfo.SMeasurePara.sSampleName = Sample.GetName();// (String)SMeasurePara.GetValue("sNewSampleName");
             // 获取测量区域形状
-            SMeasureInfo.SMeasurePara.iShape = (ShapeType)Sample.GetMsrArea().GetShape();// (int)SMeasurePara.GetValue("iShape");
+            SMeasureInfo.SMeasurePara.iShape = (ShapeType)Sample.GetMsrDomain().GetShape();// (int)SMeasurePara.GetValue("iShape");
             //获取样品孔名称
             SMeasureInfo.SMeasurePara.sampleHoleName = Sample.GetSampleHoleName();// (String)SMeasurePara.GetValue("sHoleName");
                                                                              //样品测量区域
                                                                              // JObject rec = (JObject)SMeasurePara.GetValue("MeasureRect");
-            RectangleF rec = Sample.GetMsrArea().GetDomainRect();
+            RectangleF rec = Sample.GetMsrDomain().GetDomainRect();
             SMeasureInfo.SMeasurePara.MeasureRect = new Rectangle((int)rec.X, (int)rec.Y, (int)rec.Width, (int)rec.Height);
 
          

+ 8 - 8
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CreateRectangle.cs

@@ -581,11 +581,11 @@ namespace OTSMeasureApp
             get { return lineStartPoint; }
             set { lineStartPoint = value; }
         }
-        public  PointF SEMCenterPoint
-        {
-            get { return semCenterPoint; }
-            set { semCenterPoint = value; }
-        }
+        //public  PointF SEMCenterPoint
+        //{
+        //    get { return semCenterPoint; }
+        //    set { semCenterPoint = value; }
+        //}
         public  int OTSX
         {
             get { return otsX; }
@@ -1017,7 +1017,7 @@ namespace OTSMeasureApp
             BSEImageWitdh = m_RegionF.Width;
             BSEImageHeight = m_RegionF.Height;
             BSEImageLocation = m_RegionF.Location;
-            SEMCenterPoint = m_RegionF.Location;
+            //SEMCenterPoint = m_RegionF.Location;
 
             var scalePs = new List<PointF>();
             foreach (var p in m_PolygonPoints)
@@ -1065,7 +1065,7 @@ namespace OTSMeasureApp
             BSEImageWitdh = m_RegionF.Width;
             BSEImageHeight = m_RegionF.Height;
             BSEImageLocation = m_RegionF.Location;
-            SEMCenterPoint = m_RegionF.Location;
+            //SEMCenterPoint = m_RegionF.Location;
             LineStartPoint = m_RegionF.Location;
 
             m_DraggingPoint = new Point((int)location.X,(int)location.Y);
@@ -1117,7 +1117,7 @@ namespace OTSMeasureApp
             BSEImageWitdh = m_RegionF.Width;
             BSEImageHeight = m_RegionF.Height;
             BSEImageLocation = m_RegionF.Location;
-            SEMCenterPoint = m_RegionF.Location;
+            //SEMCenterPoint = m_RegionF.Location;
             LineStartPoint = m_RegionF.Location;
 
             

+ 9 - 4
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -1430,9 +1430,13 @@ namespace OTSMeasureApp
                         //样品
                         MouseDownFunction(GetAllVisualSampleGDIObject(), e);
 
+                        if (GetWorkingVisualSample() != null)
+                        {
+                            //样品台中BSE图片
+                            MouseDownFunction(GetWorkingVisualSample().m_ImageGDIObjects, e);
 
-                        //样品台中BSE图片
-                        MouseDownFunction(GetWorkingVisualSample().m_ImageGDIObjects, e);
+                        }
+                       
 
                         MouseDownFunction(m_AllHoleImageGDIObjects, e);
 
@@ -2629,7 +2633,7 @@ namespace OTSMeasureApp
                 return false;
             }
             
-            CDomain pMsrArea = WSample.GetMsrArea();
+            CDomain pMsrArea = WSample.GetMsrDomain();
 
          
             COTSImgScanPrm pImgScanParam = WSample.GetMsrParams().GetImageScanParam();
@@ -2808,7 +2812,7 @@ namespace OTSMeasureApp
                 {
                    
                     PointF OTSLocation = m_MeasureAppForm.m_ProjParam.ConverSEMToOTSCoord(new PointF((int)Math.Round(SemLocation[(int)XYIndex.X], 0), (int)Math.Round(SemLocation[(int)XYIndex.Y], 0)));
-                   
+                    NLog.LogManager.GetCurrentClassLogger().Warn(OTSLocation.ToString());
            
                     var sam = GetWorkingVisualSample();
                     var MeasureItem = sam.GetMeasureGDIObject();
@@ -2816,6 +2820,7 @@ namespace OTSMeasureApp
 
                       var measurePos = m_visualStage.OTSCoordToCtrlCoord(OTSLocation);
 
+
                     MeasureItem.DraggingPoint = MeasureItem.GetCenterPoint();
 
                     MeasureItem.PositionAltering(measurePos,false);

+ 2 - 2
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/VisualStage.cs

@@ -415,8 +415,8 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
         private PointF CalculateLocationF(PointF point)
         {
             //获取窗体的高度与宽度
-            int ctrlWidth = m_totalCtrlWidth;
-            int ctrlHeight = m_totalCtrlHeight;
+            float ctrlWidth = m_totalCtrlWidth;
+            float ctrlHeight = m_totalCtrlHeight;
             //获取屏幕中心点
             PointF pointXY = new PointF();
             PointF screenPoint = new PointF(ctrlWidth / 2, ctrlHeight / 2);

+ 4 - 4
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -560,17 +560,17 @@ namespace OTSMeasureApp
                 //获取样品名称
                 SampleMeasureArea.sSampleName = (m_ProjData.GetSampleList())[i].GetName();
                 // 获取测量区域形状
-                SampleMeasureArea.iShape = (ShapeType)m_ProjData.GetSampleList()[i].GetMsrArea().GetShape();
+                SampleMeasureArea.iShape = (ShapeType)m_ProjData.GetSampleList()[i].GetMsrDomain().GetShape();
                 //获取样品孔名称
                 SampleMeasureArea.sampleHoleName = (m_ProjData.GetSampleList())[i].GetSampleHoleName();
                 //样品测量区域
-                SampleMeasureArea.MeasureRect =(m_ProjData.GetSampleList())[i].GetMsrArea().GetRectDomain();
+                SampleMeasureArea.MeasureRect =(m_ProjData.GetSampleList())[i].GetMsrDomain().GetRectDomain();
                 //多边形点集合
                 List<PointF> PointRegionF = new List<PointF>();
-                List<Point> PolygonPoint = m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint();
+                List<Point> PolygonPoint = m_ProjData.GetSampleList()[i].GetMsrDomain().GetPolygonPoint();
                 if (PolygonPoint != null)
                 {
-                    foreach (var item in m_ProjData.GetSampleList()[i].GetMsrArea().GetPolygonPoint())
+                    foreach (var item in m_ProjData.GetSampleList()[i].GetMsrDomain().GetPolygonPoint())
                     {
                         PointRegionF.Add(new PointF(item.X, item.Y));
                     }