ScanController.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. 
  2. using FEIApiControl;
  3. using OTSCLRINTERFACE;
  4. using OTSDataType;
  5. using OTSMeasureApp.ServiceCenter;
  6. using OTSMeasureApp.ServiceCenter.Coxm;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. using static OxfordExtenderWrapper.ExtenderIpcUI;
  15. namespace OTSModelSharp.ServiceCenter
  16. {
  17. public class ScanController : IScanController
  18. {
  19. private OTSCLRINTERFACE.COTSControlFunExport scan;
  20. static IScanController scanctrl=null;
  21. public static APIClass ApiClass = null;
  22. int imageWidth = 0;
  23. int imageHeight = 0;
  24. public static IScanController GetScanController()
  25. {
  26. var semtype = FileHelper.GetXMLInformations("SemControllerName");
  27. if (scanctrl == null)
  28. {
  29. if (semtype == "FEI")
  30. {
  31. scanctrl = new FEIScanController();
  32. }
  33. else if (semtype == "Oxford")
  34. {
  35. var srcType = FileHelper.GetOxfordInputSourceType();
  36. ImageInputSourceType imageSrcType = ImageInputSourceType.Bse;
  37. if (srcType == "SE")
  38. {
  39. imageSrcType = ImageInputSourceType.SE;
  40. }
  41. else if (srcType == "BSE")
  42. {
  43. imageSrcType = ImageInputSourceType.Bse;
  44. }
  45. scanctrl = new OxfordScanController(imageSrcType);
  46. }
  47. else if(semtype=="PicoSmart")
  48. {
  49. var srcType = FileHelper.GetOxfordInputSourceType();
  50. scanctrl = new PicoSartScanController();
  51. if (srcType == "SE")
  52. {
  53. }
  54. else if(srcType == "BSE")
  55. {
  56. }
  57. }
  58. else if (semtype == "Coxm")
  59. {
  60. var srcType = FileHelper.GetOxfordInputSourceType();
  61. scanctrl = new CoxmScanController();
  62. if (srcType == "SE")
  63. {
  64. }
  65. else if (srcType == "BSE")
  66. {
  67. }
  68. }
  69. else
  70. {
  71. scanctrl = new ScanController(semtype);
  72. }
  73. }
  74. return scanctrl;
  75. }
  76. private ScanController(string devicetype)
  77. {
  78. this.scan = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance(devicetype);
  79. }
  80. public CBSEImgClr AcquireBSEImage()
  81. {
  82. if (!scan.IsConnected())
  83. {
  84. return null;
  85. }
  86. Rectangle r = new Rectangle();
  87. CBSEImgClr bse = new CBSEImgClr(r);
  88. if (!scan.AcquireBSEImage( ref bse))
  89. {
  90. return null;
  91. }
  92. return bse;
  93. }
  94. public bool Init()
  95. {
  96. if (!scan.IsConnected())
  97. {
  98. scan.ConncetSem();
  99. }
  100. return scan.ScanInit();
  101. }
  102. public bool SetDwellTime(DwellTimeLevel val)
  103. {
  104. double dwelltime=2;
  105. switch (val)
  106. {
  107. case DwellTimeLevel.Low:
  108. dwelltime = 2;
  109. break;
  110. case DwellTimeLevel.Medium:
  111. dwelltime = 4;
  112. break;
  113. case DwellTimeLevel.High:
  114. dwelltime = 8;
  115. break;
  116. }
  117. if (!scan.IsConnected())
  118. {
  119. return false;
  120. }
  121. return scan.SetDwellTime((int)dwelltime);
  122. }
  123. public bool SetImageSize(int width,int height)
  124. {
  125. imageWidth = width;
  126. imageHeight = height;
  127. if (!scan.IsConnected())
  128. {
  129. return false;
  130. }
  131. return scan.SetImageSize(width, height);
  132. }
  133. public CBSEImgClr AcquireRectangleBSEImage( Rectangle rec)
  134. {
  135. return null;
  136. }
  137. }
  138. }