Prechádzať zdrojové kódy

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

gsp 3 rokov pred
rodič
commit
820dbe784b

+ 1 - 1
Bin/x64/Debug/Config/SysData/OTSStage.stg

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="3">
+<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="1">
   <Collection RegName="Stagelist">
     <Member strName="圆形九圆孔50mm">
       <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,50000,0" shape="0:ROUND" />

+ 9 - 6
OTSCPP/OTSClassifyEngine/InclutionEngine/OTSClassifyEng.cpp

@@ -227,19 +227,22 @@ namespace OTSClassifyEngine
 
 		//FeO
 		if (dOMolar > MIN_DOUBLE_VALUE)
-		{  
+		{
 			// calculate molar % of Fe + O
 			double dMolarFe_O = Cal100NorValue(dOMolar + dFeMolar, a_dMolarSum + dCarbonMolar);
 			if (dMolarFe_O > FEO_MOLAR_CUTOFF)
 			{
+
 				if (a_listElementChemistries.size() == 2)//there is only Fe and O
 				{
-					// this is a FeO, not a inclusion, return FALSE
-					a_nIncId = OTS_PARTCLE_TYPE::ISNOT_INCLUTION;
-					notIncId = NOT_INCLUTION_ID::FeO;
-					return TRUE;
+					if (std::find_if(a_listElementChemistries.begin(), a_listElementChemistries.end(), [](CElementChemistryPtr i) {return ((i->GetName().CompareNoCase(STR_CR) != 0) && (i->GetName().CompareNoCase(STR_O) != 0)); }) != a_listElementChemistries.end())
+					{
+						//this is a FeO, not a inclusion, return FALSE
+						a_nIncId = OTS_PARTCLE_TYPE::ISNOT_INCLUTION;
+						notIncId = NOT_INCLUTION_ID::FeO;
+						return TRUE;
+					}
 				}
-				
 			}
 		}
 

+ 3 - 2
OTSCPP/OTSClassifyEngine/InclutionEngine/OTSClassifyEng.h

@@ -15,6 +15,7 @@ namespace OTSClassifyEngine
 	const CString STR_O = _T("O");
 	const CString STR_SUL = _T("S");
 	const CString STR_N = _T("N");
+	const CString STR_CR = _T("Cr");
 	const double SIC_MOLAR_CUTOFF = 85.0;
 	const double FEO_MOLAR_CUTOFF = 85.0;
 
@@ -28,12 +29,12 @@ namespace OTSClassifyEngine
 	};
 
 	// sub element
-	const long INC_SUB_ELEMENT_MAX = 13;
+	const long INC_SUB_ELEMENT_MAX = 12;
 	const double INC_SUB_ELEMENT_CUT_OFF = 0.02;	// weight%
 	const double INC_SUB_ELEMENT_TOTAL_100 = 5.0;	// molar value
 	const CString INC_SUB_ELEMENT_NAMES[INC_SUB_ELEMENT_MAX] =
 	{
-		_T("Mg"),_T("Al"),_T("Si"),_T("Ca"),_T("Ti"),_T("V"),_T("Cr"),_T("Mn"),_T("Zr"),_T("Nb"),_T("Mo"),_T("Ce"),_T("La")
+		_T("Mg"),_T("Al"),_T("Si"),_T("Ca"),_T("Ti"),_T("V"),_T("Mn"),_T("Zr"),_T("Nb"),_T("Mo"),_T("Ce"),_T("La")
 	};
 
 	// element 100 % molar value mapping cut off

+ 17 - 13
OTSIncAMeasureApp/0-OTSModel/Measure/BSEPicData/COTSFieldData.cs

@@ -301,19 +301,23 @@ namespace OTSModelSharp
         public bool PositionEquals(COTSFieldData a_oSource)          // CBSEImg& operator=(const CBSEImg&);        // =operator
         {
 
-            //var xoffSet = width * m_pixelSize / 3;
-            //var yoffset = height * m_pixelSize / 3;
-            //if (Math.Abs(OTSPos.X - a_oSource.m_otsPos.X) < xoffSet && Math.Abs(OTSPos.Y - a_oSource.m_otsPos.Y) < yoffset)
-            //{
-
-            //    return true;
-            //}
-            //else 
-            //{
-            //    return false;
-
-            //}
-            return OTSPos.X == a_oSource.m_otsPos.X && OTSPos.Y == a_oSource.m_otsPos.Y;
+            var xoffSet = width * m_pixelSize /2;
+            var yoffSet = height * m_pixelSize/2 ;
+            if (a_oSource.m_otsPos.X < (m_otsPos.X+xoffSet) && a_oSource.m_otsPos.X>( m_otsPos.X-xoffSet))
+            {
+                if (a_oSource.m_otsPos.Y < (m_otsPos.Y + yoffSet) && a_oSource.m_otsPos.Y > (m_otsPos.Y - yoffSet))
+                {
+                    return true;
+                }
+                return false;
+
+            }
+            else
+            {
+                return false;
+
+            }
+            //return OTSPos.X == a_oSource.m_otsPos.X && OTSPos.Y == a_oSource.m_otsPos.Y;
            
               
         }

+ 1 - 5
OTSIncAMeasureApp/0-OTSModel/Measure/DBDataTransition/IncADataDB.cs

@@ -24,9 +24,6 @@ namespace OTSModelSharp
 
         public KeyValuePair<string,SQLiteParameter[]> GetUpdataAIncACmd(COTSParticleClr a_pParticle)
         {
-
-
-
             string sSQLCommand = "Update IncAData set TypeId=@TypeId,TypeName= @TypeName,TypeColor=@TypeColor,GroupId=@GroupId,GroupName=@GroupName,GroupColor=@GroupColor where FieldID =@FieldId and ParticleId =@ParticleId ";  //sSQLCommand.Format(sSQLCommand,a_pParticle->GetAveGray(),a_pParticle->GetArea(),a_pParticle->GetType(),a_pParticle->GetFieldId(),a_pParticle->GetTagId());
             var paras = new SQLiteParameter[8];
             paras[0] = new SQLiteParameter("TypeId");
@@ -47,8 +44,6 @@ namespace OTSModelSharp
             paras[7] = new SQLiteParameter("ParticleId");
             paras[7].Value = a_pParticle.GetTagId();
 
-            
-
             return new KeyValuePair<string, SQLiteParameter[]>(sSQLCommand,paras);
         }
 
@@ -109,6 +104,7 @@ namespace OTSModelSharp
         public bool GetAllFieldsRecord(ref List<COTSFieldData> allFlds)
         {
             var allRecords = this.GetQueryOfAllRecord();
+            
             Dictionary<int, COTSFieldData> mapFld = new Dictionary<int, COTSFieldData>();                                       //std.map<int, COTSFieldDataPtr> mapFld = new std.map<int, COTSFieldDataPtr>();
             for (int i = 0; i < allRecords.Rows.Count; i++)
             {

+ 35 - 13
OTSIncAMeasureApp/0-OTSModel/Measure/ParamData/COTSMsrPrjResultData.cs

@@ -123,7 +123,7 @@ namespace OTSModelSharp
             //获取测量项目文件
             XmlDocument doc = new XmlDocument();
             //载入xml文件
-            doc.Load(strPathName);
+            doc.Load(strPathName); 
             XmlNode root = doc.SelectSingleNode("XMLData");
             Serialize(false, doc, root);
 
@@ -158,16 +158,20 @@ namespace OTSModelSharp
                 CMsrDisplayResults poMsrResults = smpl.GetMsrResults();
                 double aFldArea = smpl.CalculateAFieldArea();
                 SetPathName(strIncAFilename);
-                if (GetAllFieldsFromDB(ref allMeasuredFlds,ref poMsrStatus, poMsrResults, aFldArea))
+
+                int w, h;
+                smpl.GetBSESize(out w, out h);
+                double pixelsize = smpl.CalculatePixelSize();
+
+
+                if (GetAllFieldsFromDB(ref allMeasuredFlds,ref poMsrStatus, poMsrResults, aFldArea,new Size(w,h),pixelsize))
                 {
                   
                    
                     var nodataFields = smpl.GetFieldsData();//there's only the field postion info in the xml file,so the initial filed has only postion info.
                     List<COTSFieldData> allflddata = new List<COTSFieldData>() ;//contains all the field 
                     //------------complete the infomation that doesn't contained in database-----
-                    int w, h;
-                    smpl.GetBSESize(out w, out h);
-                    double pixelsize = smpl.CalculatePixelSize();
+                   
                     foreach (var f in allMeasuredFlds)
                     {
                         f.SetPixelSize(pixelsize);
@@ -276,7 +280,7 @@ namespace OTSModelSharp
         // file pathname
         public String GetPathName() { return m_strPathName; }
 
-        public bool GetAllFieldsFromDB(ref List<COTSFieldData> allFlds, ref CMsrSampleStatus status, CMsrDisplayResults rst, double aFieldArea)
+        public bool GetAllFieldsFromDB(ref List<COTSFieldData> allFlds, ref CMsrSampleStatus status, CMsrDisplayResults rst, double aFieldArea,Size picSize,double pixelSize)
         {
             String sDatabaseName = m_strPathName;
 
@@ -291,6 +295,15 @@ namespace OTSModelSharp
             List<COTSFieldData> allFldsWithdata=new List<COTSFieldData>();
             m_IncADataDB.GetAllFieldsRecord(ref allFldsWithdata);
 
+
+            foreach (var f in allFldsWithdata)
+            {
+                f.Width = picSize.Width;
+                f.Height = picSize.Height;
+                f.SetPixelSize(pixelSize);
+            
+            }
+
             var eleChemistryDB = incAFileMgr.GetPosXrayDBMgr().GetElementChemistryDB();
              Dictionary<string, CPosXrayClr> mapXrayInfo=new Dictionary<string, CPosXrayClr>();
             eleChemistryDB.GetAllMapedXrayInfo(ref mapXrayInfo);
@@ -1493,14 +1506,20 @@ namespace OTSModelSharp
                 doc.Load(filename);
 
                 XmlNode  root = doc.SelectSingleNode("XMLData");
-               
-               var members = root.SelectNodes("Sample");
-
+               var members = root.SelectNodes("Member");
                 foreach (XmlNode member1 in members)
                 {
-                    var paramNode = member1.SelectSingleNode("MsrParams");
-
-                      ((XmlElement)paramNode).SetAttribute("STDName",stdFileName);
+                    if(member1.Attributes["RegName"].Value== "Sample")
+                    {
+                        var paramNode = member1.SelectNodes("Member");
+                        foreach (XmlNode member2 in paramNode)
+                        {
+                            if(member2.Attributes["RegName"].Value == "MsrParams")
+                            {
+                                ((XmlElement)member2).SetAttribute("STDName", stdFileName);
+                            }
+                        }
+                    }
                 }
                 
                 doc.Save(filename);
@@ -1512,6 +1531,7 @@ namespace OTSModelSharp
                     foreach (var part in fld.GetListAnalysisParticles())
                     {
                         part.SetType((int)OTS_PARTCLE_TYPE.NOT_IDENTIFIED);
+                        part.SetTypeName("Not Identified");
                     }
                 }
 
@@ -1551,7 +1571,8 @@ namespace OTSModelSharp
                         }
                         else
                         {
-                            if (stdFileName != "NoSTDDB")
+                          
+                            if (stdFileName != "NoSTDDB.db")
                             {
                                 var m_classifyEngine = new CClassifyEngine();
                                 IClassifyEngine engine = m_classifyEngine.GetParticleEngine(stdFileName);
@@ -1618,6 +1639,7 @@ namespace OTSModelSharp
             Collection<CHoleBSEImg> xholeBSEImgs = new Collection<CHoleBSEImg>();
             Collection<COTSSample> xsamples = new Collection<COTSSample>();
             Slo slo = new Slo();
+            
             slo.Register("ProjMgrFileMark", xProjMgrFileMark);
             slo.Register("ProjMgrFileVersion", xProjMgrFileVersion);
             slo.Register("strPathName", xstrPathName);

+ 2 - 1
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -436,7 +436,7 @@ namespace OTSMeasureApp
         private void ribbonOrbMenuItem1_OpenWorkspace_Click(object sender, EventArgs e)
         {
             OpenMeasureProjectFile();
-            UpdatePropertyVal();
+            //UpdatePropertyVal();
         }
 
         //新建样品工作文件
@@ -1216,6 +1216,7 @@ namespace OTSMeasureApp
           
                 // file open dialog
                 OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "Probject Files (*.prj)|*.prj";
                 if (openFileDialog.ShowDialog() != DialogResult.OK)
                 {
                     return ;