wyq 1 year ago
parent
commit
2a5bf29fbc

+ 54 - 191
XdCxRhDW.Api/AddIns/GDOP误差椭圆/GDOP.h

@@ -12,26 +12,6 @@
 
 extern "C"
 {
-	///
-	/// 获取三星双时差GDOP  带参考
-	/// mainLines :主星历双行
-	/// adaj1Lines :邻星历双行 
-	/// adaj2Lines :邻星历双行 
-	/// captime:信号时间
-	/// refPos: 参考经度,纬度
-	/// dtousErr: 时差误差
-	/// ephLocErr: 星历位置误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int Gdop3SatRef(char* mainLines, char* adaj1Lines, char* adaj2Lines, long long captime, double* refPos
-		, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
 	///
 	/// 获取三星双时差GDOP  带参考
 	/// mainxyz :xyz vx vy vz
@@ -47,28 +27,12 @@ extern "C"
 	/// satllh :卫星位置
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop3SatRefByXyz(double* mainxyz, double* adaj1xyz, double* adaj2xyz, double* refPos
+	GDOP_EXPORT int Gdop3SatRefByXyz(double *mainxyz, double *adaj1xyz, double *adaj2xyz, double *refPos
 		, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-	///
-	/// 获取三星双时差GDOP  无参考
-	/// mainLines :主星历双行
-	/// adaj1Lines :邻星历双行 
-	/// adaj2Lines :邻星历双行 
-	/// captime:信号时间
-	/// dtousErr: 时差误差
-	/// ephLocErr: 星历位置误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int Gdop3SatNoRef(char* mainLines, char* adaj1Lines, char* adaj2Lines, long long captime
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int Gdop3SatRefByXyz_new(double *mainxyz, double *adaj1xyz, double *adaj2xyz, double *refPos
 		, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取三星双时差GDOP  无参考
@@ -84,32 +48,12 @@ extern "C"
 	/// satllh :卫星位置
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop3SatNoRefByXyz(double* mainxyz, double* adaj1xyz, double* adaj2xyz
+	GDOP_EXPORT int Gdop3SatNoRefByXyz(double *mainxyz, double *adaj1xyz, double *adaj2xyz
 		, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-	///
-	/// 获取双星GDOP
-	/// mainLines :主星历双行
-	/// adajLines :邻星历双行 
-	/// captime:信号时间
-	/// refPos: 参考经度,纬度
-	/// fuHz1: 主上行
-	/// fuHz2: 邻上行
-	/// dtousErr: 时差误差
-	/// dfoHzErr: 频差误差
-	/// ephLocErr: 星历位置误差
-	/// ephVLocErr: 星历速度误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int Gdop2SatDRef(char* mainLines, char* adajLines, long long captime, double* refPos
-		, double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int Gdop3SatNoRefByXyz_new(double *mainxyz, double *adaj1xyz, double *adaj2xyz
+		, double dtousErr, double ephLocErr
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取双星GDOP
@@ -129,32 +73,12 @@ extern "C"
 	/// satllh :卫星位置
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop2SatDRefByXyz(double* mainxyz, double* adajxyz, double* refPos
+	GDOP_EXPORT int Gdop2SatDRefByXyz(double *mainxyz, double *adajxyz, double *refPos
 		, double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-	///
-	/// 获取三星双频差GDOP
-	/// mainLines :主星历双行
-	/// adaj1Lines :邻星历双行 
-	/// adaj2Lines :邻星历双行 
-	/// captime:信号时间
-	/// refPos: 参考经度,纬度
-	/// fuHz1: 主上行
-	/// fuHz2: 邻上行
-	/// dfo_err: 频差误差
-	/// eph_pos_err: 星历位置误差
-	/// eph_vel_err: 星历速度误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int Gdop3SatDF(char* mainLines, char* adaj1Lines, char* adaj2Lines, long long captime, double* refPos
-		, double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int Gdop2SatDRefByXyz_new(double *mainxyz, double *adajxyz, double *refPos
+		, double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取三星双频差GDOP
@@ -174,29 +98,12 @@ extern "C"
 	/// satllh :卫星位置
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop3SatDFByXyz(double* mainxyz, double* adaj1xyz, double* adaj2xyz, double* refPos
+	GDOP_EXPORT int Gdop3SatDFByXyz(double *mainxyz, double *adaj1xyz, double *adaj2xyz, double *refPos
 		, double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-	///
-	/// 获取2X1D GDOP
-	/// mainLines :主星历双行
-	/// adajLines :邻星历双行 
-	/// captime:信号时间
-	/// cdbPos: 地面站经度,纬度
-	/// refPos: 参考经度,纬度
-	/// dtousErr: 时差误差
-	/// ephLocErr: 星历位置误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置  长度6
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int Gdop2Sat1DRef(char* mainLines, char* adajLines, long long captime, double* cdbPos
-		, double* refPos, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int Gdop3SatDFByXyz_new(double *mainxyz, double *adaj1xyz, double *adaj2xyz, double *refPos
+		, double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取2X1D GDOP
@@ -213,29 +120,12 @@ extern "C"
 	/// satllh :卫星位置  长度6
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop2Sat1DRefByXyz(double* mainxyz, double* adajxyz, double* cdbPos
-		, double* refPos, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-
-	///
-	/// 获取2X1D no ref GDOP
-	/// mainLines :主星历双行
-	/// adajLines :邻星历双行 
-	/// captime:信号时间
-	/// cdbPos: 地面站经度,纬度
-	/// dtousErr: 时差误差
-	/// ephLocErr: 星历位置误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置  长度6
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int Gdop2Sat1DNoRef(char* mainLines, char* adajLines, long long captime, double* cdbPos
-		, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+	GDOP_EXPORT int Gdop2Sat1DRefByXyz(double *mainxyz, double *adajxyz, double *cdbPos
+		, double *refPos, double dtousErr, double ephLocErr
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int Gdop2Sat1DRefByXyz_new(double *mainxyz, double *adajxyz, double *cdbPos
+		, double *refPos, double dtousErr, double ephLocErr
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取2X1D no ref GDOP
@@ -251,30 +141,12 @@ extern "C"
 	/// satllh :卫星位置  长度6
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop2Sat1DNoRefByXyz(double* mainxyz, double* adajxyz, double* cdbPos
+	GDOP_EXPORT int Gdop2Sat1DNoRefByXyz(double *mainxyz, double *adajxyz, double *cdbPos
 		, double dtousErr, double ephLocErr
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-	///
-	/// 获取XD_CX ref GDOP
-	/// mainLines :主星历双行
-	/// captime:信号时间
-	/// cdbPos: 地面站经度,纬度
-	/// cxPos: 侧向站经度,纬度
-	/// refPos: 参考经度,纬度
-	/// dto_err: 时差误差
-	/// doa_err: 侧向误差
-	/// eph_err: 星历位置误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置  长度6
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int GdopXDCXRef(char* mainLines, long long captime, double* cdbPos, double* cxPos, double* refPos
-		, double dto_err, double doa_err, double eph_err
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int Gdop2Sat1DNoRefByXyz_new(double *mainxyz, double *adajxyz, double *cdbPos
+		, double dtousErr, double ephLocErr
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取XD_CX ref GDOP
@@ -292,30 +164,12 @@ extern "C"
 	/// satllh :卫星位置  长度6
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int GdopXDCXRefByXyz(double* mainxyz, double* cdbPos, double* cxPos, double* refPos
+	GDOP_EXPORT int GdopXDCXRefByXyz(double *mainxyz, double *cdbPos, double *cxPos, double *refPos
 		, double dto_err, double doa_err, double eph_err
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
-
-	///
-	/// 获取XD_CX no ref GDOP
-	/// mainLines :主星历双行
-	/// captime:信号时间
-	/// cdbPos: 地面站经度,纬度
-	/// cxPos: 侧向站经度,纬度
-	/// refPos: 参考经度,纬度
-	/// dto_err: 时差误差
-	/// doa_err: 侧向误差
-	/// eph_err: 星历位置误差
-	/// level: gdop输出等级
-	/// levlen:level 长度
-	/// resCount:每一级的数据个数
-	/// res :数据
-	/// satllh :卫星位置  长度6
-	/// 返回值:0 成功
-	///
-	GDOP_EXPORT int GdopXDCXNoRef(char* mainLines, long long captime, double* cdbPos, double* cxPos
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int GdopXDCXRefByXyz_new(double *mainxyz, double *cdbPos, double *cxPos, double *refPos
 		, double dto_err, double doa_err, double eph_err
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取XD_CX no ref GDOP
@@ -333,9 +187,12 @@ extern "C"
 	/// satllh :卫星位置  长度6
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int GdopXDCXNoRefByXyz(double* mainxyz, double* cdbPos, double* cxPos
+	GDOP_EXPORT int GdopXDCXNoRefByXyz(double *mainxyz, double *cdbPos, double *cxPos
+		, double dto_err, double doa_err, double eph_err
+		, double *level, int levlen, int *resCount, double **res, double *satllh);
+	GDOP_EXPORT int GdopXDCXNoRefByXyz_new(double *mainxyz, double *cdbPos, double *cxPos
 		, double dto_err, double doa_err, double eph_err
-		, double* level, int levlen, int* resCount, double** res, double* satllh);
+		, double *level, int levlen, int *resCount, int **lpoints, double **res, double *satllh);
 
 	///
 	/// 获取XD_CX no ref GDOP
@@ -350,9 +207,12 @@ extern "C"
 	/// satllh :卫星位置  长度6
 	/// 返回值:0 成功
 	///
-	GDOP_EXPORT int Gdop2CX(double* cx1Pos, double* cx2Pos
+	GDOP_EXPORT int Gdop2CX(double *cx1Pos, double *cx2Pos
 		, double doa_err1, double doa_err2
-		, double* level, int levlen, int* resCount, double** res);
+		, double *level, int levlen, int *resCount, double **res);
+	GDOP_EXPORT int Gdop2CX_new(double *cx1Pos, double *cx2Pos
+		, double doa_err1, double doa_err2
+		, double *level, int levlen, int *resCount, int **lpoints, double **res);
 
 	//
 	// 计算理论频差
@@ -363,7 +223,7 @@ extern "C"
 	//fu  上行
 	//fd  下行
 	//
-	GDOP_EXPORT double theryDfo(double* tarpos, double* recpos, double* eph1, double* eph2, double fu, double fd);
+	GDOP_EXPORT double theryDfo(double *tarpos, double *recpos, double *eph1, double *eph2, double fu, double fd);
 
 	///
 	/// XD时差线
@@ -377,9 +237,10 @@ extern "C"
 	/// reslen 时差线个数
 	/// res 值
 	///
-	GDOP_EXPORT int SCX_XD(double* main_sat_pos, double* mbwx_rec_pos, double* ckwx_rec_pos, double* cdb_rec_pos,
-		double* ref_pos, double target_dto, double ref_dto, int* reslen, double** res);
-
+	GDOP_EXPORT int SCX_XD(double *main_sat_pos, double *mbwx_rec_pos, double *ckwx_rec_pos, double *cdb_rec_pos,
+		double *ref_pos, double target_dto, double ref_dto, int *reslen, double **res);
+	GDOP_EXPORT int SCX_XD_new(double *main_sat_pos, double *mbwx_rec_pos, double *ckwx_rec_pos, double *cdb_rec_pos,
+		double *ref_pos, double target_dto, double ref_dto, int *linecount, int **reslen, double **res);
 
 	///
 	/// XD时差线
@@ -393,11 +254,13 @@ extern "C"
 	/// reslen 时差线个数
 	/// res 值
 	///
-	GDOP_EXPORT int SCX_XD_NoRef(double* main_sat_pos, double* mbwx_rec_pos, double* cdb_rec_pos,
-		double target_dto, int* reslen, double** res);
+	GDOP_EXPORT int SCX_XD_NoRef(double *main_sat_pos, double *mbwx_rec_pos, double *cdb_rec_pos,
+		double target_dto, int *reslen, double **res);
+	GDOP_EXPORT int SCX_XD_NoRef_new(double *main_sat_pos, double *mbwx_rec_pos, double *cdb_rec_pos,
+		double target_dto, int *linecount, int **reslen, double **res);
 
 	///
 	/// 释放
 	///
-	GDOP_EXPORT void FreeGDOPBuf(double* val);
+	GDOP_EXPORT void FreeGDOPBuf(double *val);
 }

+ 80 - 173
XdCxRhDW.Api/AddIns/GDOP误差椭圆/GDOPAPi.cs

@@ -13,26 +13,7 @@ namespace XdCxRhDW.Api
 
         private const string ErrellipDll = @"AddIns\GDOP误差椭圆\DLL_GDOP_Analysis0415";
 
-        ///
-        /// 获取三星双时差GDOP  带参考
-        /// mainLines :主星历双行
-        /// adaj1Lines :邻星历双行 
-        /// adaj2Lines :邻星历双行 
-        /// captime:信号时间
-        /// refPos: 参考经度,纬度
-        /// dtousErr: 时差误差
-        /// ephLocErr: 星历位置误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop3SatRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop3SatRef(string mainLines, string adajLines, string adaj2Lines, Int64 captime, double[] refPos
-            , double dtousErr, double ephLocErr
-            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
+        
 
         ///
         /// 获取三星双时差GDOP  带参考
@@ -55,26 +36,11 @@ namespace XdCxRhDW.Api
             , double dtousErr, double ephLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
-        ///
-        /// 获取三星双时差GDOP  无参考
-        /// mainLines :主星历双行
-        /// adaj1Lines :邻星历双行 
-        /// adaj2Lines :邻星历双行 
-        /// captime:信号时间
-        /// dtousErr: 时差误差
-        /// ephLocErr: 星历位置误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop3SatNoRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop3SatNoRef(string mainLines, string adajLines, string adaj2Lines, Int64 captime
-            , double dtousErr, double ephLocErr
-            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
+        [DllImport(GDOPDll, EntryPoint = "Gdop3SatRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
 
+        public static extern int Gdop3SatRefByXyz_new(double[] mainxyz, double[] adaj1xyz, double[] adaj2xyz, double[] refPos
+           , double dtousErr, double ephLocErr
+           , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
 
         ///
         /// 获取三星双时差GDOP  无参考
@@ -96,30 +62,12 @@ namespace XdCxRhDW.Api
             , double dtousErr, double ephLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
-        ///
-        /// 获取双星GDOP
-        /// mainLines :主星历双行
-        /// adajLines :邻星历双行 
-        /// captime:信号时间
-        /// refPos: 参考经度,纬度
-        /// fuHz1: 主上行
-        /// fuHz2: 邻上行
-        /// dtousErr: 时差误差
-        /// dfoHzErr: 频差误差
-        /// ephLocErr: 星历位置误差
-        /// ephVLocErr: 星历速度误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop2SatDRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop2SatDRef(string mainLines, string adajLines, Int64 captime, double[] refPos
-            , double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
-           , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
+        [DllImport(GDOPDll, EntryPoint = "Gdop3SatNoRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+
+        public static extern int Gdop3SatNoRefByXyz_new(double[] mainxyz, double[] adaj1xyz, double[] adaj2xyz
+          , double dtousErr, double ephLocErr
+          , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
 
         ///
         /// 获取双星GDOP
@@ -144,30 +92,10 @@ namespace XdCxRhDW.Api
             , double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
-        ///
-        /// 获取三星双频差GDOP
-        /// mainLines :主星历双行
-        /// adaj1Lines :邻星历双行 
-        /// adaj2Lines :邻星历双行 
-        /// captime:信号时间
-        /// refPos: 参考经度,纬度
-        /// fuHz1: 主上行
-        /// fuHz2: 邻上行
-        /// dfo_err: 频差误差
-        /// eph_pos_err: 星历位置误差
-        /// eph_vel_err: 星历速度误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop3SatDF", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop3SatDF(string mainLines, string adajLines, string adaj2Lines, Int64 captime, double[] refPos
-            , double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
-            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
-
+        [DllImport(GDOPDll, EntryPoint = "Gdop2SatDRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int Gdop2SatDRefByXyz_new(double[] mainxyz, double[] adajxyz, double[] refPos
+            , double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
+            , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
 
         ///
         /// 获取三星双频差GDOP
@@ -192,28 +120,12 @@ namespace XdCxRhDW.Api
         public static extern int Gdop3SatDFByXyz(double[] mainxyz, double[] adaj1xyz, double[] adaj2xyz, double[] refPos
             , double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
-        /// <returns></returns>
-        ///
-        /// 获取2X1D GDOP
-        /// mainLines :主星历双行
-        /// adajLines :邻星历双行 
-        /// captime:信号时间
-        /// cdbPos: 地面站经度,纬度
-        /// refPos: 参考经度,纬度
-        /// dtousErr: 时差误差
-        /// ephLocErr: 星历位置误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置  长度6
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop2Sat1DRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop2Sat1DRef(string mainLines, string adajLines, Int64 captime, double[] cdbPos
-        , double[] refPos, double dtousErr, double ephLocErr
-        , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
+        [DllImport(GDOPDll, EntryPoint = "Gdop3SatDFByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+
+        public static extern int Gdop3SatDFByXyz_new(double[] mainxyz, double[] adaj1xyz, double[] adaj2xyz, double[] refPos
+          , double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
+          , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
 
         ///
         /// 获取2X1D GDOP
@@ -236,26 +148,10 @@ namespace XdCxRhDW.Api
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
 
-
-        ///
-        /// 获取2X1D no ref GDOP
-        /// mainLines :主星历双行
-        /// adajLines :邻星历双行 
-        /// captime:信号时间
-        /// cdbPos: 地面站经度,纬度
-        /// dtousErr: 时差误差
-        /// ephLocErr: 星历位置误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置  长度6
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop2Sat1DNoRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop2Sat1DNoRef(string mainLines, string adajLines, Int64 captime, double[] cdbPos,
-            double dtousErr, double ephLocErr
-        , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
+        [DllImport(GDOPDll, EntryPoint = "Gdop2Sat1DRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int Gdop2Sat1DRefByXyz_new(double[] mainxyz, double[] adajxyz, double[] cdbPos
+        , double[] refPos, double dtousErr, double ephLocErr
+        , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
 
 
         ///
@@ -277,27 +173,11 @@ namespace XdCxRhDW.Api
             , double dtousErr, double ephLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
-        ///
-        /// 获取XD_CX ref GDOP
-        /// mainLines :主星历双行
-        /// captime:信号时间
-        /// cdbPos: 地面站经度,纬度
-        /// cxPos: 侧向站经度,纬度
-        /// refPos: 参考经度,纬度
-        /// dto_err: 时差误差
-        /// doa_err: 侧向误差
-        /// eph_err: 星历位置误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置  长度6
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "GdopXDCXRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int GdopXDCXRef(string mainLines, Int64 captime, double[] cdbPos, double[] cxPos, double[] refPos
-            , double dtoErr, double doaErr, double ephLocErr
-            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
+        [DllImport(GDOPDll, EntryPoint = "Gdop2Sat1DNoRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int Gdop2Sat1DNoRefByXyz_new(double[] mainxyz, double[] adajxyz, double[] cdbPos
+        , double dtousErr, double ephLocErr
+        , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
+       
         ///
         /// 获取XD_CX ref GDOP
         /// mainxyz :xyz vx vy vz
@@ -320,10 +200,15 @@ namespace XdCxRhDW.Api
     , double dto_err, double doa_err, double eph_err
     , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
+        [DllImport(GDOPDll, EntryPoint = "GdopXDCXRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int GdopXDCXRefByXyz_new(double[] mainxyz, double[] cdbPos, double[] cxPos, double[] refPos
+        , double dto_err, double doa_err, double eph_err
+        , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[] satllh);
+
+
         ///
         /// 获取XD_CX no ref GDOP
-        /// mainLines :主星历双行
-        /// captime:信号时间
+        /// mainxyz :xyz vx vy vz
         /// cdbPos: 地面站经度,纬度
         /// cxPos: 侧向站经度,纬度
         /// refPos: 参考经度,纬度
@@ -337,9 +222,10 @@ namespace XdCxRhDW.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, EntryPoint = "GdopXDCXNoRef", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int GdopXDCXNoRef(string mainLines, Int64 captime, double[] cdbPos, double[] cxPos
-            , double dtousErr, double doaErr, double ephLocErr, double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
+        [DllImport(GDOPDll, EntryPoint = "GdopXDCXNoRefByXyz", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int GdopXDCXNoRefByXyz(double[] mainxyz, double[] cdbPos, double[] cxPos
+            , double dto_err, double doa_err, double eph_err
+            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
 
         ///
@@ -358,27 +244,12 @@ namespace XdCxRhDW.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, EntryPoint = "GdopXDCXNoRefByXyz", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int GdopXDCXNoRefByXyz(double[] mainxyz, double[] cdbPos, double[] cxPos
-            , double dto_err, double doa_err, double eph_err
-            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
+        [DllImport(GDOPDll, EntryPoint = "GdopXDCXNoRefByXyz_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int GdopXDCXNoRefByXyz_new(double[] mainxyz, double[] cdbPos, double[] cxPos
+           , double dto_err, double doa_err, double eph_err
+           , double[] level, int levlen, int[] resCount, out IntPtr lpoints, out IntPtr res, double[]satllh);
+
 
-        ///
-        /// 获取XD_CX no ref GDOP
-        /// cx1Pos: 侧向站经度,纬度
-        /// cx2Pos: 侧向站经度,纬度
-        /// doa_err1: 侧向1误差
-        /// doa_err2: 侧向2误差
-        /// level: gdop输出等级
-        /// levlen:level 长度
-        /// resCount:每一级的数据个数
-        /// res :数据
-        /// satllh :卫星位置  长度6
-        /// 返回值:0 成功
-        ///
-        [DllImport(GDOPDll, EntryPoint = "Gdop2CX", CallingConvention = CallingConvention.Cdecl)]
-        public static extern int Gdop2CX(double[] cx1Pos, double[] cx2Pos
-            , double doaErr1, double doaErr2, double[] level, int levlen, int[] resCount, out IntPtr res);
 
         ///
         /// XD时差线
@@ -397,6 +268,23 @@ namespace XdCxRhDW.Api
             double target_dto, double ref_dto,ref int resCount, out IntPtr res);
 
 
+        ///
+        /// XD时差线
+        /// main_sat_pos 卫星星历 xyz
+        /// mbwx_rec_pos 目标接收站位置 llh
+        /// ckwx_rec_pos 参考接收站位置 llh
+        /// cdb_rec_pos 地面接收站位置 llh
+        /// ref_pos 参考位置 llh
+        /// target_dto 目标时差 llh
+        /// ref_dto 参考时差 llh
+        /// linecount 线条数
+        /// reslen 线条数对应点数
+        /// res 总点数
+        ///
+        [DllImport(GDOPDll, EntryPoint = "SCX_XD_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int SCX_XD_new(double[] mainxyz, double[] mbrecPos, double[] ckrefPos, double[] cdbPos, double[] refPos,
+            double target_dto, double ref_dto,ref int linecount, out IntPtr reslen,out IntPtr res);
+
         ///
         /// XD时差线
         /// main_sat_pos 卫星星历 xyz
@@ -412,6 +300,25 @@ namespace XdCxRhDW.Api
             double target_dto,ref int resCount, out IntPtr res);
 
 
+        ///
+        /// XD时差线
+        /// main_sat_pos 卫星星历 xyz
+        /// mbwx_rec_pos 目标接收站位置 llh
+        /// cdb_rec_pos 地面接收站位置 llh
+        /// target_dto 目标时差 llh
+        /// ref_dto 参考时差 llh
+        /// reslen 时差线个数
+        /// res 值
+        ///
+        [DllImport(GDOPDll, EntryPoint = "SCX_XD_NoRef_new", CallingConvention = CallingConvention.Cdecl)]
+        public static extern int SCX_XD_NoRef_new(double[] mainxyz, double[] mbrecPos, double[] cdbPos,
+            double target_dto, ref int linecount, out IntPtr reslen, out IntPtr res);
+
+
+        //GDOP_EXPORT int SCX_XD_NoRef_new(double* main_sat_pos, double* mbwx_rec_pos, double* cdb_rec_pos,
+        //double target_dto, int* linecount, int** reslen, double** res);
+
+
         [DllImport(GDOPDll, EntryPoint = "FreeGDOPBuf", CallingConvention = CallingConvention.Cdecl)]
         public static extern void FreeGDOPBuf(IntPtr val);
 

BIN
XdCxRhDW.Api/AddIns/GDOP误差椭圆/GDOP_Draw_11.dll


+ 125 - 192
XdCxRhDW.Api/AddIns/GDOP误差椭圆/GdopHelper.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection.Emit;
 using System.Runtime.InteropServices;
 
 namespace XdCxRhDW.Api
@@ -11,36 +12,36 @@ namespace XdCxRhDW.Api
 
         static readonly DateTime dtZero = new DateTime(1970, 1, 1, 8, 0, 0, 0);
 
+
         /// <summary>
         /// 两星一地GDOP 无参时参考位置不赋值
         /// </summary>
-        /// <param name="mainLines">主星星历</param>
-        /// <param name="adajLines">邻星星历</param>
-        /// <param name="captime">信号时间</param>
+        /// <param name="mainEph">主星星历 x y z vx vy vz</param>
+        /// <param name="adajEph">邻星星历x y z vx vy vz</param>
         /// <param name="cdbPos">超短波位置 3</param>
         /// <param name="refPos">参考站位置 3</param>
         /// <param name="dtousErr">时差误差</param>
         /// <param name="ephLocErr">星历误差</param>
+        /// <param name="refPos"></param>
         /// <returns></returns>
-        public static (List<MapSatInfo>, List<ErrDistanceMapPoints>) Gdop2Sat1D(string mainLines, string adajLines, DateTime captime, double[] cdbPos, double dtousErr, double ephLocErr, double[] refPos = null)
+        public static List<ErrDistanceMapPoints> Gdop2Sat1DByXyz(double[] mainEph, double[] adajEph, double[] cdbPos, double dtousErr, double ephLocErr, double[] refPos = null)
         {
             int satCount = 2;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-            var timeSpan = (long)(captime - dtZero).TotalSeconds;
             IntPtr res = IntPtr.Zero;
             int[] resCount = new int[level.Length];
             if (refPos == null || refPos.Length == 0)
             {
-                GDOPApi.Gdop2Sat1DNoRef(mainLines, adajLines, timeSpan, cdbPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop2Sat1DNoRefByXyz(mainEph, adajEph, cdbPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
 
             }
             else
             {
 
-                GDOPApi.Gdop2Sat1DRef(mainLines, adajLines, timeSpan, cdbPos, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop2Sat1DRefByXyz(mainEph, adajEph, cdbPos, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
 
             }
 
@@ -57,7 +58,6 @@ namespace XdCxRhDW.Api
                 points.Add(levelval);
             }
             GDOPApi.FreeGDOPBuf(res);
-            List<MapSatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines);
             List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
             for (int i = 0; i < points.Count; i++)
             {
@@ -67,9 +67,10 @@ namespace XdCxRhDW.Api
                 errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
                 errs.Add(errDistanceMap);
             }
-            return (satInfos, errs);
+            return errs;
         }
 
+
         /// <summary>
         /// 两星一地GDOP 无参时参考位置不赋值
         /// </summary>
@@ -81,7 +82,7 @@ namespace XdCxRhDW.Api
         /// <param name="ephLocErr">星历误差</param>
         /// <param name="refPos"></param>
         /// <returns></returns>
-        public static  List<ErrDistanceMapPoints> Gdop2Sat1DByXyz(double[] mainEph, double[] adajEph, double[] cdbPos, double dtousErr, double ephLocErr, double[] refPos = null)
+        public static List<ErrDistanceMapPoints> Gdop2Sat1DByXyzNew(double[] mainEph, double[] adajEph, double[] cdbPos, double dtousErr, double ephLocErr, double[] refPos = null)
         {
             int satCount = 2;
             //该值和points 一一对应
@@ -89,43 +90,67 @@ namespace XdCxRhDW.Api
             double[] satllh = new double[satCount * 3];
 
             IntPtr res = IntPtr.Zero;
+            IntPtr lpoints = IntPtr.Zero;
             int[] resCount = new int[level.Length];
             if (refPos == null || refPos.Length == 0)
             {
-                GDOPApi.Gdop2Sat1DNoRefByXyz(mainEph, adajEph, cdbPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop2Sat1DNoRefByXyz_new(mainEph, adajEph, cdbPos, dtousErr, ephLocErr, level, level.Length, resCount, out lpoints, out res, satllh);
 
             }
             else
             {
 
-                GDOPApi.Gdop2Sat1DRefByXyz(mainEph, adajEph, cdbPos, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop2Sat1DRefByXyz_new(mainEph, adajEph, cdbPos, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out lpoints, out res, satllh);
 
             }
 
+           var errs= ToErrDistanceMapPoints(level,resCount,lpoints,res);
+            GDOPApi.FreeGDOPBuf(res);
+            GDOPApi.FreeGDOPBuf(lpoints);
+            return errs;
+        }
+        private static List<ErrDistanceMapPoints> ToErrDistanceMapPoints(double[] level,int[] resCount, IntPtr lpoints, IntPtr res)
+        {
+            int total = resCount.Sum(r => r);
+            int[] Points_Value = new int[total];
+            Marshal.Copy(lpoints, Points_Value, 0, Points_Value.Length);
 
-            IntPtr tmp = res;
+            int totalPoint = Points_Value.Sum(p => p);
+            double[] LOP_Value = new double[totalPoint * 2];
+            Marshal.Copy(res, LOP_Value, 0, LOP_Value.Length);
 
+            var points = ParseResult(LOP_Value);
             //用于绘制的数据
-            List<double[]> points = new List<double[]>();
-            for (int idx = 0; idx < level.Length; ++idx)
-            {
-                double[] levelval = new double[resCount[idx]];
-                Marshal.Copy(tmp, levelval, 0, resCount[idx]);
-                tmp += (resCount[idx] * sizeof(double));
-                points.Add(levelval);
-            }
-            GDOPApi.FreeGDOPBuf(res);
+
             List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
-            for (int i = 0; i < points.Count; i++)
+
+            int skippointcount = 0;
+            int skipcount = 0;
+            int count = 0;
+            for (int idx = 0; idx < level.Length; ++idx)
             {
-                if (!points[i].Any()) continue;
-                ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
-                errDistanceMap.ErrDistance = level[i];
-                errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
-                errs.Add(errDistanceMap);
+                int levelcount = resCount[idx];
+                skipcount = idx == 0 ? 0 : skipcount + resCount[idx - 1];
+                for (int i = skipcount; i < levelcount + skipcount; i++)
+                {
+                    int pointcount = Points_Value[i];
+                    skippointcount = count == 0 ? 0 : skippointcount + Points_Value[i - 1];
+                    var mapDots = points.Skip(skippointcount).Take(pointcount);
+                    if (!mapDots.Any()) continue;
+                    ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
+                    errDistanceMap.ErrDistance = level[idx];
+                    errDistanceMap.MapDots.AddRange(mapDots);
+                    errs.Add(errDistanceMap);
+                    count++;
+                }
+
             }
-            return  errs;
+
+            return errs;
         }
+
+
+
         /// <summary>
         /// 一星一地GDOP 
         /// </summary>
@@ -138,23 +163,23 @@ namespace XdCxRhDW.Api
         /// <param name="ephLocErr">星历误差</param>
         /// <param name="refPos">参考站位置 3</param>
         /// <returns></returns>
-        public static (List<MapSatInfo>, List<ErrDistanceMapPoints>) Gdop1Sat1D(string mainLines, DateTime captime, double[] cdbPos, double[] cxPos, double dtousErr, double doaErr, double ephLocErr, double[] refPos = null)
+        public static List<ErrDistanceMapPoints> Gdop1Sat1DByXyz(double[] mainEph, double[] cdbPos, double[] cxPos, double dtousErr, double doaErr, double ephLocErr, double[] refPos = null)
         {
             int satCount = 1;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-            var timeSpan = (long)(captime - dtZero).TotalSeconds;
+
             IntPtr res = IntPtr.Zero;
             int[] resCount = new int[level.Length];
             if (refPos == null || refPos.Length == 0)
             {
-                GDOPApi.GdopXDCXNoRef(mainLines, timeSpan, cdbPos, cxPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.GdopXDCXNoRefByXyz(mainEph, cdbPos, cxPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
             }
             else
             {
-                GDOPApi.GdopXDCXRef(mainLines, timeSpan, cdbPos, cxPos, refPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.GdopXDCXRefByXyz(mainEph, cdbPos, cxPos, refPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
             }
             IntPtr tmp = res;
 
@@ -168,7 +193,6 @@ namespace XdCxRhDW.Api
                 points.Add(levelval);
             }
             GDOPApi.FreeGDOPBuf(res);
-            List<MapSatInfo> satInfos = ParseResult(satCount, satllh, mainLines);
             List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
             for (int i = 0; i < points.Count; i++)
             {
@@ -178,10 +202,10 @@ namespace XdCxRhDW.Api
                 errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
                 errs.Add(errDistanceMap);
             }
-            return (satInfos, errs);
+            return errs;
         }
 
-        public static  List<ErrDistanceMapPoints> Gdop1Sat1DByXyz(double[] mainEph, double[] cdbPos, double[] cxPos, double dtousErr, double doaErr, double ephLocErr, double[] refPos = null)
+        public static List<ErrDistanceMapPoints> Gdop1Sat1DByXyzNew(double[] mainEph, double[] cdbPos, double[] cxPos, double dtousErr, double doaErr, double ephLocErr, double[] refPos = null)
         {
             int satCount = 1;
             //该值和points 一一对应
@@ -190,58 +214,41 @@ namespace XdCxRhDW.Api
 
 
             IntPtr res = IntPtr.Zero;
+            IntPtr lpoints = IntPtr.Zero;
             int[] resCount = new int[level.Length];
             if (refPos == null || refPos.Length == 0)
             {
-                GDOPApi.GdopXDCXNoRefByXyz(mainEph, cdbPos, cxPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.GdopXDCXNoRefByXyz_new(mainEph, cdbPos, cxPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount,out lpoints, out res, satllh);
             }
             else
             {
-                GDOPApi.GdopXDCXRefByXyz(mainEph, cdbPos, cxPos, refPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount, out res, satllh);
-            }
-            IntPtr tmp = res;
-
-            //用于绘制的数据
-            List<double[]> points = new List<double[]>();
-            for (int idx = 0; idx < level.Length; ++idx)
-            {
-                double[] levelval = new double[resCount[idx]];
-                Marshal.Copy(tmp, levelval, 0, resCount[idx]);
-                tmp += (resCount[idx] * sizeof(double));
-                points.Add(levelval);
+                GDOPApi.GdopXDCXRefByXyz_new(mainEph, cdbPos, cxPos, refPos, dtousErr, doaErr, ephLocErr, level, level.Length, resCount,out lpoints, out res, satllh);
             }
+            var errs = ToErrDistanceMapPoints(level, resCount, lpoints, res);
             GDOPApi.FreeGDOPBuf(res);
-            List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
-            for (int i = 0; i < points.Count; i++)
-            {
-                if (!points[i].Any()) continue;
-                ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
-                errDistanceMap.ErrDistance = level[i];
-                errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
-                errs.Add(errDistanceMap);
-            }
-            return  errs;
+            GDOPApi.FreeGDOPBuf(lpoints);
+            return errs;
         }
 
-        public static (List<MapSatInfo>, List<ErrDistanceMapPoints>) Gdop3Sat(string mainLines, string adajLines, string adajLines2,
-            DateTime captime, double dtousErr, double ephLocErr, double[] refPos = null)
+        public static List<ErrDistanceMapPoints> Gdop3SatByXyz(double[] mainEph, double[] adaj1Eph, double[] adaj2Eph,
+         double dtousErr, double ephLocErr, double[] refPos = null)
         {
             int satCount = 3;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-            var timeSpan = (long)(captime - dtZero).TotalSeconds;
+
             IntPtr res = IntPtr.Zero;
             int[] resCount = new int[level.Length];
             if (refPos == null || refPos.Length == 0)
             {
-                GDOPApi.Gdop3SatNoRef(mainLines, adajLines, adajLines2, timeSpan, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop3SatNoRefByXyz(mainEph, adaj1Eph, adaj2Eph, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
 
             }
             else
             {
-                GDOPApi.Gdop3SatRef(mainLines, adajLines, adajLines2, timeSpan, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop3SatRefByXyz(mainEph, adaj1Eph, adaj2Eph, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
 
             }
 
@@ -258,7 +265,6 @@ namespace XdCxRhDW.Api
                 points.Add(levelval);
             }
             GDOPApi.FreeGDOPBuf(res);
-            List<MapSatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines, adajLines2);
             List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
             for (int i = 0; i < points.Count; i++)
             {
@@ -268,66 +274,52 @@ namespace XdCxRhDW.Api
                 errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
                 errs.Add(errDistanceMap);
             }
-            return (satInfos, errs);
+            return errs;
         }
-        public static List<ErrDistanceMapPoints> Gdop3SatByXyz(double[] mainEph, double[] adaj1Eph, double[] adaj2Eph,
-         double dtousErr, double ephLocErr, double[] refPos = null)
+
+
+        public static List<ErrDistanceMapPoints> Gdop3SatByXyzNew(double[] mainEph, double[] adaj1Eph, double[] adaj2Eph,
+       double dtousErr, double ephLocErr, double[] refPos = null)
         {
             int satCount = 3;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-          
+
             IntPtr res = IntPtr.Zero;
+
+            IntPtr lpoints = IntPtr.Zero;
             int[] resCount = new int[level.Length];
             if (refPos == null || refPos.Length == 0)
             {
-                GDOPApi.Gdop3SatNoRefByXyz(mainEph, adaj1Eph, adaj2Eph, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop3SatNoRefByXyz_new(mainEph, adaj1Eph, adaj2Eph, dtousErr, ephLocErr, level, level.Length, resCount,out lpoints, out res, satllh);
 
             }
             else
             {
-                GDOPApi.Gdop3SatRefByXyz(mainEph, adaj1Eph, adaj2Eph, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out res, satllh);
+                GDOPApi.Gdop3SatRefByXyz_new(mainEph, adaj1Eph, adaj2Eph, refPos, dtousErr, ephLocErr, level, level.Length, resCount, out lpoints, out res, satllh);
 
             }
-
-
-            IntPtr tmp = res;
-
-            //用于绘制的数据
-            List<double[]> points = new List<double[]>();
-            for (int idx = 0; idx < level.Length; ++idx)
-            {
-                double[] levelval = new double[resCount[idx]];
-                Marshal.Copy(tmp, levelval, 0, resCount[idx]);
-                tmp += (resCount[idx] * sizeof(double));
-                points.Add(levelval);
-            }
+            var errs = ToErrDistanceMapPoints(level, resCount, lpoints, res);
             GDOPApi.FreeGDOPBuf(res);
-            List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
-            for (int i = 0; i < points.Count; i++)
-            {
-                if (!points[i].Any()) continue;
-                ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
-                errDistanceMap.ErrDistance = level[i];
-                errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
-                errs.Add(errDistanceMap);
-            }
-            return  errs;
+            GDOPApi.FreeGDOPBuf(lpoints);
+            return errs;
         }
-        public static (List<MapSatInfo>, List<ErrDistanceMapPoints>) Gdop3SatDF(string mainLines, string adajLines, string adajLines2,
-          DateTime captime, double fuHz1, double fuHz2, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
+
+
+        public static List<ErrDistanceMapPoints> Gdop3SatDFByXyz(double[] mainEph, double[] adaj1Eph, double[] adaj2Eph,
+          double fuHz1, double fuHz2, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
         {
             int satCount = 3;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-            var timeSpan = (long)(captime - dtZero).TotalSeconds;
+
             IntPtr res = IntPtr.Zero;
             int[] resCount = new int[level.Length];
-            GDOPApi.Gdop3SatDF(mainLines, adajLines, adajLines2, timeSpan, refPos, fuHz1, fuHz2, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out res, satllh);
+            GDOPApi.Gdop3SatDFByXyz(mainEph, adaj1Eph, adaj2Eph, refPos, fuHz1, fuHz2, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out res, satllh);
 
             IntPtr tmp = res;
 
@@ -341,7 +333,6 @@ namespace XdCxRhDW.Api
                 points.Add(levelval);
             }
             GDOPApi.FreeGDOPBuf(res);
-            List<MapSatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines, adajLines2);
             List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
             for (int i = 0; i < points.Count; i++)
             {
@@ -351,21 +342,20 @@ namespace XdCxRhDW.Api
                 errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
                 errs.Add(errDistanceMap);
             }
-            return (satInfos, errs);
+            return errs;
         }
 
-        public static List<ErrDistanceMapPoints> Gdop3SatDFByXyz(double[] mainEph, double[] adaj1Eph, double[] adaj2Eph,
-          double fuHz1, double fuHz2, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
+        public static List<ErrDistanceMapPoints> Gdop2SatDRefByXyz(double[] mainEph, double[] adajEph, double fuHz1, double fuHz2, double dtousErr, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
         {
-            int satCount = 3;
+            int satCount = 2;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-           
+
             IntPtr res = IntPtr.Zero;
             int[] resCount = new int[level.Length];
-            GDOPApi.Gdop3SatDFByXyz(mainEph, adaj1Eph, adaj2Eph, refPos, fuHz1, fuHz2, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out res, satllh);
+            GDOPApi.Gdop2SatDRefByXyz(mainEph, adajEph, refPos, fuHz1, fuHz2, dtousErr, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out res, satllh);
 
             IntPtr tmp = res;
 
@@ -388,48 +378,44 @@ namespace XdCxRhDW.Api
                 errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
                 errs.Add(errDistanceMap);
             }
-            return  errs;
+            return errs;
+        }
+        private static List<(double lon, double lat)> ParseResult(double[] ponits)
+        {
+            List<(double lon,double lat)> mapDots = new List<(double lon, double lat)>();
+            int count = 2;
+            for (int i = 0; i < ponits.Length / count; i++)
+            {
+                var Lon = ponits[count * i];
+                var Lat = ponits[count * i + 1];//0 1  2  3  4 5 6 7
+                mapDots.Add((Lon, Lat));
+            }
+            return mapDots;
+
         }
 
-        public static (List<MapSatInfo>, List<ErrDistanceMapPoints>) Gdop2SatDRef(string mainLines, string adajLines,
-      DateTime captime, double fuHz1, double fuHz2, double dtousErr, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
+
+        public static List<ErrDistanceMapPoints> Gdop3SatDFByXyzNew(double[] mainEph, double[] adaj1Eph, double[] adaj2Eph,
+    double fuHz1, double fuHz2, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
         {
-            int satCount = 2;
+            int satCount = 3;
             //该值和points 一一对应
             double[] level = GdopParam.误差配置.误差距离m;
             double[] satllh = new double[satCount * 3];
 
-            var timeSpan = (long)(captime - dtZero).TotalSeconds;
+
             IntPtr res = IntPtr.Zero;
+            IntPtr lpoints = IntPtr.Zero;
             int[] resCount = new int[level.Length];
-            GDOPApi.Gdop2SatDRef(mainLines, adajLines, timeSpan, refPos, fuHz1, fuHz2, dtousErr, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out res, satllh);
-
-            IntPtr tmp = res;
+            GDOPApi.Gdop3SatDFByXyz_new(mainEph, adaj1Eph, adaj2Eph, refPos, fuHz1, fuHz2, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount,out lpoints, out res, satllh);
 
-            //用于绘制的数据
-            List<double[]> points = new List<double[]>();
-            for (int idx = 0; idx < level.Length; ++idx)
-            {
-                double[] levelval = new double[resCount[idx]];
-                Marshal.Copy(tmp, levelval, 0, resCount[idx]);
-                tmp += (resCount[idx] * sizeof(double));
-                points.Add(levelval);
-            }
+            var errs = ToErrDistanceMapPoints(level, resCount, lpoints, res);
             GDOPApi.FreeGDOPBuf(res);
-            List<MapSatInfo> satInfos = ParseResult(satCount, satllh, mainLines, adajLines);
-            List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
-            for (int i = 0; i < points.Count; i++)
-            {
-                if (!points[i].Any()) continue;
-                ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
-                errDistanceMap.ErrDistance = level[i];
-                errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
-                errs.Add(errDistanceMap);
-            }
-            return (satInfos, errs);
+            GDOPApi.FreeGDOPBuf(lpoints);
+            return errs;
         }
 
-        public static List<ErrDistanceMapPoints> Gdop2SatDRefByXyz(double[] mainEph, double[] adajEph, double fuHz1, double fuHz2, double dtousErr, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
+        public static List<ErrDistanceMapPoints> Gdop2SatDRefByXyzNew(double[] mainEph, double[] adajEph, double fuHz1, double fuHz2, double dtousErr, double dfoErr, double ephLocErr, double ephVErr, double[] refPos)
         {
             int satCount = 2;
             //该值和points 一一对应
@@ -438,68 +424,15 @@ namespace XdCxRhDW.Api
 
 
             IntPtr res = IntPtr.Zero;
+            IntPtr lpoints = IntPtr.Zero;
             int[] resCount = new int[level.Length];
-            GDOPApi.Gdop2SatDRefByXyz(mainEph, adajEph, refPos, fuHz1, fuHz2, dtousErr, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out res, satllh);
-
-            IntPtr tmp = res;
-
-            //用于绘制的数据
-            List<double[]> points = new List<double[]>();
-            for (int idx = 0; idx < level.Length; ++idx)
-            {
-                double[] levelval = new double[resCount[idx]];
-                Marshal.Copy(tmp, levelval, 0, resCount[idx]);
-                tmp += (resCount[idx] * sizeof(double));
-                points.Add(levelval);
-            }
+            GDOPApi.Gdop2SatDRefByXyz_new(mainEph, adajEph, refPos, fuHz1, fuHz2, dtousErr, dfoErr, ephLocErr, ephVErr, level, level.Length, resCount, out lpoints, out res, satllh);
+            var errs = ToErrDistanceMapPoints(level, resCount, lpoints, res);
             GDOPApi.FreeGDOPBuf(res);
-            List<ErrDistanceMapPoints> errs = new List<ErrDistanceMapPoints>();
-            for (int i = 0; i < points.Count; i++)
-            {
-                if (!points[i].Any()) continue;
-                ErrDistanceMapPoints errDistanceMap = new ErrDistanceMapPoints();
-                errDistanceMap.ErrDistance = level[i];
-                errDistanceMap.MapDots.AddRange(ParseResult(points[i]));
-                errs.Add(errDistanceMap);
-            }
-            return  errs;
-        }
-        private static List<MapDot> ParseResult(double[] ponits)
-        {
-            List<MapDot> mapDots = new List<MapDot>();
-            int count = 2;
-            for (int i = 0; i < ponits.Length / count; i++)
-            {
-                MapDot mapDot = new MapDot();
-                mapDot.Lon = ponits[count * i];
-                mapDot.Lat = ponits[count * i + 1];//0 1  2  3  4 5 6 7
-                mapDots.Add(mapDot);
-            }
-            return mapDots;
-
+            GDOPApi.FreeGDOPBuf(lpoints);
+            return errs;
         }
 
-       
-        private static List<MapSatInfo> ParseResult(int satCount, double[] satllh, params string[] ephLine)
-        {
-
-            List<MapSatInfo> list = new List<MapSatInfo>();
-            int len = 3;
-            for (int i = 0; i < satCount; i++)
-            {
-                MapSatInfo satInfo = new MapSatInfo();
-                var ephstrs = ephLine[i].Split(new string[] { " ", "U" }, StringSplitOptions.RemoveEmptyEntries);
-                if (ephstrs.Length == 16)
-                {
-                    satInfo.SatCode = Convert.ToInt32(ephstrs[1]);
-                }
-                satInfo.SatLon = Convert.ToDouble(satllh[len * i]);
-                satInfo.SatLat = Convert.ToDouble(satllh[len * i + 1]);
-                list.Add(satInfo);
-            }
-
-            return list;
-        }
     }
 
 }

+ 3 - 3
XdCxRhDW.Api/AddIns/GDOP误差椭圆/MapItem.cs

@@ -27,13 +27,13 @@ namespace XdCxRhDW.Api
         public double Alt { get; set; }
     }
 
-    
-    
+
+
     public class ErrDistanceMapPoints
     {
         public double ErrDistance { get; set; }//单位m
         public string ErrDistanceKm => $"{ErrDistance / 1e3}km";
-        public List<MapDot> MapDots { get; set; } = new List<MapDot>();
+        public List<(double lon, double lat)> MapDots { get; set; } = new List<(double lon, double lat)>();
     }
     public class MapSatInfo
     {

+ 81 - 30
XdCxRhDW.Api/AddIns/时差线/DrawDtoLineHelper.cs

@@ -14,15 +14,6 @@ namespace XdCxRhDW.Api
     {
         private const string XdtsDll = @"AddIns\时差线\Positioning.dll";
 
-        //三星双时差带参、三星双时差无参、三星双频差带参、双星时频差带参、两星一地无参定位及时差线
-        private const string xddtodll = @"AddIns\时差线\Position-New.dll";
-
-        [DllImport(xddtodll, EntryPoint = "XingDi_SCX_NoRef", CallingConvention = CallingConvention.Cdecl)]//高轨双星有参时差线
-        public extern static void XingDi_SCX_NoRef(double[] main_sat_pos, double[] mbwx_rec_pos, double[] cdb_rec_pos,
-           double[] Zone, double target_dto, out IntPtr LOP_Value, ref int LOP_Len);
-
-
-
         [DllImport(XdtsDll, EntryPoint = "CurveByTwoTDOA", CallingConvention = CallingConvention.Cdecl)]//高轨双星有参时差线
         public extern static void CurveByTwoTDOA(double[] main_sat_pos, double[] neigh_sat_pos, double[] rec1_pos, double[] rec2_pos, double[] ref_pos, double[] Zone,
       double target_dto, double ref_dto, out IntPtr LOP_Value, ref int LOP_Len);
@@ -114,56 +105,71 @@ namespace XdCxRhDW.Api
         }
 
         /// <summary>
-        /// 星地参时差线
+        /// 星地参时差线
         /// </summary>
         /// <param name="opt"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public static IEnumerable<(double lon, double lat)> DtoLineXdNoRef(DtoLineXdOption opt)
+        public static IEnumerable<(double lon, double lat)> DtoLineXdEx(DtoLineXdOption opt)
         {
-
             List<DtoLinePoint> list = new List<DtoLinePoint>();
 
             IntPtr LOP_ValuePtr;
             int LOP_Len = 0;
 
-            XingDi_SCX_NoRef(opt.MsEph, opt.MsAnt, opt.CDBAnt,
-            new double[] { -85, 85, -180, 180 }, opt.xdDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
-            double[] LOP_Value = new double[LOP_Len * 3];
+            GDOPApi.SCX_XD(opt.MsEph, opt.MsAnt, opt.MsAnt, opt.CDBAnt, opt.RefGeod, opt.xdDto * 1e-6, opt.RefDto * 1e-6, ref LOP_Len, out LOP_ValuePtr);
+            double[] LOP_Value = new double[LOP_Len];
             if (LOP_Len > 0)
             {
                 Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
-
-                list = OutputHelper.WriteDtoLine(LOP_Value, LOP_Len);
             }
-            var Lines = list.Select(p => (p.Lon, p.Lat));
-            return Lines;
+            GDOPApi.FreeGDOPBuf(LOP_ValuePtr);
+            var points = ParseResult(LOP_Value);
+            var mapDots = points.Select(p => p).Select(p => (p.Lon, p.Lat));
+            return mapDots;
         }
 
-
         /// <summary>
         /// 星地有参时差线
         /// </summary>
         /// <param name="opt"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public static IEnumerable<(double lon, double lat)> DtoLineXdEx(DtoLineXdOption opt)
+        public static IEnumerable<DtoLine> DtoLineXdNew(DtoLineXdOption opt)
         {
-            List<DtoLinePoint> list = new List<DtoLinePoint>();
+            List<DtoLine> list = new List<DtoLine>();
 
             IntPtr LOP_ValuePtr;
-            int LOP_Len = 0;
+            IntPtr ResLen;
+            int LineCount = 0;
 
-            GDOPApi.SCX_XD(opt.MsEph, opt.MsAnt, opt.MsAnt, opt.CDBAnt, opt.RefGeod, opt.xdDto * 1e-6, opt.RefDto * 1e-6, ref LOP_Len, out LOP_ValuePtr);
-            double[] LOP_Value = new double[LOP_Len];
-            if (LOP_Len > 0)
+            GDOPApi.SCX_XD_new(opt.MsEph, opt.MsAnt, opt.MsAnt, opt.CDBAnt, opt.RefGeod, opt.xdDto * 1e-6, opt.RefDto * 1e-6, ref LineCount, out ResLen, out LOP_ValuePtr);
+            int[] res_Len = new int[LineCount];
+            if (LineCount > 0)
             {
+                Marshal.Copy(ResLen, res_Len, 0, res_Len.Length);
+                int total = res_Len.Sum(r => r);
+                double[] LOP_Value = new double[total * 2];
                 Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
+
+                var points = ParseResult(LOP_Value);
+
+                int skipcount = 0;
+                for (int i = 0; i < LineCount; i++)
+                {
+                    int pointcount = res_Len[i];
+                    skipcount = i == 0 ? 0 : skipcount + res_Len[i-1];
+                    var mapDots=  points.Skip(skipcount).Take(pointcount);
+                    DtoLine dtoLine = new DtoLine();
+                    dtoLine.dtoLinePoints = mapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    list.Add(dtoLine);
+                }
+
             }
+            GDOPApi.FreeGDOPBuf(ResLen);
             GDOPApi.FreeGDOPBuf(LOP_ValuePtr);
-            var points = ParseResult(LOP_Value);
-            var mapDots = points.Select(p => p).Select(p => (p.Lon, p.Lat));
-            return mapDots;
+
+            return list;
         }
         private static List<MapDot> ParseResult(double[] ponits)
         {
@@ -207,6 +213,51 @@ namespace XdCxRhDW.Api
             return mapDots;
         }
 
+        /// <summary>
+        /// 星地无参时差线
+        /// </summary>
+        /// <param name="opt"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public static IEnumerable<DtoLine> DtoLineXdNoRefNew(DtoLineXdOption opt)
+        {
+
+            List<DtoLine> list = new List<DtoLine>();
+
+            IntPtr LOP_ValuePtr;
+            IntPtr ResLen;
+            int LineCount = 0;
+
+            GDOPApi.SCX_XD_NoRef_new(opt.MsEph, opt.MsAnt, opt.CDBAnt, opt.xdDto * 1e-6, ref LineCount, out ResLen, out LOP_ValuePtr);
+
+            int[] res_Len = new int[LineCount];
+            if (LineCount > 0)
+            {
+                Marshal.Copy(ResLen, res_Len, 0, res_Len.Length);
+                int total = res_Len.Sum(r => r);
+                double[] LOP_Value = new double[total * 2];
+                Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
+
+                var points = ParseResult(LOP_Value);
+
+                int skipcount = 0;
+                for (int i = 0; i < LineCount; i++)
+                {
+                    int pointcount = res_Len[i];
+                    skipcount = i == 0 ? 0 : skipcount + res_Len[i - 1];
+                    var mapDots = points.Skip(skipcount).Take(pointcount);
+                    DtoLine dtoLine = new DtoLine();
+                    dtoLine.dtoLinePoints = mapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    list.Add(dtoLine);
+                }
+
+            }
+            GDOPApi.FreeGDOPBuf(ResLen);
+            GDOPApi.FreeGDOPBuf(LOP_ValuePtr);
+
+            return list;
+        }
+
         public static IEnumerable<(double lon, double lat)> DtoLineXdNoRefZl(DtoLineXdOption opt)
         {
             double startLon = (int)opt.CDBAnt[0] - 30;
@@ -440,7 +491,7 @@ namespace XdCxRhDW.Api
                 }
                 list.Clear();
             }
-            return list2.Select(p => (p.Item1, p.Item2)).OrderBy(p=>PhysicsHelper.DistanceGeo((1,1,0),(1,1,9)));
+            return list2.Select(p => (p.Item1, p.Item2)).OrderBy(p => PhysicsHelper.DistanceGeo((1, 1, 0), (1, 1, 9)));
         }
 
     }

+ 7 - 0
XdCxRhDW.Api/AddIns/时差线/DtoLineModel.cs

@@ -6,6 +6,13 @@ using System.Threading.Tasks;
 
 namespace XdCxRhDW.Api
 {
+
+    public class DtoLine
+    {
+
+      public IEnumerable<(double lon, double lat)> dtoLinePoints { get; set; } = new List<(double lon, double lat)>();
+
+    }
     public class DtoLinePoint 
     {
         /// <summary>

+ 4 - 0
XdCxRhDW.App/App.config

@@ -28,6 +28,10 @@
 		<!--两星一地无参定位算法使用最新的版本-->
 		<add key="UseNewPosX2D1NoRef" value="1" />
 
+
+		<!--GDOP使用最新的版本-->
+		<add key="UseNewGDOP" value="1" />
+
 	</appSettings>
 	<startup>
 		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />

+ 12 - 2
XdCxRhDW.App/EditForms/RHDTOParamEditor.cs

@@ -211,8 +211,18 @@ namespace XdCxRhDW.App.EditForms
                 var nsat = listSat.FirstOrDefault(m => m.SatCode == cg.Adja1Code.Value)?.Sat;
                 if (string.IsNullOrWhiteSpace(nsat)) nsat = cg.Adja1Code.Value.ToString();
 
-                var xdDtoLine = DrawDtoLineHelper.DtoLineXd(dtoLineXd);
-                mapControl1.DrawDtoLine($"[{msat},超短{CDBAnt[0]}°]时差线", xdDtoLine);
+                var xdDtoLine = DrawDtoLineHelper.DtoLineXdNew(dtoLineXd);
+                List<MapPolyline> polylines = new List<MapPolyline>();
+                foreach (var dtoLine in xdDtoLine)
+                {
+                    var mapline = mapControl1.GetLine($"[{msat},超短{CDBAnt[0]}°]时差线", dtoLine.dtoLinePoints);
+                    if (mapline == null)
+                    {
+                        continue;
+                    }
+                    polylines.Add(mapline);
+                }
+                mapControl1.DrawDtoLine(polylines);
 
                 var tsDtoLine = DrawDtoLineHelper.DtoLine2XStart(twoStartOption);
                 mapControl1.DrawDtoLine($"[{msat},{nsat}]时差线", tsDtoLine);

+ 15 - 2
XdCxRhDW.App/EditForms/X1D1DTOParamEditor.cs

@@ -181,8 +181,21 @@ namespace XdCxRhDW.App.EditForms
 
                 var msat = listSat.FirstOrDefault(m => m.SatCode == cg.MainCode.Value)?.Sat;
                 if (string.IsNullOrWhiteSpace(msat)) msat = cg.MainCode.Value.ToString();
-                var xdDtoLine = DrawDtoLineHelper.DtoLineXdEx(dtoLineXd);
-                mapControl1.DrawDtoLineTwo($"[{msat},超短{CDBAnt[0]}°]带参时差线", xdDtoLine);
+
+                
+
+                var xdDtoLine = DrawDtoLineHelper.DtoLineXdNew(dtoLineXd);
+                List<MapPolyline> polylines = new List<MapPolyline>();
+                foreach (var dtoLine in xdDtoLine)
+                {
+                    var mapline = mapControl1.GetLine($"[{msat},超短{CDBAnt[0]}°]带参时差线", dtoLine.dtoLinePoints);
+                    if (mapline == null)
+                    {
+                        continue;
+                    }
+                    polylines.Add(mapline);
+                }
+                mapControl1.DrawDtoLine(polylines);
 
                 //var xdDtoLine1 = DrawDtoLineHelper.DtoLineXd(dtoLineXd);
                 //mapControl1.DrawDtoLine($"[{msat},超短{CDBAnt[0]}°]带参时差线", xdDtoLine1);

+ 45 - 6
XdCxRhDW.App/EditForms/X2D1DTOParamEditor.cs

@@ -212,19 +212,58 @@ namespace XdCxRhDW.App.EditForms
                     //var xdDtoLine = DrawDtoLineHelper.DtoLineXd(dtoLineXd);
                     //mapControl1.DrawDtoLine($"[{msat},超短{CDBAnt[0]}°]时差线", xdDtoLine);
 
-                    var xdDtoLine1 = DrawDtoLineHelper.DtoLineXdEx(dtoLineXd);
-                    mapControl1.DrawDtoLineTwo($"[{msat},超短{CDBAnt[0]}°]带参时差线", xdDtoLine1);
 
+                    string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                    if (useNewGDOP == null || useNewGDOP == "0")
+                    {
+                        var xdDtoLine1 = DrawDtoLineHelper.DtoLineXdEx(dtoLineXd);
+                        mapControl1.DrawDtoLineTwo($"[{msat},超短{CDBAnt[0]}°]带参时差线", xdDtoLine1);
+
+                    }
+                    else
+                    {
+                        var xdDtoLine = DrawDtoLineHelper.DtoLineXdNew(dtoLineXd);
+                        List<MapPolyline> polylines = new List<MapPolyline>();
+                        foreach (var dtoLine in xdDtoLine)
+                        {
+                            var mapline = mapControl1.GetLine($"[{msat},超短{CDBAnt[0]}°]带参时差线", dtoLine.dtoLinePoints);
+                            if (mapline == null)
+                            {
+                                continue;
+                            }
+                            polylines.Add(mapline);
+                        }
+                        mapControl1.DrawDtoLine(polylines);
+
+                    }
                     var tsDtoLine = DrawDtoLineHelper.DtoLine2XStart(twoStartOption);
                     mapControl1.DrawDtoLine($"[{msat},{nsat}]时差线", tsDtoLine);
                 }
                 else
                 {
-                    //var xdDtoLine = DrawDtoLineHelper.DtoLineXdNoRef(dtoLineXd);
-                    //mapControl1.DrawDtoLine($"[{msat},超短{CDBAnt[0]}°]时差线", xdDtoLine);
+                    string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                    if (useNewGDOP == null || useNewGDOP == "0")
+                    {
+                        var xdDtoLine1 = DrawDtoLineHelper.DtoLineXdNoRefEx(dtoLineXd);
+                        mapControl1.DrawDtoLineTwo($"[{msat},超短{CDBAnt[0]}°]无参时差线", xdDtoLine1);
+                    }
+                    else
+                    {
+                        var xdDtoLine = DrawDtoLineHelper.DtoLineXdNoRefNew(dtoLineXd);
+                    List<MapPolyline> polylines = new List<MapPolyline>();
+                    foreach (var dtoLine in xdDtoLine)
+                    {
+                        var mapline = mapControl1.GetLine($"[{msat},超短{CDBAnt[0]}°]无参时差线", dtoLine.dtoLinePoints);
+                        if (mapline == null)
+                        {
+                            continue;
+                        }
+                        polylines.Add(mapline);
+                    }
+                    mapControl1.DrawDtoLine(polylines);
+                    }
 
-                    var xdDtoLine1 = DrawDtoLineHelper.DtoLineXdNoRefEx(dtoLineXd);
-                    mapControl1.DrawDtoLineTwo($"[{msat},超短{CDBAnt[0]}°]无参时差线", xdDtoLine1);
+                    
 
                     //var xdDtoLine2 = DrawDtoLineHelper.DtoLineXdNoRefZl(dtoLineXd);
                     //mapControl1.DrawDtoLine($"[{msat},超短{CDBAnt[0]}°]无参时差线zl", xdDtoLine2);

+ 59 - 0
XdCxRhDW.App/ExtensionsDev/MapControlEx.cs

@@ -29,7 +29,9 @@ using System.Reflection;
 using System.Security.Policy;
 using System.Text;
 using System.Threading;
+using System.Windows.Controls;
 using System.Windows.Forms;
+using System.Windows.Shapes;
 using XdCxRhDW.App;
 using XdCxRhDW.Entity;
 using XdCxRhDW.Repostory;
@@ -1637,6 +1639,61 @@ public static class MapControlEx
         innerData.mMapStorage.Items.AddRange(list);
     }
 
+
+    public static MapPolyline GetLine(this MapControl ctrl, string title, IEnumerable<(double lon, double lat)> lines)
+    {
+        if (lines == null || !lines.Any()) return null;
+        var innerData = ctrl.Tag as InnerData; 
+        var polyLine = new MapPolyline()
+        {
+            EnableSelection = DefaultBoolean.False,
+            EnableHighlighting = DefaultBoolean.True,
+            Stroke = ColorHelper.GetColor(title),
+            StrokeWidth = 2,
+            HighlightedStrokeWidth = 4,
+            IsGeodesic = true,
+            CanResize = false,
+            CanEdit = false,
+            CanRotate = false,
+            IsHitTestVisible = true,
+            CanMove = false,
+            Tag = $"DrawDtoLine_{title}",
+            ToolTipPattern = $"{title}",
+
+
+        };
+        polyLine.pr.
+        bool isShowPattern = lines.Count() > 400;
+        if (isShowPattern)
+        {
+            polyLine.TitleOptions.Pattern = title;
+        }
+        
+        foreach (var item in lines)
+        {
+            if (double.IsNaN(item.lat) || double.IsNaN(item.lon)) continue;
+            polyLine.Points.Add(new GeoPoint(item.lat, item.lon));
+            
+        }
+        if (!polyLine.Points.Any())
+        {
+            return null;
+        }
+        else
+        {
+            return polyLine;
+        }
+       
+
+    }
+
+
+    public static void DrawDtoLine(this MapControl ctrl, List<MapPolyline> polylines)
+    {
+        if (polylines == null || !polylines.Any()) return;
+        var innerData = ctrl.Tag as InnerData;
+        innerData.mMapStorage.Items.AddRange(polylines);
+    }
     public static void DrawDtoLine(this MapControl ctrl, string title, IEnumerable<(double lon, double lat)> lines)
     {
         if (lines == null || !lines.Any()) return;
@@ -1655,7 +1712,9 @@ public static class MapControlEx
             CanMove = false,
             Tag = $"DrawDtoLine_{title}",
             ToolTipPattern = $"{title}",
+
         };
+        polyLine.TitleOptions.Pattern = title;
         foreach (var item in lines)
         {
             if (double.IsNaN(item.lat) || double.IsNaN(item.lon)) continue;

+ 29 - 11
XdCxRhDW.App/UserControl/X1D1GDOPParam.cs

@@ -11,6 +11,7 @@ using System.Drawing;
 using DevExpress.XtraCharts.Design;
 using System.Runtime.ConstrainedExecution;
 using XdCxRhDW.Dto;
+using System.Configuration;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -69,7 +70,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 return false;
             }
-            if (!txtStationLocation1.CheckLonLat(dxErrorProvider,"超短波"))
+            if (!txtStationLocation1.CheckLonLat(dxErrorProvider, "超短波"))
             {
                 return false;
             }
@@ -77,7 +78,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 return false;
             }
-            if (!txtRefLocation1.CheckLonLat(dxErrorProvider,"参考站"))
+            if (!txtRefLocation1.CheckLonLat(dxErrorProvider, "参考站"))
             {
                 return false;
             }
@@ -102,18 +103,35 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 mapControl1.ClearMap();
-                var data = GdopHelper.Gdop1Sat1DByXyz(Model.EphMain, Model.CDBStation, Model.CXStation,
-                                 Model.DtousErr, Model.CXErr, Model.SatLocErr, Model.RefStation);
-                if (data == null)
+
+                string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                if (useNewGDOP == null || useNewGDOP == "0")
                 {
-                    return;
+                    var data = GdopHelper.Gdop1Sat1DByXyz(Model.EphMain, Model.CDBStation, Model.CXStation,
+                                     Model.DtousErr, Model.CXErr, Model.SatLocErr, Model.RefStation);
+                    foreach (var errLins in data)//画GDOP
+                    {
+                        mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, errLins.MapDots, 1);
+                    }
                 }
-                foreach (var errLins in data)//画GDOP
+                else
                 {
-                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                    var data = GdopHelper.Gdop1Sat1DByXyzNew(Model.EphMain, Model.CDBStation, Model.CXStation,
+                                      Model.DtousErr, Model.CXErr, Model.SatLocErr, Model.RefStation);
+
+                    List<MapPolyline> polylines = new List<MapPolyline>();
+                    for (int i = 0; i < data.Count; i++)
+                    {
+                        var errLins = data[i];
+                        var mapline = mapControl1.GetLine(errLins.ErrDistanceKm, errLins.MapDots);
+                        if (mapline == null)
+                        {
+                            continue;
+                        }
+                        polylines.Add(mapline);
+                    }
+                    mapControl1.DrawDtoLine(polylines);
                 }
-
             }
             catch (Exception ex)
             {
@@ -145,7 +163,7 @@ namespace XdCxRhDW.App.UserControl
                     DxHelper.MsgBoxHelper.ShowWarning($"卫星:{mainCode}未找到对应的星历信息,请导入星历");
                     return;
                 }
-                var XlCalcDto = new XlCalcDto() { tleStr = mainxlInfo.TwoLine, SigTime = sigTime};
+                var XlCalcDto = new XlCalcDto() { tleStr = mainxlInfo.TwoLine, SigTime = sigTime };
                 var maineph = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
                 ucEphXYZMain.SetParam("主星", mainCode, (maineph.data.X, maineph.data.Y, maineph.data.Z, maineph.data.VX, maineph.data.VY, maineph.data.VZ), Color.Red);
             }

+ 27 - 7
XdCxRhDW.App/UserControl/X2D1GDOPParam.cs

@@ -12,6 +12,7 @@ using System.Drawing;
 using DevExpress.Utils.About;
 using DevExpress.XtraEditors.DXErrorProvider;
 using XdCxRhDW.Dto;
+using System.Configuration;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -107,17 +108,36 @@ namespace XdCxRhDW.App.UserControl
             {
 
                 mapControl1.ClearMap();
-                var data = GdopHelper.Gdop2Sat1DByXyz(Model.EphMain, Model.EphAdja, Model.CDBStation
-                         , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X2D1NoRef ? null : Model.RefStation);
-                if (data == null)
+                string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                if (useNewGDOP == null || useNewGDOP == "0")
                 {
-                    return;
+                    var data = GdopHelper.Gdop2Sat1DByXyz(Model.EphMain, Model.EphAdja, Model.CDBStation
+                             , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X2D1NoRef ? null : Model.RefStation);
+                    foreach (var errLins in data)//画GDOP
+                    {
+                        mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, errLins.MapDots, 1);
+                    }
                 }
-                foreach (var errLins in data)//画GDOP
+                else
                 {
-                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+
+                    var data = GdopHelper.Gdop2Sat1DByXyzNew(Model.EphMain, Model.EphAdja, Model.CDBStation
+                      , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X2D1NoRef ? null : Model.RefStation);
+
+                    List<MapPolyline> polylines = new List<MapPolyline>();
+                    for (int i = 0; i < data.Count; i++)
+                    {
+                        var errLins = data[i];
+                        var mapline = mapControl1.GetLine(errLins.ErrDistanceKm, errLins.MapDots);
+                        if (mapline == null)
+                        {
+                            continue;
+                        }
+                        polylines.Add(mapline);
+                    }
+                    mapControl1.DrawDtoLine(polylines);
                 }
+
             }
             catch (Exception ex)
             {

+ 23 - 8
XdCxRhDW.App/UserControl/X2DFGDOPParam.cs

@@ -5,6 +5,7 @@ using DxHelper;
 using ExtensionsDev;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
 using System.Drawing;
 using System.Linq;
@@ -115,17 +116,31 @@ namespace XdCxRhDW.App.UserControl
 
 
                 mapControl1.ClearMap();
-                var data = GdopHelper.Gdop2SatDRefByXyz(Model.EphMain, Model.EphAdja, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.RefStation);
-
-                if (data == null)
+                string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                if (useNewGDOP == null || useNewGDOP == "0")
                 {
-                    return;
+                    var data = GdopHelper.Gdop2SatDRefByXyz(Model.EphMain, Model.EphAdja, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.RefStation);
+                    foreach (var errLins in data)//画GDOP
+                    {
+                        var mapDots = errLins.MapDots;
+                        mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                    }
                 }
-
-                foreach (var errLins in data)//画GDOP
+                else
                 {
-                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                    var data = GdopHelper.Gdop2SatDRefByXyzNew(Model.EphMain, Model.EphAdja, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.RefStation);
+                    List<MapPolyline> polylines = new List<MapPolyline>();
+                    for (int i = 0; i < data.Count; i++)
+                    {
+                        var errLins = data[i];
+                        var mapline = mapControl1.GetLine(errLins.ErrDistanceKm, errLins.MapDots);
+                        if (mapline == null)
+                        {
+                            continue;
+                        }
+                        polylines.Add(mapline);
+                    }
+                    mapControl1.DrawDtoLine(polylines);
                 }
             }
             catch (Exception ex)

+ 24 - 7
XdCxRhDW.App/UserControl/X3DFGDOPParam .cs

@@ -3,6 +3,7 @@ using DxHelper;
 using ExtensionsDev;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
 using System.Drawing;
 using System.Linq;
@@ -112,16 +113,32 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 mapControl1.ClearMap();
-                var data = GdopHelper.Gdop3SatDFByXyz(Model.EphMain, Model.EphAdja1, Model.EphAdja2, Model.fu1, Model.fu2, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.RefStation);
-
-                if (data == null)
+                string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                if (useNewGDOP == null || useNewGDOP == "0")
                 {
-                    return;
+                    var data = GdopHelper.Gdop3SatDFByXyz(Model.EphMain, Model.EphAdja1, Model.EphAdja2, Model.fu1, Model.fu2, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.RefStation);
+
+                    foreach (var errLins in data)//画GDOP
+                    {
+                        var mapDots = errLins.MapDots;
+                        mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                    }
                 }
-                foreach (var errLins in data)//画GDOP
+                else
                 {
-                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                    var data = GdopHelper.Gdop3SatDFByXyzNew(Model.EphMain, Model.EphAdja1, Model.EphAdja2, Model.fu1, Model.fu2, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.RefStation);
+                    List<MapPolyline> polylines = new List<MapPolyline>();
+                    for (int i = 0; i < data.Count; i++)
+                    {
+                        var errLins = data[i];
+                        var mapline = mapControl1.GetLine(errLins.ErrDistanceKm, errLins.MapDots);
+                        if (mapline == null)
+                        {
+                            continue;
+                        }
+                        polylines.Add(mapline);
+                    }
+                    mapControl1.DrawDtoLine(polylines);
                 }
             }
             catch (Exception ex)

+ 26 - 8
XdCxRhDW.App/UserControl/X3GDOPParam.cs

@@ -11,6 +11,7 @@ using XdCxRhDW.Api;
 using System.Drawing;
 using DevExpress.XtraEditors.DXErrorProvider;
 using XdCxRhDW.Dto;
+using System.Configuration;
 namespace XdCxRhDW.App.UserControl
 {
     public partial class X3GDOPParam : DevExpress.XtraEditors.XtraUserControl
@@ -103,17 +104,34 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 mapControl1.ClearMap();
-
-                var data = GdopHelper.Gdop3SatByXyz(Model.EphMain, Model.EphAdja1, Model.EphAdja2
-                                  , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X3NoRef ? null : Model.RefStation);
-                if (data == null)
+                string useNewGDOP = ConfigurationManager.AppSettings["UseNewGDOP"];
+                if (useNewGDOP == null || useNewGDOP == "0")
                 {
-                    return;
+                    var data = GdopHelper.Gdop3SatByXyz(Model.EphMain, Model.EphAdja1, Model.EphAdja2
+                                  , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X3NoRef ? null : Model.RefStation);
+                    foreach (var errLins in data)//画GDOP
+                    {
+                        mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, errLins.MapDots, 1);
+                    }
+
                 }
-                foreach (var errLins in data)//画GDOP
+                else
                 {
-                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                    var data = GdopHelper.Gdop3SatByXyzNew(Model.EphMain, Model.EphAdja1, Model.EphAdja2
+                                     , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X3NoRef ? null : Model.RefStation);
+
+                    List<MapPolyline> polylines = new List<MapPolyline>();
+                    for (int i = 0; i < data.Count; i++)
+                    {
+                        var errLins = data[i];
+                        var mapline = mapControl1.GetLine(errLins.ErrDistanceKm, errLins.MapDots);
+                        if (mapline == null)
+                        {
+                            continue;
+                        }
+                        polylines.Add(mapline);
+                    }
+                    mapControl1.DrawDtoLine(polylines);
                 }
             }
             catch (Exception ex)