ScanController.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. 
  2. using FEIApiControl;
  3. using OTSCLRINTERFACE;
  4. using OTSDataType;
  5. using OTSMeasureApp.ServiceCenter;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace OTSModelSharp.ServiceCenter
  14. {
  15. public class ScanController : IScanController
  16. {
  17. private OTSCLRINTERFACE.COTSControlFunExport scan;
  18. static IScanController scanctrl=null;
  19. public static APIClass ApiClass = null;
  20. int imageWidth = 0;
  21. int imageHeight = 0;
  22. public static IScanController GetScanController()
  23. {
  24. if (scanctrl == null)
  25. {
  26. if (FileHelper.GetXMLInformations("SemControllerName") == "FEI")
  27. {
  28. scanctrl = new FEIScanController();
  29. }
  30. else
  31. {
  32. scanctrl = new ScanController();
  33. }
  34. }
  35. return scanctrl;
  36. }
  37. private ScanController()
  38. {
  39. this.scan = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance();
  40. }
  41. public CBSEImgClr AcquireBSEImage()
  42. {
  43. if (!scan.IsConnected())
  44. {
  45. return null;
  46. }
  47. Rectangle r = new Rectangle();
  48. CBSEImgClr bse = new CBSEImgClr(r);
  49. if (!scan.AcquireBSEImage( ref bse))
  50. {
  51. return null;
  52. }
  53. return bse;
  54. }
  55. public bool Init()
  56. {
  57. if (!scan.IsConnected())
  58. {
  59. scan.ConncetSem();
  60. }
  61. return scan.ScanInit();
  62. }
  63. public bool SetDwellTime(double val)
  64. {
  65. if (!scan.IsConnected())
  66. {
  67. return false;
  68. }
  69. return scan.SetDwellTime((int)val);
  70. }
  71. public bool SetImageSize(int width,int height)
  72. {
  73. imageWidth = width;
  74. imageHeight = height;
  75. if (!scan.IsConnected())
  76. {
  77. return false;
  78. }
  79. return scan.SetImageSize(width, height);
  80. }
  81. }
  82. }