Browse Source

optimize the GB Method2 function

gsp 2 years ago
parent
commit
305c453000

+ 5 - 5
OTSCPP/OTSRptCalculate/GBCal/GBFieldData.cpp

@@ -82,7 +82,7 @@ namespace OTSGBCalculate
 
 				double dd = 0, ds = 0;
 				ds = abs(ptParticleCenter.x - ptBParticleCenter.x);
-				if (ds < 10 )//recognize these two particle in the same level
+				if (ds < 15 )//recognize these two particle in the same vertical line.
 				{
 					if (Bottom > TopB)//current particle is on the above
 					{
@@ -341,7 +341,7 @@ namespace OTSGBCalculate
 				if (dFeretDiameter >= 13)
 				{
 					// DS		
-					if (pParticle->GetType() != OTS_PARTICLE_TYPE::INVALID)//here we take all the particles 
+					if (pParticle->GetType() != OTS_PARTICLE_TYPE::INVALID)//here we take all the particles except Invalid
 					{
 						listDSParticles.push_back(pParticle);
 					}
@@ -542,7 +542,7 @@ namespace OTSGBCalculate
 				if (dFeretDiameter >= 13)
 				{
 					// DS			
-					if (pParticle->GetType() != OTS_PARTICLE_TYPE::INVALID)//here we take all the particles 
+					if (pParticle->GetType() != OTS_PARTICLE_TYPE::INVALID)//here we take all the particles except Invalid.
 					{
 						listDSParticles.push_back(pParticle);
 					}
@@ -552,7 +552,7 @@ namespace OTSGBCalculate
 				{
 					//  D or Dsulfide
 					auto p = FindAdjacentParticle(pParticle, m_listParticles);
-					if (p == nullptr)//pParticleÊÇÒ»¸ö¹ÂÁ¢µÄ¿ÅÁ£
+					if (p == nullptr)//pParticle is a isolated particle.
 					{
 						GB_CHEMICAL_TYPE ChemicalType = pParticle->GetChemicalType();
 						if (ChemicalType == GB_CHEMICAL_TYPE::CHE_S)
@@ -612,7 +612,7 @@ namespace OTSGBCalculate
 			if (nChemicalType == GB_CHEMICAL_TYPE::CHE_S)
 			{
 				// A
-				//COTSParticlePtr pParticleNew = COTSParticlePtr(pParticle);
+				
 				GB_WIDTH_TYPE wt = this->CaculateLevelWidth(pParticle, GB_LEVEL_TYPE::A_TYPE);
 
 				switch (wt)

+ 10 - 10
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -329,7 +329,7 @@ namespace OTSIncAReportGraph.Controls
                 {
 
                     df = new DisplayField(fieldlist[i], (int)fieldSize.Width, (int)fieldSize.Height, offset_point);
-                    df.DisColor = Color.Black;
+                    df.ContentColor = Color.Black;
                     m_list_allDfield.Add(df);
                     m_list_allDPart.AddRange(df.List_DParticle);
                 }
@@ -574,7 +574,7 @@ namespace OTSIncAReportGraph.Controls
             {
                 foreach (var f in m_CurGBFields)
                 {
-                    f.OnPaint(e);
+                    f.OnPaint(e,Color.Red);
                 }
                 
 
@@ -585,7 +585,7 @@ namespace OTSIncAReportGraph.Controls
             {
                 foreach (var fld in m_list_allDfield)
                 {
-                    fld.OnPaint(e);
+                    fld.OnPaint(e,Color.Black);
                 }
 
 
@@ -2195,25 +2195,25 @@ namespace OTSIncAReportGraph.Controls
                         switch (topgrade)
                         {
                             case 0:
-                                df.DisColor = Color.White;
+                                df.ContentColor = Color.White;
                                 break;
                             case 1:
-                                df.DisColor = Color.DarkGray;
+                                df.ContentColor = Color.DarkGray;
                                 break;
                             case 2:
-                                df.DisColor = Color.Purple;
+                                df.ContentColor = Color.Purple;
                                 break;
                             case 3:
-                                df.DisColor = Color.Blue;
+                                df.ContentColor = Color.Blue;
                                 break;
                             case 4:
-                                df.DisColor = Color.Red;
+                                df.ContentColor = Color.Red;
                                 break;
                             case 5:
-                                df.DisColor = Color.Red;
+                                df.ContentColor = Color.Red;
                                 break;
                             default:
-                                df.DisColor = Color.Red;
+                                df.ContentColor = Color.Red;
                                 break;
 
                         }

+ 3 - 3
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayField.cs

@@ -187,14 +187,14 @@ namespace OTSIncAReportGraph
 
 
         public Bitmap OriginalImage { get => m_originalImage; set => m_originalImage = value; }
-        public Color DisColor { get => disColor; set =>disColor = value; }
+        public Color ContentColor { get => disColor; set =>disColor = value; }
 
-        public void OnPaint(PaintEventArgs e)
+        public void OnPaint(PaintEventArgs e,Color bodyColor)
         {
             Graphics g = e.Graphics;
             float w = 1;
          
-            Pen p = new Pen(Color.Red, w);
+            Pen p = new Pen(bodyColor, w);
             var r = new Rectangle((int)m_Rect.Left, (int)m_Rect.Top, (int)m_Rect.Width, (int)m_Rect.Height);
            
             g.DrawRectangle(p, r);