Explorar o código

add a field table to result db. and do some optimization on the distribution image display.

gsp %!s(int64=4) %!d(string=hai) anos
pai
achega
4f61241d79
Modificáronse 32 ficheiros con 240 adicións e 3474 borrados
  1. 4 3
      OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs
  2. 9 8
      OTSIncAMeasureApp/0-OTSModel/Measure/2-OTSCleanliness/SmplMeasureCleanliness.cs
  3. 1 5
      OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CMsrThread.cs
  4. 1 1
      OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs
  5. 17 50
      OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMsrResult.cs
  6. 0 19
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/CSmallParticleInfo.cs
  7. 0 292
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/ElementChemistryDB.cs
  8. 0 39
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/ElementChemistryTable.cs
  9. 0 299
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/GenInfoDB.cs
  10. 0 30
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/GenInfoTable.cs
  11. 0 187
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/IncADataDB.cs
  12. 0 87
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/IncADataTable.cs
  13. 0 291
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/IncAFileMgr.cs
  14. 0 84
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/MergedParticles/MergParticleTable.cs
  15. 0 224
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/MergedParticles/MergeParticleDB.cs
  16. 0 351
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/PosXrayDBMgr.cs
  17. 0 289
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/PosXrayInfoDB.cs
  18. 0 41
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/PosXrayInfoTable.cs
  19. 0 486
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SegmentDB.cs
  20. 0 49
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SegmentTable.cs
  21. 0 123
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SmallParticles/SmallParticleInfoDB.cs
  22. 0 50
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SmallParticles/SmallParticleInfoTable.cs
  23. 0 171
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/XRayDataDB.cs
  24. 0 35
      OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/XRayDataTable.cs
  25. 21 19
      OTSIncAMeasureApp/OTSIncAMeasureApp.csproj
  26. 1 1
      OTSIncAReportApp/App.config
  27. 86 121
      OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs
  28. 25 24
      OTSIncAReportApp/Control_Graph/OTSIncAReportGraphFuncation/OTSIncAReportFun.cs
  29. 9 37
      OTSIncAReportApp/DataOperation/DataAccess/FieldData.cs
  30. 13 1
      OTSIncAReportApp/DataOperation/DataAccess/ParticleData.cs
  31. 38 42
      OTSIncAReportApp/frmMeasureRstMgr.cs
  32. 15 15
      OTSIncAReportApp/frmReportApp.cs

+ 4 - 3
OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -88,7 +88,7 @@ namespace OTSModelSharp
 
 
                     //save to disk first ,then pop . if the size is 0,then we know all the saving work is done.
-                    SaveFieldFiles(f,m_pSampleRstFile.GetFieldFileSubFolderStr());
+                    SaveFieldData(f,m_pSampleRstFile.GetFieldFileSubFolderStr());
 
 
                 }
@@ -307,7 +307,7 @@ namespace OTSModelSharp
             }
             return ;
         }
-        public bool SaveFieldFiles(COTSFieldData fldData,string filedFileFoler)
+        public bool SaveFieldData(COTSFieldData fldData,string filedFileFoler)
         {
             //loger.Warn("begin bitmap saving...");
             string strFieldFileFolder = filedFileFoler;
@@ -334,7 +334,8 @@ namespace OTSModelSharp
           
 
             pDBFileMgr.SaveStatusDataToDB();
-
+            var fldDB = pDBFileMgr.GetFieldDB();
+            fldDB.SaveAField(fldData.GetId(),fldData.GetPosition());
             if (!pDBFileMgr.SaveIncADataToDB(curFldData.ListAnalysisParticles, fldData.GetPosition()))
             {
                 log.Info("SaveFieldFiles: save inclusion file failed.");

+ 9 - 8
OTSIncAMeasureApp/0-OTSModel/Measure/2-OTSCleanliness/SmplMeasureCleanliness.cs

@@ -378,14 +378,14 @@ namespace OTSModelSharp
             return true;
         }
 
-        public bool SaveFieldFiles(CFieldDataClean f, string filedFileFoler)
+        public bool SaveFieldFiles(CFieldDataClean fldData, string filedFileFoler)
         {
 
             string strFieldFileFolder = filedFileFoler;
 
             CBSEImageFileMgr pBSEImgFileMgr = new CBSEImageFileMgr();
-            pBSEImgFileMgr.SetBSEImg(f.GetBSEImage());
-            int nId = f.GetId();
+            pBSEImgFileMgr.SetBSEImg(fldData.GetBSEImage());
+            int nId = fldData.GetId();
             string sFieldId;
             sFieldId = nId.ToString();
      
@@ -405,8 +405,9 @@ namespace OTSModelSharp
 
             //pDBFileMgr.BeginTransaction();
             pDBFileMgr.SaveStatusDataToDB();
-
-            if (!pDBFileMgr.SaveIncADataToDB(f.ListAnalysisParticles, f.GetPosition()))
+            var fldDB = pDBFileMgr.GetFieldDB();
+            fldDB.SaveAField(fldData.GetId(), fldData.GetPosition());
+            if (!pDBFileMgr.SaveIncADataToDB(fldData.ListAnalysisParticles, fldData.GetPosition()))
             {
                 log.Info("SaveFieldFiles: save inclusion file failed.");
                 return false;
@@ -414,7 +415,7 @@ namespace OTSModelSharp
             //save the xray data and element data.
             CPosXrayDBMgr PosXrayDBMgr = pDBFileMgr.GetPosXrayDBMgr();
             var m_listAnalysisPosXray = new List<CPosXrayClr>();
-            foreach (var p in f. ListAnalysisParticles)
+            foreach (var p in fldData. ListAnalysisParticles)
             {
                 m_listAnalysisPosXray.Add(p.GetXray());
             }
@@ -430,7 +431,7 @@ namespace OTSModelSharp
             //save the small particle info 
             CSmallParticleInfoDB smallPartDB = pDBFileMgr.GetSmallParticleInfoDB();
             Dictionary<int, List<COTSParticleClr>> mapSmallParts = new Dictionary<int, List<COTSParticleClr>>();
-            foreach (COTSParticleClr smallP in f.ListSmallParticles)
+            foreach (COTSParticleClr smallP in fldData.ListSmallParticles)
             {
                 if (mapSmallParts.ContainsKey((int)smallP.GetType()))
                 {
@@ -452,7 +453,7 @@ namespace OTSModelSharp
                 CSmallParticleInfo partInfo = new CSmallParticleInfo();
                 partInfo.FieldId = particles.Value[0].GetFieldId();
                 partInfo.AveGray = particles.Value[0].GetAveGray();
-                partInfo.Quantity = (int)(particles.Value.Count / f.SmallParticlePercentage);
+                partInfo.Quantity = (int)(particles.Value.Count / fldData.SmallParticlePercentage);
                 partInfo.TypeId = particles.Key;
                 partInfo.TypeColor = particles.Value[0].GetTypeColor();
                 partInfo.TypeName = particles.Value[0].GetTypeName();

+ 1 - 5
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CMsrThread.cs

@@ -185,13 +185,9 @@ namespace OTSModelSharp
             }
 
             // working folder string
-            string  strWorkingFolder =FileHelper.GetFolderName(strSettingFilePathName);
+             m_strWorkingFolder = FileHelper.GetFolderName(strSettingFilePathName);
 
 
-            // set working folder string
-            m_strWorkingFolder = strWorkingFolder;
-
-            // ok, return TRUE
             return ;
         }
        public void SendMessageToMeasureApp(ST_MSTMsg msg)

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

@@ -589,7 +589,7 @@ namespace OTSModelSharp
                 }
                 //-----save the static measure result file data into xml file and the dynamic data of every field will be saved into sqlite database
                 log.Info("Create result file!");
-                if (!m_pSampleRstFile.CreateResultFiles(alllistFieldCenter))
+                if (!m_pSampleRstFile.CreateResultFiles())
                 {// failed to call measure result file Save method
                     log.Error("DoMeasure: failed to call measure result file Save method.");
                     pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);

+ 17 - 50
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMsrResult.cs

@@ -71,7 +71,7 @@ namespace OTSModelSharp
         COTSSample m_pSample;
         // switch
         bool m_bSwitch;
-        List<Point> allfieldcenters;
+    
 
 
         public CIncAFileMgr DBFileMgr { get => m_DBFileMgr; set => m_DBFileMgr = value; }
@@ -82,7 +82,7 @@ namespace OTSModelSharp
         {
             Init();
             m_pSample = new COTSSample();
-            allfieldcenters = new List<Point>();
+           
         }
         protected void Duplicate(CSmplMsrResult a_oSource)
         {
@@ -138,20 +138,17 @@ namespace OTSModelSharp
         }
         protected void Init()
         {
-            // file version string
+        
             m_strFileVersion = ("");
-            // SEM sample stage
+      
             m_pSEMStageData = new CSEMStageData();
-            // sample stage
+           
             m_pStage = new CStage();
-            // SEM condition??
-            //CSEMStageDataPtr m_pSEMData;
+ 
             m_pSEMData = new CSEMDataGnr();
-            // sample setting
-           
-            // switch
+      
             m_bSwitch = false;
-            // fields
+           
 
         }
         protected void Cleanup()
@@ -214,9 +211,7 @@ namespace OTSModelSharp
             }
             m_pSEMData = a_pSEMData;
         }
-        // sample setting
 
-        // switch
         public bool GetSwitch()
         {
             return m_bSwitch;
@@ -225,14 +220,8 @@ namespace OTSModelSharp
         {
             m_bSwitch = a_bSwitch;
         }
-        //fields
 
 
-        //----------protected----------------
-        // cleanup
-
-        // initialization
-
 
         public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
         {
@@ -256,21 +245,6 @@ namespace OTSModelSharp
                 xbSwitch.AssignValue(m_bSwitch);
 
 
-                for(int i=0;i<allfieldcenters.Count;i++)
-                {
-                    Slo flddata = new Slo();
-                    xInt id = new xInt();
-                    xInt fldx = new xInt();
-                    xInt fldy = new xInt();
-                    id.AssignValue( i);
-                    var p = allfieldcenters[i];
-                    fldx.AssignValue( p.X);
-                    fldy .AssignValue( p.Y);
-                    flddata.Register("ID", id);
-                    flddata.Register("FieldX", fldx);
-                    flddata.Register("FieldY", fldy);
-                    xfields.addItem(flddata);
-                }
                 slo.Serialize(true, classDoc, rootNode);
             }
             else
@@ -278,11 +252,7 @@ namespace OTSModelSharp
                 slo.Serialize(false, classDoc, rootNode);
                 m_bSwitch = xbSwitch.value();
                 m_strFileVersion = xnVersion.value();
-                // m_pSample.GetFieldsData();
-                //for (unsigned int i = 0; i < xfields.size(); i++)
-                //{
-                //    m_pSample.GetFieldsData().push_back(COTSFieldDataPtr(xfields.getItem(i)));
-                //}
+                
             }
         }
         private bool InitFolders()
@@ -386,10 +356,7 @@ namespace OTSModelSharp
 
                 return false;
             }
-            //m_strSampleWorkingFolder = strFilePath+;
 
-            // create sample measure result file
-            //CSmplMsrResult pSmplMsrResultFile = new CSmplMsrResult();
 
             // file version
             String strFileVersion = m_strFileVersion;
@@ -400,7 +367,7 @@ namespace OTSModelSharp
                 return false;
             }
             // sample measure result file
-            //m_pSmplMsrResult = pSmplMsrResultFile;
+          
             SetPathFileName(a_strPathname);
             this.LoadFieldDataFromDB(a_strPathname);
             // ok, return TRUE
@@ -643,7 +610,7 @@ namespace OTSModelSharp
                 a_strPathname = FileDialog.SelectedPath;
             }
             // get path of the pathname
-            // COTSHelper cOTSHelper = new COTSHelper();
+      
             string strFilePath = GetFolderName(a_strPathname);
             if (strFilePath == null)
             {
@@ -655,7 +622,7 @@ namespace OTSModelSharp
           
             string strFieldFileSubFolder = strFilePath + "\\" + SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER + "\\";
             // check if the field file sub folder exists
-            // COTSEDSBase cOTSFileSys = new COTSEDSBase();
+       
             if (!Exists(strFieldFileSubFolder))
             {// field files folder doesn't exist
                 logger.Info("Load: field files folder doesn't exist (%s).");
@@ -691,9 +658,9 @@ namespace OTSModelSharp
             var SegmentDB = m_DBFileMgr.GetSegmentDB();
             double msrFldsArea = 0;
 
-            // std::map<int, COTSParticleList> mapTypeParticles;//record typeId relevants particlelist;
+        
             Dictionary<int, List<COTSParticleClr>> mapTypeParticles = new Dictionary<int, List<COTSParticleClr>>();
-            // std::map<std::vector<int>, COTSSegmentsList> AllSegments;
+            
             Dictionary<List<int>, List<COTSSegmentClr>> AllSegments = new Dictionary<List<int>, List<COTSSegmentClr>>();
             if (SegmentDB.GetAllSegmentsRecord(AllSegments))
             {
@@ -774,7 +741,7 @@ namespace OTSModelSharp
 
 
         // Save 
-        public bool CreateResultFiles(List<Point> listallfldcenter)
+        public bool CreateResultFiles()
         {
             InitFolders();
 
@@ -785,11 +752,11 @@ namespace OTSModelSharp
             XmlElement rootNode = xmlDoc.CreateElement("XMLData");
             xmlDoc.AppendChild(rootNode);
 
-            //xmlDoc.LoadXml(a_strPathname);
+          
 
             XmlNode root = xmlDoc.SelectSingleNode("XMLData");
 
-            allfieldcenters = listallfldcenter;
+            
             Serialize(true, xmlDoc, root);
 
             xmlDoc.Save(m_strRstFileName);

+ 0 - 19
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/CSmallParticleInfo.cs

@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-   public class CSmallParticleInfo
-    {
-        public  int FieldId;
-        public int AveGray;
-        public int Quantity;
-        public int TypeId;
-        public string TypeColor;
-        public string TypeName;
-        public int Area;
-    }
-}

+ 0 - 292
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/ElementChemistryDB.cs

@@ -1,292 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp.DTLBase
-{
-    public class CElementChemistryDB : CSQLiteDB
-    {
-        List<CPosXrayClr> m_listPosXrayInfo = new List<CPosXrayClr>();
-        public CElementChemistryDB(IDBStoreBase _conStr, IDBTableBase _table):base(_conStr,_table) 		
-	{
-		
-
-    }
-
- 
-
-      public System.Data.DataTable GetQueryById( long a_nXrayId, long a_nFieldId,  long a_nElementId,  long a_nElementSize)
-	  {
-
-        
-
-        var datastorePtr = GetDatastore();
-   
-        var tableInfoPtr = GetTableInfo();
-   
-
-        var sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CElementChemistryTable.ColumnID.N_XRAY_INDEX - (int)CElementChemistryTable.ColumnID.MIN);
-        var sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CElementChemistryTable.ColumnID.N_FIELD_ID - (int)CElementChemistryTable.ColumnID.MIN);
-        var sElementIdColumnName = tableInfoPtr.GetColumnName((int)CElementChemistryTable.ColumnID.N_ELEMENT_ID - (int)CElementChemistryTable.ColumnID.MIN);
-        var sElementNumColumnName = tableInfoPtr.GetColumnName((int)CElementChemistryTable.ColumnID.N_ELEMENT_TOTAL - (int)CElementChemistryTable.ColumnID.MIN);
-
-
-        String  sSQLCommand= String.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8};", (String)tableInfoPtr.GetTableName(), sFieldIdColumnName,
-        a_nFieldId, sXrayIdColumnName, a_nXrayId,sElementIdColumnName, a_nElementId,sElementNumColumnName, a_nElementSize);
-
-      
-
-        var q=datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-           
-        return q;
-	  }
-
-    
-
-     public   List< CPosXrayClr> GetXrayInfoList( bool a_bForce/* = FALSE*/)
-	{
-		if (a_bForce)
-		{
-            m_listPosXrayInfo.Clear();
-		}
-
-		if (m_listPosXrayInfo.Count == 0)
-		{
-			ReadXrayPointInfoList();
-        }
-
-		return m_listPosXrayInfo;
-	}
-
-       public  bool ReadXrayPointInfoList()
-        {
-            var tableInfoPtr = GetTableInfo();
-            
-            var query = GetTableQueryForDataTable("");
-           
-            m_listPosXrayInfo = ReadXrayPointInfoList(query);
-
-            return true;
-        }
-
-     
-      public  bool SaveElementChemistriesList(List<CPosXrayClr> a_xrayPointList)
-	{
-		
-          var tableInfoPtr = GetTableInfo();
-   
-          var datastorePtr = GetDatastore();
-
-            String sInsertFormat = tableInfoPtr.GetInsertCommandFormatString();
-          String sSQLCommand = "";
-
-		foreach (var xrayPointInfo in a_xrayPointList)
-		{
-			List<CElementChemistryClr> listElemnentChemistries = xrayPointInfo.GetElementQuantifyData();
-
-            int nSize = (int)listElemnentChemistries.Count;
-            int nElementIndex = 0;
-			foreach (var pElementChemistry in listElemnentChemistries)
-			{
-                    sSQLCommand= String.Format(sInsertFormat,
-                    xrayPointInfo.GetIndex(),
-					xrayPointInfo.GetScanFieldId(),
-					nElementIndex,
-					nSize,
-					pElementChemistry.GetName(),
-					pElementChemistry.GetPercentage());
-                    //var helper = new SQLiteHelper(datastorePtr);         
-                    if (datastorePtr.RunCommand(sSQLCommand) != true)
-				   {
-
-
-
-                        return false;
-				}
-
-				nElementIndex++;
-			}
-
-		}
-
-            return true;
-	}
-
-      public  bool SaveElementChemistriesList( CPosXrayClr a_pxrayPoint)
-	{
-		
-       var tableInfoPtr = GetTableInfo();
-    
-       var datastorePtr = GetDatastore();
-
-            String sInsertFormat = tableInfoPtr.GetInsertCommandFormatString();
-        String sSQLCommand = "";
-
-       List<CElementChemistryClr >listElemnentChemistries = a_pxrayPoint.GetElementQuantifyData();
-
-        int nSize = (int)listElemnentChemistries.Count;
-        int nElementIndex = 0;
-		foreach (var pElementChemistry in listElemnentChemistries)
-		{
-                sSQLCommand=String.Format(sInsertFormat,
-                a_pxrayPoint.GetIndex(),
-				a_pxrayPoint.GetScanFieldId(),
-				nElementIndex,
-				nSize,
-				pElementChemistry.GetName(),
-				pElementChemistry.GetPercentage(),
-				pElementChemistry.GetMolarPercentage());
-                    
-                if (datastorePtr.RunCommand(sSQLCommand) != true)
-			    {
-
-                    return false;
-			    }
-
-			nElementIndex++;
-		}
-
-            return true;
-	}
-
-        public bool DeleteElementChemistryById(long a_nFieldId, long a_nXrayId)
-        {            
-            if (m_listPosXrayInfo.Count != 0)
-            {
-                for (int itr = 0; itr < m_listPosXrayInfo.Count; itr++)
-                {
-                    if (m_listPosXrayInfo[itr].ToString() == a_nFieldId.ToString())
-                    {
-                        CPosXrayClr posXrayInfo = new CPosXrayClr();
-                        posXrayInfo = m_listPosXrayInfo[itr];
-                        break;
-                    }
-                }
-            }
-            DataTable query;
-            var tableInfoPtr = GetTableInfo();
-            var datastorePtr = GetDatastore();
-            String sTableName = tableInfoPtr.GetTableName();
-            if (IsTableExists(sTableName))
-            {
-                
-
-           
-
-            var sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CElementChemistryTable.ColumnID.N_XRAY_INDEX - (int)CElementChemistryTable.ColumnID.MIN);
-            var sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CElementChemistryTable.ColumnID.N_FIELD_ID - (int)CElementChemistryTable.ColumnID.MIN);
-
-            String sSQLCommand = 
-            String.Format("DELETE FROM \'{0}\' WHERE {1} = {2} AND {3} ={4};",
-			sTableName,
-			sXrayIdColumnName,
-            a_nXrayId,
-			sFieldIdColumnName,
-			a_nFieldId);
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-             datastorePtr.RunCommand(sSQLCommand);
-            }
-            return true;
-
-    }
-
-        public bool IsTableExists(String a_sTableName)
-        {
-
-            return IsDBExist();
-
-        }
-
-       public List<CPosXrayClr> ReadXrayPointInfoList(DataTable a_query)
-        {
-            List<CPosXrayClr> xrayList = new List<CPosXrayClr>();
-            Dictionary<List<int>, CPosXrayClr> mapXrayInfo = new Dictionary<List<int>, CPosXrayClr>();
-            foreach (DataRow row in a_query.Rows)
-            {
-               int nCol = (int)CElementChemistryTable.ColumnID.N_FIELD_ID- (int)CElementChemistryTable.ColumnID.MIN;
-                int curFldId = Convert.ToInt32(row[nCol]);
-                nCol = (int)CElementChemistryTable.ColumnID.N_XRAY_INDEX - (int)CElementChemistryTable.ColumnID.MIN;
-                int xrayId = Convert.ToInt32(row[nCol]);
-                List<int> fldvec = new List<int>();
-                fldvec.Add(curFldId);
-                fldvec.Add(xrayId);
-               
-                nCol = (int)CElementChemistryTable.ColumnID.S_NAME - (int)CElementChemistryTable.ColumnID.MIN;
-                string cheName = Convert.ToString(row[nCol]);
-                nCol = (int)CElementChemistryTable.ColumnID.F_PERCENTAGE - (int)CElementChemistryTable.ColumnID.MIN;
-                double percentage = Convert.ToDouble(row[nCol]);
-                CElementChemistryClr che = new CElementChemistryClr(cheName,percentage);
-
-                if (!mapXrayInfo.ContainsKey(fldvec))
-                {
-                    CPosXrayClr xray = new CPosXrayClr();
-                    xray.AddQuantifyElement(che);
-
-                    mapXrayInfo.Add(fldvec, xray);
-                }
-                else 
-                {
-                    CPosXrayClr xray = mapXrayInfo[fldvec];
-                    xray.AddQuantifyElement(che);
-                }
-
-
-            }
-            foreach (var keyvalue in mapXrayInfo)
-            {
-                xrayList.Add(keyvalue.Value);
-
-
-            }
-            return xrayList;
-            
-        }
-      public  bool GetAllMapedXrayInfo(ref Dictionary<List<int>, CPosXrayClr> mapXrayInfo)
-        {
-            DataTable a_query = GetTableQueryForDataTable();
-            //Dictionary<List<int>, CPosXrayClr> mapXrayInfo = new Dictionary<List<int>, CPosXrayClr>();
-            foreach (DataRow row in a_query.Rows)
-            {
-                int nCol = (int)CElementChemistryTable.ColumnID.N_FIELD_ID - (int)CElementChemistryTable.ColumnID.MIN;
-                int curFldId = Convert.ToInt32(row[nCol]);
-                nCol = (int)CElementChemistryTable.ColumnID.N_XRAY_INDEX - (int)CElementChemistryTable.ColumnID.MIN;
-                int xrayId = Convert.ToInt32(row[nCol]);
-                List<int> fldvec = new List<int>();
-                fldvec.Add(curFldId);
-                fldvec.Add(xrayId);
-
-                nCol = (int)CElementChemistryTable.ColumnID.S_NAME - (int)CElementChemistryTable.ColumnID.MIN;
-                string cheName = Convert.ToString(row[nCol]);
-                nCol = (int)CElementChemistryTable.ColumnID.F_PERCENTAGE - (int)CElementChemistryTable.ColumnID.MIN;
-                double percentage = Convert.ToDouble(row[nCol]);
-                CElementChemistryClr che = new CElementChemistryClr(cheName, percentage);
-
-                if (!mapXrayInfo.ContainsKey(fldvec))
-                {
-                    CPosXrayClr xray = new CPosXrayClr();
-                    xray.AddQuantifyElement(che);
-
-                    mapXrayInfo.Add(fldvec, xray);
-                }
-                else
-                {
-                    CPosXrayClr xray = mapXrayInfo[fldvec];
-                    xray.AddQuantifyElement(che);
-                }
-
-
-            }
-            return true;
-        }
-
-
-    }
-}

+ 0 - 39
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/ElementChemistryTable.cs

@@ -1,39 +0,0 @@
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-    class CElementChemistryTable : CSQLiteTable
-    {
-      public   enum  ColumnID
-        {
-            INVALID = -1,
-			MIN = 0,
-			N_XRAY_INDEX = 0,			
-			N_FIELD_ID = 1,
-			N_ELEMENT_ID = 2,
-			N_ELEMENT_TOTAL = 3,
-			S_NAME = 4,
-			F_PERCENTAGE = 5,
-			MAX = 5
-		};
-
-      public   CElementChemistryTable()
-	{
-     
-
-         AddColumn(new ColumnDefine() { ColumName = "XRayId", ColumType = new ColumnType(ColumnType.ID.INTEGER, false, false), IsPrimarykey = false });
-         AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-         AddColumn(new ColumnDefine() { ColumName = "ElementId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-         AddColumn(new ColumnDefine() { ColumName = "ElementNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-         AddColumn(new ColumnDefine() { ColumName = "Name", ColumType = new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-         AddColumn(new ColumnDefine() { ColumName = "Percentage", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-
-         SetTableName("ElementChemistry");
-    }
-}
-}

+ 0 - 299
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/GenInfoDB.cs

@@ -1,299 +0,0 @@
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-    public enum SYSTEMTIME
-    {
-        wYear = 0,
-        wMonth = 1,
-        wDayOfWeek = 2,
-        wDay = 3,
-        wHour = 4,
-        wMinute = 5,
-        wSecond = 6,
-        wMilliseconds = 7
-    };
-    public  class CGenInfoDB : CSQLiteDB
-    {
-
-        String m_sFileVersion;
-        const string g_sTableItemNameCreateTime = "CreateTime";
-        const String g_sTableItemNameTimeStart="TimeStart";
-        const String g_sTableItemNameTimeEnd="TimeEnd";
-        const String g_sTableItemNameResultStatus="ResultStatus";
-
-        const String g_sTableItemNameFileVersion="FileVersion";
-        const string g_sDBFileVersion = "2.0";
-        public CGenInfoDB(IDBStoreBase store, CSQLiteTable _table) : base(store, _table)
-        {
-
-        }
-
-        public new bool  Init( bool a_clean=false)
-	{
-		base.Init();
-
-            if (!InsertTimeStampRow(g_sTableItemNameCreateTime,""))
-            {
-            }
-            if (!InsertStringRow(g_sTableItemNameFileVersion, g_sDBFileVersion, ""))
-            {
-
-               
-            }
-            if (!InsertTimeStampRow(g_sTableItemNameTimeStart, ""))
-            {
-            }
-            if (!InsertTimeStampRow(g_sTableItemNameTimeEnd, ""))
-            {
-            }
-            string resultSta="0";//in default ,initialize it to 0,it will be updated in the running process.
-            if (!InsertStringRow(g_sTableItemNameResultStatus, resultSta,""))
-            {
-              
-               
-            }
-            m_sFileVersion = g_sDBFileVersion;
-
-            return true;
-
-	}
-      public  String GetFileVersion()
-        {
-            //System.Data.DataTable query;
-            m_sFileVersion.Trim();
-            if (m_sFileVersion=="")
-            {
-                // read in file version if it is empty
-                var datastorePtr = GetDatastore();
-               
-
-                var tableInfoPtr = GetTableInfo();
-               
-
-                var sItemName = tableInfoPtr.GetColumnName((int)CGenInfoTable.ColumnID.ITEM - (int)CGenInfoTable.ColumnID.MIN);
-                String sSQLCommand = string.Format("SELECT * FROM \'{0}\' WHERE {1} = \'{2}\';",
-                    (String)tableInfoPtr.GetTableName(),
-                    sItemName,
-                    (String)g_sTableItemNameFileVersion);
-
-               
-
-               var query = datastorePtr.QueryByCommand(sSQLCommand);
-
-              return  query.GetColValue(0);
-            }
-
-            return m_sFileVersion;
-        }
-
-       public String GetTableItemNameTimeStart()
-        {
-            return g_sTableItemNameTimeStart;
-        }
-       public String GetTableItemNameTimeEnd()
-        {
-            return g_sTableItemNameTimeEnd;
-        }
-        public String GetTableItemNameResultStatus()
-        {
-            return g_sTableItemNameResultStatus;
-        }
-        public bool InsertRow(string a_sItemName, string a_sItemContent, string a_sItemComment /*= nullptr*/)
-        {
-            var datastorePtr = GetDatastore();
-            var t = GetTableInfo();
-            String sComment = "NULL";
-           
-
-            String sFormat = t.GetInsertCommandFormatString(true);
-
-            String sSQLCommand = 
-            string.Format(sFormat,
-                a_sItemName,
-                a_sItemContent,
-                sComment);
-
-
-            datastorePtr.RunCommand(sSQLCommand);
-            return true;
-
-        }
-
-        public bool InsertStringRow(string a_sItemName, string a_sItemContent, string a_sItemComment /*= nullptr*/)
-        {
-           
-
-            if (!InsertRow(a_sItemName, a_sItemContent, a_sItemComment))
-            {
-
-                return false;
-            }
-
-            return true;
-        }
-
-        public bool InsertIntegerRow(string a_sItemName, int a_nItemContent, string a_sItemComment /*= nullptr*/)
-        {
-            String sContent = string.Format("{0:G}", a_nItemContent);
-
-
-            return InsertRow(a_sItemName, sContent, a_sItemComment);
-        }
-
-        public bool InsertDoubleRow(string a_sItemName, double a_dItemContent, string a_sItemComment /*= nullptr*/)
-        {
-            String sContent =  string.Format("{0:G}", a_dItemContent);
-
-            return InsertRow(a_sItemName, sContent, a_sItemComment);
-        }
-
-        public bool InsertTimeStampRow(string a_sItemName, string a_sItemComment /*= nullptr*/)
-        {
-            DateTime m_time = DateTime.Now;
-            //GetLocalTime(m_time);
-
-            string sDateTime =
-            string.Format( "{0:G}", m_time);
-           
-            return InsertRow(a_sItemName, sDateTime, a_sItemComment);
-
-        }
-
-        public bool UpdateRow(string a_sItemName, string a_sItemContent, string a_sItemComment /*= nullptr*/)
-        {
-
-         
-            var tableInfo = GetTableInfo();
-            var store = GetDatastore();
-                    
-
-            List<int> vColIndexes = new List<int>();
-            var nItemIndex = (int)(CGenInfoTable.ColumnID.ITEM - (int)CGenInfoTable.ColumnID.MIN);
-
-            vColIndexes.Add((int)CGenInfoTable.ColumnID.CONTENT - (int)CGenInfoTable.ColumnID.MIN);
-            vColIndexes.Add((int)CGenInfoTable.ColumnID.COMMENT - (int)CGenInfoTable.ColumnID.MIN);
-
-            String sFormat = tableInfo.GetUpdateCommandFormatString(vColIndexes, nItemIndex);
-            String sSQLCommand = string.Format(sFormat,
-                a_sItemContent,
-                a_sItemComment,
-                a_sItemName);
-
-
-            return store.RunCommand(sSQLCommand);
-
-        }
-
-        public bool UpdateStringRow(string a_sItemName, string a_sItemContent, string a_sItemComment /*= nullptr*/)
-        {
-            String sContent = "";
-            string.Format("\"{0:G}\"", a_sItemContent);
-
-            if (!UpdateRow(a_sItemName, sContent, a_sItemComment))
-            {
-
-                return false;
-            }
-
-            return true;
-        }
-
-        public bool UpdateIntegerRow(string a_sItemName, int a_nItemContent, string a_sItemComment /*= nullptr*/)
-        {
-            String sContent = "";
-            string.Format("{0:G}", a_nItemContent);
-
-            return UpdateRow(a_sItemName, sContent, a_sItemComment);
-        }
-
-        public bool UpdateDoubleRow(string a_sItemName, double a_dItemContent, string a_sItemComment /*= nullptr*/)
-        {
-            String sContent = "";
-            string.Format("{0:G}", a_dItemContent);
-
-            return UpdateRow(a_sItemName, sContent, a_sItemComment);
-        }
-
-        public bool UpdateTimeStampRow(string a_sItemName, string a_sItemComment /*= nullptr*/)
-        {
-            DateTime m_time = DateTime.Now;
-
-          string  sDateTime=string.Format("{0:G}", m_time);
-
-            return UpdateRow(a_sItemName, sDateTime, a_sItemComment);
-        }
-
-        public bool DeleteRow(string a_sItemName)
-        {
-            System.Data.DataTable query;
-            var datastorePtr = GetDatastore();
-
-            var tableInfoPtr = GetTableInfo();
-            var sNameColumnName = tableInfoPtr.GetColumnName((int)CGenInfoTable.ColumnID.ITEM - (int)CGenInfoTable.ColumnID.MIN);
-            String sSQLCommand = "";
-            string.Format("DELETE FROM \'{0}\' WHERE {1} = \'{2}\'", (string)tableInfoPtr.GetTableName(), sNameColumnName, a_sItemName);
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-            return datastorePtr.RunCommand(sSQLCommand);
-
-        }
-
-        public bool GetStringValue(string a_sItemName,ref String a_sString)
-        {
-            //System.Data.DataTable query;
-            var datastorePtr = GetDatastore();
-
-            var tableInfoPtr = GetTableInfo();
-
-            var sNameColumnName = tableInfoPtr.GetColumnName((int)CGenInfoTable.ColumnID.ITEM - (int)CGenInfoTable.ColumnID.MIN);
-            String sSQLCommand = "";
-            sSQLCommand=string.Format("SELECT * FROM \'{0}\' WHERE {1} = \'{2}\'",
-                (string)tableInfoPtr.GetTableName(),
-                sNameColumnName,
-                a_sItemName);
-
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-            var q = datastorePtr.QueryByCommand(sSQLCommand);
-
-            a_sString = q.GetColValue((int)CGenInfoTable.ColumnID.CONTENT - (int)CGenInfoTable.ColumnID.MIN);
-
-            return true;
-        }
-
-
-
-        public bool GetIntValue(string a_sItemName, int a_nValue)
-        {
-            System.Data.DataTable query;
-            var datastorePtr = GetDatastore();
-
-            var tableInfoPtr = GetTableInfo();
-
-            var sNameColumnName = tableInfoPtr.GetColumnName((int)CGenInfoTable.ColumnID.ITEM - (int)CGenInfoTable.ColumnID.MIN);
-            String sSQLCommand = "";
-            string.Format("SELECT * FROM \'{0}\' WHERE {1}= \'{2}\'",
-                (string)tableInfoPtr.GetTableName(),
-                sNameColumnName,
-                a_sItemName);
-
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-            var q = datastorePtr.QueryByCommand(sSQLCommand);
-
-            int nCol = (int)CGenInfoTable.ColumnID.CONTENT - (int)CGenInfoTable.ColumnID.MIN;
-            a_nValue = q.GetColIntValue(nCol, 0);
-
-            return true;
-        }
-    }
-}

+ 0 - 30
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/GenInfoTable.cs

@@ -1,30 +0,0 @@
-using OTSModelSharp.DTLBase;
-
-namespace OTSModelSharp
-{
-
-    public class CGenInfoTable:CSQLiteTable
-    {
-        public enum ColumnID
-        {
-            INVALID = -1,
-            MIN = 0,
-            ITEM = 0,
-            CONTENT = 1,
-            COMMENT = 2,
-            MAX = 2
-        };
-       
-     
-        public CGenInfoTable()
-	    {       
-       
-        AddColumn(new ColumnDefine() { ColumName = "name", ColumType = new ColumnType(ColumnType.ID.STRING, false, false), IsPrimarykey = false });
-		AddColumn(new ColumnDefine() { ColumName = "value", ColumType = new ColumnType(ColumnType.ID.STRING, false, false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "comment", ColumType = new ColumnType(ColumnType.ID.STRING, false, false), IsPrimarykey = false });
-
-        SetTableName("GeneralInfo");
-        }
-    
-     }
-}

+ 0 - 187
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/IncADataDB.cs

@@ -1,187 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Diagnostics;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-
-namespace OTSModelSharp
-{
-   public  class CIncADataDB : CSQLiteDB 
-    {
-        public CIncADataDB(IDBStoreBase _conStr, IDBTableBase _table) : base(_conStr, _table)
-        {
-
-        }
-
-       
-
-      public  bool UpdataAIncA(COTSParticleClr a_pParticle)
-        {
-        
-            if (a_pParticle == null)
-            {
-                return false;
-            }
-
-           
-
-            var datastorePtr = GetDatastore();
-
-            string sSQLCommand = "Update IncAData set AveGray = {0},Area ={1},IncAId={2} where FieldID = {3} and ParticleId = {4} ";  //sSQLCommand.Format(sSQLCommand,a_pParticle->GetAveGray(),a_pParticle->GetArea(),a_pParticle->GetType(),a_pParticle->GetFieldId(),a_pParticle->GetTagId());
-            sSQLCommand = string.Format(sSQLCommand, a_pParticle.GetAveGray(), a_pParticle.GetArea(), a_pParticle.GetType(), a_pParticle.GetFieldId(), a_pParticle.GetTagId());
-            var ret = datastorePtr.RunCommand( sSQLCommand);
-            
-            return ret;
-        }
-
-        public bool SaveAIncA(COTSParticleClr a_pParticle, CPosXrayClr a_pXray, System.Drawing.Point fldPos)
-        {
-       
-            var tableInfoPtr = GetTableInfo();
-          
-            if (tableInfoPtr==null)
-            {
-                return false;
-            }
-            var datastorePtr = GetDatastore();
-          
-
-            string sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
-            string sSQLCommand;
-            Rectangle rec = (Rectangle)a_pParticle.GetParticleRect();
-            System.Drawing.Point xrayPos = (System.Drawing.Point)a_pParticle.GetXRayPos();
-            System.Drawing.Point semPos = (System.Drawing.Point)a_pParticle.GetAbsolutPos();
-            sSQLCommand =string.Format(sInsertFormat, a_pParticle.GetFieldId(), a_pParticle.GetAnalysisId(), a_pParticle.GetAveGray(), rec.Left, rec.Top, rec.Width, rec.Height, a_pParticle.GetArea(), xrayPos.X, xrayPos.Y, a_pParticle.GetClassifyId(), (int)a_pXray.GetElementQuantifyData().Count, (int)(a_pParticle.GetFeature().GetSegmentsList().Count), fldPos.X, fldPos.Y, a_pParticle.GetTagId(), a_pParticle.GetDMAX(), a_pParticle.GetDMIN(), a_pParticle.GetDMPERP(), a_pParticle.GetDPRIMETER(), a_pParticle.GetORIENTATION(), a_pParticle.GetDINSCR(), a_pParticle.GetDMEAN(), a_pParticle.GetDELONG(), a_pParticle.GetFeretDiameter(), a_pParticle.GetTypeName(), a_pParticle.GetTypeColor(),semPos.X,semPos.Y);
-
-            if (!datastorePtr.RunCommand(sSQLCommand))
-            {
-
-                return false;
-            }
-
-
-            return true;
-        }
-
-        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++)
-            {
-                int curFldId = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_FIELD_ID]);  //GetColIntValue((int)CIncADataTable.ColumnID.N_FIELD_ID);
-                if (!mapFld.Keys.Contains(curFldId))
-                {
-                    COTSFieldData fld = new COTSFieldData();
-
-                    fld.SetId(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_PARTICLE_ID]));
-                    System.Drawing.Point fldPos =new System.Drawing.Point();
-                    fldPos.X = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_FldPosX]);
-                    fldPos.Y = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_FldPosY]);
-                    fld.SetPosition(fldPos);
-                    List<COTSParticleClr> ps = fld.ListAnalysisParticles;
-                    COTSParticleClr p = new COTSParticleClr();
-                    p.SetFieldId(fld.GetId());
-                    p.SetTagId(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_PARTICLE_ID]));
-                    p.SetType(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_INCA_ID]));
-                    int top = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_TOP]);
-                    int left = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_LEFT]);
-                    int width = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_WIDTH]);
-                    int height = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_HEIGHT]);
-                    Rectangle r = new Rectangle(left, top, left + width, top + height);
-                    p.SetParticleRect(r);
-                    p.SetSubParticles("");
-                    p.SetAveGray(Convert.ToByte(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_AVE_GRAY]));
-                    p.SetArea(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_AREA]));
-                    p.SetAnalysisId(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_XRAY_ID]));
-                    p.SetDMAX(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DMAX]));
-                    p.SetDMIN(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DMIN]));
-                    p.SetDMPERP(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DPERP]));
-                    p.SetDINSCR(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DINSCR]));
-                    p.SetDMEAN(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DMEAN]));
-                    p.SetDELONG(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DELONG]));
-                    p.SetDPRIMETER(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_PERIMETER]));
-                    p.SetORIENTATION(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_ORIENTATION]));
-                    p.SetTypeName(allRecords.Rows[i][(int)CIncADataTable.ColumnID.S_NAME].ToString());
-                    p.SetTypeColor(allRecords.Rows[i][(int)CIncADataTable.ColumnID.S_COLOR].ToString());
-                    ps.Add(p);
-                    allFlds.Add(fld);
-                    mapFld[curFldId] = fld;
-                }
-                else
-                {
-                    COTSFieldData fld = mapFld[curFldId];
-                    List<COTSParticleClr> ps = fld.ListAnalysisParticles;
-                    COTSParticleClr p = new COTSParticleClr();
-                    p.SetFieldId(fld.GetId());
-                    p.SetTagId(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_PARTICLE_ID]));
-                    p.SetType(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_INCA_ID]));
-                    int top = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_TOP]);
-                    int left = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_LEFT]);
-                    int width = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_WIDTH]);
-                    int height = Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_RECT_HEIGHT]);
-                    Rectangle r = new Rectangle(left, top, left + width, top + height);
-                    p.SetParticleRect(r);
-                    //p.SetSubParticles("");                   
-                    p.SetAveGray(Convert.ToByte(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_AVE_GRAY]));
-                    p.SetArea(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_AREA]));
-                    p.SetAnalysisId(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.N_XRAY_ID]));
-                    p.SetDMAX(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DMAX]));
-                    p.SetDMIN(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DMIN]));
-                    p.SetDMPERP(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DPERP]));
-                    p.SetDINSCR(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DINSCR]));
-                    p.SetDMEAN(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DMEAN]));
-                    p.SetDELONG(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_DELONG]));
-                    p.SetDPRIMETER(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_PERIMETER]));
-                    p.SetORIENTATION(Convert.ToInt32(allRecords.Rows[i][(int)CIncADataTable.ColumnID.F_ORIENTATION]));
-                    p.SetTypeName(allRecords.Rows[i][(int)CIncADataTable.ColumnID.S_NAME].ToString());
-                    p.SetTypeColor(allRecords.Rows[i][(int)CIncADataTable.ColumnID.S_COLOR].ToString());
-                    ps.Add(p);
-                }
-            }
-            return true;
-        }
-
-
-        protected DataTable GetQueryById(int a_nXrayId, int a_nFieldId)
-        {
-            CSQLiteTable query = new CSQLiteTable();
-            var datastorePtr = GetDatastore();
-  
-            var tableInfoPtr = GetTableInfo();
-    
-            string sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CIncADataTable.ColumnID.N_XRAY_ID - (int)CIncADataTable.ColumnID.MIN);     //tableInfoPtr.GetColumnName((int)CIncADataTable.ColumnID.N_XRAY_ID - (int)CIncADataTable.ColumnID.MIN);
-            string sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CIncADataTable.ColumnID.N_FIELD_ID - (int)CIncADataTable.ColumnID.MIN);    //tableInfoPtr.GetColumnName((int)CIncADataTable.ColumnID.N_FIELD_ID - (int)CIncADataTable.ColumnID.MIN);
-            string sSQLCommand=string.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND %s = {3};", (string)tableInfoPtr.GetTableName(), (string)sFieldIdColumnName, a_nFieldId, (string)sXrayIdColumnName, a_nXrayId);
-            DataTable t1 =datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-
-            return t1;
-        }
-        protected DataTable GetQueryOfAllRecord()
-        {
-  
-            var datastorePtr = GetDatastore();
-    
-            var tableInfoPtr = GetTableInfo();
-      
-
-            string sSQLCommand= string.Format("SELECT * FROM \'{0}\';", (string)tableInfoPtr.GetTableName());
-
-            DataTable t1 = datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-
-
-
-            return t1;
-        }
-      
-       
-     
-    }
-}

+ 0 - 87
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/IncADataTable.cs

@@ -1,87 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using OTSModelSharp.DTLBase;
-
-namespace OTSModelSharp
-{
-    class CIncADataTable : CSQLiteTable
-    {
-        public enum ColumnID : int
-        {
-            INVALID = -1,
-            MIN = 0,
-            N_FIELD_ID = 0,
-            N_XRAY_ID = 1,
-            N_AVE_GRAY = 2,
-            N_RECT_LEFT = 3,
-            N_RECT_TOP = 4,
-            N_RECT_WIDTH = 5,
-            N_RECT_HEIGHT = 6,
-            F_AREA = 7,
-            N_POS_X = 8,
-            N_POS_Y = 9,
-            N_INCA_ID = 10,
-            N_ELEMENT_NUM = 11,
-            N_SEGMENT_NUM = 12,
-            N_FldPosX = 13,
-            N_FldPosY = 14,
-            N_PARTICLE_ID = 15,
-            F_DMAX = 16,
-            F_DMIN = 17,
-            F_DPERP = 18,
-            F_PERIMETER = 19,
-            F_ORIENTATION = 20,
-            F_DINSCR = 21,
-            F_DMEAN = 22,
-            F_DELONG = 23,
-            F_DFERET = 24,
-            S_NAME = 25,
-            S_COLOR = 26,
-            N_SEMPOS_X=27,
-            N_SEMPOS_Y=28,
-            MAX = 28
-        }
-
-
-
-
-
-        public CIncADataTable()
-        {
-            AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "XrayId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "AveGray", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectLeft", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectTop", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectWidth", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectHeight", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "Area", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PosX", ColumType =new ColumnType(ColumnType.ID.INTEGER, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PosY", ColumType =new ColumnType(ColumnType.ID.INTEGER, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "TypeId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ElementNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SegmentNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldPosX", ColumType =new ColumnType(ColumnType.ID.INTEGER, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldPosY", ColumType =new ColumnType(ColumnType.ID.INTEGER, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ParticleId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DMAX", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DMIN", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DPERP", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PERIMETER", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ORIENTATION", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DINSCR", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DMEAN", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DELONG", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DFERET", ColumType =new ColumnType(ColumnType.ID.FLOAT, false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "TypeName", ColumType =new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "TypeColor", ColumType =new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SEMPosX", ColumType = new ColumnType(ColumnType.ID.INTEGER, false, false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SEMPosY", ColumType = new ColumnType(ColumnType.ID.INTEGER, false, false), IsPrimarykey = false });
-            SetTableName("IncAData");
-
-        }
-    }
-}

+ 0 - 291
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/IncAFileMgr.cs

@@ -1,291 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace OTSModelSharp
-{
-   public class CIncAFileMgr
-    {
-        // file pathname
-        String m_strPathName;
-
-      
-    
-
-        CMergeParticleDB m_pMergePartDB;
-
-        CSmallParticleInfoDB m_pSmallPartInfoDB;
-
-
-        CSegmentDB m_SegmentDB;
-
-
-       
-
-        CGenInfoDB m_generalInfoDB;
-
-    
-
-       
-
-        CIncADataDB m_IncADataDB;
-
-     
-
-        CSQLiteDBStore dbStore ;
-        CPosXrayDBMgr PosXrayDBMgr;
-        public   CIncAFileMgr(String fileName)
-	    {
-
-            m_strPathName = fileName;
-            dbStore = new CSQLiteDBStore(fileName);
-            
-           
-            
-        }
-        public CSQLiteDBStore GetDBStore()
-        {
-            return dbStore;
-        }
-        public CPosXrayDBMgr GetPosXrayDBMgr()
-        {
-            if (PosXrayDBMgr == null)
-                PosXrayDBMgr = new CPosXrayDBMgr(dbStore);
-            return PosXrayDBMgr;
-        
-        }
-        // initialization
-      public  void InitFile()
-        {
-
-            CreateIncAFile();
-            
-        }
-        public void InitDataTable()
-        {
-            
-            m_generalInfoDB = GetGeneralInfoDB();
-            m_generalInfoDB.Init();
-
-            m_pMergePartDB  = GetMergedParticleDB();
-            m_pMergePartDB.Init();//judge if the table exist,if exist delete firstly,then creat,else creat.
-            m_pSmallPartInfoDB = GetSmallParticleInfoDB();
-            m_pSmallPartInfoDB.Init();
-            m_IncADataDB = GetIncADB();
-            m_IncADataDB.Init();
-            m_SegmentDB = GetSegmentDB();
-            m_SegmentDB.Init();
-
-            PosXrayDBMgr = new CPosXrayDBMgr(dbStore);
-            PosXrayDBMgr.InitDataTable();
-        }
-
-      public CSegmentDB GetSegmentDB()
-        {
-            if (m_SegmentDB==null)
-            {
-              
-                    m_SegmentDB = new CSegmentDB(dbStore,new CSegmentTable());
-               
-            }
-
-            return m_SegmentDB;
-        }
-
-      
-
-        //Create
-        private  bool CreateIncAFile()
-        {
-         
-            m_strPathName.Trim();
-            if (m_strPathName=="")
-            {
-                return false;
-            }
-
-            // get database name
-            String sDatabaseName = m_strPathName;
-
-            if (Exists(sDatabaseName))
-            {
-                if (!Open(m_strPathName, false))
-                {
-
-                    return false;
-                }
-            }
-            else
-            {
-                if (!Create(m_strPathName,false))
-                {
-
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-
-        public bool Open(string a_sFileName, bool a_bForce /*= TRUE*/)
-        {
-
-            //var datastorePtr = GetDatastore();
-
-            return dbStore.Open(a_sFileName, a_bForce);
-
-        }
-
-        // check if the file exists or not
-        public bool Exists(string a_sPathFileName)
-        {
-            return System.IO.File.Exists(a_sPathFileName);
-        }
-
-        public  CSmallParticleInfoDB GetSmallParticleInfoDB()
-        {
-            if (m_pSmallPartInfoDB==null)
-            {
-              
-                    m_pSmallPartInfoDB = new CSmallParticleInfoDB(dbStore, new CSmallParticleInfoTable());
-               
-            }
-          
-            return m_pSmallPartInfoDB;
-        }
-
-        //Get DB
-        public CIncADataDB GetIncADB()
-        {
-            if (m_IncADataDB == null)
-            {
-
-                m_IncADataDB = new CIncADataDB(dbStore, new CIncADataTable());
-            }
-            return m_IncADataDB; ;
-        }
-
-        public CMergeParticleDB GetMergedParticleDB()
-        {
-            if (m_pMergePartDB==null)
-            {
-              
-                    m_pMergePartDB = new CMergeParticleDB(dbStore, new CMergeParticleTable());
-              
-            }
-
-            return m_pMergePartDB;
-        }
-
-     public  bool Create(string a_sFileName,  bool a_bOverwrite /*= FALSE*/)
-	 {
-
-      
-
-		if (!dbStore.Create(a_sFileName, a_bOverwrite))
-		{
-                return false;
-        }
-
-        return true;
-	 }
-
-      
-
-
-
-        public CGenInfoDB GetGeneralInfoDB()
-        {
-            if (m_generalInfoDB == null)
-            {
-                
-                     m_generalInfoDB=new CGenInfoDB(dbStore,new CGenInfoTable());    
-                   
-               
-            }
-
-            return m_generalInfoDB;
-
-        }
-
- 
-
-
-
-   
-
-        public bool SaveStatusDataToDB()
-        {
-            m_generalInfoDB = GetGeneralInfoDB();
-            m_generalInfoDB.UpdateTimeStampRow(m_generalInfoDB.GetTableItemNameTimeEnd(), "");
-
-            //int sta = Convert.ToInt32(msrStatus.GetStatus());
-            //m_generalInfoDB.UpdateIntegerRow(m_generalInfoDB.GetTableItemNameResultStatus(), sta, "");
-            return true;
-        }
-        public void BeginTransaction()
-        {
-
-            dbStore.CloseSynchronous();
-            dbStore.BeginTransaction();
-        }
-        public void CommitTransaction()
-        {
-            dbStore.CommitTransaction();
-
-        }
-       public bool SaveIncADataToDB(List<COTSParticleClr> m_listParticle , System.Drawing.Point m_FieldPos)
-        {
-            if (m_listParticle.Count == 0)
-            {
-                return true;
-            }
-            BeginTransaction();
-
-            foreach (var pParticle in m_listParticle)
-            {
-              
-                CPosXrayClr pXrayPtr=pParticle.GetXray();
-                
-
-                if (!m_IncADataDB.SaveAIncA(pParticle, pXrayPtr, m_FieldPos))
-                {
-
-                        return false;
-                }
-
-
-                if (!m_SegmentDB.SaveFeature(pParticle))
-                {
-
-                        return false;
-                }
-            }
-
-            CommitTransaction();
-             return true;
-	   }
-
-        internal void UpdateIncAList(List<COTSParticleClr> m_listParticle)
-        {
-            var IncADataDB = GetIncADB();
-           
-            BeginTransaction();
-            foreach (var pParticle in m_listParticle)
-            {
-                IncADataDB.UpdataAIncA(pParticle);
-                
-            }
-            CommitTransaction();
-            return ;
-        }
-    }
-}

+ 0 - 84
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/MergedParticles/MergParticleTable.cs

@@ -1,84 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using OTSModelSharp.DTLBase;
-namespace OTSModelSharp
-{
-    class CMergeParticleTable : CSQLiteTable
-    {
-       public enum  ColumnID
-        {
-            INVALID = -1,
-			MIN = 0,
-			N_FIELD_ID = 0,
-			N_XRAY_ID = 1,
-			N_AVE_GRAY = 2,
-			N_RECT_LEFT = 3,
-			N_RECT_TOP = 4,
-			N_RECT_WIDTH = 5,
-			N_RECT_HEIGHT = 6,
-			F_AREA = 7,
-			N_POS_X = 8,
-			N_POS_Y = 9,
-			N_INCA_ID = 10,
-			N_ELEMENT_NUM = 11,
-			N_SEGMENT_NUM = 12,
-			N_FldPosX = 13,
-			N_FldPosY = 14,
-			N_PARTICLE_ID = 15,
-			F_DMAX = 16,
-			F_DMIN = 17,
-			F_DPERP = 18,
-			F_PERIMETER = 19,
-			F_ORIENTATION = 20,
-			F_DINSCR = 21,
-			F_DMEAN = 22,
-			F_DELONG = 23,
-			F_DFERET = 24,
-			S_NAME = 25,
-			S_COLOR = 26,
-			S_SubParticles=27,
-			MAX = 27
-		};
-
-      public   CMergeParticleTable()
-	{
-          
-
-            AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "XrayId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "AveGray", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectLeft", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectTop", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectWidth", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "RectHeight", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "Area", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PosX", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PosY", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "TypeId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ElementNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SegmentNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldPosX", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldPosY", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ParticleId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = true });
-            AddColumn(new ColumnDefine() { ColumName = "DMAX", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DMIN", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DPERP", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PERIMETER", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ORIENTATION", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DINSCR", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DMEAN", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DELONG", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "DFERET", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "TypeName", ColumType = new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "TypeColor", ColumType = new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SubParticles", ColumType = new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-
-
-            SetTableName("MergedParticleInfo");
-
-    }
-}
-}

+ 0 - 224
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/MergedParticles/MergeParticleDB.cs

@@ -1,224 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace OTSModelSharp
-{
-  public  class CMergeParticleDB : CSQLiteDB
-    {
-      public   CMergeParticleDB(IDBStoreBase _conStr, IDBTableBase _table) : base(_conStr, _table)
-	{
-		
-    }
-     public  bool SaveAParticle( COTSParticleClr a_pParticle,  CPosXrayClr a_pXray, System.Drawing.Point fldPos)
-	{		
-		var tableInfoPtr = GetTableInfo();		
-		var datastorePtr = GetDatastore();
-            Rectangle prec = (Rectangle)a_pParticle.GetParticleRect();
-            System.Drawing.Point pos = (System.Drawing.Point)a_pParticle.GetAbsolutPos();
-            String sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
-        String sSQLCommand = String.Format(sInsertFormat,
-            a_pParticle.GetFieldId(),
-			a_pParticle.GetAnalysisId(),
-			a_pParticle.GetAveGray(),
-             prec.Left,
-             prec.Top,
-             prec.Width,
-             prec.Height,
-			a_pParticle.GetArea(),
-            pos.X,
-            pos.Y,
-			a_pParticle.GetType(),
-			(int) a_pXray.GetElementQuantifyData().Count,
-			(int) (a_pParticle.GetFeature().GetSegmentsList().Count),
-			fldPos.X,
-			fldPos.Y,
-			a_pParticle.GetTagId(),
-			a_pParticle.GetDMAX(),
-			a_pParticle.GetDMIN(),
-			a_pParticle.GetDMPERP(),
-			a_pParticle.GetDPRIMETER(),
-			a_pParticle.GetORIENTATION(),
-			a_pParticle.GetDINSCR(),
-			a_pParticle.GetDMEAN(),
-			a_pParticle.GetDELONG(),
-			a_pParticle.GetFeretDiameter(),
-			a_pParticle.GetTypeName(),
-			a_pParticle.GetTypeColor(),
-			a_pParticle.GetSubParticles()
-			);
-            //var helper = new SQLiteHelper(datastorePtr);
-            
-            if (datastorePtr.RunCommand(sSQLCommand)!=true)
-			{
-
-
-                return false;
-			}
-
-            return true;
-	}
-
-      public  bool UpdataAParticle( COTSParticleClr a_pParticle)
-	{
-
-       var tableInfoPtr = GetTableInfo();
-
-	   var datastorePtr = GetDatastore();
-
-		String sSQLCommand = "Update IncAData \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8};";
-           sSQLCommand= String.Format(sSQLCommand,
-           a_pParticle.GetAveGray(),
-			a_pParticle.GetArea(),
-			a_pParticle.GetType(),
-			a_pParticle.GetFieldId(),
-			a_pParticle.GetTagId());
-            //var helper = new SQLiteHelper(datastorePtr);      
-            if (datastorePtr.RunCommand(sSQLCommand) != true)
-		 {			
-			return false;
-		 }
-		return true;
-	}
-
-     public   bool GetAllFieldsRecord(ref List<COTSFieldData> allFlds)
-        {
-            var allRecords = this.GetQueryOfAllRecord();
-            Dictionary<int,COTSFieldData> mapFld = new Dictionary<int,COTSFieldData>();
-            for (int i = 0; i < allRecords.Rows.Count; i++)
-            {
-                int curFldId = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_FIELD_ID][0];             
-                
-                if (!mapFld.Keys.Contains(curFldId))
-                {
-                   COTSFieldData fld = new COTSFieldData();
-
-                   
-                    fld.SetId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_FIELD_ID][0]);
-                    System.Drawing.Point fldPos = new System.Drawing.Point();
-                    
-                    fldPos.X = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_FldPosX][0];
-                    fldPos.Y = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_FldPosY][0];
-                    fld.SetPosition(fldPos);
-                    List< COTSParticleClr> ps = fld.ListAnalysisParticles;
-                    COTSParticleClr p = new COTSParticleClr();
-                   
-                    p.SetTagId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_PARTICLE_ID][0]);
-                    p.SetClassifyId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_INCA_ID][0]);
-                    int top = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_TOP][0];
-                    int left = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_LEFT][0];
-                    int width = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_WIDTH][0];
-                    int height = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_HEIGHT][0];
-
-                    Rectangle r = new Rectangle(left, top, width,  height);
-                    p.SetParticleRect(r);
-                   
-                    p.SetAveGray(Convert.ToByte(allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_AVE_GRAY][0]));
-                    p.SetArea((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_AREA][0]);
-                    p.SetAnalysisId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_XRAY_ID][0]);
-                    //p.SetDMax((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DMAX][0]);
-                    //p.SetDMin((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DMIN][0]);
-                    //p.SetDPerp((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DPERP][0]);
-                    //p.SetDInscr((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DINSCR][0]);
-                    //p.SetDMean((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DMEAN][0]);
-                    //p.SetDElong((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DELONG][0]);
-                    //p.SetPerimeter((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_PERIMETER][0]);
-                    //p.SetOrientation((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_ORIENTATION][0]);
-                    //p.TypeName(allRecords.Rows[(int)CMergeParticleTable.ColumnID.S_NAME][0].ToString());
-                    //p.TypeColor(allRecords.Rows[(int)CMergeParticleTable.ColumnID.S_COLOR][0].ToString());
-                    ps.Add(p);
-                    allFlds.Add(fld);
-                    mapFld[curFldId] = fld;
-                }
-                else
-                {
-                   COTSFieldData  fld = mapFld[curFldId];
-                    List< COTSParticleClr>  ps = fld.ListAnalysisParticles;
-                    COTSParticleClr p = new COTSParticleClr();
-                    p.SetFieldId(fld.GetId());
-
-                    p.SetTagId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_PARTICLE_ID][0]);
-                    p.SetClassifyId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_INCA_ID][0]);
-                    int top = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_TOP][0];
-                    int left = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_LEFT][0];
-                    int width = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_WIDTH][0];
-                    int height = (int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_RECT_HEIGHT][0];
-                    Rectangle r = new Rectangle(left, top,  width,  height);
-                    p.SetParticleRect(r);
-                   
-                    p.SetAveGray(Convert.ToByte(allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_AVE_GRAY][0]));
-                    p.SetArea((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_AREA][0]);
-                    p.SetAnalysisId((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.N_XRAY_ID][0]);
-                    //p.SetDMax((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DMAX][0]);
-                    //p.SetDMin((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DMIN][0]);
-                    //p.SetDPerp((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DPERP][0]);
-                    //p.SetDInscr((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DINSCR][0]);
-                    //p.SetDMean((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DMEAN][0]);
-                    //p.SetDElong((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_DELONG][0]);
-                    //p.SetPerimeter((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_PERIMETER][0]);
-                    //p.SetOrientation((int)allRecords.Rows[(int)CMergeParticleTable.ColumnID.F_ORIENTATION][0]);
-                    //p.TypeName(allRecords.Rows[(int)CMergeParticleTable.ColumnID.S_NAME][0].ToString());
-                    //p.TypeColor(allRecords.Rows[(int)CMergeParticleTable.ColumnID.S_COLOR][0].ToString());
-                    ps.Add(p);
-                }
-                allRecords.NewRow();
-            };
-            allRecords.Clear();
-            return true;
-        }
-
-      public   DataTable GetQueryOfAllRecord()
-        {
-            DataTable query;
-
-            var datastorePtr = GetDatastore();
-           
-            var tableInfoPtr = GetTableInfo();
-
-            String sSQLCommand = "";
-            String.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8};",
-                (String)tableInfoPtr.GetTableName());
-            //var helper = datastorePtr;
-       
-            query = datastorePtr.QueryByCmdForDataTable(sSQLCommand); ;
-           
-            return query;
-        }
-
-     public   DataTable GetQueryById( long a_nXrayId,  long a_nFieldId)
-	{
-        DataTable query;
-
-        var datastorePtr = GetDatastore();
-
-        var tableInfoPtr = GetTableInfo();
-    
-        var sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CMergeParticleTable.ColumnID.N_XRAY_ID - (int)CMergeParticleTable.ColumnID.MIN);
-        var sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CMergeParticleTable.ColumnID.N_FIELD_ID - (int)CMergeParticleTable.ColumnID.MIN);
-
-            String sSQLCommand = "";
-            String.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8};",
-			(String) tableInfoPtr.GetTableName(),
-			sFieldIdColumnName,
-            a_nFieldId,
-			sXrayIdColumnName,
-			a_nXrayId);
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-            query = datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-
-		 return query;
-	}
-
-    
-    }
-}

+ 0 - 351
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/PosXrayDBMgr.cs

@@ -1,351 +0,0 @@
-using OTSDataType;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using System.Threading.Tasks;
-using OTSModelSharp.DTLBase;
-using OTSModelSharp.ServiceInterface;
-using OTSCLRINTERFACE;
-
-namespace OTSModelSharp
-{
-    public class CPosXrayDBMgr 
-    {
-        protected static NLog.Logger logger = null;
-
-        bool m_bHasElement;
-
-        List<CPosXrayClr> m_listPosXray;
-        //database
-        CXRayDataDB m_pXrayDataDB;
-        CElementChemistryDB m_pElementChemistryDB;
-        CPosXrayInfoDB m_pXrayInfoDB;
-
- 
-        const long GENERALXRAYCHANNELS = 2000;
-
-
-     
-        private CSQLiteDBStore m_dbStore;
-
-       
-        public CPosXrayDBMgr(CSQLiteDBStore a_dbStore)
-        {
-     
-            m_dbStore = a_dbStore;
-            m_listPosXray = new List<CPosXrayClr>();
-            logger = NLog.LogManager.GetCurrentClassLogger();
-        }
-        public void InitDataTable()
-        {
-            m_pXrayDataDB = new CXRayDataDB(m_dbStore, new CXRayDataTable());
-            m_pXrayDataDB.Init();
-            m_pElementChemistryDB = new CElementChemistryDB(m_dbStore, new CElementChemistryTable());
-            m_pElementChemistryDB.Init();
-            m_pXrayInfoDB = new CPosXrayInfoDB(m_dbStore, new CPosXrayInfoTable());
-            m_pXrayInfoDB.Init();
-        
-        
-        }
-
-        //// Load/Save
-        //public bool Load(int fldId,  bool a_bClear)
-        //{
-
-
-        //    // clear all data if necessary
-        //    if (a_bClear)
-        //    {
-        //        m_listPosXray.Clear();
-        //    }
-
-
-        //    if (!GetXrayList(fldId))
-        //    {
-        //        return false;
-        //    }
-        //    // ok, return TRUE
-        //    return true;
-        //}
-
-
-        //x-ray
-        public List<CPosXrayClr> GetPosXrayList() { return m_listPosXray; }
-
-
-        public void SetHasElement(bool a_bHasElement) { m_bHasElement = a_bHasElement; }
-
-
-        public CElementChemistryDB GetElementChemistryDB()
-        {
-            if (m_pElementChemistryDB == null)
-            {
-
-
-                m_pElementChemistryDB = new CElementChemistryDB(m_dbStore, new CElementChemistryTable());
-            }
-            return m_pElementChemistryDB;
-        }
-
-        //protected
-
-        //protected bool GetXrayList(int fldId)
-        //{
-        //    //get x-ray info list
-        //    List<CPosXrayClr> listInfo = new List<CPosXrayClr>();
-        //    //listInfo.Clear();
-        //    if (!GetXrayInfoList(ref listInfo, fldId))
-        //    {
-        //        logger.Error("GetXrayList: get x-ray info failed.");             
-        //        return false;
-        //    }
-
-        //    if (listInfo == null)
-        //    {
-        //        return false;
-        //    }
-        //    foreach (CPosXrayClr pInfo in listInfo)    
-        //    {
-        //        //get x-ray data
-        //        CPosXrayClr pXray = new CPosXrayClr();
-
-        //        pXray.SetIndex(Convert.ToInt32(pInfo.GetIndex()));
-        //        pXray.SetPartTagId(Convert.ToInt32(pInfo.GetPartTagId()));
-        //        pXray.SetPosition(pInfo.GetPosition());
-        //        pXray.SetScanFieldId(Convert.ToInt32(pInfo.GetScanFieldId()));
-        //        pXray.SetFeatureId(Convert.ToInt32(pInfo.GetFeatureId()));
-
-        //        long a_nXrayId = pInfo.GetIndex();
-        //        long a_nFieldId = pInfo.GetScanFieldId();
-
-        //        if (!GetXrayData(a_nXrayId, a_nFieldId, pXray))
-        //        {
-        //            logger.Error("GetXrayList: get x-ray data failed.");
-                
-        //            return false;
-        //        }
-
-        //        //get element list
-        //        if (m_bHasElement)
-        //        {
-
-        //            long nElementSize = pInfo.GetElementNum();
-
-        //            if (nElementSize == 0)
-        //            {
-        //                m_listPosXray.Add(pXray);
-        //                continue;
-        //            }
-
-        //            List<CElementChemistryClr> listElementChemistry = new List<CElementChemistryClr>();
-        //            if (!GetElementChemistry(a_nXrayId, a_nFieldId, nElementSize, ref listElementChemistry))
-        //            {
-        //                logger.Error("GetXrayList: get x-ray data failed.");
-                
-        //                return false;
-        //            }
-        //            pXray.SetElementQuantifyData(listElementChemistry);
-        //        }
-
-        //        m_listPosXray.Add(pXray);
-        //    }
-        //    return true;
-        //}
-        public bool SaveXray(List<CPosXrayClr> a_listPosXray,bool m_bHasElement)
-        {
-            if (a_listPosXray != null)          
-            {
-              
-                CElementChemistryDB XElementChemistryDB = GetElementChemistryDB();
-
-
-                m_dbStore.CloseSynchronous();
-                m_dbStore.BeginTransaction();
-                m_listPosXray = a_listPosXray;
-                //save info list
-                SaveXrayInfoList();
-
-                foreach (CPosXrayClr pPosXray in a_listPosXray)
-                {
-                    if (!SavePosXrayPtr(pPosXray))
-                    {
-                        logger.Error("Failed to save x-ray data.");
-                
-                        return false;
-                    }
-                    //save element
-                    if (m_bHasElement)
-                    {
-                        if (!XElementChemistryDB.SaveElementChemistriesList(pPosXray))
-                        {
-                            logger.Error("Failed to save element chemistry list data.");
-                            return false;
-                        }
-
-                    }
-                }
-                
-                m_dbStore.CommitTransaction();
-            }
-            return true;
-        }
-
-        public bool SavePosXrayPtr(CPosXrayClr a_pXray)
-        {
-
-            var tableInfoPtr =m_pXrayDataDB. GetTableInfo();
-
-            var datastorePtr = m_pXrayDataDB.GetDatastore();
-
-
-            String sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
-           
-            UInt32[] xrayData = a_pXray.GetXrayData();
-            String sSQLCommand = string.Format(sInsertFormat,
-            a_pXray.GetIndex(),
-            a_pXray.GetScanFieldId()
-                    );
-            byte[] bytedata = new byte[GENERALXRAYCHANNELS * 4];
-            
-            for (int j = 0; j < GENERALXRAYCHANNELS; j++)
-            {
-
-                uint m = xrayData[j];
-                byte[] dwordData = BitConverter.GetBytes(m);
-                bytedata[j * 4] = dwordData[0];
-                bytedata[j * 4 + 1] = dwordData[1];
-                bytedata[j * 4 + 2] = dwordData[2];
-                bytedata[j * 4 + 3] = dwordData[3];
-
-             
-
-            }
-
-
-
-            if (!datastorePtr.InsertBlobData(sSQLCommand, bytedata, Convert.ToInt32(otsdataconst.GENERALXRAYCHANNELS) * 4))
-            {
-
-                string.Format(a_pXray.GetIndex().ToString(),
-                a_pXray.GetScanFieldId(),
-                0,
-                sSQLCommand);
-
-
-                return false;
-            }
-            return true;
-        }
-
-    
-
-       
-
-
-        protected bool SaveXrayInfoList()
-        {
-            var XrayInfoDB = GetXrayInfoDB();
-            //List<CPosXray> m_listPosXray;
-
-            //m_listPosXray
-
-            if (!XrayInfoDB.SaveXrayInfoList(m_listPosXray))
-            {
-                logger.Error("Failed to save xray info list.");
-              
-                return false;
-            }
-            return true;
-        }
-     
-        protected bool GetXrayInfoList(ref List<CPosXrayClr> a_listXra, int fldId)
-        {
-            var XrayInfoDB = GetXrayInfoDB();
-            if (XrayInfoDB==null)
-            {
-                logger.Error("Failed to open result setting table");
-           
-                return false;
-            }
-            a_listXra = XrayInfoDB.GetXrayInfoListByFieldId(fldId);
-            return true;
-        }
-        //protected bool GetXrayData( long a_nXrayId,  long a_nFieldId, CPosXrayClr a_pPosXray)
-        //{
-        //    if (a_pPosXray==null)
-        //    {
-        //        logger.Error("Invalid x-ray point.");               
-        //        return false;
-        //    }
-        //    CXRayDataDB XrayDataDB = GetXrayDataDB();
-        //    if (XrayDataDB==null)
-        //    {
-        //        logger.Error("Failed to open result setting table");
-        //        return false;
-        //    }
-        //    CPosXrayClr pPosXray = XrayDataDB.GetXRayDataById(a_nXrayId, a_nFieldId);
-        //    a_pPosXray.SetXrayData(pPosXray.GetXrayData());
-        //    return true;
-        //}
-        //protected bool GetElementChemistry( long a_nXrayId,  long a_nFieldId,  long a_nElementSize,ref List<CElementChemistryClr> a_listElementChemistry)
-        //{
-        //    CElementChemistryDB XElementChemistryDB = GetElementChemistryDB();
-        //    if (XElementChemistryDB==null)
-        //    {
-        //        logger.Error("Failed to open result setting table");
-        //        return false;
-        //    }
-        //    a_listElementChemistry.Clear();
-        //    a_listElementChemistry = XElementChemistryDB.GetElementChemistryListById(a_nXrayId, a_nFieldId, a_nElementSize);
-        //    return true;
-        //}
-        //Get DB
-        public CXRayDataDB GetXrayDataDB()
-        {
-            if (m_pXrayDataDB==null)
-            {
-         
-                m_pXrayDataDB = new CXRayDataDB(m_dbStore, new CXRayDataTable());
-              
-            }
-            return m_pXrayDataDB;
-        }
-
-        public CPosXrayInfoDB GetXrayInfoDB()
-        {
-            if (m_pXrayInfoDB==null)
-            {
-
-                m_pXrayInfoDB = new CPosXrayInfoDB(m_dbStore,new CPosXrayInfoTable());
-            }
-            return m_pXrayInfoDB;
-        }
-        // cleanup 
-        protected void Cleanup()
-        {
-            // need to do nothing at the moment
-            m_listPosXray.Clear();
-        }
-
-   
-        // duplication
-        protected void Duplicate( CPosXrayDBMgr a_oSource)
-        {
-            // initialization
-            m_listPosXray.Clear();
-
-
-            // copy data over
-            foreach(CPosXrayClr pPosXray in a_oSource.m_listPosXray)
-            //for (auto pPosXray : a_oSource.m_listPosXray)
-            {
-                CPosXrayClr pPosXrayNew = new CPosXrayClr(pPosXray);
-                m_listPosXray.Add(pPosXrayNew);
-            }
-        }
-    }
-
-    
-}

+ 0 - 289
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/PosXrayInfoDB.cs

@@ -1,289 +0,0 @@
-using OTSDataType;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using OTSModelSharp.DTLBase;
-using System.Data;
-using System.Drawing;
-using OTSCLRINTERFACE;
-
-namespace OTSModelSharp
-{
-      public class CPosXrayInfoDB :CSQLiteDB
-      {
-        protected static NLog.Logger logger = null;
-
-        protected CSQLiteTable m_tableInfo = new CSQLiteTable();
-        List<CPosXrayClr> m_listPosXrayInfo=new List<CPosXrayClr>();
-     
-        public CPosXrayInfoDB(IDBStoreBase _conStr, CSQLiteTable _table) : base(_conStr, _table)
-        {
-
-        }
-
-        public List<CPosXrayClr> GetXrayInfoListByFieldId(long a_nFieldId)
-        {
-            List<CPosXrayClr> xrayPointInfoVec =new List<CPosXrayClr>();
-
-            if (m_listPosXrayInfo!=null)
-            {
-                foreach(CPosXrayClr xrayPointInfo in m_listPosXrayInfo)   //for (auto & xrayPointInfo : m_listPosXrayInfo)
-                {
-                    if (xrayPointInfo.GetScanFieldId() == (System.UInt32)a_nFieldId)
-                    {
-                        xrayPointInfoVec.Add(xrayPointInfo);
-                    }
-                }
-            }
-            else
-            {
-                DataTable tableQuery = GetQueryByFieldId(a_nFieldId);
-                if (tableQuery!=null)
-                {
-                    return xrayPointInfoVec;
-                }
-
-                xrayPointInfoVec = ReadXrayPointInfoListByQuery(tableQuery);
-            }
-
-            return xrayPointInfoVec;
-        }
-
-        public List<CPosXrayClr> GetXrayInfoList(bool a_bForce, int fldId)
-        {
-            if (a_bForce)
-            {
-                m_listPosXrayInfo.Clear();
-            }
-
-            if (m_listPosXrayInfo.Count() == 0)
-            {
-                GetXrayInfoListByFieldId(fldId);
-            }
-
-            return m_listPosXrayInfo;
-        }
-        public bool SaveXrayInfoList(List<CPosXrayClr> a_xrayPointList)
-        {
-     
-            var tableInfoPtr = GetTableInfo();
-            if (tableInfoPtr==null) 
-            {
-                return false;
-            }
-            var datastorePtr = GetDatastore();
-            if (datastorePtr==null)
-            {
-                return false;
-            }
-            CSQLiteTable cSQLiteTable = new CSQLiteTable();
-            string sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);
-            string sSQLCommand = "";
-            foreach (CPosXrayClr xrayPointInfo in a_xrayPointList)
-            {
-                System.Drawing.Point pos = (System.Drawing.Point)xrayPointInfo.GetPosition();
-                var qtyData = xrayPointInfo.GetElementQuantifyData();
-                var elenum = qtyData.Count;
-                sSQLCommand =string.Format( sInsertFormat,
-                    (xrayPointInfo.GetIndex()),
-                    (pos.X) ,
-                    (pos.Y) ,
-                   (xrayPointInfo.GetScanFieldId()) ,
-                   (xrayPointInfo.GetPartTagId()) ,
-                    (xrayPointInfo.GetFeatureId()) ,
-                    (elenum));
-               
-                if (!datastorePtr.RunCommand(sSQLCommand, false))
-                {
-         
-                    return false;
-                }
-            }
-      
-
-            return true;
-        }
-       
-
-       
-
-        //public bool DeleteXrayListByFieldId(long a_nFieldId)
-        //{
-        //    if (m_listPosXrayInfo != null)
-        //    {
-
-        //        for (int i = 0; i < m_listPosXrayInfo.Count; i++)
-        //        {
-        //            if (m_listPosXrayInfo[i].GetScanFieldId() == (uint)a_nFieldId)
-        //            {
-        //                m_listPosXrayInfo.Remove(m_listPosXrayInfo[i]);
-        //            }
-        //        }
-        //    }
-        //    var tableInfoPtr = GetTableInfo();
-        //    if (tableInfoPtr == null)
-        //    {
-        //        return false;
-        //    }
-        //    var datastorePtr = GetDatastore();
-        //    if (datastorePtr == null)
-        //    {
-        //        return false;
-        //    }
-
-        //    string sTableName = tableInfoPtr.GetTableName();
-
-        //    if (!datastorePtr.IsTableExists(sTableName))
-        //    {
-        //        logger.Trace("Table %s not exist" + sTableName);
-        //        return true;
-        //    }
-
-        //    string sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CPosXrayInfoTable.ColumnID.N_FIELD_ID - (int)CPosXrayInfoTable.ColumnID.MIN);
-
-       
-
-
-        //    string sSQLCommand = "DELETE FROM \'{0}\' WHERE {1} = {2}";
-        //    sSQLCommand = string.Format(sSQLCommand, tableInfoPtr.GetTableName(), sFieldIdColumnName, a_nFieldId);
-
-        //    return datastorePtr.RunCommand(sSQLCommand);
-        //}
-
-
-       
-
-        protected bool ReadXrayPointInfoList()
-        {
-            var st = GetDatastore();
-            var t = GetTableInfo();
-            DataTable query = st.QueryByTableNameForDataTable(t.GetTableName(), "");
-            if (query!=null)
-            {
-                return false;
-            }
-
-            m_listPosXrayInfo = ReadXrayPointInfoListByQuery(query);
-
-            return true;
-        }
-        protected List<CPosXrayClr> ReadXrayPointInfoListByQuery(DataTable a_query)
-        {
-            List<CPosXrayClr> xrayPointInfoVec =new List<CPosXrayClr>();
-            //xrayPointInfoVec.Clear();
-            //int nRowId = 0;
-            //int nWrongItems = 0;
-            //while (!a_query.IsEOF())
-            //{
-            //    CPosXrayClr xrayPointInfo = ReadXrayPointInfo(a_query);
-
-            //    if (xrayPointInfo!=null)
-            //    {
-            //        logger.Info("Read xray point info item failed: row id: %d");
-            //        nWrongItems++;
-            //    }
-            //    else
-            //    {
-            //        xrayPointInfoVec.Add(xrayPointInfo);
-            //    }
-            //    a_query.NextRow();
-            //    nRowId++;
-            //}
-            
-            for (int i=0; i< a_query.Rows.Count;i++)
-            {
-                CPosXrayClr xrayPointInfo = ReadXrayPointInfo(a_query);
-                if(xrayPointInfo != null)
-                {
-                    logger.Info("Read xray point info item failed: row id: %d",i);
-                    //nWrongItems++;
-                }
-                else
-                {
-                    xrayPointInfoVec.Add(xrayPointInfo);
-                }
-                //a_query.NextRow();
-                //nRowId++;
-            }
-            
-
-            return xrayPointInfoVec;
-        }
-        protected CPosXrayClr ReadXrayPointInfo(DataTable a_query)
-        {
-            int nCol;
-            //CPosXrayClr CPosXrayClr = new CPosXrayClr();
-            CPosXrayClr xrayPointPtr = new CPosXrayClr();
-
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_INDEX - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPointPtr.SetIndex((int)a_query.Rows[nCol][0]);
-
-
-
-            System.Drawing.Point xrayPosition =new System.Drawing.Point();
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_POS_X - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPosition.X = (int)a_query.Rows[nCol][0];
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_POS_Y - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPosition.Y = (int)a_query.Rows[nCol][0];
-            xrayPointPtr.SetPosition(xrayPosition);
-
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_FIELD_ID - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPointPtr.SetScanFieldId((int)a_query.Rows[nCol][0]);
-
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_PARTICLE_ID - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPointPtr.SetPartTagId((int)a_query.Rows[nCol][0]);
-
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_FEATURE_ID - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPointPtr.SetFeatureId((int)a_query.Rows[nCol][0]);
-
-            nCol = (int)CPosXrayInfoTable.ColumnID.N_ELEMENT_NUM - (int)CPosXrayInfoTable.ColumnID.MIN;
-            xrayPointPtr.SetElementNum((int)a_query.Rows[nCol][0]);
-
-            return xrayPointPtr;
-        }
-        protected DataTable GetQueryByFieldId( long a_nFieldId)
-        {
-            CSQLiteTable query =new CSQLiteTable();
-            var datastorePtr = GetDatastore();
-            //if (datastorePtr==null)
-            //{
-            //    return query;
-            //}
-            var tableInfoPtr = GetTableInfo();
-            //if (tableInfoPtr==null)
-            //{
-            //    return query;
-            //}
-            string sFieldIdColumnName = tableInfoPtr.GetColumnName(Convert.ToInt32(CPosXrayInfoTable.ColumnID.N_FIELD_ID) - Convert.ToInt32(CPosXrayInfoTable.ColumnID.MIN));
-            //string sSQLCommand;
-            //sSQLCommand = "SELECT * FROM \'{0}\' WHERE {1} ={2};" + Convert.ToString(tableInfoPtr.GetTableName()) +
-            //    Convert.ToString(sFieldIdColumnName) + a_nFieldId;
-            //CSQLiteQuery cSQLiteQuery = new CSQLiteQuery();
-            //query = datastorePtr.QueryByCommand(sSQLCommand);
-
-            string sSQLCommand = string.Format("SELECT * FROM \'{0}\' WHERE {1} ={2};",tableInfoPtr.GetTableName(),sFieldIdColumnName, a_nFieldId);
-            DataTable t1 = datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-
-            //ASSERT(query);
-            //if (query==null || !query.IsValid())
-            //{
-            //    logger.Info("Invalid quary command (%s)."+Convert.ToString(sSQLCommand));
-            //    //ASSERT(FALSE);
-            //    CDBQueryBase cDBQueryBase = new CDBQueryBase();
-            //    return (cDBQueryBase);
-            //}
-            //// do the table related valid checking
-            //if (query.GetColCount() != GetTableInfo().GetColumnCount())
-            //{
-            //    logger.Info("query col num value is %d, but not %d"+ cSQLiteQuery.GetColCount()+ GetTableInfo().GetColumnCount());
-            //    CDBQueryBase cDBQueryBase = new CDBQueryBase();
-            //    return (cDBQueryBase);
-            //}
-
-            return t1;
-        }
-    }
-}

+ 0 - 41
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/PosXrayInfoTable.cs

@@ -1,41 +0,0 @@
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-    public class CPosXrayInfoTable: CSQLiteTable
-    {
-        public enum ColumnID
-        {
-            INVALID = -1,
-            MIN = 0,
-            N_INDEX = 0,
-            N_POS_X = 1,
-            N_POS_Y = 2,
-            N_FIELD_ID = 3,
-            N_PARTICLE_ID = 4,
-            N_FEATURE_ID = 5,
-            N_ELEMENT_NUM = 6,
-            MAX = 6
-        }
-        public CPosXrayInfoTable()
-        {
-            CSQLiteTable cSQLiteTable = new CSQLiteTable();
-            //cSQLiteTable.AddColumn();
-            AddColumn(new ColumnDefine() { ColumName = "XrayIndex", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PosX", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "PosY", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ParticleId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FeatureId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ElementNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            SetTableName("PosXrayInfo");
-        }
-
-
-    }
-}

+ 0 - 486
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SegmentDB.cs

@@ -1,486 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-  public  class CSegmentDB: CSQLiteDB
-  {
-      
-        // particle list
-       List< COTSParticleClr> m_listParticle;
-
-
-     public CSegmentDB(IDBStoreBase _conStr, CSQLiteTable _table):base(_conStr,_table)	
-	{
-		
-    }
-
-        public COTSFeatureClr GetFeatureById( long a_nXrayId,  long a_nFieldId,  long a_nSegmentSize)
-	{
-
-        COTSFeatureClr pFeatureNew = null;
-
-		if (m_listParticle.Count!=0)
-		{
-			foreach (var pParticle in m_listParticle)
-			{
-			COTSFeatureClr pFeature = pParticle.GetFeature();
-            if (pParticle.GetAnalysisId() == a_nXrayId && pParticle.GetFieldId() == a_nFieldId && (int) pFeature.GetSegmentsList().Count == a_nSegmentSize)
-			{ 	
-            pFeatureNew = new COTSFeatureClr(pFeature);
-    }
-    }
-		}
-		else
-		{
-			// read element list
-			for (int i = 0; i<a_nSegmentSize; i++)
-			{
-				var tableQuery = GetQueryById(a_nXrayId, a_nFieldId, i, a_nSegmentSize); //CElementChemistryDB
-
-
-                COTSParticleClr pParticle = ReadParticleInfo(tableQuery);
-
-
-                COTSFeatureClr pFeature = pParticle.GetFeature();
-
-                pFeatureNew = new COTSFeatureClr(pFeature);
-			}
-
-		}
-
-		return pFeatureNew;
-	}
-
-        public  List< COTSParticleClr>  GetParticleInfoList( bool a_bForce/* = FALSE*/)
-	{
-		if (a_bForce)
-		{
-        m_listParticle.Clear();
-		}
-
-		if (m_listParticle.Count == 0)
-		{
-			ReadParticleInfoList();
-		}
-
-		return m_listParticle;
-	}
-
-        public  COTSParticleClr ReadParticleInfo(DataTable a_query)
-        {
-            int nCol;
-            COTSParticleClr pParticle=new COTSParticleClr();
-
-            int nXrayIdNow;
-            int nFieldIdNow;
-           // CSegmentTable类改完再改此处
-            nCol = (int)CSegmentTable.ColumnID.N_XRAY_INDEX - (int)CSegmentTable.ColumnID.MIN;
-            nXrayIdNow = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_XRAY_INDEX][0];
-            pParticle.SetAnalysisId(nXrayIdNow);
-
-            nCol = (int)CSegmentTable.ColumnID.N_FIELD_ID - (int)CSegmentTable.ColumnID.MIN;
-            nFieldIdNow = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_FIELD_ID][0];
-            pParticle.SetFieldId(nFieldIdNow);
-
-            nCol = (int)CSegmentTable.ColumnID.N_SEGMENT_ID - (int)CSegmentTable.ColumnID.MIN;
-            int nSegmentIndex = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_SEGMENT_ID][0];
-
-            nCol = (int)CSegmentTable.ColumnID.N_SEGMENT_TOTAL - (int)CSegmentTable.ColumnID.MIN;
-            int nSegmentTotal = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_SEGMENT_TOTAL][0];
-            //pParticle->SetElementNum(nElementTotal);
-
-            if (nSegmentIndex > nSegmentTotal - 1)
-            {
-                return null;
-            }
-
-            COTSSegmentClr pSegment = new COTSSegmentClr();
-
-            nCol = (int)CSegmentTable.ColumnID.N_START - (int)CSegmentTable.ColumnID.MIN;
-            int nStart = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_START][0];
-            pSegment.SetStart(nStart);
-
-            nCol = (int)CSegmentTable.ColumnID.N_HEIGHT - (int)CSegmentTable.ColumnID.MIN;
-            int nHeight = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_HEIGHT][0];
-            pSegment.SetHeight(nHeight);
-
-            nCol = (int)CSegmentTable.ColumnID.N_LENGTH - (int)CSegmentTable.ColumnID.MIN;
-            int nLength = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_LENGTH][0];
-            pSegment.SetLength(nLength);
-
-            List<COTSSegmentClr> listSegment = new List<COTSSegmentClr>();
-            listSegment.Add(pSegment);
-
-            a_query.NewRow();
-
-            int nXrayNew, nFieldIdNew;
-
-            int nRowId = 0;
-
-            
-            for (int i = 0; i < a_query.Rows.Count; i++)
-            {
-                nCol = (int)CSegmentTable.ColumnID.N_XRAY_INDEX - (int)CSegmentTable.ColumnID.MIN;
-                nXrayNew = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_XRAY_INDEX][0];
-
-                nCol = (int)CSegmentTable.ColumnID.N_FIELD_ID - (int)CSegmentTable.ColumnID.MIN;
-                nFieldIdNew = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_FIELD_ID][0];
-
-                if (nXrayNew == nXrayIdNow && nFieldIdNew == nFieldIdNow)
-                {
-                    nCol = (int)CSegmentTable.ColumnID.N_SEGMENT_ID - (int)CSegmentTable.ColumnID.MIN;
-                    int nSegmentIndexs = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_SEGMENT_ID][0];
-
-                    nCol = (int)CSegmentTable.ColumnID.N_SEGMENT_TOTAL - (int)CSegmentTable.ColumnID.MIN;
-                    int nSegmentTotals = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_SEGMENT_TOTAL][0];
-
-                    if (nSegmentIndex > nSegmentTotal - 1)
-                    {
-                        return null;
-                    }
-                  
-
-                    nCol = (int)CSegmentTable.ColumnID.N_START - (int)CSegmentTable.ColumnID.MIN;
-                    int Start = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_START][0];
-                    pSegment.SetStart(nStart);
-
-                    nCol = (int)CSegmentTable.ColumnID.N_HEIGHT - (int)CSegmentTable.ColumnID.MIN;
-                    int Height = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_HEIGHT][0];
-                    pSegment.SetHeight(nHeight);
-
-                    nCol = (int)CSegmentTable.ColumnID.N_LENGTH - (int)CSegmentTable.ColumnID.MIN;
-                    int Length = (int)a_query.Rows[(int)CSegmentTable.ColumnID.N_LENGTH][0];
-                    pSegment.SetLength(nLength);
-
-                    listSegment.Add(pSegment);
-
-                    if (nSegmentIndex == nSegmentTotal - 1)
-                    {
-                        break;
-                    }
-                }
-                else
-                {
-                    continue;
-                }
-
-                a_query.NewRow();
-                nRowId++;
-            }
-
-            COTSFeatureClr pFeature = new COTSFeatureClr();
-            pFeature.SetSegmentsList(listSegment,true);
-
-            pParticle.SetFeature(pFeature);
-
-            return pParticle;
-        }
-
-    public  bool SaveFeature( List<COTSParticleClr> a_ParticleList)
-	{
-            //System.Data.DataTable query;
-            var tableInfoPtr = GetTableInfo();   
-            var datastorePtr = GetDatastore();
-	        String sInsertFormat =tableInfoPtr. GetInsertCommandFormatString(true);//SQLiteTable
-            String sSQLCommand = "";
-		foreach (var pParticle in a_ParticleList)
-		{			
-		COTSFeatureClr pFeature = pParticle.GetFeature();
-	    List< COTSSegmentClr> listSegments = pFeature.GetSegmentsList();
-            int nSize = (int)listSegments.Count;
-            int nSegmentIndex = 0;
-			foreach (var pSegment in listSegments)
-			{
-			sSQLCommand=	String.Format(sInsertFormat,
-                    pParticle.GetAnalysisId(),
-					pParticle.GetFieldId(),
-					nSegmentIndex,
-					nSize,
-					pSegment.GetStart(),
-					pSegment.GetHeight(),
-					pSegment.GetLength(),
-					pParticle.GetTagId());
-                  
-                    datastorePtr.RunCommand(sSQLCommand);
-    
-				nSegmentIndex++;
-			}
-		}
-            return true;
-	}
-
-     public  bool SaveFeature(COTSParticleClr a_pParticle)
-        {
-            //System.Data.DataTable query;
-            var tableInfoPtr = GetTableInfo();
-           
-            var datastorePtr = GetDatastore();
-            
-            String sInsertFormat = tableInfoPtr.GetInsertCommandFormatString(true);//CSQLiteTable修改完再修改此处
-            String sSQLCommand = "";
-
-            COTSFeatureClr pFeature = a_pParticle.GetFeature();
-            List< COTSSegmentClr> listSegments = pFeature.GetSegmentsList();
-           
-            int nSize = (int)listSegments.Count;
-            int nSegmentIndex = 0;
-            foreach (var pSegment in listSegments)
-            {
-                sSQLCommand=String.Format(sInsertFormat,
-                    a_pParticle.GetAnalysisId(),
-                    a_pParticle.GetFieldId(),
-                    nSegmentIndex,
-                    nSize,
-                    pSegment.GetStart(),
-                    pSegment.GetHeight(),
-                    pSegment.GetLength(),
-                    a_pParticle.GetTagId());
-
-               
-                 datastorePtr.RunCommand(sSQLCommand);
-                
-
-                nSegmentIndex++;
-            }
-
-            return true;
-        }
-
-     public  bool DeleteFeatureById( long a_nFieldId,  long a_nXrayId)
-	{
-            System.Data.DataTable query;
-            if (m_listParticle.Count!=0)
-		{
-
-               
-                for (int itr = 0; itr < m_listParticle.Count; itr++)
-                {
-                    if (m_listParticle[itr].GetTypeName() ==a_nFieldId.ToString())
-                    {
-                        COTSParticleClr particle = new COTSParticleClr();
-                        particle = m_listParticle[itr];
-                        break;
-                    }
-                }
-
-
-            }
-
-       var tableInfoPtr = GetTableInfo();
-		var datastorePtr = GetDatastore();
-
-            String sTableName = tableInfoPtr.GetTableName();
-		if (!IsTableExists(""))
-		{
-
-                return true;
-		}
-        //CSQLiteTable 修改完再修改此处
-		var sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_XRAY_INDEX - (int)CSegmentTable.ColumnID.MIN);
-        var sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_FIELD_ID - (int)CSegmentTable.ColumnID.MIN);
-
-            String sSQLCommand = "";
-            String.Format("DELETE FROM \'%s\' WHERE %s = %d AND %s = %d AND %s = %d AND %s = %d;", (String)tableInfoPtr.GetTableName(), sXrayIdColumnName,
-            a_nXrayId, sFieldIdColumnName, a_nFieldId);
-            //var helper = new SQLiteHelper(datastorePtr);
-            datastorePtr.RunCommand(sSQLCommand);
-           
-            return true;
-	}
-
-       
-
-        public  bool IsTableExists(String a_sTableName)
-        {
-           
-            return tableExists(a_sTableName);//OTSSQLiteDll,SQLiteStore中的GetDBPtr()方法修改完再修改此处
-
-        }
-
-       public bool tableExists(string szTable)
-        {
-            String sSQL = "";
-            string.Format("select count(*) from sqlite_master where type='table' and name='%s'", szTable);
-            int nRet = Convert.ToInt32(sSQL);
-            return (nRet > 0);
-        }
-
-      
-
-        public  bool GetAllSegmentsRecord(Dictionary<List<int>, List<COTSSegmentClr>> mapSegments)
-        {                  
-            var allRecords = this.GetQueryOfAllRecord();
-            for (int i = 0; i < allRecords.Rows.Count; i++)
-            {
-                int curFldId = Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_FIELD_ID]);
-                int curParticleId = Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_PARTICLE_ID]);
-                List<int> fldvec = new List<int>();
-                fldvec.Add(curFldId);
-                fldvec.Add(curParticleId);
-                //var itr = mapSegments.ContainsKey(fldvec);                   
-                if (mapSegments.ContainsKey(fldvec))
-                {
-                    List<COTSSegmentClr> segments = mapSegments[fldvec];
-                    COTSSegmentClr segment = new COTSSegmentClr();
-                    segment.SetStart(Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_START]));
-                    segment.SetHeight(Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_HEIGHT]));
-                    segment.SetLength(Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_LENGTH]));
-                    //segment.UpDownConection(segment);
-                    segments.Add(segment);                  
-                                 
-                }
-                else
-                {
-                    //auto pairseg = *itr;
-                    List<COTSSegmentClr> segments = new List<COTSSegmentClr>();
-                    COTSSegmentClr segment = new COTSSegmentClr();
-                    segment.SetStart(Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_START]));
-                    segment.SetHeight(Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_HEIGHT]));
-                    segment.SetLength(Convert.ToInt32(allRecords.Rows[i][(int)CSegmentTable.ColumnID.N_LENGTH]));
-                    segments.Add(segment);
-                    mapSegments.Add(fldvec, segments);
-                }
-
-
-                   
-            }
-            //allRecords.Dispose();                
-            return true;
-        }
-
-       public bool ReadParticleInfoList()
-       {
-            var tableInfoPtr = GetTableInfo();
-           
-            var query =GetTableQueryForDataTable (tableInfoPtr.GetTableName());//CElementChemistryDB
-
-            m_listParticle = ReadParticleInfoList(query);
-
-            return true;
-       }
-
-        public List< COTSParticleClr> ReadParticleInfoList(DataTable a_query)
-        {
-            List<COTSParticleClr> listParticle = new List<COTSParticleClr>();
-
-            int nRowId = 0;
-            int nWrongItems = 0;
-
-            DataTable dataTable = new DataTable();
-           foreach(var r in a_query.Rows)
-            {
-                var ParticleInfo = ReadParticleInfo(dataTable);  //current x-ray point		
-
-                if (ParticleInfo != null)
-                {
-                   
-                    nWrongItems++;
-                }
-                else
-                {
-                    if (listParticle.Count!=0)
-                    {
-                        int nXrayId = ParticleInfo.GetAnalysisId();
-                        int nFieldId = ParticleInfo.GetFieldId();
-
-                        COTSFeatureClr pFeature = ParticleInfo.GetFeature();
-                     
-                       List< COTSSegmentClr> listSegmentNew = pFeature.GetSegmentsList();
-
-                        int nIndex = 0;
-
-                        foreach (var pParticle in listParticle)
-                        {
-
-                            listParticle.Remove(pParticle);
-
-                            if ((pParticle.GetAnalysisId() == nXrayId)
-                                && (pParticle.GetFieldId() == nFieldId))
-                            {
-                                COTSFeatureClr apFeature = pParticle.GetFeature();
-                                
-                              List < COTSSegmentClr> listSegmentOld = pFeature.GetSegmentsList();
-
-                                foreach (var pSegment in listSegmentNew)
-                                {
-                                    listSegmentOld.Add(new COTSSegmentClr(pSegment));
-                                }
-
-                                pFeature.SetSegmentsList(listSegmentOld,true);
-
-                                ParticleInfo.SetFeature(pFeature);
-
-                                break;
-                            }
-                            nIndex++;
-                        }
-
-                    }
-
-                    listParticle.Add(ParticleInfo);
-                }
-
-               
-            }
-
-            return listParticle;
-        }
-
-        public DataTable GetQueryById( long a_nXrayId,  long a_nFieldId,  long a_nSegmentId,  long a_nSegmentNum)
-	{
-
-        DataTable query;
-        var datastorePtr = GetDatastore();
-            //var helper = new SQLiteHelper(datastorePtr);
-
-        var tableInfoPtr = GetTableInfo();
-
-            //没有SegmentTable类,有了再修改此处 
-            // String sXrayIdColumnName = tableInfoPtr.columns((int)CSegmentTable.ColumnID.N_XRAY_INDEX - (int)CSegmentTable.ColumnID.MIN);
-            var sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_XRAY_INDEX - (int)CSegmentTable.ColumnID.MIN);
-            //  String sXrayIdColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_XRAY_INDEX - (int)CSegmentTable.ColumnID.MIN);
-            var sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_FIELD_ID - (int)CSegmentTable.ColumnID.MIN);
-        String sElementIdColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_SEGMENT_ID - (int)CSegmentTable.ColumnID.MIN);
-        String sElementNumColumnName = tableInfoPtr.GetColumnName((int)CSegmentTable.ColumnID.N_SEGMENT_TOTAL - (int)CSegmentTable.ColumnID.MIN);
-
-           // String sSQLCommand;
-            String sSQLCommand=String.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8};",(String)tableInfoPtr.GetTableName(),
-            (String)sFieldIdColumnName,a_nFieldId,(String)sXrayIdColumnName,a_nXrayId,a_nSegmentId, (String)sElementNumColumnName,
-            a_nSegmentNum);
-
-		    query = datastorePtr.QueryByCmdForDataTable(sSQLCommand);//SQLiteStote在OTSSQLiteDll中修改完再修改此处
-
- 
-
-		return query;
-	}
-
-        public  DataTable GetQueryOfAllRecord()//CDBQueryBase在OTSClassifyEngine中修改完再更改此处
-        {
-
-            DataTable query;
-            var datastorestr = GetDatastore();
-            
-            var tableInfoPtr = GetTableInfo();
-
-
-            String sSQLCommand=String.Format("SELECT * FROM \'{0}\';", tableInfoPtr.GetTableName());
-            //sSQLCommand= tableInfoPtr.GetTableName();
-            //var helper = new SQLiteHelper(datastorestr);
-            query = datastorestr.QueryByCmdForDataTable(sSQLCommand);//SQLiteStote在OTSSQLiteDll中修改完再修改此处
-            
-            // do the table related valid checking
-        
-            return query;
-        }
-
-    }
-}

+ 0 - 49
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SegmentTable.cs

@@ -1,49 +0,0 @@
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-
-
-namespace OTSModelSharp
-{
-    class CSegmentTable: CSQLiteTable
-    {
-        public enum ColumnID:int
-        {
-            INVALID = -1,
-            MIN = 0,
-            N_XRAY_INDEX = 0,
-            N_FIELD_ID = 1,
-            N_SEGMENT_ID = 2,
-            N_SEGMENT_TOTAL = 3,
-            N_START = 4,
-            N_HEIGHT = 5,
-            N_LENGTH = 6,
-            N_PARTICLE_ID = 7,
-            MAX = 7
-        };
-
-        public  CSegmentTable()
-        {  
-            AddColumn(new ColumnDefine() { ColumName = "XRayId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SegmentId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "SegmentNum", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "Start", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "Height", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "Length", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "ParticleId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            SetTableName("Segment");
-        }
-
-
-
-       
-        
-    }
-}
-
-

+ 0 - 123
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SmallParticles/SmallParticleInfoDB.cs

@@ -1,123 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-  public  class CSmallParticleInfoDB : CSQLiteDB
-    {
-      public CSmallParticleInfoDB(IDBStoreBase _conStr, IDBTableBase _table) : base(_conStr, _table)
-        {
-		
-        }
-
-       public bool SaveAKindOfSmallParticle( CSmallParticleInfo a_pParticleInfo,  CPosXrayClr a_pXray, System.Drawing.Point fldPos)
-	   {
-		
-        var tableInfoPtr = GetTableInfo();
-		
-		var datastorePtr = GetDatastore();
-
-            String sInsertFormat = tableInfoPtr.GetInsertCommandFormatString();
-        
-
-
-          string  sSQLCommand=string.Format(sInsertFormat,
-        a_pParticleInfo.FieldId,
-
-        a_pParticleInfo.AveGray,
-
-        a_pParticleInfo.Area,
-
-        a_pParticleInfo.TypeId,
-
-        a_pParticleInfo.TypeName,
-        a_pParticleInfo.TypeColor,
-        a_pParticleInfo.Quantity
-        );
-            if (!datastorePtr.RunCommand(sSQLCommand))
-			{
-				
-
-                return false;
-			}
-
-            return true;
-	   }
-
-      public  bool UpdataAKindOfSamllParticle( CSmallParticleInfo a_pParticleInfo)
-	  {
-        var tableInfoPtr = GetTableInfo();
-
-		var datastorePtr = GetDatastore();
-
-		//String sSQLCommand = "Update \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8}; ";
-
-            string sSQLCommand = "Update SmallParticleInfo set AveGray = {0},Area = {1},IncAId={2} where FieldID = {3} and IncAId = {2}";
-            sSQLCommand=string.Format(sSQLCommand,
-                a_pParticleInfo.AveGray,
-                a_pParticleInfo.Area,
-                a_pParticleInfo.TypeId,
-                a_pParticleInfo.FieldId
-                
-                );
-
-
-          
-            //var helper = new SQLiteHelper(datastorePtr);
-            if(datastorePtr.RunCommand( sSQLCommand)!=true)
-		{			
-			return false;
-		}
-		return true;
-	  }
-
-        public    DataTable GetQueryById( long a_nFieldId)
-	    {
-
-        DataTable query;
-        var datastorePtr = GetDatastore();
-        
-        var tableInfoPtr = GetTableInfo();
-  
-        var sFieldIdColumnName = tableInfoPtr.GetColumnName((int)CSmallParticleInfoTable.ColumnID.N_FIELD_ID - (int)CSmallParticleInfoTable.ColumnID.MIN);
-
-            String sSQLCommand = "";
-            String.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8}; ",
-			(String) tableInfoPtr.GetTableName(),
-			 sFieldIdColumnName,a_nFieldId);
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-            query = datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-           
-		return query;
-	    }
-
-       public  DataTable GetQueryOfAllRecord()
-        {
-            DataTable query;
-
-            var datastorePtr = GetDatastore();
-            
-            var tableInfoPtr = GetTableInfo();
-
-            String sSQLCommand = "";
-            String.Format("SELECT * FROM \'{0}\' WHERE {1} = {2} AND {3} ={4} AND {5} ={6} AND {7} = {8};",
-                (String)tableInfoPtr.GetTableName());
-
-            //var helper = new SQLiteHelper(datastorePtr);
-
-            query = datastorePtr.QueryByCmdForDataTable(sSQLCommand);
-         
-            return query;
-        }
-    }
-}

+ 0 - 50
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/SmallParticles/SmallParticleInfoTable.cs

@@ -1,50 +0,0 @@
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-    class CSmallParticleInfoTable :  CSQLiteTable
-    {
-        
-        public  enum  ColumnID
-        {
-            INVALID = -1,
-			MIN = 0,
-			N_FIELD_ID = 0,
-		
-			N_AVE_GRAY = 1,
-			
-			F_AREA = 2,
-
-			N_TYPE_ID = 3,
-			
-			S_NAME = 4,
-
-			S_COLOR=5,	
-
-			N_ParticleQuantity=6,
-
-			MAX = 6
-		};
-
-     public   CSmallParticleInfoTable()
-	{
-		
-        AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "AveGray", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "Area", ColumType = new ColumnType(ColumnType.ID.FLOAT,false,false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "TypeId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "TypeName", ColumType = new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "TypeColor", ColumType = new ColumnType(ColumnType.ID.STRING,false,false), IsPrimarykey = false });
-        AddColumn(new ColumnDefine() { ColumName = "ParticleQuant", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-
-        SetTableName("SmallParticleInfo");
-
-
-    }
-}
-}

+ 0 - 171
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/XRayDataDB.cs

@@ -1,171 +0,0 @@
-using OTSCLRINTERFACE;
-using OTSDataType;
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.IO;
-using System.Linq;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-    public class CXRayDataDB : CSQLiteDB
-    {
-        List<CPosXrayClr> m_listPosXray;
-
- 
-
-        const long GENERALXRAYCHANNELS = 2000;
-
-     
-
-        public CXRayDataDB(IDBStoreBase _fileName, IDBTableBase _table) : base(_fileName, _table)
-        {
-            m_listPosXray = new List<CPosXrayClr>();
-        }
-
- 
-
-    
-
-
-        public  List< CPosXrayClr> GetXrayList( bool a_bForce/* = FALSE*/)
-	    {
-		if (a_bForce)
-		{
-			m_listPosXray.Clear();
-		}
-
-		if (m_listPosXray.Count == 0)
-		{
-			ReadAllXrayList();
-        }
-
-		return m_listPosXray;
-	    }
-
-       public bool ReadAllXrayList()
-        {
-            var t = GetTableInfo();
-            var query = GetTableQueryForDataTable(t.GetTableName());
-           
-            ReadXrayListFromAQuery(query,ref m_listPosXray);
-
-            return true;
-        }
-
-       public  bool ReadXrayListFromAQuery(DataTable a_query,ref List<CPosXrayClr> a_XrayList)
-        {
-           
-            Dictionary<List<int>, CPosXrayClr> mapXrayInfo = new Dictionary<List<int>, CPosXrayClr>();
-            foreach (DataRow row in a_query.Rows)
-            {
-                int nCol = (int)CXRayDataTable.ColumnID.N_FIELD_ID - (int)CXRayDataTable.ColumnID.MIN;
-                int curFldId = Convert.ToInt32(row[nCol]);
-                nCol = (int)CXRayDataTable.ColumnID.N_INDEX - (int)CXRayDataTable.ColumnID.MIN;
-                int xrayId = Convert.ToInt32(row[nCol]);
-                List<int> fldvec = new List<int>();
-                fldvec.Add(curFldId);
-                fldvec.Add(xrayId);
-                nCol = (int)CXRayDataTable.ColumnID.N_XRAY_DATA - (int)CXRayDataTable.ColumnID.MIN;
-
-                byte[] xraydata = (byte[])row[nCol];
-                uint[] uintData = new uint[GENERALXRAYCHANNELS];
-                for (int j = 0; j < GENERALXRAYCHANNELS; j++)
-                {
-                    int m = j * 4;
-                    uint d = xraydata[m + 3];
-                    d = d << 8;
-                    d = d | xraydata[m + 2];
-                    d = d << 8;
-                    d = d | xraydata[m + 1];
-                    d = d << 8;
-                    d = d | xraydata[m];
-                    uintData[j] = d;
-
-                }
-
-                if (!mapXrayInfo.ContainsKey(fldvec))
-                {
-                    CPosXrayClr xray = new CPosXrayClr();
-                    xray.SetXrayData(uintData);
-
-                    mapXrayInfo.Add(fldvec, xray);
-                }
-                else
-                {
-                    CPosXrayClr xray = mapXrayInfo[fldvec];
-                    xray.SetXrayData(uintData);
-                }
-
-
-            }
-            foreach (var keyvalue in mapXrayInfo)
-            {
-                a_XrayList.Add(keyvalue.Value);
-
-
-            }
-            return true;
-
-
-        }
-
-      
-       public bool GetAllMapedXrayData(ref Dictionary<List<int>, CPosXrayClr> mapXrayInfo)
-        {
-            var t = GetTableInfo();
-            var query = GetTableQueryForDataTable(t.GetTableName());
-            foreach (DataRow row in query.Rows)
-            {
-                int nCol = (int)CXRayDataTable.ColumnID.N_FIELD_ID - (int)CXRayDataTable.ColumnID.MIN;
-                int curFldId = Convert.ToInt32(row[nCol]);
-                nCol = (int)CXRayDataTable.ColumnID.N_INDEX - (int)CXRayDataTable.ColumnID.MIN;
-                int xrayId = Convert.ToInt32(row[nCol]);
-                List<int> fldvec = new List<int>();
-                fldvec.Add(curFldId);
-                fldvec.Add(xrayId);
-                nCol = (int)CXRayDataTable.ColumnID.N_XRAY_DATA - (int)CXRayDataTable.ColumnID.MIN;
-
-                byte[] xraydata = (byte[])row[nCol];
-                uint[] uintData = new uint[GENERALXRAYCHANNELS];
-                for (int j = 0; j < GENERALXRAYCHANNELS; j++)
-                {
-                    int m = j * 4;
-                    uint d = xraydata[m + 3];
-                    d = d << 8;
-                    d = d | xraydata[m + 2];
-                    d = d << 8;
-                    d = d | xraydata[m + 1];
-                    d = d << 8;
-                    d = d | xraydata[m];
-                    uintData[j] = d;
-
-                }
-
-                if (!mapXrayInfo.ContainsKey(fldvec))
-                {
-                    CPosXrayClr xray = new CPosXrayClr();
-                    xray.SetXrayData(uintData);
-
-                    mapXrayInfo.Add(fldvec, xray);
-                }
-                else
-                {
-                    CPosXrayClr xray = mapXrayInfo[fldvec];
-                    xray.SetXrayData(uintData);
-                }
-
-
-            }
-
-            return true;
-        }
-
-
-
-    }
-}

+ 0 - 35
OTSIncAMeasureApp/0-OTSModel/Measure/ParticleData/XRayDataTable.cs

@@ -1,35 +0,0 @@
-using OTSModelSharp.DTLBase;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OTSModelSharp
-{
-    class CXRayDataTable : CSQLiteTable
-    {
-     
-
-        public  enum  ColumnID:int
-        {
-            INVALID = -1,
-			MIN = 0,
-			N_INDEX = 0,
-			N_FIELD_ID = 1,			
-			N_XRAY_DATA = 2,
-			MAX = 2
-		};
-
-     public  CXRayDataTable()
-	 {
-
-            AddColumn(new ColumnDefine() { ColumName = "XrayIndex", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            AddColumn(new ColumnDefine() { ColumName = "FieldId", ColumType =new ColumnType(ColumnType.ID.INTEGER,false,false), IsPrimarykey = false });
-            
-            AddColumn(new ColumnDefine() { ColumName = "XrayData", ColumType =new ColumnType(ColumnType.ID.BLOB,false,false), IsPrimarykey = false });
-
-            SetTableName("XRayData");
-     }
-}
-}

+ 21 - 19
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -181,6 +181,8 @@
     <Compile Include="0-OTSModel\Measure\3-MeasureFlow\MsrThreadStatus.cs" />
     <Compile Include="0-OTSModel\Measure\BSEPicData\BSEImgFileMgr.cs" />
     <Compile Include="0-OTSModel\Measure\BSEPicData\COTSFieldData.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\CFieldDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\CFieldTable.cs" />
     <Compile Include="0-OTSModel\Measure\ParamData\COTSMsrPrjResultData.cs" />
     <Compile Include="0-OTSModel\Measure\ParamData\CSampleParamMgr.cs" />
     <Compile Include="0-OTSModel\Measure\ParamData\DIALOG_CHECK_PARAM_RESULT.cs">
@@ -192,25 +194,25 @@
     <Compile Include="0-OTSModel\Measure\ParamData\OTSDefaultParam.cs" />
     <Compile Include="0-OTSModel\Measure\ParamData\OTSGeneralParam.cs" />
     <Compile Include="0-OTSModel\Measure\ParamData\StageParam.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\CSmallParticleInfo.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\ElementChemistryDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\ElementChemistryTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\GenInfoDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\GenInfoTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\IncADataDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\IncADataTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\IncAFileMgr.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\MergedParticles\MergeParticleDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\MergedParticles\MergParticleTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\PosXrayDBMgr.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\PosXrayInfoDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\PosXrayInfoTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\SegmentDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\SegmentTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\SmallParticles\SmallParticleInfoDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\SmallParticles\SmallParticleInfoTable.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\XRayDataDB.cs" />
-    <Compile Include="0-OTSModel\Measure\ParticleData\XRayDataTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\CSmallParticleInfo.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\ElementChemistryDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\ElementChemistryTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\GenInfoDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\GenInfoTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\IncADataDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\IncADataTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\IncAFileMgr.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\MergedParticles\MergeParticleDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\MergedParticles\MergParticleTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\PosXrayDBMgr.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\PosXrayInfoDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\PosXrayInfoTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\SegmentDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\SegmentTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\SmallParticles\SmallParticleInfoDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\SmallParticles\SmallParticleInfoTable.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\XRayDataDB.cs" />
+    <Compile Include="0-OTSModel\Measure\DBDataTransition\XRayDataTable.cs" />
     <Compile Include="0-OTSModel\OTSDataType\CDomain.cs" />
     <Compile Include="0-OTSModel\OTSDataType\CDoubleRange.cs" />
     <Compile Include="0-OTSModel\OTSDataType\CElement.cs" />

+ 1 - 1
OTSIncAReportApp/App.config

@@ -22,7 +22,7 @@
   for information on customizing logging rules and outputs.
    -->
     <targets async="true">
-      <target type="File" name="file" fileName="${basedir}/Log/Nlogs/OTS ${shortdate}.log" layout="${longdate} ${message}" />
+      <target type="File" name="file" fileName="${basedir}/Log/Nlogs/OTSReport ${shortdate}.log" layout="${longdate} ${message}" />
       <target name="control" type="RichTextBox" controlName="richTextBox_Nlog" formName="OutputNlog" maxLines="10000" autoScroll="true" useDefaultRowColoringRules="true" layout="${longdate} ${message}" />
     </targets>
     <rules>

+ 86 - 121
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -95,8 +95,7 @@ namespace OTSIncAReportGraph.Controls
         //拖动前的坐标记录
         private PointF m_beforedrag_pointf = new PointF();
 
-        //记录鼠标拖选完成后形成的路径
-        private GraphicsPath m_selectmulti_gpath = new GraphicsPath();
+
 
         //缩放的增大缩小的增量
         private float m_f_zoom_increment = 0.05f;
@@ -131,8 +130,7 @@ namespace OTSIncAReportGraph.Controls
         //整个背景矩形的背景色
         private Color m_backrangecolor = Color.White;
 
-        //日志文件名
-        const String m_csFileName = "OTSReportAppLog";
+     
 
         //底层封装类
         OTSIncAReportFun m_OTSIncAReportFun = null;
@@ -166,7 +164,7 @@ namespace OTSIncAReportGraph.Controls
         //背景使用原图
         private bool OriginalBackground = false;
 
-     
+        static System.Windows.Forms.Timer delaytimer = new System.Windows.Forms.Timer();
 
         /// <summary>
         /// 当前正在显示的数据源名称,用来与框架调用条件判断使用
@@ -205,10 +203,7 @@ namespace OTSIncAReportGraph.Controls
         /// </summary>
         public bool bShowSmallParticle = false;
 
-        /// <summary>
-        /// 接收外部传进来的查询条件
-        /// </summary>
-        //List<CGridDataClr> m_list_cgriddataclr = null;
+  
 
         public List<Particle> SelectedParticles { set; get; }
         OTSIncAReportApp.frmReportApp m_ReportApp;
@@ -329,11 +324,6 @@ namespace OTSIncAReportGraph.Controls
             //上面是必须有的
             SetStyle(ControlStyles.UserMouse, true);    //执行自己的鼠标行为,这个打开后,在win7下鼠标操作明显改善
 
-            //双缓冲其它选项说明
-            //SetStyle(ControlStyles.Selectable, true);         //可以接收焦点,未知效果
-            //SetStyle(ControlStyles.StandardClick,true);       //控件标准行为,未知效果
-            //SetStyle(ControlStyles.EnableNotifyMessage, true);//派发所有的消息,未知效果
-            //SetStyle(ControlStyles.ContainerControl, true);   //设置自身为容器,未知效果
         }
         #endregion
 
@@ -745,7 +735,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                     DParticle dp = (DParticle)item;
                     //明白了,选择第一个时,被第二个刷掉了
-                    if (true == WhetherInRange(item.GPath.PathPoints, e.Location))
+                    if (true == WhetherInRange(dp, e.Location))
                     {
                         dp.IsMouseMove = true;
                         //获取颗粒ID
@@ -821,13 +811,10 @@ namespace OTSIncAReportGraph.Controls
                 DParticle dp = (DParticle)item;
                 if (dp.Operator != ParticleOperator.NODISPLAY)
                 {
-                    if (true == WhetherInRange(dp.GPath.PathPoints, e.Location))
+                    if (true == WhetherInRange(dp, e.Location))
                     {
                         ////并保存到变量中,供移动电镜使用
-                        //Point ls_fieldotspoint =m_OTSIncAReportFun.GetOTSPointByFieldID(m_list_dfield,dp.CLRFieldID);
-                        ////从OTS坐标系转成SEM坐标系
-                        //m_sem_mouse_now_point = m_OTSIncAReportFun.ChangeOTSToSemCoord(new Point(ls_fieldotspoint.X, ls_fieldotspoint.Y));
-                        //m_str_mouseshow_left = "视域位置:" + m_sem_mouse_now_point.X.ToString() + ":" + m_sem_mouse_now_point.Y.ToString();
+       
 
                         m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
                         m_str_mouseshow_left = "颗粒SEM位置:" + dp.SEMPosX.ToString() + ":" + dp.SEMPosY.ToString();
@@ -839,43 +826,7 @@ namespace OTSIncAReportGraph.Controls
             Color ls_c = GetColorByMousePoint(e.X, e.Y);
             m_str_mouseshow_right = "灰度#" + ls_c.R.ToString();
 
-            #region ////获取颜色方法2,获取的速度很快,但是却影响程序的运行速度----------------------------------------------------
-            //Bitmap ls_bp = new Bitmap(this.Width, this.Height);
-            //this.DrawToBitmap(ls_bp, new Rectangle(0, 0, this.Width, this.Height));
-            //Color ls_c = ls_bp.GetPixel(e.X, e.Y);
-            //str_mouseshow_right = "颜色值#" + ls_c.R.ToString() + "," + ls_c.G.ToString() + "," + ls_c.B.ToString();
-
-            //str_mouseshow_right = "未指向颗粒";
-            //foreach (BaseObject item in list_baseobject)
-            //{
-            //    if (((DParticle)item).Operator != "不显示")
-            //    {
-            //        //明白了,选择第一个时,被第二个刷掉了
-            //        if (true == WhetherInRange(item.GPath.PathPoints, e.Location))
-            //        {
-            //            DParticle ap = (DParticle)item;
-            //            str_mouseshow_right = "颗粒:" + item.ID.ToString();
-            //        }
-            //    }
-            //}
-
-            //int hWnd = FindWindow(null, @"报告程序");
-            //if (hWnd == 0)
-            //{
-            //    MessageBox.Show("未找到消息接受者!");
-            //}
-            //else
-            //{
-            //    string sendString = str_mouseshow_left + "|"+ str_mouseshow_right ;
-            //    byte[] sarr = System.Text.Encoding.Default.GetBytes(sendString);
-            //    int len = sarr.Length;
-            //    COPYDATASTRUCT cds;
-            //    cds.dwData = (IntPtr)0;
-            //    cds.cbData = len + 1;
-            //    cds.lpData = sendString;
-            //    SendMessage(hWnd, WM_COPYDATA, ref cds, ref cds);
-            //}
-            #endregion
+          
 
             m_ReportApp.mouseMatter.Text = m_str_mouseshow_right ;
             m_ReportApp.RSGrayVal.Text = m_str_mouseshow_left;
@@ -931,7 +882,7 @@ namespace OTSIncAReportGraph.Controls
                                 PointF[] lspointf = dp.GPath.PathPoints;
                                 for (int i = 0; i < lspointf.Count(); i++)
                                 {
-                                    if (true == WhetherInRange(ls_gpath.PathPoints, lspointf[i]))
+                                    if (true == WhetherInRange(dp, lspointf[i]))
                                     {
                                         //选择到了该路径,那么就选取该图像
                                         dp.Operator = ParticleOperator.SELECTED;
@@ -999,7 +950,7 @@ namespace OTSIncAReportGraph.Controls
                         foreach (DParticle dp in m_list_baseobject)
                         {
                             PointF[] lspointf = dp.GPath.PathPoints;
-                            if (true == WhetherInRange(lspointf, new Point(e.X, e.Y)))
+                            if (true == WhetherInRange(dp, new Point(e.X, e.Y)))
                             {
                                 //选择到了该路径,那么就选取该图像b
                                 dp.Operator_ShowXRay = ParticleOperatorShowXray.SELECTANDDISPLAYXRAY;
@@ -1036,7 +987,7 @@ namespace OTSIncAReportGraph.Controls
                 //这个判断右键菜单加在这里,也不知道对不对
                 foreach (BaseObject item in m_list_baseobject)
                 {
-                    if (true == WhetherInRange(item.GPath.PathPoints, e.Location))
+                    if (true == WhetherInRange((DParticle)item, e.Location))
                     {
                         DParticle dp = (DParticle)item;
                         CMenuStrip.Items[0].Enabled = true;
@@ -1055,10 +1006,7 @@ namespace OTSIncAReportGraph.Controls
                         CMenuStrip.Items[2].Enabled = true;
                         CMenuStrip.Items[3].Enabled = true;
 
-                        ////并保存到变量中,供移动电镜使用
-                        //Point ls_fieldotspoint = m_OTSIncAReportFun.GetOTSPointByFieldID(m_list_dfield, dp.CLRFieldID);
-                        ////从OTS坐标系转成SEM坐标系
-                        //m_sem_mouse_now_point = m_OTSIncAReportFun.ChangeOTSToSemCoord(new Point(ls_fieldotspoint.X, ls_fieldotspoint.Y));
+           
 
                         m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
                         //获取颜色方法1,使用API来获取当前鼠标指向位置的颜色值-----------------------------------------------------
@@ -1178,6 +1126,28 @@ namespace OTSIncAReportGraph.Controls
         /// <param name="in_dparticle"></param>
         private void ShowXRay(DParticle in_dparticle)
         {
+            
+            if (delaytimer.Enabled == false)
+            {
+                m_move_dparticle = in_dparticle;//将显示xray的dparticle记录给全局变量
+
+                delaytimer.Tick += Delaytimer_Tick;
+                delaytimer.Interval = 500;
+                delaytimer.Start();
+
+            }
+            
+           
+        }
+
+        private void Delaytimer_Tick(object sender, EventArgs e)
+        {
+            if (m_move_dparticle.IsMouseMove == false)
+            {
+                delaytimer.Enabled = false;
+                return;
+            }
+            delaytimer.Enabled = false;
             //显示xray相关信息
             uint[] Search_xray = new uint[2000];
             uint[] Analysis_xray = new uint[2000];
@@ -1188,7 +1158,7 @@ namespace OTSIncAReportGraph.Controls
             List<Element> list_celementchemistryclr = new List<Element>();
 
             //获取Xray数据
-            m_OTSIncAReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(in_dparticle.CLRTagID, in_dparticle.CLRFieldID, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
+            m_OTSIncAReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_move_dparticle.CLRTagID, m_move_dparticle.CLRFieldID, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
 
             //get CElementChemistryClr list
             List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
@@ -1202,36 +1172,10 @@ namespace OTSIncAReportGraph.Controls
             }
 
             //获取使用标准库的名称
-            string str_stdname = "";
+            //string str_stdname = "";
             string str_IncALibName = "";
-            List<int> FLID = new List<int>() { 0, 1, 2, 4, 6, 9 };
-            //List<string> NameList = new List<string>() { "过小颗粒", "过大颗粒", "亮度不在分析范围内的颗粒", "低计数率颗粒", "不含分析元素的颗粒", "非夹杂物颗粒SiC", "非夹杂物颗粒FeO", "未识别颗粒" };
-            List<string> NameList = new List<string>() { "过小颗粒", "过大颗粒", "亮度不在分析范围内的颗粒", "低计数率颗粒", "不含分析元素的颗粒", "未识别颗粒" };
+            str_IncALibName = m_move_dparticle.TypeName;
 
-            if (in_dparticle.TypeId < 1000)
-            {
-                int index = FLID.IndexOf(in_dparticle.TypeId);
-                if (index == -1)
-                {
-                    index = 5;
-                }
-                //小于1000,使用系统默认分类
-                str_IncALibName = NameList[index];
-                str_stdname = "默认标准库";
-            }
-            else if (in_dparticle.TypeId >= 1000 && in_dparticle.TypeId < 10000)
-            {
-                //大于等于1000,并且小于10000时,使用系统数据库中夹杂物来分析
-                str_IncALibName = in_dparticle.TypeName;
-                str_stdname = "用户定义标准库";
-            }
-            else if (in_dparticle.TypeId > 10000)
-            {
-                //大于10000时,使用用户标准库来分析夹杂物名称
-                str_IncALibName = in_dparticle.TypeName;
-                if (str_stdname == "")
-                    str_stdname = "系统标准库";
-            }
 
             //获取数据后,需要对xraytable设置
             control_XRayTable1.Visible = false;
@@ -1239,16 +1183,15 @@ namespace OTSIncAReportGraph.Controls
             //颗粒国标信息
             control_XRayTable1.GBInfoStr = "";
             control_XRayTable1.GoodName = str_IncALibName;//杂夹物
-            control_XRayTable1.STDName = str_stdname;//标准库
+            //control_XRayTable1.STDName = str_stdname;//标准库
             control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
             control_XRayTable1.Visible = true;
 
-            //将显示xray的dparticle记录给全局变量
-            m_move_dparticle = in_dparticle;
+
 
             this.Refresh();
+           
         }
-
         /// <summary>
         /// 隐藏x-ray能谱图
         /// </summary>
@@ -1588,19 +1531,31 @@ namespace OTSIncAReportGraph.Controls
         /// <param name="inPoints"></param>
         /// <param name="WhetherPoint"></param>
         /// <returns></returns>
-        private bool WhetherInRange(PointF[] inPoints, Point WhetherPoint)
+        private bool WhetherInRange(DParticle Part,/*PointF[] inPoints,*/ Point WhetherPoint)
         {
-            bool b_inrange = false;
-            GraphicsPath myGraphicsPath = new GraphicsPath();
-            Region myRegion = new Region();
-            myGraphicsPath.Reset();
-
-            myGraphicsPath.AddPolygon(inPoints);
-            myRegion.MakeEmpty();
-            myRegion.Union(myGraphicsPath);
-            //返回判断点是否在多边形里
-            b_inrange = myRegion.IsVisible(WhetherPoint);
-            return b_inrange;
+            var rect = Part.Rect;
+            if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
+            {
+                var itm = (BaseObject)Part;
+                PointF[] inPoints = itm.GPath.PathPoints;
+                bool b_inrange = false;
+                GraphicsPath myGraphicsPath = new GraphicsPath();
+                Region myRegion = new Region();
+                myGraphicsPath.Reset();
+
+                myGraphicsPath.AddPolygon(inPoints);
+                myRegion.MakeEmpty();
+                myRegion.Union(myGraphicsPath);
+                //返回判断点是否在多边形里
+                b_inrange = myRegion.IsVisible(WhetherPoint);
+                return b_inrange;
+            }
+            else
+            {
+                return false;
+            
+            }
+            
         }
 
         /// <summary>
@@ -1609,19 +1564,29 @@ namespace OTSIncAReportGraph.Controls
         /// <param name="inPoints"></param>
         /// <param name="WhetherPoint"></param>
         /// <returns></returns>
-        private bool WhetherInRange(PointF[] inPoints, PointF WhetherPoint)
+        private bool WhetherInRange(DParticle Part,/* PointF[] inPoints, */PointF WhetherPoint)
         {
-            bool b_inrange = false;
-            GraphicsPath myGraphicsPath = new GraphicsPath();
-            Region myRegion = new Region();
-            myGraphicsPath.Reset();
-
-            myGraphicsPath.AddPolygon(inPoints);
-            myRegion.MakeEmpty();
-            myRegion.Union(myGraphicsPath);
-            //返回判断点是否在多边形里
-            b_inrange = myRegion.IsVisible(WhetherPoint);
-            return b_inrange;
+            var rect = Part.Rect;
+            if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
+            {
+                var itm = (BaseObject)Part;
+                PointF[] inPoints = itm.GPath.PathPoints;
+                bool b_inrange = false;
+                GraphicsPath myGraphicsPath = new GraphicsPath();
+                Region myRegion = new Region();
+                myGraphicsPath.Reset();
+
+                myGraphicsPath.AddPolygon(inPoints);
+                myRegion.MakeEmpty();
+                myRegion.Union(myGraphicsPath);
+                //返回判断点是否在多边形里
+                b_inrange = myRegion.IsVisible(WhetherPoint);
+                return b_inrange;
+            }
+            else 
+            {
+                return false;
+            }
         }
 
         /// <summary>

+ 25 - 24
OTSIncAReportApp/Control_Graph/OTSIncAReportGraphFuncation/OTSIncAReportFun.cs

@@ -14,6 +14,7 @@ using System.Diagnostics;
 using System.Drawing;
 using System.Linq;
 
+
 namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 {
     class OTSIncAReportFun
@@ -49,9 +50,9 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         private Control_DrawDistrbutionImageAndBSE m_Control_DrawDistrbutionImageAndBSE = null;
 
         //全局对象,为了能够快速的获取到xray数据,而做为一个临时变量进行保存,使用前应该判断是否为空
-        public List<Field> m_list_COTSFieldMgrClr = null;
+        public List<Field> m_list_OTSField = null;
 
-        NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
+        NLog.Logger log;
         //field的数量
         public int m_field_count = 0;
 
@@ -92,7 +93,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             m_Control_DrawDistrbutionImageAndBSE = in_Control_DrawDistrbutionImageAndBSE;
             resultFile = result;
             m_cfun =new ServiceInterface.SemController();
-
+            log = NLog.LogManager.GetCurrentClassLogger();
             table = lan.GetNameTable("OTSIncAReportFun");
         }
 
@@ -106,7 +107,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             m_Control_DrawdistrbutionsortImage = in_Control_DrawDistrbutionSortimage;
             resultFile = result;
             m_cfun = new ServiceInterface.SemController();
-
+            log = NLog.LogManager.GetCurrentClassLogger();
             table = lan.GetNameTable("OTSIncAReportFun");
         }
 
@@ -123,7 +124,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             List<Particle> ls_list_cotsparticleclr = new List<Particle>();
 
             //防止为空校验判断
-            if (m_list_COTSFieldMgrClr == null)
+            if (m_list_OTSField == null)
                 return ls_list_cotsparticleclr;
 
             //先取出,所有被选择的dparticle列表的
@@ -139,11 +140,11 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             //并开始查找包含tagid和fieldid的cotsparticle的对象,保存到list当中
             for (int i = 0; i < ls_list_dp.Count(); i++)
             {
-                for (int j = 0; j < m_list_COTSFieldMgrClr.Count(); j++)
+                for (int j = 0; j < m_list_OTSField.Count(); j++)
                 {
                     //先获取该field中的所有particle
                     List<Particle> list_cotsparticleclr = new List<Particle>();
-                    list_cotsparticleclr = m_list_COTSFieldMgrClr[j].ParticleList;
+                    list_cotsparticleclr = m_list_OTSField[j].ParticleList;
 
                     for (int k = 0; k < list_cotsparticleclr.Count(); k++)
                     {
@@ -394,10 +395,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
              
                 log.Trace("(Connection_ForDrawDistrbutionImageAndBSE)" + "Connect to SEM" + ":--" + m_SEMConnectionState + "---");
 
-                ///获取当前电镜的ID号
-                //m_SEM_ID = m_cfun.get
-              
-                //log.Trace("(Connection_ForDrawDistrbutionImageAndBSE)" + "ID:"  + m_SEM_ID.ToString());
+        
             }
             else
             {
@@ -467,9 +465,11 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             list_celementchemistryclr = new List<Element>();
 
             //防止为空校验判断
-            if (m_list_COTSFieldMgrClr == null)
+            if (m_list_OTSField == null)
                 return;
-            Particle particle = m_list_COTSFieldMgrClr.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
+            Particle particle = m_list_OTSField.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
+            var tmpPart = new ParticleData(resultFile.FilePath).GetParticleXrayDataByFidAndPid(Convert.ToString(particle.FieldId), Convert.ToString(particle.XrayId));
+            particle.XRayData = tmpPart.XRayData;
             if (particle.XrayId > -1)
             {
                 for (int i = 0; i < 2000; i++)
@@ -484,6 +484,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 
         }
 
+
         /// <summary>
         /// 传入所有的物理field坐标点,和单个物理field的宽高,返回所有field的左上角位置,和整个field组成的rect大小
         /// </summary>
@@ -628,7 +629,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(15, str29);
 
             //将field的list对象给全局变量中,供后面获取xray使用,不需要再次重新加载数据,以提升速度
-            m_list_COTSFieldMgrClr = fieldlist;
+            m_list_OTSField = fieldlist;
 
             //第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
             List<Point> list_point = new List<Point>();
@@ -698,7 +699,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             for (int i = 0; i < fieldlist.Count(); i++)
             {
                 //更新进度条提示
-                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_list_COTSFieldMgrClr.Count.ToString() + str34);
+                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_list_OTSField.Count.ToString() + str34);
 
                 //先获取该Field中的所有Particle
                 List<Particle> list_cotsparticleclr = new List<Particle>();
@@ -849,9 +850,9 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         //读取进度条,虚拟读取,直接通过所有时域
         void setPr(float ls_int_progresscalc, string str32, string str33, string str34)
         {
-            for (int i = 0; i < m_list_COTSFieldMgrClr.Count; i++)
+            for (int i = 0; i < m_list_OTSField.Count; i++)
             {
-                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_list_COTSFieldMgrClr.Count.ToString() + str34);
+                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_list_OTSField.Count.ToString() + str34);
             }
         }
 
@@ -935,7 +936,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             List<Particle> ls_list_cotsparticleclr = new List<Particle>();
 
             //防止为空校验判断
-            if (m_list_COTSFieldMgrClr == null)
+            if (m_list_OTSField == null)
             {
                 return ls_list_cotsparticleclr;
             }
@@ -956,11 +957,11 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             //并开始查找包含tagid和fieldid的cotsparticle的对象,保存到list当中
             for (int i = 0; i < ls_list_dp.Count(); i++)
             {
-                for (int j = 0; j < m_list_COTSFieldMgrClr.Count(); j++)
+                for (int j = 0; j < m_list_OTSField.Count(); j++)
                 {
                     //先获取该field中的所有particle
                     List<Particle> list_cotsparticleclr = new List<Particle>();
-                    list_cotsparticleclr = m_list_COTSFieldMgrClr[j].ParticleList;
+                    list_cotsparticleclr = m_list_OTSField[j].ParticleList;
 
                     for (int k = 0; k < list_cotsparticleclr.Count(); k++)
                     {
@@ -986,9 +987,9 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         public Point GetOTSPointFromOld_list_sortparticledistribution(int in_fieldid, int in_tagid, Control_DrawDistrbutionSortImage in_control_drawdistrbutionsortimage)
         {
             Point ret_point = new Point(0, 0);
-            if (m_list_COTSFieldMgrClr != null)
+            if (m_list_OTSField != null)
             {
-                Field field = m_list_COTSFieldMgrClr.Find(x => x.FieldID == in_fieldid);
+                Field field = m_list_OTSField.Find(x => x.FieldID == in_fieldid);
 
                 ret_point = new Point() { X = field.FieldPosX, Y = field.FieldPosY };
 
@@ -1011,7 +1012,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             FieldData fieldData = new FieldData(path);
             List<Field> fieldlist = fieldData.GetFieldList(a_ReportApp);
             //将field的list对象给全局变量中,供后面获取xray使用
-            m_list_COTSFieldMgrClr = fieldlist;
+            m_list_OTSField = fieldlist;
             string str49 = "开始组建图像资源....";
             str49 = table["str49"].ToString();
             m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(15, str49);
@@ -1069,7 +1070,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             //第二次,再通过Field取到对应的Particle,循环一次
             for (int i = 0; i < fieldlist.Count(); i++)
             {
-                m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str52 + i.ToString() + str53 + m_list_COTSFieldMgrClr.Count.ToString() + str54);
+                m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str52 + i.ToString() + str53 + m_list_OTSField.Count.ToString() + str54);
 
                 //先获取该field中的所有particle
                 List<Particle> list_cotsparticleclr = new List<Particle>();

+ 9 - 37
OTSIncAReportApp/DataOperation/DataAccess/FieldData.cs

@@ -27,10 +27,11 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         public List<Model.Field> GetFieldList(frmReportApp a_ReportApp)
         {
             //获取field信息
-            string sql = "select fieldid,fieldposx,fieldposy,SEMPosX,SEMPosY from IncAData group by fieldid,fieldposx,fieldposy";
+            string sql = "select fieldid,fieldposx,fieldposy from field ";//select fieldid,fieldposx,fieldposy from field
             DataTable DT = dbHelper.ExecuteDataTable(sql, null);
             //获取Particle信息
-            string sqlp = "select a.*,b.XrayData from IncAData a left join XRayData b on a.FieldId =b.FieldId and a.XrayId= b.XrayIndex";
+            //string sqlp = "select a.*,b.XrayData from IncAData a left join XRayData b on a.FieldId =b.FieldId and a.XrayId= b.XrayIndex";
+            string sqlp = "select * from IncAData ";
             DataTable DTP = dbHelper.ExecuteDataTable(sqlp, null);
             //获取Segment信息
 
@@ -48,24 +49,24 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             for (int i=0;i< count; i++)
             {
                 
-                string imagePath = filePath + "Field" + a_ReportApp.OriginalPoint.Rows[i]["ID"].ToString() + ".bmp";
+                string imagePath = filePath + "Field" + DT.Rows[i]["FieldId"].ToString() + ".bmp";
 
 
-                Model.Field modelf = new Model.Field() { FieldID = Convert.ToInt32(a_ReportApp.OriginalPoint.Rows[i]["ID"].ToString()), FieldPosX = Convert.ToInt32(a_ReportApp.OriginalPoint.Rows[i]["FieldX"].ToString()), FieldPosY = Convert.ToInt32(a_ReportApp.OriginalPoint.Rows[i]["FieldY"].ToString()), FieldImage = imagePath };
+                Model.Field modelf = new Model.Field() { FieldID = Convert.ToInt32(DT.Rows[i]["FieldId"].ToString()), FieldPosX = Convert.ToInt32(DT.Rows[i]["fieldposx"].ToString()), FieldPosY = Convert.ToInt32(DT.Rows[i]["fieldposy"].ToString()), FieldImage = imagePath };
 
-                DataRow[] drp = DTP.Select("fieldid=" + a_ReportApp.OriginalPoint.Rows[i]["ID"].ToString());
+                DataRow[] drp = DTP.Select("fieldid=" + DT.Rows[i]["FieldId"].ToString());
 
                 List<Model.Particle> listp = dbHelper.RowsToList<Model.Particle>(drp);
 
                 foreach (Model.Particle modelp in listp)
                 {
                     //添加FeatureList信息
-                    DataRow[] drs = DTS.Select("fieldid=" + a_ReportApp.OriginalPoint.Rows[i]["ID"].ToString() + " and particleid=" + modelp.ParticleId.ToString());
+                    DataRow[] drs = DTS.Select("fieldid=" + DT.Rows[i]["FieldId"].ToString() + " and particleid=" + modelp.ParticleId.ToString());
                     List<Model.Feature> flist = dbHelper.RowsToList<Model.Feature>(drs);
                     modelp.FeatureList = flist;
 
                     //添加ElementList信息
-                    DataRow[] dre = DTE.Select("fieldid=" + a_ReportApp.OriginalPoint.Rows[i]["ID"].ToString() + " and XRayId=" + modelp.XrayId.ToString());
+                    DataRow[] dre = DTE.Select("fieldid=" + DT.Rows[i]["FieldId"].ToString() + " and XRayId=" + modelp.XrayId.ToString());
                     List<Model.Element> elist = dbHelper.RowsToList<Model.Element>(dre);
                     modelp.ElementList = elist;
                 }
@@ -74,36 +75,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
 
                 Fields.Add(modelf);
             }
-            
-
-            //foreach (DataRow dr in DT.Rows)
-            //{
-            //    string imagePath = filePath + "Field" + dr["fieldid"].ToString() + ".bmp";
-                
-
-            //    Model.Field modelf = new Model.Field() { FieldID = Convert.ToInt32(dr["fieldid"]), FieldPosX = Convert.ToInt32(dr["fieldposx"]), FieldPosY = Convert.ToInt32(dr["fieldposy"]), FieldImage = imagePath };
-
-            //    DataRow[] drp = DTP.Select("fieldid=" + dr["fieldid"].ToString());
-
-            //    List<Model.Particle> listp = dbHelper.RowsToList<Model.Particle>(drp);
-
-            //    foreach (Model.Particle modelp in listp)
-            //    {
-            //        //添加FeatureList信息
-            //        DataRow[] drs = DTS.Select("fieldid=" + dr["fieldid"].ToString() + " and particleid=" + modelp.ParticleId.ToString());
-            //        List<Model.Feature> flist = dbHelper.RowsToList<Model.Feature>(drs);
-            //        modelp.FeatureList = flist;
-
-            //        //添加ElementList信息
-            //        DataRow[] dre = DTE.Select("fieldid=" + dr["fieldid"].ToString() + " and XRayId=" + modelp.XrayId.ToString());
-            //        List<Model.Element> elist = dbHelper.RowsToList<Model.Element>(dre);
-            //        modelp.ElementList = elist;
-            //    }
-
-            //    modelf.ParticleList = listp;
-
-            //    Fields.Add(modelf);
-            //}
+          
 
             return Fields;
 

+ 13 - 1
OTSIncAReportApp/DataOperation/DataAccess/ParticleData.cs

@@ -48,7 +48,9 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         public List<Model.Particle> GetParticleListByCon(string con, string max, string min, int display)
         {
 
-            string sqlp = "select a.*,b.XrayData from IncAData a left join XRayData b on a.FieldId =b.FieldId and a.XrayId= b.XrayIndex";
+            //string sqlp = "select a.*,b.XrayData from IncAData a left join XRayData b on a.FieldId =b.FieldId and a.XrayId= b.XrayIndex";
+            //string where = " where 1=1 ";
+            string sqlp = "select * from IncAData";
             string where = " where 1=1 ";
             if (display == 1)
             {
@@ -338,7 +340,17 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
 
             return particle;
         }
+        public Model.Particle GetParticleXrayDataByFidAndPid(string fieldid, string particleid)
+        {
+            string sqlp = @"select xraydata from xraydata where xrayindex="+particleid+" and fieldid="
+            + fieldid ;
 
+            DataTable DT = dbHelper.ExecuteDataTable(sqlp, null);
+            List<Model.Particle> listp = dbHelper.TableToList<Model.Particle>(DT);
+ 
+
+            return listp[0];
+        }
         public enum PARTCLE_TYPE
         {
             SMALL = 0,//过小颗粒

+ 38 - 42
OTSIncAReportApp/frmMeasureRstMgr.cs

@@ -305,11 +305,7 @@ namespace OTSIncAReportApp
                 return;
             }
 
-            //为了使用国标,保留clr向底层加载的代码部份-----------------------------------------------
-            //m_ReportApp.m_ReportProjFileMgr.AddASmplMsrResultMgr(str_path);
-            //m_ReportApp.m_ReportProjFileMgr.SetSelectedPicture(1);
-            //-----------------------------------------------------------------------------------------
-           m_ReportApp.OriginalPoint= ReadXML(str_path);
+
 
             //加载测量结果文件
             Dictionary<string, object> suggestions = DataOperation.DataAccess.XMLoperate.GetXMLAllInfo(str_path);
@@ -568,44 +564,44 @@ namespace OTSIncAReportApp
         #endregion
 
         //读取rst文件中的帧图位置信息
-        private DataTable ReadXML(string a_position)
-        {
-            //创建空列
-            DataTable dt = new DataTable();
-            dt.TableName = "Fields";
-            dt.Columns.Add("FieldX");
-            dt.Columns.Add("FieldY");
-            dt.Columns.Add("ID");
-
-            XmlDocument doc = new XmlDocument();
-            XmlReaderSettings settings = new XmlReaderSettings();
-            settings.IgnoreComments = true;//忽略文档里的注释
-            XmlReader reader = XmlReader.Create(a_position, settings);
-            doc.Load(reader);
-            //得到根结点
-            XmlNode xn = doc.SelectSingleNode("XMLData");
-            //得到根结点的所有子节点
-            XmlNodeList xnl = xn.ChildNodes;
-            foreach (XmlNode xml in xnl)
-            {
-                if (xml.Name.ToString() == "Collection")
-                {
-                    for (int i = 0; i < xml.ChildNodes.Count; i++)
-                    {
-                        if (xml.ChildNodes[i].Name.ToLower() == "member")
-                        {
-                                DataRow dr = dt.NewRow();
-                                dr["FieldX"] = xml.ChildNodes[i].Attributes.GetNamedItem("FieldX").Value;
-                                dr["FieldY"] = xml.ChildNodes[i].Attributes.GetNamedItem("FieldY").Value;
-                                dr["ID"] = xml.ChildNodes[i].Attributes.GetNamedItem("ID").Value;
-                                dt.Rows.Add(dr);
+        //private DataTable ReadXML(string a_position)
+        //{
+        //    //创建空列
+        //    DataTable dt = new DataTable();
+        //    dt.TableName = "Fields";
+        //    dt.Columns.Add("FieldX");
+        //    dt.Columns.Add("FieldY");
+        //    dt.Columns.Add("ID");
+
+        //    XmlDocument doc = new XmlDocument();
+        //    XmlReaderSettings settings = new XmlReaderSettings();
+        //    settings.IgnoreComments = true;//忽略文档里的注释
+        //    XmlReader reader = XmlReader.Create(a_position, settings);
+        //    doc.Load(reader);
+        //    //得到根结点
+        //    XmlNode xn = doc.SelectSingleNode("XMLData");
+        //    //得到根结点的所有子节点
+        //    XmlNodeList xnl = xn.ChildNodes;
+        //    foreach (XmlNode xml in xnl)
+        //    {
+        //        if (xml.Name.ToString() == "Collection")
+        //        {
+        //            for (int i = 0; i < xml.ChildNodes.Count; i++)
+        //            {
+        //                if (xml.ChildNodes[i].Name.ToLower() == "member")
+        //                {
+        //                        DataRow dr = dt.NewRow();
+        //                        dr["FieldX"] = xml.ChildNodes[i].Attributes.GetNamedItem("FieldX").Value;
+        //                        dr["FieldY"] = xml.ChildNodes[i].Attributes.GetNamedItem("FieldY").Value;
+        //                        dr["ID"] = xml.ChildNodes[i].Attributes.GetNamedItem("ID").Value;
+        //                        dt.Rows.Add(dr);
                             
-                        }
-                    }
-                }
-            }
-            return dt;
-        }
+        //                }
+        //            }
+        //        }
+        //    }
+        //    return dt;
+        //}
 
     }
 }

+ 15 - 15
OTSIncAReportApp/frmReportApp.cs

@@ -51,7 +51,6 @@ namespace OTSIncAReportApp
         public List<DataOperation.Model.Particle> SelectedParticles = new List<DataOperation.Model.Particle>();     //所有选择颗粒
 
         
-        public DataTable OriginalPoint = new DataTable();//帧图位置point
         public string MoreSource = "";
 
         Hashtable table;                                                                                            //国际化表
@@ -165,12 +164,11 @@ namespace OTSIncAReportApp
         /// </summary>
         public frmReportApp()
         {
-            InitializeComponent();
-
-
-            m_OutputNlog = new OutputNlog();
-            m_OutputNlog.Visible = true;
-
+           
+            InitializeComponent();      
+          
+           
+           
             //树窗口
             m_RstWindow = new frmMeasureRstMgr(this);
             //属性窗口
@@ -227,14 +225,14 @@ namespace OTSIncAReportApp
         /// </summary>
         public frmReportApp(string[] str_resultfilepaths)
         {
-            
+           
             m_str_resultfilepaths = str_resultfilepaths;
             
             InitializeComponent();
+            log = NLog.LogManager.GetCurrentClassLogger();
+          
 
-            m_OutputNlog = new OutputNlog();
-            m_OutputNlog.Visible = true;
-
+           
             //树窗口
             m_RstWindow = new frmMeasureRstMgr(this);
             //属性窗口
@@ -276,9 +274,9 @@ namespace OTSIncAReportApp
         /// <param name="e"></param>
         private void OTSReportApp_Load(object sender, EventArgs e)
         {
+            //m_OutputNlog.Visible = true;
 
-            log = NLog.LogManager.GetCurrentClassLogger();
-
+          //------------- initialize the HMI of the main form.
             if (Cef.IsInitialized == false)
             {
                 var settings = new CefSettings();
@@ -307,7 +305,8 @@ namespace OTSIncAReportApp
             this.m_RstWindow.Activate();
             //激活分布图窗体
             this.m_SImageWindow.Activate();
-
+            //----------------end the initialization
+            log = NLog.LogManager.GetCurrentClassLogger();
             if (m_str_resultfilepaths != null)
             {
                 //构造函数直接接收传入的测量结果文件,并加载
@@ -316,7 +315,7 @@ namespace OTSIncAReportApp
                     this.m_RstWindow.AddSampleClick(m_str_resultfilepaths[i].Replace("^", " "));
                 }
             }
-
+           
 
         }
 
@@ -389,6 +388,7 @@ namespace OTSIncAReportApp
             fileDialog.RestoreDirectory = true; 
             if (fileDialog.ShowDialog() == DialogResult.OK)
                 path = System.IO.Path.GetFullPath(fileDialog.FileName);
+            log.Info("begin to load the result!");
             this.m_RstWindow.AddSampleClick(path);
         }