Browse Source

optimize the GB calculate algorithm

gsp 1 year ago
parent
commit
186be596e7

+ 13 - 13
OTSCPP/OTSClrInterface/ReportCalculateClr/ReportMgrClr.cpp

@@ -346,7 +346,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] =gcnew System::String( p->GetParticleId());
 					r["gbClassify"] = "A";
 					r["gbClassify"] = "A";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -354,7 +354,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "A";
 					r["gbClassify"] = "A";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -362,7 +362,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "A";
 					r["gbClassify"] = "A";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -371,7 +371,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "B";
 					r["gbClassify"] = "B";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -379,7 +379,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "B";
 					r["gbClassify"] = "B";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -387,7 +387,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "B";
 					r["gbClassify"] = "B";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -396,7 +396,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "C";
 					r["gbClassify"] = "C";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -404,7 +404,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "C";
 					r["gbClassify"] = "C";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -412,7 +412,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "C";
 					r["gbClassify"] = "C";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -421,7 +421,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "D";
 					r["gbClassify"] = "D";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -429,7 +429,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "D";
 					r["gbClassify"] = "D";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -437,7 +437,7 @@ namespace OTSCLRINTERFACE {
 				{
 				{
 					auto r = tbl->NewRow();
 					auto r = tbl->NewRow();
 					r["fieldId"] = p->GetFieldId();
 					r["fieldId"] = p->GetFieldId();
-					r["particleId"] = p->GetParticleId();
+					r["particleId"] = gcnew System::String(p->GetParticleId());
 					r["gbClassify"] = "D";
 					r["gbClassify"] = "D";
 					tbl->Rows->Add(r);
 					tbl->Rows->Add(r);
 				}
 				}
@@ -497,7 +497,7 @@ namespace OTSCLRINTERFACE {
 		{
 		{
 			auto r=tbl->NewRow();
 			auto r=tbl->NewRow();
 			r["fieldId"] = p->GetFieldId();
 			r["fieldId"] = p->GetFieldId();
-			r["particleId"] = p->GetParticleId();
+			r["particleId"] = gcnew System::String(p->GetParticleId());
 			CString partDsGrade = OTSGBCalculate::GetDSGrade(p->GetFeretDiameter());
 			CString partDsGrade = OTSGBCalculate::GetDSGrade(p->GetFeretDiameter());
 			String^ pDsGr = gcnew String(partDsGrade);
 			String^ pDsGr = gcnew String(partDsGrade);
 			r["DSGrade"] = pDsGr;
 			r["DSGrade"] = pDsGr;

+ 2 - 1
OTSCPP/OTSImagePro/BaseFunction.cpp

@@ -7,6 +7,7 @@
 #include "OTSImageProcessParam.h"
 #include "OTSImageProcessParam.h"
 #include <OTSFieldData.h>
 #include <OTSFieldData.h>
 #include "OTSMorphology.h"
 #include "OTSMorphology.h"
+
 using namespace cv;
 using namespace cv;
 using namespace std;
 using namespace std;
 using namespace OTSDATA;
 using namespace OTSDATA;
@@ -331,4 +332,4 @@ void RemoveBG_old(const cv::Mat& img, cv::Mat& dst, int nBGStart, int nBGEnd,lon
 	}
 	}
 	dst.data = pPixel;
 	dst.data = pPixel;
 	delete[] pTempImg;
 	delete[] pTempImg;
-}
+}

+ 39 - 15
OTSCPP/OTSRptCalculate/GBCal/GBFieldData.cpp

@@ -59,6 +59,12 @@ namespace OTSGBCalculate
 			s.Format(_T("%.0lf"), d);
 			s.Format(_T("%.0lf"), d);
 			return s;
 			return s;
 		}
 		}
+		CString IntToCString(int d)
+		{
+			CString s;
+			s.Format(_T("%d"), d);
+			return s;
+		}
 
 
 
 
 	}
 	}
@@ -353,8 +359,11 @@ namespace OTSGBCalculate
 				if (dFeretDiameter >= 13)
 				if (dFeretDiameter >= 13)
 				{
 				{
 					// DS		
 					// DS		
-					
-						listDSparts.push_back(pParticle);
+					CGBParticlePtr gbp = CGBParticlePtr(new GBParticle());
+					gbp->myType = GB_CLASSIFY_TYPE::DS_TYPE;
+					gbp->myOTSParts.push_back(pParticle);
+					listDSParticles.push_back(gbp);
+
 					
 					
 				}
 				}
 				else
 				else
@@ -385,8 +394,10 @@ namespace OTSGBCalculate
 		ConnectStringParts(listAparts, listAGBparts);
 		ConnectStringParts(listAparts, listAGBparts);
 		for (auto gbp : listAGBparts)
 		for (auto gbp : listAGBparts)
 		{
 		{
+			gbp->myType = GB_CLASSIFY_TYPE::A_TYPE;
 			//计算颗粒宽度是属于细系粗系还是超尺寸
 			//计算颗粒宽度是属于细系粗系还是超尺寸
 			GB_WIDTH_TYPE wt = gbp->CaculateLevelWidth(GB_CLASSIFY_TYPE::A_TYPE);
 			GB_WIDTH_TYPE wt = gbp->CaculateLevelWidth(GB_CLASSIFY_TYPE::A_TYPE);
+			gbp->myWidth = wt;
 			switch (wt)
 			switch (wt)
 			{
 			{
 			case GB_WIDTH_TYPE::THIN:
 			case GB_WIDTH_TYPE::THIN:
@@ -406,8 +417,9 @@ namespace OTSGBCalculate
 		//计算颗粒宽度是属于细系粗系还是超尺寸
 		//计算颗粒宽度是属于细系粗系还是超尺寸
 		for (auto gbp : listCGBparts)
 		for (auto gbp : listCGBparts)
 		{
 		{
+			gbp->myType = GB_CLASSIFY_TYPE::C_TYPE;
 			GB_WIDTH_TYPE wt = gbp->CaculateLevelWidth(GB_CLASSIFY_TYPE::C_TYPE);
 			GB_WIDTH_TYPE wt = gbp->CaculateLevelWidth(GB_CLASSIFY_TYPE::C_TYPE);
-
+			gbp->myWidth = wt;
 			switch (wt)
 			switch (wt)
 			{
 			{
 			case GB_WIDTH_TYPE::THIN:
 			case GB_WIDTH_TYPE::THIN:
@@ -438,6 +450,7 @@ namespace OTSGBCalculate
 
 
 						//计算颗粒宽度是属于细系粗系还是超尺寸
 						//计算颗粒宽度是属于细系粗系还是超尺寸
 						GB_WIDTH_TYPE wt = pGBParticle->CaculateLevelWidth( GB_CLASSIFY_TYPE::D_TYPE);
 						GB_WIDTH_TYPE wt = pGBParticle->CaculateLevelWidth( GB_CLASSIFY_TYPE::D_TYPE);
+						pGBParticle->myWidth = wt;
 						switch (wt)
 						switch (wt)
 						{
 						{
 						case GB_WIDTH_TYPE::THIN:
 						case GB_WIDTH_TYPE::THIN:
@@ -463,6 +476,7 @@ namespace OTSGBCalculate
 						gbp->myType = GB_CLASSIFY_TYPE::D_TYPE;
 						gbp->myType = GB_CLASSIFY_TYPE::D_TYPE;
 						gbp->myOTSParts.push_back(p);
 						gbp->myOTSParts.push_back(p);
 						GB_WIDTH_TYPE wt = gbp->CaculateLevelWidth(GB_CLASSIFY_TYPE::D_TYPE);
 						GB_WIDTH_TYPE wt = gbp->CaculateLevelWidth(GB_CLASSIFY_TYPE::D_TYPE);
+						gbp->myWidth = wt;
 						switch (wt)
 						switch (wt)
 						{
 						{
 						case GB_WIDTH_TYPE::THIN:
 						case GB_WIDTH_TYPE::THIN:
@@ -480,11 +494,12 @@ namespace OTSGBCalculate
 				else if(pGBParticle->myOTSParts.size()>= 3)
 				else if(pGBParticle->myOTSParts.size()>= 3)
 				{
 				{
 					
 					
-						pGBParticle->myType = GB_CLASSIFY_TYPE::B_TYPE;//把类型设为有效类型,以便不再找这个颗粒
-						/*adjacentPart->myType = GB_CLASSIFY_TYPE::B_TYPE;*/
+						pGBParticle->myType = GB_CLASSIFY_TYPE::B_TYPE;
+						
 
 
 						//计算颗粒宽度是属于细系粗系还是超尺寸
 						//计算颗粒宽度是属于细系粗系还是超尺寸
 						GB_WIDTH_TYPE wt = pGBParticle->CaculateLevelWidth( GB_CLASSIFY_TYPE::B_TYPE);
 						GB_WIDTH_TYPE wt = pGBParticle->CaculateLevelWidth( GB_CLASSIFY_TYPE::B_TYPE);
+						pGBParticle->myWidth = wt;
 						switch (wt)
 						switch (wt)
 						{
 						{
 						case GB_WIDTH_TYPE::THIN:
 						case GB_WIDTH_TYPE::THIN:
@@ -546,7 +561,7 @@ namespace OTSGBCalculate
 				continue;
 				continue;
 			}
 			}
 
 
-			//CGBParticlePtr gbp = CGBParticlePtr(new GBParticle());
+			
 
 
 			GB_CHEMICAL_TYPE nChemicalType = GBParticle::IdentifyPartChemicalType(pParticle);
 			GB_CHEMICAL_TYPE nChemicalType = GBParticle::IdentifyPartChemicalType(pParticle);
 
 
@@ -932,7 +947,7 @@ namespace OTSGBCalculate
 			}
 			}
 		
 		
 			COTSParticlePtr myPart;
 			COTSParticlePtr myPart;
-			listStringPart connectParticles;//used to merge particles ,if this particle has been merged then this pointer will point to the first particle of these merged particles or else it's NULL.
+			listStringPart connectParticles;//used to merge particles 
 			BOOL ifMerged;
 			BOOL ifMerged;
 		};
 		};
 		
 		
@@ -963,9 +978,9 @@ namespace OTSGBCalculate
 					}
 					}
 					double dd = 0, ds = 0;
 					double dd = 0, ds = 0;
 					ds = abs(ptParticleCenter.x - ptBParticleCenter.x);
 					ds = abs(ptParticleCenter.x - ptBParticleCenter.x);
-					if (ds < 15)//认为两个颗粒在一条竖直线上,但不在一起
+					if (ds < 10)//认为两个颗粒在一条竖直线上,但不在一起
 					{
 					{
-						if (Bottom > TopB)//current particle is on the above
+						if (Bottom >= TopB)//current particle is on the above
 						{
 						{
 							dd = Bottom - TopB;
 							dd = Bottom - TopB;
 							if (dd < 40)//认为这两个颗粒在一个串条上
 							if (dd < 40)//认为这两个颗粒在一个串条上
@@ -973,7 +988,11 @@ namespace OTSGBCalculate
 								return true;
 								return true;
 							}
 							}
 						}
 						}
-						else if (BottomB > Top)	//current particle is on the below
+						else if(Bottom<TopB && TopB<Top)
+						{
+							return true;
+						}
+						else if (BottomB >= Top)	//current particle is on the below
 						{
 						{
 							dd = BottomB - Top;
 							dd = BottomB - Top;
 							if (dd < 40)
 							if (dd < 40)
@@ -981,6 +1000,10 @@ namespace OTSGBCalculate
 								return true;
 								return true;
 							}
 							}
 						}
 						}
+						else if (BottomB < Top && BottomB> Bottom)
+						{
+							return true;
+						}
 					}
 					}
 
 
 					return false;
 					return false;
@@ -1013,13 +1036,14 @@ namespace OTSGBCalculate
 					{
 					{
 						gbpart->myOTSParts.push_back(currpart->myPart);
 						gbpart->myOTSParts.push_back(currpart->myPart);
 						currpart->ifMerged = true;
 						currpart->ifMerged = true;
+						for (auto connP : currpart->connectParticles)
+						{
+							partque.push(connP);
+
+						}
 					}
 					}
 					partque.pop();
 					partque.pop();
-					for (auto connP : currpart->connectParticles)
-					{
-						partque.push(connP);
-						
-					}
+					
 					
 					
 					
 					
 				}
 				}

+ 63 - 3
OTSCPP/OTSRptCalculate/GBCal/GBParticle.cpp

@@ -114,6 +114,33 @@ namespace OTSGBCalculate
 		}
 		}
 
 
 	}
 	}
+	int GBParticle::GetFieldId()
+	{
+		COTSParticlePtr Particle = myOTSParts[0];
+		for (auto p : myOTSParts)//get the longest particle 
+		{
+			if (p->GetDMax() > Particle->GetDMax())
+			{
+				Particle = p;
+			}
+		}
+		return Particle->GetFieldId();
+	}
+	CString GBParticle::GetParticleId()
+	{
+		COTSParticlePtr Particle = myOTSParts[0];
+		CString partsid="";
+		for (auto p : myOTSParts)
+		{
+			
+			CString partid;
+			partid.Format(_T("%d:%d "), p->GetFieldId(), p->GetParticleId());
+			partsid += partid;
+			
+		}
+		partsid.TrimRight();
+		return partsid;
+	}
 	GB_WIDTH_TYPE 	 GBParticle::CaculateLevelWidth( GB_CLASSIFY_TYPE a_nLevel)
 	GB_WIDTH_TYPE 	 GBParticle::CaculateLevelWidth( GB_CLASSIFY_TYPE a_nLevel)
 	{
 	{
 		COTSParticlePtr Particle= myOTSParts[0];
 		COTSParticlePtr Particle= myOTSParts[0];
@@ -202,14 +229,47 @@ namespace OTSGBCalculate
 	}
 	}
 	double GBParticle::GetDMax()
 	double GBParticle::GetDMax()
 	{
 	{
-		return 0.0;
+		auto compare = [](const COTSParticlePtr& a, const COTSParticlePtr& b)		
+		{
+			return  a->GetOTSRect().GetTopLeft().y> b->GetOTSRect().GetTopLeft().y;
+		};
+		std::sort(myOTSParts.begin(), myOTSParts.end(), compare);
+		double dmax=0;
+		auto p = myOTSParts.begin();
+		while (p != myOTSParts.end())
+		{
+			dmax += (*p)->GetDMax();
+			auto cur = p;
+			auto next = ++p;
+			if (next!= myOTSParts.end())
+			{
+				auto distance= (*cur)->GetOTSRect().GetBottomRight().y - (*next)->GetOTSRect().GetTopLeft().y;
+				if (distance > 0)
+				{
+					dmax += distance;
+				}
+				
+			}
+		}
+		
+		return dmax;
 	}
 	}
 	double GBParticle::GetFeretDiameter()
 	double GBParticle::GetFeretDiameter()
 	{
 	{
-		return 0.0;
+		double dferet=0;
+		for (auto p : myOTSParts)
+		{
+			dferet += p->GetFeretDiameter();
+		}
+		return dferet;
 	}
 	}
 	double GBParticle::GetActualArea()
 	double GBParticle::GetActualArea()
 	{
 	{
-		return 0.0;
+		double area = 0;
+		for (auto p : myOTSParts)
+		{
+			area += p->GetActualArea();
+		}
+		return area;
 	}
 	}
 }
 }

+ 4 - 2
OTSCPP/OTSRptCalculate/GBCal/GBParticle.h

@@ -6,7 +6,7 @@ namespace OTSGBCalculate
 {
 {
 	using namespace std;
 	using namespace std;
 	using namespace OTSDATA;
 	using namespace OTSDATA;
-	class GBParticle
+	class  __declspec(dllexport) GBParticle
 	{
 	{
 	public:
 	public:
 		GBParticle()
 		GBParticle()
@@ -14,12 +14,14 @@ namespace OTSGBCalculate
 		}
 		}
 
 
 		static GB_CHEMICAL_TYPE IdentifyPartChemicalType(COTSParticlePtr Particle);
 		static GB_CHEMICAL_TYPE IdentifyPartChemicalType(COTSParticlePtr Particle);
-
+		int GetFieldId();
+		CString GetParticleId();
 		GB_WIDTH_TYPE CaculateLevelWidth( GB_CLASSIFY_TYPE a_nLevel);
 		GB_WIDTH_TYPE CaculateLevelWidth( GB_CLASSIFY_TYPE a_nLevel);
 		double GetDMax();
 		double GetDMax();
 		double GetFeretDiameter();
 		double GetFeretDiameter();
 		double GetActualArea();
 		double GetActualArea();
 
 
+
 		GB_CLASSIFY_TYPE myType;
 		GB_CLASSIFY_TYPE myType;
 		GB_WIDTH_TYPE myWidth;
 		GB_WIDTH_TYPE myWidth;
 
 

+ 2 - 2
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSRect.cs

@@ -22,7 +22,7 @@ namespace OTSMeasureApp._0_OTSModel.OTSDataType
 			m_bottom = 0;
 			m_bottom = 0;
 		}
 		}
 
 
-		public COTSRect(int left, int top, int right, int bottom)
+		public COTSRect(float left, float top, float right, float bottom)
 		{
 		{
 			m_left = left;
 			m_left = left;
 			m_top = top;
 			m_top = top;
@@ -39,7 +39,7 @@ namespace OTSMeasureApp._0_OTSModel.OTSDataType
 		}
 		}
 
 
 
 
-	public	void SetRectData(int left, int top, int right, int bottom)
+	public	void SetRectData(float  left, float  top,  float  right, float  bottom)
 		{
 		{
 			m_left = left;
 			m_left = left;
 			m_top = top;
 			m_top = top;

+ 2 - 32
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -593,7 +593,7 @@ namespace OTSMeasureApp
             {
             {
                 contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text = "SwitchDisplayToBSEDiagram";
                 contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Text = "SwitchDisplayToBSEDiagram";
             }
             }
-            //UpdateImageOrChart(m_imagetype);
+          
 
 
             int[] XData = new int[(int)GrayLevel.Max];
             int[] XData = new int[(int)GrayLevel.Max];
             for (int i = 0; i < (int)GrayLevel.Max; i++)
             for (int i = 0; i < (int)GrayLevel.Max; i++)
@@ -1830,37 +1830,7 @@ namespace OTSMeasureApp
             }
             }
         }
         }
 
 
-        //private void button1_Click(object sender, EventArgs e)
-        //{
-        //    COTSSample cSample = m_MeasureAppForm.m_ProjParam.GetWorkSample();
-        //    int start = cSample.GetMsrParams().GetImageProcessParam().GetBGGray().GetStart();
-        //    int end = cSample.GetMsrParams().GetImageProcessParam().GetBGGray().GetEnd();
-        //    Image bInput = picBox.Image;
-        //    List<ColorMap> colorMapTemp = new List<ColorMap>();
-        //    for (int i = start; i <= end; i++)
-        //    {
-        //        ColorMap colorMap = new ColorMap();
-        //        string colorName = "#" + Color.FromArgb(i, i, i).Name.ToString();
-        //        colorMap.OldColor = ColorTranslator.FromHtml(colorName);
-        //        colorMap.NewColor = Color.Red;
-        //        colorMapTemp.Add(colorMap);
-        //    }
-        //    Bitmap outBitmap = new Bitmap(bInput);
-        //    //创建Graphics对象
-        //    Graphics g = Graphics.FromImage(outBitmap);
-        //    //生成的图像大小
-        //    int width = bInput.Width;
-        //    int height = bInput.Height;
-        //    //编辑被着急图像所要显示的位置
-        //    Rectangle DrawRect = new Rectangle(0, 0, 1024, 768);
-        //    //编辑输出画布中着色的位置
-        //    Rectangle ShowRect = new Rectangle(0, 0, 1024, 768);
-        //    ImageAttributes attr = new ImageAttributes();
-        //    attr.SetRemapTable(colorMapTemp.ToArray());
-        //    //从输入图像中截图至临时图像中
-        //    g.DrawImage(bInput, ShowRect, 0, 0, DrawRect.Width, DrawRect.Height, GraphicsUnit.Pixel, attr);
-        //    picBox.Image = outBitmap;
-        //}
+        
 
 
         private void OTSMeasureStatusWindow_MouseClick(object sender, MouseEventArgs e)
         private void OTSMeasureStatusWindow_MouseClick(object sender, MouseEventArgs e)
         {
         {

+ 6 - 2
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -397,8 +397,12 @@ namespace OTSModelSharp.ServiceCenter
             // 绘制一个红色矩形
             // 绘制一个红色矩形
             Pen pen = new Pen(Color.Red, 1);
             Pen pen = new Pen(Color.Red, 1);
             var overlap=a_pImgProcessParam.GetOverlapParam();
             var overlap=a_pImgProcessParam.GetOverlapParam();
-            int overlapPixels =(int) (overlap / a_pixelSize);
-            graphics.DrawRectangle(pen, overlapPixels, overlapPixels, a_pBmpOut.Width-2*overlapPixels, a_pBmpOut.Height - 2 * overlapPixels);
+            if (overlap > 0)
+            {
+                int overlapPixels = (int)(overlap / a_pixelSize);
+                graphics.DrawRectangle(pen, overlapPixels, overlapPixels, a_pBmpOut.Width - 2 * overlapPixels, a_pBmpOut.Height - 2 * overlapPixels);
+
+            }
 
 
 
 
 
 

+ 155 - 141
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -10,6 +10,7 @@ using OTSIncAReportGraph.Class;
 
 
 using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
 using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
 using OTSIncAReportMailInterface;
 using OTSIncAReportMailInterface;
+using OTSMeasureApp._0_OTSModel.OTSDataType;
 using OTSPeriodicTable;
 using OTSPeriodicTable;
 
 
 using System;
 using System;
@@ -106,12 +107,13 @@ namespace OTSIncAReportGraph.Controls
         System.Collections.Hashtable table;
         System.Collections.Hashtable table;
 
 
         //包含particle的field的列表对象
         //包含particle的field的列表对象
-        public List<DisplayField> m_list_allDfield = null;
+        public List<DisplayRectangle> m_list_allDfield = null;
 
 
 
 
         //这里要做成控件,不要是窗体
         //这里要做成控件,不要是窗体
         public List<DisplayParticle> m_list_allDPart_original = null;
         public List<DisplayParticle> m_list_allDPart_original = null;
-        public List<DisplayField> m_CurGBFields = new List<DisplayField>();
+        public List<DisplayRectangle> m_CurGBFields = new List<DisplayRectangle>();
+        public List<DisplayRectangle> m_CurGBParticles = new List<DisplayRectangle>();
 
 
         //总背景矩形
         //总背景矩形
         private RectangleF m_backRect = new RectangleF();
         private RectangleF m_backRect = new RectangleF();
@@ -204,7 +206,7 @@ namespace OTSIncAReportGraph.Controls
         public Control_DrawDistrbutionImageAndBSE(OTSIncAReportApp.frmReportApp ReportApp)
         public Control_DrawDistrbutionImageAndBSE(OTSIncAReportApp.frmReportApp ReportApp)
         {
         {
             log = NLog.LogManager.GetCurrentClassLogger();
             log = NLog.LogManager.GetCurrentClassLogger();
-            m_list_allDfield = new List<DisplayField>();
+            m_list_allDfield = new List<DisplayRectangle>();
 
 
             m_frm_userprogress = new Frm_UserProgress();
             m_frm_userprogress = new Frm_UserProgress();
 
 
@@ -305,14 +307,14 @@ namespace OTSIncAReportGraph.Controls
             {
             {
                 ProgressBarUpdate(20 + (int)(ls_int_progresscalc * (i + 1)), "finished " + i.ToString() + "total " + resultFile.List_OTSField.Count.ToString() + "field...");
                 ProgressBarUpdate(20 + (int)(ls_int_progresscalc * (i + 1)), "finished " + i.ToString() + "total " + resultFile.List_OTSField.Count.ToString() + "field...");
 
 
-                Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };//get OTS coordination
+                PointF thisfield_point = new PointF() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };//get OTS coordination
 
 
-                Point offset_point = imageDisHelper.ConvertOTSCoordToScreenCoord(thisfield_point);//the ots coordinate is always the up right positive.
-                DisplayField df;
+                PointF offset_point = imageDisHelper.ConvertOTSCoordToScreenCoord(thisfield_point);//the ots coordinate is always the up right positive.
+                DisplayRectangle df;
                 try
                 try
                 {
                 {
 
 
-                    df = new DisplayField(fieldlist[i], (int)fieldSize.Width, (int)fieldSize.Height, resultFile.GetPixelSize(), offset_point);
+                    df = new DisplayRectangle(fieldlist[i], fieldSize.Width,fieldSize.Height, resultFile.GetPixelSize(), offset_point);
                     df.ContentColor = Color.Black;
                     df.ContentColor = Color.Black;
                     m_list_allDfield.Add(df);
                     m_list_allDfield.Add(df);
                 }
                 }
@@ -414,7 +416,7 @@ namespace OTSIncAReportGraph.Controls
             double dia_min = Convert.ToDouble(min);
             double dia_min = Convert.ToDouble(min);
             double dia_max = Convert.ToDouble(max);
             double dia_max = Convert.ToDouble(max);
 
 
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (DisplayParticle ls_dp in a_field.List_DParticle)
                 foreach (DisplayParticle ls_dp in a_field.List_DParticle)
                 {
                 {
@@ -515,7 +517,7 @@ namespace OTSIncAReportGraph.Controls
                 case DISTRIBUTION_IMAGE_SHOW_MODE.BSE:
                 case DISTRIBUTION_IMAGE_SHOW_MODE.BSE:
 
 
                     e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), m_backRect);
                     e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), m_backRect);
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         foreach (DisplayParticle dp in a_field.List_DParticle)
                         foreach (DisplayParticle dp in a_field.List_DParticle)
                         {
                         {
@@ -533,7 +535,7 @@ namespace OTSIncAReportGraph.Controls
 
 
                     e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), m_backRect);
                     e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), m_backRect);
 
 
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         foreach (DisplayParticle dp in a_field.List_DParticle)
                         foreach (DisplayParticle dp in a_field.List_DParticle)
                         {
                         {
@@ -547,7 +549,7 @@ namespace OTSIncAReportGraph.Controls
                     }
                     }
                     break;
                     break;
                 case DISTRIBUTION_IMAGE_SHOW_MODE.ORIGINAl:
                 case DISTRIBUTION_IMAGE_SHOW_MODE.ORIGINAl:
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         foreach (DisplayParticle ls_dp in a_field.List_DParticle)
                         foreach (DisplayParticle ls_dp in a_field.List_DParticle)
                         {
                         {
@@ -558,7 +560,7 @@ namespace OTSIncAReportGraph.Controls
                     break;
                     break;
                 case DISTRIBUTION_IMAGE_SHOW_MODE.ORIGINALCLASSIFIED:
                 case DISTRIBUTION_IMAGE_SHOW_MODE.ORIGINALCLASSIFIED:
                     DrawOriginalImageAsBackground(e);
                     DrawOriginalImageAsBackground(e);
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         foreach (DisplayParticle dp in a_field.List_DParticle)
                         foreach (DisplayParticle dp in a_field.List_DParticle)
                         {
                         {
@@ -585,6 +587,13 @@ namespace OTSIncAReportGraph.Controls
                     f.OnPaint(e, Color.Red);
                     f.OnPaint(e, Color.Red);
                 }
                 }
             }
             }
+            if (m_CurGBParticles.Count > 0)
+            {
+                foreach (var f in m_CurGBParticles)
+                {
+                    f.OnPaint(e, Color.Blue);
+                }
+            }
             #region 绘制网格线,帧图边框部份
             #region 绘制网格线,帧图边框部份
             if (true == m_is_showgrid)
             if (true == m_is_showgrid)
             {
             {
@@ -677,7 +686,7 @@ namespace OTSIncAReportGraph.Controls
             m_backRect.X = refPoint.X + xShift;
             m_backRect.X = refPoint.X + xShift;
             m_backRect.Y = refPoint.Y + yShift;
             m_backRect.Y = refPoint.Y + yShift;
 
 
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 for (int i = 0; i < a_field.List_DParticle.Count(); i++)
                 for (int i = 0; i < a_field.List_DParticle.Count(); i++)
                 {
                 {
@@ -698,7 +707,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                 {
                     for (int i = 0; i < m_list_allDfield.Count; i++)
                     for (int i = 0; i < m_list_allDfield.Count; i++)
                     {
                     {
-                        DisplayField theField = m_list_allDfield[i];
+                        DisplayRectangle theField = m_list_allDfield[i];
                         theField.Zoom(zoomDelta, refPoint);
                         theField.Zoom(zoomDelta, refPoint);
 
 
                     }
                     }
@@ -715,6 +724,17 @@ namespace OTSIncAReportGraph.Controls
 
 
                 }
                 }
 
 
+            }
+            if (m_CurGBParticles.Count > 0)
+            {
+
+                for (int i = 0; i < m_CurGBParticles.Count; i++)
+                {
+                    var r = m_CurGBParticles[i];
+                    r.Zoom(zoomDelta, refPoint);
+
+                }
+
             }
             }
 
 
             #region 计算标尺尺寸部份-----放大------
             #region 计算标尺尺寸部份-----放大------
@@ -771,7 +791,7 @@ namespace OTSIncAReportGraph.Controls
                 else
                 else
                 {
                 {
                     bool ifClickOnParticle = false;
                     bool ifClickOnParticle = false;
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         if (imageDisHelper.WhetherInRange(a_field, e.Location))
                         if (imageDisHelper.WhetherInRange(a_field, e.Location))
                         {
                         {
@@ -789,7 +809,7 @@ namespace OTSIncAReportGraph.Controls
                     }
                     }
                     if (ifClickOnParticle == false)
                     if (ifClickOnParticle == false)
                     {
                     {
-                        foreach (DisplayField item in m_list_allDfield)
+                        foreach (DisplayRectangle item in m_list_allDfield)
                         {
                         {
                             item.IsDragging = true;
                             item.IsDragging = true;
                             item.DraggingPoint = e.Location;
                             item.DraggingPoint = e.Location;
@@ -808,7 +828,12 @@ namespace OTSIncAReportGraph.Controls
                                 dp.DraggingPoint = e.Location;
                                 dp.DraggingPoint = e.Location;
                             }
                             }
                         }
                         }
-                        foreach (DisplayField item in m_CurGBFields)
+                        foreach (DisplayRectangle item in m_CurGBFields)
+                        {
+                            item.IsDragging = true;
+                            item.DraggingPoint = e.Location;
+                        }
+                        foreach (DisplayRectangle item in m_CurGBParticles)
                         {
                         {
                             item.IsDragging = true;
                             item.IsDragging = true;
                             item.DraggingPoint = e.Location;
                             item.DraggingPoint = e.Location;
@@ -893,6 +918,14 @@ namespace OTSIncAReportGraph.Controls
                             item.DraggingMove(e.Location);
                             item.DraggingMove(e.Location);
                         }
                         }
                     }
                     }
+                    foreach (var item in m_CurGBParticles)
+                    {
+                        if (item.IsDragging)
+                        {
+
+                            item.DraggingMove(e.Location);
+                        }
+                    }
                     //同样重新计算backrectf的坐标
                     //同样重新计算backrectf的坐标
                     m_backRect = new RectangleF(m_backRect.Location.X + e.X - m_beforedrag_pointf.X,
                     m_backRect = new RectangleF(m_backRect.Location.X + e.X - m_beforedrag_pointf.X,
                          m_backRect.Location.Y + e.Y - m_beforedrag_pointf.Y, m_backRect.Width, m_backRect.Height);
                          m_backRect.Location.Y + e.Y - m_beforedrag_pointf.Y, m_backRect.Width, m_backRect.Height);
@@ -902,7 +935,7 @@ namespace OTSIncAReportGraph.Controls
                 }
                 }
                 else
                 else
                 {
                 {
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
 
 
                         foreach (DisplayParticle item in a_field.List_DParticle)
                         foreach (DisplayParticle item in a_field.List_DParticle)
@@ -1036,7 +1069,7 @@ namespace OTSIncAReportGraph.Controls
 
 
                         }
                         }
 
 
-                        foreach (DisplayField a_field in m_list_allDfield)
+                        foreach (DisplayRectangle a_field in m_list_allDfield)
                         {
                         {
                             foreach (DisplayParticle dp in a_field.List_DParticle)
                             foreach (DisplayParticle dp in a_field.List_DParticle)
                             {
                             {
@@ -1107,7 +1140,7 @@ namespace OTSIncAReportGraph.Controls
                     if (m_isDrag)
                     if (m_isDrag)
                     {
                     {
 
 
-                        foreach (DisplayField a_field in m_list_allDfield)
+                        foreach (DisplayRectangle a_field in m_list_allDfield)
                         {
                         {
                             foreach (DisplayParticle dp in a_field.List_DParticle)
                             foreach (DisplayParticle dp in a_field.List_DParticle)
                             {
                             {
@@ -1147,7 +1180,7 @@ namespace OTSIncAReportGraph.Controls
                 bool ifClickOnParticle = false;
                 bool ifClickOnParticle = false;
 
 
                 
                 
-                foreach (DisplayField a_field in m_list_allDfield)
+                foreach (DisplayRectangle a_field in m_list_allDfield)
                 {
                 {
                     if (imageDisHelper.WhetherInRange(a_field, e.Location))
                     if (imageDisHelper.WhetherInRange(a_field, e.Location))
                     {
                     {
@@ -1355,7 +1388,7 @@ namespace OTSIncAReportGraph.Controls
             {
             {
                 return;
                 return;
             }
             }
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 for (int i = 0; i < particles.Count; i++)
                 for (int i = 0; i < particles.Count; i++)
                 {
                 {
@@ -1608,7 +1641,7 @@ namespace OTSIncAReportGraph.Controls
             //同样重新计算backrectf的坐标
             //同样重新计算backrectf的坐标
             m_backRect = new RectangleF(in_pointf.X, in_pointf.Y,
             m_backRect = new RectangleF(in_pointf.X, in_pointf.Y,
                  m_backRect.Width, m_backRect.Height);
                  m_backRect.Width, m_backRect.Height);
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 for (int i = 0; i < a_field.List_DParticle.Count; i++)
                 for (int i = 0; i < a_field.List_DParticle.Count; i++)
                 {
                 {
@@ -1643,6 +1676,12 @@ namespace OTSIncAReportGraph.Controls
                 f.Move(offex_p);
                 f.Move(offex_p);
 
 
             }
             }
+            for (int i = 0; i < m_CurGBParticles.Count; i++)
+            {
+                var f = m_CurGBParticles[i];
+                f.Move(offex_p);
+
+            }
 
 
 
 
             Invalidate();
             Invalidate();
@@ -1729,7 +1768,7 @@ namespace OTSIncAReportGraph.Controls
         /// </summary>
         /// </summary>
         public void ReverseSelection()
         public void ReverseSelection()
         {
         {
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (DisplayParticle dp in a_field.List_DParticle)
                 foreach (DisplayParticle dp in a_field.List_DParticle)
                 {
                 {
@@ -1755,7 +1794,7 @@ namespace OTSIncAReportGraph.Controls
         /// </summary>
         /// </summary>
         public void DeselectAllParticle()
         public void DeselectAllParticle()
         {
         {
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (DisplayParticle dp in a_field.List_DParticle)
                 foreach (DisplayParticle dp in a_field.List_DParticle)
                 {
                 {
@@ -1764,7 +1803,7 @@ namespace OTSIncAReportGraph.Controls
 
 
                 }
                 }
             }
             }
-
+            m_CurGBParticles.Clear();
 
 
 
 
             this.Invalidate();
             this.Invalidate();
@@ -1806,7 +1845,7 @@ namespace OTSIncAReportGraph.Controls
         public int GetParticleNumberByState(PaintState in_ParticleState)
         public int GetParticleNumberByState(PaintState in_ParticleState)
         {
         {
             int icount = 0;
             int icount = 0;
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (DisplayParticle dp in a_field.List_DParticle)
                 foreach (DisplayParticle dp in a_field.List_DParticle)
                 {
                 {
@@ -1900,7 +1939,7 @@ namespace OTSIncAReportGraph.Controls
             DialogResult dr = MessageBox.Show("Remove all these particles permanently?", "Tips", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             DialogResult dr = MessageBox.Show("Remove all these particles permanently?", "Tips", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (dr == DialogResult.OK)
             if (dr == DialogResult.OK)
             {
             {
-                foreach (DisplayField a_field in m_list_allDfield)
+                foreach (DisplayRectangle a_field in m_list_allDfield)
                 {
                 {
                     foreach (var p in a_field.List_DParticle)
                     foreach (var p in a_field.List_DParticle)
                     {
                     {
@@ -1927,7 +1966,7 @@ namespace OTSIncAReportGraph.Controls
 
 
         public void DeletesParticlesSynchronously(List<Particle> list_Part)
         public void DeletesParticlesSynchronously(List<Particle> list_Part)
         {
         {
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (var p_Selected in list_Part)
                 foreach (var p_Selected in list_Part)
                 {
                 {
@@ -1984,7 +2023,7 @@ namespace OTSIncAReportGraph.Controls
         }
         }
         public bool WhetherThereAreDeleteParticles()
         public bool WhetherThereAreDeleteParticles()
         {
         {
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (var p in a_field.List_DParticle)
                 foreach (var p in a_field.List_DParticle)
                 {
                 {
@@ -2099,14 +2138,14 @@ namespace OTSIncAReportGraph.Controls
                 {
                 {
                     foreach (DataRow r in tbl.Rows)
                     foreach (DataRow r in tbl.Rows)
                     {
                     {
-                        Point p = new Point(Convert.ToInt32(r["fieldX"]), Convert.ToInt32(r["fieldY"]));
+                        PointF p = new PointF(Convert.ToSingle( r["fieldX"]),Convert.ToSingle(r["fieldY"]));
 
 
-                        Point screenP = imageDisHelper.ConvertOTSCoordToScreenCoord(p);
+                        PointF screenP = imageDisHelper.ConvertOTSCoordToScreenCoord(p);
 
 
-                        int gbfldwidth = Convert.ToInt32(710.0 / imageDisHelper.m_pixelSize);
+                        float gbfldwidth = (float)((float)710.0 / imageDisHelper.m_pixelSize);
 
 
 
 
-                        var df = new DisplayField(gbfldwidth, gbfldwidth, p, screenP);
+                        var df = new DisplayRectangle(gbfldwidth, gbfldwidth, p, screenP);
 
 
 
 
                         df.Zoom(m_zoom_record - 1, new PointF(0, 0));
                         df.Zoom(m_zoom_record - 1, new PointF(0, 0));
@@ -2159,14 +2198,15 @@ namespace OTSIncAReportGraph.Controls
                     foreach (DataRow r in tbl.Rows)
                     foreach (DataRow r in tbl.Rows)
                     {
                     {
                         int fid = Convert.ToInt32(r["fieldId"]);
                         int fid = Convert.ToInt32(r["fieldId"]);
-                        int pid = Convert.ToInt32(r["particleId"]);
-                        foreach (DisplayField a_field in m_list_allDfield)
+                        string pid =Convert.ToString( r["particleId"]);
+                        string[] partid = pid.Split(':');
+                        foreach (DisplayRectangle a_field in m_list_allDfield)
                         {
                         {
                             if (int.Parse(a_field.FieldID) == fid)
                             if (int.Parse(a_field.FieldID) == fid)
                             {
                             {
                                 foreach (var p in a_field.List_DParticle)
                                 foreach (var p in a_field.List_DParticle)
                                 {
                                 {
-                                    if (p.objParticleData.ParticleId == pid)
+                                    if (p.objParticleData.ParticleId == Convert.ToInt32( partid[1]))
                                     {
                                     {
                                         p.IsSelect = true;
                                         p.IsSelect = true;
                                         break;
                                         break;
@@ -2188,6 +2228,7 @@ namespace OTSIncAReportGraph.Controls
         private void 清除ToolStripMenuItem_Click(object sender, EventArgs e)
         private void 清除ToolStripMenuItem_Click(object sender, EventArgs e)
         {
         {
             m_CurGBFields.Clear();
             m_CurGBFields.Clear();
+            m_CurGBParticles.Clear();
             Invalidate();
             Invalidate();
         }
         }
 
 
@@ -2228,7 +2269,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                 {
                     bool deleteflag = true;
                     bool deleteflag = true;
 
 
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         foreach (var p in a_field.List_DParticle)
                         foreach (var p in a_field.List_DParticle)
                         {
                         {
@@ -2334,7 +2375,7 @@ namespace OTSIncAReportGraph.Controls
             clr_prop.SetDataSourceId(index);//
             clr_prop.SetDataSourceId(index);//
 
 
             clr_prop.SetType((int)DisplayPicutureType.AnalyzeDataTable);//table
             clr_prop.SetType((int)DisplayPicutureType.AnalyzeDataTable);//table
-            DisplayField curfld = new DisplayField(1024,768,new Point(0,0),new Point(0,0));
+            DisplayRectangle curfld = new DisplayRectangle(1024,768,new Point(0,0),new Point(0,0));
             foreach (var f in m_CurGBFields)
             foreach (var f in m_CurGBFields)
             {
             {
                 if (imageDisHelper.WhetherInRange(f, m_currentMouseDownPoint))
                 if (imageDisHelper.WhetherInRange(f, m_currentMouseDownPoint))
@@ -2363,7 +2404,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                 {
                     int fid = Convert.ToInt32(r["fieldId"]);
                     int fid = Convert.ToInt32(r["fieldId"]);
                     int pid = Convert.ToInt32(r["particleId"]);
                     int pid = Convert.ToInt32(r["particleId"]);
-                    foreach (DisplayField a_field in m_list_allDfield)
+                    foreach (DisplayRectangle a_field in m_list_allDfield)
                     {
                     {
                         if (int.Parse(a_field.FieldID) == fid)
                         if (int.Parse(a_field.FieldID) == fid)
                         {
                         {
@@ -2384,40 +2425,93 @@ namespace OTSIncAReportGraph.Controls
 
 
             Invalidate();
             Invalidate();
         }
         }
-
-        private void aToolStripMenuItem_Click(object sender, EventArgs e)
+        private void DisplayGBParticles(string parttype)
         {
         {
-            Cursor = Cursors.WaitCursor;
-           
             var tbl = GetAllPartsOfCurrentGBField();
             var tbl = GetAllPartsOfCurrentGBField();
+
             if (tbl.Rows.Count > 0)
             if (tbl.Rows.Count > 0)
             {
             {
                 foreach (DataRow r in tbl.Rows)
                 foreach (DataRow r in tbl.Rows)
                 {
                 {
                     int fid = Convert.ToInt32(r["fieldId"]);
                     int fid = Convert.ToInt32(r["fieldId"]);
-                    int pid = Convert.ToInt32(r["particleId"]);
-                    var typestr =Convert.ToString( r["gbClassify"]);
-                    if (typestr == "A")
+                    string pid = Convert.ToString(r["particleId"]);
+                    string[] GBpartsid = pid.Split(' ');
+                    var typestr = Convert.ToString(r["gbClassify"]);
+                    List<DisplayParticle> parts = new List<DisplayParticle>();
+                    if (typestr == parttype)
                     {
                     {
-                        foreach (DisplayField a_field in m_list_allDfield)
+                        foreach (DisplayRectangle a_field in m_list_allDfield)
                         {
                         {
-                            if (int.Parse(a_field.FieldID) == fid)
+
+                            foreach (var p1 in a_field.List_DParticle)
                             {
                             {
-                                foreach (var p in a_field.List_DParticle)
+                                string partid = a_field.FieldID.ToString() + ":" + p1.objParticleData.ParticleId.ToString();
+                                if (GBpartsid.Contains(partid))
                                 {
                                 {
-                                    if (p.objParticleData.FieldId == fid && p.objParticleData.ParticleId == pid)
-                                    {
-                                        p.IsSelect = true;
-                                        break;
-                                    }
+
+                                    parts.Add(p1);
+
                                 }
                                 }
+
+                            }
+                        }
+                        var pfirst = parts[0];
+                        float top = pfirst.OTSRect.GetTopLeft().Y;
+                        float bottom = pfirst.OTSRect.GetBottomRight().Y;
+                        float left = pfirst.OTSRect.GetTopLeft().X;
+                        float right = pfirst.OTSRect.GetBottomRight().X;
+                        foreach (var p2 in parts)
+                        {
+                            if (p2.OTSRect.GetTopLeft().Y > top)
+                            {
+                                top = p2.OTSRect.GetTopLeft().Y;
+                            }
+                            if (p2.OTSRect.GetTopLeft().X < left)
+                            {
+                                left = p2.OTSRect.GetTopLeft().X;
+                            }
+                            if (p2.OTSRect.GetBottomRight().X > right)
+                            {
+                                right = p2.OTSRect.GetBottomRight().X;
+                            }
+                            if (p2.OTSRect.GetBottomRight().Y < bottom)
+                            {
+                                bottom = p2.OTSRect.GetBottomRight().Y;
                             }
                             }
                         }
                         }
+                        COTSRect rec = new COTSRect(left, top, right, bottom);
+
+
+                        PointF otsPos = new PointF(rec.GetCenterPoint().X, rec.GetCenterPoint().Y);
+                        PointF screenP = imageDisHelper.ConvertOTSCoordToScreenCoord(otsPos);
+
+                        double gbpartwidth = ((right - left) / imageDisHelper.m_pixelSize);
+                        double gbpartheight = ((top - bottom) / imageDisHelper.m_pixelSize);
+
+
+                        var gbprec = new DisplayRectangle((float)gbpartwidth, (float)gbpartheight, otsPos, screenP);
+
+
+                        gbprec.Zoom(m_zoom_record - 1, new PointF(0, 0));
+
+
+
+                        gbprec.Move(new SizeF(-m_backRect.X, -m_backRect.Y));
+
+
+                        m_CurGBParticles.Add(gbprec);
                     }
                     }
-                    
+
                 }
                 }
             }
             }
 
 
+        }
+        private void aToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            Cursor = Cursors.WaitCursor;
+
+            DisplayGBParticles("A");
+
             Cursor = Cursors.Default;
             Cursor = Cursors.Default;
 
 
             Invalidate();
             Invalidate();
@@ -2426,33 +2520,7 @@ namespace OTSIncAReportGraph.Controls
         private void bToolStripMenuItem_Click(object sender, EventArgs e)
         private void bToolStripMenuItem_Click(object sender, EventArgs e)
         {
         {
             Cursor = Cursors.WaitCursor;
             Cursor = Cursors.WaitCursor;
-            var tbl = GetAllPartsOfCurrentGBField();
-            if (tbl.Rows.Count > 0)
-            {
-                foreach (DataRow r in tbl.Rows)
-                {
-                    int fid = Convert.ToInt32(r["fieldId"]);
-                    int pid = Convert.ToInt32(r["particleId"]);
-                    var typestr = Convert.ToString(r["gbClassify"]);
-                    if (typestr == "B")
-                    {
-                        foreach (DisplayField a_field in m_list_allDfield)
-                        {
-                            if (int.Parse(a_field.FieldID) == fid)
-                            {
-                                foreach (var p in a_field.List_DParticle)
-                                {
-                                    if (p.objParticleData.FieldId == fid && p.objParticleData.ParticleId == pid)
-                            {
-                                p.IsSelect = true;
-                                break;
-                            }}}
-
-                        }
-                    }
-
-                }
-            }
+            DisplayGBParticles("B");
 
 
             Cursor = Cursors.Default;
             Cursor = Cursors.Default;
 
 
@@ -2463,34 +2531,7 @@ namespace OTSIncAReportGraph.Controls
         {
         {
             Cursor = Cursors.WaitCursor;
             Cursor = Cursors.WaitCursor;
 
 
-            var tbl = GetAllPartsOfCurrentGBField();
-            if (tbl.Rows.Count > 0)
-            {
-                foreach (DataRow r in tbl.Rows)
-                {
-                    int fid = Convert.ToInt32(r["fieldId"]);
-                    int pid = Convert.ToInt32(r["particleId"]);
-                    var typestr = Convert.ToString(r["gbClassify"]);
-                    if (typestr == "C")
-                    {
-                        foreach (DisplayField a_field in m_list_allDfield)
-                        {
-                            if (int.Parse(a_field.FieldID) == fid)
-                            {
-                                foreach (var p in a_field.List_DParticle)
-                                {
-                                    if (p.objParticleData.FieldId == fid && p.objParticleData.ParticleId == pid)
-                                    {
-                                        p.IsSelect = true;
-                                        break;
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                }
-            }
+            DisplayGBParticles("C");
 
 
             Cursor = Cursors.Default;
             Cursor = Cursors.Default;
 
 
@@ -2501,34 +2542,7 @@ namespace OTSIncAReportGraph.Controls
         {
         {
             Cursor = Cursors.WaitCursor;
             Cursor = Cursors.WaitCursor;
 
 
-            var tbl = GetAllPartsOfCurrentGBField();
-            if (tbl.Rows.Count > 0)
-            {
-                foreach (DataRow r in tbl.Rows)
-                {
-                    int fid = Convert.ToInt32(r["fieldId"]);
-                    int pid = Convert.ToInt32(r["particleId"]);
-                    var typestr = Convert.ToString(r["gbClassify"]);
-                    if (typestr == "D")
-                    {
-                        foreach (DisplayField a_field in m_list_allDfield)
-                        {
-                            if (int.Parse(a_field.FieldID) == fid)
-                            {
-                                foreach (var p in a_field.List_DParticle)
-                                {
-                                    if (p.objParticleData.FieldId == fid && p.objParticleData.ParticleId == pid)
-                                    {
-                                        p.IsSelect = true;
-                                        break;
-                                    }
-                                }}
-
-                        }
-                    }
-
-                }
-            }
+            DisplayGBParticles("D");
 
 
             Cursor = Cursors.Default;
             Cursor = Cursors.Default;
 
 
@@ -2629,7 +2643,7 @@ namespace OTSIncAReportGraph.Controls
         {
         {
             DisplayParticle selpart = new DisplayParticle();
             DisplayParticle selpart = new DisplayParticle();
             var overlap = resultFile.GetOverlapParam();
             var overlap = resultFile.GetOverlapParam();
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (var p in a_field.List_DParticle)
                 foreach (var p in a_field.List_DParticle)
                 {
                 {
@@ -2647,7 +2661,7 @@ namespace OTSIncAReportGraph.Controls
             var selpartPos = selpart.OTSRect.GetCenterPoint();
             var selpartPos = selpart.OTSRect.GetCenterPoint();
 
 
             var selpartclrobj = GetParticleclrObjFromParticleData(selpart);
             var selpartclrobj = GetParticleclrObjFromParticleData(selpart);
-            foreach (DisplayField a_field in m_list_allDfield)
+            foreach (DisplayRectangle a_field in m_list_allDfield)
             {
             {
                 foreach (var otherP in a_field.List_DParticle)
                 foreach (var otherP in a_field.List_DParticle)
                 {
                 {

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Graph/Controls/OutPIC.cs

@@ -20,7 +20,7 @@ namespace OTSIncAReportApp._3_ServiceCenter
     {
     {
         public OTSIncAReportApp.frmReportApp m_ReportApp;
         public OTSIncAReportApp.frmReportApp m_ReportApp;
         //包含particle的field的列表对象
         //包含particle的field的列表对象
-        public List<DisplayField> m_list_allDfield = null;
+        public List<DisplayRectangle> m_list_allDfield = null;
         public ResultFile resultFile = null;
         public ResultFile resultFile = null;
         public SaveFileDialog sfd = null;
         public SaveFileDialog sfd = null;
         public DataTable ParticleData = new DataTable();
         public DataTable ParticleData = new DataTable();

+ 6 - 6
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -145,17 +145,17 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             return new Point(i_offset_x + fieldwidth / 2, i_offset_y + fieldheight / 2);//the field pos is the center point position.
             return new Point(i_offset_x + fieldwidth / 2, i_offset_y + fieldheight / 2);//the field pos is the center point position.
         }
         }
 
 
-        public Point ConvertOTSCoordToScreenCoord( Point currenFldOTSPos)//
+        public PointF ConvertOTSCoordToScreenCoord( PointF currenFldOTSPos)//
         {
         {
            
            
-            var OTSPoint=new Point(currenFldOTSPos.X - OTSLeftBottomPoint.X, currenFldOTSPos.Y - OTSLeftBottomPoint.Y);
+            var OTSPoint=new PointF(currenFldOTSPos.X - OTSLeftBottomPoint.X, currenFldOTSPos.Y - OTSLeftBottomPoint.Y);
 
 
             int screenHeight = (int)m_originalBackRect.Height + (0 - (int)(Convert.ToDouble(OTSPoint.Y) / m_pixelSize));//because the screen coordinate is downward rightward positive,so we need to translate the Y coordinate of the OTS system which is upward rightward positive.
             int screenHeight = (int)m_originalBackRect.Height + (0 - (int)(Convert.ToDouble(OTSPoint.Y) / m_pixelSize));//because the screen coordinate is downward rightward positive,so we need to translate the Y coordinate of the OTS system which is upward rightward positive.
            
            
-            var screenPoint = new Point((int)(Convert.ToDouble(OTSPoint.X)/m_pixelSize), (int)(screenHeight));
+            var screenPoint = new PointF(OTSPoint.X/(float)m_pixelSize, Convert.ToSingle(screenHeight));
 
 
             //var curP = new Point((int)(screenPoint.X + m_wholeBackRect.X), (int)(screenPoint.Y + m_wholeBackRect.Y));
             //var curP = new Point((int)(screenPoint.X + m_wholeBackRect.X), (int)(screenPoint.Y + m_wholeBackRect.Y));
-            var curP = new Point((int)(screenPoint.X + m_originalBackRect.X), (int)(screenPoint.Y + m_originalBackRect.Y));
+            var curP = new PointF((screenPoint.X + m_originalBackRect.X), (screenPoint.Y + m_originalBackRect.Y));
 
 
             return curP;
             return curP;
         }
         }
@@ -345,7 +345,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         /// </summary>
         /// </summary>
         /// <param name="in_fieldid"></param>
         /// <param name="in_fieldid"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public Point GetOTSPointByFieldID(List<DisplayField> in_list_dfield, int in_fieldid)
+        public Point GetOTSPointByFieldID(List<DisplayRectangle> in_list_dfield, int in_fieldid)
         {
         {
             Point ret_point = new Point(0, 0);
             Point ret_point = new Point(0, 0);
             for (int i = 0; i < in_list_dfield.Count; i++)
             for (int i = 0; i < in_list_dfield.Count; i++)
@@ -507,7 +507,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
                 return false;
                 return false;
             }
             }
         }
         }
-        public bool WhetherInRange(DisplayField field, PointF WhetherPoint)
+        public bool WhetherInRange(DisplayRectangle field, PointF WhetherPoint)
         {
         {
             var rect = field.GetShowRect();
             var rect = field.GetShowRect();
             if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
             if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))

+ 0 - 251
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayField.cs

@@ -1,251 +0,0 @@
-using OTSCommon.Model;
-using OTSIncAReportGraph.Class;
-using OTSMeasureApp._0_OTSModel.OTSDataType;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-
-using System.Windows.Forms;
-
-namespace OTSIncAReportGraph
-{
-
-    public class DisplayField
-    {
-        Guid  m_id;
-        Color disColor;
-        string m_fieldid;
-        bool m_IsDragging;
-        public string gradeString="";
-     
-        List<DisplayParticle> m_list_dparticle;
-        private float m_currentZoom=1;
- 
-        PointF m_ots_point;  //按底层设计结构,底层返回的物理坐标位置及大小,OTS坐标大小
- 
-        RectangleF m_Rect;//最后换算到在显示器上显示的坐标位置大小    
-        PointF m_dragingpoint;//鼠标拖动的位置
-       public COTSRect myOTSRect = new COTSRect();
-        private Bitmap m_originalImage;
-        public enum RemoveParticleType
-        {
-            INVALID = -1,
-            MIN = 0,
-            UNCLASSIFY = 0,
-            NOT_USE2 = 1,
-            AVE_GRAY_NOT_INRANRE = 2,
-            SEARCH_X_RAY = 3,
-            LOW_COUNT = 4,
-            NO_INTEREST_ELEMENTS = 5,
-            NO_ANALYSIS_X_RAY = 6,
-            ISNOT_INCLUTION = 7,
-            NOT_USE = 8,
-            NOT_IDENTIFIED = 9,
-            IDENTIFIED = 10,//当为可识别类型时(10),可以被进一步识别为用户类型(1000以上),系统预定义类型(10000以上),所以最终颗粒类型不会为10,最终的组号可能为7,9(非夹杂物和未识别)或其他预定义的组,ID号则为识别出的ID号
-            MAX = 10,
-        }
-
-        const int INVALIDPARTICLE= -1;
-        /// <summary>
-        /// 构造函数
-        /// </summary>
-        public DisplayField(Field fld, int fldwidth, int fldheight,double pixelSize,Point screenPos)
-        {
-         
-            m_list_dparticle = new List<DisplayParticle>();
-       
-            m_id = System.Guid.NewGuid();
-            Point thisfield_point = new Point() { X = fld.FieldPosX, Y = fld.FieldPosY };
-           
-            FieldID = fld.FieldID.ToString();
-            var ltPoint = new Point(screenPos.X - fldwidth / 2, screenPos.Y -fldheight / 2);
-            SetShow_Rect(new Rectangle(ltPoint, new Size(fldwidth, fldheight)));
-
-            OTSCoordinatePos = new PointF(thisfield_point.X, thisfield_point.Y);
-            double left = OTSCoordinatePos.X - fldwidth * pixelSize / 2;
-            double right = OTSCoordinatePos.X + fldwidth * pixelSize / 2;
-            double top = OTSCoordinatePos.Y + fldheight * pixelSize / 2;
-            double bottom = OTSCoordinatePos.Y + fldheight * pixelSize / 2;
-            myOTSRect.SetRectData( (int)left,(int)top,(int)right,(int)bottom);
-
-            //先获取该Field中的所有Particle
-            List<Particle> list_particle;
-            list_particle = fld.ParticleList;
-           
-            //然后将取出的数据,转换成Bitmap对象
-            m_originalImage = DrawFunction.ReadImageFile(fld.FieldImageName);
-
-            Bitmap dpImage = new Bitmap(fldwidth, fldheight);
-            //再循环计算所有的Particle对象
-            foreach (Particle particle in list_particle)
-            {
-                //分布图排列图无效颗粒不显示
-                if (particle.TypeId == (int)RemoveParticleType.INVALID|| particle.TypeId == (int)RemoveParticleType.LOW_COUNT)
-                {
-                    continue;
-                }
-                //创建DParticle颗粒
-                DisplayParticle dp = new DisplayParticle(particle, ltPoint, m_originalImage,dpImage);
-                double partLeft=dp.objParticleData.RectLeft*pixelSize+myOTSRect.GetTopLeft().X;
-                double partRight = partLeft+dp.objParticleData.RectWidth*pixelSize;
-                double partTop = myOTSRect.GetTopLeft().Y - dp.objParticleData.RectTop * pixelSize;
-                double partBottom = partTop - dp.objParticleData.RectHeight * pixelSize;
-                dp.OTSRect.SetRectData((int)partLeft, (int)partTop, (int)partRight, (int)partBottom);
-
-                m_list_dparticle.Add(dp);
-          
-
-            }
-
-
-
-
-
-        }
-
-        public DisplayField(List<DisplayParticle> in_list_dparticle)
-        {
-            m_list_dparticle = in_list_dparticle;
-        }
-
-        public DisplayField(int fldwidth, int fldheight,Point OTSPos, Point screenPos)
-        {
-            m_id = System.Guid.NewGuid();
-            var ltPoint = new Point(screenPos.X - fldwidth / 2, screenPos.Y - fldheight / 2);
-            SetShow_Rect(new Rectangle(ltPoint, new Size(fldwidth, fldheight)));
-            m_ots_point = OTSPos;
-        }
-
-        public void Zoom(float zoomDelta , PointF refPoint)
-        {
-            
-            m_Rect.Width += m_Rect.Width/ m_currentZoom * zoomDelta;
-            m_Rect.Height += m_Rect.Height/ m_currentZoom * zoomDelta;
-            //锚点缩放补差值计算,得出差值
-            float xShiftOld = m_Rect.X - refPoint.X;
-            float yShiftOld = m_Rect.Y - refPoint.Y;
-            float xShift = m_Rect.X - refPoint.X + xShiftOld/ m_currentZoom * zoomDelta;
-            float yShift = m_Rect.Y - refPoint.Y + yShiftOld/ m_currentZoom * zoomDelta;
-
-
-           
-            m_Rect.X = refPoint.X + xShift;
-            m_Rect.Y = refPoint.Y + yShift;
-
-            m_currentZoom += zoomDelta;
-
-        }
-        public void DraggingMove(PointF mousePoint)
-        {
-            m_Rect = new RectangleF(
-                           m_Rect.Left + Convert.ToSingle((mousePoint.X - DraggingPoint.X)),
-                          m_Rect.Top + Convert.ToSingle((mousePoint.Y - DraggingPoint.Y)),
-                          m_Rect.Width,
-                           m_Rect.Height);
-            DraggingPoint = mousePoint;
-        }
-        public void Move(SizeF xyShift)
-        {
-            m_Rect = new RectangleF(
-                           m_Rect.Left- Convert.ToSingle(xyShift.Width),
-                          m_Rect.Top - Convert.ToSingle(xyShift.Height),
-                          m_Rect.Width,
-                           m_Rect.Height);
-           
-        }
-        public  Guid guid { get => m_id; set => m_id = value; }
-
-        /// <summary>
-        /// 是否被拖动标识
-        /// </summary>
-
-
-        public  bool IsDragging { get => m_IsDragging; set => m_IsDragging = value; }
-
-        /// <summary>
-        /// 被拖动到的位置坐标
-        /// </summary>
-
-
-        public  PointF DraggingPoint { get => m_dragingpoint; set => m_dragingpoint = value; }
-
-        /// <summary>
-        /// 与底层对应的ID,这里叫成FieldID
-        /// </summary>
-        public string FieldID
-        {
-            get { return m_fieldid; }
-            set { m_fieldid = value; }
-        }
-
-    
-
-        /// <summary>
-        /// 包含的Particle列表
-        /// </summary>
-        public List<DisplayParticle> List_DParticle
-        {
-            get { return m_list_dparticle; }
-            set { m_list_dparticle = value; }
-        }
-       
-        /// <summary>
-        /// 该Field的OTS坐标及大小
-        /// </summary>
-        public PointF OTSCoordinatePos
-        {
-            get { return m_ots_point; }
-            set { m_ots_point = value; }
-        }
-
-
-        /// <summary>
-        /// 该Field最后在屏幕上显示的坐标及大小
-        /// </summary>
-        public  RectangleF GetShowRect()
-        { return m_Rect; }
-
-        /// <summary>
-        /// 该Field最后在屏幕上显示的坐标及大小
-        /// </summary>
-        public void SetShow_Rect(RectangleF value)
-        { m_Rect = value; }
-
-
-
-
-
-
-        public Bitmap OriginalImage { get => m_originalImage; set => m_originalImage = value; }
-        public Color ContentColor { get => disColor; set =>disColor = value; }
-
-        public void OnPaint(PaintEventArgs e,Color bodyColor)
-        {
-            Graphics g = e.Graphics;
-            float w = 1;
-         
-            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);
-
-            if (gradeString != "")
-            {
-                SolidBrush solidBrush = new SolidBrush(Color.FromArgb(100, disColor));
-                //字体大小 根据样品孔Rectangle大小
-                float fontSize = m_Rect.Width / 20;
-                Font font = new Font("宋体", fontSize, FontStyle.Bold);
-                if (fontSize == 0)
-                {
-                    font = new Font("宋体", 5, FontStyle.Bold);
-                }
-              
-                RectangleF rectFont = m_Rect;
-                rectFont.X += 2;
-                rectFont.Y += 2;
-                g.DrawString(gradeString, font, solidBrush, rectFont);
-              
-            }
-        }
-    }
-}

+ 12 - 3
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayParticle.cs

@@ -141,7 +141,7 @@ namespace OTSIncAReportGraph
             this.Color = GetColorBySTDTypeIDForBSEAndSorImage(part.TypeColor, part.TypeId);
             this.Color = GetColorBySTDTypeIDForBSEAndSorImage(part.TypeColor, part.TypeId);
 
 
         }
         }
-        public DisplayParticle(Particle particle,Point FieldLeftTop,Bitmap originalFieldImage,Bitmap fieldParticleImage)
+        public DisplayParticle(Particle particle,PointF FieldLeftTop,Bitmap originalFieldImage,Bitmap fieldParticleImage)
         {
         {
          
          
             m_id = System.Guid.NewGuid();
             m_id = System.Guid.NewGuid();
@@ -162,7 +162,7 @@ namespace OTSIncAReportGraph
                 #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
                 #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
                 //对Particle里的Segment进行偏移的计算等,创建了DSegment的大小
                 //对Particle里的Segment进行偏移的计算等,创建了DSegment的大小
                 DisplaySegment ds = new DisplaySegment();
                 DisplaySegment ds = new DisplaySegment();
-                ds.SetShowRect(new Rectangle(seg.Start + FieldLeftTop.X,
+                ds.SetShowRect(new RectangleF(seg.Start + FieldLeftTop.X,
 
 
                     seg.Height + FieldLeftTop.Y,
                     seg.Height + FieldLeftTop.Y,
                     seg.Length,
                     seg.Length,
@@ -706,7 +706,16 @@ namespace OTSIncAReportGraph
             }
             }
             if (GetPaintState() == PaintState.CONCISEPAINT)
             if (GetPaintState() == PaintState.CONCISEPAINT)
             {
             {
-                g.DrawString("+", new Font("黑体", 6), new SolidBrush(Color.DarkSlateBlue), new PointF(m_smallRect.X, m_smallRect.Y));
+                if (m_isSelected)
+                {
+                    g.DrawString("+", new Font("黑体", 12), new SolidBrush(Color.Red), new PointF(m_smallRect.X, m_smallRect.Y));
+
+                }
+                else 
+                {
+                    g.DrawString("+", new Font("黑体", 6), new SolidBrush(Color.DarkSlateBlue), new PointF(m_smallRect.X, m_smallRect.Y));
+
+                }
             }
             }
 
 
             if (m_isSelected)
             if (m_isSelected)

+ 1 - 1
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -620,7 +620,7 @@
     <Compile Include="1-UI\OTSReportExport\Template\DataTemplate.Designer.cs">
     <Compile Include="1-UI\OTSReportExport\Template\DataTemplate.Designer.cs">
       <DependentUpon>DataTemplate.cs</DependentUpon>
       <DependentUpon>DataTemplate.cs</DependentUpon>
     </Compile>
     </Compile>
-    <Compile Include="2-CommonFunction\CommonClass\DisplayField.cs" />
+    <Compile Include="2-CommonFunction\CommonClass\DisplayRectangle.cs" />
     <Compile Include="2-CommonFunction\CommonClass\DisplayParticle.cs" />
     <Compile Include="2-CommonFunction\CommonClass\DisplayParticle.cs" />
     <Compile Include="2-CommonFunction\CommonClass\DisplaySegment.cs" />
     <Compile Include="2-CommonFunction\CommonClass\DisplaySegment.cs" />
     <Compile Include="2-CommonFunction\CommonClass\DragHelper.cs" />
     <Compile Include="2-CommonFunction\CommonClass\DragHelper.cs" />