CSmplMsrResult.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. using OTSCLRINTERFACE;
  2. using OTSDataType;
  3. using OTSModelSharp.DTLBase;
  4. using OTSModelSharp.ServiceCenter;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. using System.Xml;
  14. namespace OTSModelSharp
  15. {
  16. public class CSmplMsrResult
  17. {
  18. //----------------定义----------------------
  19. protected static NLog.Logger logger = null;
  20. // working folder string
  21. string m_strWorkingFolder;
  22. string m_strSampleWorkingFolder;
  23. string m_strFieldFileSubFolder;
  24. private string m_strBSEImageFileFolder;
  25. private string m_strDBFileFolder;
  26. // pathname
  27. string m_strRstFileName;
  28. string m_strdbPathName;
  29. CIncAFileMgr m_DBFileMgr ;
  30. public string SMPL_MSR_RESULT_FILE_EXT = ".rst";
  31. // fields file sub-directory string
  32. public string SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER = "FIELD_FILES";
  33. public string DBFILE_NAME = "Inclusion.db";
  34. // BSE file name
  35. public string SMPL_MSR_RESULT_FIELDS_BSE = ("Field");
  36. public string SMPL_MSR_RESULT_FILE_FILTER = ("Sample Measure Result Files (*.rst)|*.rst||");
  37. // search x-ray file name
  38. //public string SMPL_MSR_RESULT_SEARCH_X_RAY_FILE = ("SearchXray.db");
  39. //----------全局定义------------------
  40. // sample measure result file mark
  41. public int SMPL_MSR_RESULT_FILE_MARK = 'S' + 'M' + 'P' + 'L' + 'M' + 'S' + 'R' + 'R' + 'E' + 'S' + 'U' + 'L' + 'T';
  42. // sample measure result file version
  43. public string SMPL_MSR_RESULT_FILE_VERSION = ("2.0.0");
  44. // sample measure result file extension
  45. //----------定义----------------------
  46. // file version string
  47. string m_strFileVersion;
  48. // SEM sample stage
  49. CSEMStageData m_pSEMStageData;
  50. // sample stage
  51. CStage m_pStage;
  52. //CSEMStageDataPtr m_pSEMData;
  53. CSEMDataGnr m_pSEMData;
  54. // sample setting
  55. COTSSample m_pSample;
  56. // switch
  57. bool m_bSwitch;
  58. public CIncAFileMgr DBFileMgr { get => m_DBFileMgr; set => m_DBFileMgr = value; }
  59. //----------------public-----------------
  60. public CSmplMsrResult()
  61. {
  62. Init();
  63. m_pSample = new COTSSample();
  64. }
  65. public CSmplMsrResult(string measureWorkingFolder,COTSSample a_pSample)
  66. {
  67. Init();
  68. logger = NLog.LogManager.GetCurrentClassLogger();
  69. m_pSample = a_pSample;
  70. m_strWorkingFolder = measureWorkingFolder;
  71. m_strSampleWorkingFolder = measureWorkingFolder + "\\" + a_pSample.GetName();
  72. m_strFieldFileSubFolder = m_strSampleWorkingFolder + "\\" + SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER;
  73. m_strBSEImageFileFolder = m_strFieldFileSubFolder;
  74. m_strDBFileFolder = m_strFieldFileSubFolder;
  75. m_strRstFileName = m_strSampleWorkingFolder + "\\" + a_pSample.GetName() + SMPL_MSR_RESULT_FILE_EXT;
  76. m_strdbPathName = m_strFieldFileSubFolder + "\\" + DBFILE_NAME;
  77. m_DBFileMgr = new CIncAFileMgr(m_strdbPathName);
  78. }
  79. protected void Init()
  80. {
  81. m_strFileVersion = ("");
  82. m_pSEMStageData = new CSEMStageData();
  83. m_pStage = new CStage();
  84. m_pSEMData = new CSEMDataGnr();
  85. m_bSwitch = false;
  86. }
  87. protected void Cleanup()
  88. {
  89. m_pSample.GetFieldsData().Clear();
  90. }
  91. public string GetFileVersion()
  92. {
  93. return m_strFileVersion;
  94. }
  95. public void SetFileVersion(string a_strFileVersion)
  96. {
  97. m_strFileVersion = a_strFileVersion;
  98. }
  99. public COTSSample GetSample()
  100. {
  101. return m_pSample;
  102. }
  103. public void SetSample(COTSSample a_pSample)
  104. {
  105. if (a_pSample != null)
  106. {
  107. return;
  108. }
  109. m_pSample = a_pSample;
  110. }
  111. public CSEMStageData GetSEMStageData()
  112. {
  113. return m_pSEMStageData;
  114. }
  115. public void SetSEMStageData(CSEMStageData a_pSEMStageData)
  116. {
  117. m_pSEMStageData = a_pSEMStageData;
  118. }
  119. // sample stage
  120. public CStage GetStage()
  121. {
  122. return m_pStage;
  123. }
  124. public void SetStage(CStage a_pStage)
  125. {
  126. if (a_pStage != null)
  127. {
  128. return;
  129. }
  130. m_pStage = a_pStage;
  131. }
  132. // SEM condition
  133. public CSEMDataGnr GetSEMStage()
  134. {
  135. return m_pSEMData;
  136. }
  137. public void SetSEMStage(CSEMDataGnr a_pSEMData)
  138. {
  139. if (a_pSEMData != null)
  140. {
  141. return;
  142. }
  143. m_pSEMData = a_pSEMData;
  144. }
  145. public bool GetSwitch()
  146. {
  147. return m_bSwitch;
  148. }
  149. public void SetSwitch(bool a_bSwitch)
  150. {
  151. m_bSwitch = a_bSwitch;
  152. }
  153. public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
  154. {
  155. xInt xnFileMark = new xInt();
  156. xString xnVersion = new xString();
  157. xBool xbSwitch = new xBool();
  158. Collection<Slo> xfields = new Collection<Slo>();
  159. Slo slo = new Slo();
  160. slo.Register("FileMark", xnFileMark);
  161. slo.Register("Version", xnVersion);
  162. slo.Register("Switch", xbSwitch);
  163. slo.Register("SEMStageData", m_pSEMStageData);
  164. slo.Register("Stage", m_pStage);
  165. slo.Register("SEMData", m_pSEMData);
  166. slo.Register("Sample", m_pSample);
  167. slo.Register("Fields", xfields);
  168. if (isStoring)
  169. {
  170. xnFileMark.AssignValue(SMPL_MSR_RESULT_FILE_MARK);
  171. xnVersion.AssignValue(SMPL_MSR_RESULT_FILE_VERSION);
  172. xbSwitch.AssignValue(m_bSwitch);
  173. slo.Serialize(true, classDoc, rootNode);
  174. }
  175. else
  176. {
  177. slo.Serialize(false, classDoc, rootNode);
  178. m_bSwitch = xbSwitch.value();
  179. m_strFileVersion = xnVersion.value();
  180. }
  181. }
  182. private bool InitFolders()
  183. {
  184. if (!Exists(m_strSampleWorkingFolder))
  185. {
  186. // the working directory is not exit, create it
  187. if (!CreateFolder(m_strSampleWorkingFolder))
  188. {
  189. return false;
  190. }
  191. }
  192. // check if the field files directory exists
  193. if (!Exists(m_strFieldFileSubFolder))
  194. {
  195. // field files directory exists not exists, creates it
  196. if (!CreateFolder(m_strFieldFileSubFolder))
  197. {
  198. // failed to create the field files directory
  199. return false;
  200. }
  201. }
  202. return true;
  203. }
  204. // creates a folder.
  205. private bool CreateFolder(string a_strFolder)
  206. {
  207. // make sure the folder name string are not empty
  208. string strFolder = a_strFolder;
  209. strFolder.Trim();
  210. if (strFolder=="")
  211. {
  212. return false;
  213. }
  214. // if the folder exist?
  215. if (Exists(strFolder))
  216. {
  217. return true;
  218. }
  219. Directory.CreateDirectory(strFolder);
  220. bool bRet = true;
  221. // return folder create result
  222. return bRet;
  223. }
  224. // check if the file exists or not
  225. private bool Exists(string a_sPath)
  226. {
  227. return Directory.Exists(a_sPath);
  228. }
  229. // Load
  230. public bool Load(String a_strPathname /*= _T("")*/)
  231. {
  232. a_strPathname.Trim();
  233. if (a_strPathname == "")
  234. {
  235. FolderBrowserDialog FileDialog = new FolderBrowserDialog();//创建一个文件对话框
  236. if (FileDialog.ShowDialog() != DialogResult.OK)
  237. {
  238. // user canceled loading
  239. logger.Info("Load: user canceled loading.");
  240. return false;
  241. }
  242. a_strPathname = FileDialog.SelectedPath;
  243. }
  244. // get path of the pathname
  245. String strFilePath =a_strPathname;
  246. // field file sub folder string
  247. m_strFieldFileSubFolder = strFilePath + "\\" + SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER + "\\";
  248. // check if the field file sub folder exists
  249. if (!Exists(m_strFieldFileSubFolder))
  250. {
  251. // field files folder doesn't exist
  252. return false;
  253. }
  254. // file version
  255. String strFileVersion = m_strFileVersion;
  256. uint nFileVersion = GetVersionFromString(strFileVersion);
  257. if (nFileVersion == 0)
  258. {// invalid file
  259. return false;
  260. }
  261. // sample measure result file
  262. SetPathFileName(a_strPathname);
  263. this.LoadFieldDataFromDB(a_strPathname);
  264. // ok, return TRUE
  265. return true;
  266. }
  267. // Get file versio
  268. // File Version should be format <Major version>.<Minor version>.<Build version>, like 1.2.3
  269. public uint GetVersionFromString(string a_sVersion)
  270. {
  271. int nMajorVersion = 0;
  272. int nMinorVersion = 0;
  273. int nBuildVersion = 0;
  274. uint nVersion = 0;
  275. if (GetMajorVersionFromString(a_sVersion, nMajorVersion) &&
  276. GetMinorVersionFromString(a_sVersion, nMinorVersion) &&
  277. GetBuildVersionFromString(a_sVersion, nBuildVersion))
  278. {
  279. nVersion = (uint)nMajorVersion * 10000 + (uint)nMinorVersion * 100 + (uint)nBuildVersion;
  280. }
  281. return nVersion;
  282. }
  283. public bool GetMinorVersionFromString(string a_sVersion, int a_nVersion)
  284. {
  285. // version string
  286. String strVersion = a_sVersion;
  287. // get major file version string position first
  288. int nPosFirst = strVersion.IndexOf('.');
  289. if (nPosFirst < 0)
  290. {
  291. // failed to find major file version string
  292. return false;
  293. }
  294. // get minor file version string position
  295. int nPosSecond = strVersion.IndexOf('.', nPosFirst + 1);
  296. int nStrLength = nPosSecond - nPosFirst - 1;
  297. if (nStrLength <= 0)
  298. {
  299. // failed to find minor file version string
  300. return false;
  301. }
  302. // get minor file version string
  303. String strMinorVersion = strVersion.Remove(nPosFirst + 1, nStrLength);
  304. // the minor file version string can't be empty
  305. strMinorVersion.Trim();
  306. if (strMinorVersion == "")
  307. {
  308. // failed to find minor file version string
  309. return false;
  310. }
  311. // convert the minor version string to minor version number
  312. if (!StringToInt(strMinorVersion, a_nVersion))
  313. {
  314. // failed to convert the major file version string to number
  315. return false;
  316. }
  317. // ok, return TRUE
  318. return true;
  319. }
  320. public bool GetMajorVersionFromString(string a_sVersion, int a_nVersion)
  321. {
  322. // version string
  323. String strVersion = a_sVersion;
  324. // get major file version string position
  325. int nPosFirst = strVersion.IndexOf('.');
  326. if (nPosFirst <= 0)
  327. {
  328. // failed to find major file version
  329. return false;
  330. }
  331. // get major file version string
  332. String strMajorVersion = strVersion.PadLeft(nPosFirst);
  333. // the major file version string can't be empty
  334. strMajorVersion.Trim();
  335. if (strMajorVersion == "")
  336. {
  337. // failed to find major file version
  338. return false;
  339. }
  340. // convert the major version string to major version number
  341. if (!StringToInt(strMajorVersion, a_nVersion))
  342. {
  343. // failed to convert the major file version string to number
  344. return false;
  345. }
  346. // ok, return TRUE
  347. return true;
  348. }
  349. public bool GetBuildVersionFromString(string a_sVersion, int a_nBuild)
  350. {
  351. // version string
  352. String strVersion = a_sVersion;
  353. // get major file version string position first
  354. int nPosFirst = strVersion.IndexOf('.');
  355. if (nPosFirst < 0)
  356. {
  357. // failed to find major file version string
  358. return false;
  359. }
  360. // get minor file version string position
  361. int nPosSecond = strVersion.IndexOf('.', nPosFirst + 1);
  362. if (nPosSecond < 0)
  363. {
  364. // failed to find minor file version string
  365. return false;
  366. }
  367. // get build string position
  368. int nStrLength = strVersion.Length - nPosSecond - 1;
  369. if (nStrLength <= 0)
  370. {
  371. // failed to find build string
  372. return false;
  373. }
  374. // get build string
  375. String strBuild = strVersion.PadRight(nStrLength);
  376. // build string can't be empty
  377. strBuild.Trim();
  378. if (strBuild == "")
  379. {
  380. // failed to convert the build string to number
  381. return false;
  382. }
  383. // convert the build string to build number
  384. if (!StringToInt(strBuild, a_nBuild))
  385. {
  386. // failed to convert the build string to number
  387. return false;
  388. }
  389. // ok, return TRUE
  390. return true;
  391. }
  392. // Strings to int.
  393. public bool StringToInt(string a_sValue, int a_nValue)
  394. {
  395. if (!IsDigitString(a_sValue))
  396. {
  397. return false;
  398. }
  399. a_nValue = Convert.ToInt32(a_sValue);
  400. return true;
  401. }
  402. // Determines whether is digit string.
  403. public bool IsDigitString(string a_sValue)
  404. {
  405. String strInt = a_sValue;
  406. strInt.Trim();
  407. if (strInt == "")
  408. {
  409. return false;
  410. }
  411. int nStart = 0;
  412. if (strInt[nStart] == '-')
  413. {
  414. ++nStart;
  415. }
  416. // cycle through string and check each character if it is a digit
  417. for (; nStart < strInt.Length; ++nStart)
  418. {
  419. if (strInt[nStart] != '-')
  420. {
  421. return false;
  422. }
  423. }
  424. return true;
  425. }
  426. // gets the name of the folder
  427. static String GetFolderName(String a_strPathName)
  428. {
  429. string str= FileHelper.GetFolderName(a_strPathName);
  430. return str.ToString();
  431. }
  432. private bool LoadFieldDataFromDB(string a_strPathname)
  433. {
  434. // check the pathname string
  435. a_strPathname.Trim();
  436. if (a_strPathname == null)
  437. {
  438. // open
  439. FolderBrowserDialog FileDialog = new FolderBrowserDialog();//创建一个文件对话框
  440. if (FileDialog.ShowDialog() != DialogResult.OK)
  441. {
  442. // user canceled loading
  443. logger.Info("Load: user canceled loading.");
  444. return false;
  445. }
  446. a_strPathname = FileDialog.SelectedPath;
  447. }
  448. // get path of the pathname
  449. string strFilePath = GetFolderName(a_strPathname);
  450. if (strFilePath == null)
  451. {
  452. // file path string is an empty string
  453. logger.Info("Load: file path string is an empty string.");
  454. return false;
  455. }
  456. // field file sub folder string
  457. string strFieldFileSubFolder = strFilePath + "\\" + SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER + "\\";
  458. // check if the field file sub folder exists
  459. if (!Exists(strFieldFileSubFolder))
  460. {// field files folder doesn't exist
  461. logger.Info("Load: field files folder doesn't exist (%s).");
  462. return false;
  463. }
  464. string strIncAFilename = strFieldFileSubFolder + "\\" +DBFILE_NAME;
  465. CIncAFileMgr pIncAFileMgr = new CIncAFileMgr(strIncAFilename);
  466. List<COTSFieldData> allFlds;
  467. allFlds = null;
  468. CMsrSampleStatus poMsrStatus = m_pSample.GetMsrStatus();
  469. CMsrResultItems poMsrResults = m_pSample.GetMsrResults();
  470. double aFldArea = m_pSample.CalculateAFieldArea();
  471. if (GetAllFieldsFromDB(allFlds, poMsrStatus, poMsrResults, aFldArea))
  472. {
  473. SetFieldData(allFlds);
  474. return true;
  475. }
  476. else
  477. {
  478. return false;
  479. }
  480. }
  481. public bool GetAllFieldsFromDB(List<COTSFieldData> allFlds, CMsrSampleStatus status, CMsrResultItems rst, double aFieldArea)
  482. {
  483. List<System.Drawing.PointF> completedfld = new List<System.Drawing.PointF>();
  484. m_DBFileMgr.GetIncADB().GetAllFieldsRecord(ref allFlds);
  485. var SegmentDB = m_DBFileMgr.GetSegmentDB();
  486. double msrFldsArea = 0;
  487. Dictionary<int, List<COTSParticleClr>> mapTypeParticles = new Dictionary<int, List<COTSParticleClr>>();
  488. Dictionary<string, List<COTSSegmentClr>> AllSegments = new Dictionary<string, List<COTSSegmentClr>>();
  489. if (SegmentDB.GetAllSegmentsRecord(AllSegments))
  490. {
  491. //int nCol;
  492. foreach (var fld in allFlds)
  493. {
  494. int fldId = fld.GetId();
  495. List<COTSParticleClr> parts = fld.GetListAnalysisParticles();
  496. List<COTSSegmentClr> cOTSSegment = new List<COTSSegmentClr>();
  497. foreach (var part in parts)
  498. {
  499. var itr = AllSegments.Values;
  500. if (itr != AllSegments.Values)
  501. {
  502. COTSFeatureClr f = new COTSFeatureClr();
  503. f.SetSegmentsList(cOTSSegment, true);
  504. part.SetFeature(f);
  505. }
  506. mapTypeParticles[part.GetClassifyId()].Add(part);
  507. }
  508. completedfld.Add(fld.GetOTSPosition());
  509. msrFldsArea += aFieldArea;
  510. }
  511. }
  512. // get MsrStatus info from DB.
  513. String strTimeStart = "";
  514. String strTimeEnd = "";
  515. String strRstStatus = "";
  516. var m_GenInfoDB = m_DBFileMgr.GetGeneralInfoDB();
  517. m_GenInfoDB.GetStringValue(m_GenInfoDB.GetTableItemNameTimeStart(), ref strTimeStart);
  518. m_GenInfoDB.GetStringValue(m_GenInfoDB.GetTableItemNameTimeEnd(),ref strTimeEnd);
  519. m_GenInfoDB.GetStringValue(m_GenInfoDB.GetTableItemNameResultStatus(),ref strRstStatus);
  520. status.SetCompletedFieldsCenter(completedfld);
  521. DateTime timeStart, timeEnd;
  522. timeStart = Convert.ToDateTime(strTimeStart);
  523. timeEnd = Convert.ToDateTime(strTimeEnd);
  524. status.SetStartTime(timeStart);
  525. status.SetEndTime(timeEnd);
  526. status.SetUsedTime(timeEnd - timeStart);
  527. status.SetStatus((OTS_MSR_SAMPLE_STATUS)Convert.ToInt32(strRstStatus));
  528. //get MsrResults data from map.
  529. List<CMsrResultItem> rstItms = new List<CMsrResultItem>();
  530. double allPartArea = 0;
  531. foreach (var typeParticles in mapTypeParticles)
  532. {
  533. CMsrResultItem rstItm = new CMsrResultItem();
  534. int typeNum = 0;
  535. double typeArea = 0;
  536. foreach (var p in mapTypeParticles)
  537. {
  538. typeNum += 1;
  539. typeArea += Convert.ToInt32(p);
  540. }
  541. rstItm.SetTypeId(Convert.ToInt32(typeParticles));
  542. rstItm.SetNumber((uint)typeNum);
  543. rstItm.SetArea((uint)typeArea);
  544. rstItms.Add(rstItm);
  545. allPartArea += typeArea;
  546. }
  547. rst.SetResultItems(rstItms);
  548. rst.SetMeasuredArea((uint)msrFldsArea * 1000000);
  549. rst.SetRatio(allPartArea / (msrFldsArea * 1000000));
  550. return true;
  551. }
  552. // Save
  553. public bool CreateResultFiles()
  554. {
  555. InitFolders();
  556. XmlDocument xmlDoc = new XmlDocument();
  557. XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);
  558. xmlDoc.AppendChild(xmlDeclaration);
  559. XmlElement rootNode = xmlDoc.CreateElement("XMLData");
  560. xmlDoc.AppendChild(rootNode);
  561. XmlNode root = xmlDoc.SelectSingleNode("XMLData");
  562. Serialize(true, xmlDoc, root);
  563. if (!File.Exists(m_strRstFileName))
  564. {
  565. xmlDoc.Save(m_strRstFileName);
  566. }
  567. m_DBFileMgr.InitFile();
  568. m_DBFileMgr.InitDataTable();
  569. return true;
  570. }
  571. public string GetFieldFileSubFolderStr()
  572. {
  573. // return field file sub folder string
  574. return m_strFieldFileSubFolder;
  575. }
  576. // sample measure result file
  577. // save a BSE file for a field
  578. public bool SaveBSEFileForAField(COTSFieldData a_pField)
  579. {
  580. if (a_pField == null)
  581. {
  582. logger.Info("SaveBSEFileForAField: invalid field data pointer.");
  583. return false;
  584. }
  585. string strBSEFilePathname = m_strSampleWorkingFolder + "\\" +SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER + "\\";
  586. // save BSE file for the field
  587. CBSEImgClr pBSEImage = a_pField.GetBSEImage();
  588. CBSEImageFileMgr pBSEImgFileMgr = new CBSEImageFileMgr();
  589. pBSEImgFileMgr.SetBSEImg(pBSEImage);
  590. pBSEImgFileMgr.SaveIntoBitmap(strBSEFilePathname);
  591. // ok, return TRUE
  592. return true;
  593. }
  594. // save a x-ray file for a field
  595. public bool SaveXRayFileForAField(List<CPosXrayClr> a_pFieldXray)
  596. {
  597. string strIncAFilename = m_strDBFileFolder + "\\" + DBFILE_NAME;
  598. // save x-ray file for the field
  599. CPosXrayDBMgr pPosXrayDBMgr = new CIncAFileMgr(strIncAFilename).GetPosXrayDBMgr();
  600. List<CPosXrayClr> listAnalysisXray = a_pFieldXray;
  601. if (!pPosXrayDBMgr.SaveXray(listAnalysisXray,true))
  602. {
  603. logger.Info("SaveXRayFileForAField: save analysis x-ray failed.");
  604. return false;
  605. }
  606. // ok, return TRUE
  607. return true;
  608. }
  609. public void SetFieldData(List<COTSFieldData> a_listFieldData)
  610. {
  611. m_pSample.SetFieldsData(a_listFieldData);
  612. }
  613. public string GetPathFileName()
  614. {
  615. return m_strRstFileName;
  616. }
  617. public string GetDBPathName()
  618. {
  619. return m_strdbPathName;
  620. }
  621. public void SetPathFileName(string PathName)
  622. {
  623. m_strRstFileName = PathName;
  624. }
  625. public void SetSEMGnr(CSEMDataGnr a_pSEMGnr)
  626. {
  627. if (a_pSEMGnr == null)
  628. {
  629. logger.Info("input a invalid SEM general data pointer.");
  630. return;
  631. }
  632. m_pSEMData= a_pSEMGnr;
  633. }
  634. public void SetSEMStage(CStage a_pStage)
  635. {
  636. //ASSERT(a_pStage);
  637. if (a_pStage == null)
  638. {
  639. logger.Info("input a invalid stage pointer.");
  640. return;
  641. }
  642. m_pStage= a_pStage;
  643. }
  644. }
  645. }