public MyIcon2(MyGMap map, ImageSource image, GMapMarker iconContentViewer, Dictionary <string, object> iconButtonDownCommandParameter = null, double width = 22, double height = 22, bool showTipAlways = false) { this.InitializeComponent(); mapControl = map; buttonDownCommandParameter = iconButtonDownCommandParameter; this.Width = width; this.Height = height; contentViewer = iconContentViewer; this.MouseEnter += MyIcon2_MouseEnter; this.MouseLeave += MyIcon2_MouseLeave; this.MouseWheel += MyIcon2_MouseWheel; MouseLeftButtonDown += MyIcon2_MouseLeftButtonDown; if (showTipAlways) { contentViewer.Shape.Visibility = Visibility.Visible; IsHitTestVisible = false; } icon.Source = image; if (icon.Source.CanFreeze) { icon.Source.Freeze(); } }
/// <summary> /// 地图显示地震标注 /// </summary> /// <param name="gmapcontrol"></param> public void annoEqkList(GMap.NET.WindowsForms.GMapControl gmapcontrol = null) { try { int[] rowNum = this.gridView.GetSelectedRows(); double lg = 0; double la = 0; List <EqkBean> eqkMapList = new List <EqkBean>(); MyGMap.ClearAllEqkMarker(gmapcontrol); for (int index = 0; index < rowNum.Length; index++) { int i = rowNum[index]; eqkMapList.Add(eqkDataList[i]); lg += eqkDataList[i].Longtitude; la += eqkDataList[i].Latitude; } string linecode = lineTag.ToString().Split(',')[1]; string sitecode = LineBll.Instance.GetSitecodeByLinecode(linecode); double lon = double.Parse(xxkUI.Bll.SiteBll.Instance.GetNameByID("LONGTITUDE", "SITECODE", sitecode)); double lat = double.Parse(xxkUI.Bll.SiteBll.Instance.GetNameByID("LATITUDE", "SITECODE", sitecode)); MyGMap.CreateCircle(new PointLatLng(lat, lon), double.Parse(this.textEdit8.Text), double.Parse(textEdit7.Text), gmapcontrol); MyGMap.AnnotationEqkToMap(eqkMapList, gmapcontrol); gmapcontrol.Position = new PointLatLng(la / rowNum.Length, lg / rowNum.Length); gmapcontrol.Zoom = 6; } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="data">待显示数据</param> /// <param name="Marker">用于此控件显示的marker,更具自身宽高改变marker位置</param> public TooltipForMap(List <string> data, GMapMarker Marker, MyGMap control) { InitializeComponent(); this.parentMarker = Marker; this.mapControl = control; this.MouseWheel += TooltipForMap_MouseWheel; if (data == null) { return; } foreach (string subData in data) { ListBoxItem item = new ListBoxItem(); item.Height = double.NaN; item.FontSize = 12; item.Padding = new Thickness(0, 4, 0, 4); item.Content = subData; listBox.Items.Add(item); } }
public MyIcon(MyGMap map, ImageSource image, double width, double height, string tip = null, bool showTipAlways = false) { this.InitializeComponent(); mapControl = map; this.Width = width; this.Height = height; this.IsHitTestVisible = false; if (tip != null) { this.IsHitTestVisible = true; //this.ToolTip = tip; this.MouseEnter += MyIcon_MouseEnter; this.MouseLeave += MyIcon_MouseLeave; this.MouseWheel += MyIcon_MouseWheel; Popup = new Popup(); { Popup.Placement = PlacementMode.Mouse; } Label = new Label(); Popup.PlacementTarget = this; { Label.Background = Brushes.White; Label.Foreground = new SolidColorBrush(Color.FromRgb(51, 51, 51)); Label.BorderBrush = new SolidColorBrush(Color.FromRgb(170, 170, 170)); Label.BorderThickness = new Thickness(1); Label.Padding = new Thickness(5); Label.FontSize = 16; Label.Content = tip; } Popup.Child = Label; } if (showTipAlways) { Popup.Placement = PlacementMode.Center; IsHitTestVisible = false; Popup.IsOpen = true; } icon.Source = image; if (icon.Source.CanFreeze) { icon.Source.Freeze(); } }
public CloseButton(MapView mapView, MyGMap mapControl, Guid id, double width, double height) { this.InitializeComponent(); this.Width = width; this.Height = height; this._MapControl = mapControl; this._MapView = mapView; this._Id = id; this.Loaded += new RoutedEventHandler(CloseButton_Loaded); this.MouseDown += CloseButton_MouseDown; this.MouseWheel += CloseButton_MouseWheel; }
/// <summary> /// 构造函数 /// </summary> /// <param name="map">地图控件实例</param> /// <param name="width">图标宽度</param> /// <param name="height">图标高度</param> public PhoneIcon(MyGMap map, double width, double height, GMapMarker iconContentViewer) { this.InitializeComponent(); mapControl = map; this.Width = width; this.Height = height; contentViewer = iconContentViewer; iconContentViewer.Shape.Visibility = Visibility.Collapsed; this.MouseEnter += PhoneIcon_MouseEnter; this.MouseLeave += PhoneIcon_MouseLeave; this.MouseWheel += PhoneIcon_MouseWheel; this.MouseLeftButtonDown += PhoneIcon_MouseLeftButtonDown; this.MouseLeftButtonUp += PhoneIcon_MouseLeftButtonUp; icon.Source = new BitmapImage(IconDictionaryHelper.iconDictionary[IconDictionaryHelper.Icons.Phone]); if (icon.Source.CanFreeze) { icon.Source.Freeze(); } }