| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 | 
							- 
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Diagnostics;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Runtime.InteropServices;
 
- using System.Text;
 
- namespace XdCxRhDW.App.Api
 
- {
 
-     public class DrawDfoLineHelper
 
-     {
 
-         private const string exeName = "locow.exe";
 
-         private static double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
 
-         /// <summary>
 
-         /// 高轨双星频差线
 
-         /// </summary>
 
-         /// <param name="opt"></param>
 
-         /// <returns></returns>
 
-         /// <exception cref="Exception"></exception>
 
-         public static IEnumerable<(double lon, double lat)> DfoLineTwoStart(DfoLineTwoStartOption opt)
 
-         {
 
-             List<DfoLinePoint> list = new List<DfoLinePoint>();
 
-             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("dfoline");
 
-             arguments.Add($"{opt.TargetDfo}");
 
-             arguments.Add($"{opt.Freq * 1e-6}");
 
-             arguments.Add($"{opt.Turn1 * 1e-6}");
 
-             arguments.Add($"{opt.Turn2 * 1e-6}");
 
-             arguments.Add($"--rec1 {opt.MsAnt[0]} {opt.MsAnt[1]} 0");
 
-             arguments.Add($"--rec2 {opt.NsAnt[0]} {opt.NsAnt[1]} 0");
 
-             arguments.Add($"--eph1 {opt.MsEph[0]} {opt.MsEph[1]} {opt.MsEph[2]} {opt.MsEph[3]} {opt.MsEph[4]} {opt.MsEph[5]}");
 
-             arguments.Add($"--eph2 {opt.NsEph[0]} {opt.NsEph[1]} {opt.NsEph[2]} {opt.NsEph[3]} {opt.NsEph[4]} {opt.NsEph[5]}");
 
-             arguments.Add($"--refdf {opt.RefDfo}");
 
-             arguments.Add($"--reffreq {opt.RefFreq * 1e-6}");
 
-             arguments.Add($"--reflla {opt.RefGeod[0]} {opt.RefGeod[1]} 0");
 
-             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;
 
-             StringBuilder sb = new StringBuilder();
 
-             p.OutputDataReceived += (sender, e) => sb.Append(e.Data);
 
-             p.Start();
 
-             p.BeginOutputReadLine();
 
-             p.WaitForExit();
 
-             if (string.IsNullOrWhiteSpace(sb.ToString()))
 
-             {
 
-                 throw new Exception("计算频差线出现未知错误!");
 
-             }
 
-             var array = sb.ToString().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
 
-             foreach (var item in array)
 
-             {
 
-                 var strs = item.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
 
-                 DfoLinePoint point = new DfoLinePoint();
 
-                 point.Lon = Convert.ToDouble(strs[0]);
 
-                 point.Lat = Convert.ToDouble(strs[1]);
 
-                 list.Add(point);
 
-             }
 
-             var Lines = list.Select(s => (s.Lon, s.Lat));
 
-             return Lines;
 
-         }
 
-     }
 
- }
 
 
  |