ExtenderInterface.cs 3.8 KB

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