public bool ExistMapLocation(string orgguid) { MapPlace place = ActivityMap.ShowMap.DrawElementList.FirstOrDefault(r => r.Key == orgguid).Value as MapPlace; if (place != null) { ActivityMap.ShowMap.MainMap.Location(place.MapPoint); return(true); } else { return(false); } }
private void MainMap_Drop(object sender, DragEventArgs e) { if (OrgInfo != null) { Point scpoint = e.GetPosition(this); MapPointEx currentmappoint = ActivityMap.ShowMap.MainMap.ScreenToMap(new PointEx(scpoint.X, scpoint.Y)); string placeid = ActivityMap.GetMouseLocationPlaceID(currentmappoint.X, currentmappoint.Y); if (string.IsNullOrEmpty(placeid)) { MessageBoxResult msgresult = MessageBox.Show("当前地点不是活动区域,是否手动选择地点?", "提示", MessageBoxButton.YesNo); if (msgresult == MessageBoxResult.Yes) { SelectPlaceDialog selectplace = new SelectPlaceDialog(); selectplace.WindowStartupLocation = WindowStartupLocation.CenterScreen; selectplace.SelectedPlaceChangeEvent += (currentplaceId) => { ActivityMap.CurrentPlaceId = currentplaceId; }; selectplace.SelectedPlaceEvent += (placeguid) => { placeid = placeguid; ActivityMap.CurrentPlaceId = null; }; selectplace.ShowDialog(this); } } MapPlace place = ActivityMap.ShowMap.DrawElementList.FirstOrDefault(r => r.Key == OrgInfo.GUID).Value as MapPlace; if (place == null) { place = new MapPlace(); place.BeforeDragPlaceEvent += OnBeforeDragPlace; place.DeletePlaceEvent += place_DeletePlaceEvent; } place.ORGinfo = OrgInfo; place.PlaceGuid = placeid; place.MapPoint = currentmappoint; SaveORGPLocation(placeid, currentmappoint); DrawORGToMap(place, currentmappoint); } }
public void SelectionLocation(string orgguid) { if (!string.IsNullOrEmpty(orgguid)) { foreach (KeyValuePair <string, object> item in ActivityMap.ShowMap.DrawElementList) { MapPlace place = item.Value as MapPlace; if (place != null) { if (place.ElementId == orgguid) { place.IsChecked = true; ActivityMap.ShowMap.MainMap.Location(place.MapPoint); } else { place.IsChecked = false; } } } } }
private void DrawORGToMap(MapPlace place, MapPointEx mappoint) { //placeMap.ShowMap.AddElement(place, placeMap.ShowMap.GetMapPointEx(mappoint.X, mappoint.Y)); }
private void DrawORGToMap(MapPlace place, MapPointEx mappoint) { ActivityMap.ShowMap.RemoveElement(place.ElementId); ActivityMap.ShowMap.AddElement(place, ActivityMap.ShowMap.GetMapPointEx(mappoint.X, mappoint.Y)); }