|
@@ -36,6 +36,9 @@ using XzXdDw.App.Model;
|
|
|
using DevExpress.XtraCharts.Native;
|
|
|
using DevExpress.Utils.Extensions;
|
|
|
using System.Windows.Ink;
|
|
|
+//using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
|
|
+//using Serilog;
|
|
|
+//using DevExpress.XtraPrinting.Native;
|
|
|
//using RHDW.Model;
|
|
|
|
|
|
/// <summary>
|
|
@@ -620,10 +623,10 @@ public static class MapControlEx
|
|
|
btnCustom.ImageOptions.SvgImage = img;
|
|
|
btnCustom.Tag = ctrl;
|
|
|
btnCustom.ItemClick += (sender, e) =>
|
|
|
- {
|
|
|
- var data = ctrl.GetRectPosItem<T>();
|
|
|
- action(data);
|
|
|
- };
|
|
|
+ {
|
|
|
+ var data = ctrl.GetRectPosItem<T>();
|
|
|
+ action(data);
|
|
|
+ };
|
|
|
var innerData = ctrl.Tag as InnerData;
|
|
|
innerData.barM.BeginInit();
|
|
|
innerData.barM.Items.Add(btnCustom);
|
|
@@ -1218,13 +1221,13 @@ public static class MapControlEx
|
|
|
var options = new XlsxExportOptionsEx();
|
|
|
WaitHelper.ShowOverlayForm(ctrl);
|
|
|
options.ExportProgress += arg =>
|
|
|
- {
|
|
|
- WaitHelper.UpdateOverlyText($"{arg.ProgressPercentage}%");
|
|
|
- if (arg.ProgressPercentage >= 100)
|
|
|
- {
|
|
|
- WaitHelper.CloseOverlayForm();
|
|
|
- }
|
|
|
- };
|
|
|
+ {
|
|
|
+ WaitHelper.UpdateOverlyText($"{arg.ProgressPercentage}%");
|
|
|
+ if (arg.ProgressPercentage >= 100)
|
|
|
+ {
|
|
|
+ WaitHelper.CloseOverlayForm();
|
|
|
+ }
|
|
|
+ };
|
|
|
view.OptionsPrint.PrintHeader = exportHeader;
|
|
|
options.CustomizeCell += arg =>
|
|
|
{
|
|
@@ -1353,7 +1356,66 @@ public static class MapControlEx
|
|
|
};
|
|
|
return ctrl;
|
|
|
}
|
|
|
+ public static void Drea(this MapControl ctrl, double Lat, double Lon)
|
|
|
+ {
|
|
|
+ var innerData = ctrl.Tag as InnerData;
|
|
|
+ var mapItem = new MapDot()
|
|
|
+ {
|
|
|
+ Stroke = Color.FromArgb(128, 255, 93, 106),
|
|
|
+ ToolTipPattern = "天线",
|
|
|
+ EnableHighlighting = DefaultBoolean.True,
|
|
|
+ EnableSelection = DefaultBoolean.False,
|
|
|
+ CanMove = false,
|
|
|
+ Visible = true,
|
|
|
+ IsHitTestVisible = true,
|
|
|
+ Fill = Color.FromArgb(128, 255, 93, 106),
|
|
|
+ Size = 400,
|
|
|
+ Tag = "天线",
|
|
|
+ Location = new GeoPoint(Lat, Lon),
|
|
|
+ StrokeWidth = 1,
|
|
|
+ };
|
|
|
+ innerData.posStorge.Items.Add(mapItem);
|
|
|
+ }
|
|
|
+ public static void DrawEllipse(this MapControl ctrl, double lat, double lon, int radius)
|
|
|
+ {
|
|
|
+ var innerData = ctrl.Tag as InnerData;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (radius <= 0)
|
|
|
+ return;
|
|
|
+
|
|
|
+ CoordPointCollection latLngs = new CoordPointCollection();
|
|
|
+ MyLatLng centerLatLng = new MyLatLng(lon, lat);
|
|
|
+
|
|
|
+ // 0 - 360度 寻找半径为radius,圆心为centerP的圆上点的经纬度
|
|
|
+ for (int i = 0; i < 360; i++)
|
|
|
+ {
|
|
|
+ //获取目标经纬度
|
|
|
+ MyLatLng tempLatLng = getMyLatLng(centerLatLng, radius, i);
|
|
|
+ //将自定义的经纬度类 转换成 标准经纬度类
|
|
|
+ CoordPoint p = new GeoPoint(tempLatLng.m_Latitude, tempLatLng.m_Longitude);
|
|
|
+ latLngs.Add(p);
|
|
|
+ }
|
|
|
|
|
|
+ //安全性检查
|
|
|
+ if (latLngs.Count < 20)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //通过绘制多边形的方式绘制圆
|
|
|
+ MapPolygon gpol = new MapPolygon();
|
|
|
+ gpol.Points = latLngs;
|
|
|
+ gpol.Stroke = Color.Red;
|
|
|
+ gpol.Fill = Color.FromArgb(50, Color.Red);
|
|
|
+ gpol.IsHitTestVisible = true;
|
|
|
+ innerData.mMapStorageFixed.Items.Add(gpol);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ //Dialog.Error(ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 绘制矩形
|
|
|
/// </summary>
|
|
@@ -1426,7 +1488,7 @@ public static class MapControlEx
|
|
|
if (!polyLine.Points.Any()) return;
|
|
|
innerData.mMapStorage.Items.Add(polyLine);
|
|
|
}
|
|
|
- public static void DrawDtoLine(this MapControl ctrl,string title, IEnumerable<(double lon, double lat)> lines)
|
|
|
+ public static void DrawDtoLine(this MapControl ctrl, string title, IEnumerable<(double lon, double lat)> lines)
|
|
|
{
|
|
|
if (lines == null || !lines.Any()) return;
|
|
|
var innerData = ctrl.Tag as InnerData;
|
|
@@ -1474,12 +1536,12 @@ public static class MapControlEx
|
|
|
Size = 4,
|
|
|
Tag = $"DrawPoint_{title}{lines.ElementAt(i).lon}",
|
|
|
Location = new GeoPoint(p.lat, p.lon),
|
|
|
- ToolTipPattern= $"{title}",
|
|
|
+ ToolTipPattern = $"{title}",
|
|
|
|
|
|
};
|
|
|
list.Add(mapItem);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!list.Any()) return;
|
|
|
innerData.mMapStorage.Items.AddRange(list);
|
|
|
}
|
|
@@ -1578,7 +1640,7 @@ public static class MapControlEx
|
|
|
var innerData = ctrl.Tag as InnerData;
|
|
|
return innerData.mMapStorage;
|
|
|
}
|
|
|
- public static void RemoveFlag(this MapControl ctrl,string flag)
|
|
|
+ public static void RemoveFlag(this MapControl ctrl, string flag)
|
|
|
{
|
|
|
var innerData = ctrl.Tag as InnerData;
|
|
|
var items = innerData.mMapStorage.Items.ToList().FindAll(p => p.Tag != null && p.Tag.ToString() == flag);
|
|
@@ -1875,6 +1937,38 @@ public static class MapControlEx
|
|
|
ctrl.MouseLeave -= MapControl_MouseLeave;
|
|
|
ctrl.MouseEnter -= MapControl_MouseEnter;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //度 转换成 弧度
|
|
|
+ public static double DegreesToRadians(double degrees)
|
|
|
+ {
|
|
|
+ const double degToRadFactor = Math.PI / 180;
|
|
|
+ return degrees * degToRadFactor;
|
|
|
+ }
|
|
|
+
|
|
|
+ //弧度 转换成 度
|
|
|
+ public static double RadiansToDegrees(double radians)
|
|
|
+ {
|
|
|
+ const double radToDegFactor = 180 / Math.PI;
|
|
|
+ return radians * radToDegFactor;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 求B点经纬度
|
|
|
+ * @param A 已知点的经纬度,
|
|
|
+ * @param distance AB两地的距离 单位km
|
|
|
+ * @param angle AB连线与正北方向的夹角(0~360)
|
|
|
+ * @return B点的经纬度
|
|
|
+*/
|
|
|
+ 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));
|
|
|
+
|
|
|
+ double bjd = (dx / A.Ed + A.m_RadLo) * 180 / Math.PI;
|
|
|
+ double bwd = (dy / A.Ec + A.m_RadLa) * 180 / Math.PI;
|
|
|
+ return new MyLatLng(bjd, bwd);
|
|
|
+ }
|
|
|
+
|
|
|
class MapEditPointView : DevExpress.XtraEditors.XtraForm
|
|
|
{
|
|
|
private System.ComponentModel.IContainer components = null;
|
|
@@ -2230,7 +2324,35 @@ public static class MapControlEx
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
-
|
|
|
+ //自定义经纬度类
|
|
|
+ public class MyLatLng
|
|
|
+ {
|
|
|
+ public double Rc = 6378137; //赤道半径
|
|
|
+ public double Rj = 6356725; //极半径
|
|
|
+ public double m_LoDeg, m_LoMin, m_LoSec;
|
|
|
+ public double m_LaDeg, m_LaMin, m_LaSec;
|
|
|
+ public double m_Longitude, m_Latitude;
|
|
|
+ public double m_RadLo, m_RadLa;
|
|
|
+ public double Ec;
|
|
|
+ public double Ed;
|
|
|
+ public MyLatLng(double longitude, double latitude)
|
|
|
+ {
|
|
|
+ m_LoDeg = (int)longitude;
|
|
|
+ m_LoMin = (int)((longitude - m_LoDeg) * 60);
|
|
|
+ m_LoSec = (longitude - m_LoDeg - m_LoMin / 60) * 3600;
|
|
|
+
|
|
|
+ m_LaDeg = (int)latitude;
|
|
|
+ m_LaMin = (int)((latitude - m_LaDeg) * 60);
|
|
|
+ m_LaSec = (latitude - m_LaDeg - m_LaMin / 60) * 3600;
|
|
|
+
|
|
|
+ m_Longitude = longitude;
|
|
|
+ m_Latitude = latitude;
|
|
|
+ m_RadLo = longitude * Math.PI / 180;
|
|
|
+ m_RadLa = latitude * Math.PI / 180;
|
|
|
+ Ec = Rj + (Rc - Rj) * (90 - m_Latitude) / 90;
|
|
|
+ Ed = Ec * Math.Cos(m_RadLa);
|
|
|
+ }
|
|
|
+ }
|
|
|
#region ImageLayer数据源接口实现(本地和Http接口)
|
|
|
class ImageTileSource : IImageTileSource
|
|
|
{
|