|
@@ -379,7 +379,7 @@ public static class MapControlEx
|
|
|
/// <param name="img"></param>
|
|
|
/// <param name="action">一个回调,参数为选中的定位点</param>
|
|
|
/// <returns></returns>
|
|
|
- public static MapControl AddPosMenu<T>(this MapControl ctrl, string caption, SvgImage img, Action<T> action) where T : PosData, new()
|
|
|
+ public static MapControl AddPosMenu<T>(this MapControl ctrl, string caption, SvgImage img, Action<T> action, Func<T, bool> showCondition = null) where T : PosData, new()
|
|
|
{
|
|
|
var btnCustom = new BarButtonItem() { Caption = caption };
|
|
|
btnCustom.ImageOptions.SvgImage = img;
|
|
@@ -394,6 +394,20 @@ public static class MapControlEx
|
|
|
|
|
|
innerData.posMenu.LinksPersistInfo.Add(new LinkPersistInfo(btnCustom));
|
|
|
innerData.barM.EndInit();
|
|
|
+ innerData.posMenu.BeforePopup += (sender, e) =>
|
|
|
+ {
|
|
|
+ if (showCondition == null)
|
|
|
+ btnCustom.Visibility = BarItemVisibility.Always;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool showBtn = showCondition((T)innerData.preSelectedItem.Tag);
|
|
|
+ if (showBtn)
|
|
|
+ btnCustom.Visibility = BarItemVisibility.Always;
|
|
|
+ else
|
|
|
+ btnCustom.Visibility = BarItemVisibility.Never;
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
return ctrl;
|
|
|
}
|
|
|
|
|
@@ -796,7 +810,7 @@ public static class MapControlEx
|
|
|
var btnHJ = new BarButtonItem() { Caption = "航迹" };
|
|
|
btnHJ.ImageOptions.SvgImage = SvgHelper.CreateMarkDot();
|
|
|
btnHJ.Tag = ctrl;
|
|
|
-
|
|
|
+
|
|
|
var innerData = ctrl.Tag as InnerData;
|
|
|
innerData.onClickChanged = onClickChanged;
|
|
|
btnHJ.ItemClick += (sender, e) =>
|
|
@@ -836,7 +850,7 @@ public static class MapControlEx
|
|
|
Size = _dotSize,
|
|
|
Tag = item,
|
|
|
Location = new GeoPoint(item.PosLat, item.PosLon),
|
|
|
- ToolTipPattern="dd"
|
|
|
+ ToolTipPattern = "dd"
|
|
|
};
|
|
|
innerData.mMapStorage.Items.Add(mapItem);
|
|
|
|
|
@@ -1356,7 +1370,7 @@ public static class MapControlEx
|
|
|
Visible = true,
|
|
|
IsHitTestVisible = true,
|
|
|
Tag = $"{identify}{title}",
|
|
|
- ToolTipPattern= title,
|
|
|
+ ToolTipPattern = title,
|
|
|
|
|
|
};
|
|
|
foreach (var item in lines)
|
|
@@ -1561,15 +1575,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));
|