ExtenderInterface.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Drawing;
  7. namespace Extender
  8. {
  9. public sealed class ExtenderInterface
  10. {
  11. //只读的静态成员
  12. private static readonly ExtenderInterface instance = new ExtenderInterface();
  13. // Explicit static constructor to tell C# compiler
  14. // not to mark type as beforefieldinit
  15. //C#的静态构造函数只有在当其类的实例被创建或者有静态成员被引用时执行,
  16. //在整个应用程序域中只会被执行一次。
  17. static ExtenderInterface()
  18. {
  19. }
  20. private ExtenderInterface()
  21. {
  22. }
  23. //使用这个实例
  24. public static ExtenderInterface Instance
  25. {
  26. get
  27. {
  28. return instance;
  29. }
  30. }
  31. //其他使用的成员变量
  32. private IExtenderControl m_iExtender = null; //成员变量
  33. //private readonly IExtenderControl m_iExtender = new Extender(); //成员变量
  34. public IExtenderControl IExtender
  35. {
  36. get {
  37. if (m_iExtender == null)
  38. {
  39. m_iExtender = new ExtenderWrapper();
  40. }
  41. return m_iExtender;
  42. }
  43. } //属性,只能当前类创建
  44. ~ExtenderInterface()
  45. {
  46. if (m_iExtender!=null)
  47. {
  48. m_iExtender.CloseExtender();
  49. }
  50. }
  51. }
  52. public class Segment
  53. {
  54. private int m_nX;
  55. private int m_nY;
  56. private int m_nLength;
  57. public int X
  58. {
  59. get { return m_nX; }
  60. set {
  61. if (value > 0)
  62. {
  63. m_nX = value;
  64. }
  65. }
  66. }
  67. public int Y
  68. {
  69. get { return m_nY; }
  70. set
  71. {
  72. if (value > 0)
  73. {
  74. m_nY = value;
  75. }
  76. }
  77. }
  78. public int Length
  79. {
  80. get { return m_nLength; }
  81. set
  82. {
  83. if (value > 0)
  84. {
  85. m_nLength = value;
  86. }
  87. }
  88. }
  89. };
  90. //Extender控制
  91. public interface IExtenderControl
  92. {
  93. //缩放
  94. float GetMagnification();
  95. Boolean SetMagnification(float set);
  96. //焦距
  97. float GetWorkingDistance();
  98. Boolean SetWorkingDistance(float set);
  99. //亮度
  100. float GetBrightness();
  101. Boolean SetBrightness(float set);
  102. //对比度
  103. float GetContrast();
  104. Boolean SetContrast(float set);
  105. //SEM电压
  106. float GetSEMVoltage();
  107. Boolean SetSEMVoltage(float set);
  108. //样品台
  109. float[] GetStagePosition();
  110. Boolean SetStagePosition(float[] set);
  111. float GetStageAtX();
  112. float GetStageAtY();
  113. float GetStageAtZ();
  114. float GetStageAtT();
  115. float GetStageAtR();
  116. Boolean SetStageGotoX(float set);
  117. Boolean SetStageGotoY(float set);
  118. Boolean SetStageGotoZ(float set);
  119. Boolean SetStageGotoT(float set);
  120. Boolean SetStageGotoR(float set);
  121. Boolean MoveStageXY(float x, float y);
  122. //拍图
  123. Boolean GrabImage(String filename, short xoff, short yoff, short width, short height, short type);
  124. //采集参数设置
  125. Boolean SetImageAcquistionSetting(double a_dDwellTime, int a_nImageType, double a_dImageScanSize);
  126. //获取分辨率
  127. int[] GetImageStore();
  128. //设置分辨率
  129. Boolean SetImageStore(float set);
  130. //获取bitmap
  131. Bitmap GetBitmap();
  132. bool IsAcquiringSpectrum();
  133. //X-ray
  134. //点采集
  135. Boolean XrayPointCollecting(double dMilliSecondsTime, double x, double y, out long[] XrayData, out Dictionary<string, double> a_listElement);
  136. //Boolean XrayPointCollectiong1(double dMilliSecondsTime, int x, int y, out long[] XrayData, out Dictionary<string, double> a_listElement);
  137. //面采集
  138. Boolean XrayAreaCollectiong( double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement);
  139. void CloseExtender();
  140. void BeginMultipleAquisition();
  141. void EndMultipleAquisition();
  142. void BeginAreaModeMultipleAquisition();
  143. void EndAreaModeMultipleAquisition();
  144. }
  145. }