瀏覽代碼

Merge branch 'master' of http://139.155.15.221:3000/zoulei/XdCxRhDW

gongqiuhong 1 年之前
父節點
當前提交
96d4a7341b
共有 2 個文件被更改,包括 36 次插入47 次删除
  1. 17 26
      XdCxRhDW.App/ExtensionsDev/MapControlEx.cs
  2. 19 21
      XdCxRhDW.App/UserControl/CtrlHome.cs

+ 17 - 26
XdCxRhDW.App/ExtensionsDev/MapControlEx.cs

@@ -1,12 +1,18 @@
-using DevExpress.Map.Native;
+using DevExpress.Export.Xl;
+using DevExpress.Map;
+using DevExpress.Map.Native;
 using DevExpress.Utils;
-using DevExpress.Utils.Design;
 using DevExpress.Utils.Svg;
 using DevExpress.XtraBars;
+using DevExpress.XtraGrid;
+using DevExpress.XtraGrid.Columns;
+using DevExpress.XtraGrid.Views.Grid;
 using DevExpress.XtraMap;
+using DevExpress.XtraMap.ItemEditor;
+using DevExpress.XtraPrinting;
+using DxHelper;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
 using System.Data.Common;
 using System.Data.SQLite;
@@ -14,25 +20,9 @@ using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
 using System.Linq;
-using System.Linq.Expressions;
 using System.Reflection;
 using System.Text;
-using System.Threading.Tasks;
 using System.Windows.Forms;
-using DevExpress.XtraMap.ItemEditor;
-using DxHelper;
-using System.Runtime.CompilerServices;
-using DevExpress.XtraPrinting;
-using DevExpress.Export.Xl;
-using DevExpress.XtraEditors;
-using DevExpress.Map.Dashboard;
-using DevExpress.XtraGrid;
-using DevExpress.XtraGrid.Views.Grid;
-using DevExpress.XtraGrid.Columns;
-using DevExpress.Map;
-using System.Threading;
-using System.ComponentModel.DataAnnotations.Schema;
-using XdCxRhDW.Repostory.Model;
 using XdCxRhDW.Repostory;
 
 public enum GoogleMapType
@@ -1571,14 +1561,15 @@ public static class MapControlEx
 
         return (c_lng, c_lat);  //方向上的另一点坐标
     }
-    /**
-    * 求B点经纬度
-    * @param A 已知点的经纬度,
-    * @param distance   AB两地的距离  单位km
-    * @param angle  AB连线与正北方向的夹角(0~360)
-    * @return  B点的经纬度
+    
+/**
+* 求B点经纬度
+* @param A 已知点的经纬度,
+* @param distance   AB两地的距离  单位km
+* @param angle  AB连线与正北方向的夹角(0~360)
+* @return  B点的经纬度
 */
-    private static MyLatLng getMyLatLng(MyLatLng A, double distance, double angle)
+private static MyLatLng getMyLatLng(MyLatLng A, double distance, double angle)
     {
         double dx = distance * 1000 * Math.Sin(DegreesToRadians(angle));
         double dy = distance * 1000 * Math.Cos(DegreesToRadians(angle));

+ 19 - 21
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -599,16 +599,6 @@ namespace XdCxRhDW.App.UserControl
             var item = gridView2.GetRow(ids[0]) as PosRes;
             return item;
         }
-        private EnumPosType GetPosRes(PosRes posRes, string msg)
-        {
-            var taskInfo = list.Find(m => m.ID == posRes.TaskInfoID);
-            if (taskInfo == null)
-            {
-                DxHelper.MsgBoxHelper.ShowWarning($"{msg}未找到任务[{posRes.TaskInfoID}]!");
-                return default;
-            }
-            return taskInfo.PosType;
-        }
 
         private void btnDrawDfo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
@@ -713,7 +703,7 @@ namespace XdCxRhDW.App.UserControl
 
                     listSat = db.SatInfos.ToList();
                     cg = await db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
-                    station = await db.StationRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
+                    station = await db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefaultAsync();
                 }
                 if (cg == null)
                 {
@@ -750,8 +740,11 @@ namespace XdCxRhDW.App.UserControl
                 dtoLineXd.RefDto = cg.YbMainDto.Value;
                 dtoLineXd.PosLon = item.PosLon;
                 dtoLineXd.PosLat = item.PosLat;
-
-                var msat = listSat.FirstOrDefault(m => m.SatCode == cg.MainCode.Value)?.Sat;
+                string msat = string.Empty;
+                if (cg.MainCode.HasValue)
+                {
+                    msat = listSat.FirstOrDefault(m => m.SatCode == cg.MainCode.Value)?.Sat;
+                }
                 var xdDtoLine = DrawDtoLineHelper.DtoLineXd(dtoLineXd);
                 mapControl1.DrawDtoPonit($"星地[{msat},[{station.CdbTxLon}°]]时差线", xdDtoLine);
 
@@ -768,7 +761,12 @@ namespace XdCxRhDW.App.UserControl
                     twoStartOption.PosLon = item.PosLon;
                     twoStartOption.PosLat = item.PosLat;
                     var tsDtoLine = DrawDtoLineHelper.DtoLineXDTwoStart(twoStartOption);
-                    mapControl1.DrawDtoPonit($"双星[{msat},{listSat.FirstOrDefault(m => m.SatCode == cg.Adja1Code.Value)?.Sat}]时差线", tsDtoLine);
+                    string nsat = string.Empty;
+                    if (cg.Adja1Code.HasValue)
+                    {
+                        nsat = listSat.FirstOrDefault(m => m.SatCode == cg.Adja1Code.Value)?.Sat;
+                    }
+                    mapControl1.DrawDtoPonit($"双星[{msat},{nsat}]时差线", tsDtoLine);
                 }
             }
             catch (Exception ex)
@@ -790,7 +788,7 @@ namespace XdCxRhDW.App.UserControl
 
                     listSat = db.SatInfos.ToList();
                     cg = await db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
-                    station = await db.StationRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
+                    station = await db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefaultAsync();
                 }
                 if (cg == null)
                 {
@@ -866,7 +864,7 @@ namespace XdCxRhDW.App.UserControl
                     listSat = db.SatInfos.ToList();
                     cg = await db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
 
-                    station = await db.StationRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
+                    station = await db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefaultAsync();
                 }
                 if (cg == null)
                 {
@@ -900,8 +898,9 @@ namespace XdCxRhDW.App.UserControl
                 twoStartOption.Turn1 = Math.Abs(twoStartOption.Freq - (cg.TarFreqDown.HasValue ? cg.TarFreqDown.Value : 0));
                 twoStartOption.Turn2 = Math.Abs(twoStartOption.RefFreq - (cg.RefFreqDown.HasValue ? cg.RefFreqDown.Value : 0));
                 twoStartOption.RefDfo = cg.YbMainDfo.Value - cg.YbAdja1Dfo.Value;
-                var msat = listSat.FirstOrDefault(m => m.SatCode == cg.MainCode.Value)?.Sat;
                 var tsDtoLine = DrawDfoLineHelper.DfoLineTwoStart(twoStartOption);
+
+                var msat = listSat.FirstOrDefault(m => m.SatCode == cg.MainCode.Value)?.Sat;
                 mapControl1.DrawDtoPonit($"{item.PosResType.GetEnumDisplayName()}[{msat},{listSat.FirstOrDefault(m => m.SatCode == cg.Adja1X.Value)?.Sat}]频差线", tsDtoLine);
 
                 if (item.PosResType == EnumPosResType.X3TwoDfo)
@@ -933,7 +932,7 @@ namespace XdCxRhDW.App.UserControl
                 using (RHDWContext db = new RHDWContext())
                 {
                     cx = await db.CxRes.Where(m => m.ID == item.CxResID.Value).FirstOrDefaultAsync();
-                    station = await db.StationRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
+                    station = await db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefaultAsync();
                 }
                 if (cx == null)
                 {
@@ -951,15 +950,14 @@ namespace XdCxRhDW.App.UserControl
                     DxHelper.MsgBoxHelper.ShowWarning($"测向站信息为空!");
                     return;
                 }
-                double startdeg = 360;
-                double deg = startdeg - cx.Fx;//向北顺时针方向为夹角
+                double deg = cx.Fx;//向北顺时针方向为夹角
                 //计算测向站到定位点之间的距离
                 var km = MapControlEx.CalcLineKm(station.CxLon.Value, station.CxLat.Value, item.PosLon, item.PosLat);
                 var endpoint = MapControlEx.CalcSituation(station.CxLon.Value, station.CxLat.Value, deg, (km + 100) * 1000);
                 List<(double, double)> points = new List<(double, double)>();
                 points.Add((station.CxLon.Value, station.CxLat.Value));
                 points.Add((endpoint.Item1, endpoint.Item2));
-                mapControl1.DrawCXLine($"测向线角度:{cx.Fx}°\t\n", points);
+                mapControl1.DrawCXLine($"测向线角度:{cx.Fx}°\t\n", points, true);
             }
             catch (Exception ex)
             {