Explorar el Código

更新双星参考站

wyq hace 1 año
padre
commit
4cb2964179

+ 83 - 74
XzXdDw.App/App.config

@@ -1,77 +1,86 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
-  <configSections>
-    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
-      <section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
-    </sectionGroup>
-  </configSections>
-  <applicationSettings>
-    <DevExpress.LookAndFeel.Design.AppSettings>
-      <setting name="DefaultAppSkin" serializeAs="String">
-        <value>CompactSkin/WXI</value>
-      </setting>
-      <setting name="DefaultPalette" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="TouchUI" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="CompactUI" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="TouchScaleFactor" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="DirectX" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="RegisterUserSkins" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="RegisterBonusSkins" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="FontBehavior" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="DefaultAppFont" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="DPIAwarenessMode" serializeAs="String">
-        <value></value>
-      </setting>
-      <setting name="CustomPaletteCollection" serializeAs="Xml">
-        <value />
-      </setting>
-    </DevExpress.LookAndFeel.Design.AppSettings>
-  </applicationSettings>
-  <startup>
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
-  </startup>
-  <entityFramework>
-    <providers>
-      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
-      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
-      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
-    </providers>
-  </entityFramework>
-  <system.data>
-    <DbProviderFactories>
-      <remove invariant="System.Data.SQLite.EF6" />
-      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
-      <remove invariant="System.Data.SQLite" />
-      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
-    </DbProviderFactories>
-  </system.data>
-  <connectionStrings>
-    <add name="DbCon" connectionString="Data Source=|DataDirectory|\Database.db" providerName="System.Data.SQLite.EF6" />
-  </connectionStrings>
-  <appSettings>
-    <!--程序标题-->
-    <add key="SystemName" value="XZDW平台" />
-    <!--公司名称(没有则不会显示版权)-->
-    <add key="Company" value="" />
-  </appSettings>
+	<configSections>
+		<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+		<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+		<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
+			<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+		</sectionGroup>
+	</configSections>
+	<applicationSettings>
+		<DevExpress.LookAndFeel.Design.AppSettings>
+			<setting name="DefaultAppSkin" serializeAs="String">
+				<value>CompactSkin/WXI</value>
+			</setting>
+			<setting name="DefaultPalette" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="TouchUI" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="CompactUI" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="TouchScaleFactor" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="DirectX" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="RegisterUserSkins" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="RegisterBonusSkins" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="FontBehavior" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="DefaultAppFont" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="DPIAwarenessMode" serializeAs="String">
+				<value></value>
+			</setting>
+			<setting name="CustomPaletteCollection" serializeAs="Xml">
+				<value />
+			</setting>
+		</DevExpress.LookAndFeel.Design.AppSettings>
+	</applicationSettings>
+	<startup>
+		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+	</startup>
+	<entityFramework>
+		<providers>
+			<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+			<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+			<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+		</providers>
+	</entityFramework>
+	<system.data>
+		<DbProviderFactories>
+			<remove invariant="System.Data.SQLite.EF6" />
+			<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
+			<remove invariant="System.Data.SQLite" />
+			<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
+		</DbProviderFactories>
+	</system.data>
+	<connectionStrings>
+		<add name="DbCon" connectionString="Data Source=|DataDirectory|\Database.db" providerName="System.Data.SQLite.EF6" />
+	</connectionStrings>
+	<appSettings>
+		<!--程序标题-->
+		<add key="SystemName" value="XZDW平台" />
+		<!--公司名称(没有则不会显示版权)-->
+		<add key="Company" value="" />
+		<add key="MBUpFreq" value="3.1085e8"/>
+		<add key="CKUpFreq" value="2.95e8"/>
+		<!--双星参考站位置-->
+		<add key="SXCKLon" value="112.33"/>
+		<add key="SXCKLat" value="16.3"/>
+
+		<!--框选范围-->
+		<add key="CenterLon" value="144"/>
+		<add key="CenterLat" value="13"/>
+	</appSettings>
 </configuration>

+ 193 - 0
XzXdDw.App/DxHelper/StringExtension.cs

@@ -0,0 +1,193 @@
+using System;
+using System.Text.RegularExpressions;
+
+namespace Extensions
+{
+    public static class stringExtension
+    {
+        public static T ToJson<T>(this string obj)
+        {
+            return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(obj);
+        }
+        public static bool IsNullOrEmpty(this string @this)
+        {
+            return string.IsNullOrEmpty(@this);
+        }
+        public static Nullable<T> ToNullable<T>(this string @this) where T:struct
+        {
+            if (string.IsNullOrWhiteSpace(@this)) return null;
+            var val=Convert.ChangeType(@this, typeof(T));
+            return (T)val;
+        }
+        public static bool IsNotNullOrEmpty(this string @this)
+        {
+            return !string.IsNullOrEmpty(@this);
+        }
+
+        public static bool IsNullOrWhitespace(this string @this)
+        {
+            return string.IsNullOrWhiteSpace(@this);
+        }
+
+        public static bool IsNotNullOrWhitespace(this string @this)
+        {
+            return !string.IsNullOrWhiteSpace(@this);
+        }
+
+        public static string IfNullOrEmpty(this string @this, string defaultVal)
+        {
+            return string.IsNullOrEmpty(@this) ? defaultVal : @this;
+        }
+
+        public static string IfNullOrWhitespace(this string @this, string defaultVal)
+        {
+            return string.IsNullOrWhiteSpace(@this) ? defaultVal : @this;
+        }
+
+        public static string ClearWhitespace(this string @this)
+        {
+            if (string.IsNullOrWhiteSpace(@this)) return string.Empty;
+            return @this.Replace(" ", string.Empty);
+        }
+
+        public static string Left(this string @this, int length)
+        {
+            if (string.IsNullOrEmpty(@this)) return string.Empty;
+            return @this.Length < length ? @this : @this.Substring(0, length);
+        }
+
+        public static string Rigth(this string @this, int length)
+        {
+            if (string.IsNullOrEmpty(@this)) return string.Empty;
+            return @this.Length < length ? @this : @this.Substring(@this.Length - length);
+        }
+
+        public static string TrimToMaxLength(this string @this, int maxLength, string suffix = "")
+        {
+            return ((@this == null || @this.Length <= maxLength) ? @this : string.Concat(@this.Substring(0, maxLength), suffix));
+        }
+
+        public static T To<T>(this string @this)
+        {
+            return To(@this, default(T));
+        }
+
+        public static T To<T>(this string @this, T defaultValue)
+        {
+            if (string.IsNullOrWhiteSpace(@this))
+                return defaultValue;
+
+            T retVal = defaultValue;
+            try
+            {
+                //获取要转换的目标类型
+                Type targetType = typeof(T);
+
+                //对 Guid 类型的值进行单独处理
+                if (targetType == typeof(Guid))
+                    retVal = (T)((object)(new Guid(@this)));
+                //对 Enum 类型的值进行单独处理
+                else if (targetType.BaseType == typeof(Enum))
+                    retVal = (T)Enum.Parse(targetType, @this);
+                else
+                    retVal = (T)Convert.ChangeType(@this, targetType);
+            }
+            catch { }
+
+            return retVal;
+        }
+
+        public static string GetBefore(this string value, string x)
+        {
+            if (value == null || x == null)
+                return string.Empty;
+
+            int xPos = value.IndexOf(x);
+            return xPos == -1 ? string.Empty : value.Substring(0, xPos);
+        }
+
+        public static string GetAfter(this string value, string x)
+        {
+            if (value == null || x == null)
+                return string.Empty;
+
+            int xPos = value.LastIndexOf(x);
+            if (xPos == -1)
+                return string.Empty;
+
+            int startIndex = xPos + x.Length;
+            return startIndex >= value.Length ? string.Empty : value.Substring(startIndex);
+        }
+
+        public static string GetBetween(this string value, string x, string y)
+        {
+            if (value == null || x == null || y == null)
+                return string.Empty;
+
+            int xPos = value.IndexOf(x);
+            int yPos = value.LastIndexOf(y);
+
+            if (xPos == -1 || yPos == -1)
+                return string.Empty;
+
+            int startIndex = xPos + x.Length;
+            return startIndex >= yPos ? string.Empty : value.Substring(startIndex, yPos - startIndex);
+        }
+
+        public static string FormatWith(this string @this, Object arg0)
+        {
+            return string.Format(@this, arg0);
+        }
+
+        public static string FormatWith(this string @this, Object arg0, Object arg1)
+        {
+            return string.Format(@this, arg0, arg1);
+        }
+
+        public static string FormatWith(this string @this, Object arg0, Object arg1, Object arg2)
+        {
+            return string.Format(@this, arg0, arg1, arg2);
+        }
+
+        public static string FormatWith(this string @this, params object[] values)
+        {
+            return string.Format(@this, values);
+        }
+
+        public static string[] Split(this string @this, string separator, StringSplitOptions option = StringSplitOptions.None)
+        {
+            return @this.Split(new[] { separator }, option);
+        }
+
+        public static Boolean IsMatch(this string input, string pattern)
+        {
+            return Regex.IsMatch(input, pattern);
+        }
+
+        public static Boolean IsMatch(this string input, string pattern, RegexOptions options)
+        {
+            return Regex.IsMatch(input, pattern, options);
+        }
+
+        public static Match Match(this string input, string pattern)
+        {
+            return Regex.Match(input, pattern);
+        }
+
+        public static Match Match(this string input, string pattern, RegexOptions options)
+        {
+            return Regex.Match(input, pattern, options);
+        }
+
+        public static MatchCollection Matches(this string input, string pattern)
+        {
+            return Regex.Matches(input, pattern);
+        }
+
+        public static MatchCollection Matches(this string input, string pattern, RegexOptions options)
+        {
+            return Regex.Matches(input, pattern, options);
+        }
+    }
+}
+

+ 6 - 3
XzXdDw.App/UserControl/CtrlPosSingle.cs

@@ -8,9 +8,11 @@ using DevExpress.XtraGrid.Views.Grid;
 using DevExpress.XtraMap;
 using DevExpress.XtraTreeList.Data;
 using DxHelper;
+using Extensions;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Configuration;
 using System.Data;
 using System.Data.Entity;
 using System.Drawing;
@@ -41,9 +43,11 @@ namespace XzXdDw.App.UserControl
     public partial class CtrlPosSingle : DevExpress.XtraEditors.XtraUserControl
     {
         DtXDParam dtxdctrl = null;
+        double MBfu;
         public CtrlPosSingle()
         {
             InitializeComponent();
+            MBfu = ConfigurationManager.AppSettings["MBUpFreq"].To(3.1085e8);
         }
 
         private async void CtrlXdPos_Load(object sender, EventArgs e)
@@ -153,7 +157,6 @@ namespace XzXdDw.App.UserControl
             stoped = false;
 
 
-            double fu = 3.1085e8;
             //在列表控件中全选+右键可以删除所有测试结果
             using (RHDWContext db = new RHDWContext())
             {
@@ -231,11 +234,11 @@ namespace XzXdDw.App.UserControl
                     var cg1 = db.CgRes.Add(cgRes1);//参估结果入库
                     await db.SaveChangesAsync();
 
-                    var res = PosApi.X1_POS(cg, cg1, fu);
+                    var res = PosApi.X1_POS(cg, cg1, MBfu);
 
                     PosRes posRes = new PosRes()
                     {
-                        UpFreq = fu,
+                        UpFreq = MBfu,
                         SigTime = DateTime.Now,
                         CgResID = cg.ID,
                         TarName = "未知目标",

+ 25 - 45
XzXdDw.App/UserControl/CtrlPosXz.cs

@@ -6,9 +6,11 @@ using DevExpress.XtraGrid.Views.Grid;
 using DevExpress.XtraMap;
 using DevExpress.XtraTreeList.Data;
 using DxHelper;
+using Extensions;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
+using System.Configuration;
 using System.Data;
 using System.Data.Entity;
 using System.Drawing;
@@ -43,11 +45,25 @@ namespace XzXdDw.App.UserControl
         /// 时差初值 范围计算
         /// </summary>
         DtSXLParam dtsxlctrl = null;
-        double fu1 = 3.1085e8;
-        double fu2 = 2.95e8;
+        double MBfu;
+        double CKfu;
+        private TxInfo refTx;
         public CtrlPosXz()
         {
             InitializeComponent();
+            InitData();
+        }
+
+        private void InitData()
+        {
+            refTx = new TxInfo();
+            refTx.Lon = ConfigurationManager.AppSettings["SXCKLon"].To(112.33);
+            refTx.Lat = ConfigurationManager.AppSettings["SXCKLat"].To(16.3);
+
+            MBfu = ConfigurationManager.AppSettings["MBUpFreq"].To(3.1085e8);
+            CKfu = ConfigurationManager.AppSettings["CKUpFreq"].To(2.95e8);
+
+          
         }
 
         private async void CtrlXdPos_Load(object sender, EventArgs e)
@@ -275,25 +291,8 @@ namespace XzXdDw.App.UserControl
 
                     var cg = db.CgRes.Add(cgRes);//参估结果入库
                     await db.SaveChangesAsync();
-                    /*double[] main_sat = { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.158046 };
-                    double[] neigh_sat = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
-                    double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
-                    double[] Zone = { -80, 80, -150, 150 };
-
-                    double target_dto = -0.010246009710722;
-                    double target_dfo = 1.595360344349182e+03;
-
-                    double ref_dto = 0.002823291225258;
-                    double ref_dfo = 1.132007974492508e+04;
-
-                    double fu1 = 3.1085e8;
-                    double fu2 = 2.95e8;
-                    */
-
-                    var refTx = listTx.Find(p => p.TxType == EnumTxType.Ref);
-                   // refTx.Lon = 112.33;
-                    //refTx.Lat = 16.3;
-                    var res = PosApi.X2_POS(cg, refTx, fu1, fu2);
+                  
+                    var res = PosApi.X2_POS(cg, refTx, MBfu, CKfu);
 
                     XZPosRes posRes = new XZPosRes()
                     {
@@ -350,9 +349,8 @@ namespace XzXdDw.App.UserControl
                 }
                 var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
                 var satNTx = listTx.Find(p => p.TxType == EnumTxType.AdjaSat);
-                var refTx = listTx.Find(p => p.TxType == EnumTxType.Ref);
-                //refTx.Lon = 112.33;
-                //refTx.Lat = 16.3;
+               
+               
                 DtoLineTwoStartOption twoStartOption = new DtoLineTwoStartOption();
                 twoStartOption.MsEph = new double[6] { cg.MainX, cg.MainY, cg.MainZ, cg.MainVX, cg.MainVY, cg.MainVZ };
                 twoStartOption.NsEph = new double[6] { cg.AdjaX, cg.AdjaY, cg.AdjaZ, cg.AdjaVX, cg.AdjaVY, cg.AdjaVZ };
@@ -399,33 +397,15 @@ namespace XzXdDw.App.UserControl
                 }
                 var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
                 var satNTx = listTx.Find(p => p.TxType == EnumTxType.AdjaSat);
-                var refTx = listTx.Find(p => p.TxType == EnumTxType.Ref);
-
-                /*
-                double[] main_sat = { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.158046 };
-                double[] neigh_sat = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
-                double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
-                double[] Zone = { -80, 80, -150, 150 };
-                
-
-                double target_dfo = 1.595360344349182e+03;
-
-                double ref_dfo = 1.132007974492508e+04;
-
-                double fu1 = 3.1085e8;
-                double fu2 = 2.95e8;
-                
-                refTx.Lon = 112.33;
-                refTx.Lat = 16.3;
-                */
+              
                 DfoLineTwoStartOption twoStartOption = new DfoLineTwoStartOption();
                 twoStartOption.MsEph = new double[6] { cg.MainX, cg.MainY, cg.MainZ, cg.MainVX, cg.MainVY, cg.MainVZ };
                 twoStartOption.NsEph = new double[6] { cg.AdjaX, cg.AdjaY, cg.AdjaZ, cg.AdjaVX, cg.AdjaVY, cg.AdjaVZ };
                 twoStartOption.RefGeod = new double[3] { refTx.Lon, refTx.Lat, 0 };
                 twoStartOption.TargetDfo = cg.DfoSx;
                 twoStartOption.RefDfo = cg.DfoCdb;
-                twoStartOption.fu1 = fu1;
-                twoStartOption.fu2 = fu2;
+                twoStartOption.fu1 = MBfu;
+                twoStartOption.fu2 = CKfu;
 
                 var tsDtoLine = DrawDtoLineHelper.DfoLineXZTwoStart(twoStartOption);
                 mapControl1.DrawDtoPonit($"双星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat},{listSat.FirstOrDefault(m => m.ID == satNTx.ID)?.Sat}]频差线", tsDtoLine);

+ 1 - 0
XzXdDw.App/XzXdDw.App.csproj

@@ -159,6 +159,7 @@
     <Compile Include="Basic\PhysicsHelper.cs" />
     <Compile Include="DTO\MapItem.cs" />
     <Compile Include="DxHelper\PopupHelper.cs" />
+    <Compile Include="DxHelper\StringExtension.cs" />
     <Compile Include="DxHelper\SvgHelper.cs" />
     <Compile Include="DxHelper\WaitHelper.cs" />
     <Compile Include="EditForms\SimulationEditor.cs">