|
@@ -0,0 +1,163 @@
|
|
|
+using DevExpress.Internal.WinApi.Windows.UI.Notifications;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.IO;
|
|
|
+using System.Linq;
|
|
|
+using System.Runtime.InteropServices;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using XzXdDw.App.Api;
|
|
|
+
|
|
|
+namespace XdCxRhDW.App.Api.时差线
|
|
|
+{
|
|
|
+ public class DrawDtoLineHelper
|
|
|
+ {
|
|
|
+ #region 未使用
|
|
|
+ /*
|
|
|
+ static double[] HandleX2D1(X2D1Option opt)
|
|
|
+ {
|
|
|
+ var target_llh = DLL_LXYDApi.XingDi_DW(
|
|
|
+ opt.MsEph
|
|
|
+ , opt.NsEph
|
|
|
+ , opt.MsAnt
|
|
|
+ , opt.NsAnt
|
|
|
+ , opt.CDBMsAnt
|
|
|
+ , opt.CDBAnt
|
|
|
+ , opt.RefGeod
|
|
|
+ , opt.Zone
|
|
|
+ , opt.SxDto * 1e-6
|
|
|
+ , opt.xdDto * 1e-6
|
|
|
+ , -opt.SampMsDto * 1e-6
|
|
|
+ , -opt.SampNsDto * 1e-6
|
|
|
+ , -opt.CDBpMsDto * 1e-6
|
|
|
+ );
|
|
|
+ double[] result = new double[6];
|
|
|
+ Marshal.Copy(target_llh, result, 0, result.Length);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ static void HandleX1D2(X1D2Option opt)
|
|
|
+ {
|
|
|
+ var target_llh = DLL_YXLDApi.XingDi_DW_YXLD(
|
|
|
+ opt.MsEph
|
|
|
+ , opt.Ms1Ant
|
|
|
+ , opt.Ms2Ant
|
|
|
+ , opt.Nd1Ant
|
|
|
+ , opt.Nd2Ant
|
|
|
+ , opt.RefGeod1
|
|
|
+ , opt.RefGeod2
|
|
|
+ , opt.Zone
|
|
|
+ , opt.DtXd1 * 1e-6
|
|
|
+ , opt.DtXd2 * 1e-6
|
|
|
+ , -opt.DtRef1 * 1e-6
|
|
|
+ , -opt.DtRef2 * 1e-6
|
|
|
+ );
|
|
|
+ double[] result = new double[6];
|
|
|
+ Marshal.Copy(target_llh, result, 0, result.Length);
|
|
|
+ // OutputHelper.WritePos(result);
|
|
|
+ }
|
|
|
+ */
|
|
|
+ #endregion
|
|
|
+ private const string exeName = "XingDiSCX.exe";
|
|
|
+
|
|
|
+ public static IEnumerable<(double lon, double lat)> HandleDtoLineXd(DtoLineXdOption opt)
|
|
|
+ {
|
|
|
+ List<DtoLinePoint> list = new List<DtoLinePoint>();
|
|
|
+
|
|
|
+ string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "API\\时差线\\DtoLine.dat");
|
|
|
+ string exePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "API\\时差线");
|
|
|
+ if (string.IsNullOrWhiteSpace(exePath))
|
|
|
+ throw new Exception($"请先调用SetExePath指定{exeName}进程所在路径,支持相对路径");
|
|
|
+ if (!Directory.Exists(exePath))
|
|
|
+ throw new Exception($"路径[{exePath}]不存在");
|
|
|
+ var exeFile = Path.Combine(exePath, exeName);
|
|
|
+ if (!File.Exists(exeFile))
|
|
|
+ throw new Exception($"文件[{exeFile}]不存在");
|
|
|
+ List<string> arguments = new List<string>();
|
|
|
+ arguments.Add(file);
|
|
|
+ arguments.Add($"{opt.MsEph[0]}");
|
|
|
+ arguments.Add($"{opt.MsEph[1]}");
|
|
|
+ arguments.Add($"{opt.MsEph[2]}");
|
|
|
+
|
|
|
+ arguments.Add($"{opt.MsAnt[0]}");
|
|
|
+ arguments.Add($"{opt.MsAnt[1]}");
|
|
|
+
|
|
|
+ arguments.Add($"{opt.CDBAnt[0]}");
|
|
|
+ arguments.Add($"{opt.CDBAnt[1]}");
|
|
|
+
|
|
|
+ arguments.Add($"{opt.RefGeod[0]}");
|
|
|
+ arguments.Add($"{opt.RefGeod[1]}");
|
|
|
+
|
|
|
+ arguments.Add($"{opt.xdDto}");
|
|
|
+ arguments.Add($"{opt.RefDto}");
|
|
|
+
|
|
|
+ Process p = new Process();
|
|
|
+ p.StartInfo.WorkingDirectory = exePath;
|
|
|
+ p.StartInfo.FileName = exeFile;
|
|
|
+ p.StartInfo.Arguments = string.Join(" ", arguments);
|
|
|
+ p.StartInfo.CreateNoWindow = true;
|
|
|
+ p.StartInfo.RedirectStandardError = true;
|
|
|
+ p.StartInfo.RedirectStandardOutput = true;
|
|
|
+ p.StartInfo.UseShellExecute = false;
|
|
|
+ p.Start();
|
|
|
+ var succeed = p.WaitForExit(10000);
|
|
|
+ if (!succeed)
|
|
|
+ {
|
|
|
+ throw new Exception($"进程[{exeName}]超时未完成!");
|
|
|
+ }
|
|
|
+ string result = p.StandardOutput.ReadToEnd();
|
|
|
+ if (string.IsNullOrWhiteSpace(result))
|
|
|
+ {
|
|
|
+ throw new Exception("计算时差线出现未知错误!");
|
|
|
+ }
|
|
|
+ var array = result.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
|
|
+ if (array[0] == "1")
|
|
|
+ {
|
|
|
+ throw new Exception(array[1]);
|
|
|
+ }
|
|
|
+ var dtostr = File.ReadAllText(file);
|
|
|
+ list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DtoLinePoint>>(dtostr);
|
|
|
+
|
|
|
+ var Lines = list.Select(s => (s.Lon, s.Lat));
|
|
|
+ return Lines;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static IEnumerable<(double lon, double lat)> HandleDtoLineTwoStart(DtoLineTwoStartOption opt)
|
|
|
+ {
|
|
|
+
|
|
|
+ List<DtoLinePoint> list = new List<DtoLinePoint>();
|
|
|
+ IntPtr LOP_ValuePtr;
|
|
|
+ int LOP_Len = 0;
|
|
|
+ double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
|
|
|
+
|
|
|
+ PosApi.TwoStar_SCX(
|
|
|
+ opt.MsEph,
|
|
|
+ opt.NsEph,
|
|
|
+ opt.RefGeod,
|
|
|
+ zone,
|
|
|
+ opt.TargetDto * 1e-6,
|
|
|
+ opt.RefDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
|
|
|
+
|
|
|
+
|
|
|
+ double[] LOP_Value = new double[LOP_Len * 3];
|
|
|
+ if (LOP_Len > 0)
|
|
|
+ {
|
|
|
+ Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
|
|
|
+ for (int i = 0; i < LOP_Len; i++)
|
|
|
+ {
|
|
|
+ int temp = i * 3;
|
|
|
+ DtoLinePoint point = new DtoLinePoint();
|
|
|
+ point.Lon = LOP_Value[temp + 1];
|
|
|
+ point.Lat = LOP_Value[temp];
|
|
|
+ list.Add(point);
|
|
|
+ }
|
|
|
+ //OutputHelper.WriteDtoLine(LOP_Value, LOP_Len);
|
|
|
+ }
|
|
|
+ var Lines = list.Select(p => (p.Lon, p.Lat));
|
|
|
+ return Lines;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|