ScanController.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. 
  2. using FEIApiControl;
  3. //using OINA.Extender.Data.Image;
  4. using OTSCLRINTERFACE;
  5. using OTSDataType;
  6. using OTSMeasureApp.ServiceCenter;
  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
  59. {
  60. scanctrl = new ScanController(semtype);
  61. }
  62. }
  63. return scanctrl;
  64. }
  65. private ScanController(string devicetype)
  66. {
  67. this.scan = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance(devicetype);
  68. }
  69. public CBSEImgClr AcquireBSEImage()
  70. {
  71. if (!scan.IsConnected())
  72. {
  73. return null;
  74. }
  75. Rectangle r = new Rectangle();
  76. CBSEImgClr bse = new CBSEImgClr(r);
  77. if (!scan.AcquireBSEImage( ref bse))
  78. {
  79. return null;
  80. }
  81. return bse;
  82. }
  83. public bool Init()
  84. {
  85. if (!scan.IsConnected())
  86. {
  87. scan.ConncetSem();
  88. }
  89. return scan.ScanInit();
  90. }
  91. public bool SetDwellTime(double val)
  92. {
  93. if (!scan.IsConnected())
  94. {
  95. return false;
  96. }
  97. return scan.SetDwellTime((int)val);
  98. }
  99. public bool SetImageSize(int width,int height)
  100. {
  101. imageWidth = width;
  102. imageHeight = height;
  103. if (!scan.IsConnected())
  104. {
  105. return false;
  106. }
  107. return scan.SetImageSize(width, height);
  108. }
  109. }
  110. }