| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- using CliWrap;
- using CliWrap.Buffered;
- using Ips.Library.Basic;
- using Ips.Library.CliLib;
- using Ips.Library.Entity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Ips.PosAlgorithm
- {
- public class PosEsUtil
- {
- static readonly string CliPath = PathUtil.GetAssemblyPath("ipscli", "poses", "poses.exe");
- public static async Task<ExeResult<PosResult>> X3(
- double dtotar1,
- double dtotar2,
- double[] msant1,
- double[] nsant1,
- double[] msant2,
- double[] nsant2,
- double[] mseph1,
- double[] nseph1,
- double[] mseph2,
- double[] nseph2,
- int timeout = 60,
- CancellationToken token = default
- )
- {
- const string cmd = "x3";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(dtotar1), dtotar1);
- args.IpsAdd(nameof(dtotar2), dtotar2);
- args.IpsAdd(nameof(msant1), msant1);
- args.IpsAdd(nameof(nsant1), nsant1);
- args.IpsAdd(nameof(msant2), msant2);
- args.IpsAdd(nameof(nsant2), nsant2);
- args.IpsAdd(nameof(mseph1), mseph1);
- args.IpsAdd(nameof(nseph1), nseph1);
- args.IpsAdd(nameof(mseph2), mseph2);
- args.IpsAdd(nameof(nseph2), nseph2);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = PosResult.FromString(PosType.X3, false, res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode, res.StandardError);
- }
- public static async Task<ExeResult<PosResult>> X3Ref(
- double dtotar1,
- double dtotar2,
- double dtoref1,
- double dtoref2,
- double[] refgeod1,
- double[] refgeod2,
- double[] msant1,
- double[] nsant1,
- double[] msant2,
- double[] nsant2,
- double[] mseph1,
- double[] nseph1,
- double[] mseph2,
- double[] nseph2,
- int timeout = 60,
- CancellationToken token = default
- )
- {
- const string cmd = "x3ref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(dtotar1), dtotar1);
- args.IpsAdd(nameof(dtotar2), dtotar2);
- args.IpsAdd(nameof(dtoref1), dtoref1);
- args.IpsAdd(nameof(dtoref2), dtoref2);
- args.IpsAdd(nameof(refgeod1), refgeod1);
- args.IpsAdd(nameof(refgeod2), refgeod2);
- args.IpsAdd(nameof(msant1), msant1);
- args.IpsAdd(nameof(nsant1), nsant1);
- args.IpsAdd(nameof(msant2), msant2);
- args.IpsAdd(nameof(nsant2), nsant2);
- args.IpsAdd(nameof(mseph1), mseph1);
- args.IpsAdd(nameof(nseph1), nseph1);
- args.IpsAdd(nameof(mseph2), mseph2);
- args.IpsAdd(nameof(nseph2), nseph2);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dwResult = PosResult.FromString(PosType.X3Ref, true, res.StandardOutput);
- return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode, res.StandardError);
- }
- public static Task<ExeResult<PosResult>> X4(
- double dtotar1,
- double dtotar2,
- double dtotar3,
- double[] nsant1,
- double[] nsant2,
- double[] nsant3,
- double[] nseph1,
- double[] nseph2,
- double[] nseph3,
- int timeout = 60,
- CancellationToken token = default
- )
- {
- var dt1 = dtotar2 - dtotar1;
- var dt2 = dtotar3 - dtotar1;
- return X3(dt1, dt2, nsant1, nsant2, nsant1, nsant3, nseph1, nseph2, nseph1, nseph3, timeout, token);
- }
- public static Task<ExeResult<PosResult>> X4Ref(
- double dtotar1,
- double dtotar2,
- double dtotar3,
- double dtoref1,
- double dtoref2,
- double dtoref3,
- double[] refgeod,
- double[] nsant1,
- double[] nsant2,
- double[] nsant3,
- double[] nseph1,
- double[] nseph2,
- double[] nseph3,
- int timeout = 60,
- CancellationToken token = default
- )
- {
- var dt1 = dtotar2 - dtotar1;
- var dt2 = dtotar3 - dtotar1;
- var refdt1 = dtoref2 - dtoref1;
- var refdt2 = dtoref3 - dtoref1;
- return X3Ref(dt1, dt2, refdt1, refdt2, refgeod, refgeod, nsant1, nsant2, nsant1, nsant3, nseph1, nseph2, nseph1, nseph3, timeout, token);
- }
- public static async Task<ExeResult<List<GeoLine>>> DtoLineSx(double dtotar, double[] recgeod, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtolinesx";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(dtotar), dtotar);
- args.IpsAdd(nameof(recgeod), recgeod);
- args.IpsAdd(nameof(mseph), mseph);
- args.IpsAdd(nameof(nseph), nseph);
- });
- 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>>> DtoLineSxRef(double dtotar, double dtoref, double[] refgeod, double[] mseph, double[] nseph, double[] msant, double[] nsaant, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtolinesxref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(dtotar), dtotar);
- args.IpsAdd(nameof(dtoref), dtoref);
- args.IpsAdd(nameof(refgeod), refgeod);
- args.IpsAdd(nameof(mseph), mseph);
- args.IpsAdd(nameof(nseph), nseph);
- });
- 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>>> DtoLineLoc(double[] pos, GeoXYZ recgeod, GeoXYZ mseph, GeoLLA nseph, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtolineloc";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(pos), pos);
- args.IpsAdd(nameof(recgeod), recgeod);
- args.IpsAdd(nameof(mseph), mseph);
- args.IpsAdd(nameof(nseph), nseph);
- });
- 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>>> DtoLineLocRef(double[] pos, double[] refgeod, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtolinelocref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(pos), pos);
- args.IpsAdd(nameof(refgeod), refgeod);
- args.IpsAdd(nameof(mseph), mseph);
- args.IpsAdd(nameof(nseph), nseph);
- });
- 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>>> DtoLineYiDi(double dtotar, double[] mseph, double[] nseph, double[] msant, double[] nsant, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "dtolineyidi";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(dtotar), dtotar);
- args.IpsAdd(nameof(mseph), mseph);
- args.IpsAdd(nameof(nseph), nseph);
- args.IpsAdd(nameof(msant), msant);
- args.IpsAdd(nameof(nsant), nsant);
- });
- 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<GdopResult>> Gdop(double[] recgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "gdop";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(recgeod), recgeod);
- args.IpsAdd(nameof(mseph1), mseph1);
- args.IpsAdd(nameof(nseph1), nseph1);
- args.IpsAdd(nameof(mseph2), mseph2);
- args.IpsAdd(nameof(nseph2), nseph2);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var result = new GdopResult(res.StandardOutput);
- return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<GdopResult>> GdopRef(double[] refgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "gdopref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(refgeod), refgeod);
- args.IpsAdd(nameof(mseph1), mseph1);
- args.IpsAdd(nameof(nseph1), nseph1);
- args.IpsAdd(nameof(mseph2), mseph2);
- args.IpsAdd(nameof(nseph2), nseph2);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var result = new GdopResult(res.StandardOutput);
- return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<LocErrResult>> LocErr(double[] pos, double[] recgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "locerr";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(pos), pos);
- args.IpsAdd(nameof(recgeod), recgeod);
- args.IpsAdd(nameof(mseph1), mseph1);
- args.IpsAdd(nameof(nseph1), nseph1);
- args.IpsAdd(nameof(mseph2), mseph2);
- args.IpsAdd(nameof(nseph2), nseph2);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var result = new LocErrResult(res.StandardOutput);
- return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<LocErrResult>> LocErrRef(double[] pos, double[] refgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "locerrref";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(pos), pos);
- args.IpsAdd(nameof(refgeod), refgeod);
- args.IpsAdd(nameof(mseph1), mseph1);
- args.IpsAdd(nameof(nseph1), nseph1);
- args.IpsAdd(nameof(mseph2), mseph2);
- args.IpsAdd(nameof(nseph2), nseph2);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var result = new LocErrResult(res.StandardOutput);
- return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- public static async Task<ExeResult<double>> RefCalc(DateTime[] intimes, double[] inmsephs, double[] innsephs, double[] indtorefs, double[] refgeod, double[] recgeod, DateTime time, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
- {
- const string cmd = "refcalc";
- var cli = Cli.Wrap(CliPath)
- .WithArguments(args =>
- {
- args.Add(cmd);
- args.IpsAdd(nameof(intimes), intimes);
- args.IpsAdd(nameof(inmsephs), inmsephs);
- args.IpsAdd(nameof(innsephs), innsephs);
- args.IpsAdd(nameof(indtorefs), indtorefs);
- args.IpsAdd(nameof(refgeod), refgeod);
- args.IpsAdd(nameof(recgeod), recgeod);
- args.IpsAdd(nameof(time), time);
- args.IpsAdd(nameof(mseph), mseph);
- args.IpsAdd(nameof(nseph), nseph);
- });
- var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
- var dtoRefOut = double.Parse(res.StandardOutput);
- return ExeResult.Create(dtoRefOut, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
- }
- }
- }
|