123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- using DPP_YH_Core.Extensions;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- using XdCxRhDW.Dto;
- namespace XdCxRhDW.Api
- {
- /// <summary>
- /// 误差椭圆帮助类
- /// </summary>
- public static class ErrEllipseHepler
- {
- private const string ErrellipDll = @"AddIns\GDOP误差椭圆\DLL_GDOP_Analysis0415";
- /// <summary>
- /// 两星一地误差椭圆
- /// </summary>
- /// <param name="main_eph">主星位置 长度6</param>
- /// <param name="neigh_eph">邻星位置 长度6</param>
- /// <param name="cdbAnt">超短波 长度3</param>
- /// <param name="refStation">参考站 长度3</param>
- /// <param name="Select_Point">定位点 长度3</param>
- /// <param name="dto_err">时差误差(s)</param>
- /// <param name="eph_err"></param>
- /// <param name="Pe">0.5</param>
- /// <param name="LOP_Len"></param>
- /// <returns></returns>
- [DllImport(ErrellipDll, EntryPoint = "Error_Ellipse_2X1D", CallingConvention = CallingConvention.Cdecl)]
- private extern static IntPtr Error_Ellipse_2X1D(double[] main_eph, double[] neigh_eph, double[] cdbAnt, double[] refStation, double[] Select_Point, double dto_err,
- double eph_err, double Pe, ref int LOP_Len);
- /// <summary>
- /// 两星一地误差椭圆
- /// </summary>
- /// <param name="main_eph">主星位置 长度6</param>
- /// <param name="neigh_eph">邻星位置 长度6</param>
- /// <param name="cdbAnt">超短波 长度3</param>
- /// <param name="refStation">参考站 长度3</param>
- /// <param name="Select_Point">定位点 长度3</param>
- /// <param name="dto_err">时差误差(s)</param>
- /// <param name="eph_err"></param>
- /// <param name="Pe">0.5</param>
- /// <param name="LOP_Len"></param>
- /// <returns></returns>
- [DllImport(ErrellipDll, EntryPoint = "Error_Ellipse_2X1D_NoRef", CallingConvention = CallingConvention.Cdecl)]
- private extern static IntPtr Error_Ellipse_2X1D_NoRef(double[] main_eph, double[] neigh_eph, double[] cdbAnt, double[] Select_Point, double dto_err,
- double eph_err, double Pe, ref int LOP_Len);
- /// <summary>
- /// 获取误差椭圆的长轴(m)、短轴(m)、倾角(°)
- /// </summary>
- /// <param name="posLon"></param>
- /// <param name="posLat"></param>
- /// <param name="mainEph"></param>
- /// <param name="adajEph"></param>
- /// <param name="cdbPos"></param>
- /// <param name="RefGeod"></param>
- /// <param name="DtoErrus"></param>
- /// <param name="EphErrm"></param>
- /// <param name="outputErrPoint"></param>
- /// <returns></returns>
- public static ErrEllipseResDto ErrorEllipse2X1D(double posLon, double posLat, double[] mainEph, double[] adajEph, double[] cdbPos, double[] RefGeod, double DtoErrus, double EphErrm, bool outputErrPoint)
- {
- //IEnumerable<double> res = new List<double>();
- int LOP_Len = 0;
- double Pe = 0.5;
- IntPtr LOP_ValuePtr = Error_Ellipse_2X1D(
- mainEph,
- adajEph,
- cdbPos,
- RefGeod,
- new double[3] { posLon, posLat, 0 },
- DtoErrus * 1e-6,
- EphErrm,//单位m
- Pe, ref LOP_Len);
- double[] LOP_Value = new double[LOP_Len];
- if (LOP_Len > 0)
- {
- Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
- }
- ErrEllipseResDto res = new ErrEllipseResDto();
- res.LongRadius = LOP_Value[LOP_Value.Length - 3];
- res.ShortRadius = LOP_Value[LOP_Value.Length - 2];
- res.DipAngle = LOP_Value[LOP_Value.Length - 1];
- if (outputErrPoint)
- {
- int count = LOP_Value.Length - 3;
- for (int i = 0; i < count; i += 2)//13 ---01 23 45 67 89
- {
- res.GeoPoints.Add(new GeoPoint()
- {
- Lon = LOP_Value[i],
- Lat = LOP_Value[i + 1],
- });
- }
- }
- return res;
- }
- /// <summary>
- /// 获取误差椭圆的长轴(m)、短轴(m)、倾角(°)
- /// </summary>
- /// <param name="posLon"></param>
- /// <param name="posLat"></param>
- /// <param name="mainEph"></param>
- /// <param name="adajEph"></param>
- /// <param name="cdbPos"></param>
- /// <param name="DtoErrus"></param>
- /// <param name="EphErrm"></param>
- /// <param name="outputErrPoint"></param>
- /// <returns></returns>
- public static ErrEllipseResDto ErrorEllipse2X1DNoRef(double posLon, double posLat, double[] mainEph, double[] adajEph, double[] cdbPos, double DtoErrus, double EphErrm, bool outputErrPoint)
- {
- //IEnumerable<double> res = new List<double>();
- int LOP_Len = 0;
- double Pe = 0.5;
- IntPtr LOP_ValuePtr = Error_Ellipse_2X1D_NoRef(
- mainEph,
- adajEph,
- cdbPos,
- new double[3] { posLon, posLat, 0 },
- DtoErrus * 1e-6,
- EphErrm,//单位m
- Pe, ref LOP_Len);
- double[] LOP_Value = new double[LOP_Len];
- if (LOP_Len > 0)
- {
- Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
- }
- ErrEllipseResDto res = new ErrEllipseResDto();
- res.LongRadius = LOP_Value[LOP_Value.Length - 3];
- res.ShortRadius = LOP_Value[LOP_Value.Length - 2];
- res.DipAngle = LOP_Value[LOP_Value.Length - 1];
- if (outputErrPoint)
- {
- int count = LOP_Value.Length - 3;
- for (int i = 0; i < count; i += 2)//13 ---01 23 45 67 89
- {
- res.GeoPoints.Add(new GeoPoint()
- {
- Lon = LOP_Value[i],
- Lat = LOP_Value[i + 1],
- });
- }
- }
- return res;
- }
- }
- }
|