private void itemTrack_Click(object sender, RoutedEventArgs e) { if (tv_PersonPlan.SelectedItem != null) { PP_OrgInfo orgInfo = tv_PersonPlan.SelectedItem as PP_OrgInfo; if (orgInfo != null) { //先查有没有车,或者车牌 PP_VehicleInfo itemVehicle = null; PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.PersonSchedule.I_CO_IA_PersonSchedule>(channel => { //更新当前节点 itemVehicle = channel.GetPP_VehicleInfo(orgInfo.GUID); }); if (itemVehicle != null && !string.IsNullOrEmpty(itemVehicle.VEHICLE_NUMB)) { OrgToMapStyle group = new OrgToMapStyle(orgInfo); Track.TrackCondition conTrack = new Track.TrackCondition(group); conTrack.VehicleNum = itemVehicle.VEHICLE_NUMB; conTrack.Owner = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(this); conTrack.Show(); } else { MessageBox.Show("没有查询到车辆信息!"); } } } }
/// <summary> /// 查看移动轨迹 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void itemTrack_Click(object sender, RoutedEventArgs e) { MenuItem item = sender as MenuItem; ContextMenu menu = item.Parent as ContextMenu; var target = menu.PlacementTarget as OrgToMapStyle; if (target != null) { PP_OrgInfo orgInfo = target.OrgInfo; //先查有没有车,或者车牌 PP_VehicleInfo itemVehicle = null; PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.PersonSchedule.I_CO_IA_PersonSchedule>(channel => { //更新当前节点 itemVehicle = channel.GetPP_VehicleInfo(orgInfo.GUID); }); if (itemVehicle != null && !string.IsNullOrEmpty(itemVehicle.VEHICLE_NUMB)) { OrgToMapStyle group = new OrgToMapStyle(orgInfo); Track.TrackCondition conTrack = new Track.TrackCondition(group); conTrack.VehicleNum = itemVehicle.VEHICLE_NUMB; conTrack.Owner = VisualTreeHelperExtension.GetParentObject <System.Windows.Window>(Element); conTrack.Show(); } else { MessageBox.Show("没有查询到车辆信息!"); } } }
private void UpdateVehicle(KeyValuePair <string, Point> item) { if (idDic.ContainsKey(item.Key)) { string groupid = idDic[item.Key]; var group = Obj.screenMap.DrawElementList.Where(o => MapGroupTypes.MonitorGroup_.ToString() + groupid == o.Key).ToArray(); if (group != null && group.Length == 1) { Obj.screenMap.MainMap.Dispatcher.BeginInvoke(new Action(() => { OrgToMapStyle orgPoint = group[0].Value as OrgToMapStyle; if (orgPoint != null) { if (orgPoint.ElementTag != null && orgPoint.ElementTag is MapPointEx) { MapPointEx p = orgPoint.ElementTag as MapPointEx; if (p.X != item.Value.X || p.Y != item.Value.Y) { //移动位置 Obj.screenMap.RemoveElement(MapGroupTypes.MonitorGroup_.ToString() + groupid); Obj.screenMap.AddElement(orgPoint, Obj.screenMap.GetMapPointEx(item.Value.X, item.Value.Y)); } } } })); } } }
/// <summary> /// 修改已绘制点的监测组状态 /// </summary> /// <param name="groupId"></param> /// <param name="online"></param> public static void SetGroupStateToMap(ClientInfo clientinfo, bool online) { if (Obj.screenMap.DrawElementList.Count > 0) { var list = Obj.screenMap.DrawElementList.Where(item => item.Key == MapGroupTypes.MonitorGroup_.ToString() + clientinfo.GroupGuid).ToArray(); if (list != null && list.Length == 1) { OrgToMapStyle orgPoint = list[0].Value as OrgToMapStyle; if (orgPoint != null) { orgPoint.OrgInfo.OnLine = online; orgPoint.clientInfo = clientinfo; } } } Obj.mainPanel.ChangeGroupState(clientinfo.GroupGuid, online); }
private void UpdatePerson(KeyValuePair <string, Point> item) { //根据对象ID找组 if (idDic.ContainsKey(item.Key)) { string groupid = idDic[item.Key]; var person = Obj.screenMap.DrawElementList.Where(o => MapGroupTypes.Person_.ToString() + item.Key == o.Key).ToArray(); if (person != null && person.Length == 1) { Obj.screenMap.MainMap.Dispatcher.BeginInvoke(new Action(() => { //修改位置 PersonPoint personPoint = person[0].Value as PersonPoint; if (personPoint != null) { if (personPoint.ElementTag != null && personPoint.ElementTag is MapPointEx) { MapPointEx p = personPoint.ElementTag as MapPointEx; if (p.X != item.Value.X || p.Y != item.Value.Y) { //移动位置 Obj.screenMap.RemoveElement(MapGroupTypes.Person_.ToString() + item.Key); Obj.screenMap.AddElement(personPoint, Obj.screenMap.GetMapPointEx(item.Value.X, item.Value.Y)); } } } })); } else { //添加 var group = Obj.screenMap.DrawElementList.Where(o => MapGroupTypes.MonitorGroup_.ToString() + groupid == o.Key).ToArray(); if (group != null && group.Length == 1) { Obj.screenMap.MainMap.Dispatcher.BeginInvoke(new Action(() => { OrgToMapStyle orgPoint = group[0].Value as OrgToMapStyle; PP_OrgInfo orginfo = orgPoint.OrgInfo; PersonPoint personPoint = new PersonPoint(orginfo, ObjDic[item.Key] as PP_PersonInfo); personPoint.ContextMenu = GetContextMenu(); Obj.screenMap.AddElement(personPoint, Obj.screenMap.GetMapPointEx(item.Value.X, item.Value.Y)); })); } } } }
/// <summary> /// 绘制组,获取当前活动时的小组信息 /// </summary> /// <param name="map"></param> /// <param name="_activityGuid"></param> /// <param name="stageType"></param> public static void DrawOrgsToMap(MapGIS map, string _activityGuid, ActivityStage stageType, ContextMenu menu = null) { map.RemoveElementByFlag(MapGroupTypes.MonitorGroup_.ToString()); ScheduleDetail[] scheduleDetails = Utility.getOrgGroupsBySchedule(_activityGuid, stageType); if (scheduleDetails != null && scheduleDetails.Length > 0) { foreach (ScheduleDetail detail in scheduleDetails) { PP_OrgInfo orginfo = detail.ScheduleOrgs[0].OrgInfo; orginfo.OnLine = null; OrgToMapStyle group = new OrgToMapStyle(orginfo); if (menu != null) { group.ContextMenu = menu; } map.AddElement(group, map.GetMapPointEx(detail.ScheduleOrgs[0].LONGITUDE, detail.ScheduleOrgs[0].LATITUDE)); } } }
/// <summary> /// 初始调用,设置初始状态 /// </summary> /// <param name="online"></param> public static void SetGroupAllStateToMap(bool online) { if (Obj.screenMap.DrawElementList.Count > 0) { var list = Obj.screenMap.DrawElementList.Where(item => item.Key.StartsWith(MapGroupTypes.MonitorGroup_.ToString())).ToArray(); if (list != null && list.Length > 0) { foreach (var item in list) { OrgToMapStyle orgPoint = item.Value as OrgToMapStyle; if (orgPoint != null) { orgPoint.OrgInfo.OnLine = online; orgPoint.OrgInfo.NAME = orgPoint.OrgInfo.NAME; } } } } Obj.mainPanel.ChangeGroupState(null, false); }
private void LocationItem_Click(object sender, RoutedEventArgs e) { if (tv_PersonPlan.SelectedItem != null) { PP_OrgInfo orginfo = tv_PersonPlan.SelectedItem as PP_OrgInfo; if (orginfo != null) { var org = Obj.screenMap.DrawElementList.Where(item => item.Key == MapGroupTypes.MonitorGroup_.ToString() + orginfo.GUID).ToArray(); if (org != null && org.Length == 1) { OrgToMapStyle orgPoint = org[0].Value as OrgToMapStyle; if (orgPoint != null) { MapPointEx p = orgPoint.ElementTag as MapPointEx; if (p != null) { Obj.screenMap.setExtent(p); } } } } } }