Browse Source

提交代码,报告导出图片拼接优化

zhangjiaxin 1 year ago
parent
commit
96c7b2c007

+ 1 - 1
Bin/x64/Debug/Config/ProData/HardwareConfig.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <XMLData PathName="HardwareConfig.xml" ID="1">
 <XMLData PathName="HardwareConfig.xml" ID="1">
   <Member RegName="SemControllerName" Value="OffLine" ImageInputSources="SE" />
   <Member RegName="SemControllerName" Value="OffLine" ImageInputSources="SE" />
-  <Member RegName="EDSName" Value="OffLine" DelayQuantify="true" />
+  <Member RegName="EDSName" Value="OffLine" DelayQuantify="true" WeightPercentageToAtomicPercentage="false"/>
   <Member RegName="BrukerDllVersion" Version="Bruker.API.Esprit64.dll" />
   <Member RegName="BrukerDllVersion" Version="Bruker.API.Esprit64.dll" />
   <Member RegName="FEIIP" Value="192.168.0.1" />
   <Member RegName="FEIIP" Value="192.168.0.1" />
   <Member RegName="FEIPORT" Value="7520" />
   <Member RegName="FEIPORT" Value="7520" />

+ 4 - 1
OTSCPP/OTSClassifyEngine/ExpressionClassifyEngine.cpp

@@ -21,7 +21,10 @@ bool ExpressionClassifyEngine::Init()
 		return FALSE;
 		return FALSE;
 	}
 	}
 	 pLibFileMgr->LoadMaxEDSRulesData(m_std);
 	 pLibFileMgr->LoadMaxEDSRulesData(m_std);
-	 pLibFileMgr->LoadZeroElementRulesData(m_std);
+	 if (!pLibFileMgr->LoadZeroElementRulesData(m_std))
+	 {
+		 //return false;
+	 }
 	
 	
 	 string constantStr = pLibFileMgr->LoadConstantsData();
 	 string constantStr = pLibFileMgr->LoadConstantsData();
 	 std::map<std::string, double> m_mapConstants;
 	 std::map<std::string, double> m_mapConstants;

+ 4 - 1
OTSCPP/OTSClassifyEngine/ExpressionParseEngine/ZeroElementRulesDataDB.cpp

@@ -142,7 +142,10 @@ namespace OTSClassifyEngine
 		nCol = (int)CZeroElementRulesDataTable::ColumnID::S_Expression - (int)CZeroElementRulesDataTable::ColumnID::MIN;
 		nCol = (int)CZeroElementRulesDataTable::ColumnID::S_Expression - (int)CZeroElementRulesDataTable::ColumnID::MIN;
 		sExpression = a_query->GetColStringValue(nCol, _T(""));
 		sExpression = a_query->GetColStringValue(nCol, _T(""));
 		m_ZeroElementRuleItem->SetExpressionStr(sExpression.GetString());
 		m_ZeroElementRuleItem->SetExpressionStr(sExpression.GetString());
-
+		if (sExpression == "")
+		{
+			return FALSE;
+		}
 		return TRUE;
 		return TRUE;
 	}
 	}
 	
 	

+ 6 - 0
OTSCPP/OTSClassifyEngine/SpectrumCompareEngine/OTSSTDLibFileMgr.cpp

@@ -132,6 +132,12 @@ namespace OTSClassifyEngine
 		GetZeroElementRulesDataDB();
 		GetZeroElementRulesDataDB();
 
 
 		auto rules= m_pZeroElementRulesDataDB->GetZeroElementRulesLib(bClear);
 		auto rules= m_pZeroElementRulesDataDB->GetZeroElementRulesLib(bClear);
+		if (rules.size() == 0)
+		{
+			AfxMessageBox(_T("The format of the zero element rule is incorrect. Please use the zero element interface in the standard library editor to save and try again!"));
+				
+			return FALSE;
+		}
 		lib->setZeroElementRuleList(rules);
 		lib->setZeroElementRuleList(rules);
 
 
 		return TRUE;
 		return TRUE;

+ 2 - 0
OTSCPP/OTSData/Element.h

@@ -104,6 +104,8 @@ namespace OTSDATA
 		double GetMolarPercentage();
 		double GetMolarPercentage();
 		void SetMolarPercentage(double a_dMolarPer);
 		void SetMolarPercentage(double a_dMolarPer);
 
 
+		
+
 	protected:
 	protected:
 
 
 		// cleanup 
 		// cleanup 

+ 3 - 3
OTSCPP/OTSImagePro/OTSImageProcess.cpp

@@ -590,7 +590,7 @@ namespace OTSIMGPROC
 		long nBGEnd;
 		long nBGEnd;
 		long nPartStart;
 		long nPartStart;
 		long nPartEnd;
 		long nPartEnd;
-		//long nNumParticle = 0;
+		long nNumParticle = 0;
 		if (a_pImageProcessParam->GetBGRemoveType() == OTS_BGREMOVE_TYPE::MANUAL)
 		if (a_pImageProcessParam->GetBGRemoveType() == OTS_BGREMOVE_TYPE::MANUAL)
 		{
 		{
 			nBGStart = a_pImageProcessParam->GetBGGray().GetStart();
 			nBGStart = a_pImageProcessParam->GetBGGray().GetStart();
@@ -601,8 +601,8 @@ namespace OTSIMGPROC
 			
 			
 			
 			
 			
 			
-			CVRemoveBG(srcImgMat, rstMat, nBGStart, nBGEnd);
-			//RemoveBG_old(srcImgMat, rstMat, nBGStart, nBGEnd, nNumParticle);
+			//CVRemoveBG(srcImgMat, rstMat, nBGStart, nBGEnd);
+			RemoveBG_old(srcImgMat, rstMat, nBGStart, nBGEnd, nNumParticle);
 
 
 			pPixel = rstMat.data;
 			pPixel = rstMat.data;
 		
 		

+ 1 - 1
OTSCPP/OTSSQLiteDll/SQLiteDB.cpp

@@ -91,7 +91,7 @@ namespace OTSSQLITE
 		{
 		{
 			LogErrorTrace(__FILE__, __LINE__, _T(sTableName+":Invalid table columns(%d): should be %d"), query->GetColCount(), tableInfoPtr->GetColumnCount());
 			LogErrorTrace(__FILE__, __LINE__, _T(sTableName+":Invalid table columns(%d): should be %d"), query->GetColCount(), tableInfoPtr->GetColumnCount());
 		}
 		}
-
+		
 		return query;
 		return query;
 	}
 	}
 	CDBQueryBasePtr	CSQLiteDB::GetCommandStringQuery(LPCTSTR a_commandStr /*= nullptr*/)
 	CDBQueryBasePtr	CSQLiteDB::GetCommandStringQuery(LPCTSTR a_commandStr /*= nullptr*/)

+ 14 - 1
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.Designer.cs

@@ -35,6 +35,7 @@
             this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
             this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
             this.TSLoad = new System.Windows.Forms.ToolStripButton();
             this.TSLoad = new System.Windows.Forms.ToolStripButton();
             this.PropGrid = new SourceGrid.Grid();
             this.PropGrid = new SourceGrid.Grid();
+            this.toolStripButton_refresh = new System.Windows.Forms.ToolStripButton();
             this.TSGridTitle.SuspendLayout();
             this.TSGridTitle.SuspendLayout();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
@@ -53,7 +54,8 @@
             this.TSEdit,
             this.TSEdit,
             this.TSSaveAs,
             this.TSSaveAs,
             this.toolStripSeparator2,
             this.toolStripSeparator2,
-            this.TSLoad});
+            this.TSLoad,
+            this.toolStripButton_refresh});
             this.TSGridTitle.Location = new System.Drawing.Point(0, 1);
             this.TSGridTitle.Location = new System.Drawing.Point(0, 1);
             this.TSGridTitle.Name = "TSGridTitle";
             this.TSGridTitle.Name = "TSGridTitle";
             this.TSGridTitle.Padding = new System.Windows.Forms.Padding(0);
             this.TSGridTitle.Padding = new System.Windows.Forms.Padding(0);
@@ -117,6 +119,16 @@
             this.PropGrid.ToolTipText = "";
             this.PropGrid.ToolTipText = "";
             this.PropGrid.Click += new System.EventHandler(this.PropGrid_Click_1);
             this.PropGrid.Click += new System.EventHandler(this.PropGrid_Click_1);
             // 
             // 
+            // toolStripButton_refresh
+            // 
+            this.toolStripButton_refresh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+            this.toolStripButton_refresh.Image = global::OTSMeasureApp.Properties.Resources.Recover16;
+            this.toolStripButton_refresh.ImageTransparentColor = System.Drawing.Color.Magenta;
+            this.toolStripButton_refresh.Name = "toolStripButton_refresh";
+            this.toolStripButton_refresh.Size = new System.Drawing.Size(28, 23);
+            this.toolStripButton_refresh.Text = "toolStripButton1";
+            this.toolStripButton_refresh.Click += new System.EventHandler(this.toolStripButton_refresh_Click);
+            // 
             // OTSPropertyWindow
             // OTSPropertyWindow
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -150,5 +162,6 @@
         public SourceGrid.Grid PropGrid;
         public SourceGrid.Grid PropGrid;
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
         public System.Windows.Forms.ToolStripButton TSLoad;
         public System.Windows.Forms.ToolStripButton TSLoad;
+        private System.Windows.Forms.ToolStripButton toolStripButton_refresh;
     }
     }
 }
 }

+ 8 - 0
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.cs

@@ -385,5 +385,13 @@ namespace OTSMeasureApp
                 return;
                 return;
             }
             }
         }
         }
+
+        private void toolStripButton_refresh_Click(object sender, EventArgs e)
+        {
+            var sample = m_MeasureAppForm.m_ProjParam.GetWorkSample();
+            var stype = m_MeasureAppForm.m_ProjParam.GetDefaultParam().GetSysType();
+            OTSSampleVisualPropertyInfo MeasureInfo = new OTSSampleVisualPropertyInfo(sample, stype);
+            DisplaySampleMeasureInfo(MeasureInfo);
+        }
     }
     }
 }
 }

+ 26 - 26
OTSIncAMeasureApp/3-OTSDisplaySourceGridData/OTSPropertyWindow.resx

@@ -134,32 +134,32 @@
   <data name="TSEdit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
   <data name="TSEdit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
     <value>
         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
-        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
+        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
 </value>
 </value>
   </data>
   </data>
   <data name="TSSaveAs.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
   <data name="TSSaveAs.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

+ 22 - 1
OTSIncAMeasureApp/ServiceCenter/CClassifyEngine.cs

@@ -14,7 +14,7 @@ namespace OTSModelSharp.ServiceCenter
    public class CClassifyEngine : IClassifyEngine
    public class CClassifyEngine : IClassifyEngine
     {
     {
         COTSClassifyEngineClr myEng;
         COTSClassifyEngineClr myEng;
-        
+        bool ifWeightPercentageToAtomicPercentage;
 
 
         public bool ClassifyIncA(COTSParticleClr particle, int steelTech)
         public bool ClassifyIncA(COTSParticleClr particle, int steelTech)
         {
         {
@@ -48,6 +48,9 @@ namespace OTSModelSharp.ServiceCenter
                 libName = libName + ".db";
                 libName = libName + ".db";
             }
             }
             myEng = new COTSClassifyEngineClr(EngineType.ExpressionClassifyEng, libName);
             myEng = new COTSClassifyEngineClr(EngineType.ExpressionClassifyEng, libName);
+            ifWeightPercentageToAtomicPercentage = FileHelper.GetIfTranslateWeightPercentageToAtomicPercentage();
+
+
             return this;
             return this;
         }
         }
 
 
@@ -68,6 +71,24 @@ namespace OTSModelSharp.ServiceCenter
 
 
         public bool ClassifyByExpression(COTSParticleClr particle)
         public bool ClassifyByExpression(COTSParticleClr particle)
         {
         {
+            if (ifWeightPercentageToAtomicPercentage==true)
+            {
+                double sumMolar=0;
+
+                foreach (var ele in particle.GetXray().GetElementQuantifyData())
+                {
+                    sumMolar += ele.GetMolarPercentage();
+                
+                }
+                foreach (var ele in particle.GetXray().GetElementQuantifyData())
+                {
+                    ele.SetPercentage(ele.GetMolarPercentage() / sumMolar);
+
+                }
+
+            }
+
+
             return myEng.ClassifyByExpression(particle);
             return myEng.ClassifyByExpression(particle);
         }
         }
     }
     }

+ 7 - 4
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -228,7 +228,9 @@ namespace OTSModelSharp.ServiceCenter
             {
             {
                 return;
                 return;
             }
             }
-
+            tempFld.CalParticleImageProp(parts);
+            tempFld.SelectParticlesAccordingImgProp(a_pImgProcessParam);
+            parts = tempFld.GetListAnalysisParticles();
             if (a_pImgProcessParam.GetSpecialGreyRangeParam().GetIsToRun())
             if (a_pImgProcessParam.GetSpecialGreyRangeParam().GetIsToRun())
             {
             {
                 var param = a_pImgProcessParam.GetSpecialGreyRangeParam();
                 var param = a_pImgProcessParam.GetSpecialGreyRangeParam();
@@ -309,7 +311,9 @@ namespace OTSModelSharp.ServiceCenter
             {
             {
                 return;
                 return;
             }
             }
-
+            tempFld.CalParticleImageProp(parts);
+            tempFld.SelectParticlesAccordingImgProp(a_pImgProcessParam);
+            parts = tempFld.GetListAnalysisParticles();
             if (a_pImgProcessParam.GetSpecialGreyRangeParam().GetIsToRun())
             if (a_pImgProcessParam.GetSpecialGreyRangeParam().GetIsToRun())
             {
             {
                 var param = a_pImgProcessParam.GetSpecialGreyRangeParam();
                 var param = a_pImgProcessParam.GetSpecialGreyRangeParam();
@@ -556,8 +560,7 @@ namespace OTSModelSharp.ServiceCenter
             //currentField.FilterParticles(m_Sample.GetMsrParams().GetXRayParam());//filter according to the xraylimit
             //currentField.FilterParticles(m_Sample.GetMsrParams().GetXRayParam());//filter according to the xraylimit
            
            
             currentField.SetListAnalysisParticles(parts);
             currentField.SetListAnalysisParticles(parts);
-            currentField.CalParticleImageProp(parts);
-            currentField.SelectParticlesAccordingImgProp(a_pImgProcessParam);
+          
             parts = currentField.GetListAnalysisParticles();
             parts = currentField.GetListAnalysisParticles();
             return true;
             return true;
 
 

+ 46 - 0
OTSIncAMeasureApp/ServiceCenter/FileHelper.cs

@@ -117,6 +117,52 @@ namespace OTSModelSharp.ServiceCenter
                 return "false";
                 return "false";
             }
             }
         }
         }
+        public static bool GetIfTranslateWeightPercentageToAtomicPercentage()
+        {
+            try
+            {
+                XmlDocument doc;
+                string value = string.Empty;
+                if (Hardwareconfigdoc == null)
+                {
+                    string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
+
+
+                    Hardwareconfigdoc = new XmlDocument();
+
+                    Hardwareconfigdoc.Load(xmlFilePath);    //加载Xml文件 
+                    doc = Hardwareconfigdoc;
+
+                }
+                else
+                {
+                    doc = Hardwareconfigdoc;
+                }
+
+
+                XmlElement root = doc.DocumentElement;   //获取根节点  
+
+                XmlNodeList mainNodes = root.GetElementsByTagName("Member"); //获取子节点集合  
+
+                foreach (XmlNode node in mainNodes)
+                {
+                    //获取Name属性值
+                    string name = ((XmlElement)node).GetAttribute("RegName");
+                    if (name.Equals("EDSName"))
+                    {
+
+                        value = ((XmlElement)node).GetAttribute("WeightPercentageToAtomicPercentage");
+
+                        break;
+                    }
+                }
+                return Convert.ToBoolean(value);
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
         public static string GetOxfordInputSourceType()
         public static string GetOxfordInputSourceType()
         {
         {
             try
             try

+ 1 - 1
OTSPartA_STDEditor/UI/Form_Main.cs

@@ -919,7 +919,7 @@ namespace OTSPartA_STDEditor
             new_STDdata.Element = "1";
             new_STDdata.Element = "1";
             new_STDdata.StrName = "NewRuleName";
             new_STDdata.StrName = "NewRuleName";
             //new_STDdata.Expression = "NewRules";
             //new_STDdata.Expression = "NewRules";
-            new_STDdata.Expression = "";
+            new_STDdata.Expression = "false";
             new_STDdata.KeyElementList = "";
             new_STDdata.KeyElementList = "";
             new_STDdata.SubElementList = "";
             new_STDdata.SubElementList = "";
 
 

+ 6 - 18
OTSPartA_STDEditor/UI/Form_ZeroElementRules.cs

@@ -437,16 +437,13 @@ namespace OTSPartA_STDEditor
             m_dbConnection.Open();
             m_dbConnection.Open();
 
 
             System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
             System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-            cmm.CommandText = "delete from ZeroElementRules";
 
 
-            try
-            {
-                cmm.ExecuteNonQuery();
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString());
-            }
+            cmm.CommandText = "drop table ZeroElementRules";
+            cmm.ExecuteNonQuery();
+
+            cmm.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT, UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";
+            cmm.ExecuteNonQuery();
+
             System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ZeroElementRules", m_dbConnection);
             System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ZeroElementRules", m_dbConnection);
             System.Data.SQLite.SQLiteCommandBuilder qLiteCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(m_dataAdapter);
             System.Data.SQLite.SQLiteCommandBuilder qLiteCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(m_dataAdapter);
 
 
@@ -454,8 +451,6 @@ namespace OTSPartA_STDEditor
             m_dataAdapter.Fill(ds, "ZeroElementRules");
             m_dataAdapter.Fill(ds, "ZeroElementRules");
             DataTable dt = ds.Tables["ZeroElementRules"];
             DataTable dt = ds.Tables["ZeroElementRules"];
 
 
-            dt.Clear();
-
             for (int num = 0; num < XmlTree_ZeroElementRules.Nodes.Count; num++)
             for (int num = 0; num < XmlTree_ZeroElementRules.Nodes.Count; num++)
             {
             {
                 string UsingElementList = "";
                 string UsingElementList = "";
@@ -466,13 +461,6 @@ namespace OTSPartA_STDEditor
                 List<string> UsingOtherPropertyL = new List<string>();
                 List<string> UsingOtherPropertyL = new List<string>();
 
 
                 string str_RemoveBlank = "";
                 string str_RemoveBlank = "";
-                //forth_elem干扰or分隔符,故先行去掉
-                //if (XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Contains("fourth_elem"))
-                //{
-                //    str_RemoveBlank = str_RemoveBlank.Replace("fourth_elem", "");
-                //    UsingOtherPropertyList = "fourth_elem,";
-                //}
-
                 str_RemoveBlank = XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Replace(" ", "");
                 str_RemoveBlank = XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Replace(" ", "");
                 string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
                 string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
                 List<string> str_Removeandor = new List<string>();
                 List<string> str_Removeandor = new List<string>();

+ 26 - 27
OTSPartA_STDEditor/UI/STDEditor.cs

@@ -682,13 +682,12 @@ namespace OTSPartA_STDEditor
 
 
         private void textbox_STDEditor_MouseLeave(object sender, EventArgs e)
         private void textbox_STDEditor_MouseLeave(object sender, EventArgs e)
         {
         {
-            dataGridView_KeyElements.Rows.Clear();
-            dataGridView_KeyElements.Columns.Clear();
+            dataGridView_SubElements.Rows.Clear();
+            dataGridView_SubElements.Columns.Clear(); 
 
 
 
 
             string str_RemoveBlank = textbox_STDEditor.Text.ToString().Replace(" ", "");
             string str_RemoveBlank = textbox_STDEditor.Text.ToString().Replace(" ", "");
             str_RemoveBlank = str_RemoveBlank.Replace("\r\n", "");
             str_RemoveBlank = str_RemoveBlank.Replace("\r\n", "");
-            //str_RemoveBlank = str_RemoveBlank.Replace("fourth_elem", "");
             string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
             string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
             List<string> str_Removeandor = new List<string>();
             List<string> str_Removeandor = new List<string>();
             for (int i = 0; i < str_Removeand.Length; i++)
             for (int i = 0; i < str_Removeand.Length; i++)
@@ -712,46 +711,46 @@ namespace OTSPartA_STDEditor
                 }
                 }
             }
             }
 
 
-            List<string> SubElements = new List<string>();
-            for (int i = 0; i < dataGridView_SubElements.ColumnCount; i++)
+            List<string> KeyElements = new List<string>();
+            for (int i = 0; i < dataGridView_KeyElements.ColumnCount; i++)
             {
             {
-                if (UsingElementL.Contains(dataGridView_SubElements.Rows[0].Cells[i].Value))
+                if (UsingElementL.Contains(dataGridView_KeyElements.Rows[0].Cells[i].Value))
                 {
                 {
-                    SubElements.Add(dataGridView_SubElements.Rows[0].Cells[i].Value.ToString());
+                    KeyElements.Add(dataGridView_KeyElements.Rows[0].Cells[i].Value.ToString());
                 }
                 }
             }
             }
 
 
-            dataGridView_SubElements.Rows.Clear();
-            dataGridView_SubElements.Columns.Clear();
+            dataGridView_KeyElements.Rows.Clear();
+            dataGridView_KeyElements.Columns.Clear();
 
 
-            for (int i = 0; i < SubElements.Count; i++)
+            for (int i = 0; i < KeyElements.Count; i++)
             {
             {
                 DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
                 DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-                dataGridViewButtonColumn.Name = dataGridView_SubElements.Columns.Count.ToString();
-                dataGridView_SubElements.Columns.Add(dataGridViewButtonColumn);
-                if (dataGridView_SubElements.Rows.Count == 0)
+                dataGridViewButtonColumn.Name = dataGridView_KeyElements.Columns.Count.ToString();
+                dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
+                if (dataGridView_KeyElements.Rows.Count == 0)
                 {
                 {
                     DataGridViewRow row = new DataGridViewRow();
                     DataGridViewRow row = new DataGridViewRow();
-                    dataGridView_SubElements.Rows.Add(row);
+                    dataGridView_KeyElements.Rows.Add(row);
                 }
                 }
-                dataGridView_SubElements.Rows[0].Cells[dataGridView_SubElements.ColumnCount - 1].Value = SubElements[i];
+                dataGridView_KeyElements.Rows[0].Cells[dataGridView_KeyElements.ColumnCount - 1].Value = KeyElements[i];
             }
             }
 
 
-            if (SubElements.Count > 0)
+            if (KeyElements.Count > 0)
             {
             {
                 for (int i = 0; i < UsingElementL.Count; i++)
                 for (int i = 0; i < UsingElementL.Count; i++)
                 {
                 {
-                    if (!SubElements.Contains(UsingElementL[i]))
+                    if (!KeyElements.Contains(UsingElementL[i]))
                     {
                     {
                         DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
                         DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-                        dataGridViewButtonColumn.Name = dataGridView_KeyElements.Columns.Count.ToString();
-                        dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
-                        if (dataGridView_KeyElements.Rows.Count == 0)
+                        dataGridViewButtonColumn.Name = dataGridView_SubElements.Columns.Count.ToString();
+                        dataGridView_SubElements.Columns.Add(dataGridViewButtonColumn);
+                        if (dataGridView_SubElements.Rows.Count == 0)
                         {
                         {
                             DataGridViewRow row = new DataGridViewRow();
                             DataGridViewRow row = new DataGridViewRow();
-                            dataGridView_KeyElements.Rows.Add(row);
+                            dataGridView_SubElements.Rows.Add(row);
                         }
                         }
-                        dataGridView_KeyElements.Rows[0].Cells[dataGridView_KeyElements.ColumnCount - 1].Value = UsingElementL[i];
+                        dataGridView_SubElements.Rows[0].Cells[dataGridView_SubElements.ColumnCount - 1].Value = UsingElementL[i];
                     }
                     }
                 }
                 }
             }
             }
@@ -760,14 +759,14 @@ namespace OTSPartA_STDEditor
                 for (int i = 0; i < UsingElementL.Count; i++)
                 for (int i = 0; i < UsingElementL.Count; i++)
                 {
                 {
                     DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
                     DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-                    dataGridViewButtonColumn.Name = dataGridView_KeyElements.Columns.Count.ToString();
-                    dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
-                    if (dataGridView_KeyElements.Rows.Count == 0)
+                    dataGridViewButtonColumn.Name = dataGridView_SubElements.Columns.Count.ToString();
+                    dataGridView_SubElements.Columns.Add(dataGridViewButtonColumn);
+                    if (dataGridView_SubElements.Rows.Count == 0)
                     {
                     {
                         DataGridViewRow row = new DataGridViewRow();
                         DataGridViewRow row = new DataGridViewRow();
-                        dataGridView_KeyElements.Rows.Add(row);
+                        dataGridView_SubElements.Rows.Add(row);
                     }
                     }
-                    dataGridView_KeyElements.Rows[0].Cells[i].Value = UsingElementL[i];
+                    dataGridView_SubElements.Rows[0].Cells[i].Value = UsingElementL[i];
                 }
                 }
             }
             }
             dataGridView_KeyElements.ClearSelection();
             dataGridView_KeyElements.ClearSelection();

+ 2 - 0
OTSPartA_STDEditor/UI/STDRuleslist.cs

@@ -84,6 +84,8 @@ namespace OTSPartA_STDEditor
                 i++;
                 i++;
             }
             }
 
 
+
+
             Grid_Minerals.Controller.AddController(m_ValueChangedEvent);
             Grid_Minerals.Controller.AddController(m_ValueChangedEvent);
             Grid_Minerals.FixedRows = 1;// 第一行是列标题不可以滚动
             Grid_Minerals.FixedRows = 1;// 第一行是列标题不可以滚动
             Grid_Minerals.Selection.FocusStyle = FocusStyle.None;
             Grid_Minerals.Selection.FocusStyle = FocusStyle.None;