|
@@ -20,6 +20,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
public static APIClass ApiClass = null;
|
|
|
private static bool isFEI = false;
|
|
|
private int AnalyExpCount = 100000;
|
|
|
+ private string strResolution = "";
|
|
|
public static EDSController GetEDSController()
|
|
|
{
|
|
|
if (FileHelper.GetXMLInformations("EDSName") == "FEI")
|
|
@@ -55,7 +56,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
Rectangle rectangle = (Rectangle)a_listParticles[i].GetParticleRect();
|
|
|
Dictionary<string, double> eleItems = new Dictionary<string, double>();
|
|
|
uint[] spectrumItems = new uint[2000];
|
|
|
- if (!ApiClass.GetXRayByRect(rectangle, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref spectrumItems))
|
|
|
+ if (!ApiClass.GetXRayByRect(rectangle, strResolution, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref spectrumItems))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
@@ -99,7 +100,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
Point point = (Point)a_listParticles[i].GetXRayPos();
|
|
|
Dictionary<string, double> eleItems = new Dictionary<string, double>();
|
|
|
uint[] spectrumItems = new uint[2000];
|
|
|
- if (!ApiClass.GetXRayByPoint(point.X, point.Y, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref spectrumItems))
|
|
|
+ if (!ApiClass.GetXRayByPoint(point.X, point.Y, strResolution, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref spectrumItems))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
@@ -146,18 +147,9 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
{
|
|
|
if (isFEI)
|
|
|
{
|
|
|
- double x = 0;
|
|
|
- double y = 0;
|
|
|
- double z = 0;
|
|
|
- double r = 0;
|
|
|
- double t = 0;
|
|
|
Dictionary<string, double> eleItems = new Dictionary<string, double>();
|
|
|
- if (!ApiClass.GetSemPositionXYZRT(ref x, ref y, ref z, ref r, ref t))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
|
|
|
- return ApiClass.GetXRayByPoint((int)x, (int)y, a_nXRayAQTime, AnalyExpCount, false, ref eleItems, ref a_XrayData);
|
|
|
+ return ApiClass.AcquireSpectrum(false, ref eleItems, ref a_XrayData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -184,8 +176,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- return ApiClass.GetXRayByPoint((int)x, (int)y, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref a_XrayData);
|
|
|
+ return ApiClass.GetXRayByPoint((int)x, (int)y, strResolution, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref a_XrayData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -209,8 +200,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
rectangle.Height = Math.Abs(rectangle.Y - rectangle.X);
|
|
|
|
|
|
Dictionary<string, double> eleItems = new Dictionary<string, double>();
|
|
|
-
|
|
|
- return ApiClass.GetXRayByRect(rectangle, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref a_XrayData);
|
|
|
+ return ApiClass.GetXRayByRect(rectangle, strResolution, a_nXRayAQTime, AnalyExpCount, a_bElementInfo, ref eleItems, ref a_XrayData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -227,17 +217,8 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
{
|
|
|
if (isFEI)
|
|
|
{
|
|
|
- double x = 0;
|
|
|
- double y = 0;
|
|
|
- double z = 0;
|
|
|
- double r = 0;
|
|
|
- double t = 0;
|
|
|
Dictionary<string, double> eleItems = new Dictionary<string, double>();
|
|
|
- if (!ApiClass.GetSemPositionXYZRT(ref x, ref y, ref z, ref r, ref t))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- bool isTrue = ApiClass.GetXRayByPoint((int)x, (int)y, a_nXRayAQTime, AnalyExpCount, true, ref eleItems, ref a_XrayData);
|
|
|
+ bool isTrue = ApiClass.AcquireSpectrum(true, ref eleItems, ref a_XrayData);
|
|
|
a_nElementNum = eleItems.Count;
|
|
|
for (int i = 0; i < eleItems.Count; i++)
|
|
|
{
|
|
@@ -262,7 +243,7 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
if (isFEI)
|
|
|
{
|
|
|
Dictionary<string, double> eleItems = new Dictionary<string, double>();
|
|
|
- bool isTrue = ApiClass.GetXRayByPoint(dMouseImgX, dMouseImgY, a_nXRayAQTime, AnalyExpCount, true, ref eleItems, ref a_XrayData);
|
|
|
+ bool isTrue = ApiClass.GetXRayByPoint(dMouseImgX, dMouseImgY, strResolution, a_nXRayAQTime, AnalyExpCount, true, ref eleItems, ref a_XrayData);
|
|
|
a_nElementNum = eleItems.Count;
|
|
|
for (int i = 0; i < eleItems.Count; i++)
|
|
|
{
|
|
@@ -316,10 +297,15 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");
|
|
|
if (FEIIP == "" || FEIPORT == "")
|
|
|
{
|
|
|
- MessageBox.Show("FEI电镜端口配置为空!");
|
|
|
+ NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ if (ApiClass.isConnect())
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
return ApiClass.Connect(FEIIP, FEIPORT);
|
|
|
}
|
|
|
else
|
|
@@ -358,12 +344,9 @@ namespace OTSModelSharp.ServiceInterface
|
|
|
{
|
|
|
if (isFEI)
|
|
|
{
|
|
|
- return ApiClass.SetResolution(ResolutionWidth, ResolutionHeight);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return true;
|
|
|
+ strResolution = ResolutionWidth + "x" + ResolutionHeight;
|
|
|
}
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
public bool SetAnalyExpCount(int MaxCounts)
|