123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- using CliWrap;
- using CliWrap.Buffered;
- using Ips.Library.Basic;
- using Ips.Library.Entity;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace Ips.Pto
- {
- public static class PtoLineUtils
- {
- static readonly string CliPath = PathUtil.GetAssemblyPath("ipscli", "pto", "pto.exe");
- public static async Task<ExeResult<List<GeoLine>>> Get(GeoLLA recGeod, GeoXYZ msEph, GeoXYZ nsEph, double dtoTar, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtoline noref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.Add("--recgeod").Add(recGeod.ToString());
- args.Add("--mseph").Add(msEph.ToString());
- args.Add("--nseph").Add(nsEph.ToString());
- args.Add("--dtotar").Add(dtoTar.ToString());
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = GeoLine.FromListString(res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<List<GeoLine>>> GetRef(GeoLLA refGeod, GeoXYZ msEph, GeoXYZ nsEph, double dtoTar, double dtoRef, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtoline ref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.Add("--refgeod").Add(refGeod.ToString());
- args.Add("--mseph").Add(msEph.ToString());
- args.Add("--nseph").Add(nsEph.ToString());
- args.Add("--dtotar").Add(dtoTar.ToString());
- args.Add("--dtoref").Add(dtoRef.ToString());
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = GeoLine.FromListString(res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<List<GeoLine>>> GetLoc(GeoLLA recGeod, GeoXYZ msEph, GeoXYZ nsEph, GeoLLA pos, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtoline loc";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.Add("--recgeod").Add(recGeod.ToString());
- args.Add("--mseph").Add(msEph.ToString());
- args.Add("--nseph").Add(nsEph.ToString());
- args.Add("--pos").Add(pos.ToString());
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = GeoLine.FromListString(res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<List<GeoLine>>> GetLocRef(GeoLLA refGeod, GeoXYZ msEph, GeoXYZ nsEph, GeoLLA pos, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtoline locref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.Add("--refgeod").Add(refGeod.ToString());
- args.Add("--mseph").Add(msEph.ToString());
- args.Add("--nseph").Add(nsEph.ToString());
- args.Add("--pos").Add(pos.ToString());
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = GeoLine.FromListString(res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<List<GeoLine>>> GetXdRef(GeoXYZ msEph, GeoLLA msAnt, GeoLLA nsAnt, double dtoTar, GeoLLA refGeod, double msDtoRef, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtoline xdref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.Add("--mseph").Add(msEph.ToString());
- args.Add("--msant").Add(msAnt.ToString());
- args.Add("--nsant").Add(nsAnt.ToString());
- args.Add("--dtotar").Add(dtoTar.ToString());
- args.Add("--refgeod").Add(refGeod.ToString());
- args.Add("--msdtoref").Add(msDtoRef.ToString());
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = GeoLine.FromListString(res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<List<GeoLine>>> GetYidi(GeoXYZ msEph, GeoXYZ nsEph, GeoLLA msAnt, GeoLLA nsAnt, double dtoTar, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtoline yidi";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.Add("--mseph").Add(msEph.ToString());
- args.Add("--nseph").Add(nsEph.ToString());
- args.Add("--msant").Add(msAnt.ToString());
- args.Add("--nsant").Add(nsAnt.ToString());
- args.Add("--dtotar").Add(dtoTar.ToString());
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = GeoLine.FromListString(res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- }
- }
|