ExtenderInterface.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. }
  45. public class Segment
  46. {
  47. private int m_nX;
  48. private int m_nY;
  49. private int m_nLength;
  50. public int X
  51. {
  52. get { return m_nX; }
  53. set {
  54. if (value > 0)
  55. {
  56. m_nX = value;
  57. }
  58. }
  59. }
  60. public int Y
  61. {
  62. get { return m_nY; }
  63. set
  64. {
  65. if (value > 0)
  66. {
  67. m_nY = value;
  68. }
  69. }
  70. }
  71. public int Length
  72. {
  73. get { return m_nLength; }
  74. set
  75. {
  76. if (value > 0)
  77. {
  78. m_nLength = value;
  79. }
  80. }
  81. }
  82. };
  83. //Extender控制
  84. public interface IExtenderControl
  85. {
  86. //缩放
  87. float GetMagnification();
  88. Boolean SetMagnification(float set);
  89. //焦距
  90. float GetWorkingDistance();
  91. Boolean SetWorkingDistance(float set);
  92. //亮度
  93. float GetBrightness();
  94. Boolean SetBrightness(float set);
  95. //对比度
  96. float GetContrast();
  97. Boolean SetContrast(float set);
  98. //SEM电压
  99. float GetSEMVoltage();
  100. Boolean SetSEMVoltage(float set);
  101. //样品台
  102. float[] GetStagePosition();
  103. Boolean SetStagePosition(float[] set);
  104. float GetStageAtX();
  105. float GetStageAtY();
  106. float GetStageAtZ();
  107. float GetStageAtT();
  108. float GetStageAtR();
  109. Boolean SetStageGotoX(float set);
  110. Boolean SetStageGotoY(float set);
  111. Boolean SetStageGotoZ(float set);
  112. Boolean SetStageGotoT(float set);
  113. Boolean SetStageGotoR(float set);
  114. Boolean MoveStageXY(float x, float y);
  115. //拍图
  116. Boolean GrabImage(String filename, short xoff, short yoff, short width, short height, short type);
  117. //采集参数设置
  118. Boolean SetImageAcquistionSetting(double a_dDwellTime, int a_nImageType, double a_dImageScanSize);
  119. //获取分辨率
  120. int[] GetImageStore();
  121. //设置分辨率
  122. Boolean SetImageStore(float set);
  123. //获取bitmap
  124. Bitmap GetBitmap();
  125. bool IsAcquiringSpectrum();
  126. //X-ray
  127. //点采集
  128. Boolean XrayPointCollectiong(double dMilliSecondsTime, int x, int y, out long[] XrayData, out Dictionary<string, double> a_listElement);
  129. //面采集
  130. Boolean XrayAreaCollectiong(double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement);
  131. }
  132. }